summaryrefslogtreecommitdiffstats
path: root/src/com/android/gallery3d/filtershow
diff options
context:
space:
mode:
authorRuben Brunk <rubenbrunk@google.com>2013-04-19 17:00:51 -0700
committerRuben Brunk <rubenbrunk@google.com>2013-04-20 13:29:54 -0700
commit3b148d0e719a6ae42c0147bdf63fe0c14cff2fd8 (patch)
treeed8b41e3f8d0a78d3675ddd82b8946b32e89947d /src/com/android/gallery3d/filtershow
parent2429727fc3e751edec61042846ae268ec70ea2e6 (diff)
downloadandroid_packages_apps_Snap-3b148d0e719a6ae42c0147bdf63fe0c14cff2fd8.tar.gz
android_packages_apps_Snap-3b148d0e719a6ae42c0147bdf63fe0c14cff2fd8.tar.bz2
android_packages_apps_Snap-3b148d0e719a6ae42c0147bdf63fe0c14cff2fd8.zip
Reenables crop aspect ratio menu.
Bug: 8471812 Change-Id: I50044f4c787ba326e24f67c5370e1f8a220eb005
Diffstat (limited to 'src/com/android/gallery3d/filtershow')
-rw-r--r--src/com/android/gallery3d/filtershow/editors/EditorCrop.java37
-rw-r--r--src/com/android/gallery3d/filtershow/imageshow/ImageCrop.java9
2 files changed, 38 insertions, 8 deletions
diff --git a/src/com/android/gallery3d/filtershow/editors/EditorCrop.java b/src/com/android/gallery3d/filtershow/editors/EditorCrop.java
index e2173ad77..24a83cd46 100644
--- a/src/com/android/gallery3d/filtershow/editors/EditorCrop.java
+++ b/src/com/android/gallery3d/filtershow/editors/EditorCrop.java
@@ -17,8 +17,13 @@
package com.android.gallery3d.filtershow.editors;
import android.content.Context;
+import android.view.MenuItem;
import android.view.View;
+import android.view.View.OnClickListener;
+import android.widget.Button;
import android.widget.FrameLayout;
+import android.widget.LinearLayout;
+import android.widget.PopupMenu;
import com.android.gallery3d.R;
import com.android.gallery3d.filtershow.crop.CropExtras;
@@ -62,6 +67,38 @@ public class EditorCrop extends Editor implements EditorInfo {
}
@Override
+ public void openUtilityPanel(final LinearLayout accessoryViewList) {
+ Button view = (Button) accessoryViewList.findViewById(R.id.applyEffect);
+ view.setText(mContext.getString(R.string.crop));
+ view.setOnClickListener(new OnClickListener() {
+
+ @Override
+ public void onClick(View arg0) {
+ showPopupMenu(accessoryViewList);
+ }
+ });
+ }
+
+ private void showPopupMenu(LinearLayout accessoryViewList) {
+ final Button button = (Button) accessoryViewList.findViewById(
+ R.id.applyEffect);
+ if (button == null) {
+ return;
+ }
+ final PopupMenu popupMenu = new PopupMenu(mImageShow.getActivity(), button);
+ popupMenu.getMenuInflater().inflate(R.menu.filtershow_menu_crop, popupMenu.getMenu());
+ popupMenu.setOnMenuItemClickListener(new PopupMenu.OnMenuItemClickListener() {
+
+ @Override
+ public boolean onMenuItemClick(MenuItem item) {
+ mImageCrop.setAspectButton(item.getItemId());
+ return true;
+ }
+ });
+ popupMenu.show();
+ }
+
+ @Override
public boolean showsSeekBar() {
return false;
}
diff --git a/src/com/android/gallery3d/filtershow/imageshow/ImageCrop.java b/src/com/android/gallery3d/filtershow/imageshow/ImageCrop.java
index 6d62bbd1d..3208732b7 100644
--- a/src/com/android/gallery3d/filtershow/imageshow/ImageCrop.java
+++ b/src/com/android/gallery3d/filtershow/imageshow/ImageCrop.java
@@ -671,53 +671,46 @@ public class ImageCrop extends ImageGeometry {
}
}
- private void setAspectButton(FramedTextButton button, int itemId) {
+ public void setAspectButton(int itemId) {
switch (itemId) {
case R.id.crop_menu_1to1: {
String t = getActivity().getString(R.string.aspect1to1_effect);
- button.setText(t);
apply(1, 1);
setAspectString(t);
break;
}
case R.id.crop_menu_4to3: {
String t = getActivity().getString(R.string.aspect4to3_effect);
- button.setText(t);
apply(4, 3);
setAspectString(t);
break;
}
case R.id.crop_menu_3to4: {
String t = getActivity().getString(R.string.aspect3to4_effect);
- button.setText(t);
apply(3, 4);
setAspectString(t);
break;
}
case R.id.crop_menu_5to7: {
String t = getActivity().getString(R.string.aspect5to7_effect);
- button.setText(t);
apply(5, 7);
setAspectString(t);
break;
}
case R.id.crop_menu_7to5: {
String t = getActivity().getString(R.string.aspect7to5_effect);
- button.setText(t);
apply(7, 5);
setAspectString(t);
break;
}
case R.id.crop_menu_none: {
String t = getActivity().getString(R.string.aspectNone_effect);
- button.setText(t);
applyClear();
setAspectString(t);
break;
}
case R.id.crop_menu_original: {
String t = getActivity().getString(R.string.aspectOriginal_effect);
- button.setText(t);
applyOriginal();
setAspectString(t);
break;