[UI] Better support for Immersive mode on notched devices
This commit is contained in:
parent
c6f6317839
commit
238c54c6fb
3 changed files with 6 additions and 2 deletions
|
@ -17,6 +17,7 @@ package code.name.monkey.retromusic.activities.base
|
|||
import android.content.Context
|
||||
import android.content.res.Resources
|
||||
import android.graphics.Color
|
||||
import android.os.Build
|
||||
import android.os.Bundle
|
||||
import android.os.Handler
|
||||
import android.view.KeyEvent
|
||||
|
@ -200,6 +201,9 @@ abstract class AbsThemeActivity : ATHToolbarActivity(), Runnable {
|
|||
WindowInsetsControllerCompat.BEHAVIOR_SHOW_TRANSIENT_BARS_BY_SWIPE
|
||||
hide(WindowInsetsCompat.Type.systemBars())
|
||||
}
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {
|
||||
window.attributes.layoutInDisplayCutoutMode = WindowManager.LayoutParams.LAYOUT_IN_DISPLAY_CUTOUT_MODE_SHORT_EDGES
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -136,6 +136,7 @@ fun ShapeableImageView.setCircleShape(boolean: Boolean) {
|
|||
* This will draw our view above the navigation bar instead of behind it by adding margins.
|
||||
*/
|
||||
fun View.drawAboveSystemBars(onlyPortrait: Boolean = true) {
|
||||
if (PreferenceUtil.isFullScreenMode) return
|
||||
if (onlyPortrait && RetroUtil.isLandscape()) return
|
||||
// Create a snapshot of the view's margin state
|
||||
val initialMargin = recordInitialMarginForView(this)
|
||||
|
@ -157,6 +158,7 @@ fun View.drawAboveSystemBars(onlyPortrait: Boolean = true) {
|
|||
* This will draw our view above the navigation bar instead of behind it by adding padding.
|
||||
*/
|
||||
fun View.drawAboveSystemBarsWithPadding(consume: Boolean = false) {
|
||||
if (PreferenceUtil.isFullScreenMode) return
|
||||
val initialPadding = recordInitialPaddingForView(this)
|
||||
|
||||
ViewCompat.setOnApplyWindowInsetsListener(
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
package code.name.monkey.appthemehelper
|
||||
|
||||
import android.annotation.SuppressLint
|
||||
import android.app.Activity
|
||||
import android.app.ActivityManager
|
||||
import android.content.Context
|
||||
|
@ -18,7 +17,6 @@ import code.name.monkey.appthemehelper.util.ToolbarContentTintHelper
|
|||
*/
|
||||
object ATH {
|
||||
|
||||
@SuppressLint("CommitPrefEdits")
|
||||
fun didThemeValuesChange(context: Context, since: Long): Boolean {
|
||||
return ThemeStore.isConfigured(context) && ThemeStore.prefs(context).getLong(
|
||||
ThemeStorePrefKeys.VALUES_CHANGED,
|
||||
|
|
Loading…
Reference in a new issue