diff options
author | nicolasroard <nicolasroard@google.com> | 2013-02-28 12:11:35 -0800 |
---|---|---|
committer | nicolasroard <nicolasroard@google.com> | 2013-03-01 13:56:10 -0800 |
commit | 2a025ee773a4c40b05de6c70a4681abdb4e243bd (patch) | |
tree | cc66d1164919c6a28ffa11eb45bdc7069ff3a497 | |
parent | 5df0d2333fd3ade6a0396124ae4ce85e51ef7f0d (diff) | |
download | android_packages_apps_Snap-2a025ee773a4c40b05de6c70a4681abdb4e243bd.tar.gz android_packages_apps_Snap-2a025ee773a4c40b05de6c70a4681abdb4e243bd.tar.bz2 android_packages_apps_Snap-2a025ee773a4c40b05de6c70a4681abdb4e243bd.zip |
Improves State panel and Refactor FilterShowActivity
- handles multiple xml layout
- add a portrait layout
- improves the state panel (delete, etc.)
Change-Id: I29762c99cdd467db8705174c660304c8ed673ce2
-rw-r--r-- | res/layout-land/filtershow_activity.xml | 336 | ||||
-rw-r--r-- | res/layout/filtershow_activity.xml | 64 | ||||
-rw-r--r-- | res/layout/filtershow_imagestate_row.xml | 18 | ||||
-rw-r--r-- | res/values/filtershow_strings.xml | 2 | ||||
-rw-r--r-- | src/com/android/gallery3d/filtershow/presets/ImagePreset.java | 21 |
5 files changed, 411 insertions, 30 deletions
diff --git a/res/layout-land/filtershow_activity.xml b/res/layout-land/filtershow_activity.xml new file mode 100644 index 000000000..8e74de908 --- /dev/null +++ b/res/layout-land/filtershow_activity.xml @@ -0,0 +1,336 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + Copyright (C) 2013 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. +--> + +<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" + xmlns:iconbutton="http://schemas.android.com/apk/res/com.android.gallery3d" + android:layout_width="match_parent" + android:layout_height="match_parent" + android:id="@+id/mainView"> + + <LinearLayout + android:layout_width="match_parent" + android:layout_height="match_parent" + android:orientation="horizontal" + android:animateLayoutChanges="true"> + + <LinearLayout + android:layout_weight="1" + android:layout_width="wrap_content" + android:layout_height="match_parent" + android:orientation="horizontal"> + + <FrameLayout + android:id="@+id/editorContainer" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:layout_weight="1" /> + + <com.android.gallery3d.filtershow.imageshow.ImageShow + android:id="@+id/imageShow" + android:layout_width="match_parent" + android:layout_height="wrap_content" /> + + <com.android.gallery3d.filtershow.imageshow.ImageTinyPlanet + android:id="@+id/imageTinyPlanet" + android:layout_width="match_parent" + android:layout_height="wrap_content" /> + + </LinearLayout> + + <LinearLayout + android:id="@+id/mainPanel" + android:layout_width="650dip" + android:layout_height="match_parent" + android:layout_weight="1" + android:orientation="vertical" > + + <LinearLayout + android:id="@+id/imageStatePanel" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:orientation="vertical" + android:layout_weight="1" + android:visibility="visible" > + + <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> + + + <FrameLayout + android:layout_gravity="bottom" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:layout_weight="1" > + + + <ProgressBar + android:id="@+id/loading" + style="@android:style/Widget.Holo.ProgressBar.Large" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_gravity="center" + android:indeterminate="true" + android:indeterminateOnly="true" + android:background="@color/background_screen" /> + + </FrameLayout> + + <com.android.gallery3d.filtershow.CenteredLinearLayout + xmlns:custom="http://schemas.android.com/apk/res/com.android.gallery3d" + android:id="@+id/filtersPanel" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:layout_gravity="center" + android:background="@color/background_main_toolbar" + custom:max_width="600dip" + android:orientation="vertical"> + + <FrameLayout + android:id="@+id/secondRowPanel" + android:layout_width="fill_parent" + android:layout_height="wrap_content" > + + <LinearLayout + android:id="@+id/filterButtonsList" + android:layout_width="fill_parent" + android:layout_height="@dimen/thumbnail_size" + android:background="@color/background_main_toolbar" + android:orientation="horizontal" + android:visibility="gone" > + + <FrameLayout + android:layout_width="fill_parent" + android:layout_height="fill_parent" > + + <LinearLayout + android:id="@+id/panelAccessoryViewList" + android:layout_width="wrap_content" + android:layout_height="fill_parent" + android:orientation="horizontal" + android:visibility="visible" /> + + <Button + android:id="@+id/applyEffect" + android:layout_width="wrap_content" + android:layout_height="94dip" + android:layout_gravity="center" + android:layout_weight="1" + android:background="@android:color/transparent" + android:gravity="center" + android:text="@string/apply_effect" + android:textSize="18dip" /> + </FrameLayout> + + </LinearLayout> + + <HorizontalScrollView + android:id="@+id/fxList" + android:layout_width="match_parent" + android:layout_height="@dimen/thumbnail_size" + android:scrollbars="none" > + + <LinearLayout + android:id="@+id/listFilters" + android:layout_width="wrap_content" + android:layout_height="match_parent" + android:layout_marginLeft="@dimen/thumbnail_margin" + android:orientation="horizontal" > + </LinearLayout> + </HorizontalScrollView> + + <HorizontalScrollView + android:id="@+id/bordersList" + android:layout_width="match_parent" + android:layout_height="@dimen/thumbnail_size" + android:visibility="gone" + android:scrollbars="none" > + + <LinearLayout + android:id="@+id/listBorders" + android:layout_width="wrap_content" + android:layout_height="match_parent" + android:layout_marginLeft="@dimen/thumbnail_margin" + android:orientation="horizontal" > + </LinearLayout> + </HorizontalScrollView> + + <HorizontalScrollView + android:id="@+id/geometryList" + android:layout_width="fill_parent" + android:layout_height="@dimen/thumbnail_size" + android:background="@color/background_main_toolbar" + android:visibility="gone" + android:scrollbars="none" > + + <LinearLayout + android:id="@+id/listGeometry" + android:layout_width="wrap_content" + android:layout_height="fill_parent" + android:layout_gravity="left" + android:orientation="horizontal" /> + + </HorizontalScrollView> + + <HorizontalScrollView + android:id="@+id/colorsFxList" + android:layout_width="fill_parent" + android:layout_height="wrap_content" + android:background="@color/background_main_toolbar" + android:visibility="gone" + android:scrollbars="none" > + + <LinearLayout + android:id="@+id/listColorsFx" + android:layout_width="wrap_content" + android:layout_height="@dimen/thumbnail_size" + android:background="@color/background_main_toolbar" + android:layout_marginLeft="@dimen/thumbnail_margin" + android:orientation="horizontal" > + + </LinearLayout> + </HorizontalScrollView> + </FrameLayout> + + <View + android:background="@color/toolbar_separation_line" + android:layout_height="1dip" + android:layout_width="match_parent" /> + + <com.android.gallery3d.filtershow.CenteredLinearLayout + xmlns:custom="http://schemas.android.com/apk/res/com.android.gallery3d" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:layout_gravity="center" + custom:max_width="400dip" + android:orientation="vertical"> + + <LinearLayout + android:layout_width="match_parent" + android:layout_height="48dip" + android:background="@color/background_main_toolbar" > + + <ImageButton + android:id="@+id/fxButton" + android:layout_width="@dimen/thumbnail_size" + android:layout_height="match_parent" + android:layout_weight="1" + android:background="@drawable/filtershow_button_background" + android:scaleType="centerInside" + android:src="@drawable/ic_photoeditor_effects" /> + + <ImageButton + android:id="@+id/borderButton" + android:layout_width="@dimen/thumbnail_size" + android:layout_height="match_parent" + android:layout_weight="1" + android:background="@drawable/filtershow_button_background" + android:padding="2dip" + android:scaleType="centerInside" + android:src="@drawable/ic_photoeditor_border" /> + + <ImageButton + android:id="@+id/geometryButton" + android:layout_width="@dimen/thumbnail_size" + android:layout_height="match_parent" + android:layout_weight="1" + android:background="@drawable/filtershow_button_background" + android:padding="2dip" + android:scaleType="centerInside" + android:src="@drawable/ic_photoeditor_fix" /> + + <ImageButton + android:id="@+id/colorsButton" + android:layout_width="@dimen/thumbnail_size" + android:layout_height="match_parent" + android:layout_weight="1" + android:background="@drawable/filtershow_button_background" + android:padding="2dip" + android:scaleType="centerInside" + android:src="@drawable/ic_photoeditor_color" /> + </LinearLayout> + + </com.android.gallery3d.filtershow.CenteredLinearLayout> + + </com.android.gallery3d.filtershow.CenteredLinearLayout> + + </LinearLayout> + + </LinearLayout> + + <LinearLayout + android:id="@+id/historyPanel" + android:layout_width="200dip" + android:layout_height="match_parent" + android:layout_gravity="right" + android:orientation="vertical" + android:visibility="invisible" > + + <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/history" + android:textColor="@android:color/white" + android:textSize="24sp" + android:textStyle="bold" /> + + <ListView + android:id="@+id/operationsList" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:layout_weight="1" > + </ListView> + + <LinearLayout + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:orientation="horizontal" > + + <Button + android:id="@+id/resetOperationsButton" + style="@style/FilterShowHistoryButton" + android:gravity="center" + android:text="@string/reset" /> + + <Button + android:id="@+id/saveOperationsButton" + style="@style/FilterShowHistoryButton" + android:text="@string/save" + android:visibility="gone" /> + </LinearLayout> + </LinearLayout> + +</FrameLayout> diff --git a/res/layout/filtershow_activity.xml b/res/layout/filtershow_activity.xml index 0f94f9226..6bdd48710 100644 --- a/res/layout/filtershow_activity.xml +++ b/res/layout/filtershow_activity.xml @@ -22,36 +22,16 @@ android:id="@+id/mainView"> <LinearLayout - android:id="@+id/imageStatePanel" - android:layout_width="200dip" - android:layout_height="match_parent" - android:layout_gravity="right" - android:orientation="vertical" - android:visibility="invisible" > - - <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> + android:layout_height="match_parent" + android:orientation="horizontal" + android:animateLayoutChanges="true"> - <LinearLayout + <LinearLayout android:id="@+id/mainPanel" - android:layout_width="match_parent" + android:layout_width="wrap_content" android:layout_height="match_parent" + android:layout_weight="1" android:orientation="vertical" > <FrameLayout @@ -264,6 +244,38 @@ </com.android.gallery3d.filtershow.CenteredLinearLayout> </com.android.gallery3d.filtershow.CenteredLinearLayout> + + </LinearLayout> + + <LinearLayout + android:id="@+id/imageStatePanel" + android:layout_width="400dip" + android:layout_height="match_parent" + android:layout_gravity="right" + android:orientation="vertical" + android:layout_weight="1" + android:visibility="gone" > + + <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> <LinearLayout diff --git a/res/layout/filtershow_imagestate_row.xml b/res/layout/filtershow_imagestate_row.xml index 2e9b1bf9b..d62f54c29 100644 --- a/res/layout/filtershow_imagestate_row.xml +++ b/res/layout/filtershow_imagestate_row.xml @@ -14,13 +14,25 @@ limitations under the License. --> -<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" +<com.android.gallery3d.filtershow.MovableLinearLayout 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:layout_height="128dip" android:orientation="horizontal" android:background="@drawable/filtershow_button_background"> + <ImageView + android:id="@+id/selectedMark" + android:src="@drawable/camera_crop" + android:background="@android:color/transparent" + android:layout_width="32dip" + android:layout_height="match_parent" + android:scaleType="centerInside" + android:visibility="visible" + android:layout_weight="1" + > + </ImageView> + <TextView xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/imagestate_label" @@ -44,4 +56,4 @@ android:textStyle="bold" > </TextView> -</LinearLayout>
\ No newline at end of file +</com.android.gallery3d.filtershow.MovableLinearLayout>
\ No newline at end of file diff --git a/res/values/filtershow_strings.xml b/res/values/filtershow_strings.xml index 3e9e35508..80d0fc6b9 100644 --- a/res/values/filtershow_strings.xml +++ b/res/values/filtershow_strings.xml @@ -62,7 +62,7 @@ <!-- Image state panel --> <!-- Text for the image state panel title [CHAR LIMIT=50] --> - <string name="imageState">Current Image State</string> + <string name="imageState">Applied Effects</string> <!-- Additional filters buttons --> diff --git a/src/com/android/gallery3d/filtershow/presets/ImagePreset.java b/src/com/android/gallery3d/filtershow/presets/ImagePreset.java index 14c671e9f..82592a0f7 100644 --- a/src/com/android/gallery3d/filtershow/presets/ImagePreset.java +++ b/src/com/android/gallery3d/filtershow/presets/ImagePreset.java @@ -129,6 +129,9 @@ public class ImagePreset { } public void updateFilterRepresentation(FilterRepresentation representation) { + if (representation == null) { + return; + } synchronized (mFilters) { if (representation instanceof GeometryMetadata) { setGeometry((GeometryMetadata) representation); @@ -331,6 +334,23 @@ public class ImagePreset { Log.v(LOGTAG, "/// showFilters -- " + mFilters.size() + " filters"); } + public FilterRepresentation getLastRepresentation() { + if (mFilters.size() > 0) { + return mFilters.lastElement(); + } + return null; + } + + public void removeFilter(FilterRepresentation filterRepresentation) { + for (int i = 0; i < mFilters.size(); i++) { + if (mFilters.elementAt(i).getFilterClass() == filterRepresentation.getFilterClass()) { + mFilters.remove(i); + setHistoryName("Remove"); + return; + } + } + } + public void addFilter(FilterRepresentation representation) { if (representation instanceof GeometryMetadata) { setGeometry((GeometryMetadata) representation); @@ -501,4 +521,5 @@ public class ImagePreset { public Rect getPartialRenderingBounds() { return mPartialRenderingBounds; } + } |