summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohn Hoford <hoford@google.com>2013-04-09 11:51:42 -0700
committerJohn Hoford <hoford@google.com>2013-04-09 11:53:33 -0700
commitb990071d1a9b8464c29333a9fac8ae41563f4621 (patch)
tree7e503dfcbd1a9712b783b1836cfe5ca0046b3a9a
parent15f4efb50b40fbdf108121e367bfd6f50d5b2c41 (diff)
downloadandroid_packages_apps_Snap-b990071d1a9b8464c29333a9fac8ae41563f4621.tar.gz
android_packages_apps_Snap-b990071d1a9b8464c29333a9fac8ae41563f4621.tar.bz2
android_packages_apps_Snap-b990071d1a9b8464c29333a9fac8ae41563f4621.zip
ui cleanup
Change-Id: Ifb08af6bfad2f049b66932360901b2e52ff07f01
-rw-r--r--src/com/android/gallery3d/filtershow/controller/StyleChooser.java24
1 files changed, 11 insertions, 13 deletions
diff --git a/src/com/android/gallery3d/filtershow/controller/StyleChooser.java b/src/com/android/gallery3d/filtershow/controller/StyleChooser.java
index 201f6613e..3f75839ba 100644
--- a/src/com/android/gallery3d/filtershow/controller/StyleChooser.java
+++ b/src/com/android/gallery3d/filtershow/controller/StyleChooser.java
@@ -1,14 +1,13 @@
package com.android.gallery3d.filtershow.controller;
+import android.app.ActionBar.LayoutParams;
import android.content.Context;
-import android.content.res.Resources;
import android.graphics.Bitmap;
-import android.graphics.drawable.BitmapDrawable;
-import android.graphics.drawable.ScaleDrawable;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
-import android.widget.Button;
+import android.widget.ImageButton;
+import android.widget.ImageView.ScaleType;
import android.widget.LinearLayout;
import com.android.gallery3d.R;
@@ -25,7 +24,7 @@ public class StyleChooser implements Control, RenderingRequestCaller {
protected Editor mEditor;
private View mTopView;
private int mProcessingButton = 0;
- private Vector<Button> mIconButton = new Vector<Button>();
+ private Vector<ImageButton> mIconButton = new Vector<ImageButton>();
protected int mLayoutID = R.layout.filtershow_control_style_chooser;
@Override
@@ -41,8 +40,12 @@ public class StyleChooser implements Control, RenderingRequestCaller {
mTopView.setVisibility(View.VISIBLE);
int n = mParameter.getNumberOfStyles();
mIconButton.clear();
+ LayoutParams lp = new LayoutParams(120, 120);
for (int i = 0; i < n; i++) {
- Button button = new Button(context);
+ ImageButton button = new ImageButton(context);
+ button.setScaleType(ScaleType.CENTER_CROP);
+ button.setLayoutParams(lp);
+ button.setBackgroundResource(android.R.color.transparent);
mIconButton.add(button);
final int buttonNo = i;
button.setOnClickListener(new View.OnClickListener() {
@@ -83,13 +86,8 @@ public class StyleChooser implements Control, RenderingRequestCaller {
}
try {
- Button button = mIconButton.get(mProcessingButton);
- Resources res = mLinearLayout.getContext().getResources();
- BitmapDrawable drawable = new BitmapDrawable(res, bmap);
- float scale = 12000 / (float) button.getWidth();
- ScaleDrawable sd = new ScaleDrawable(drawable, 0, scale, scale);
-
- button.setCompoundDrawablesWithIntrinsicBounds(null, sd, null, null);
+ ImageButton button = mIconButton.get(mProcessingButton);
+ button.setImageBitmap(bmap);
} catch (Exception e) {
return;
}