diff options
author | Allan Wang <me@allanwang.ca> | 2019-10-19 23:15:47 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-10-19 23:15:47 -0700 |
commit | 5dc6b2151f3177d01b2afe8f2e0479379f9970ff (patch) | |
tree | f3c154ebfb28b8f27651ccd9abf2ee35d0b045d3 /kpref-activity | |
parent | cd068b144ef533bccafc20b8b25ff72b56a93e23 (diff) | |
parent | f411167d3a7748bafbd54394e24ee40808faa6be (diff) | |
download | kau-5dc6b2151f3177d01b2afe8f2e0479379f9970ff.tar.gz kau-5dc6b2151f3177d01b2afe8f2e0479379f9970ff.tar.bz2 kau-5dc6b2151f3177d01b2afe8f2e0479379f9970ff.zip |
Merge pull request #234 from AllanWang/status-bar-height
Fix status bar height for settings activity
Diffstat (limited to 'kpref-activity')
-rw-r--r-- | kpref-activity/src/main/kotlin/ca/allanwang/kau/kpref/activity/KPrefActivity.kt | 7 | ||||
-rw-r--r-- | kpref-activity/src/main/res/layout/kau_pref_activity.xml | 2 |
2 files changed, 7 insertions, 2 deletions
diff --git a/kpref-activity/src/main/kotlin/ca/allanwang/kau/kpref/activity/KPrefActivity.kt b/kpref-activity/src/main/kotlin/ca/allanwang/kau/kpref/activity/KPrefActivity.kt index 800a355..90827d3 100644 --- a/kpref-activity/src/main/kotlin/ca/allanwang/kau/kpref/activity/KPrefActivity.kt +++ b/kpref-activity/src/main/kotlin/ca/allanwang/kau/kpref/activity/KPrefActivity.kt @@ -29,15 +29,16 @@ import ca.allanwang.kau.ui.views.RippleCanvas import ca.allanwang.kau.utils.KAU_LEFT import ca.allanwang.kau.utils.KAU_RIGHT import ca.allanwang.kau.utils.resolveColor +import ca.allanwang.kau.utils.setMarginTop import ca.allanwang.kau.utils.statusBarColor import ca.allanwang.kau.utils.withLinearAdapter import com.mikepenz.fastadapter.adapters.FastItemAdapter import com.mikepenz.fastadapter.select.getSelectExtension +import java.util.Stack import kotlinx.android.synthetic.main.kau_pref_activity.* import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.launch import kotlinx.coroutines.withContext -import java.util.Stack abstract class KPrefActivity : KauBaseActivity(), KPrefActivityContract { @@ -83,6 +84,10 @@ abstract class KPrefActivity : KauBaseActivity(), KPrefActivityContract { toolbar.setNavigationOnClickListener { onBackPressed() } setDisplayShowTitleEnabled(false) } + findViewById<View>(android.R.id.content).setOnApplyWindowInsetsListener { _, insets -> + kau_toolbar.setMarginTop(insets.systemWindowInsetTop) + insets + } window.decorView.systemUiVisibility = View.SYSTEM_UI_FLAG_LAYOUT_STABLE or View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN statusBarColor = 0x30000000 diff --git a/kpref-activity/src/main/res/layout/kau_pref_activity.xml b/kpref-activity/src/main/res/layout/kau_pref_activity.xml index d6ea6e6..d73e07f 100644 --- a/kpref-activity/src/main/res/layout/kau_pref_activity.xml +++ b/kpref-activity/src/main/res/layout/kau_pref_activity.xml @@ -13,11 +13,11 @@ app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toTopOf="parent" /> + <!-- Margin top will be set to status bar height programmatically --> <androidx.appcompat.widget.Toolbar android:id="@id/kau_toolbar" android:layout_width="0dp" android:layout_height="?attr/actionBarSize" - android:layout_marginTop="@dimen/kau_status_bar_height" android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent" |