diff options
Diffstat (limited to 'src/com')
6 files changed, 66 insertions, 50 deletions
diff --git a/src/com/android/gallery3d/filtershow/FilterShowActivity.java b/src/com/android/gallery3d/filtershow/FilterShowActivity.java index ce2ab7412..bf5deedd5 100644 --- a/src/com/android/gallery3d/filtershow/FilterShowActivity.java +++ b/src/com/android/gallery3d/filtershow/FilterShowActivity.java @@ -1519,10 +1519,6 @@ public class FilterShowActivity extends FragmentActivity implements OnItemClickL for (FilterRepresentation representation : filtersRepresentations) { mCategoryLooksAdapter.add(new Action(this, representation, Action.FULL_VIEW)); } - if (mUserPresetsManager.getRepresentations() == null - || mUserPresetsManager.getRepresentations().size() == 0) { - mCategoryLooksAdapter.add(new Action(this, Action.ADD_ACTION)); - } Fragment panel = getSupportFragmentManager().findFragmentByTag(MainPanel.FRAGMENT_TAG); if (panel != null) { @@ -1855,28 +1851,10 @@ public class FilterShowActivity extends FragmentActivity implements OnItemClickL } public void startTouchAnimation(View target, float x, float y) { - final CategorySelected hint = - (CategorySelected) findViewById(R.id.categorySelectedIndicator); int location[] = new int[2]; target.getLocationOnScreen(location); mHintTouchPoint.x = (int) (location[0] + x); mHintTouchPoint.y = (int) (location[1] + y); - int locationHint[] = new int[2]; - ((View)hint.getParent()).getLocationOnScreen(locationHint); - int dx = (int) (x - (hint.getWidth())/2); - int dy = (int) (y - (hint.getHeight())/2); - hint.setTranslationX(location[0] - locationHint[0] + dx); - hint.setTranslationY(location[1] - locationHint[1] + dy); - hint.setVisibility(View.VISIBLE); - hint.animate().scaleX(2).scaleY(2).alpha(0).withEndAction(new Runnable() { - @Override - public void run() { - hint.setVisibility(View.INVISIBLE); - hint.setScaleX(1); - hint.setScaleY(1); - hint.setAlpha(1); - } - }); } public void setScaleImage(boolean isScaled) { diff --git a/src/com/android/gallery3d/filtershow/category/CategoryView.java b/src/com/android/gallery3d/filtershow/category/CategoryView.java index 99af80f4d..fff4e0bf3 100644 --- a/src/com/android/gallery3d/filtershow/category/CategoryView.java +++ b/src/com/android/gallery3d/filtershow/category/CategoryView.java @@ -28,6 +28,7 @@ import android.view.MotionEvent; import android.view.View; import com.android.gallery3d.R; import com.android.gallery3d.filtershow.FilterShowActivity; +import com.android.gallery3d.filtershow.filters.FilterRepresentation; import com.android.gallery3d.filtershow.ui.SelectionRenderer; public class CategoryView extends IconView @@ -121,8 +122,8 @@ public class CategoryView extends IconView } super.onDraw(canvas); if (mAdapter.isSelected(this)) { - SelectionRenderer.drawSelection(canvas, 0, 0, - getWidth(), getHeight(), + SelectionRenderer.drawSelection(canvas, getMargin() / 2, getMargin(), + getWidth() - getMargin() / 2, getHeight() - getMargin(), mSelectionStroke, mSelectPaint, mBorderStroke, mBorderPaint); } } @@ -198,4 +199,24 @@ public class CategoryView extends IconView public void delete() { mAdapter.remove(mAction); } + + @Override + protected void drawBottomRect(Canvas canvas) { + super.drawBottomRect(canvas); + FilterRepresentation filterRepresentation = mAction.getRepresentation(); + if (filterRepresentation != null) { + if (filterRepresentation.getFilterType() == FilterRepresentation.TYPE_FX) { + mPaint.setColor(getResources().getColor(filterRepresentation.getColorId())); + } else { + mPaint.setColor( + getContext().getResources().getColor(R.color.iconview_bottom_color)); + } + mPaint.setStyle(Paint.Style.FILL); + canvas.drawRect(getBitmapBounds().left, + getBitmapBounds().bottom - getBottomRectHeight(), + getBitmapBounds().right, + getBitmapBounds().bottom, + mPaint); + } + } } diff --git a/src/com/android/gallery3d/filtershow/category/IconView.java b/src/com/android/gallery3d/filtershow/category/IconView.java index 4823cd1a6..1bfd2a7af 100644 --- a/src/com/android/gallery3d/filtershow/category/IconView.java +++ b/src/com/android/gallery3d/filtershow/category/IconView.java @@ -21,13 +21,10 @@ import android.content.res.Resources; import android.graphics.Bitmap; import android.graphics.BitmapFactory; import android.graphics.Canvas; -import android.graphics.Color; -import android.graphics.LinearGradient; import android.graphics.Matrix; import android.graphics.Paint; import android.graphics.Rect; import android.graphics.RectF; -import android.graphics.Shader; import android.graphics.Typeface; import android.util.AttributeSet; import android.view.View; @@ -44,6 +41,7 @@ public class IconView extends View { private int mMargin = 16; private int mOrientation = HORIZONTAL; private int mTextSize = 32; + private int mBottomRectHeight; private Rect mTextBounds = new Rect(); private Bitmap mBitmap; private Rect mBitmapBounds; @@ -72,6 +70,7 @@ public class IconView extends View { mBackgroundColor = res.getColor(android.R.color.transparent); mMargin = res.getDimensionPixelOffset(R.dimen.category_panel_margin); mTextSize = res.getDimensionPixelSize(R.dimen.category_panel_text_size); + mBottomRectHeight = res.getDimensionPixelOffset(R.dimen.category_panel_bottom_rect_height); } protected void computeTextPosition(String text) { @@ -108,7 +107,7 @@ public class IconView extends View { // justify to the left. x = mMargin; } - int y = canvas.getHeight() - getTextHeight(mPaint) / 2 - mMargin; + int y = canvas.getHeight() - mBottomRectHeight / 2 - mMargin / 2; canvas.drawText(text, x, y, mPaint); } @@ -129,6 +128,13 @@ public class IconView extends View { drawText(canvas, text); } + protected void drawBottomRect(Canvas canvas) { + } + + public int getBottomRectHeight() { + return mBottomRectHeight; + } + public int getOrientation() { return mOrientation; } @@ -184,13 +190,14 @@ public class IconView extends View { public void computeBitmapBounds() { if (mUseOnlyDrawable) { - mBitmapBounds = new Rect(mMargin/2, mMargin, getWidth() - mMargin/2, - getHeight() - mTextSize - 2*mMargin); + mBitmapBounds = new Rect(mMargin / 2, mMargin, getWidth() - mMargin / 2, + getHeight() - mTextSize - 2 * mMargin); } else { if (getOrientation() == VERTICAL && isHalfImage()) { - mBitmapBounds = new Rect(mMargin/2, mMargin, getWidth()/2, getHeight()); + mBitmapBounds = new Rect(mMargin / 2, mMargin, getWidth() / 2, getHeight()); } else { - mBitmapBounds = new Rect(mMargin/2, mMargin, getWidth() - mMargin/2, getHeight()); + mBitmapBounds = new Rect(mMargin / 2, mMargin, getWidth() - mMargin / 2, + getHeight() - mMargin); } } } @@ -226,22 +233,7 @@ public class IconView extends View { canvas.drawBitmap(mBitmap, m, mPaint); canvas.restore(); } - - if (!mUseOnlyDrawable) { - int startColor = Color.argb(0, 0, 0, 0); - int endColor = Color.argb(200, 0, 0, 0); - float start = getHeight() - 2 * mMargin - 2 * mTextSize; - float end = getHeight(); - Shader shader = new LinearGradient(0, start, 0, end, startColor, - endColor, Shader.TileMode.CLAMP); - mPaint.setShader(shader); - float startGradient = 0; - if (getOrientation() == VERTICAL && isHalfImage()) { - startGradient = getWidth()/2; - } - canvas.drawRect(new RectF(startGradient, start, getWidth(), end), mPaint); - mPaint.setShader(null); - } + drawBottomRect(canvas); drawOutlinedText(canvas, getText()); } } diff --git a/src/com/android/gallery3d/filtershow/filters/BaseFiltersManager.java b/src/com/android/gallery3d/filtershow/filters/BaseFiltersManager.java index efa351b04..b72b5d2fd 100644 --- a/src/com/android/gallery3d/filtershow/filters/BaseFiltersManager.java +++ b/src/com/android/gallery3d/filtershow/filters/BaseFiltersManager.java @@ -315,19 +315,35 @@ public abstract class BaseFiltersManager implements FiltersManagerInterface { "LUT3D_XPROCESS" }; + int[] colorId = { + R.color.filtershow_color_none, + R.color.filtershow_color_punch, + R.color.filtershow_color_vintage, + R.color.filtershow_color_bw, + R.color.filtershow_color_bleach, + R.color.filtershow_color_instant, + R.color.filtershow_color_latte, + R.color.filtershow_color_blue, + R.color.filtershow_color_litho, + R.color.filtershow_color_xprocess + }; + FilterFxRepresentation nullFx = new FilterFxRepresentation(context.getString(R.string.none), 0, R.string.none); + nullFx.setColorId(colorId[0]); mLooks.add(nullFx); for (int i = 0; i < drawid.length; i++) { FilterFxRepresentation fx = new FilterFxRepresentation( context.getString(fxNameid[i]), drawid[i], fxNameid[i]); fx.setSerializationName(serializationNames[i]); + fx.setColorId(colorId[i] + 1); ImagePreset preset = new ImagePreset(); preset.addFilter(fx); FilterUserPresetRepresentation rep = new FilterUserPresetRepresentation( context.getString(fxNameid[i]), preset, -1); + rep.setColorId(colorId[i] + 1); mLooks.add(rep); addRepresentation(fx); } diff --git a/src/com/android/gallery3d/filtershow/filters/FilterRepresentation.java b/src/com/android/gallery3d/filtershow/filters/FilterRepresentation.java index 198e741c3..8d1911315 100644 --- a/src/com/android/gallery3d/filtershow/filters/FilterRepresentation.java +++ b/src/com/android/gallery3d/filtershow/filters/FilterRepresentation.java @@ -36,6 +36,7 @@ public class FilterRepresentation { private int mEditorId = BasicEditor.ID; private int mButtonId = 0; private int mOverlayId = 0; + private int mColorId = 0; private boolean mOverlayOnly = false; private boolean mShowParameterValue = true; private boolean mIsBooleanFilter = false; @@ -91,12 +92,21 @@ public class FilterRepresentation { && representation.mOverlayId == mOverlayId && representation.mOverlayOnly == mOverlayOnly && representation.mShowParameterValue == mShowParameterValue - && representation.mIsBooleanFilter == mIsBooleanFilter) { + && representation.mIsBooleanFilter == mIsBooleanFilter + && representation.mColorId == mColorId) { return true; } return false; } + public int getColorId() { + return mColorId; + } + + public void setColorId(int colorId) { + mColorId = colorId; + } + public boolean isBooleanFilter() { return mIsBooleanFilter; } diff --git a/src/com/android/gallery3d/filtershow/filters/ImageFilterSharpen.java b/src/com/android/gallery3d/filtershow/filters/ImageFilterSharpen.java index 16959035d..783afee25 100644 --- a/src/com/android/gallery3d/filtershow/filters/ImageFilterSharpen.java +++ b/src/com/android/gallery3d/filtershow/filters/ImageFilterSharpen.java @@ -36,7 +36,6 @@ public class ImageFilterSharpen extends ImageFilterRS { representation.setShowParameterValue(true); representation.setFilterClass(ImageFilterSharpen.class); representation.setTextId(R.string.sharpness); - representation.setOverlayId(R.drawable.filtershow_button_colors_sharpen); representation.setEditorId(BasicEditor.ID); representation.setSupportsPartialRendering(true); return representation; |
