summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDanny Baumann <dannybaumann@web.de>2013-05-18 13:25:27 -0700
committerGerrit Code Review <gerrit@cyanogenmod.org>2013-05-18 13:25:27 -0700
commitf8b41f6deb4369d6c8cbd82581d574ca0d41085d (patch)
treecb780a99c956b86bc71769ad4f4dc0fce642e07d
parent152a38d50c5fcf27a58c7d57fd1e058e9c56088b (diff)
parent5a94560d926ccf8ecfde3f7cdc90780ccf73e274 (diff)
downloadpackages_apps_settings-f8b41f6deb4369d6c8cbd82581d574ca0d41085d.zip
packages_apps_settings-f8b41f6deb4369d6c8cbd82581d574ca0d41085d.tar.gz
packages_apps_settings-f8b41f6deb4369d6c8cbd82581d574ca0d41085d.tar.bz2
Merge "Fix entering navbar editor in expanded desktop mode." into cm-10.1
-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();
- }
}