Cleanup unused
This commit is contained in:
1 parent
2ed957b5f2
commit
a128356fc4
7 files changed
-173
No files matched your search
@@ -1,25 +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.ehviewer.util
|
||||
|
||||
import android.view.animation.Interpolator
|
||||
import androidx.interpolator.view.animation.FastOutLinearInInterpolator
|
||||
import androidx.interpolator.view.animation.LinearOutSlowInInterpolator
|
||||
|
||||
object AnimationUtils {
|
||||
val FAST_SLOW_INTERPOLATOR: Interpolator = LinearOutSlowInInterpolator()
|
||||
val SLOW_FAST_INTERPOLATOR: Interpolator = FastOutLinearInInterpolator()
|
||||
}
|
||||
@@ -1,25 +0,0 @@
|
||||
/*
|
||||
* Copyright 2015 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.ehviewer.util
|
||||
|
||||
import android.content.Context
|
||||
import android.util.TypedValue.COMPLEX_UNIT_DIP
|
||||
import android.util.TypedValue.applyDimension
|
||||
import kotlin.math.roundToInt
|
||||
|
||||
fun dp2px(context: Context, dp: Float): Int {
|
||||
return applyDimension(COMPLEX_UNIT_DIP, dp, context.resources.displayMetrics).roundToInt()
|
||||
}
|
||||
@@ -3,11 +3,8 @@ package com.hippo.ehviewer.util
|
||||
import android.content.Intent
|
||||
import android.os.Bundle
|
||||
import android.os.Parcelable
|
||||
import android.util.SparseArray
|
||||
import androidx.core.content.IntentCompat
|
||||
import androidx.core.os.BundleCompat
|
||||
|
||||
inline fun <reified T : Parcelable> Bundle.getParcelableCompat(key: String?): T? = BundleCompat.getParcelable(this, key, T::class.java)
|
||||
inline fun <reified T : Parcelable> Bundle.getParcelableArrayListCompat(key: String?): ArrayList<T>? = BundleCompat.getParcelableArrayList(this, key, T::class.java)
|
||||
inline fun <reified T : Parcelable> Bundle.getSparseParcelableArrayCompat(key: String?): SparseArray<T>? = BundleCompat.getSparseParcelableArray(this, key, T::class.java)
|
||||
inline fun <reified T : Parcelable> Intent.getParcelableExtraCompat(key: String?): T? = IntentCompat.getParcelableExtra(this, key, T::class.java)
|
||||
@@ -45,43 +45,3 @@ class IntRangeSet : RangeSet<Int> {
|
||||
}
|
||||
|
||||
fun List<IntRange>.toRangeSet() = IntRangeSet(this)
|
||||
|
||||
class LongRangeSet : RangeSet<Long> {
|
||||
|
||||
constructor() : super()
|
||||
|
||||
constructor(ranges: List<LongRange>) : super(ranges)
|
||||
|
||||
constructor(vararg ranges: LongRange) : this(ranges.asList())
|
||||
|
||||
private constructor(rangeSet: LongRangeSet) : super(rangeSet)
|
||||
|
||||
override fun createRange(start: Long, endInclusive: Long): LongRange =
|
||||
LongRange(start, endInclusive)
|
||||
|
||||
override fun incrementValue(value: Long): Long = value + 1
|
||||
|
||||
override fun decrementValue(value: Long): Long = value - 1
|
||||
|
||||
override fun clone(): RangeSet<Long> = LongRangeSet(this)
|
||||
}
|
||||
|
||||
class CharRangeSet : RangeSet<Char> {
|
||||
|
||||
constructor() : super()
|
||||
|
||||
constructor(ranges: List<CharRange>) : super(ranges)
|
||||
|
||||
constructor(vararg ranges: CharRange) : this(ranges.asList())
|
||||
|
||||
private constructor(rangeSet: CharRangeSet) : super(rangeSet)
|
||||
|
||||
override fun createRange(start: Char, endInclusive: Char): CharRange =
|
||||
CharRange(start, endInclusive)
|
||||
|
||||
override fun incrementValue(value: Char): Char = value + 1
|
||||
|
||||
override fun decrementValue(value: Char): Char = value - 1
|
||||
|
||||
override fun clone(): RangeSet<Char> = CharRangeSet(this)
|
||||
}
|
||||
@@ -1,25 +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.ehviewer.util
|
||||
|
||||
import android.animation.Animator
|
||||
|
||||
abstract class SimpleAnimatorListener : Animator.AnimatorListener {
|
||||
override fun onAnimationStart(animation: Animator) {}
|
||||
override fun onAnimationEnd(animation: Animator) {}
|
||||
override fun onAnimationCancel(animation: Animator) {}
|
||||
override fun onAnimationRepeat(animation: Animator) {}
|
||||
}
|
||||
@@ -1,47 +0,0 @@
|
||||
package com.hippo.ehviewer.util
|
||||
|
||||
import android.graphics.Rect
|
||||
import androidx.compose.foundation.layout.WindowInsets
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.ui.platform.LocalDensity
|
||||
import androidx.compose.ui.platform.LocalLayoutDirection
|
||||
import androidx.core.graphics.Insets
|
||||
import androidx.core.view.WindowInsetsCompat
|
||||
import kotlin.contracts.InvocationKind
|
||||
import kotlin.contracts.contract
|
||||
|
||||
inline fun buildWindowInsets(builderAction: WindowInsetsCompat.Builder.() -> Unit): WindowInsetsCompat {
|
||||
contract { callsInPlace(builderAction, InvocationKind.EXACTLY_ONCE) }
|
||||
val builder = if (isAtLeastQ) {
|
||||
WindowInsetsCompat.Builder()
|
||||
} else {
|
||||
// TODO: Report to google issue tracker
|
||||
// On API 20-28, WindowInsetsCompat.Builder() will copy the WindowInsets.CONSUMED static field,
|
||||
// which isConsumed() returns true, resulting in the insets not being dispatched
|
||||
runCatching {
|
||||
val constructor = android.view.WindowInsets::class.java.getConstructor(Rect::class.java)
|
||||
val platformInsets = constructor.newInstance(Rect())
|
||||
WindowInsetsCompat.Builder(WindowInsetsCompat.toWindowInsetsCompat(platformInsets))
|
||||
}.getOrElse {
|
||||
it.printStackTrace()
|
||||
WindowInsetsCompat.Builder()
|
||||
}
|
||||
}
|
||||
builder.builderAction()
|
||||
return builder.build()
|
||||
}
|
||||
|
||||
@Composable
|
||||
fun WindowInsetsCompat.Builder.set(type: Int, insets: WindowInsets): WindowInsetsCompat.Builder {
|
||||
val density = LocalDensity.current
|
||||
val layoutDirection = LocalLayoutDirection.current
|
||||
return setInsets(
|
||||
type,
|
||||
Insets.of(
|
||||
insets.getLeft(density, layoutDirection),
|
||||
insets.getTop(density),
|
||||
insets.getRight(density, layoutDirection),
|
||||
insets.getBottom(density),
|
||||
),
|
||||
)
|
||||
}
|
||||
@@ -1,7 +1,6 @@
|
||||
package rikka.core.res
|
||||
|
||||
import android.content.res.Resources
|
||||
import android.graphics.drawable.Drawable
|
||||
import androidx.annotation.AttrRes
|
||||
import androidx.annotation.ColorInt
|
||||
|
||||
@@ -12,10 +11,3 @@ fun Resources.Theme.resolveColor(@AttrRes attrId: Int): Int {
|
||||
a.recycle()
|
||||
return res
|
||||
}
|
||||
|
||||
fun Resources.Theme.resolveDrawable(@AttrRes attrId: Int): Drawable? {
|
||||
val a = obtainStyledAttributes(intArrayOf(attrId))
|
||||
val res = a.getDrawable(0)
|
||||
a.recycle()
|
||||
return res
|
||||
}
|
||||
Reference in new issue
Block a user