Skip to content

Commit

Permalink
Padded all systems bars in all activities
Browse files Browse the repository at this point in the history
  • Loading branch information
juha-h committed Dec 14, 2024
1 parent 04462f4 commit 0a17139
Show file tree
Hide file tree
Showing 12 changed files with 20 additions and 24 deletions.
7 changes: 3 additions & 4 deletions app/src/main/kotlin/com/tutpro/baresip/AboutActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -35,16 +35,15 @@ class AboutActivity : AppCompatActivity() {

ViewCompat.setOnApplyWindowInsetsListener(window.decorView) { v: View, insets: WindowInsetsCompat ->
val systemBars: Insets = insets.getInsets(WindowInsetsCompat.Type.systemBars())
v.setPadding(0, systemBars.top, 0, systemBars.bottom)
v.setPadding(systemBars.left, systemBars.top, systemBars.right, systemBars.bottom)
if (Build.VERSION.SDK_INT >= 35)
binding.aboutText.updatePadding(top = 172)
WindowInsetsCompat.CONSUMED
}

if (!Utils.isDarkTheme(this))
WindowInsetsControllerCompat(window, binding.root).isAppearanceLightStatusBars = true

if (Build.VERSION.SDK_INT >= 35)
binding.aboutText.updatePadding(top = 172)

Utils.addActivity("about")

val text = String.format(getString(R.string.about_text),
Expand Down
7 changes: 3 additions & 4 deletions app/src/main/kotlin/com/tutpro/baresip/AccountActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -88,16 +88,15 @@ class AccountActivity : AppCompatActivity() {

ViewCompat.setOnApplyWindowInsetsListener(window.decorView) { v: View, insets: WindowInsetsCompat ->
val systemBars: Insets = insets.getInsets(WindowInsetsCompat.Type.systemBars())
v.setPadding(0, systemBars.top, 0, systemBars.bottom)
v.setPadding(systemBars.left, systemBars.top, systemBars.right, systemBars.bottom)
if (Build.VERSION.SDK_INT >= 35)
binding.AccountView.updatePadding(top = 172)
WindowInsetsCompat.CONSUMED
}

if (!Utils.isDarkTheme(this))
WindowInsetsControllerCompat(window, binding.root).isAppearanceLightStatusBars = true

if (Build.VERSION.SDK_INT >= 35)
binding.AccountView.updatePadding(top = 172)

supportActionBar?.setDisplayHomeAsUpEnabled(true)

uri = binding.Uri
Expand Down
7 changes: 3 additions & 4 deletions app/src/main/kotlin/com/tutpro/baresip/AccountsActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -37,16 +37,15 @@ class AccountsActivity : AppCompatActivity() {

ViewCompat.setOnApplyWindowInsetsListener(window.decorView) { v: View, insets: WindowInsetsCompat ->
val systemBars: Insets = insets.getInsets(WindowInsetsCompat.Type.systemBars())
v.setPadding(0, systemBars.top, 0, systemBars.bottom)
v.setPadding(systemBars.left, systemBars.top, systemBars.right, systemBars.bottom)
if (Build.VERSION.SDK_INT >= 35)
binding.AccountsView.updatePadding(top = 172)
WindowInsetsCompat.CONSUMED
}

if (!Utils.isDarkTheme(this))
WindowInsetsControllerCompat(window, binding.root).isAppearanceLightStatusBars = true

if (Build.VERSION.SDK_INT >= 35)
binding.AccountsView.updatePadding(top = 172)

aor = intent.getStringExtra("aor")!!
Utils.addActivity("accounts,$aor")

Expand Down
2 changes: 1 addition & 1 deletion app/src/main/kotlin/com/tutpro/baresip/AudioActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ class AudioActivity : AppCompatActivity() {

ViewCompat.setOnApplyWindowInsetsListener(window.decorView) { v: View, insets: WindowInsetsCompat ->
val systemBars: Insets = insets.getInsets(WindowInsetsCompat.Type.systemBars())
v.setPadding(0, systemBars.top, 0, systemBars.bottom)
v.setPadding(systemBars.left, systemBars.top, systemBars.right, systemBars.bottom)
if (Build.VERSION.SDK_INT >= 35)
binding.AudioView.updatePadding(top = systemBars.top + 56)
WindowInsetsCompat.CONSUMED
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ class CallDetailsActivity : AppCompatActivity() {

ViewCompat.setOnApplyWindowInsetsListener(window.decorView) { v: View, insets: WindowInsetsCompat ->
val systemBars: Insets = insets.getInsets(WindowInsetsCompat.Type.systemBars())
v.setPadding(0, systemBars.top, 0, systemBars.bottom)
v.setPadding(systemBars.left, systemBars.top, systemBars.right, systemBars.bottom)
if (Build.VERSION.SDK_INT >= 35)
binding.CallDetailsView.updatePadding(top = systemBars.top + 56)
WindowInsetsCompat.CONSUMED
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/kotlin/com/tutpro/baresip/CallsActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ class CallsActivity : AppCompatActivity() {

ViewCompat.setOnApplyWindowInsetsListener(window.decorView) { v: View, insets: WindowInsetsCompat ->
val systemBars: Insets = insets.getInsets(WindowInsetsCompat.Type.systemBars())
v.setPadding(0, systemBars.top, 0, systemBars.bottom)
v.setPadding(systemBars.left, systemBars.top, systemBars.right, systemBars.bottom)
if (Build.VERSION.SDK_INT >= 35)
binding.CallsView.updatePadding(top = systemBars.top + 56)
WindowInsetsCompat.CONSUMED
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/kotlin/com/tutpro/baresip/ChatActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ class ChatActivity : AppCompatActivity() {

ViewCompat.setOnApplyWindowInsetsListener(window.decorView) { v: View, insets: WindowInsetsCompat ->
val systemBars: Insets = insets.getInsets(WindowInsetsCompat.Type.systemBars())
v.setPadding(0, systemBars.top, 0, systemBars.bottom)
v.setPadding(systemBars.left, systemBars.top, systemBars.right, systemBars.bottom)
if (Build.VERSION.SDK_INT >= 35)
binding.ChatView.updatePadding(top = systemBars.top + 56)
WindowInsetsCompat.CONSUMED
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/kotlin/com/tutpro/baresip/ChatsActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ class ChatsActivity: AppCompatActivity() {

ViewCompat.setOnApplyWindowInsetsListener(window.decorView) { v: View, insets: WindowInsetsCompat ->
val systemBars: Insets = insets.getInsets(WindowInsetsCompat.Type.systemBars())
v.setPadding(0, systemBars.top, 0, systemBars.bottom)
v.setPadding(systemBars.left, systemBars.top, systemBars.right, systemBars.bottom)
if (Build.VERSION.SDK_INT >= 35)
binding.ChatsView.updatePadding(top = systemBars.top + 56)
WindowInsetsCompat.CONSUMED
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/kotlin/com/tutpro/baresip/CodecsActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ class CodecsActivity : AppCompatActivity() {

ViewCompat.setOnApplyWindowInsetsListener(window.decorView) { v: View, insets: WindowInsetsCompat ->
val systemBars: Insets = insets.getInsets(WindowInsetsCompat.Type.systemBars())
v.setPadding(0, systemBars.top, 0, systemBars.bottom)
v.setPadding(systemBars.left, systemBars.top, systemBars.right, systemBars.bottom)
if (Build.VERSION.SDK_INT >= 35)
binding.CodecsView.updatePadding(top = systemBars.top + 64)
WindowInsetsCompat.CONSUMED
Expand Down
7 changes: 3 additions & 4 deletions app/src/main/kotlin/com/tutpro/baresip/ConfigActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -104,16 +104,15 @@ class ConfigActivity : AppCompatActivity() {

ViewCompat.setOnApplyWindowInsetsListener(window.decorView) { v: View, insets: WindowInsetsCompat ->
val systemBars: Insets = insets.getInsets(WindowInsetsCompat.Type.systemBars())
v.setPadding(0, systemBars.top, 0, systemBars.bottom)
v.setPadding(systemBars.left, systemBars.top, systemBars.right, systemBars.bottom)
if (Build.VERSION.SDK_INT >= 35)
binding.ConfigView.updatePadding(top = 172)
WindowInsetsCompat.CONSUMED
}

if (!Utils.isDarkTheme(this))
WindowInsetsControllerCompat(window, binding.root).isAppearanceLightStatusBars = true

if (Build.VERSION.SDK_INT >= 35)
binding.ConfigView.updatePadding(top = 172)

Utils.addActivity("config")

baresipService = Intent(this@ConfigActivity, BaresipService::class.java)
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/kotlin/com/tutpro/baresip/ContactActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ class ContactActivity : AppCompatActivity() {

ViewCompat.setOnApplyWindowInsetsListener(window.decorView) { v: View, insets: WindowInsetsCompat ->
val systemBars: Insets = insets.getInsets(WindowInsetsCompat.Type.systemBars())
v.setPadding(0, systemBars.top, 0, systemBars.bottom)
v.setPadding(systemBars.left, systemBars.top, systemBars.right, systemBars.bottom)
if (Build.VERSION.SDK_INT >= 35)
binding.ContactView.updatePadding(top = systemBars.top + 56)
WindowInsetsCompat.CONSUMED
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/kotlin/com/tutpro/baresip/ContactsActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ class ContactsActivity : AppCompatActivity() {

ViewCompat.setOnApplyWindowInsetsListener(window.decorView) { v: View, insets: WindowInsetsCompat ->
val systemBars: Insets = insets.getInsets(WindowInsetsCompat.Type.systemBars())
v.setPadding(0, systemBars.top, 0, systemBars.bottom)
v.setPadding(systemBars.left, systemBars.top, systemBars.right, systemBars.bottom)
if (Build.VERSION.SDK_INT >= 35)
binding.ContactsView.updatePadding(top = systemBars.top + 56)
WindowInsetsCompat.CONSUMED
Expand Down

0 comments on commit 0a17139

Please sign in to comment.