pull/42/head
kunfei 5 years ago
parent e6701ef574
commit 583253b7d2
  1. 6
      app/src/main/java/io/legado/app/ui/filechooser/utils/ConvertUtils.kt

@ -29,7 +29,6 @@ object ConvertUtils {
} catch (e: NumberFormatException) { } catch (e: NumberFormatException) {
-1 -1
} }
} }
fun toInt(bytes: ByteArray): Int { fun toInt(bytes: ByteArray): Int {
@ -65,8 +64,6 @@ object ConvertUtils {
if (bytes.isNotEmpty()) { if (bytes.isNotEmpty()) {
try { try {
val options = BitmapFactory.Options() val options = BitmapFactory.Options()
// 不进行图片抖动处理
options.inDither = false
// 设置让解码器以最佳方式解码 // 设置让解码器以最佳方式解码
options.inPreferredConfig = null options.inPreferredConfig = null
if (width > 0 && height > 0) { if (width > 0 && height > 0) {
@ -77,12 +74,11 @@ object ConvertUtils {
bitmap!!.density = 96// 96 dpi bitmap!!.density = 96// 96 dpi
} catch (e: Exception) { } catch (e: Exception) {
} }
} }
return bitmap return bitmap
} }
fun toDrawable(bitmap: Bitmap?): Drawable? { private fun toDrawable(bitmap: Bitmap?): Drawable? {
return if (bitmap == null) null else BitmapDrawable(Resources.getSystem(), bitmap) return if (bitmap == null) null else BitmapDrawable(Resources.getSystem(), bitmap)
} }

Loading…
Cancel
Save