Skip to content

Commit e87a202

Browse files
committed
代码更新,所有代码
1 parent 4661fae commit e87a202

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

54 files changed

+2911
-165
lines changed

app/build.gradle

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,11 @@ if (file('google-services.json').exists()) {
66
}
77

88
android {
9-
compileSdkVersion 30
10-
buildToolsVersion "30.0.3"
11-
ndkVersion '23.1.7779620'
9+
namespace 'com.hippo.ehviewer'
10+
testNamespace 'com.hippo.ehviewer.debug'
11+
compileSdkVersion 32
12+
// buildToolsVersion "30.0.3"
13+
// ndkVersion '23.1.7779620'
1214

1315
flavorDimensions "distribute"
1416
productFlavors {
@@ -26,10 +28,9 @@ android {
2628
//noinspection ExpiredTargetSdkVersion
2729
targetSdkVersion 29
2830
versionCode 111
29-
versionName "1.9.4.2"
31+
versionName "1.9.4.7"
3032
vectorDrawables.useSupportLibrary = true
31-
resConfigs "zh", "zh-rCN", "zh-rHK", "zh-rTW",
32-
"es", "ja", "ko", "fr", "de", "th"
33+
resConfigs 'zh', 'zh-rCN', 'zh-rHK', 'zh-rTW', 'es', 'ja', 'ko', 'fr', 'de', 'th'
3334
testOptions.unitTests.includeAndroidResources = true
3435
ndk {
3536
moduleName "native-lib"
@@ -82,7 +83,6 @@ android {
8283
viewBinding true
8384
}
8485

85-
8686
}
8787

8888
task copyNotice(type: Copy) {
@@ -160,6 +160,12 @@ dependencies {
160160
testImplementation 'junit:junit:4.8.2'
161161
testImplementation 'org.robolectric:robolectric:4.2.1'
162162
testImplementation 'org.jooq:joor:0.9.6'
163+
// implementation "androidx.core:core-ktx:1.9.0"
164+
// implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
165+
166+
// https://mvnrepository.com/artifact/androidx.webkit/webkit
167+
runtimeOnly group: 'androidx.webkit', name: 'webkit', version: '1.4.0'
168+
163169
}
164170

165171
configurations.all {
@@ -172,3 +178,6 @@ configurations.all {
172178
exclude group: 'com.github.seven332', module: 'okhttp'
173179
}
174180
}
181+
//repositories {
182+
// mavenCentral()
183+
//}

app/src/debug/AndroidManifest.xml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,7 @@
1515
~ limitations under the License.
1616
-->
1717

18-
<manifest
19-
package="com.hippo.ehviewer"
20-
xmlns:android="http://schemas.android.com/apk/res/android">
18+
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
2119

2220
<application>
2321

app/src/main/AndroidManifest.xml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
-->
1717
<!-- android:requestLegacyExternalStorage="true"-->
1818
<manifest xmlns:tools="http://schemas.android.com/tools"
19-
package="com.hippo.ehviewer"
2019
xmlns:android="http://schemas.android.com/apk/res/android">
2120

2221
<uses-permission android:name="android.permission.INTERNET"/>

app/src/main/cpp/gif/native-lib.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -327,7 +327,7 @@ Java_com_hippo_util_GifHandler_updateFrame__JLandroid_graphics_Bitmap_2(JNIEnv *
327327
// LOGE("当前帧 %d ", gifBean->current_frame);
328328
if (gifBean->current_frame >= gifBean->total_frame - 1) {
329329
gifBean->current_frame = 0;
330-
LOGE("重新过来 %d ", gifBean->current_frame);
330+
// LOGE("重新过来 %d ", gifBean->current_frame);
331331
}
332332
AndroidBitmap_unlockPixels(env, bitmap);
333333
return gifBean->dealys[gifBean->current_frame];

app/src/main/java/com/hippo/ehviewer/EhApplication.java

Lines changed: 35 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@
4646
import com.hippo.ehviewer.client.EhCookieStore;
4747
import com.hippo.ehviewer.client.EhDns;
4848
import com.hippo.ehviewer.client.EhEngine;
49+
import com.hippo.ehviewer.client.data.EhNewsDetail;
4950
import com.hippo.ehviewer.client.data.GalleryDetail;
5051
import com.hippo.ehviewer.client.data.userTag.UserTagList;
5152
import com.hippo.ehviewer.download.DownloadManager;
@@ -59,6 +60,7 @@
5960
import com.hippo.network.StatusCodeException;
6061
import com.hippo.text.Html;
6162
import com.hippo.unifile.UniFile;
63+
import com.hippo.util.AppHelper;
6264
import com.hippo.util.BitmapUtils;
6365
import com.hippo.util.ExceptionUtils;
6466
import com.hippo.util.IoThreadPoolExecutor;
@@ -120,6 +122,8 @@ public class EhApplication extends RecordingApplication {
120122
private FavouriteStatusRouter mFavouriteStatusRouter;
121123
@Nullable
122124
private UserTagList userTagList;
125+
@Nullable
126+
private EhNewsDetail ehNewsDetail;
123127

124128
private final List<Activity> mActivityList = new ArrayList<>();
125129

@@ -348,7 +352,7 @@ public static OkHttpClient getOkHttpClient(@NonNull Context context) {
348352
}
349353
})
350354
.proxySelector(getEhProxySelector(application));
351-
if (Settings.getDF()) {
355+
if (Settings.getDF() && !AppHelper.checkVPN(context)) {
352356
if (Build.VERSION.SDK_INT < 29) {
353357
Security.insertProviderAt(Conscrypt.newProvider(), 1);
354358
builder.connectionSpecs(Collections.singletonList(ConnectionSpec.MODERN_TLS));
@@ -407,7 +411,7 @@ public static OkHttpClient getImageOkHttpClient(@NonNull Context context) {
407411
.hostnameVerifier((hostname, session) -> true)
408412
.dns(new EhDns(application))
409413
.proxySelector(getEhProxySelector(application));
410-
if (Settings.getDF()) {
414+
if (Settings.getDF() && !AppHelper.checkVPN(context)) {
411415
if (Build.VERSION.SDK_INT < 29) {
412416
Security.insertProviderAt(Conscrypt.newProvider(), 1);
413417
builder.connectionSpecs(Collections.singletonList(ConnectionSpec.MODERN_TLS));
@@ -608,48 +612,52 @@ public void unbindService(ServiceConnection conn) {
608612
}
609613
}
610614

611-
public static boolean addDownloadTorrent(@NonNull Context context,String url){
615+
public static boolean addDownloadTorrent(@NonNull Context context, String url) {
612616
EhApplication application = ((EhApplication) context.getApplicationContext());
613617

614-
if (application.torrentList.contains(url)){
618+
if (application.torrentList.contains(url)) {
615619
return false;
616620
}
617621

618622
application.torrentList.add(url);
619623
return true;
620624
}
621625

622-
public static void removeDownloadTorrent(@NonNull Context context, String url){
626+
public static void removeDownloadTorrent(@NonNull Context context, String url) {
623627
EhApplication application = ((EhApplication) context.getApplicationContext());
624628

625629
application.torrentList.remove(url);
626630
}
627631

628632
/**
629633
* 将用户订阅标签列表存入内存缓存
634+
*
630635
* @param context
631636
* @param userTagList
632637
*/
633-
public static void saveUserTagList(@NonNull Context context,UserTagList userTagList){
638+
public static void saveUserTagList(@NonNull Context context, UserTagList userTagList) {
634639
EhApplication application = ((EhApplication) context.getApplicationContext());
635640
application.userTagList = userTagList;
636641
}
637642

638643
/**
639644
* 从内存缓存中获取用户订阅标签列表
645+
*
640646
* @param context
641647
* @return
642648
*/
643-
public static UserTagList getUserTagList(@NonNull Context context){
649+
public static UserTagList getUserTagList(@NonNull Context context) {
644650
EhApplication application = ((EhApplication) context.getApplicationContext());
645651
return application.userTagList;
646652
}
647653

648-
/**
649-
* 显示eh事件
650-
* @param html
651-
*/
652-
public void showEventPane(String html) {
654+
public void showEventPane(String html){
655+
if (!Settings.getShowEhEvents()){
656+
return;
657+
}
658+
if (html==null){
659+
return;
660+
}
653661
Activity activity = getTopActivity();
654662
if (activity != null) {
655663
activity.runOnUiThread(() -> {
@@ -672,5 +680,20 @@ public void showEventPane(String html) {
672680
}
673681
}
674682

683+
/**
684+
* 显示eh事件
685+
*
686+
* @param result
687+
*/
688+
public void showEventPane(EhNewsDetail result) {
689+
ehNewsDetail = result;
690+
String html = result.getEventPane();
691+
showEventPane(html);
692+
}
693+
694+
public EhNewsDetail getEhNewsDetail(){
695+
return ehNewsDetail;
696+
}
697+
675698
}
676699

app/src/main/java/com/hippo/ehviewer/Settings.java

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -565,6 +565,18 @@ public static void putVolumePage(boolean value) {
565565
putBoolean(KEY_VOLUME_PAGE, value);
566566
}
567567

568+
569+
private static final String KEY_REVERSE_VOLUME_PAGE = "reverse_volume_page";
570+
private static final boolean DEFAULT_REVERSE_VOLUME_PAGE = false;
571+
572+
public static boolean getReverseVolumePage() {
573+
return getBoolean(KEY_REVERSE_VOLUME_PAGE, DEFAULT_REVERSE_VOLUME_PAGE);
574+
}
575+
576+
public static void putReverseVolumePage(boolean value) {
577+
putBoolean(KEY_REVERSE_VOLUME_PAGE, value);
578+
}
579+
568580
private static final String KEY_READING_FULLSCREEN = "reading_fullscreen";
569581
private static final boolean VALUE_READING_FULLSCREEN = true;
570582

@@ -1243,6 +1255,30 @@ public static void setShowGalleryComment(boolean value) {
12431255
putBoolean(KEY_SHOW_GALLERY_COMMENT, value);
12441256
}
12451257

1258+
public static final String KEY_CLOSE_AUTO_UPDATES = "close_auto_updates";
1259+
1260+
private static boolean IS_CLOSE_AUTO_UPDATES = false;
1261+
1262+
public static boolean getCloseAutoUpdate() {
1263+
return getBoolean(KEY_CLOSE_AUTO_UPDATES, IS_CLOSE_AUTO_UPDATES);
1264+
}
1265+
1266+
public static void setKeyCloseAutoUpdates(boolean value) {
1267+
putBoolean(KEY_CLOSE_AUTO_UPDATES, value);
1268+
}
1269+
1270+
public static final String KEY_SHOW_EH_EVENTS = "show_eh_events";
1271+
1272+
private static boolean IS_SHOW_EH_EVENTS = true;
1273+
1274+
public static boolean getShowEhEvents() {
1275+
return getBoolean(KEY_SHOW_EH_EVENTS, IS_SHOW_EH_EVENTS) && isLogin();
1276+
}
1277+
1278+
public static void setKeyShowEhEvents(boolean value) {
1279+
putBoolean(KEY_SHOW_EH_EVENTS, value);
1280+
}
1281+
12461282
public static final String USER_BACKGROUND_IMAGE = "background_image_path";
12471283
public static final String USER_AVATAR_IMAGE = "avatar_image_path";
12481284

app/src/main/java/com/hippo/ehviewer/client/EhEngine.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@
4242
import com.hippo.ehviewer.client.exception.ParseException;
4343
import com.hippo.ehviewer.client.parser.ArchiveParser;
4444
import com.hippo.ehviewer.client.parser.EhEventParse;
45-
import com.hippo.ehviewer.client.parser.EhNewsParse;
4645
import com.hippo.ehviewer.client.parser.FavoritesParser;
4746
import com.hippo.ehviewer.client.parser.ForumsParser;
4847
import com.hippo.ehviewer.client.parser.GalleryApiParser;
@@ -1202,7 +1201,7 @@ public static EhNewsDetail getEhNews(EhClient.Task task, OkHttpClient mOkHttpCli
12021201
return null;
12031202
}
12041203
body = response.body().string();
1205-
return EhNewsParse.parse(body);
1204+
return new EhNewsDetail(body);
12061205
} catch (IOException e) {
12071206
ExceptionUtils.throwIfFatal(e);
12081207
throwException(call, code, headers, null, e);

app/src/main/java/com/hippo/ehviewer/client/data/EhNewsDetail.java

Lines changed: 35 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,20 +3,36 @@
33
import android.os.Parcel;
44
import android.os.Parcelable;
55

6+
import org.jsoup.Jsoup;
7+
import org.jsoup.nodes.Document;
8+
import org.jsoup.nodes.Element;
9+
610
public class EhNewsDetail implements Parcelable {
7-
public String eventPane;
11+
public String webData;
12+
private String eventPane;
13+
private String htmlData;
814

915
public EhNewsDetail(){
1016
eventPane = null;
17+
this.webData = null;
18+
this.htmlData = null;
19+
}
20+
public EhNewsDetail(String webData){
21+
eventPane = null;
22+
this.webData = webData;
1123
}
1224

1325
protected EhNewsDetail(Parcel in) {
26+
this.webData = in.readString();
1427
this.eventPane = in.readString();
28+
this.htmlData = in.readString();
1529
}
1630

1731
@Override
1832
public void writeToParcel(Parcel dest, int flags) {
33+
dest.writeString(this.webData);
1934
dest.writeString(this.eventPane);
35+
dest.writeString(this.htmlData);
2036
}
2137

2238
@Override
@@ -36,5 +52,23 @@ public EhNewsDetail[] newArray(int size) {
3652
}
3753
};
3854

55+
public String getEventPane(){
56+
if (eventPane!=null){
57+
return eventPane;
58+
}
59+
Document document = Jsoup.parse(webData);
60+
Element eventPaneElement = document.getElementById("eventpane");
61+
if (eventPaneElement!=null&&eventPaneElement.childrenSize()==3){
62+
eventPane = eventPaneElement.html();
63+
}
64+
return eventPane;
65+
}
66+
67+
68+
public String getHtmlData(){
69+
Document document = Jsoup.parse(webData);
70+
Element element = document.child(0);
71+
return element.outerHtml();
72+
}
3973

4074
}

app/src/main/java/com/hippo/ehviewer/client/parser/EhNewsParse.java

Lines changed: 0 additions & 50 deletions
This file was deleted.

0 commit comments

Comments
 (0)