Commit 3ca157c6 authored by Mygod's avatar Mygod

Fix back button

parent 7a68333c
......@@ -344,9 +344,12 @@ class MainActivity : AppCompatActivity(), ShadowsocksConnection.Interface, OnPre
override fun onBackPressed() {
if (drawer.isDrawerOpen(Gravity.START)) drawer.closeDrawers() else {
val currentFragment = supportFragmentManager.findFragmentById(R.id.fragment_holder) as ToolbarFragment
if (!currentFragment.onBackPressed())
if (currentFragment is ProfilesFragment) super.onBackPressed()
else navigation.menu.findItem(R.id.profiles).isChecked = true
if (!currentFragment.onBackPressed()) {
if (currentFragment is ProfilesFragment) super.onBackPressed() else {
navigation.menu.findItem(R.id.profiles).isChecked = true
displayFragment(ProfilesFragment())
}
}
}
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment