diff --git a/README.md b/README.md index 2e104a4..5d9bad1 100644 --- a/README.md +++ b/README.md @@ -54,7 +54,7 @@ allprojects { ##### 此处显示的是本框架的最新版本号: ##### ⚠️注意:glide v3版本不再维护,最终版本为v3_4.0.2。建议使用androidx版本。 ``` -androidx用户 : 使用 androidx-7.1.3 +androidx用户 : 使用 androidx-7.1.4 对于glide4.x : 使用 v4_6.1.3 ``` @@ -68,7 +68,7 @@ dependencies { annotationProcessor 'com.github.bumptech.glide:compiler:4.11.0' implementation 'com.github.bumptech.glide:okhttp3-integration:4.11.0' // BigImageViewPager https://github.com/SherlockGougou/BigImageViewPager - implementation 'com.github.SherlockGougou:BigImageViewPager:androidx-7.1.3' + implementation 'com.github.SherlockGougou:BigImageViewPager:androidx-7.1.4' ================================分割线================================== diff --git a/library/src/main/java/cc/shinichi/library/tool/image/ImageUtil.kt b/library/src/main/java/cc/shinichi/library/tool/image/ImageUtil.kt index 7ebc59c..5f9d63d 100644 --- a/library/src/main/java/cc/shinichi/library/tool/image/ImageUtil.kt +++ b/library/src/main/java/cc/shinichi/library/tool/image/ImageUtil.kt @@ -12,6 +12,7 @@ import cc.shinichi.library.tool.common.Print.d import cc.shinichi.library.tool.ui.PhoneUtil import java.io.* import java.util.* +import kotlin.math.max /** * @author 工藤 @@ -166,8 +167,12 @@ object ImageUtil { fun getImageMaxZoomScale(context: Context, imagePath: String): Float { val wh = getWidthHeight(imagePath) + val imageWid = wh[0].toFloat() val imageHei = wh[1].toFloat() val phoneHei = PhoneUtil.getPhoneHei(context.applicationContext).toFloat() + if (imageWid >= 2560) { + return phoneHei * 4f / imageHei + } return phoneHei * 2f / imageHei } @@ -182,7 +187,8 @@ object ImageUtil { val wh = getWidthHeight(imagePath) val imageWid = wh[0].toFloat() val imageHei = wh[1].toFloat() - return imageHei / imageWid + val phoneWid = PhoneUtil.getPhoneWid(context.applicationContext).toFloat() + return max(imageHei / imageWid, phoneWid * 2f / imageWid) } fun getLongImageDoubleZoomScale(context: Context, imagePath: String): Float { @@ -196,7 +202,8 @@ object ImageUtil { val wh = getWidthHeight(imagePath) val imageWid = wh[0].toFloat() val imageHei = wh[1].toFloat() - return imageWid / imageHei + val phoneHei = PhoneUtil.getPhoneHei(context.applicationContext).toFloat() + return max(imageWid / imageHei, phoneHei * 2f / imageHei) } fun getWideImageDoubleScale(context: Context, imagePath: String): Float { diff --git a/sample/build.gradle b/sample/build.gradle index ed293cf..723d045 100644 --- a/sample/build.gradle +++ b/sample/build.gradle @@ -8,8 +8,8 @@ android { applicationId "cc.shinichi.bigimageviewpager" minSdkVersion 14 targetSdkVersion 32 - versionCode 713 - versionName "androidx-7.1.3" + versionCode 714 + versionName "androidx-7.1.4" } buildTypes { release { @@ -57,6 +57,6 @@ dependencies { annotationProcessor 'com.github.bumptech.glide:compiler:4.11.0' implementation 'com.github.bumptech.glide:okhttp3-integration:4.11.0' // library -// implementation 'com.github.SherlockGougou:BigImageViewPager:androidx-7.1.3' +// implementation 'com.github.SherlockGougou:BigImageViewPager:androidx-7.1.4' implementation project(':library') } \ No newline at end of file