diff options
author | Jay Wang <jaywang@codeaurora.org> | 2016-09-13 18:17:44 -0700 |
---|---|---|
committer | Jay Wang <jaywang@codeaurora.org> | 2016-09-14 16:04:59 -0700 |
commit | c91419614f073226b06ae0cd13a74967d76a5a04 (patch) | |
tree | 7cbd85ff7c468c3500d44405787d071c1012825c | |
parent | eeb2253db1ee359acb0ec0df177290d7d1d15c29 (diff) | |
download | android_packages_apps_Gallery2-c91419614f073226b06ae0cd13a74967d76a5a04.tar.gz android_packages_apps_Gallery2-c91419614f073226b06ae0cd13a74967d76a5a04.tar.bz2 android_packages_apps_Gallery2-c91419614f073226b06ae0cd13a74967d76a5a04.zip |
SnapdragonGallery: Update UI for TruePortrait effects
Make UI adjustments based on feedback from UX team
for TruePortrait effects.
CRs-Fixed: 1066553
Change-Id: If5cf78af60daf81a4abf76e8d85534322760ccc8
9 files changed, 78 insertions, 55 deletions
diff --git a/res/drawable/tp_mask_toggle.xml b/res/drawable/tp_mask_toggle.xml new file mode 100644 index 000000000..29abd41fc --- /dev/null +++ b/res/drawable/tp_mask_toggle.xml @@ -0,0 +1,34 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + Copyright (c) 2016, The Linux Foundation. All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are + met: + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above + copyright notice, this list of conditions and the following + disclaimer in the documentation and/or other materials provided + with the distribution. + * Neither the name of The Linux Foundation nor the names of its + contributors may be used to endorse or promote products derived + from this software without specific prior written permission. + + THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED + WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT + ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS + BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE + OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN + IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +--> + +<selector xmlns:android="http://schemas.android.com/apk/res/android"> + <item android:drawable="@android:color/holo_blue_light" android:state_checked="true"></item> + <item android:drawable="@color/cache_placeholder" android:state_checked="false"></item> +</selector>
\ No newline at end of file diff --git a/res/layout/do_not_show_again_dialog.xml b/res/layout/do_not_show_again_dialog.xml index 8ddfdc191..d3d229740 100644 --- a/res/layout/do_not_show_again_dialog.xml +++ b/res/layout/do_not_show_again_dialog.xml @@ -30,19 +30,27 @@ <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="wrap_content" + android:paddingTop="8dip" + android:paddingBottom="8dip" + android:paddingEnd="?android:attr/dialogPreferredPadding" + android:paddingStart="?android:attr/dialogPreferredPadding" android:orientation="vertical" > <TextView android:id="@+id/message" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:layout_margin="8dp" /> + style="@android:style/TextAppearance.Material.Subhead" /> + + <Space + android:layout_width="0dp" + android:layout_height="5dp"/> <CheckBox android:id="@+id/do_not_show_chk" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:layout_margin="8dp" + style="@android:style/TextAppearance.Material.Subhead" android:text="@string/do_not_show_again" /> </LinearLayout>
\ No newline at end of file diff --git a/res/layout/filtershow_actionbar_trueportrait_mask.xml b/res/layout/filtershow_actionbar_trueportrait_mask.xml index b922dbd2d..f992e76a8 100644 --- a/res/layout/filtershow_actionbar_trueportrait_mask.xml +++ b/res/layout/filtershow_actionbar_trueportrait_mask.xml @@ -52,15 +52,23 @@ android:id="@+id/maskForeground" android:layout_width="wrap_content" android:layout_height="match_parent" + android:background="@drawable/tp_mask_toggle" + android:textColor="@color/primary_text" android:paddingEnd="16dp" android:paddingStart="16dp" android:textOff="@string/foreground" android:textOn="@string/foreground" /> + <Space + android:layout_width="5dp" + android:layout_height="0dp"/> + <ToggleButton android:id="@+id/maskBackground" android:layout_width="wrap_content" android:layout_height="match_parent" + android:background="@drawable/tp_mask_toggle" + android:textColor="@color/primary_text" android:paddingEnd="16dp" android:paddingStart="16dp" android:textOff="@string/background" diff --git a/res/values/filtershow_strings.xml b/res/values/filtershow_strings.xml index 81b7ba535..7c0212e7e 100644 --- a/res/values/filtershow_strings.xml +++ b/res/values/filtershow_strings.xml @@ -352,7 +352,7 @@ <string name="fusion_pick_underlay">Pick Underlay</string> <string name="dualcam_no_segment_toast">No segment found at this point</string> <string name="dualcam_filter_not_supported">Dual camera filters not supported for this image</string> - <string name="trueportrait_intro">Allows you to enhance photos of people. You can apply effects to the background, such "blur" and "sketch". You can also merge two photos together to create interesting backgrounds for your portrait photos.</string> + <string name="trueportrait_intro">Allows you to enhance photos of people. You can apply effects to the background, such as \"blur\" and \"sketch\". You can also merge two photos together to create interesting backgrounds for your portrait photos.</string> <string name="trueportrait_no_face">True Portrait effects cannot be applied to this photo. Face not detected.</string> <string name="trueportrait_edit_intro">With the Touch-Up tool, you can edit the foreground and the background. You can user your finger to paint in any areas of the foreground or background that were missed.</string> <string name="trueportrait_edit_foreground_toast">Use your finger to paint in any areas of the foreground that were missed.</string> diff --git a/src/com/android/gallery3d/filtershow/category/Action.java b/src/com/android/gallery3d/filtershow/category/Action.java index 75982d851..731c07999 100644 --- a/src/com/android/gallery3d/filtershow/category/Action.java +++ b/src/com/android/gallery3d/filtershow/category/Action.java @@ -123,15 +123,6 @@ public class Action implements RenderingRequestCaller { return; } - if(mRepresentation.getOverlayOnly()) { - mImageFrame = imageFrame; - int w = mImageFrame.width(); - int h = mImageFrame.height(); - mImage = MasterImage.getImage().getBitmapCache().getBitmap(w, h, BitmapCache.ICON); - drawOverlay(true); - return; - } - Bitmap temp = MasterImage.getImage().getTemporaryThumbnailBitmap(); if (temp != null) { mImage = temp; @@ -176,17 +167,21 @@ public class Action implements RenderingRequestCaller { float dx = (destination.getWidth() - source.getWidth() * scaleFactor) / 2.0f; float dy = (destination.getHeight() - source.getHeight() * scaleFactor) / 2.0f; - if (mImageFrame.height() > mImageFrame.width()) { - // if portrait - dy -= mTextSize; - } m.setScale(scaleFactor, scaleFactor); m.postTranslate(dx, dy); Canvas canvas = new Canvas(destination); canvas.drawBitmap(source, m, new Paint(Paint.FILTER_BITMAP_FLAG)); } - private void drawOverlay(boolean scale) { + @Override + public void available(RenderingRequest request) { + clearBitmap(); + mImage = request.getBitmap(); + if (mImage == null) { + mImageFrame = null; + return; + } + if (mRepresentation.getOverlayId() != 0 && mOverlayBitmap == null) { mOverlayBitmap = BitmapFactory.decodeResource( mContext.getResources(), @@ -200,21 +195,9 @@ public class Action implements RenderingRequestCaller { } else { Canvas canvas = new Canvas(mImage); canvas.drawARGB(128, 0, 0, 0); - drawCenteredImage(mOverlayBitmap, mImage, scale); + drawCenteredImage(mOverlayBitmap, mImage, false); } } - } - - @Override - public void available(RenderingRequest request) { - clearBitmap(); - mImage = request.getBitmap(); - if (mImage == null) { - mImageFrame = null; - return; - } - - drawOverlay(false); if (mAdapter != null) { mAdapter.notifyDataSetChanged(); diff --git a/src/com/android/gallery3d/filtershow/editors/EditorTruePortraitMask.java b/src/com/android/gallery3d/filtershow/editors/EditorTruePortraitMask.java index 7c5842f7f..75f84efd2 100644 --- a/src/com/android/gallery3d/filtershow/editors/EditorTruePortraitMask.java +++ b/src/com/android/gallery3d/filtershow/editors/EditorTruePortraitMask.java @@ -193,9 +193,9 @@ public class EditorTruePortraitMask extends Editor { private void showToast() { Toast toast; if(isBackgroundMode()) { - toast = Toast.makeText(mContext, R.string.trueportrait_edit_background_toast, Toast.LENGTH_SHORT); + toast = Toast.makeText(mContext, R.string.trueportrait_edit_background_toast, Toast.LENGTH_LONG); } else { - toast = Toast.makeText(mContext, R.string.trueportrait_edit_foreground_toast, Toast.LENGTH_SHORT); + toast = Toast.makeText(mContext, R.string.trueportrait_edit_foreground_toast, Toast.LENGTH_LONG); } toast.show(); diff --git a/src/com/android/gallery3d/filtershow/filters/ImageFilterTruePortrait.java b/src/com/android/gallery3d/filtershow/filters/ImageFilterTruePortrait.java index f070bfc30..b885dc831 100755..100644 --- a/src/com/android/gallery3d/filtershow/filters/ImageFilterTruePortrait.java +++ b/src/com/android/gallery3d/filtershow/filters/ImageFilterTruePortrait.java @@ -66,7 +66,7 @@ public class ImageFilterTruePortrait extends ImageFilter { @Override public Bitmap apply(Bitmap bitmap, float scaleFactor, int quality) { - if (getParameters() == null) { + if (getParameters() == null || quality == FilterEnvironment.QUALITY_ICON) { return bitmap; } diff --git a/src/com/android/gallery3d/filtershow/imageshow/ImageTruePortraitMask.java b/src/com/android/gallery3d/filtershow/imageshow/ImageTruePortraitMask.java index 052035714..43193acab 100644 --- a/src/com/android/gallery3d/filtershow/imageshow/ImageTruePortraitMask.java +++ b/src/com/android/gallery3d/filtershow/imageshow/ImageTruePortraitMask.java @@ -97,21 +97,25 @@ public class ImageTruePortraitMask extends ImageShow { private void setup() { mMaskPaintForeground.setAntiAlias(true); - mMaskPaintForeground.setColor(Color.RED); - mMaskPaintForeground.setColorFilter(new LightingColorFilter(Color.RED, 1)); - mMaskPaintForeground.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.SCREEN)); + mMaskPaintForeground.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.SRC_OVER)); + mMaskPaintForeground.setColorFilter(new ColorMatrixColorFilter(new float[] { + // Set color to GREEN + 0,0,0,0,0, + 0,0,0,0,191, + 0,0,0,0,0, + 0,0,0,.5f,0 + })); mMaskPaintBackground.setAntiAlias(true); - mMaskPaintBackground.setColor(Color.GREEN); + mMaskPaintBackground.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.SRC_OVER)); mMaskPaintBackground.setColorFilter(new ColorMatrixColorFilter(new float[] { - // Set color to GREEN and inverse ALPHA channel + // Set color to RED and inverse ALPHA channel // of original mask to get background + 0,0,0,0,191, 0,0,0,0,0, - 0,0,0,0,255, 0,0,0,0,0, - 0,0,0,-1,255 + 0,0,0,-.5f,127 })); - mMaskPaintBackground.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.SCREEN)); mMaskEditPaint.setAntiAlias(true); mMaskEditPaint.setStyle(Style.STROKE); diff --git a/src/com/android/gallery3d/filtershow/tools/TruePortraitNativeEngine.java b/src/com/android/gallery3d/filtershow/tools/TruePortraitNativeEngine.java index 03972638c..16cf27d16 100644 --- a/src/com/android/gallery3d/filtershow/tools/TruePortraitNativeEngine.java +++ b/src/com/android/gallery3d/filtershow/tools/TruePortraitNativeEngine.java @@ -183,20 +183,6 @@ public class TruePortraitNativeEngine { for(StrokeData sd:edits) { drawEdit(canvas, sd); } - - // DEBUG - for(int i = 0; i<mPreviewSize.y; i++) { - StringBuilder sb = new StringBuilder(); - sb.append("[ "); - for(int j = 0; j<mPreviewSize.x; j++) { - int pixel = mUpdateBm.getPixel(j, i); - sb.append(Color.alpha(pixel)); - sb.append(" "); - } - sb.append("]"); - Log.e(TAG, sb.toString()); - } - // return nativeUpdatePreviewMask(mUpdateBm); } |