RedEyeAction.java revision 0f8a40e4cfdc5f6cd47c22e81f69ed0446067c54
1/*
2 * Copyright (C) 2010 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 *      http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17package com.android.photoeditor.actions;
18
19import android.view.View;
20import android.view.ViewGroup;
21
22import com.android.photoeditor.FilterStack;
23import com.android.photoeditor.R;
24import com.android.photoeditor.filters.RedEyeFilter;
25
26/**
27 * An action handling red-eye removal.
28 */
29public class RedEyeAction extends FilterAction {
30
31    public RedEyeAction(FilterStack filterStack, ViewGroup tools) {
32        super(filterStack, tools, R.string.redeye_tooltip);
33    }
34
35    @Override
36    public void onBegin() {
37        final RedEyeFilter filter = new RedEyeFilter();
38
39        touchView.setSingleTapListener(new TouchView.SingleTapListener() {
40
41            @Override
42            public void onSingleTap(float x, float y) {
43                filter.addRedEyePosition(photoView.mapPhotoPoint(x, y));
44                notifyFilterChanged(filter, true);
45            }
46        });
47        touchView.setVisibility(View.VISIBLE);
48    }
49
50    @Override
51    public void onEnd() {
52    }
53}
54