From 9efb8cf450838c45637b6a4c007319cc65479aef Mon Sep 17 00:00:00 2001 From: tarsin Date: Mon, 10 Apr 2023 19:00:47 +0800 Subject: [PATCH] Cleanup unused res --- .../hippo/drawable/PreciselyClipDrawable.kt | 68 ------------------- .../java/com/hippo/ehviewer/EhApplication.kt | 1 + app/src/main/res/drawable/tile_background.xml | 22 ------ app/src/main/res/values/dimens.xml | 1 - app/src/main/res/values/drawables.xml | 3 - 5 files changed, 1 insertion(+), 94 deletions(-) delete mode 100644 app/src/main/java/com/hippo/drawable/PreciselyClipDrawable.kt delete mode 100644 app/src/main/res/drawable/tile_background.xml diff --git a/app/src/main/java/com/hippo/drawable/PreciselyClipDrawable.kt b/app/src/main/java/com/hippo/drawable/PreciselyClipDrawable.kt deleted file mode 100644 index fc037ffa3..000000000 --- a/app/src/main/java/com/hippo/drawable/PreciselyClipDrawable.kt +++ /dev/null @@ -1,68 +0,0 @@ -/* - * Copyright 2016 Hippo Seven - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.hippo.drawable - -import android.graphics.Canvas -import android.graphics.Rect -import android.graphics.RectF -import android.graphics.drawable.Drawable -import android.graphics.drawable.DrawableWrapper -import androidx.core.graphics.withClip - -/** - * Show a part of the original drawable - */ -class PreciselyClipDrawable( - drawable: Drawable, - offsetX: Int, - offsetY: Int, - width: Int, - height: Int, -) : DrawableWrapper(drawable) { - private val mScale: RectF - private val mTemp = Rect() - - init { - val originWidth = drawable.intrinsicWidth.toFloat() - val originHeight = drawable.intrinsicHeight.toFloat() - mScale = RectF( - (offsetX / originWidth).coerceIn(0.0f, 1.0f), - (offsetY / originHeight).coerceIn(0.0f, 1.0f), - ((offsetX + width) / originWidth).coerceIn(0.0f, 1.0f), - ((offsetY + height) / originHeight).coerceIn(0.0f, 1.0f), - ) - } - - override fun onBoundsChange(bounds: Rect) { - mTemp.left = ((mScale.left * bounds.right - mScale.right * bounds.left) / (mScale.left * (1 - mScale.right) - mScale.right * (1 - mScale.left))).toInt() - mTemp.right = (((1 - mScale.right) * bounds.left - (1 - mScale.left) * bounds.right) / (mScale.left * (1 - mScale.right) - mScale.right * (1 - mScale.left))).toInt() - mTemp.top = ((mScale.top * bounds.bottom - mScale.bottom * bounds.top) / (mScale.top * (1 - mScale.bottom) - mScale.bottom * (1 - mScale.top))).toInt() - mTemp.bottom = (((1 - mScale.bottom) * bounds.top - (1 - mScale.top) * bounds.bottom) / (mScale.top * (1 - mScale.bottom) - mScale.bottom * (1 - mScale.top))).toInt() - super.onBoundsChange(mTemp) - } - - override fun getIntrinsicWidth(): Int { - return (super.getIntrinsicWidth() * mScale.width()).toInt() - } - - override fun getIntrinsicHeight(): Int { - return (super.getIntrinsicHeight() * mScale.height()).toInt() - } - - override fun draw(canvas: Canvas) { - canvas.withClip(bounds) { super.draw(canvas) } - } -} diff --git a/app/src/main/java/com/hippo/ehviewer/EhApplication.kt b/app/src/main/java/com/hippo/ehviewer/EhApplication.kt index 80423b634..dce2cd714 100644 --- a/app/src/main/java/com/hippo/ehviewer/EhApplication.kt +++ b/app/src/main/java/com/hippo/ehviewer/EhApplication.kt @@ -179,6 +179,7 @@ class EhApplication : Application(), DefaultLifecycleObserver, ImageLoaderFactor components { add(MergeInterceptor) } diskCache(imageCache) crossfade(300) + error(R.drawable.image_failed) if (BuildConfig.DEBUG) logger(DebugLogger()) }.build() } diff --git a/app/src/main/res/drawable/tile_background.xml b/app/src/main/res/drawable/tile_background.xml deleted file mode 100644 index 18b624f43..000000000 --- a/app/src/main/res/drawable/tile_background.xml +++ /dev/null @@ -1,22 +0,0 @@ - - - - - - - - diff --git a/app/src/main/res/values/dimens.xml b/app/src/main/res/values/dimens.xml index 1b93e3e9a..ae2ff0e61 100644 --- a/app/src/main/res/values/dimens.xml +++ b/app/src/main/res/values/dimens.xml @@ -22,7 +22,6 @@ 16dp 260dp - 280dp 8dp diff --git a/app/src/main/res/values/drawables.xml b/app/src/main/res/values/drawables.xml index 40e3a7415..01917b0c2 100644 --- a/app/src/main/res/values/drawables.xml +++ b/app/src/main/res/values/drawables.xml @@ -15,7 +15,4 @@ --> - @android:color/transparent - #7f9c27b0 -