summaryrefslogtreecommitdiffhomepage
path: root/app/src
diff options
context:
space:
mode:
authorSamuel Holland <samuel@sholland.org>2017-08-16 01:05:13 -0500
committerSamuel Holland <samuel@sholland.org>2017-08-16 01:05:13 -0500
commit6d2960b8537f67d7b4051cb244500fbe3f0bcd7e (patch)
treeafdc9afb424dbbf3a5c4c504fe05f05f398cf12f /app/src
parent73217a098a264e3da8497b2c3696c8816004ca64 (diff)
ConfigActivity: Adjust when the back arrow is shown
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Diffstat (limited to 'app/src')
-rw-r--r--app/src/main/java/com/wireguard/android/ConfigActivity.java18
1 files changed, 9 insertions, 9 deletions
diff --git a/app/src/main/java/com/wireguard/android/ConfigActivity.java b/app/src/main/java/com/wireguard/android/ConfigActivity.java
index 90ba754a..4833d876 100644
--- a/app/src/main/java/com/wireguard/android/ConfigActivity.java
+++ b/app/src/main/java/com/wireguard/android/ConfigActivity.java
@@ -31,13 +31,15 @@ public class ConfigActivity extends BaseConfigActivity {
@Override
public void onBackPressed() {
super.onBackPressed();
- // Ensure the current config is cleared when going back to the single-fragment-layout list.
+ if ((isEditing && isSplitLayout) || (!isEditing && !isSplitLayout)) {
+ if (getActionBar() != null)
+ getActionBar().setDisplayHomeAsUpEnabled(false);
+ }
+ // Ensure the current config is cleared when going back to the single-pane-layout list.
if (isEditing)
isEditing = false;
else
setCurrentConfig(null);
- if (!isSplitLayout && fm.getBackStackEntryCount() == 0 && getActionBar() != null)
- getActionBar().setDisplayHomeAsUpEnabled(false);
}
@Override
@@ -77,10 +79,8 @@ public class ConfigActivity extends BaseConfigActivity {
if (!isSplitLayout)
setTitle(config != null ? config.getName() : getString(R.string.app_name));
// Update the fragment in the main container.
- if (isEditing) {
- fm.popBackStackImmediate();
- isEditing = false;
- }
+ if (isEditing)
+ onBackPressed();
if (config != null) {
final boolean shouldPush = !isSplitLayout &&
fm.findFragmentById(mainContainer) instanceof ConfigListFragment;
@@ -97,8 +97,8 @@ public class ConfigActivity extends BaseConfigActivity {
onBackPressed();
return true;
case R.id.menu_action_edit:
- switchToFragment(mainContainer, TAG_EDIT, true);
isEditing = true;
+ switchToFragment(mainContainer, TAG_EDIT, true);
return true;
case R.id.menu_action_save:
// This menu item is handled by the current fragment.
@@ -186,7 +186,7 @@ public class ConfigActivity extends BaseConfigActivity {
if (push) {
transaction.addToBackStack(null);
transaction.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_FADE);
- if (!isSplitLayout && getActionBar() != null)
+ if (getActionBar() != null && (!isSplitLayout || isEditing))
getActionBar().setDisplayHomeAsUpEnabled(true);
}
transaction.replace(container, fragment, null).commit();