aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStephen Bird <sebirdman@gmail.com>2015-05-12 17:30:16 -0700
committerNir Bruderman <nbruderman@gmail.com>2015-05-15 09:09:28 +0000
commit7cf35abef8a342effac7dff4b2b401a9d4514e89 (patch)
tree22431934c4c24c24891f33625efb67b530200da2
parent25ef6f709c0dc2753c4b21e49184d648db1da2f4 (diff)
downloadandroid_packages_apps_CMFileManager-7cf35abef8a342effac7dff4b2b401a9d4514e89.tar.gz
android_packages_apps_CMFileManager-7cf35abef8a342effac7dff4b2b401a9d4514e89.tar.bz2
android_packages_apps_CMFileManager-7cf35abef8a342effac7dff4b2b401a9d4514e89.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)
-rw-r--r--res/layout/navigation.xml2
-rwxr-xr-xsrc/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 f1489cd5..860db6d3 100755
--- a/src/com/cyanogenmod/filemanager/activities/NavigationActivity.java
+++ b/src/com/cyanogenmod/filemanager/activities/NavigationActivity.java
@@ -471,6 +471,8 @@ public class NavigationActivity extends Activity
private int mOrientation;
+ private boolean mNeedsEasyMode = false;
+
/**
* @hide
*/
@@ -682,6 +684,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);
}
@@ -967,6 +979,7 @@ public class NavigationActivity extends Activity
private void performShowEasyMode() {
mEasyModeListView.setVisibility(View.VISIBLE);
getCurrentNavigationView().setVisibility(View.GONE);
+ performShowBackArrow(false);
}
/**
@@ -977,6 +990,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
@@ -1083,6 +1106,7 @@ public class NavigationActivity extends Activity
} else {
performHideEasyMode();
}
+ performShowBackArrow(!mDrawerToggle.isDrawerIndicatorEnabled());
getCurrentNavigationView().open(fso);
mDrawerLayout.closeDrawer(Gravity.START);
}
@@ -1458,7 +1482,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 {
@@ -1656,8 +1682,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 {
@@ -1747,6 +1774,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
@@ -2133,7 +2165,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