Loading res/layout/filtershow_activity.xml +1 −1 Original line number Diff line number Diff line Loading @@ -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> Loading res/layout/filtershow_control_action_slider.xml +7 −4 Original line number Diff line number Diff line Loading @@ -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_width="0dip" android:layout_height="wrap_content" android:layout_gravity="fill_horizontal" android:layout_gravity="center_vertical" android:layout_weight="1" style="@style/FilterShowSlider" /> </LinearLayout> res/layout/filtershow_control_style_chooser.xml +2 −3 Original line number Diff line number Diff line Loading @@ -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> Loading res/layout/filtershow_editor_panel.xml +11 −8 Original line number Diff line number Diff line Loading @@ -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" > Loading @@ -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" /> Loading @@ -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" > Loading @@ -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" Loading @@ -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" Loading @@ -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" /> Loading src/com/android/gallery3d/filtershow/controller/StyleChooser.java +11 −13 Original line number Diff line number Diff line 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; Loading @@ -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 Loading @@ -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() { Loading Loading @@ -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; } Loading Loading
res/layout/filtershow_activity.xml +1 −1 Original line number Diff line number Diff line Loading @@ -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> Loading
res/layout/filtershow_control_action_slider.xml +7 −4 Original line number Diff line number Diff line Loading @@ -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_width="0dip" android:layout_height="wrap_content" android:layout_gravity="fill_horizontal" android:layout_gravity="center_vertical" android:layout_weight="1" style="@style/FilterShowSlider" /> </LinearLayout>
res/layout/filtershow_control_style_chooser.xml +2 −3 Original line number Diff line number Diff line Loading @@ -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> Loading
res/layout/filtershow_editor_panel.xml +11 −8 Original line number Diff line number Diff line Loading @@ -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" > Loading @@ -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" /> Loading @@ -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" > Loading @@ -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" Loading @@ -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" Loading @@ -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" /> Loading
src/com/android/gallery3d/filtershow/controller/StyleChooser.java +11 −13 Original line number Diff line number Diff line 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; Loading @@ -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 Loading @@ -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() { Loading Loading @@ -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; } Loading