mirror of
https://github.com/KDE/kdeconnect-android
synced 2025-08-30 13:47:41 +00:00
Capture back press in Settings and About
The Settings and About fragments are arguably one logical layer below the PairingFragment (which feels like the "main screen"). Capture the back press and return to the PairingFragment. Fixes https://bugs.kde.org/show_bug.cgi?id=442716. Notes: - In a DeviceFragment back-pressing continues to close the app, as before. Judging from the fact that the app persists the last selected device to the shared prefs, I assume this is a intentional. - I also thought about storing from where the Settings/About were opened (e.g. from a specific DeviceFragment) and returning there. However this would be a much larger change with arguable user benefit. After all, from the PairingFragment it's just a single click to your device.
This commit is contained in:
committed by
Simon Redman
parent
cbabc40e7b
commit
8e43ef421b
@@ -249,6 +249,10 @@ public class MainActivity extends AppCompatActivity implements SharedPreferences
|
||||
public void onBackPressed() {
|
||||
if (mDrawerLayout.isDrawerOpen(mNavigationView)) {
|
||||
mDrawerLayout.closeDrawer(mNavigationView);
|
||||
} else if (mCurrentMenuEntry == MENU_ENTRY_SETTINGS || mCurrentMenuEntry == MENU_ENTRY_ABOUT) {
|
||||
mCurrentMenuEntry = MENU_ENTRY_ADD_DEVICE;
|
||||
mNavigationView.setCheckedItem(MENU_ENTRY_ADD_DEVICE);
|
||||
setContentFragment(new PairingFragment());
|
||||
} else {
|
||||
super.onBackPressed();
|
||||
}
|
||||
|
Reference in New Issue
Block a user