aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStephen Bird <sebirdman@gmail.com>2015-05-12 17:30:16 -0700
committerStephen Bird <sbird@cyngn.com>2015-05-15 17:40:34 +0000
commitf56063cec4dbdc58e4f2a4d8162e394045f33aa8 (patch)
tree97d77da240e78594144664d7ca33ce7fb34f94fa
parent0bb92a04b7078c695e7e7b9c901353de509ec96a (diff)
downloadandroid_packages_apps_CMFileManager-f56063cec4dbdc58e4f2a4d8162e394045f33aa8.tar.gz
android_packages_apps_CMFileManager-f56063cec4dbdc58e4f2a4d8162e394045f33aa8.tar.bz2
android_packages_apps_CMFileManager-f56063cec4dbdc58e4f2a4d8162e394045f33aa8.zip
CM Easy Mode File Manager Navigation fixes
This patch fixes an issue where the user cannot get back to easy mode without exiting and re-entering the application in certain situations Repro Steps: 1) Select "All" in the easy mode list 2) Action Bar arrow is gone, pressing back on the navbar does not return you to easy mode Change-Id: I5f6b47b8b69e57cffac77f7bfa24f8a75d8ff1d4 (cherry picked from commit c5c685221337c3c0b1f13ef20423de56fdba8870) (cherry picked from commit 7cf35abef8a342effac7dff4b2b401a9d4514e89)
-rw-r--r--res/layout/navigation.xml2
-rw-r--r--src/com/cyanogenmod/filemanager/activities/NavigationActivity.java42
2 files changed, 40 insertions, 4 deletions
diff --git a/res/layout/navigation.xml b/res/layout/navigation.xml
index e457d1b9..fad876ad 100644
--- a/res/layout/navigation.xml
+++ b/res/layout/navigation.xml
@@ -46,7 +46,7 @@
android:layout_width="match_parent"
android:minHeight="?android:attr/actionBarSize"
android:background="?android:attr/colorPrimary"
- android:theme="@style/FileManager.Widget.ActionBar.White"/>
+ android:theme="@android:style/Theme.Material"/>
<!-- Navigation View -->
<com.cyanogenmod.filemanager.ui.widgets.NavigationView
diff --git a/src/com/cyanogenmod/filemanager/activities/NavigationActivity.java b/src/com/cyanogenmod/filemanager/activities/NavigationActivity.java
index a3af6b56..b296a402 100644
--- a/src/com/cyanogenmod/filemanager/activities/NavigationActivity.java
+++ b/src/com/cyanogenmod/filemanager/activities/NavigationActivity.java
@@ -478,6 +478,8 @@ public class NavigationActivity extends Activity
private int mOrientation;
+ private boolean mNeedsEasyMode = false;
+
/**
* @hide
*/
@@ -688,6 +690,16 @@ public class NavigationActivity extends Activity
if (mDrawerToggle.onOptionsItemSelected(item)) {
return true;
}
+
+ if (mNeedsEasyMode) {
+ if (item.getItemId() == android.R.id.home) {
+ if (mHistory.size() == 0 && !isEasyModeVisible()) {
+ performShowEasyMode();
+ } else {
+ back();
+ }
+ }
+ }
return super.onOptionsItemSelected(item);
}
@@ -973,6 +985,7 @@ public class NavigationActivity extends Activity
private void performShowEasyMode() {
mEasyModeListView.setVisibility(View.VISIBLE);
getCurrentNavigationView().setVisibility(View.GONE);
+ performShowBackArrow(false);
}
/**
@@ -983,6 +996,16 @@ public class NavigationActivity extends Activity
getCurrentNavigationView().setVisibility(View.VISIBLE);
}
+ private void performShowBackArrow(boolean showBackArrow) {
+ if (mNeedsEasyMode) {
+ mDrawerToggle.setDrawerIndicatorEnabled(!showBackArrow);
+ }
+ }
+
+ private boolean isEasyModeVisible() {
+ return mEasyModeListView.getVisibility() != View.GONE;
+ }
+
/**
* Method takes a bookmark as argument and adds it to the bookmark list in
* the drawer
@@ -1089,6 +1112,7 @@ public class NavigationActivity extends Activity
} else {
performHideEasyMode();
}
+ performShowBackArrow(!mDrawerToggle.isDrawerIndicatorEnabled());
getCurrentNavigationView().open(fso);
mDrawerLayout.closeDrawer(Gravity.START);
}
@@ -1464,7 +1488,9 @@ public class NavigationActivity extends Activity
intent.putExtra(SearchManager.QUERY, "*"); // Use wild-card '*'
if (position == 0) {
+ // the user has selected all items, they want to see their folders so let's do that.
performHideEasyMode();
+ performShowBackArrow(true);
return;
} else {
@@ -1643,8 +1669,9 @@ public class NavigationActivity extends Activity
}
}
- needsEasyMode = needsEasyMode
- && getResources().getBoolean(R.bool.cmcc_show_easy_mode);
+ mNeedsEasyMode = getResources().getBoolean(R.bool.cmcc_show_easy_mode);
+
+ needsEasyMode = needsEasyMode && mNeedsEasyMode;
if (needsEasyMode) {
performShowEasyMode();
} else {
@@ -1734,6 +1761,11 @@ public class NavigationActivity extends Activity
if (checkBackAction()) {
performHideEasyMode();
return;
+ } else {
+ if (mNeedsEasyMode && !isEasyModeVisible()) {
+ performShowEasyMode();
+ return;
+ }
}
// An exit event has occurred, force the destroy the consoles
@@ -2120,7 +2152,11 @@ public class NavigationActivity extends Activity
//Communicate the user that the next time the application will be closed
this.mExitBackTimeout = System.currentTimeMillis();
DialogHelper.showToast(this, R.string.msgs_push_again_to_exit, Toast.LENGTH_SHORT);
- return true;
+ if (mNeedsEasyMode) {
+ return isEasyModeVisible();
+ } else {
+ return true;
+ }
}
//Back action not applied