Skip to content

Commit

Permalink
Merge pull request #207 from AshiqYadav/main
Browse files Browse the repository at this point in the history
Fix back button not exiting app
  • Loading branch information
andrewtavis authored Oct 18, 2024
2 parents 0314f76 + fe76137 commit a186771
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions app/src/main/java/be/scri/activities/MainActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,19 @@ class MainActivity : AppCompatActivity() {
}
}

override fun onBackPressed() {
super.onBackPressed()
if (viewPager.currentItem == 0) {
if (binding.fragmentContainer.visibility == View.VISIBLE) {
binding.fragmentContainer.visibility = View.GONE
} else {
finish()
}
} else {
viewPager.currentItem = viewPager.currentItem - 1
}
}

fun hideHint() {
val hintLayout = findViewById<View>(R.id.hint_layout)
hintLayout.visibility = View.GONE
Expand Down

0 comments on commit a186771

Please sign in to comment.