调整图片缩放,增加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() // def keystoreProperties = new Properties()
keystoreProperties.load(new FileInputStream(rootProject.file("keystore.properties"))) // keystoreProperties.load(new FileInputStream(rootProject.file("keystore.properties")))
def applicationProperties = new Properties() // def applicationProperties = new Properties()
applicationProperties.load(new FileInputStream(rootProject.file("application.properties"))) // applicationProperties.load(new FileInputStream(rootProject.file("application.properties")))
def SHA1 = System.getenv("CIRCLE_SHA1") // def SHA1 = System.getenv("CIRCLE_SHA1")
def applicationVersionCode = applicationProperties["versionCode"].toInteger() // def applicationVersionCode = applicationProperties["versionCode"].toInteger()
def applicationVersionName = applicationProperties["versionName"] // def applicationVersionName = applicationProperties["versionName"]
def isPerVersion = applicationProperties["isPerRelease"] == "true" // def isPerVersion = applicationProperties["isPerRelease"] == "true"
if (SHA1 != null) { // if (SHA1 != null) {
applicationVersionName = applicationVersionName + ".${SHA1.substring(0, 7)}" // applicationVersionName = applicationVersionName + ".${SHA1.substring(0, 7)}"
} // }
if (isPerVersion) { // if (isPerVersion) {
applicationVersionName = applicationVersionName + ".${applicationProperties["preReleaseName"]}-${applicationProperties["preReleaseVer"]}" // applicationVersionName = applicationVersionName + ".${applicationProperties["preReleaseName"]}-${applicationProperties["preReleaseVer"]}"
} // }
andResGuard { andResGuard {
mappingFile = null mappingFile = null
use7zip = true use7zip = true
useSign = true useSign = false
keepRoot = false keepRoot = false
mergeDuplicatedRes = true mergeDuplicatedRes = true
whiteList = ["R.mipmap.ic_launcher", whiteList = ["R.mipmap.ic_launcher",
@ -58,15 +58,15 @@ andResGuard {
} }
android { android {
signingConfigs { // signingConfigs {
release { // release {
keyAlias keystoreProperties['releaseKeyAlias'] // keyAlias keystoreProperties['releaseKeyAlias']
keyPassword keystoreProperties['releaseKeyPassword'] // keyPassword keystoreProperties['releaseKeyPassword']
storeFile file(rootDir.getCanonicalPath() + '/' + keystoreProperties['releaseKeyStore']) // storeFile file(rootDir.getCanonicalPath() + '/' + keystoreProperties['releaseKeyStore'])
storePassword keystoreProperties['releaseStorePassword'] // storePassword keystoreProperties['releaseStorePassword']
v2SigningEnabled true // v2SigningEnabled true
} // }
} // }
compileSdkVersion 29 compileSdkVersion 29
defaultConfig { defaultConfig {
applicationId "com.huanchengfly.tieba.post" applicationId "com.huanchengfly.tieba.post"
@ -88,6 +88,15 @@ android {
zipAlignEnabled true zipAlignEnabled true
multiDexEnabled 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 { compileOptions {
targetCompatibility JavaVersion.VERSION_1_8 targetCompatibility JavaVersion.VERSION_1_8

View File

@ -179,6 +179,7 @@ public class PhotoViewFragment extends BaseFragment {
} }
private float getInitImageScale(Bitmap bitmap) { private float getInitImageScale(Bitmap bitmap) {
int width = BaseApplication.ScreenInfo.EXACT_SCREEN_WIDTH; int width = BaseApplication.ScreenInfo.EXACT_SCREEN_WIDTH;
int height = BaseApplication.ScreenInfo.EXACT_SCREEN_HEIGHT; int height = BaseApplication.ScreenInfo.EXACT_SCREEN_HEIGHT;
float scale = 1.0f; float scale = 1.0f;
@ -202,7 +203,12 @@ public class PhotoViewFragment extends BaseFragment {
if (dw > width && dh > height) { if (dw > width && dh > height) {
scale = width * 1.0f / dw; 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; return scale;
} }
@Override @Override