@ -6,3 +6,7 @@ android {
|
|||||||
abortOnError true
|
abortOnError true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
dependencies {
|
||||||
|
implementation "androidx.appcompat:appcompat-resources:1.2.0"
|
||||||
|
}
|
@ -25,6 +25,9 @@ import android.view.ViewTreeObserver;
|
|||||||
import android.view.animation.AccelerateInterpolator;
|
import android.view.animation.AccelerateInterpolator;
|
||||||
import android.view.animation.Interpolator;
|
import android.view.animation.Interpolator;
|
||||||
|
|
||||||
|
import androidx.appcompat.content.res.AppCompatResources;
|
||||||
|
import androidx.core.graphics.drawable.DrawableCompat;
|
||||||
|
|
||||||
public abstract class MenuDrawer extends ViewGroup {
|
public abstract class MenuDrawer extends ViewGroup {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -547,6 +550,21 @@ public abstract class MenuDrawer extends ViewGroup {
|
|||||||
initDrawer(context, attrs, defStyle);
|
initDrawer(context, attrs, defStyle);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static Bitmap getBitmapFromVectorDrawable(Context context, int drawableId) {
|
||||||
|
Drawable drawable = AppCompatResources.getDrawable(context, drawableId);
|
||||||
|
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) {
|
||||||
|
drawable = (DrawableCompat.wrap(drawable)).mutate();
|
||||||
|
}
|
||||||
|
|
||||||
|
Bitmap bitmap = Bitmap.createBitmap(drawable.getIntrinsicWidth(),
|
||||||
|
drawable.getIntrinsicHeight(), Bitmap.Config.ARGB_8888);
|
||||||
|
Canvas canvas = new Canvas(bitmap);
|
||||||
|
drawable.setBounds(0, 0, canvas.getWidth(), canvas.getHeight());
|
||||||
|
drawable.draw(canvas);
|
||||||
|
|
||||||
|
return bitmap;
|
||||||
|
}
|
||||||
|
|
||||||
protected void initDrawer(Context context, AttributeSet attrs, int defStyle) {
|
protected void initDrawer(Context context, AttributeSet attrs, int defStyle) {
|
||||||
setWillNotDraw(false);
|
setWillNotDraw(false);
|
||||||
setFocusable(false);
|
setFocusable(false);
|
||||||
@ -561,7 +579,8 @@ public abstract class MenuDrawer extends ViewGroup {
|
|||||||
|
|
||||||
final int indicatorResId = a.getResourceId(R.styleable.MenuDrawer_mdActiveIndicator, 0);
|
final int indicatorResId = a.getResourceId(R.styleable.MenuDrawer_mdActiveIndicator, 0);
|
||||||
if (indicatorResId != 0) {
|
if (indicatorResId != 0) {
|
||||||
mActiveIndicator = BitmapFactory.decodeResource(getResources(), indicatorResId);
|
//mActiveIndicator = BitmapFactory.decodeResource(getResources(), indicatorResId);
|
||||||
|
mActiveIndicator = getBitmapFromVectorDrawable(context, indicatorResId);
|
||||||
}
|
}
|
||||||
|
|
||||||
mDropShadowEnabled = a.getBoolean(R.styleable.MenuDrawer_mdDropShadowEnabled, true);
|
mDropShadowEnabled = a.getBoolean(R.styleable.MenuDrawer_mdDropShadowEnabled, true);
|
||||||
|
@ -131,7 +131,7 @@ public class UltrasonicAppWidgetProvider extends AppWidgetProvider
|
|||||||
{
|
{
|
||||||
views.setTextViewText(R.id.album, null);
|
views.setTextViewText(R.id.album, null);
|
||||||
}
|
}
|
||||||
views.setImageViewResource(R.id.appwidget_coverart, R.drawable.unknown_album_large);
|
views.setImageViewResource(R.id.appwidget_coverart, R.drawable.unknown_album);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -162,7 +162,7 @@ public class UltrasonicAppWidgetProvider extends AppWidgetProvider
|
|||||||
if (bitmap == null)
|
if (bitmap == null)
|
||||||
{
|
{
|
||||||
// Set default cover art
|
// Set default cover art
|
||||||
views.setImageViewResource(R.id.appwidget_coverart, R.drawable.unknown_album_large);
|
views.setImageViewResource(R.id.appwidget_coverart, R.drawable.unknown_album);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -172,7 +172,7 @@ public class UltrasonicAppWidgetProvider extends AppWidgetProvider
|
|||||||
catch (Exception x)
|
catch (Exception x)
|
||||||
{
|
{
|
||||||
Log.e(TAG, "Failed to load cover art", x);
|
Log.e(TAG, "Failed to load cover art", x);
|
||||||
views.setImageViewResource(R.id.appwidget_coverart, R.drawable.unknown_album_large);
|
views.setImageViewResource(R.id.appwidget_coverart, R.drawable.unknown_album);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Link actions buttons to intents
|
// Link actions buttons to intents
|
||||||
|
@ -120,7 +120,7 @@ public class LegacyImageLoader implements Runnable, ImageLoader {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void createLargeUnknownImage(Context context) {
|
private void createLargeUnknownImage(Context context) {
|
||||||
BitmapDrawable drawable = (BitmapDrawable) context.getResources().getDrawable(R.drawable.unknown_album_large);
|
BitmapDrawable drawable = (BitmapDrawable) context.getResources().getDrawable(R.drawable.unknown_album);
|
||||||
Log.i(TAG, "createLargeUnknownImage");
|
Log.i(TAG, "createLargeUnknownImage");
|
||||||
|
|
||||||
if (drawable != null) {
|
if (drawable != null) {
|
||||||
|
@ -61,7 +61,7 @@ public class SongView extends UpdateView implements Checkable
|
|||||||
private static final String TAG = SongView.class.getSimpleName();
|
private static final String TAG = SongView.class.getSimpleName();
|
||||||
private static Drawable starHollowDrawable;
|
private static Drawable starHollowDrawable;
|
||||||
private static Drawable starDrawable;
|
private static Drawable starDrawable;
|
||||||
private static Drawable unpinImage;
|
private static Drawable pinImage;
|
||||||
private static Drawable downloadedImage;
|
private static Drawable downloadedImage;
|
||||||
private static Drawable downloadingImage;
|
private static Drawable downloadingImage;
|
||||||
private static Drawable playingImage;
|
private static Drawable playingImage;
|
||||||
@ -108,9 +108,9 @@ public class SongView extends UpdateView implements Checkable
|
|||||||
starDrawable = Util.getDrawableFromAttribute(context, R.attr.star_full);
|
starDrawable = Util.getDrawableFromAttribute(context, R.attr.star_full);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (unpinImage == null || !themesMatch)
|
if (pinImage == null || !themesMatch)
|
||||||
{
|
{
|
||||||
unpinImage = Util.getDrawableFromAttribute(context, R.attr.unpin);
|
pinImage = Util.getDrawableFromAttribute(context, R.attr.pin);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (downloadedImage == null || !themesMatch)
|
if (downloadedImage == null || !themesMatch)
|
||||||
@ -323,11 +323,11 @@ public class SongView extends UpdateView implements Checkable
|
|||||||
|
|
||||||
if (downloadFile.isWorkDone())
|
if (downloadFile.isWorkDone())
|
||||||
{
|
{
|
||||||
ImageType newLeftImageType = downloadFile.isSaved() ? ImageType.unpin : ImageType.downloaded;
|
ImageType newLeftImageType = downloadFile.isSaved() ? ImageType.pin : ImageType.downloaded;
|
||||||
|
|
||||||
if (this.leftImageType != newLeftImageType)
|
if (this.leftImageType != newLeftImageType)
|
||||||
{
|
{
|
||||||
this.leftImage = downloadFile.isSaved() ? unpinImage : downloadedImage;
|
this.leftImage = downloadFile.isSaved() ? pinImage : downloadedImage;
|
||||||
this.leftImageType = newLeftImageType;
|
this.leftImageType = newLeftImageType;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -378,6 +378,7 @@ public class SongView extends UpdateView implements Checkable
|
|||||||
{
|
{
|
||||||
AnimationDrawable frameAnimation = (AnimationDrawable) rightImage;
|
AnimationDrawable frameAnimation = (AnimationDrawable) rightImage;
|
||||||
frameAnimation.setVisible(true, true);
|
frameAnimation.setVisible(true, true);
|
||||||
|
frameAnimation.start();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -469,7 +470,7 @@ public class SongView extends UpdateView implements Checkable
|
|||||||
public enum ImageType
|
public enum ImageType
|
||||||
{
|
{
|
||||||
none,
|
none,
|
||||||
unpin,
|
pin,
|
||||||
downloaded,
|
downloaded,
|
||||||
downloading
|
downloading
|
||||||
}
|
}
|
||||||
|
@ -96,7 +96,7 @@ internal class ServerRowAdapter(
|
|||||||
serverMenu?.visibility = View.INVISIBLE
|
serverMenu?.visibility = View.INVISIBLE
|
||||||
image?.setImageDrawable(Util.getDrawableFromAttribute(context, R.attr.screen_on_off))
|
image?.setImageDrawable(Util.getDrawableFromAttribute(context, R.attr.screen_on_off))
|
||||||
} else {
|
} else {
|
||||||
image?.setImageDrawable(Util.getDrawableFromAttribute(context, R.attr.podcasts))
|
image?.setImageDrawable(Util.getDrawableFromAttribute(context, R.attr.server))
|
||||||
}
|
}
|
||||||
|
|
||||||
// Highlight the Active Server's row by changing its background
|
// Highlight the Active Server's row by changing its background
|
||||||
|
Before Width: | Height: | Size: 898 B |
Before Width: | Height: | Size: 408 B |
Before Width: | Height: | Size: 498 B |
Before Width: | Height: | Size: 256 B |
Before Width: | Height: | Size: 260 B |
Before Width: | Height: | Size: 2.4 KiB |
Before Width: | Height: | Size: 2.5 KiB |
Before Width: | Height: | Size: 2.3 KiB |
Before Width: | Height: | Size: 2.3 KiB |
Before Width: | Height: | Size: 1.6 KiB |
Before Width: | Height: | Size: 2.3 KiB |
Before Width: | Height: | Size: 2.0 KiB |
Before Width: | Height: | Size: 107 B |
Before Width: | Height: | Size: 1.9 KiB |
Before Width: | Height: | Size: 1.8 KiB |
Before Width: | Height: | Size: 725 B |
Before Width: | Height: | Size: 698 B |
Before Width: | Height: | Size: 637 B |
Before Width: | Height: | Size: 609 B |
Before Width: | Height: | Size: 346 B |
Before Width: | Height: | Size: 340 B |
Before Width: | Height: | Size: 710 B |
Before Width: | Height: | Size: 687 B |
Before Width: | Height: | Size: 592 B |
Before Width: | Height: | Size: 554 B |
Before Width: | Height: | Size: 428 B |
Before Width: | Height: | Size: 417 B |
Before Width: | Height: | Size: 488 B |
Before Width: | Height: | Size: 473 B |
Before Width: | Height: | Size: 363 B |
Before Width: | Height: | Size: 368 B |
Before Width: | Height: | Size: 347 B |
Before Width: | Height: | Size: 341 B |
Before Width: | Height: | Size: 661 B |
Before Width: | Height: | Size: 625 B |
Before Width: | Height: | Size: 952 B |
Before Width: | Height: | Size: 937 B |
Before Width: | Height: | Size: 469 B |
Before Width: | Height: | Size: 455 B |
Before Width: | Height: | Size: 752 B |
Before Width: | Height: | Size: 846 B |
Before Width: | Height: | Size: 498 B |
Before Width: | Height: | Size: 492 B |
Before Width: | Height: | Size: 762 B |
Before Width: | Height: | Size: 719 B |
Before Width: | Height: | Size: 569 B |
Before Width: | Height: | Size: 559 B |
Before Width: | Height: | Size: 501 B |
Before Width: | Height: | Size: 484 B |
Before Width: | Height: | Size: 899 B |
Before Width: | Height: | Size: 857 B |
Before Width: | Height: | Size: 579 B |
Before Width: | Height: | Size: 548 B |
Before Width: | Height: | Size: 516 B |
Before Width: | Height: | Size: 501 B |
Before Width: | Height: | Size: 1.1 KiB |
Before Width: | Height: | Size: 1.0 KiB |
Before Width: | Height: | Size: 627 B |
Before Width: | Height: | Size: 599 B |
Before Width: | Height: | Size: 668 B |
Before Width: | Height: | Size: 648 B |
Before Width: | Height: | Size: 3.0 KiB |
Before Width: | Height: | Size: 2.1 KiB |
Before Width: | Height: | Size: 2.0 KiB |
Before Width: | Height: | Size: 1.9 KiB |
Before Width: | Height: | Size: 814 B |
Before Width: | Height: | Size: 780 B |
Before Width: | Height: | Size: 917 B |
Before Width: | Height: | Size: 888 B |
Before Width: | Height: | Size: 1.2 KiB |
Before Width: | Height: | Size: 1.1 KiB |
Before Width: | Height: | Size: 673 B |
Before Width: | Height: | Size: 2.2 KiB |
Before Width: | Height: | Size: 2.1 KiB |
Before Width: | Height: | Size: 537 B |
Before Width: | Height: | Size: 519 B |
Before Width: | Height: | Size: 542 B |
Before Width: | Height: | Size: 516 B |
Before Width: | Height: | Size: 305 B |
Before Width: | Height: | Size: 302 B |
Before Width: | Height: | Size: 886 B |
Before Width: | Height: | Size: 791 B |
Before Width: | Height: | Size: 768 B |
Before Width: | Height: | Size: 815 B |
Before Width: | Height: | Size: 772 B |
Before Width: | Height: | Size: 459 B |
Before Width: | Height: | Size: 447 B |
Before Width: | Height: | Size: 258 B |
Before Width: | Height: | Size: 259 B |
Before Width: | Height: | Size: 286 B |
Before Width: | Height: | Size: 283 B |
Before Width: | Height: | Size: 880 B |
Before Width: | Height: | Size: 167 B |
Before Width: | Height: | Size: 1.2 KiB |