Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit c9141961 authored by Jay Wang's avatar Jay Wang
Browse files

SnapdragonGallery: Update UI for TruePortrait effects

Make UI adjustments based on feedback from UX team
for TruePortrait effects.

CRs-Fixed: 1066553
Change-Id: If5cf78af60daf81a4abf76e8d85534322760ccc8
parent eeb2253d
Loading
Loading
Loading
Loading
+34 −0
Original line number Diff line number Diff line
<?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
+10 −2
Original line number Diff line number Diff line
@@ -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
+8 −0
Original line number Diff line number Diff line
@@ -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"
+1 −1
Original line number Diff line number Diff line
@@ -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>
+10 −27
Original line number Diff line number Diff line
@@ -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();
Loading