<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
- android:layout_height="match_parent" >
+ android:layout_height="match_parent"
+ android:background="@color/background_main_toolbar" >
<LinearLayout
android:id="@+id/imageStatePanel"
android:visibility="gone" />
</FrameLayout>
+ <com.android.gallery3d.filtershow.CenteredLinearLayout
+ xmlns:custom="http://schemas.android.com/apk/res/com.android.gallery3d"
+ android:id="@+id/mainPanel"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:layout_gravity="center"
+ custom:max_width="600dip"
+ android:orientation="vertical">
+
<FrameLayout
android:id="@+id/secondRowPanel"
android:layout_width="fill_parent"
android:id="@+id/listGeometry"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
- android:orientation="horizontal" >
+ android:layout_gravity="center"
+ android:orientation="horizontal">
<com.android.gallery3d.filtershow.ui.ImageButtonTitle
android:id="@+id/straightenButton"
</HorizontalScrollView>
</FrameLayout>
+ <com.android.gallery3d.filtershow.CenteredLinearLayout
+ xmlns:custom="http://schemas.android.com/apk/res/com.android.gallery3d"
+ android:id="@+id/mainPanel"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:layout_gravity="center"
+ custom:max_width="400dip"
+ android:orientation="vertical">
+
<LinearLayout
android:layout_width="match_parent"
android:layout_height="48dip"
android:scaleType="centerInside"
android:src="@drawable/ic_photoeditor_color" />
</LinearLayout>
+
+ </com.android.gallery3d.filtershow.CenteredLinearLayout>
+
+ </com.android.gallery3d.filtershow.CenteredLinearLayout>
</LinearLayout>
</FrameLayout>
--- /dev/null
+package com.android.gallery3d.filtershow;
+
+import android.content.Context;
+import android.content.res.Resources;
+import android.content.res.TypedArray;
+import android.util.AttributeSet;
+import android.util.TypedValue;
+import android.view.View.MeasureSpec;
+import android.widget.LinearLayout;
+
+import com.android.gallery3d.R;
+
+public class CenteredLinearLayout extends LinearLayout {
+ private final int mMaxWidth;
+
+ public CenteredLinearLayout(Context context, AttributeSet attrs) {
+ super(context, attrs);
+ TypedArray a = getContext().obtainStyledAttributes(attrs, R.styleable.CenteredLinearLayout);
+ mMaxWidth = a.getDimensionPixelSize(R.styleable.CenteredLinearLayout_max_width, 0);
+ }
+
+ @Override
+ protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
+ int parentWidth = MeasureSpec.getSize(widthMeasureSpec);
+ int parentHeight = MeasureSpec.getSize(heightMeasureSpec);
+ Resources r = getContext().getResources();
+ float value = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, parentWidth,
+ r.getDisplayMetrics());
+ if (mMaxWidth > 0 && parentWidth > mMaxWidth) {
+ int measureMode = MeasureSpec.getMode(widthMeasureSpec);
+ widthMeasureSpec = MeasureSpec.makeMeasureSpec(mMaxWidth, measureMode);
+ }
+ super.onMeasure(widthMeasureSpec, heightMeasureSpec);
+ }
+
+}
import com.android.gallery3d.filtershow.cache.ImageLoader;
import com.android.gallery3d.filtershow.filters.ImageFilter;
import com.android.gallery3d.filtershow.filters.ImageFilterBorder;
+import com.android.gallery3d.filtershow.filters.ImageFilterContrast;
+import com.android.gallery3d.filtershow.filters.ImageFilterExposure;
import com.android.gallery3d.filtershow.filters.ImageFilterFx;
+import com.android.gallery3d.filtershow.filters.ImageFilterHue;
import com.android.gallery3d.filtershow.filters.ImageFilterParametricBorder;
import com.android.gallery3d.filtershow.filters.ImageFilterRS;
+import com.android.gallery3d.filtershow.filters.ImageFilterSaturated;
+import com.android.gallery3d.filtershow.filters.ImageFilterShadows;
+import com.android.gallery3d.filtershow.filters.ImageFilterVibrance;
+import com.android.gallery3d.filtershow.filters.ImageFilterVignette;
+import com.android.gallery3d.filtershow.filters.ImageFilterWBalance;
import com.android.gallery3d.filtershow.imageshow.ImageBorder;
import com.android.gallery3d.filtershow.imageshow.ImageCrop;
import com.android.gallery3d.filtershow.imageshow.ImageFlip;
import com.android.gallery3d.filtershow.imageshow.ImageSmallBorder;
import com.android.gallery3d.filtershow.imageshow.ImageSmallFilter;
import com.android.gallery3d.filtershow.imageshow.ImageStraighten;
+import com.android.gallery3d.filtershow.imageshow.ImageWithIcon;
import com.android.gallery3d.filtershow.imageshow.ImageZoom;
import com.android.gallery3d.filtershow.presets.ImagePreset;
import com.android.gallery3d.filtershow.provider.SharedImageProvider;
LinearLayout listFilters = (LinearLayout) findViewById(R.id.listFilters);
LinearLayout listBorders = (LinearLayout) findViewById(R.id.listBorders);
+ LinearLayout listColors = (LinearLayout) findViewById(R.id.listColorsFx);
mImageShow = (ImageShow) findViewById(R.id.imageShow);
mImageCurves = (ImageCurves) findViewById(R.id.imageCurves);
mPanelController.addComponent(mGeometryButton, findViewById(R.id.flipButton));
mPanelController.addPanel(mColorsButton, mListColors, 3);
- mPanelController.addComponent(mColorsButton, findViewById(R.id.vignetteButton));
+
+ int []recastIDs = {
+ R.id.vignetteButton,
+ R.id.vibranceButton,
+ R.id.contrastButton,
+ R.id.saturationButton,
+ R.id.wbalanceButton,
+ R.id.hueButton,
+ R.id.exposureButton,
+ R.id.shadowRecoveryButton
+ };
+ ImageFilter []filters = {
+ new ImageFilterVignette(),
+ new ImageFilterVibrance(),
+ new ImageFilterContrast(),
+ new ImageFilterSaturated(),
+ new ImageFilterWBalance(),
+ new ImageFilterHue(),
+ new ImageFilterExposure(),
+ new ImageFilterShadows()
+ };
+
+
+ for (int i = 0; i < filters.length; i++) {
+
+ ImageSmallFilter fView = new ImageSmallFilter(this);
+ View v = listColors.findViewById(recastIDs[i]);
+ int pos = listColors.indexOfChild(v);
+ listColors.removeView(v);
+
+ filters[i].setParameter(100);
+ fView.setImageFilter(filters[i]);
+ fView.setController(this);
+ fView.setImageLoader(mImageLoader);
+ fView.setId(recastIDs[i]);
+
+ mPanelController.addComponent(mColorsButton, fView);
+ listColors.addView(fView,pos);
+ }
+
+ int []overlayIDs = {
+ R.id.sharpenButton,
+ R.id.curvesButtonRGB
+ };
+ int []overlayBitmaps = {
+ R.drawable.filtershow_button_colors_sharpen,
+ R.drawable.filtershow_button_colors_curve
+ };
+ int []overlayNames = {
+ R.string.sharpen,
+ R.string.curvesRGB
+ };
+
+ for (int i = 0; i < overlayIDs.length; i++) {
+ ImageWithIcon fView = new ImageWithIcon(this);
+ View v = listColors.findViewById(overlayIDs[i]);
+ int pos = listColors.indexOfChild(v);
+ listColors.removeView(v);
+ final int sid =overlayNames[i];
+ ImageFilterExposure efilter = new ImageFilterExposure(){
+ {
+ mName = getString(sid);
+ }
+ };
+ efilter.setParameter(-300);
+ Bitmap bitmap = BitmapFactory.decodeResource(getResources(),
+ overlayBitmaps[i] );
+
+ fView.setIcon(bitmap);
+ fView.setImageFilter(efilter);
+ fView.setController(this);
+ fView.setImageLoader(mImageLoader);
+ fView.setId(overlayIDs[i]);
+
+ mPanelController.addComponent(mColorsButton, fView);
+ listColors.addView(fView,pos);
+ }
+
mPanelController.addComponent(mColorsButton, findViewById(R.id.curvesButtonRGB));
mPanelController.addComponent(mColorsButton, findViewById(R.id.sharpenButton));
mPanelController.addComponent(mColorsButton, findViewById(R.id.vibranceButton));