Skip to content

Commit

Permalink
status bar height fix
Browse files Browse the repository at this point in the history
  • Loading branch information
rebelonion committed Jan 18, 2024
1 parent 5bd8f1a commit 91b1f47
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion app/src/main/java/ani/dantotsu/MainActivity.kt
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package ani.dantotsu

import android.animation.ObjectAnimator
import android.annotation.SuppressLint
import android.content.Context
import android.content.Intent
import android.graphics.drawable.Animatable
Expand Down Expand Up @@ -68,6 +69,7 @@ class MainActivity : AppCompatActivity() {
private var uiSettings = UserInterfaceSettings()


@SuppressLint("InternalInsetResource", "DiscouragedApi")
@OptIn(UnstableApi::class)
override fun onCreate(savedInstanceState: Bundle?) {
ThemeManager(this).applyTheme()
Expand Down Expand Up @@ -96,8 +98,14 @@ class MainActivity : AppCompatActivity() {

}

val offset = try {
val statusBarHeightId = resources.getIdentifier("status_bar_height", "dimen", "android")
resources.getDimensionPixelSize(statusBarHeightId)
} catch (e: Exception) {
statusBarHeight
}
val layoutParams = binding.incognitoTextView.layoutParams as ViewGroup.MarginLayoutParams
layoutParams.topMargin = 11 * statusBarHeight / 12
layoutParams.topMargin = 11 * offset / 12
binding.incognitoTextView.layoutParams = layoutParams
incognitoLiveData = SharedPreferenceBooleanLiveData(
sharedPreferences,
Expand Down

0 comments on commit 91b1f47

Please sign in to comment.