1
0
mirror of https://github.com/ultrasonic/ultrasonic synced 2025-02-08 07:48:53 +01:00

Merge pull request #312 from ultrasonic/vector

Vector
This commit is contained in:
Óscar García Amor 2020-09-25 18:33:28 +02:00 committed by GitHub
commit 2a7ea19a0f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
661 changed files with 1248 additions and 159 deletions

View File

@ -6,3 +6,7 @@ android {
abortOnError true abortOnError true
} }
} }
dependencies {
implementation "androidx.appcompat:appcompat-resources:1.2.0"
}

View File

@ -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);

View File

@ -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

View File

@ -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) {

View File

@ -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
} }

View File

@ -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

Binary file not shown.

Before

Width:  |  Height:  |  Size: 898 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 408 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 498 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 256 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 260 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 107 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 725 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 698 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 637 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 609 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 346 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 340 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 710 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 687 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 592 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 554 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 428 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 417 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 488 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 473 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 363 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 368 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 347 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 341 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 661 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 625 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 952 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 937 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 469 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 455 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 752 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 846 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 498 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 492 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 762 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 719 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 569 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 559 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 501 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 484 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 899 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 857 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 579 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 548 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 516 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 501 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 627 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 599 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 668 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 648 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 814 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 780 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 917 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 888 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 673 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 537 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 519 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 542 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 516 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 305 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 302 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 886 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 791 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 768 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 815 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 772 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 459 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 447 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 258 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 259 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 286 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 283 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 880 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 167 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

Some files were not shown because too many files have changed in this diff Show More