diff --git a/.github/ISSUE_TEMPLATE.md b/.github/ISSUE_TEMPLATE.md
deleted file mode 100644
index 51ddc7258..000000000
--- a/.github/ISSUE_TEMPLATE.md
+++ /dev/null
@@ -1,26 +0,0 @@
-感谢您提交 Issue,请在提交前仔细阅读以下信息。
-
-Issue 的内容仅可为
-* Bug 反馈
-* 功能申请
-
-若您希望得到使用指导(譬如如何删除快速搜索),请至 [G+ 社区](https://plus.google.com/u/1/communities/103823982034655188459) 发贴。若有其他问题,可在应用内找到开发者的邮箱地址,使用电子邮件与开发者交流。
-
-若内容为 Bug 反馈,请先查看 [release 页面](https://github.com/seven332/EhViewer/releases),以帮助确认该 bug 是否存在于最新版中;同时应详细描述 bug 内容与重现方法,必要时可附加截图,但请确定截图符合风序良俗。
-
-功能申请包括添加新功能与改进现有功能。
-
-一个 Issue 只包含一个 Bug 反馈或者功能申请。若有多个需求,请提交多个 Issue。
-
-尽量不提交重复的 Issue,可先进行搜索。对于重复的 Issue,开发者可能会直接关闭并添加 Duplicate 标签。
-
-
-Thank you for taking the time to submit an issue. Before you proceed, please consider the following.
-
-An issue can only be about:
-* Bug Report
-* Feature Request
-
-If you need application instructions, please post your question in [G+ community](https://plus.google.com/u/1/communities/103823982034655188459). If you have other questions, please get the developer's email address in the application, and send him/her an email.
-
-One issue one bug report or feature request.
diff --git a/.github/ISSUE_TEMPLATE/-------feature-request.md b/.github/ISSUE_TEMPLATE/-------feature-request.md
new file mode 100644
index 000000000..1c51bcc30
--- /dev/null
+++ b/.github/ISSUE_TEMPLATE/-------feature-request.md
@@ -0,0 +1,20 @@
+---
+name: 功能申请 / Feature request
+about: 有个想法 / Suggest an idea for this project
+title: ''
+labels: ''
+assignees: ''
+
+---
+
+**这个功能是用来解决问题的吗? / Is your feature request related to a problem? Please describe.**
+描述这个问题。
+A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
+
+**描述你想要的解决方法 / Describe the solution you'd like**
+描述应通过何种行为来解决这个问题。
+A clear and concise description of what you want to happen.
+
+**备注 / Additional context**
+还有别的想说的吗?
+Add any other context or screenshots about the feature request here.
diff --git a/.github/ISSUE_TEMPLATE/bug------bug-report.md b/.github/ISSUE_TEMPLATE/bug------bug-report.md
new file mode 100644
index 000000000..698923bad
--- /dev/null
+++ b/.github/ISSUE_TEMPLATE/bug------bug-report.md
@@ -0,0 +1,41 @@
+---
+name: Bug 反馈 / Bug report
+about: 出问题了 / Create a report to help us improve
+title: ''
+labels: ''
+assignees: ''
+
+---
+
+**简略描述 / Describe the bug**
+大概说下是什么问题。
+A clear and concise description of what the bug is.
+
+**如何重现 / To Reproduce**
+重现的步骤:
+1. 打开什么什么
+2. 点击什么什么
+3. 出现什么什么问题
+Steps to reproduce the behavior:
+1. Go to '...'
+2. Click on '....'
+3. Scroll down to '....'
+4. See error
+
+**预期行为 / Expected behavior**
+应该是什么样子的?
+A clear and concise description of what you expected to happen.
+
+**截图 / Screenshots**
+能截图的话就发截图,请注意风序良俗。
+If applicable, add screenshots to help explain your problem.
+
+**设备型号与 Android 版本 / Device model and Android version**
+ - 设备型号:【比如 Pixel 6 XXXL】
+ - Android 版本:【比如 Android 12.1】
+ - Device model: [e.g. Pixel 6 XXXL]
+ - Android version: [e.g. Android 12.1]
+
+**备注 / Additional context**
+还有什么想说的?
+Add any other context about the problem here.
diff --git a/.github/ISSUE_TEMPLATE/sad-panda----------slow-download-speed.md b/.github/ISSUE_TEMPLATE/sad-panda----------slow-download-speed.md
new file mode 100644
index 000000000..c8475236c
--- /dev/null
+++ b/.github/ISSUE_TEMPLATE/sad-panda----------slow-download-speed.md
@@ -0,0 +1,11 @@
+---
+name: Sad Panda / 下载太慢 / Slow download speed
+about: 所有其他问题 / All other questions
+title: ''
+labels: ''
+assignees: ''
+
+---
+
+加入我们的 Telegram 群组,[https://t.me/ehviewer](https://t.me/ehviewer)。温柔[大小]姐姐手把手帮你解决问题。
+Join our Telegram group, [https://t.me/ehviewer](https://t.me/ehviewer). Administrators will help you solve the problem.
diff --git a/.gitignore b/.gitignore
index 28bbe8f98..cee31a082 100644
--- a/.gitignore
+++ b/.gitignore
@@ -6,3 +6,5 @@
*.iml
.idea
/captures
+release
+google-services.json
diff --git a/README.md b/README.md
index f43bc2e41..d7ebcda19 100644
--- a/README.md
+++ b/README.md
@@ -1,3 +1,7 @@
+# DEPRECATED
+
+[](https://t.me/ehviewer)
+
# EhViewer

@@ -31,6 +35,13 @@ Linux
The apk is in app\build\outputs\apk
+# Download
+
+[下载](https://github.com/seven332/EhViewer/releases)
+
+[Download](https://github.com/seven332/EhViewer/releases)
+
+
# Thanks
本项目受到了诸多开源项目的帮助
@@ -55,7 +66,7 @@ Here is the libraries
# License
- Copyright (C) 2014-2016 Hippo Seven
+ Copyright (C) 2014-2019 Hippo Seven
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
diff --git a/app/build.gradle b/app/build.gradle
index bcc651249..81fdefad4 100644
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -1,31 +1,48 @@
-import com.android.build.gradle.internal.tasks.DefaultAndroidTask
-
apply plugin: 'com.android.application'
-apply plugin: 'android-chinese-string'
+
+if (file('google-services.json').exists()) {
+ apply plugin: 'com.google.gms.google-services'
+ apply plugin: 'io.fabric'
+}
android {
- compileSdkVersion 25
- buildToolsVersion "25.0.3"
+ compileSdkVersion 28
defaultConfig {
applicationId "com.hippo.ehviewer"
minSdkVersion 14
- targetSdkVersion 25
- versionCode 77
- versionName "1.0.24"
+ targetSdkVersion 28
+ versionCode 104
+ versionName "1.7.3"
vectorDrawables.useSupportLibrary = true
resConfigs "zh", "zh-rCN", "zh-rHK", "zh-rTW",
- "es"
+ "es", "ja", "ko", "fr", "de", "th"
+ testOptions.unitTests.includeAndroidResources = true
+ ndk {
+ abiFilters "armeabi-v7a", "x86"
+ }
+ }
+
+ compileOptions {
+ sourceCompatibility JavaVersion.VERSION_1_8
+ targetCompatibility JavaVersion.VERSION_1_8
}
lintOptions {
+ disable 'MissingTranslation'
abortOnError true
+ checkReleaseBuilds true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
+ buildConfigField 'String', 'FILE_PROVIDER_AUTHORITY', '"com.hippo.ehviewer.fileprovider"'
+ }
+ debug {
+ applicationIdSuffix ".debug"
+ buildConfigField 'String', 'FILE_PROVIDER_AUTHORITY', '"com.hippo.ehviewer.debug.fileprovider"'
}
}
@@ -42,7 +59,7 @@ task copyNotice(type: Copy) {
finalizedBy ":daogenerator:executeDaoGenerator"
}
-tasks.withType(DefaultAndroidTask) {
+tasks.withType(JavaCompile) {
task -> task.dependsOn copyNotice
}
@@ -51,35 +68,52 @@ clean {
}
dependencies {
- compile fileTree(include: ['*.jar'], dir: 'libs')
- compile "com.android.support:appcompat-v7:$supportLibrary"
- compile "com.android.support:design:$supportLibrary"
- compile 'com.github.amlcurran.showcaseview:library:5.4.3'
- compile 'com.github.seven332:android-recaptcha:2bbb3459a8'
- compile 'com.github.seven332:animator:0.1.0'
- compile 'com.github.seven332:beerbelly:0.1.4'
- compile 'com.github.seven332:conaco:0.1.5-eh'
- compile 'com.github.seven332:drawerlayout:0.2.1'
- compile 'com.github.seven332:easyrecyclerview:0.1.1'
- compile 'com.github.seven332:glgallery:0.1.2'
- compile 'com.github.seven332:glview:0.1.0'
- compile 'com.github.seven332:glview-image:0.1.0'
- compile 'com.github.seven332:hotspot:0.1.0'
- compile 'com.github.seven332:image:0.1.12'
- compile 'com.github.seven332:okhttp:3.5.0'
- compile 'com.github.seven332:refreshlayout:0.1.0'
- compile 'com.github.seven332:ripple:0.1.2'
- compile 'com.github.seven332:streampipe:0.1.0'
- compile 'com.github.seven332:tuxiang:0.1.2'
- compile 'com.github.seven332:unifile:0.2.0'
- compile 'com.github.seven332:yorozuya:0.1.2'
- compile 'com.github.seven332:yorozuya-thread:0.1.1'
- compile 'com.github.seven332:yorozuya-collect:0.1.4'
- compile 'com.h6ah4i.android.widget.advrecyclerview:advrecyclerview:0.9.2'
- compile 'org.ccil.cowan.tagsoup:tagsoup:1.2.1'
- compile 'org.greenrobot:greendao:2.2.0'
- compile 'org.jsoup:jsoup:1.9.2'
- testCompile 'junit:junit:4.12'
- testCompile 'org.robolectric:robolectric:3.4'
- testCompile 'org.jooq:joor:0.9.6'
+ implementation fileTree(include: ['*.jar'], dir: 'libs')
+ implementation 'androidx.appcompat:appcompat:1.0.2'
+ implementation 'androidx.cardview:cardview:1.0.0'
+ implementation 'com.google.android.material:material:1.0.0'
+ implementation 'com.google.firebase:firebase-core:16.0.9'
+ implementation 'com.crashlytics.sdk.android:crashlytics:2.10.1'
+ implementation 'com.getkeepsafe.relinker:relinker:1.3.1'
+ implementation 'com.github.amlcurran.showcaseview:library:5.4.3'
+ implementation 'com.github.seven332.a7zip:extract-lite:d4ddec5793'
+ implementation 'com.github.seven332:android-recaptcha:2bbb3459a8'
+ implementation 'com.github.seven332:android-resource:0.1.0'
+ implementation 'com.github.seven332:animator:0.1.0'
+ implementation 'com.github.seven332:beerbelly:0.1.4'
+ implementation 'com.github.seven332:conaco:0.1.5-eh'
+ implementation 'com.github.seven332:drawerlayout:ea2bb388f0'
+ implementation 'com.github.seven332:easyrecyclerview:0.1.1'
+ implementation 'com.github.seven332:glgallery:0.1.2'
+ implementation 'com.github.seven332:glview:0.1.0'
+ implementation 'com.github.seven332:glview-image:0.1.0'
+ implementation 'com.github.seven332:hotspot:0.1.0'
+ implementation 'com.github.seven332:image:0.1.12'
+ implementation 'com.github.seven332:refreshlayout:0.1.0'
+ implementation 'com.github.seven332:ripple:0.1.2'
+ implementation 'com.github.seven332:streampipe:0.1.0'
+ implementation 'com.github.seven332:tuxiang:0.1.6'
+ implementation 'com.github.seven332:unifile:9ec57bcd8f'
+ implementation 'com.github.seven332:yorozuya:0.1.2'
+ implementation 'com.github.seven332:yorozuya-thread:0.1.1'
+ implementation 'com.github.seven332:yorozuya-collect:0.1.4'
+ implementation 'com.h6ah4i.android.widget.advrecyclerview:advrecyclerview:1.0.0'
+ implementation 'com.squareup.okhttp3:okhttp:3.12.3'
+ implementation 'org.ccil.cowan.tagsoup:tagsoup:1.2.1'
+ implementation 'org.greenrobot:greendao:2.2.1'
+ implementation 'org.jsoup:jsoup:1.12.1'
+ testImplementation 'junit:junit:4.12'
+ testImplementation 'org.robolectric:robolectric:4.2.1'
+ testImplementation 'org.jooq:joor:0.9.6'
+}
+
+configurations.all {
+ resolutionStrategy {
+ force 'com.github.seven332:glgallery:25893283ca'
+ force 'com.github.seven332:glview:ba6aee61d7'
+ force 'com.github.seven332:glview-image:68d94b0fc2'
+ force 'com.github.seven332:image:09b43c0c68'
+
+ exclude group: 'com.github.seven332', module: 'okhttp'
+ }
}
diff --git a/app/libs/libGoogleAnalyticsServices.jar b/app/libs/libGoogleAnalyticsServices.jar
deleted file mode 100644
index 082a9180e..000000000
Binary files a/app/libs/libGoogleAnalyticsServices.jar and /dev/null differ
diff --git a/app/src/debug/res/values-es/strings.xml b/app/src/debug/res/values-es/strings.xml
new file mode 100755
index 000000000..82d363589
--- /dev/null
+++ b/app/src/debug/res/values-es/strings.xml
@@ -0,0 +1,22 @@
+
+
+
+ When set to a non-null value the {@link #getActionBar()} method will return
- * an {@link android.support.v7.app.ActionBar} object that can be used to control the given toolbar as if it were
- * a traditional window decor action bar. The toolbar's menu will be populated with the
- * Activity's options menu and the navigation button will be wired through the standard
- * {@link android.R.id#home home} menu select action.
In order to use a Toolbar within the Activity's window content the application * must not request the window feature * {@link android.view.Window#FEATURE_ACTION_BAR FEATURE_SUPPORT_ACTION_BAR}.
* - * @param toolbar Toolbar to set as the Activity's action bar + * @param toolbar Toolbar to set as the Activity's action bar, or {@code null} to clear it */ public void setSupportActionBar(@Nullable Toolbar toolbar) { getDelegate().setSupportActionBar(toolbar); } - @NonNull @Override public MenuInflater getMenuInflater() { return getDelegate().getMenuInflater(); @@ -117,6 +147,24 @@ public void addContentView(View view, ViewGroup.LayoutParams params) { public void onConfigurationChanged(Configuration newConfig) { super.onConfigurationChanged(newConfig); getDelegate().onConfigurationChanged(newConfig); + if (mResources != null) { + // The real (and thus managed) resources object was already updated + // by ResourcesManager, so pull the current metrics from there. + final DisplayMetrics newMetrics = super.getResources().getDisplayMetrics(); + mResources.updateConfiguration(newConfig, newMetrics); + } + } + + @Override + protected void onPostResume() { + super.onPostResume(); + getDelegate().onPostResume(); + } + + @Override + protected void onStart() { + super.onStart(); + getDelegate().onStart(); } @Override @@ -125,10 +173,10 @@ protected void onStop() { getDelegate().onStop(); } + @SuppressWarnings("TypeParameterUnusedInFormals") @Override - protected void onPostResume() { - super.onPostResume(); - getDelegate().onPostResume(); + publicThe default implementation of this method adds the parent chain of this activity - * as specified in the manifest to the supplied {@link android.support.v4.app.TaskStackBuilder}. Applications + * as specified in the manifest to the supplied {@link androidx.core.app.TaskStackBuilder}. Applications * may choose to override this method to construct the desired task stack in a different * way.
* @@ -243,12 +326,12 @@ public ActionMode startSupportActionMode(ActionMode.Callback callback) { * *Applications that wish to supply extra Intent parameters to the parent stack defined * by the manifest should override - * {@link #onPrepareSupportNavigateUpTaskStack(android.support.v4.app.TaskStackBuilder)}.
+ * {@link #onPrepareSupportNavigateUpTaskStack(androidx.core.app.TaskStackBuilder)}. * * @param builder An empty TaskStackBuilder - the application should add intents representing * the desired task stack */ - public void onCreateSupportNavigateUpTaskStack(TaskStackBuilder builder) { + public void onCreateSupportNavigateUpTaskStack(@NonNull TaskStackBuilder builder) { builder.addParentStack(this); } @@ -259,15 +342,15 @@ public void onCreateSupportNavigateUpTaskStack(TaskStackBuilder builder) { * Prepare the synthetic task stack that will be generated during Up navigation * from a different task. * - *This method receives the {@link android.support.v4.app.TaskStackBuilder} with the constructed series of - * Intents as generated by {@link #onCreateSupportNavigateUpTaskStack(android.support.v4.app.TaskStackBuilder)}. + *
This method receives the {@link androidx.core.app.TaskStackBuilder} with the constructed series of + * Intents as generated by {@link #onCreateSupportNavigateUpTaskStack(androidx.core.app.TaskStackBuilder)}. * If any extra data should be added to these intents before launching the new task, * the application should override this method and add that data here.
* * @param builder A TaskStackBuilder that has been populated with Intents by * onCreateNavigateUpTaskStack. */ - public void onPrepareSupportNavigateUpTaskStack(TaskStackBuilder builder) { + public void onPrepareSupportNavigateUpTaskStack(@NonNull TaskStackBuilder builder) { } /** @@ -278,7 +361,7 @@ public void onPrepareSupportNavigateUpTaskStack(TaskStackBuilder builder) { * default Up navigation will be handled automatically. See * {@link #getSupportParentActivityIntent()} for how to specify the parent. If any activity * along the parent chain requires extra Intent arguments, the Activity subclass - * should override the method {@link #onPrepareSupportNavigateUpTaskStack(android.support.v4.app.TaskStackBuilder)} + * should override the method {@link #onPrepareSupportNavigateUpTaskStack(androidx.core.app.TaskStackBuilder)} * to supply those arguments. * *See Tasks and @@ -286,7 +369,7 @@ public void onPrepareSupportNavigateUpTaskStack(TaskStackBuilder builder) { * Navigation from the design guide * for more information about navigating within your app.
* - *See the {@link android.support.v4.app.TaskStackBuilder} class and the Activity methods + *
See the {@link androidx.core.app.TaskStackBuilder} class and the Activity methods * {@link #getSupportParentActivityIntent()}, {@link #supportShouldUpRecreateTask(android.content.Intent)}, and * {@link #supportNavigateUpTo(android.content.Intent)} for help implementing custom Up navigation.
* @@ -322,15 +405,15 @@ public boolean onSupportNavigateUp() { /** * Obtain an {@link android.content.Intent} that will launch an explicit target activity - * specified by sourceActivity's {@link android.support.v4.app.NavUtils#PARENT_ACTIVITY} <meta-data> + * specified by sourceActivity's {@link androidx.core.app.NavUtils#PARENT_ACTIVITY} <meta-data> * element in the application's manifest. If the device is running * Jellybean or newer, the android:parentActivityName attribute will be preferred * if it is present. * * @return a new Intent targeting the defined parent activity of sourceActivity */ - @Override @Nullable + @Override public Intent getSupportParentActivityIntent() { return NavUtils.getParentActivityIntent(this); } @@ -342,13 +425,13 @@ public Intent getSupportParentActivityIntent() { *If this method returns false the app can trivially call * {@link #supportNavigateUpTo(android.content.Intent)} using the same parameters to correctly perform * up navigation. If this method returns false, the app should synthesize a new task stack - * by using {@link android.support.v4.app.TaskStackBuilder} or another similar mechanism to perform up navigation.
+ * by using {@link androidx.core.app.TaskStackBuilder} or another similar mechanism to perform up navigation. * * @param targetIntent An intent representing the target destination for up navigation * @return true if navigating up should recreate a new task stack, false if the same task * should be used for the destination */ - public boolean supportShouldUpRecreateTask(Intent targetIntent) { + public boolean supportShouldUpRecreateTask(@NonNull Intent targetIntent) { return NavUtils.shouldUpRecreateTask(this, targetIntent); } @@ -364,7 +447,7 @@ public boolean supportShouldUpRecreateTask(Intent targetIntent) { * * @param upIntent An intent representing the target destination for up navigation */ - public void supportNavigateUpTo(Intent upIntent) { + public void supportNavigateUpTo(@NonNull Intent upIntent) { NavUtils.navigateUpTo(this, upIntent); } @@ -374,13 +457,114 @@ public ActionBarDrawerToggle.Delegate getDrawerToggleDelegate() { return getDelegate().getDrawerToggleDelegate(); } + /** + * {@inheritDoc} + * + *Please note: AppCompat uses its own feature id for the action bar: + * {@link AppCompatDelegate#FEATURE_SUPPORT_ACTION_BAR FEATURE_SUPPORT_ACTION_BAR}.
+ */ + @Override + public boolean onMenuOpened(int featureId, Menu menu) { + return super.onMenuOpened(featureId, menu); + } + + /** + * {@inheritDoc} + * + *Please note: AppCompat uses its own feature id for the action bar: + * {@link AppCompatDelegate#FEATURE_SUPPORT_ACTION_BAR FEATURE_SUPPORT_ACTION_BAR}.
+ */ + @Override + public void onPanelClosed(int featureId, Menu menu) { + super.onPanelClosed(featureId, menu); + } + + @Override + protected void onSaveInstanceState(Bundle outState) { + super.onSaveInstanceState(outState); + getDelegate().onSaveInstanceState(outState); + } + /** * @return The {@link AppCompatDelegate} being used by this Activity. */ + @NonNull public AppCompatDelegate getDelegate() { if (mDelegate == null) { mDelegate = AppCompatDelegate.create(this, this); } return mDelegate; } + + @SuppressLint("RestrictedApi") + @Override + public boolean dispatchKeyEvent(KeyEvent event) { + // Let support action bars open menus in response to the menu key prioritized over + // the window handling it + final int keyCode = event.getKeyCode(); + final ActionBar actionBar = getSupportActionBar(); + if (keyCode == KeyEvent.KEYCODE_MENU + && actionBar != null && actionBar.onMenuKeyEvent(event)) { + return true; + } + return super.dispatchKeyEvent(event); + } + + @SuppressLint("RestrictedApi") + @Override + public Resources getResources() { + if (mResources == null && VectorEnabledTintResources.shouldBeUsed()) { + mResources = new VectorEnabledTintResources(this, super.getResources()); + } + return mResources == null ? super.getResources() : mResources; + } + + /** + * KeyEvents with non-default modifiers are not dispatched to menu's performShortcut in API 25 + * or lower. Here, we check if the keypress corresponds to a menuitem's shortcut combination + * and perform the corresponding action. + */ + private boolean performMenuItemShortcut(int keycode, KeyEvent event) { + if (!(Build.VERSION.SDK_INT >= 26) && !event.isCtrlPressed() + && !KeyEvent.metaStateHasNoModifiers(event.getMetaState()) + && event.getRepeatCount() == 0 + && !KeyEvent.isModifierKey(event.getKeyCode())) { + final Window currentWindow = getWindow(); + if (currentWindow != null && currentWindow.getDecorView() != null) { + final View decorView = currentWindow.getDecorView(); + if (decorView.dispatchKeyShortcutEvent(event)) { + return true; + } + } + } + return false; + } + + @Override + public boolean onKeyDown(int keyCode, KeyEvent event) { + if (performMenuItemShortcut(keyCode, event)) { + return true; + } + return super.onKeyDown(keyCode, event); + } + + @SuppressLint("RestrictedApi") + @Override + public void openOptionsMenu() { + ActionBar actionBar = getSupportActionBar(); + if (getWindow().hasFeature(Window.FEATURE_OPTIONS_PANEL) + && (actionBar == null || !actionBar.openOptionsMenu())) { + super.openOptionsMenu(); + } + } + + @SuppressLint("RestrictedApi") + @Override + public void closeOptionsMenu() { + ActionBar actionBar = getSupportActionBar(); + if (getWindow().hasFeature(Window.FEATURE_OPTIONS_PANEL) + && (actionBar == null || !actionBar.closeOptionsMenu())) { + super.closeOptionsMenu(); + } + } } diff --git a/app/src/main/java/com/hippo/app/CheckBoxDialogBuilder.java b/app/src/main/java/com/hippo/app/CheckBoxDialogBuilder.java index 34af8a97b..ca9a4c9d4 100644 --- a/app/src/main/java/com/hippo/app/CheckBoxDialogBuilder.java +++ b/app/src/main/java/com/hippo/app/CheckBoxDialogBuilder.java @@ -18,12 +18,11 @@ import android.annotation.SuppressLint; import android.content.Context; -import android.support.v7.app.AlertDialog; import android.view.LayoutInflater; import android.view.View; import android.widget.CheckBox; import android.widget.TextView; - +import androidx.appcompat.app.AlertDialog; import com.hippo.ehviewer.R; public class CheckBoxDialogBuilder extends AlertDialog.Builder { diff --git a/app/src/main/java/com/hippo/app/EditTextDialogBuilder.java b/app/src/main/java/com/hippo/app/EditTextDialogBuilder.java index 750bc39bf..4c89ce9d3 100644 --- a/app/src/main/java/com/hippo/app/EditTextDialogBuilder.java +++ b/app/src/main/java/com/hippo/app/EditTextDialogBuilder.java @@ -19,15 +19,14 @@ import android.annotation.SuppressLint; import android.content.Context; import android.content.DialogInterface; -import android.support.design.widget.TextInputLayout; -import android.support.v7.app.AlertDialog; import android.view.KeyEvent; import android.view.LayoutInflater; import android.view.View; import android.widget.Button; import android.widget.EditText; import android.widget.TextView; - +import androidx.appcompat.app.AlertDialog; +import com.google.android.material.textfield.TextInputLayout; import com.hippo.ehviewer.R; public class EditTextDialogBuilder extends AlertDialog.Builder implements EditText.OnEditorActionListener { diff --git a/app/src/main/java/com/hippo/app/ListCheckBoxDialogBuilder.java b/app/src/main/java/com/hippo/app/ListCheckBoxDialogBuilder.java index ebdb09763..a84822787 100644 --- a/app/src/main/java/com/hippo/app/ListCheckBoxDialogBuilder.java +++ b/app/src/main/java/com/hippo/app/ListCheckBoxDialogBuilder.java @@ -18,14 +18,13 @@ import android.annotation.SuppressLint; import android.content.Context; -import android.support.v7.app.AlertDialog; import android.view.LayoutInflater; import android.view.View; import android.widget.AdapterView; import android.widget.ArrayAdapter; import android.widget.CheckBox; import android.widget.ListView; - +import androidx.appcompat.app.AlertDialog; import com.hippo.ehviewer.R; import com.hippo.yorozuya.ViewUtils; diff --git a/app/src/main/java/com/hippo/app/PrettyPreferenceActivity.java b/app/src/main/java/com/hippo/app/PrettyPreferenceActivity.java new file mode 100644 index 000000000..2ddb26b2c --- /dev/null +++ b/app/src/main/java/com/hippo/app/PrettyPreferenceActivity.java @@ -0,0 +1,113 @@ +/* + * Copyright 2018 Hippo Seven + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.hippo.app; + +import android.content.Context; +import android.preference.PreferenceActivity; +import android.text.TextUtils; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.widget.ArrayAdapter; +import android.widget.ImageView; +import android.widget.ListAdapter; +import android.widget.TextView; +import androidx.annotation.NonNull; +import com.hippo.ehviewer.R; +import java.util.ArrayList; +import java.util.List; + +public abstract class PrettyPreferenceActivity extends AppCompatPreferenceActivity { + + @Override + public void setListAdapter(ListAdapter adapter) { + if (adapter == null) { + super.setListAdapter(null); + return; + } + + int count = adapter.getCount(); + ListYou do not have any watched tags"); if (body.contains("No hits found
")) { result.pages = 0; //noinspection unchecked result.galleryInfoList = Collections.EMPTY_LIST; return result; + } else if (d.getElementsByClass("ptt").isEmpty()) { + result.pages = 1; } else { - throw e; + result.pages = Integer.MAX_VALUE; } } try { - Elements es = d.getElementsByClass("itg").first().child(0).children(); - List