summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDanny Baumann <dannybaumann@web.de>2013-05-15 10:58:27 +0200
committerDanny Baumann <dannybaumann@web.de>2013-05-17 14:39:10 +0200
commit5a94560d926ccf8ecfde3f7cdc90780ccf73e274 (patch)
tree945aef38ade2a5cab0a62d23cfcfd7e3203e87d6
parentba7f45a393bbdbcc3e94aa340212e595230bb90b (diff)
downloadpackages_apps_settings-5a94560d926ccf8ecfde3f7cdc90780ccf73e274.zip
packages_apps_settings-5a94560d926ccf8ecfde3f7cdc90780ccf73e274.tar.gz
packages_apps_settings-5a94560d926ccf8ecfde3f7cdc90780ccf73e274.tar.bz2
Fix entering navbar editor in expanded desktop mode.
Uses the new system UI visibility flag to show the navbar in expanded desktop mode. Change-Id: Ia515b3c5a73d0741c3aad5421c9ac46d9876c177
-rw-r--r--src/com/android/settings/cyanogenmod/NavBar.java88
1 files changed, 37 insertions, 51 deletions
diff --git a/src/com/android/settings/cyanogenmod/NavBar.java b/src/com/android/settings/cyanogenmod/NavBar.java
index 2c69163..9fc56af 100644
--- a/src/com/android/settings/cyanogenmod/NavBar.java
+++ b/src/com/android/settings/cyanogenmod/NavBar.java
@@ -47,37 +47,27 @@ public class NavBar extends Fragment {
private static final int MENU_EDIT = Menu.FIRST + 1;
@Override
+ public void onAttach(Activity activity) {
+ super.onAttach(activity);
+ mActivity = activity;
+ mActivity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
+ }
+
+ @Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.nav_bar, container, false);
- setHasOptionsMenu(true);
+
mContainer = container;
- mActivity = getActivity();
- mActivity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
- return view;
- }
+ setHasOptionsMenu(true);
- /**
- * Toggles navbar edit mode
- * @param on True to enter edit mode / false to exit
- * @param save True to save changes / false to discard them
- */
- private void toggleEditMode(boolean on, boolean save) {
- mIntent.putExtra("edit", on);
- mIntent.putExtra("save", save);
- mActivity.sendBroadcast(mIntent);
- if (mEditMenu != null) {
- mEditMenu.setTitle(on ? R.string.navigation_bar_menu_editable : R.string.navigation_bar_menu_locked)
- .setIcon(on ? R.drawable.stat_navbar_edit_on : R.drawable.stat_navbar_edit_off);
- }
+ return view;
}
@Override
- public void onResume() {
- super.onResume();
- mWasInExpandedState = Settings.System.getInt(mActivity.getContentResolver(),
- Settings.System.EXPANDED_DESKTOP_STATE, 0) == 1;
- setExpandedDesktopState(false);
+ public void onViewCreated(View view, Bundle savedInstanceState) {
+ view.setSystemUiVisibility(View.SYSTEM_UI_FLAG_SHOW_NAVIGATION_IN_EXPANDED_DESKTOP);
+
// If running on a phone, remove padding around container
if (Utils.isPhone(mActivity)) {
mContainer.setPadding(0, 0, 0, 0);
@@ -85,6 +75,18 @@ public class NavBar extends Fragment {
}
@Override
+ public void onDetach() {
+ mActivity = null;
+ super.onDetach();
+ }
+
+ @Override
+ public void onPause() {
+ super.onPause();
+ toggleEditMode(false, false);
+ }
+
+ @Override
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
menu.add(0, MENU_RESET, 0, R.string.profile_reset_title)
.setIcon(R.drawable.ic_settings_backup)
@@ -133,34 +135,18 @@ public class NavBar extends Fragment {
}
}
- private void setExpandedDesktopState(boolean on) {
- if (mWasInExpandedState) {
- Settings.System.putInt(mActivity.getContentResolver(),
- Settings.System.EXPANDED_DESKTOP_STATE, on ? 1 : 0);
- if (on) {
- mWasInExpandedState = false;
- }
+ /**
+ * Toggles navbar edit mode
+ * @param on True to enter edit mode / false to exit
+ * @param save True to save changes / false to discard them
+ */
+ private void toggleEditMode(boolean on, boolean save) {
+ mIntent.putExtra("edit", on);
+ mIntent.putExtra("save", save);
+ mActivity.sendBroadcast(mIntent);
+ if (mEditMenu != null) {
+ mEditMenu.setTitle(on ? R.string.navigation_bar_menu_editable : R.string.navigation_bar_menu_locked)
+ .setIcon(on ? R.drawable.stat_navbar_edit_on : R.drawable.stat_navbar_edit_off);
}
}
-
- @Override
- public void onPause() {
- toggleEditMode(false, false);
- setExpandedDesktopState(true);
- super.onPause();
- }
-
- @Override
- public void onStop() {
- toggleEditMode(false, false);
- setExpandedDesktopState(true);
- super.onStop();
- }
-
- @Override
- public void onDestroy() {
- toggleEditMode(false, false);
- setExpandedDesktopState(true);
- super.onDestroy();
- }
}