diff options
author | nicolasroard <nicolasroard@google.com> | 2012-10-01 00:00:08 -0700 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2012-10-01 00:00:08 -0700 |
commit | d16e4ee3cb7e63a5c4fa128e1793a6dadab4066a (patch) | |
tree | 003146175dbff72bcd5c2ed5a2c55bfe20c119f7 | |
parent | 079ccc76aab8ab3e6ac5c999969c98d01d0ce71c (diff) | |
parent | 4367088e5419630afb1e849fc6ffbe885c0a9c1d (diff) | |
download | android_packages_apps_Snap-d16e4ee3cb7e63a5c4fa128e1793a6dadab4066a.tar.gz android_packages_apps_Snap-d16e4ee3cb7e63a5c4fa128e1793a6dadab4066a.tar.bz2 android_packages_apps_Snap-d16e4ee3cb7e63a5c4fa128e1793a6dadab4066a.zip |
am f497fdfa: Merge "Fix border bug and filter application - fix layout (use framelayout) - fix copy imagepreset - added a current image state panel - remove title for border images for now" into gb-ub-photos-arches
* commit 'f497fdfa1abfea7b4ddabd7850eb528ea1c126ee':
Fix border bug and filter application - fix layout (use framelayout) - fix copy imagepreset - added a current image state panel - remove title for border images for now
-rw-r--r-- | res/layout/filtershow_activity.xml | 36 | ||||
-rw-r--r-- | res/layout/filtershow_imagestate_row.xml | 47 | ||||
-rw-r--r-- | res/menu/filtershow_activity_menu.xml | 11 | ||||
-rw-r--r-- | res/values/filtershow_strings.xml | 69 | ||||
-rw-r--r-- | src/com/android/gallery3d/filtershow/presets/ImagePreset.java | 31 |
5 files changed, 161 insertions, 33 deletions
diff --git a/res/layout/filtershow_activity.xml b/res/layout/filtershow_activity.xml index 06583d8f0..0dead607f 100644 --- a/res/layout/filtershow_activity.xml +++ b/res/layout/filtershow_activity.xml @@ -14,16 +14,44 @@ limitations under the License. --> -<AbsoluteLayout xmlns:android="http://schemas.android.com/apk/res/android" +<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" > <LinearLayout + android:id="@+id/imageStatePanel" + android:layout_width="200dip" + android:layout_height="match_parent" + android:orientation="vertical" + android:visibility="invisible" + android:layout_gravity="right"> + + <TextView + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:background="@android:color/transparent" + android:gravity="center" + android:padding="2dip" + android:text="@string/imageState" + android:textColor="@android:color/white" + android:textSize="24sp" + android:textStyle="bold" /> + + <ListView + android:id="@+id/imageStateList" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:layout_weight="1" > + </ListView> + </LinearLayout> + + <LinearLayout android:id="@+id/historyPanel" android:layout_width="200dip" android:layout_height="match_parent" android:orientation="vertical" - android:visibility="invisible" > + android:visibility="invisible" + android:layout_gravity="right"> <TextView android:layout_width="match_parent" @@ -49,6 +77,7 @@ android:orientation="horizontal" > <Button + android:gravity="center" android:id="@+id/resetOperationsButton" style="@style/FilterShowHistoryButton" android:text="@string/reset" /> @@ -56,6 +85,7 @@ <Button android:id="@+id/saveOperationsButton" style="@style/FilterShowHistoryButton" + android:visibility="gone" android:text="@string/save" /> </LinearLayout> </LinearLayout> @@ -286,4 +316,4 @@ </LinearLayout> </LinearLayout> -</AbsoluteLayout>
\ No newline at end of file +</FrameLayout>
\ No newline at end of file diff --git a/res/layout/filtershow_imagestate_row.xml b/res/layout/filtershow_imagestate_row.xml new file mode 100644 index 000000000..2e9b1bf9b --- /dev/null +++ b/res/layout/filtershow_imagestate_row.xml @@ -0,0 +1,47 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- Copyright (C) 2012 The Android Open Source Project + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +--> + +<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" + xmlns:tools="http://schemas.android.com/tools" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:orientation="horizontal" + android:background="@drawable/filtershow_button_background"> + + <TextView + xmlns:android="http://schemas.android.com/apk/res/android" + android:id="@+id/imagestate_label" + android:layout_width="wrap_content" + android:layout_height="match_parent" + android:layout_weight="1" + android:gravity="left" + android:padding="10dip" + android:textSize="16dip" > + </TextView> + + <TextView + xmlns:android="http://schemas.android.com/apk/res/android" + android:id="@+id/imagestate_parameter" + android:layout_width="wrap_content" + android:layout_height="match_parent" + android:layout_weight="1" + android:gravity="right" + android:padding="10dip" + android:textSize="16dip" + android:textStyle="bold" > + </TextView> + +</LinearLayout>
\ No newline at end of file diff --git a/res/menu/filtershow_activity_menu.xml b/res/menu/filtershow_activity_menu.xml index f0c0f3247..8987e48e4 100644 --- a/res/menu/filtershow_activity_menu.xml +++ b/res/menu/filtershow_activity_menu.xml @@ -8,21 +8,26 @@ <item android:id="@+id/undoButton" android:icon="@drawable/filtershow_button_undo" - android:showAsAction="always" + android:showAsAction="never" android:title="@string/filtershow_undo"/> <item android:id="@+id/redoButton" android:icon="@drawable/filtershow_button_redo" - android:showAsAction="always" + android:showAsAction="never" android:title="@string/filtershow_redo"/> <item android:id="@+id/operationsButton" android:icon="@drawable/filtershow_button_operations" - android:showAsAction="ifRoom" + android:showAsAction="never" android:title="@string/show_history_panel"/> <item + android:id="@+id/showImageStateButton" + android:showAsAction="never" + android:title="@string/show_imagestate_panel" /> + <item android:id="@+id/menu_settings" android:enabled="false" + android:showAsAction="never" android:orderInCategory="100" android:title="@string/menu_settings"/> diff --git a/res/values/filtershow_strings.xml b/res/values/filtershow_strings.xml index 0a3e93d89..7d8613883 100644 --- a/res/values/filtershow_strings.xml +++ b/res/values/filtershow_strings.xml @@ -16,37 +16,72 @@ <resources> + <!-- Name for the image editor activity [CHAR LIMIT=NONE]--> <string name="app_name">FilterShow</string> - <string name="menu_settings">Settings</string> + <!-- Title for the image editor activity [CHAR LIMIT=NONE]--> <string name="title_activity_filter_show">FilterShowActivity</string> - <string name="save">Save</string> + + <!-- actionbar menu --> + + <!-- Text for the actionbar confirmation button [CHAR LIMIT=20] --> <string name="done">Done</string> - <string name="history">History</string> + <!-- Text for the undo menu item [CHAR LIMIT=20] --> + <string name="filtershow_undo">Undo</string> + <!-- Text for redo menu item [CHAR LIMIT=20] --> + <string name="filtershow_redo">Redo</string> + <!-- Text for the history panel menu item [CHAR LIMIT=20] --> <string name="show_history_panel">Show History</string> + <!-- Text for the history panel menu item [CHAR LIMIT=20] --> <string name="hide_history_panel">Hide History</string> + <!-- Text for the image state panel menu item [CHAR LIMIT=20] --> + <string name="show_imagestate_panel">Show Image State</string> + <!-- Text for the image state panel menu item [CHAR LIMIT=20] --> + <string name="hide_imagestate_panel">Hide Image State</string> + <!-- Name for the overflow menu item for settings [CHAR LIMIT=20] --> + <string name="menu_settings">Settings</string> + + <!-- History Panel --> + + <!-- Text for the history panel title [CHAR LIMIT=50] --> + <string name="history">History</string> + <!-- Text for the history panel reset button [CHAR LIMIT=20]--> <string name="reset">Reset</string> - <string name="filtershow_undo">Undo</string> - <string name="filtershow_redo">Redo</string> - <string name="straighten">Straighten</string> - <string name="crop">Crop</string> - <string name="rotate">Rotate</string> - <string name="flip">Flip</string> - <string name="vignette">Vignette</string> - <string name="curvesRGB">Curves</string> - <string name="curvesRed">Curves (Red)</string> - <string name="curvesGreen">Curves (Green)</string> - <string name="curvesBlue">Curves (Blue)</string> + + <!-- Image state panel --> + + <!-- Text for the image state panel title [CHAR LIMIT=50] --> + <string name="imageState">Current Image State</string> + + <!-- Filters buttons --> + + <!-- Label for the exposure filter button [CHAR LIMIT=15] --> + <string name="exposure">Exposure</string> + <!-- Label for the sharpen filter button [CHAR LIMIT=15] --> <string name="sharpen">Sharpen</string> + <!-- Label for the contrast filter button [CHAR LIMIT=15] --> <string name="contrast">Contrast</string> + <!-- Label for the vibrance filter button [CHAR LIMIT=15] --> <string name="vibrance">Vibrance</string> - <string name="exposure">Exposure</string> + <!-- Label for the saturation filter button [CHAR LIMIT=15] --> <string name="saturation">Saturation</string> + <!-- Label for the tint filter button [CHAR LIMIT=15] --> <string name="tint">Tint</string> - <string name="shadow_recovery">Shadow Recovery</string> - <string name="curves_channel">Channel</string> + <!-- Label for the shadow recovery filter button [CHAR LIMIT=15] --> + <string name="shadow_recovery">Shadows</string> + <!-- Label for the curves filter button [CHAR LIMIT=15] --> + <string name="curvesRGB">Curves</string> + <!-- Label for the vignette filter button [CHAR LIMIT=15] --> + <string name="vignette">Vignette</string> + + <!-- Labels for the curves tool --> + + <!-- Label for the curves tool, all channels (RGB) [CHAR LIMIT=3] --> <string name="curves_channel_rgb">RGB</string> + <!-- Label for the curves tool, Red color channel [CHAR LIMIT=10] --> <string name="curves_channel_red">Red</string> + <!-- Label for the curves tool, Green color channel [CHAR LIMIT=10] --> <string name="curves_channel_green">Green</string> + <!-- Label for the curves tool, Blue color channel [CHAR LIMIT=10] --> <string name="curves_channel_blue">Blue</string> </resources>
\ No newline at end of file diff --git a/src/com/android/gallery3d/filtershow/presets/ImagePreset.java b/src/com/android/gallery3d/filtershow/presets/ImagePreset.java index 6659eaecf..69b3f0939 100644 --- a/src/com/android/gallery3d/filtershow/presets/ImagePreset.java +++ b/src/com/android/gallery3d/filtershow/presets/ImagePreset.java @@ -7,6 +7,7 @@ import android.graphics.Bitmap; import android.graphics.RectF; import android.util.Log; +import com.android.gallery3d.filtershow.ImageStateAdapter; import com.android.gallery3d.filtershow.filters.ImageFilter; import com.android.gallery3d.filtershow.filters.ImageFilterStraighten; import com.android.gallery3d.filtershow.imageshow.ImageShow; @@ -36,8 +37,12 @@ public class ImagePreset { } public ImagePreset(ImagePreset source) { - for (int i = 0; i < source.mFilters.size(); i++) { - add(source.mFilters.elementAt(i).copy()); + try { + for (int i = 0; i < source.mFilters.size(); i++) { + add(source.mFilters.elementAt(i).clone()); + } + } catch (java.lang.CloneNotSupportedException e) { + Log.v(LOGTAG, "Exception trying to clone: " + e); } mName = source.name(); mHistoryName = source.name(); @@ -59,9 +64,6 @@ public class ImagePreset { // TODO } -// Log.v(LOGTAG, "applyGeometry with rotate " + mStraightenRotate + " and zoom " - // + mStraightenZoom); - if (mStraightenRotate != 0) { // TODO: keep the instances around ImageFilter straighten = new ImageFilterStraighten(mStraightenRotate, mStraightenZoom); @@ -117,8 +119,8 @@ public class ImagePreset { return mHistoryName; } - public void add(ImageFilter preset) { - mFilters.add(preset); + public void add(ImageFilter filter) { + mFilters.add(filter); } public void remove(String filterName) { @@ -135,7 +137,7 @@ public class ImagePreset { public ImageFilter getFilter(String name) { for (int i = 0; i < mFilters.size(); i++) { ImageFilter filter = mFilters.elementAt(i); - if (filter.name().equalsIgnoreCase(name)) { + if (filter.getName().equalsIgnoreCase(name)) { return filter; } } @@ -158,7 +160,7 @@ public class ImagePreset { ImageFilter borderFilter = null; for (int i = 0; i < mFilters.size(); i++) { ImageFilter filter = mFilters.elementAt(i); - if (filter.name().equalsIgnoreCase("Border")) { + if (filter.getName().equalsIgnoreCase("Border")) { // TODO don't use the name as an id borderFilter = filter; } else { @@ -174,4 +176,13 @@ public class ImagePreset { return bitmap; } - } + public void fillImageStateAdapter(ImageStateAdapter imageStateAdapter) { + if (imageStateAdapter == null) { + return; + } + imageStateAdapter.clear(); + imageStateAdapter.addAll(mFilters); + imageStateAdapter.notifyDataSetChanged(); + } + +} |