Skip to content

Commit

Permalink
gradle 更新至8.6
Browse files Browse the repository at this point in the history
尝试修复从预览页跳转到阅读页面时的内存溢出问题
  • Loading branch information
xiaojieonly committed Oct 31, 2024
1 parent 3e4d52c commit 214ba1e
Show file tree
Hide file tree
Showing 7 changed files with 31 additions and 22 deletions.
6 changes: 4 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ if (file('google-services.json').exists()) {
android {
namespace 'com.hippo.ehviewer'
testNamespace 'com.hippo.ehviewer.debug'
compileSdkVersion 31
compileSdk 34
// buildToolsVersion "30.0.3"
// ndkVersion '23.1.7779620'

Expand Down Expand Up @@ -101,14 +101,16 @@ clean {
}

dependencies {
// 测试工具
implementation 'com.gu.android:toolargetool:0.3.0'

// 应用服务分发
def appCenterSdkVersion = '4.4.5'
implementation "com.microsoft.appcenter:appcenter-analytics:${appCenterSdkVersion}"
// implementation "com.microsoft.appcenter:appcenter-crashes:${appCenterSdkVersion}"
implementation "com.microsoft.appcenter:appcenter-distribute:${appCenterSdkVersion}"

implementation 'com.google.android.material:material:1.4.0'
implementation 'com.google.android.material:material:1.12.0'

// app使用情况数据收集
// Import the BoM for the Firebase platform
Expand Down
4 changes: 4 additions & 0 deletions app/src/main/java/com/hippo/ehviewer/EhApplication.java
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
import androidx.appcompat.app.AlertDialog;
import androidx.collection.LruCache;

import com.gu.toolargetool.TooLargeTool;
import com.hippo.a7zip.A7Zip;
import com.hippo.beerbelly.SimpleDiskCache;
import com.hippo.conaco.Conaco;
Expand Down Expand Up @@ -163,6 +164,9 @@ public void onCreate() {
});

super.onCreate();
if(BuildConfig.DEBUG){
TooLargeTool.startLogging(this);
}

GetText.initialize(this);
StatusCodeException.initialize(this);
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/java/com/hippo/ehviewer/ui/MainActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -549,7 +549,7 @@ private void onRestore(Bundle savedInstanceState) {

@Override
public void onSaveInstanceState(Bundle outState, PersistableBundle outPersistentState) {
super.onSaveInstanceState(outState, outPersistentState);
// super.onSaveInstanceState(outState, outPersistentState);
outState.putInt(KEY_NAV_CHECKED_ITEM, mNavCheckedItem);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,11 +97,12 @@ public void onCreate(@Nullable Bundle savedInstanceState) {
Context context = getEHContext();
AssertUtils.assertNotNull(context);
mClient = EhApplication.getEhClient(context);
if (savedInstanceState == null) {
onInit();
} else {
onRestore(savedInstanceState);
}
onInit();
// if (savedInstanceState == null) {
// onInit();
// } else {
// onRestore(savedInstanceState);
// }
}

private void onInit() {
Expand All @@ -120,16 +121,16 @@ private void onRestore(@NonNull Bundle savedInstanceState) {

@Override
public void onSaveInstanceState(@NonNull Bundle outState) {
super.onSaveInstanceState(outState);

boolean hasFirstRefresh;
if (mHelper != null && 1 == mHelper.getShownViewIndex()) {
hasFirstRefresh = false;
} else {
hasFirstRefresh = mHasFirstRefresh;
}
outState.putBoolean(KEY_HAS_FIRST_REFRESH, hasFirstRefresh);
outState.putParcelable(KEY_GALLERY_INFO, mGalleryInfo);
// super.onSaveInstanceState(outState);

// boolean hasFirstRefresh;
// if (mHelper != null && 1 == mHelper.getShownViewIndex()) {
// hasFirstRefresh = false;
// } else {
// hasFirstRefresh = mHasFirstRefresh;
// }
// outState.putBoolean(KEY_HAS_FIRST_REFRESH, hasFirstRefresh);
// outState.putParcelable(KEY_GALLERY_INFO, mGalleryInfo);
}

@Nullable
Expand Down
4 changes: 2 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@

// Top-level build file where you can add configuration options common to all sub-projects/modules.
plugins {
id 'com.android.application' version '7.4.1' apply false
id 'com.android.library' version '7.4.1' apply false
id 'com.android.application' version '8.6.0' apply false
id 'com.android.library' version '8.6.0' apply false
id 'com.google.gms.google-services' version '4.4.1' apply false
id "org.jetbrains.kotlin.android" version "1.9.23" apply false
id "org.jetbrains.kotlin.plugin.parcelize" version "1.9.23" apply false
Expand Down
4 changes: 3 additions & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,6 @@ android.useAndroidX=true
# Enables namespacing of each library's R class so that its R class includes only the
# resources declared in the library itself and none from the library's dependencies,
# thereby reducing the size of the R class for that library
android.nonTransitiveRClass=true
android.nonTransitiveRClass=true
android.defaults.buildfeatures.buildconfig=true
android.nonFinalResIds=false
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-all.zip

0 comments on commit 214ba1e

Please sign in to comment.