aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorScott Jackson <daneren2005@gmail.com>2012-11-10 10:21:58 -0800
committerScott Jackson <daneren2005@gmail.com>2012-11-10 10:21:58 -0800
commitf068c1c71f4115bb4c73b6ad9bb807666270ff97 (patch)
treea23eea236c6d16b3192fb49f6313992f097a6a77
parentc629960b135718cfbf62711910493013eb3143c0 (diff)
downloaddsub-f068c1c71f4115bb4c73b6ad9bb807666270ff97.tar.gz
dsub-f068c1c71f4115bb4c73b6ad9bb807666270ff97.tar.bz2
dsub-f068c1c71f4115bb4c73b6ad9bb807666270ff97.zip
Rework of now playing tab to have larger image like Subsonic
-rw-r--r--subsonic-android/res/drawable-hdpi-v4/media_repeat_all.pngbin1428 -> 5090 bytes
-rw-r--r--subsonic-android/res/drawable-hdpi-v4/media_repeat_off.pngbin1552 -> 1079 bytes
-rw-r--r--subsonic-android/res/drawable-hdpi-v4/media_repeat_single.pngbin1889 -> 5564 bytes
-rw-r--r--subsonic-android/res/layout-land/download.xml13
-rw-r--r--subsonic-android/res/layout-port/download.xml145
-rw-r--r--subsonic-android/res/layout/download_media_buttons.xml4
-rw-r--r--subsonic-android/res/values/colors.xml2
-rw-r--r--subsonic-android/src/github/daneren2005/dsub/activity/DownloadActivity.java63
-rw-r--r--subsonic-android/src/github/daneren2005/dsub/util/FadeOutAnimation.java77
-rw-r--r--subsonic-android/src/github/daneren2005/dsub/util/ImageLoader.java70
10 files changed, 206 insertions, 168 deletions
diff --git a/subsonic-android/res/drawable-hdpi-v4/media_repeat_all.png b/subsonic-android/res/drawable-hdpi-v4/media_repeat_all.png
index f8012f9f..c2255058 100644
--- a/subsonic-android/res/drawable-hdpi-v4/media_repeat_all.png
+++ b/subsonic-android/res/drawable-hdpi-v4/media_repeat_all.png
Binary files differ
diff --git a/subsonic-android/res/drawable-hdpi-v4/media_repeat_off.png b/subsonic-android/res/drawable-hdpi-v4/media_repeat_off.png
index caf2cdfb..10315ab3 100644
--- a/subsonic-android/res/drawable-hdpi-v4/media_repeat_off.png
+++ b/subsonic-android/res/drawable-hdpi-v4/media_repeat_off.png
Binary files differ
diff --git a/subsonic-android/res/drawable-hdpi-v4/media_repeat_single.png b/subsonic-android/res/drawable-hdpi-v4/media_repeat_single.png
index 99d534cb..6d280e7a 100644
--- a/subsonic-android/res/drawable-hdpi-v4/media_repeat_single.png
+++ b/subsonic-android/res/drawable-hdpi-v4/media_repeat_single.png
Binary files differ
diff --git a/subsonic-android/res/layout-land/download.xml b/subsonic-android/res/layout-land/download.xml
index 8be7b430..6a9ccc5f 100644
--- a/subsonic-android/res/layout-land/download.xml
+++ b/subsonic-android/res/layout-land/download.xml
@@ -21,7 +21,7 @@
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight="1"
- android:scaleType="centerCrop"/>
+ android:scaleType="fitXY"/>
<include layout="@layout/download_playlist"/>
@@ -42,13 +42,6 @@
android:layout_gravity="center_horizontal">
<ImageButton
- android:id="@+id/download_repeat"
- android:src="@drawable/media_repeat_off"
- android:background="@android:color/transparent"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:padding="9dip"/>
- <ImageButton
android:id="@+id/download_star"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
@@ -125,13 +118,13 @@
android:textColor="?android:textColorPrimary" />
<include layout="@layout/download_media_buttons"/>
+
+ <include layout="@layout/download_slider"/>
</LinearLayout>
</LinearLayout>
- <include layout="@layout/download_slider"/>
-
<include layout="@layout/button_bar"/>
</LinearLayout>
diff --git a/subsonic-android/res/layout-port/download.xml b/subsonic-android/res/layout-port/download.xml
index e3d315c1..697067fa 100644
--- a/subsonic-android/res/layout-port/download.xml
+++ b/subsonic-android/res/layout-port/download.xml
@@ -18,78 +18,79 @@
android:layout_weight="1"
android:background="@android:color/transparent">
- <ImageButton
- android:id="@+id/download_repeat"
- android:src="@drawable/media_repeat_off"
- android:background="@android:color/transparent"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_gravity="top|right"
- android:paddingTop="24dip"
- android:paddingLeft="8dip"
- android:paddingBottom="12dip"/>
-
- <Button
- android:id="@+id/download_jukebox"
- android:text="RC"
- android:textStyle="bold"
- android:textSize="22sp"
- android:background="@android:color/transparent"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_gravity="top|right"
- android:layout_below="@+id/download_repeat"
- android:paddingTop="12dip"
- android:paddingLeft="14dip"
- android:paddingBottom="15dip"/>
-
- <Button
- android:id="@+id/download_equalizer"
- android:text="EQ"
- android:textStyle="bold"
- android:textSize="22sp"
- android:background="@android:color/transparent"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_gravity="top|right"
- android:layout_alignParentRight="true"
- android:paddingTop="24dip"
- android:paddingRight="16dip"
- android:paddingBottom="12dip"/>
-
- <Button
- android:id="@+id/download_visualizer"
- android:text="VIS"
- android:textStyle="bold"
- android:textSize="22sp"
- android:background="@android:color/transparent"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_gravity="top|right"
- android:layout_alignParentRight="true"
- android:layout_below="@+id/download_equalizer"
- android:layout_alignBottom="@+id/download_jukebox"
- android:paddingTop="12dip"
- android:paddingRight="12dip"
- android:paddingBottom="12dip"/>
-
- <ImageButton
- android:id="@+id/download_star"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_alignRight="@+id/download_repeat"
- android:layout_below="@+id/download_jukebox"
- android:background="@null"
- android:src="@android:drawable/star_big_off"/>
-
- <ImageView
- android:id="@+id/download_album_art_image"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_centerHorizontal="true"
- android:layout_alignParentTop="true"
- android:layout_marginTop="24dip"
- android:scaleType="fitCenter"/>
+ <RelativeLayout android:orientation="vertical"
+ android:layout_width="fill_parent"
+ android:layout_height="fill_parent"
+ android:layout_weight="1"
+ android:layout_above="@+id/download_visualizer_view_layout">
+
+ <ImageView
+ android:id="@+id/download_album_art_image"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_centerHorizontal="true"
+ android:layout_alignParentTop="true"
+ android:scaleType="centerCrop"/>
+
+ <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:id="@+id/download_overlay_buttons"
+ android:orientation="horizontal"
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content"
+ android:background="@color/overlayColor"
+ android:layout_alignParentBottom="true">
+
+ <Button
+ android:id="@+id/download_jukebox"
+ android:text="RC"
+ android:textStyle="bold"
+ android:textSize="22sp"
+ android:background="@android:color/transparent"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_gravity="bottom"
+ android:paddingTop="12dip"
+ android:paddingLeft="14dip"
+ android:paddingBottom="12dip"/>
+
+ <Button
+ android:id="@+id/download_equalizer"
+ android:text="EQ"
+ android:textStyle="bold"
+ android:textSize="22sp"
+ android:background="@android:color/transparent"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_gravity="bottom"
+ android:paddingTop="12dip"
+ android:paddingLeft="14dip"
+ android:paddingBottom="12dip"/>
+
+ <Button
+ android:id="@+id/download_visualizer"
+ android:text="VIS"
+ android:textStyle="bold"
+ android:textSize="22sp"
+ android:background="@android:color/transparent"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_gravity="bottom"
+ android:paddingTop="12dip"
+ android:paddingLeft="14dip"
+ android:paddingBottom="12dip"/>
+
+ <ImageButton
+ android:id="@+id/download_star"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_below="@+id/download_jukebox"
+ android:background="@android:color/transparent"
+ android:src="@android:drawable/star_big_off"
+ android:paddingTop="12dip"
+ android:paddingLeft="14dip"
+ android:paddingBottom="12dip"/>
+ </LinearLayout>
+ </RelativeLayout>
<TextView
android:id="@+id/download_status"
diff --git a/subsonic-android/res/layout/download_media_buttons.xml b/subsonic-android/res/layout/download_media_buttons.xml
index f0ceabcf..bc2b5c35 100644
--- a/subsonic-android/res/layout/download_media_buttons.xml
+++ b/subsonic-android/res/layout/download_media_buttons.xml
@@ -8,8 +8,8 @@
<ImageButton
style="@style/PlaybackControl.Small"
- android:id="@+id/download_shuffle"
- android:src="@drawable/action_shuffle"
+ android:id="@+id/download_repeat"
+ android:src="@drawable/media_repeat_off"
android:layout_alignParentLeft="true"
android:layout_centerVertical="true"
/>
diff --git a/subsonic-android/res/values/colors.xml b/subsonic-android/res/values/colors.xml
index 625810ff..d17486a1 100644
--- a/subsonic-android/res/values/colors.xml
+++ b/subsonic-android/res/values/colors.xml
@@ -8,7 +8,7 @@
<color name="notificationArtist">#434343</color>
<color name="notificationTitle">#000000</color>
<color name="background_holo_light">#ff33b5e5</color>
-
+ <color name="overlayColor">#80000000</color>
<color name="ics_opaque">#8033b5e5</color>
<color name="cyan">#ff0099cc</color>
</resources> \ No newline at end of file
diff --git a/subsonic-android/src/github/daneren2005/dsub/activity/DownloadActivity.java b/subsonic-android/src/github/daneren2005/dsub/activity/DownloadActivity.java
index 73f99b92..d428db4d 100644
--- a/subsonic-android/src/github/daneren2005/dsub/activity/DownloadActivity.java
+++ b/subsonic-android/src/github/daneren2005/dsub/activity/DownloadActivity.java
@@ -76,7 +76,9 @@ import github.daneren2005.dsub.util.Util;
import github.daneren2005.dsub.view.VisualizerView;
import static github.daneren2005.dsub.domain.PlayerState.*;
+import github.daneren2005.dsub.util.*;
import java.util.ArrayList;
+import java.util.concurrent.ScheduledFuture;
public class DownloadActivity extends SubsonicTabActivity implements OnGestureListener {
private static final String TAG = DownloadActivity.class.getSimpleName();
@@ -100,7 +102,6 @@ public class DownloadActivity extends SubsonicTabActivity implements OnGestureLi
private View pauseButton;
private View stopButton;
private View startButton;
- private View shuffleButton;
private ImageButton repeatButton;
private Button equalizerButton;
private Button visualizerButton;
@@ -116,6 +117,7 @@ public class DownloadActivity extends SubsonicTabActivity implements OnGestureLi
private int swipeVelocity;
private VisualizerView visualizerView;
private boolean nowPlaying = true;
+ private ScheduledFuture<?> hideControlsFuture;
/**
* Called when the activity is first created.
@@ -146,13 +148,11 @@ public class DownloadActivity extends SubsonicTabActivity implements OnGestureLi
pauseButton = findViewById(R.id.download_pause);
stopButton = findViewById(R.id.download_stop);
startButton = findViewById(R.id.download_start);
- shuffleButton = findViewById(R.id.download_shuffle);
repeatButton = (ImageButton) findViewById(R.id.download_repeat);
equalizerButton = (Button) findViewById(R.id.download_equalizer);
visualizerButton = (Button) findViewById(R.id.download_visualizer);
jukeboxButton = (Button) findViewById(R.id.download_jukebox);
LinearLayout visualizerViewLayout = (LinearLayout) findViewById(R.id.download_visualizer_view_layout);
-
toggleListButton = findViewById(R.id.download_toggle_list);
starButton = (ImageButton) findViewById(R.id.download_star);
@@ -186,13 +186,6 @@ public class DownloadActivity extends SubsonicTabActivity implements OnGestureLi
emptyTextView.setOnTouchListener(touchListener);
albumArtImageView.setOnTouchListener(touchListener);
- albumArtImageView.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View view) {
- toggleFullscreenAlbumArt();
- }
- });
-
previousButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
@@ -243,14 +236,6 @@ public class DownloadActivity extends SubsonicTabActivity implements OnGestureLi
}
});
- shuffleButton.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View view) {
- getDownloadService().shuffle();
- Util.toast(DownloadActivity.this, R.string.download_menu_shuffle_notification);
- }
- });
-
repeatButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
@@ -270,6 +255,7 @@ public class DownloadActivity extends SubsonicTabActivity implements OnGestureLi
default:
break;
}
+ setControlsVisible(true);
}
});
@@ -277,6 +263,7 @@ public class DownloadActivity extends SubsonicTabActivity implements OnGestureLi
@Override
public void onClick(View view) {
startActivity(new Intent(DownloadActivity.this, EqualizerActivity.class));
+ setControlsVisible(true);
}
});
@@ -288,6 +275,7 @@ public class DownloadActivity extends SubsonicTabActivity implements OnGestureLi
getDownloadService().setShowVisualization(visualizerView.isActive());
updateButtons();
Util.toast(DownloadActivity.this, active ? R.string.download_visualizer_on : R.string.download_visualizer_off);
+ setControlsVisible(true);
}
});
@@ -298,6 +286,7 @@ public class DownloadActivity extends SubsonicTabActivity implements OnGestureLi
getDownloadService().setJukeboxEnabled(jukeboxEnabled);
updateButtons();
Util.toast(DownloadActivity.this, jukeboxEnabled ? R.string.download_jukebox_on : R.string.download_jukebox_off, false);
+ setControlsVisible(true);
}
});
@@ -305,6 +294,7 @@ public class DownloadActivity extends SubsonicTabActivity implements OnGestureLi
@Override
public void onClick(View view) {
toggleFullscreenAlbumArt();
+ setControlsVisible(true);
}
});
@@ -316,6 +306,7 @@ public class DownloadActivity extends SubsonicTabActivity implements OnGestureLi
getDownloadService().seekTo(position);
onProgressChanged();
}
+ setControlsVisible(true);
}
});
playlistView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@@ -388,6 +379,8 @@ public class DownloadActivity extends SubsonicTabActivity implements OnGestureLi
executorService = Executors.newSingleThreadScheduledExecutor();
executorService.scheduleWithFixedDelay(runnable, 0L, 1000L, TimeUnit.MILLISECONDS);
+
+ setControlsVisible(true);
DownloadService downloadService = getDownloadService();
if (downloadService == null || downloadService.getCurrentPlaying() == null) {
@@ -410,6 +403,39 @@ public class DownloadActivity extends SubsonicTabActivity implements OnGestureLi
updateButtons();
}
+
+ private void scheduleHideControls() {
+ if (hideControlsFuture != null) {
+ hideControlsFuture.cancel(false);
+ }
+
+ final Handler handler = new Handler();
+ Runnable runnable = new Runnable() {
+ @Override
+ public void run() {
+ handler.post(new Runnable() {
+ @Override
+ public void run() {
+ setControlsVisible(false);
+ }
+ });
+ }
+ };
+ hideControlsFuture = executorService.schedule(runnable, 3000L, TimeUnit.MILLISECONDS);
+ }
+
+ private void setControlsVisible(boolean visible) {
+ try {
+ long duration = 1700L;
+ FadeOutAnimation.createAndStart(findViewById(R.id.download_overlay_buttons), !visible, duration);
+
+ if (visible) {
+ scheduleHideControls();
+ }
+ } catch(Exception e) {
+
+ }
+ }
private void updateButtons() {
boolean eqEnabled = getDownloadService() != null && getDownloadService().getEqualizerController() != null &&
@@ -838,6 +864,7 @@ public class DownloadActivity extends SubsonicTabActivity implements OnGestureLi
@Override
public boolean onDown(MotionEvent me) {
+ setControlsVisible(true);
return false;
}
diff --git a/subsonic-android/src/github/daneren2005/dsub/util/FadeOutAnimation.java b/subsonic-android/src/github/daneren2005/dsub/util/FadeOutAnimation.java
new file mode 100644
index 00000000..7acd79be
--- /dev/null
+++ b/subsonic-android/src/github/daneren2005/dsub/util/FadeOutAnimation.java
@@ -0,0 +1,77 @@
+/*
+ This file is part of Subsonic.
+
+ Subsonic is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ Subsonic is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with Subsonic. If not, see <http://www.gnu.org/licenses/>.
+
+ Copyright 2009 (C) Sindre Mehus
+ */
+package github.daneren2005.dsub.util;
+
+import android.view.View;
+import android.view.animation.AlphaAnimation;
+import android.view.animation.Animation;
+
+/**
+ * Fades a view out by changing its alpha value.
+ *
+ * @author Sindre Mehus
+ * @version $Id: Util.java 3203 2012-10-04 09:12:08Z sindre_mehus $
+ */
+public class FadeOutAnimation extends AlphaAnimation {
+
+ private boolean cancelled;
+
+ /**
+ * Creates and starts the fade out animation.
+ *
+ * @param view The view to fade out (or display).
+ * @param fadeOut If true, the view is faded out. Otherwise it is immediately made visible.
+ * @param durationMillis Fade duration.
+ */
+ public static void createAndStart(View view, boolean fadeOut, long durationMillis) {
+ if (fadeOut) {
+ view.clearAnimation();
+ view.startAnimation(new FadeOutAnimation(view, durationMillis));
+ } else {
+ Animation animation = view.getAnimation();
+ if (animation instanceof FadeOutAnimation) {
+ ((FadeOutAnimation) animation).cancelFadeOut();
+ }
+ view.clearAnimation();
+ view.setVisibility(View.VISIBLE);
+ }
+ }
+
+ FadeOutAnimation(final View view, long durationMillis) {
+ super(1.0F, 0.0F);
+ setDuration(durationMillis);
+ setAnimationListener(new AnimationListener() {
+ public void onAnimationStart(Animation animation) {
+ }
+
+ public void onAnimationRepeat(Animation animation) {
+ }
+
+ public void onAnimationEnd(Animation animation) {
+ if (!cancelled) {
+ view.setVisibility(View.INVISIBLE);
+ }
+ }
+ });
+ }
+
+ private void cancelFadeOut() {
+ cancelled = true;
+ }
+}
diff --git a/subsonic-android/src/github/daneren2005/dsub/util/ImageLoader.java b/subsonic-android/src/github/daneren2005/dsub/util/ImageLoader.java
index fff1d68e..8c037468 100644
--- a/subsonic-android/src/github/daneren2005/dsub/util/ImageLoader.java
+++ b/subsonic-android/src/github/daneren2005/dsub/util/ImageLoader.java
@@ -21,11 +21,6 @@ package github.daneren2005.dsub.util;
import android.annotation.TargetApi;
import android.content.Context;
import android.graphics.Bitmap;
-import android.graphics.Canvas;
-import android.graphics.LinearGradient;
-import android.graphics.Matrix;
-import android.graphics.Paint;
-import android.graphics.Shader;
import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.Drawable;
import android.graphics.drawable.TransitionDrawable;
@@ -71,7 +66,7 @@ public class ImageLoader implements Runnable {
// Determine the density-dependent image sizes.
imageSizeDefault = context.getResources().getDrawable(R.drawable.unknown_album).getIntrinsicHeight();
DisplayMetrics metrics = context.getResources().getDisplayMetrics();
- imageSizeLarge = (int) Math.round(Math.min(metrics.widthPixels, metrics.heightPixels) * 0.6);
+ imageSizeLarge = (int) Math.round(Math.min(metrics.widthPixels, metrics.heightPixels));
for (int i = 0; i < CONCURRENCY; i++) {
new Thread(this, "ImageLoader").start();
@@ -83,7 +78,6 @@ public class ImageLoader implements Runnable {
private void createLargeUnknownImage(Context context) {
BitmapDrawable drawable = (BitmapDrawable) context.getResources().getDrawable(R.drawable.unknown_album_large);
Bitmap bitmap = Bitmap.createScaledBitmap(drawable.getBitmap(), imageSizeLarge, imageSizeLarge, true);
- bitmap = createReflection(bitmap);
largeUnknownImage = Util.createDrawableFromBitmap(context, bitmap);
}
@@ -103,7 +97,7 @@ public class ImageLoader implements Runnable {
if (!large) {
setUnknownImage(view, large);
}
- queue.offer(new Task(view.getContext(), entry, size, large, large, new ViewTaskHandler(view, crossfade)));
+ queue.offer(new Task(view.getContext(), entry, size, large, new ViewTaskHandler(view, crossfade)));
}
public void loadImage(Context context, RemoteControlClient remoteControl, MusicDirectory.Entry entry) {
@@ -119,7 +113,7 @@ public class ImageLoader implements Runnable {
}
setUnknownImage(remoteControl);
- queue.offer(new Task(context, entry, imageSizeLarge, false, false, new RemoteControlClientTaskHandler(remoteControl)));
+ queue.offer(new Task(context, entry, imageSizeLarge, false, new RemoteControlClientTaskHandler(remoteControl)));
}
public void loadImage(ActionBar actionBar, MusicDirectory.Entry entry) {
@@ -135,7 +129,7 @@ public class ImageLoader implements Runnable {
}
setUnknownImage(actionBar);
- queue.offer(new Task(actionBar.getThemedContext(), entry, imageSizeDefault, false, false, new ActionBarTaskHandler(actionBar)));
+ queue.offer(new Task(actionBar.getThemedContext(), entry, imageSizeDefault, false, new ActionBarTaskHandler(actionBar)));
}
private String getKey(String coverArtId, int size) {
@@ -218,69 +212,19 @@ public class ImageLoader implements Runnable {
}
}
}
-
- private Bitmap createReflection(Bitmap originalImage) {
-
- int width = originalImage.getWidth();
- int height = originalImage.getHeight();
-
- // The gap we want between the reflection and the original image
- final int reflectionGap = 4;
-
- // This will not scale but will flip on the Y axis
- Matrix matrix = new Matrix();
- matrix.preScale(1, -1);
-
- // Create a Bitmap with the flip matix applied to it.
- // We only want the bottom half of the image
- Bitmap reflectionImage = Bitmap.createBitmap(originalImage, 0, height / 2, width, height / 2, matrix, false);
-
- // Create a new bitmap with same width but taller to fit reflection
- Bitmap bitmapWithReflection = Bitmap.createBitmap(width, (height + height / 2), Bitmap.Config.ARGB_8888);
-
- // Create a new Canvas with the bitmap that's big enough for
- // the image plus gap plus reflection
- Canvas canvas = new Canvas(bitmapWithReflection);
-
- // Draw in the original image
- canvas.drawBitmap(originalImage, 0, 0, null);
-
- // Draw in the gap
- Paint defaultPaint = new Paint();
- canvas.drawRect(0, height, width, height + reflectionGap, defaultPaint);
-
- // Draw in the reflection
- canvas.drawBitmap(reflectionImage, 0, height + reflectionGap, null);
-
- // Create a shader that is a linear gradient that covers the reflection
- Paint paint = new Paint();
- LinearGradient shader = new LinearGradient(0, originalImage.getHeight(), 0,
- bitmapWithReflection.getHeight() + reflectionGap, 0x70000000, 0xff000000,
- Shader.TileMode.CLAMP);
-
- // Set the paint to use this shader (linear gradient)
- paint.setShader(shader);
-
- // Draw a rectangle using the paint with our linear gradient
- canvas.drawRect(0, height, width, bitmapWithReflection.getHeight() + reflectionGap, paint);
-
- return bitmapWithReflection;
- }
private class Task {
private final Context mContext;
private final MusicDirectory.Entry mEntry;
private final Handler mHandler;
private final int mSize;
- private final boolean mReflection;
private final boolean mSaveToFile;
private ImageLoaderTaskHandler mTaskHandler;
- public Task(Context context, MusicDirectory.Entry entry, int size, boolean reflection, boolean saveToFile, ImageLoaderTaskHandler taskHandler) {
+ public Task(Context context, MusicDirectory.Entry entry, int size, boolean saveToFile, ImageLoaderTaskHandler taskHandler) {
mContext = context;
mEntry = entry;
mSize = size;
- mReflection = reflection;
mSaveToFile = saveToFile;
mTaskHandler = taskHandler;
mHandler = new Handler();
@@ -291,10 +235,6 @@ public class ImageLoader implements Runnable {
MusicService musicService = MusicServiceFactory.getMusicService(mContext);
Bitmap bitmap = musicService.getCoverArt(mContext, mEntry, mSize, mSaveToFile, null);
- if (mReflection) {
- bitmap = createReflection(bitmap);
- }
-
final Drawable drawable = Util.createDrawableFromBitmap(mContext, bitmap);
cache.put(getKey(mEntry.getCoverArt(), mSize), drawable);