diff --git a/app/build.gradle b/app/build.gradle index 1dd2c524..533a72dc 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -16,25 +16,25 @@ buildscript { } } -def keystoreProperties = new Properties() -keystoreProperties.load(new FileInputStream(rootProject.file("keystore.properties"))) -def applicationProperties = new Properties() -applicationProperties.load(new FileInputStream(rootProject.file("application.properties"))) -def SHA1 = System.getenv("CIRCLE_SHA1") -def applicationVersionCode = applicationProperties["versionCode"].toInteger() -def applicationVersionName = applicationProperties["versionName"] -def isPerVersion = applicationProperties["isPerRelease"] == "true" -if (SHA1 != null) { - applicationVersionName = applicationVersionName + ".${SHA1.substring(0, 7)}" -} -if (isPerVersion) { - applicationVersionName = applicationVersionName + ".${applicationProperties["preReleaseName"]}-${applicationProperties["preReleaseVer"]}" -} +// def keystoreProperties = new Properties() +// keystoreProperties.load(new FileInputStream(rootProject.file("keystore.properties"))) +// def applicationProperties = new Properties() +// applicationProperties.load(new FileInputStream(rootProject.file("application.properties"))) +// def SHA1 = System.getenv("CIRCLE_SHA1") +// def applicationVersionCode = applicationProperties["versionCode"].toInteger() +// def applicationVersionName = applicationProperties["versionName"] +// def isPerVersion = applicationProperties["isPerRelease"] == "true" +// if (SHA1 != null) { +// applicationVersionName = applicationVersionName + ".${SHA1.substring(0, 7)}" +// } +// if (isPerVersion) { +// applicationVersionName = applicationVersionName + ".${applicationProperties["preReleaseName"]}-${applicationProperties["preReleaseVer"]}" +// } andResGuard { mappingFile = null use7zip = true - useSign = true + useSign = false keepRoot = false mergeDuplicatedRes = true whiteList = ["R.mipmap.ic_launcher", @@ -58,15 +58,15 @@ andResGuard { } android { - signingConfigs { - release { - keyAlias keystoreProperties['releaseKeyAlias'] - keyPassword keystoreProperties['releaseKeyPassword'] - storeFile file(rootDir.getCanonicalPath() + '/' + keystoreProperties['releaseKeyStore']) - storePassword keystoreProperties['releaseStorePassword'] - v2SigningEnabled true - } - } + // signingConfigs { + // release { + // keyAlias keystoreProperties['releaseKeyAlias'] + // keyPassword keystoreProperties['releaseKeyPassword'] + // storeFile file(rootDir.getCanonicalPath() + '/' + keystoreProperties['releaseKeyStore']) + // storePassword keystoreProperties['releaseStorePassword'] + // v2SigningEnabled true + // } + // } compileSdkVersion 29 defaultConfig { applicationId "com.huanchengfly.tieba.post" @@ -88,6 +88,15 @@ android { zipAlignEnabled true multiDexEnabled true } + debug { + minifyEnabled true + proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' + debuggable true + jniDebuggable false + signingConfig signingConfigs.debug + zipAlignEnabled true + multiDexEnabled true + } } compileOptions { targetCompatibility JavaVersion.VERSION_1_8 diff --git a/app/src/main/java/com/huanchengfly/tieba/post/fragments/PhotoViewFragment.java b/app/src/main/java/com/huanchengfly/tieba/post/fragments/PhotoViewFragment.java index 7b5be928..78ccb5e6 100644 --- a/app/src/main/java/com/huanchengfly/tieba/post/fragments/PhotoViewFragment.java +++ b/app/src/main/java/com/huanchengfly/tieba/post/fragments/PhotoViewFragment.java @@ -179,6 +179,7 @@ public class PhotoViewFragment extends BaseFragment { } private float getInitImageScale(Bitmap bitmap) { + int width = BaseApplication.ScreenInfo.EXACT_SCREEN_WIDTH; int height = BaseApplication.ScreenInfo.EXACT_SCREEN_HEIGHT; float scale = 1.0f; @@ -202,7 +203,12 @@ public class PhotoViewFragment extends BaseFragment { if (dw > width && dh > height) { scale = width * 1.0f / dw; } + // 图片高度和宽度都小于屏幕,且放大1.5倍后依旧小于屏幕,则放大图片至1.5倍,避免小图放大倍数过高 + if (dw < width && dh < height && (dh * 1.5 < height || dw * 1.5 < width)) { + scale = 1.5f; + } return scale; + } @Override