diff options
author | Michael Bestas <mikeioannina@gmail.com> | 2013-10-10 02:08:01 +0300 |
---|---|---|
committer | Steve Kondik <shade@chemlab.org> | 2013-10-25 02:28:07 -0700 |
commit | 148fd03e0aded0c5e5188c64a35d554a052eba7d (patch) | |
tree | c5ff594f7da59255182c87c39bba960b7884ff40 /src/com/android/camera | |
parent | 6efe7ec43d32c8638da823ef8a464b13ec6eca31 (diff) | |
download | android_packages_apps_Gallery2-148fd03e0aded0c5e5188c64a35d554a052eba7d.tar.gz android_packages_apps_Gallery2-148fd03e0aded0c5e5188c64a35d554a052eba7d.tar.bz2 android_packages_apps_Gallery2-148fd03e0aded0c5e5188c64a35d554a052eba7d.zip |
Camera: Additional scene & focus modes
-Scene modes
-Focus modes
-Focus mode settings
-Fix filtering of unsupported focus modes
-Add one missing resolution
-Extra settings menu
Use ListPreference instead of IconListPreference in scene mode selection
It doesn't look good in devices with many supported scene modes
and we don't need to create drawables for all new scene modes.
Added an extra settings menu in photo mode to hold more features
in the future because aosp UI is unusable when it contains many options.
Signed-off-by: Michael Bestas <mikeioannina@gmail.com>
Change-Id: Ifa411ffc77c72d968ea769dad76575b901ad7a84
Diffstat (limited to 'src/com/android/camera')
-rw-r--r-- | src/com/android/camera/CameraSettings.java | 7 | ||||
-rw-r--r-- | src/com/android/camera/PhotoMenu.java | 99 |
2 files changed, 89 insertions, 17 deletions
diff --git a/src/com/android/camera/CameraSettings.java b/src/com/android/camera/CameraSettings.java index 9504e9ba6..cbdfb3f91 100644 --- a/src/com/android/camera/CameraSettings.java +++ b/src/com/android/camera/CameraSettings.java @@ -206,10 +206,9 @@ public class CameraSettings { flashMode, mParameters.getSupportedFlashModes()); } if (focusMode != null) { - if (!Util.isFocusAreaSupported(mParameters)) { - filterUnsupportedOptions(group, - focusMode, mParameters.getSupportedFocusModes()); - } else if (!mContext.getResources().getBoolean(R.bool.wantsFocusModes)) { + filterUnsupportedOptions(group, + focusMode, mParameters.getSupportedFocusModes()); + if (!mContext.getResources().getBoolean(R.bool.wantsFocusModes)) { // Remove the focus mode if we can use tap-to-focus. removePreference(group, focusMode.getKey()); } diff --git a/src/com/android/camera/PhotoMenu.java b/src/com/android/camera/PhotoMenu.java index 0de790a60..68f65a0c1 100644 --- a/src/com/android/camera/PhotoMenu.java +++ b/src/com/android/camera/PhotoMenu.java @@ -1,5 +1,6 @@ /* * Copyright (C) 2012 The Android Open Source Project + * Copyright (C) 2013 The CyanogenMod Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,6 +17,7 @@ package com.android.camera; +import android.content.Context; import android.content.res.Resources; import android.hardware.Camera.Parameters; import android.view.LayoutInflater; @@ -23,6 +25,7 @@ import android.view.LayoutInflater; import com.android.camera.ui.AbstractSettingPopup; import com.android.camera.ui.CountdownTimerPopup; import com.android.camera.ui.ListPrefSettingPopup; +import com.android.camera.ui.MoreSettingPopup; import com.android.camera.ui.PieItem; import com.android.camera.ui.PieItem.OnClickListener; import com.android.camera.ui.PieRenderer; @@ -31,14 +34,21 @@ import com.android.gallery3d.R; import java.util.Locale; public class PhotoMenu extends PieController - implements CountdownTimerPopup.Listener, + implements MoreSettingPopup.Listener, + CountdownTimerPopup.Listener, ListPrefSettingPopup.Listener { private static String TAG = "CAM_photomenu"; private final String mSettingOff; private PhotoUI mUI; + private String[] mOtherKeys; private AbstractSettingPopup mPopup; + + private static final int POPUP_NONE = 0; + private static final int POPUP_FIRST_LEVEL = 1; + private static final int POPUP_SECOND_LEVEL = 2; + private int mPopupStatus; private CameraActivity mActivity; public PhotoMenu(CameraActivity activity, PhotoUI ui, PieRenderer pie) { @@ -51,6 +61,7 @@ public class PhotoMenu extends PieController public void initialize(PreferenceGroup group) { super.initialize(group); mPopup = null; + mPopupStatus = POPUP_NONE; PieItem item = null; final Resources res = mActivity.getResources(); Locale locale = res.getConfiguration().locale; @@ -69,7 +80,7 @@ public class PhotoMenu extends PieController } // more settings PieItem more = makeItem(R.drawable.ic_settings_holo_light); - more.setLabel(res.getString(R.string.camera_menu_more_label)); + more.setLabel(res.getString(R.string.camera_menu_settings_label)); mRenderer.addItem(more); // flash if (group.findPreference(CameraSettings.KEY_FLASH_MODE) != null) { @@ -110,13 +121,15 @@ public class PhotoMenu extends PieController } // countdown timer final ListPreference ctpref = group.findPreference(CameraSettings.KEY_TIMER); - final ListPreference beeppref = group.findPreference(CameraSettings.KEY_TIMER_SOUND_EFFECTS); + final ListPreference beeppref = + group.findPreference(CameraSettings.KEY_TIMER_SOUND_EFFECTS); item = makeItem(R.drawable.ic_timer); item.setLabel(res.getString(R.string.pref_camera_timer_title).toUpperCase(locale)); item.setOnClickListener(new OnClickListener() { @Override public void onClick(PieItem item) { - CountdownTimerPopup timerPopup = (CountdownTimerPopup) mActivity.getLayoutInflater().inflate( + CountdownTimerPopup timerPopup = + (CountdownTimerPopup) mActivity.getLayoutInflater().inflate( R.layout.countdown_setting_popup, null, false); timerPopup.initialize(ctpref, beeppref); timerPopup.setSettingChangedListener(PhotoMenu.this); @@ -130,16 +143,19 @@ public class PhotoMenu extends PieController final ListPreference sizePref = group.findPreference(CameraSettings.KEY_PICTURE_SIZE); if (sizePref != null) { item = makeItem(R.drawable.ic_imagesize); - item.setLabel(res.getString(R.string.pref_camera_picturesize_title).toUpperCase(locale)); + item.setLabel(res.getString( + R.string.pref_camera_picturesize_title).toUpperCase(locale)); item.setOnClickListener(new OnClickListener() { @Override public void onClick(PieItem item) { - ListPrefSettingPopup popup = (ListPrefSettingPopup) mActivity.getLayoutInflater().inflate( + ListPrefSettingPopup popup = + (ListPrefSettingPopup) mActivity.getLayoutInflater().inflate( R.layout.list_pref_setting_popup, null, false); popup.initialize(sizePref); popup.setSettingChangedListener(PhotoMenu.this); mUI.dismissPopup(); mPopup = popup; + mPopupStatus = POPUP_SECOND_LEVEL; mUI.showPopup(mPopup); } }); @@ -160,6 +176,7 @@ public class PhotoMenu extends PieController popup.setSettingChangedListener(PhotoMenu.this); mUI.dismissPopup(); mPopup = popup; + mPopupStatus = POPUP_SECOND_LEVEL; mUI.showPopup(mPopup); } }); @@ -172,20 +189,57 @@ public class PhotoMenu extends PieController more.addItem(item); } // scene mode - if (group.findPreference(CameraSettings.KEY_SCENE_MODE) != null) { - IconListPreference pref = (IconListPreference) group.findPreference( - CameraSettings.KEY_SCENE_MODE); - pref.setUseSingleIcon(true); - item = makeItem(CameraSettings.KEY_SCENE_MODE); + final ListPreference scenePref = group.findPreference(CameraSettings.KEY_SCENE_MODE); + if (scenePref != null) { + item = makeItem(R.drawable.ic_sce); + item.setLabel(res.getString(R.string.pref_camera_scenemode_title).toUpperCase(locale)); + item.setOnClickListener(new OnClickListener() { + @Override + public void onClick(PieItem item) { + LayoutInflater inflater = mActivity.getLayoutInflater(); + ListPrefSettingPopup popup = (ListPrefSettingPopup) inflater.inflate( + R.layout.list_pref_setting_popup, null, false); + popup.initialize(scenePref); + popup.setSettingChangedListener(PhotoMenu.this); + mUI.dismissPopup(); + mPopup = popup; + mPopupStatus = POPUP_SECOND_LEVEL; + mUI.showPopup(mPopup); + } + }); more.addItem(item); } + // extra settings popup + mOtherKeys = new String[] { + CameraSettings.KEY_FOCUS_MODE + }; + item = makeItem(R.drawable.ic_settings_holo_light); + item.setLabel(res.getString(R.string.camera_menu_more_label).toUpperCase(locale)); + item.setOnClickListener(new OnClickListener() { + @Override + public void onClick(PieItem item) { + if (mPopup == null || mPopupStatus != POPUP_FIRST_LEVEL) { + LayoutInflater inflater = mActivity.getLayoutInflater(); + MoreSettingPopup popup = (MoreSettingPopup) inflater.inflate( + R.layout.more_setting_popup, null, false); + popup.initialize(mPreferenceGroup, mOtherKeys); + popup.setSettingChangedListener(PhotoMenu.this); + mPopup = popup; + mPopupStatus = POPUP_FIRST_LEVEL; + } + mUI.showPopup(mPopup); + } + }); + more.addItem(item); } @Override // Hit when an item in a popup gets selected public void onListPrefChanged(ListPreference pref) { if (mPopup != null) { - mUI.dismissPopup(); + if (mPopupStatus == POPUP_SECOND_LEVEL) { + mUI.dismissPopup(); + } } onSettingChanged(pref); } @@ -193,7 +247,9 @@ public class PhotoMenu extends PieController public void popupDismissed() { // the popup gets dismissed if (mPopup != null) { - mPopup = null; + if (mPopupStatus == POPUP_SECOND_LEVEL) { + mPopup = null; + } } } @@ -222,4 +278,21 @@ public class PhotoMenu extends PieController super.onSettingChanged(pref); } + @Override + // Hit when an item in the first-level popup gets selected, then bring up + // the second-level popup + public void onPreferenceClicked(ListPreference pref) { + if (mPopupStatus != POPUP_FIRST_LEVEL) return; + + LayoutInflater inflater = mActivity.getLayoutInflater(); + ListPrefSettingPopup basic = (ListPrefSettingPopup) inflater.inflate( + R.layout.list_pref_setting_popup, null, false); + basic.initialize(pref); + basic.setSettingChangedListener(this); + mUI.dismissPopup(); + mPopup = basic; + mUI.showPopup(mPopup); + mPopupStatus = POPUP_SECOND_LEVEL; + } + } |