Merge pull request 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
core/menudrawer
build.gradle
src/main/java/net/simonvt/menudrawer
ultrasonic/src/main
java/org/moire/ultrasonic
kotlin/org/moire/ultrasonic/activity
res
drawable-hdpi-v14
drawable-hdpi
btn_check_off_focused_holo_dark.pngbtn_check_off_focused_holo_light.pngbtn_check_off_holo_dark.pngbtn_check_off_holo_light.pngbtn_check_on_focused_holo_dark.pngbtn_check_on_focused_holo_light.pngbtn_check_on_holo_dark.pngbtn_check_on_holo_light.pngic_add_white.pngic_create_new_folder_dark.pngic_create_new_folder_light.pngic_drag_queue.pngic_folder_dark.pngic_folder_light.pngic_menu_about_dark.pngic_menu_about_light.pngic_menu_add_to_queue_dark.pngic_menu_add_to_queue_light.pngic_menu_backward_dark.pngic_menu_backward_light.pngic_menu_bookmark_dark.pngic_menu_bookmark_light.pngic_menu_browse_dark.pngic_menu_browse_light.pngic_menu_chat_dark.pngic_menu_chat_light.pngic_menu_chat_send_dark.pngic_menu_chat_send_light.pngic_menu_exit_dark.pngic_menu_exit_light.pngic_menu_forward_dark.pngic_menu_forward_light.pngic_menu_help_dark.pngic_menu_help_light.pngic_menu_home_dark.pngic_menu_home_light.pngic_menu_playlists_dark.pngic_menu_playlists_light.pngic_menu_podcasts_dark.pngic_menu_podcasts_light.pngic_menu_refresh_dark.pngic_menu_refresh_light.pngic_menu_remove_all_dark.pngic_menu_remove_all_light.pngic_menu_save_dark.pngic_menu_save_light.pngic_menu_screen_on_off_dark.pngic_menu_screen_on_off_light.pngic_menu_search_holo_dark.pngic_menu_search_holo_light.pngic_menu_select_all_dark.pngic_menu_select_all_light.pngic_menu_select_folder_dark.pngic_menu_select_folder_light.pngic_menu_settings_dark.pngic_menu_settings_light.pngic_menu_share_dark.pngic_menu_share_light.pngic_menu_unpin_dark.pngic_menu_unpin_light.pngic_more_vert_dark.pngic_more_vert_light.pngic_sd_storage_dark.pngic_sd_storage_light.pngic_star_full_dark.pngic_star_full_light.pngic_star_hollow_dark.pngic_star_hollow_light.pngic_stat_play_dark.pngic_stat_play_light.pngic_stat_ultrasonic.pngic_subdirectory_up_dark.pngic_subdirectory_up_light.pngmedia_backward_normal_dark.pngmedia_backward_normal_light.pngmedia_forward_normal_dark.pngmedia_forward_normal_light.pngmedia_pause_normal_dark.pngmedia_pause_normal_light.pngmedia_repeat_all.pngmedia_repeat_off_dark.pngmedia_repeat_off_light.pngmedia_shuffle_normal_dark.pngmedia_shuffle_normal_light.pngmedia_start_normal_dark.pngmedia_start_normal_light.pngmedia_stop_normal_dark.pngmedia_stop_normal_light.pngmedia_toggle_list_normal_dark.pngmedia_toggle_list_normal_light.pngmenu_arrow.pngprogress_bg_holo_dark.9.pngprogress_primary_holo_dark.9.png

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

Binary file not shown.

Before

(image error) Size: 898 B

Binary file not shown.

Before

(image error) Size: 408 B

Binary file not shown.

Before

(image error) Size: 498 B

Binary file not shown.

Before

(image error) Size: 256 B

Binary file not shown.

Before

(image error) Size: 260 B

Binary file not shown.

Before

(image error) Size: 2.4 KiB

Binary file not shown.

Before

(image error) Size: 2.5 KiB

Binary file not shown.

Before

(image error) Size: 2.3 KiB

Binary file not shown.

Before

(image error) Size: 2.3 KiB

Binary file not shown.

Before

(image error) Size: 1.6 KiB

Binary file not shown.

Before

(image error) Size: 2.3 KiB

Binary file not shown.

Before

(image error) Size: 2.0 KiB

Binary file not shown.

Before

(image error) Size: 107 B

Binary file not shown.

Before

(image error) Size: 1.9 KiB

Binary file not shown.

Before

(image error) Size: 1.8 KiB

Binary file not shown.

Before

(image error) Size: 725 B

Binary file not shown.

Before

(image error) Size: 698 B

Binary file not shown.

Before

(image error) Size: 637 B

Binary file not shown.

Before

(image error) Size: 609 B

Binary file not shown.

Before

(image error) Size: 346 B

Binary file not shown.

Before

(image error) Size: 340 B

Binary file not shown.

Before

(image error) Size: 710 B

Binary file not shown.

Before

(image error) Size: 687 B

Binary file not shown.

Before

(image error) Size: 592 B

Binary file not shown.

Before

(image error) Size: 554 B

Binary file not shown.

Before

(image error) Size: 428 B

Binary file not shown.

Before

(image error) Size: 417 B

Binary file not shown.

Before

(image error) Size: 488 B

Binary file not shown.

Before

(image error) Size: 473 B

Binary file not shown.

Before

(image error) Size: 363 B

Binary file not shown.

Before

(image error) Size: 368 B

Binary file not shown.

Before

(image error) Size: 347 B

Binary file not shown.

Before

(image error) Size: 341 B

Binary file not shown.

Before

(image error) Size: 661 B

Binary file not shown.

Before

(image error) Size: 625 B

Binary file not shown.

Before

(image error) Size: 952 B

Binary file not shown.

Before

(image error) Size: 937 B

Binary file not shown.

Before

(image error) Size: 469 B

Binary file not shown.

Before

(image error) Size: 455 B

Binary file not shown.

Before

(image error) Size: 752 B

Binary file not shown.

Before

(image error) Size: 846 B

Binary file not shown.

Before

(image error) Size: 498 B

Binary file not shown.

Before

(image error) Size: 492 B

Binary file not shown.

Before

(image error) Size: 762 B

Binary file not shown.

Before

(image error) Size: 719 B

Binary file not shown.

Before

(image error) Size: 569 B

Binary file not shown.

Before

(image error) Size: 559 B

Binary file not shown.

Before

(image error) Size: 501 B

Binary file not shown.

Before

(image error) Size: 484 B

Binary file not shown.

Before

(image error) Size: 899 B

Binary file not shown.

Before

(image error) Size: 857 B

Binary file not shown.

Before

(image error) Size: 579 B

Binary file not shown.

Before

(image error) Size: 548 B

Binary file not shown.

Before

(image error) Size: 516 B

Binary file not shown.

Before

(image error) Size: 501 B

Binary file not shown.

Before

(image error) Size: 1.1 KiB

Binary file not shown.

Before

(image error) Size: 1.0 KiB

Binary file not shown.

Before

(image error) Size: 627 B

Binary file not shown.

Before

(image error) Size: 599 B

Binary file not shown.

Before

(image error) Size: 668 B

Binary file not shown.

Before

(image error) Size: 648 B

Binary file not shown.

Before

(image error) Size: 3.0 KiB

Binary file not shown.

Before

(image error) Size: 2.1 KiB

Binary file not shown.

Before

(image error) Size: 2.0 KiB

Binary file not shown.

Before

(image error) Size: 1.9 KiB

Binary file not shown.

Before

(image error) Size: 814 B

Binary file not shown.

Before

(image error) Size: 780 B

Binary file not shown.

Before

(image error) Size: 917 B

Binary file not shown.

Before

(image error) Size: 888 B

Binary file not shown.

Before

(image error) Size: 1.2 KiB

Binary file not shown.

Before

(image error) Size: 1.1 KiB

Binary file not shown.

Before

(image error) Size: 673 B

Binary file not shown.

Before

(image error) Size: 2.2 KiB

Binary file not shown.

Before

(image error) Size: 2.1 KiB

Binary file not shown.

Before

(image error) Size: 537 B

Binary file not shown.

Before

(image error) Size: 519 B

Binary file not shown.

Before

(image error) Size: 542 B

Binary file not shown.

Before

(image error) Size: 516 B

Binary file not shown.

Before

(image error) Size: 305 B

Binary file not shown.

Before

(image error) Size: 302 B

Binary file not shown.

Before

(image error) Size: 886 B

Binary file not shown.

Before

(image error) Size: 791 B

Binary file not shown.

Before

(image error) Size: 768 B

Binary file not shown.

Before

(image error) Size: 815 B

Binary file not shown.

Before

(image error) Size: 772 B

Binary file not shown.

Before

(image error) Size: 459 B

Binary file not shown.

Before

(image error) Size: 447 B

Binary file not shown.

Before

(image error) Size: 258 B

Binary file not shown.

Before

(image error) Size: 259 B

Binary file not shown.

Before

(image error) Size: 286 B

Binary file not shown.

Before

(image error) Size: 283 B

Binary file not shown.

Before

(image error) Size: 880 B

Binary file not shown.

Before

(image error) Size: 167 B

Binary file not shown.

Before

(image error) Size: 1.2 KiB

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