|
|
|
@ -2,12 +2,14 @@ |
|
|
|
|
|
|
|
|
|
package io.legado.app.lib.theme |
|
|
|
|
|
|
|
|
|
import android.annotation.SuppressLint |
|
|
|
|
import android.content.Context |
|
|
|
|
import android.graphics.drawable.GradientDrawable |
|
|
|
|
import androidx.annotation.ColorInt |
|
|
|
|
import androidx.core.content.ContextCompat |
|
|
|
|
import androidx.fragment.app.Fragment |
|
|
|
|
import io.legado.app.R |
|
|
|
|
import io.legado.app.help.AppConfig |
|
|
|
|
import io.legado.app.utils.ColorUtils |
|
|
|
|
import io.legado.app.utils.dp |
|
|
|
|
|
|
|
|
@ -116,7 +118,18 @@ val Fragment.isDarkTheme: Boolean |
|
|
|
|
get() = requireContext().isDarkTheme |
|
|
|
|
|
|
|
|
|
val Context.elevation: Float |
|
|
|
|
get() = ThemeStore.elevation(this) |
|
|
|
|
@SuppressLint("PrivateResource") |
|
|
|
|
get() { |
|
|
|
|
return if (AppConfig.elevation < 0) { |
|
|
|
|
ThemeUtils.resolveFloat( |
|
|
|
|
this, |
|
|
|
|
android.R.attr.elevation, |
|
|
|
|
resources.getDimension(R.dimen.design_appbar_elevation) |
|
|
|
|
) |
|
|
|
|
} else { |
|
|
|
|
AppConfig.elevation.dp.toFloat() |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
val Context.filletBackground: GradientDrawable |
|
|
|
|
get() { |
|
|
|
|