Home | History | Annotate | Download | only in editors
      1 /*
      2  * Copyright (C) 2013 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 
     17 package com.android.gallery3d.filtershow.editors;
     18 
     19 import android.content.Context;
     20 import android.view.View;
     21 import android.view.View.OnClickListener;
     22 import android.widget.Button;
     23 import android.widget.FrameLayout;
     24 import android.widget.LinearLayout;
     25 
     26 import com.android.gallery3d.R;
     27 import com.android.gallery3d.filtershow.imageshow.ImageFlip;
     28 import com.android.gallery3d.filtershow.imageshow.MasterImage;
     29 
     30 public class EditorFlip extends Editor implements EditorInfo {
     31     public static final String LOGTAG = "EditorFlip";
     32     public static final int ID = R.id.editorFlip;
     33     ImageFlip mImageFlip;
     34 
     35     public EditorFlip() {
     36         super(ID);
     37     }
     38 
     39     @Override
     40     public void createEditor(Context context, FrameLayout frameLayout) {
     41         super.createEditor(context, frameLayout);
     42         if (mImageFlip == null) {
     43             mImageFlip = new ImageFlip(context);
     44         }
     45         mView = mImageShow = mImageFlip;
     46         mImageFlip.setImageLoader(MasterImage.getImage().getImageLoader());
     47         mImageFlip.setEditor(this);
     48         mImageFlip.syncLocalToMasterGeometry();
     49     }
     50 
     51     @Override
     52     public void openUtilityPanel(final LinearLayout accessoryViewList) {
     53         final Button button = (Button) accessoryViewList.findViewById(R.id.applyEffect);
     54         button.setOnClickListener(new OnClickListener() {
     55             @Override
     56             public void onClick(View arg0) {
     57                 mImageFlip.flip();
     58                 mImageFlip.saveAndSetPreset();
     59             }
     60         });
     61     }
     62 
     63     @Override
     64     public int getTextId() {
     65         return R.string.mirror;
     66     }
     67 
     68     @Override
     69     public int getOverlayId() {
     70         return R.drawable.filtershow_button_geometry_flip;
     71     }
     72 
     73     @Override
     74     public boolean getOverlayOnly() {
     75         return true;
     76     }
     77 
     78     @Override
     79     public boolean showsSeekBar() {
     80         return false;
     81     }
     82 
     83     @Override
     84     public boolean showsPopupIndicator() {
     85         return false;
     86     }
     87 }
     88