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

Commit d37ff2ee authored by Ruei-sung Lin's avatar Ruei-sung Lin
Browse files

facelift in gallery

Change-Id: I7cb67c3d977d8b23957586bb5ad1dada096ef07b
parent 75ebc879
Loading
Loading
Loading
Loading
+5 −4
Original line number Diff line number Diff line
@@ -204,12 +204,13 @@
                <category android:name="android.intent.category.DEFAULT" />
            </intent-filter>
        </activity>
        <uses-library android:name="com.google.android.media.effects"
                android:required="false" />

        <activity android:name="com.android.gallery3d.app.SlideshowDream"
                android:label="@string/slideshow_dream_name"
                android:theme="@android:style/Theme.Black.NoTitleBar.Fullscreen"
            android:hardwareAccelerated="true"
            >
                android:hardwareAccelerated="true">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.DEFAULT" />
+1.76 KiB
Loading image diff...
+10 −0
Original line number Diff line number Diff line
@@ -40,6 +40,16 @@
            android:text="@string/redeye"
            style="@style/EffectLabel"/>
    </com.android.gallery3d.photoeditor.actions.RedEyeAction>
    <com.android.gallery3d.photoeditor.actions.FaceliftAction style="@style/Effect">
        <ImageButton
            android:id="@+id/effect_button"
            style="@style/EffectIcon"
            android:src="@drawable/photoeditor_effect_facelift"/>
        <TextView
            android:id="@+id/effect_label"
            android:text="@string/facelift"
            style="@style/EffectLabel"/>
    </com.android.gallery3d.photoeditor.actions.FaceliftAction>
    <com.android.gallery3d.photoeditor.actions.StraightenAction style="@style/Effect"
        android:tag="@string/straighten_tooltip">
        <ImageButton
+6 −0
Original line number Diff line number Diff line
@@ -60,6 +60,12 @@
    <!-- Name for the photo effect that makes photo only two color tones. [CHAR LIMIT=15] -->
    <string name="duotone">Duo-tone</string>

    <!-- Name for the photo effect that smooths facial skins. [CHAR LIMIT=15] -->
    <string name="facelift">Face Glow</string>

    <!-- Name for the photo effect that tans facial skins. [CHAR LIMIT=15] -->
    <string name="facetan">Face Tan</string>

    <!-- Name for the photo effect that fills back-light. [CHAR LIMIT=15] -->
    <string name="filllight">Fill Light</string>

+62 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2010 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.
 */

package com.android.gallery3d.photoeditor.actions;

import android.content.Context;
import android.util.AttributeSet;

import com.android.gallery3d.photoeditor.filters.FaceliftFilter;

/**
 * An action handling facelift effect.
 */
public class FaceliftAction extends EffectAction {

    private static final float DEFAULT_SCALE = 0.5f;

    private ScaleSeekBar scalePicker;

    public FaceliftAction(Context context, AttributeSet attrs) {
        super(context, attrs);
    }

    @Override
    public void doBegin() {
        final FaceliftFilter filter = new FaceliftFilter();

        scalePicker = factory.createScalePicker(EffectToolFactory.ScalePickerType.GENERIC);
        scalePicker.setOnScaleChangeListener(new ScaleSeekBar.OnScaleChangeListener() {

            @Override
            public void onProgressChanged(float progress, boolean fromUser) {
                if (fromUser) {
                    filter.setScale(progress);
                    notifyFilterChanged(filter, true);
                }
            }
        });
        scalePicker.setProgress(DEFAULT_SCALE);

        filter.setScale(DEFAULT_SCALE);
        notifyFilterChanged(filter, true);
    }

    @Override
    public void doEnd() {
        scalePicker.setOnScaleChangeListener(null);
    }
}
Loading