diff options
author | linus_lee <llee@cyngn.com> | 2014-09-02 18:57:39 -0700 |
---|---|---|
committer | linus_lee <llee@cyngn.com> | 2014-11-20 11:59:11 -0800 |
commit | 32e9492d3d5d0fae297af88865cfc3cfc22e27c1 (patch) | |
tree | a17d7d9233935af839885e3fffdfe0f9a5dc5eb1 /src/com/cyngn/eleven/widgets | |
parent | 08276a046ece9c2d25ee5db858bce822bfb0a292 (diff) | |
download | android_packages_apps_Eleven-32e9492d3d5d0fae297af88865cfc3cfc22e27c1.tar.gz android_packages_apps_Eleven-32e9492d3d5d0fae297af88865cfc3cfc22e27c1.tar.bz2 android_packages_apps_Eleven-32e9492d3d5d0fae297af88865cfc3cfc22e27c1.zip |
Eleven: Add blurring behind the now playing and the queue fragments and fixes a few bugs
In addition to blurring, hide non-english headers, and fix the gripper colors
Change-Id: I6899a5d1d3bb8c6c7711652a618b1bdc47abcb1f
Diffstat (limited to 'src/com/cyngn/eleven/widgets')
-rw-r--r-- | src/com/cyngn/eleven/widgets/BlurScrimImage.java | 73 |
1 files changed, 73 insertions, 0 deletions
diff --git a/src/com/cyngn/eleven/widgets/BlurScrimImage.java b/src/com/cyngn/eleven/widgets/BlurScrimImage.java new file mode 100644 index 0000000..e9be8f9 --- /dev/null +++ b/src/com/cyngn/eleven/widgets/BlurScrimImage.java @@ -0,0 +1,73 @@ +/* + * Copyright (C) 2014 Cyanogen, Inc. + */ +package com.cyngn.eleven.widgets; + +import android.content.Context; +import android.graphics.Bitmap; +import android.graphics.Color; +import android.graphics.drawable.BitmapDrawable; +import android.graphics.drawable.TransitionDrawable; +import android.util.AttributeSet; +import android.widget.FrameLayout; +import android.widget.ImageView; + +import com.cyngn.eleven.R; +import com.cyngn.eleven.cache.ImageFetcher; +import com.cyngn.eleven.cache.ImageWorker; + +public class BlurScrimImage extends FrameLayout { + private ImageView mImageView; + + public BlurScrimImage(Context context, AttributeSet attrs) { + super(context, attrs); + } + + + + @Override + protected void onFinishInflate() { + super.onFinishInflate(); + + mImageView = (ImageView)findViewById(R.id.blurImage); + } + + public ImageView getImageView() { + return mImageView; + } + + /** + * Transitions the image to the default state (default blur artwork) + */ + public void transitionToDefaultState() { + Bitmap blurredBitmap = ((BitmapDrawable) getResources().getDrawable(R.drawable.default_artwork_blur)).getBitmap(); + + TransitionDrawable imageTransition = ImageWorker.createImageTransitionDrawable(getResources(), + mImageView.getDrawable(), blurredBitmap, ImageWorker.FADE_IN_TIME_SLOW, true, true); + + TransitionDrawable paletteTransition = ImageWorker.createPaletteTransition(this, + Color.TRANSPARENT); + + + setTransitionDrawable(imageTransition, paletteTransition); + } + + /** + * Sets the transition drawable + * @param imageTransition the transition for the imageview + * @param paletteTransition the transition for the scrim overlay + */ + public void setTransitionDrawable(TransitionDrawable imageTransition, + TransitionDrawable paletteTransition) { + setBackground(paletteTransition); + mImageView.setImageDrawable(imageTransition); + } + + /** + * Loads the current artwork into this BlurScrimImage + * @param imageFetcher an ImageFetcher instance + */ + public void loadBlurImage(ImageFetcher imageFetcher) { + imageFetcher.loadCurrentBlurredArtwork(this); + } +} |