This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ======================= WINDOW INSETS ======================= | |
fun View.addSystemTopPadding( | |
targetView: View = this, | |
isConsumed: Boolean = false | |
) { | |
doOnApplyWindowInsets { _, insets, initialPadding -> | |
targetView.updatePadding( | |
top = initialPadding.top + insets.systemWindowInsetTop | |
) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import android.content.Context | |
import android.util.AttributeSet | |
import android.widget.FrameLayout | |
import androidx.core.view.ViewCompat | |
import androidx.core.view.WindowInsetsCompat | |
/** | |
* Before adding this: | |
* 1. In AndroidManifest in your <activity/> tag android:windowSoftInputMode="adjustResize" | |
* 2. Enable "EDGE-TO-EDGE" mode in your activity -> window.decorView.systemUiVisibility = decorView.systemUiVisibility or (View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION or View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN or View.SYSTEM_UI_FLAG_LAYOUT_STABLE) |