mirror of
https://github.com/mihonapp/mihon.git
synced 2025-11-14 13:08:56 +01:00
Address some build warnings
This commit is contained in:
@@ -2,9 +2,6 @@ package eu.kanade.tachiyomi.util.system
|
||||
|
||||
import android.content.Context
|
||||
import android.provider.Settings
|
||||
import android.view.ViewPropertyAnimator
|
||||
import android.view.animation.Animation
|
||||
import androidx.constraintlayout.motion.widget.MotionScene.Transition
|
||||
|
||||
/**
|
||||
* Gets the duration multiplier for general animations on the device
|
||||
@@ -12,19 +9,3 @@ import androidx.constraintlayout.motion.widget.MotionScene.Transition
|
||||
*/
|
||||
val Context.animatorDurationScale: Float
|
||||
get() = Settings.Global.getFloat(this.contentResolver, Settings.Global.ANIMATOR_DURATION_SCALE, 1f)
|
||||
|
||||
/** Scale the duration of this [Animation] by [Context.animatorDurationScale] */
|
||||
fun Animation.applySystemAnimatorScale(context: Context) {
|
||||
this.duration = (this.duration * context.animatorDurationScale).toLong()
|
||||
}
|
||||
|
||||
/** Scale the duration of this [Transition] by [Context.animatorDurationScale] */
|
||||
fun Transition.applySystemAnimatorScale(context: Context) {
|
||||
// End layout of cover expanding animation tends to break when the transition is less than ~25ms
|
||||
this.duration = (this.duration * context.animatorDurationScale).toInt().coerceAtLeast(25)
|
||||
}
|
||||
|
||||
/** Scale the duration of this [ViewPropertyAnimator] by [Context.animatorDurationScale] */
|
||||
fun ViewPropertyAnimator.applySystemAnimatorScale(context: Context): ViewPropertyAnimator = apply {
|
||||
this.duration = (this.duration * context.animatorDurationScale).toLong()
|
||||
}
|
||||
|
||||
@@ -17,18 +17,10 @@ private const val TABLET_UI_MIN_SCREEN_WIDTH_PORTRAIT_DP = 700
|
||||
// make sure icons on the nav rail fit
|
||||
private const val TABLET_UI_MIN_SCREEN_WIDTH_LANDSCAPE_DP = 600
|
||||
|
||||
fun Context.isTabletUi(): Boolean {
|
||||
return resources.configuration.isTabletUi()
|
||||
}
|
||||
|
||||
fun Configuration.isTabletUi(): Boolean {
|
||||
return smallestScreenWidthDp >= TABLET_UI_REQUIRED_SCREEN_WIDTH_DP
|
||||
}
|
||||
|
||||
fun Configuration.isAutoTabletUiAvailable(): Boolean {
|
||||
return smallestScreenWidthDp >= TABLET_UI_MIN_SCREEN_WIDTH_LANDSCAPE_DP
|
||||
}
|
||||
|
||||
// TODO: move the logic to `isTabletUi()` when main activity is rewritten in Compose
|
||||
fun Context.prepareTabletUiContext(): Context {
|
||||
val configuration = resources.configuration
|
||||
|
||||
Reference in New Issue
Block a user