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
commit9e0d687320eb9302b4b96f615083c31edbdeb08b (patch)
tree05027d0b256c12986f8f72a23537ec43311a8d39
parent01a4beb197d74dddf788efaf6aedef434dfb8f8f (diff)
downloadandroid_packages_apps_Gallery2-9e0d687320eb9302b4b96f615083c31edbdeb08b.tar.gz
android_packages_apps_Gallery2-9e0d687320eb9302b4b96f615083c31edbdeb08b.tar.bz2
android_packages_apps_Gallery2-9e0d687320eb9302b4b96f615083c31edbdeb08b.zip
ui cleanup
Change-Id: Ifb08af6bfad2f049b66932360901b2e52ff07f01
-rw-r--r--res/layout/filtershow_activity.xml2
-rw-r--r--res/layout/filtershow_control_action_slider.xml11
-rw-r--r--res/layout/filtershow_control_style_chooser.xml5
-rw-r--r--res/layout/filtershow_editor_panel.xml19
-rw-r--r--src/com/android/gallery3d/filtershow/controller/StyleChooser.java24
5 files changed, 32 insertions, 29 deletions
diff --git a/res/layout/filtershow_activity.xml b/res/layout/filtershow_activity.xml
index 644bd5a54..c3c593b4a 100644
--- a/res/layout/filtershow_activity.xml
+++ b/res/layout/filtershow_activity.xml
@@ -93,7 +93,7 @@
android:inflatedId="@+id/editorPanel"
android:layout="@layout/filtershow_editor_panel"
android:layout_width="match_parent"
- android:layout_height="wrap_content"
+ android:layout_height="match_parent"
android:visibility="visible" />
</LinearLayout>
diff --git a/res/layout/filtershow_control_action_slider.xml b/res/layout/filtershow_control_action_slider.xml
index 7caf96dca..734d7500b 100644
--- a/res/layout/filtershow_control_action_slider.xml
+++ b/res/layout/filtershow_control_action_slider.xml
@@ -18,23 +18,26 @@
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res/com.example.imagefilterharness"
android:layout_width="match_parent"
- android:layout_height="150dp"
+ android:layout_height="match_parent"
android:orientation="horizontal" >
<ImageButton
android:id="@+id/actionButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
+ android:layout_gravity="left|center_vertical"
android:scaleType="centerInside"
+ android:layout_weight="0"
android:background="@drawable/filtershow_button_background"
android:src="@drawable/filtershow_addpoint"
android:paddingBottom="8dp" />
<SeekBar
android:id="@+id/controlValueSeekBar"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:layout_gravity="fill_horizontal"
+ android:layout_width="0dip"
+ android:layout_height="wrap_content"
+ android:layout_gravity="center_vertical"
+ android:layout_weight="1"
style="@style/FilterShowSlider" />
</LinearLayout>
diff --git a/res/layout/filtershow_control_style_chooser.xml b/res/layout/filtershow_control_style_chooser.xml
index 4353b0b1f..a5bc984df 100644
--- a/res/layout/filtershow_control_style_chooser.xml
+++ b/res/layout/filtershow_control_style_chooser.xml
@@ -18,19 +18,18 @@
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res/com.example.imagefilterharness"
android:layout_width="match_parent"
- android:layout_height="150dp"
+ android:layout_height="match_parent"
android:orientation="horizontal" >
<HorizontalScrollView
android:id="@+id/scrollList"
android:layout_width="match_parent"
- android:layout_height="@dimen/thumbnail_size"
+ android:layout_height="match_parent"
android:scrollbars="none" >
<LinearLayout
android:id="@+id/listStyles"
android:layout_width="wrap_content"
android:layout_height="match_parent"
- android:layout_marginLeft="@dimen/thumbnail_margin"
android:orientation="horizontal" >
</LinearLayout>
</HorizontalScrollView>
diff --git a/res/layout/filtershow_editor_panel.xml b/res/layout/filtershow_editor_panel.xml
index 2afd3b286..e4bcfc805 100644
--- a/res/layout/filtershow_editor_panel.xml
+++ b/res/layout/filtershow_editor_panel.xml
@@ -18,15 +18,16 @@
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/top"
android:layout_width="match_parent"
- android:layout_height="wrap_content"
+ android:layout_height="match_parent"
android:layout_weight="0"
+ android:baselineAligned="false"
android:orientation="vertical"
android:visibility="visible" >
<LinearLayout
android:id="@+id/controlArea"
android:layout_width="match_parent"
- android:layout_height="64dp"
+ android:layout_height="0dp"
android:layout_weight="1"
android:orientation="horizontal"
android:visibility="visible" >
@@ -35,6 +36,7 @@
android:id="@+id/primarySeekBar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
+ android:layout_gravity="center_vertical"
android:layout_weight="1"
style="@style/FilterShowSlider" />
@@ -42,9 +44,10 @@
<LinearLayout
android:layout_width="match_parent"
- android:layout_height="94dip"
- android:layout_weight="1"
- android:background="@color/filtershow_background"
+ android:layout_height="56dip"
+ android:layout_weight="0"
+ android:layout_gravity="bottom"
+ android:background="@color/background_main_toolbar"
android:orientation="horizontal"
android:baselineAligned="false"
android:visibility="visible" >
@@ -54,7 +57,7 @@
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:layout_gravity="left|center_vertical"
- android:background="@drawable/filtershow_button_background"
+ android:background="@android:color/transparent"
android:layout_weight=".1"
android:gravity="center"
android:src="@drawable/ic_menu_cancel_holo_light"
@@ -78,7 +81,7 @@
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_gravity="center"
- android:background="@drawable/filtershow_button_background"
+ android:background="@android:color/transparent"
android:gravity="center"
android:text="@string/apply_effect"
android:textSize="18dip"
@@ -96,7 +99,7 @@
android:layout_height="fill_parent"
android:layout_gravity="right|center_vertical"
android:layout_weight=".1"
- android:background="@drawable/filtershow_button_background"
+ android:background="@android:color/transparent"
android:gravity="center"
android:src="@drawable/ic_menu_done_holo_light"
android:textSize="18dip" />
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;
}