summaryrefslogtreecommitdiffstats
path: root/src/com/android/camera/settings/CameraSettingsActivity.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/com/android/camera/settings/CameraSettingsActivity.java')
-rw-r--r--src/com/android/camera/settings/CameraSettingsActivity.java30
1 files changed, 24 insertions, 6 deletions
diff --git a/src/com/android/camera/settings/CameraSettingsActivity.java b/src/com/android/camera/settings/CameraSettingsActivity.java
index af80741b5..bb30b1122 100644
--- a/src/com/android/camera/settings/CameraSettingsActivity.java
+++ b/src/com/android/camera/settings/CameraSettingsActivity.java
@@ -49,6 +49,13 @@ import java.util.List;
* Provides the settings UI for the Camera app.
*/
public class CameraSettingsActivity extends FragmentActivity {
+ /**
+ * Used to denote a subsection of the preference tree to display in the
+ * Fragment. For instance, if 'Advanced' key is provided, the advanced
+ * preference section will be treated as the root for display. This is used
+ * to enable activity transitions between preference sections, and allows
+ * back/up stack to operate correctly.
+ */
public static final String PREF_SCREEN_EXTRA = "pref_screen_extra";
@Override
@@ -60,7 +67,10 @@ public class CameraSettingsActivity extends FragmentActivity {
actionBar.setTitle(R.string.mode_settings);
String prefKey = getIntent().getStringExtra(PREF_SCREEN_EXTRA);
- CameraSettingsFragment dialog = new CameraSettingsFragment(prefKey);
+ CameraSettingsFragment dialog = new CameraSettingsFragment();
+ Bundle bundle = new Bundle(1);
+ bundle.putString(PREF_SCREEN_EXTRA, prefKey);
+ dialog.setArguments(bundle);
getFragmentManager().beginTransaction().replace(android.R.id.content, dialog).commit();
}
@@ -83,7 +93,7 @@ public class CameraSettingsActivity extends FragmentActivity {
private static DecimalFormat sMegaPixelFormat = new DecimalFormat("##0.0");
private String[] mCamcorderProfileNames;
private CameraDeviceInfo mInfos;
- private final String mPrefKey;
+ private String mPrefKey;
private boolean mGetSubPrefAsRoot = true;
private boolean mPreferencesRemoved = false;
@@ -95,13 +105,13 @@ public class CameraSettingsActivity extends FragmentActivity {
private SelectedVideoQualities mVideoQualitiesBack;
private SelectedVideoQualities mVideoQualitiesFront;
- public CameraSettingsFragment(String prefKey) {
- mPrefKey = prefKey;
- }
-
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
+ Bundle arguments = getArguments();
+ if (arguments != null) {
+ mPrefKey = arguments.getString(PREF_SCREEN_EXTRA);
+ }
Context context = this.getActivity().getApplicationContext();
addPreferencesFromResource(R.xml.camera_preferences);
@@ -235,6 +245,14 @@ public class CameraSettingsActivity extends FragmentActivity {
* was found and removed.
*/
private boolean recursiveDelete(PreferenceGroup group, Preference preference) {
+ if (group == null) {
+ Log.d(TAG, "attempting to delete from null preference group");
+ return false;
+ }
+ if (preference == null) {
+ Log.d(TAG, "attempting to delete null preference");
+ return false;
+ }
if (group.removePreference(preference)) {
// Removal was successful.
return true;