调整图片缩放,增加debug编译项

This commit is contained in:
Ling0925 2023-01-21 22:22:23 +08:00
parent 0c8e577f2c
commit c36a35f7d4
2 changed files with 39 additions and 24 deletions

View File

@ -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

View File

@ -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