From 001283a72d451999e3308f45dc365d4defc0af39 Mon Sep 17 00:00:00 2001 From: John Hoford Date: Mon, 11 Mar 2013 15:08:26 -0700 Subject: [PATCH] fix menus for all editors Change-Id: I93e7eef3176b38480d55df176166646709a875fe --- .../gallery3d/filtershow/editors/Editor.java | 5 +--- .../gallery3d/filtershow/editors/EditorDraw.java | 34 ++++++---------------- 2 files changed, 10 insertions(+), 29 deletions(-) diff --git a/src/com/android/gallery3d/filtershow/editors/Editor.java b/src/com/android/gallery3d/filtershow/editors/Editor.java index cefdfe6bf..3fd44b6fd 100644 --- a/src/com/android/gallery3d/filtershow/editors/Editor.java +++ b/src/com/android/gallery3d/filtershow/editors/Editor.java @@ -182,10 +182,7 @@ public class Editor implements OnSeekBarChangeListener { } public boolean useUtilityPanel() { - if (mImageShow != null) { - return mImageShow.useUtilityPanel(); - } - return false; + return true; } public void openUtilityPanel(LinearLayout mAccessoryViewList) { diff --git a/src/com/android/gallery3d/filtershow/editors/EditorDraw.java b/src/com/android/gallery3d/filtershow/editors/EditorDraw.java index aa5ec61e8..1cc8aa2a3 100644 --- a/src/com/android/gallery3d/filtershow/editors/EditorDraw.java +++ b/src/com/android/gallery3d/filtershow/editors/EditorDraw.java @@ -18,7 +18,6 @@ package com.android.gallery3d.filtershow.editors; import android.app.Dialog; import android.content.Context; -import android.view.LayoutInflater; import android.view.MenuItem; import android.view.View; import android.view.View.OnClickListener; @@ -37,7 +36,6 @@ import com.android.gallery3d.filtershow.filters.FilterDrawRepresentation; import com.android.gallery3d.filtershow.filters.FilterRepresentation; import com.android.gallery3d.filtershow.filters.ImageFilterDraw; import com.android.gallery3d.filtershow.imageshow.ImageDraw; -import com.android.gallery3d.filtershow.ui.FramedTextButton; public class EditorDraw extends Editor { private static final String LOGTAG = "EditorDraw"; @@ -57,11 +55,6 @@ public class EditorDraw extends Editor { } @Override - public boolean useUtilityPanel() { - return true; - } - - @Override public void reflectCurrentFilter() { super.reflectCurrentFilter(); FilterRepresentation rep = getLocalRepresentation(); @@ -74,29 +67,20 @@ public class EditorDraw extends Editor { @Override public void openUtilityPanel(final LinearLayout accessoryViewList) { - View view = accessoryViewList.findViewById(R.id.drawUtilityButton); - if (view == null) { - LayoutInflater inflater = (LayoutInflater) mImageShow.getActivity().getSystemService - (Context.LAYOUT_INFLATER_SERVICE); - view = inflater.inflate(R.layout.filtershow_draw_button, accessoryViewList, false); - accessoryViewList.addView(view, view.getLayoutParams()); - view.setOnClickListener(new OnClickListener() { + Button view = (Button) accessoryViewList.findViewById(R.id.applyEffect); + view.setText(mContext.getString(R.string.draw_style)); + view.setOnClickListener(new OnClickListener() { @Override - public void onClick(View arg0) { - showPopupMenu(accessoryViewList); - } - }); - } - - if (view != null) { - view.setVisibility(View.VISIBLE); - } + public void onClick(View arg0) { + showPopupMenu(accessoryViewList); + } + }); } private void showPopupMenu(LinearLayout accessoryViewList) { - final FramedTextButton button = (FramedTextButton) accessoryViewList.findViewById( - R.id.drawUtilityButton); + final Button button = (Button) accessoryViewList.findViewById( + R.id.applyEffect); if (button == null) { return; } -- 2.11.0