From 19d30f247ec785c8202e1802631a7231c32c4389 Mon Sep 17 00:00:00 2001 From: h4h13 Date: Fri, 15 Nov 2019 23:38:57 +0530 Subject: [PATCH] Added splash screen --- app/src/main/AndroidManifest.xml | 3 +- .../retromusic/appwidgets/AppWidgetBig.kt | 290 +++++++++------- .../retromusic/appwidgets/AppWidgetCard.kt | 323 +++++++++++------- .../retromusic/appwidgets/AppWidgetClassic.kt | 285 +++++++++------- .../retromusic/appwidgets/AppWidgetSmall.kt | 296 +++++++++------- .../retromusic/appwidgets/AppWidgetText.kt | 196 +++++++---- .../retromusic/appwidgets/BootReceiver.kt | 45 ++- app/src/main/res/drawable/retro.png | Bin 0 -> 9643 bytes app/src/main/res/drawable/splash.xml | 25 ++ app/src/main/res/values/styles.xml | 5 + 10 files changed, 896 insertions(+), 572 deletions(-) create mode 100644 app/src/main/res/drawable/retro.png create mode 100644 app/src/main/res/drawable/splash.xml diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 55965140..5b8b416b 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -27,7 +27,8 @@ tools:ignore="AllowBackup,GoogleAppIndexingWarning"> + android:label="@string/app_name" + android:theme="@style/SplashTheme"> diff --git a/app/src/main/java/code/name/monkey/retromusic/appwidgets/AppWidgetBig.kt b/app/src/main/java/code/name/monkey/retromusic/appwidgets/AppWidgetBig.kt index a719ccc5..f7e51128 100644 --- a/app/src/main/java/code/name/monkey/retromusic/appwidgets/AppWidgetBig.kt +++ b/app/src/main/java/code/name/monkey/retromusic/appwidgets/AppWidgetBig.kt @@ -15,9 +15,7 @@ package code.name.monkey.retromusic.appwidgets import android.app.PendingIntent -import android.content.ComponentName -import android.content.Context -import android.content.Intent +import android.content.* import android.graphics.Bitmap import android.graphics.drawable.Drawable import android.text.TextUtils @@ -33,147 +31,201 @@ import code.name.monkey.retromusic.service.MusicService.* import code.name.monkey.retromusic.util.RetroUtil import com.bumptech.glide.Glide import com.bumptech.glide.request.animation.GlideAnimation -import com.bumptech.glide.request.target.SimpleTarget +import com.bumptech.glide.request.target.* import com.bumptech.glide.request.target.Target - class AppWidgetBig : BaseAppWidget() { - private var target: Target? = null // for cancellation + private var target: Target? = null // for cancellation - /** - * Initialize given widgets to default state, where we launch Music on default click and hide - * actions if service not running. - */ - override fun defaultAppWidget(context: Context, appWidgetIds: IntArray) { - val appWidgetView = RemoteViews(context.packageName, - code.name.monkey.retromusic.R.layout.app_widget_big) + /** + * Initialize given widgets to default state, where we launch Music on default click and hide + * actions if service not running. + */ + override fun defaultAppWidget(context: Context, appWidgetIds: IntArray) { + val appWidgetView = RemoteViews( + context.packageName, code.name.monkey.retromusic.R.layout.app_widget_big + ) - appWidgetView.setViewVisibility(code.name.monkey.retromusic.R.id.media_titles, View.INVISIBLE) - appWidgetView.setImageViewResource(R.id.image, R.drawable.default_album_art) - appWidgetView.setImageViewBitmap(R.id.button_next, BaseAppWidget.createBitmap( - RetroUtil.getTintedVectorDrawable(context, code.name.monkey.retromusic.R.drawable.ic_skip_next_white_24dp, - MaterialValueHelper.getPrimaryTextColor(context, false))!!, 1f)) - appWidgetView.setImageViewBitmap(R.id.button_prev, BaseAppWidget.Companion.createBitmap( - RetroUtil.getTintedVectorDrawable(context, code.name.monkey.retromusic.R.drawable.ic_skip_previous_white_24dp, - MaterialValueHelper.getPrimaryTextColor(context, false))!!, 1f)) - appWidgetView.setImageViewBitmap(R.id.button_toggle_play_pause, BaseAppWidget.Companion.createBitmap( - RetroUtil.getTintedVectorDrawable(context, code.name.monkey.retromusic.R.drawable.ic_play_arrow_white_32dp, - MaterialValueHelper.getPrimaryTextColor(context, false))!!, 1f)) + appWidgetView.setViewVisibility( + code.name.monkey.retromusic.R.id.media_titles, + View.INVISIBLE + ) + appWidgetView.setImageViewResource(R.id.image, R.drawable.default_album_art) + appWidgetView.setImageViewBitmap( + R.id.button_next, BaseAppWidget.createBitmap( + RetroUtil.getTintedVectorDrawable( + context, + code.name.monkey.retromusic.R.drawable.ic_skip_next_white_24dp, + MaterialValueHelper.getPrimaryTextColor(context, false) + )!!, 1f + ) + ) + appWidgetView.setImageViewBitmap( + R.id.button_prev, BaseAppWidget.Companion.createBitmap( + RetroUtil.getTintedVectorDrawable( + context, + code.name.monkey.retromusic.R.drawable.ic_skip_previous_white_24dp, + MaterialValueHelper.getPrimaryTextColor(context, false) + )!!, 1f + ) + ) + appWidgetView.setImageViewBitmap( + R.id.button_toggle_play_pause, BaseAppWidget.Companion.createBitmap( + RetroUtil.getTintedVectorDrawable( + context, + code.name.monkey.retromusic.R.drawable.ic_play_arrow_white_32dp, + MaterialValueHelper.getPrimaryTextColor(context, false) + )!!, 1f + ) + ) - linkButtons(context, appWidgetView) - pushUpdate(context, appWidgetIds, appWidgetView) - } + linkButtons(context, appWidgetView) + pushUpdate(context, appWidgetIds, appWidgetView) + } - /** - * Update all active widget instances by pushing changes - */ - override fun performUpdate(service: MusicService, appWidgetIds: IntArray?) { - val appWidgetView = RemoteViews(service.packageName, - code.name.monkey.retromusic.R.layout.app_widget_big) + /** + * Update all active widget instances by pushing changes + */ + override fun performUpdate(service: MusicService, appWidgetIds: IntArray?) { + val appWidgetView = RemoteViews( + service.packageName, code.name.monkey.retromusic.R.layout.app_widget_big + ) - val isPlaying = service.isPlaying - val song = service.currentSong + val isPlaying = service.isPlaying + val song = service.currentSong - // Set the titles and artwork - if (TextUtils.isEmpty(song.title) && TextUtils.isEmpty(song.artistName)) { - appWidgetView.setViewVisibility(code.name.monkey.retromusic.R.id.media_titles, View.INVISIBLE) - } else { - appWidgetView.setViewVisibility(code.name.monkey.retromusic.R.id.media_titles, View.VISIBLE) - appWidgetView.setTextViewText(code.name.monkey.retromusic.R.id.title, song.title) - appWidgetView.setTextViewText(code.name.monkey.retromusic.R.id.text, getSongArtistAndAlbum(song)) - } + // Set the titles and artwork + if (TextUtils.isEmpty(song.title) && TextUtils.isEmpty(song.artistName)) { + appWidgetView.setViewVisibility( + code.name.monkey.retromusic.R.id.media_titles, + View.INVISIBLE + ) + } else { + appWidgetView.setViewVisibility( + code.name.monkey.retromusic.R.id.media_titles, + View.VISIBLE + ) + appWidgetView.setTextViewText(code.name.monkey.retromusic.R.id.title, song.title) + appWidgetView.setTextViewText( + code.name.monkey.retromusic.R.id.text, + getSongArtistAndAlbum(song) + ) + } - // Set correct drawable for pause state - val playPauseRes = if (isPlaying) code.name.monkey.retromusic.R.drawable.ic_pause_white_24dp else code.name.monkey.retromusic.R.drawable.ic_play_arrow_white_32dp - appWidgetView.setImageViewBitmap(R.id.button_toggle_play_pause, BaseAppWidget.createBitmap( - RetroUtil.getTintedVectorDrawable(service, playPauseRes, - MaterialValueHelper.getPrimaryTextColor(service, false))!!, 1f)) + // Set correct drawable for pause state + val playPauseRes = if (isPlaying) code.name.monkey.retromusic.R.drawable.ic_pause_white_24dp else code.name.monkey.retromusic.R.drawable.ic_play_arrow_white_32dp + appWidgetView.setImageViewBitmap( + R.id.button_toggle_play_pause, BaseAppWidget.createBitmap( + RetroUtil.getTintedVectorDrawable( + service, + playPauseRes, + MaterialValueHelper.getPrimaryTextColor(service, false) + )!!, 1f + ) + ) - // Set prev/next button drawables - appWidgetView.setImageViewBitmap(R.id.button_next, BaseAppWidget.Companion.createBitmap( - RetroUtil.getTintedVectorDrawable(service, code.name.monkey.retromusic.R.drawable.ic_skip_next_white_24dp, - MaterialValueHelper.getPrimaryTextColor(service, false))!!, 1f)) - appWidgetView.setImageViewBitmap(R.id.button_prev, BaseAppWidget.Companion.createBitmap( - RetroUtil.getTintedVectorDrawable(service, code.name.monkey.retromusic.R.drawable.ic_skip_previous_white_24dp, - MaterialValueHelper.getPrimaryTextColor(service, false))!!, 1f)) + // Set prev/next button drawables + appWidgetView.setImageViewBitmap( + R.id.button_next, BaseAppWidget.Companion.createBitmap( + RetroUtil.getTintedVectorDrawable( + service, + code.name.monkey.retromusic.R.drawable.ic_skip_next_white_24dp, + MaterialValueHelper.getPrimaryTextColor(service, false) + )!!, 1f + ) + ) + appWidgetView.setImageViewBitmap( + R.id.button_prev, BaseAppWidget.Companion.createBitmap( + RetroUtil.getTintedVectorDrawable( + service, + code.name.monkey.retromusic.R.drawable.ic_skip_previous_white_24dp, + MaterialValueHelper.getPrimaryTextColor(service, false) + )!!, 1f + ) + ) - // Link actions buttons to intents - linkButtons(service, appWidgetView) + // Link actions buttons to intents + linkButtons(service, appWidgetView) - // Load the album cover async and push the update on completion - val p = RetroUtil.getScreenSize(service) - val widgetImageSize = Math.min(p.x, p.y) - val appContext = service.applicationContext - service.runOnUiThread { - if (target != null) { - Glide.clear(target) - } - target = SongGlideRequest.Builder.from(Glide.with(appContext), song) - .checkIgnoreMediaStore(appContext) - .asBitmap().build() - .into(object : SimpleTarget(widgetImageSize, widgetImageSize) { - override fun onResourceReady(resource: Bitmap, glideAnimation: GlideAnimation) { - update(resource) - } + // Load the album cover async and push the update on completion + val p = RetroUtil.getScreenSize(service) + val widgetImageSize = Math.min(p.x, p.y) + val appContext = service.applicationContext + service.runOnUiThread { + if (target != null) { + Glide.clear(target) + } + target = SongGlideRequest.Builder.from(Glide.with(appContext), song) + .checkIgnoreMediaStore(appContext).asBitmap().build() + .into(object : SimpleTarget(widgetImageSize, widgetImageSize) { + override fun onResourceReady( + resource: Bitmap, + glideAnimation: GlideAnimation + ) { + update(resource) + } - override fun onLoadFailed(e: Exception?, errorDrawable: Drawable?) { - super.onLoadFailed(e, errorDrawable) - update(null) - } + override fun onLoadFailed(e: Exception?, errorDrawable: Drawable?) { + super.onLoadFailed(e, errorDrawable) + update(null) + } - private fun update(bitmap: Bitmap?) { - if (bitmap == null) { - appWidgetView.setImageViewResource(R.id.image, R.drawable.default_album_art) - } else { - appWidgetView.setImageViewBitmap(R.id.image, bitmap) - } - pushUpdate(appContext, appWidgetIds, appWidgetView) - } - }); - } - } + private fun update(bitmap: Bitmap?) { + if (bitmap == null) { + appWidgetView.setImageViewResource( + R.id.image, + R.drawable.default_album_art + ) + } else { + appWidgetView.setImageViewBitmap(R.id.image, bitmap) + } + pushUpdate(appContext, appWidgetIds, appWidgetView) + } + }); + } + } - /** - * Link up various button actions using [PendingIntent]. - */ - private fun linkButtons(context: Context, views: RemoteViews) { - val action = Intent(context, MainActivity::class.java).putExtra("expand", true) - var pendingIntent: PendingIntent + /** + * Link up various button actions using [PendingIntent]. + */ + private fun linkButtons(context: Context, views: RemoteViews) { + val action = Intent(context, MainActivity::class.java).putExtra("expand", true) + var pendingIntent: PendingIntent - val serviceName = ComponentName(context, MusicService::class.java) + val serviceName = ComponentName(context, MusicService::class.java) - // Home - action.flags = Intent.FLAG_ACTIVITY_NEW_TASK or Intent.FLAG_ACTIVITY_CLEAR_TOP - pendingIntent = PendingIntent.getActivity(context, 0, action, 0) - views.setOnClickPendingIntent(R.id.clickable_area, pendingIntent) + // Home + action.flags = Intent.FLAG_ACTIVITY_NEW_TASK or Intent.FLAG_ACTIVITY_CLEAR_TOP + pendingIntent = PendingIntent.getActivity(context, 0, action, 0) + views.setOnClickPendingIntent(R.id.clickable_area, pendingIntent) - // Previous track - pendingIntent = buildPendingIntent(context, ACTION_REWIND, serviceName) - views.setOnClickPendingIntent(R.id.button_prev, pendingIntent) + // Previous track + pendingIntent = buildPendingIntent(context, ACTION_REWIND, serviceName) + views.setOnClickPendingIntent(R.id.button_prev, pendingIntent) - // Play and pause - pendingIntent = buildPendingIntent(context, ACTION_TOGGLE_PAUSE, serviceName) - views.setOnClickPendingIntent(R.id.button_toggle_play_pause, pendingIntent) + // Play and pause + pendingIntent = buildPendingIntent(context, ACTION_TOGGLE_PAUSE, serviceName) + views.setOnClickPendingIntent(R.id.button_toggle_play_pause, pendingIntent) - // Next track - pendingIntent = buildPendingIntent(context, ACTION_SKIP, serviceName) - views.setOnClickPendingIntent(R.id.button_next, pendingIntent) + // Next track + pendingIntent = buildPendingIntent(context, ACTION_SKIP, serviceName) + views.setOnClickPendingIntent(R.id.button_next, pendingIntent) - } + } - companion object { + companion object { - const val NAME: String = "app_widget_big" - private var mInstance: AppWidgetBig? = null + const val NAME: String = "app_widget_big" + private var mInstance: AppWidgetBig? = null - val instance: AppWidgetBig - @Synchronized get() { - if (mInstance == null) { - mInstance = AppWidgetBig() - } - return mInstance!! - } + val instance: AppWidgetBig + @Synchronized get() { + if (mInstance == null) { + mInstance = AppWidgetBig() + } + return mInstance!! + } - } + } } diff --git a/app/src/main/java/code/name/monkey/retromusic/appwidgets/AppWidgetCard.kt b/app/src/main/java/code/name/monkey/retromusic/appwidgets/AppWidgetCard.kt index 79f92cc5..bf72379d 100644 --- a/app/src/main/java/code/name/monkey/retromusic/appwidgets/AppWidgetCard.kt +++ b/app/src/main/java/code/name/monkey/retromusic/appwidgets/AppWidgetCard.kt @@ -15,9 +15,7 @@ package code.name.monkey.retromusic.appwidgets import android.app.PendingIntent -import android.content.ComponentName -import android.content.Context -import android.content.Intent +import android.content.* import android.graphics.Bitmap import android.graphics.drawable.Drawable import android.text.TextUtils @@ -31,156 +29,231 @@ import code.name.monkey.retromusic.glide.SongGlideRequest import code.name.monkey.retromusic.glide.palette.BitmapPaletteWrapper import code.name.monkey.retromusic.service.MusicService import code.name.monkey.retromusic.service.MusicService.* -import code.name.monkey.retromusic.util.ImageUtil -import code.name.monkey.retromusic.util.RetroUtil +import code.name.monkey.retromusic.util.* import com.bumptech.glide.Glide import com.bumptech.glide.request.animation.GlideAnimation -import com.bumptech.glide.request.target.SimpleTarget +import com.bumptech.glide.request.target.* import com.bumptech.glide.request.target.Target - class AppWidgetCard : BaseAppWidget() { - private var target: Target? = null // for cancellation + private var target: Target? = null // for cancellation - /** - * Initialize given widgets to default state, where we launch Music on default click and hide - * actions if service not running. - */ - override fun defaultAppWidget(context: Context, appWidgetIds: IntArray) { - val appWidgetView = RemoteViews(context.packageName, R.layout.app_widget_card) + /** + * Initialize given widgets to default state, where we launch Music on default click and hide + * actions if service not running. + */ + override fun defaultAppWidget(context: Context, appWidgetIds: IntArray) { + val appWidgetView = RemoteViews(context.packageName, R.layout.app_widget_card) - appWidgetView.setViewVisibility(R.id.media_titles, View.INVISIBLE) - appWidgetView.setImageViewResource(R.id.image, R.drawable.default_album_art) - appWidgetView.setImageViewBitmap(R.id.button_next, createBitmap(RetroUtil.getTintedVectorDrawable(context, R.drawable.ic_skip_next_white_24dp, MaterialValueHelper.getSecondaryTextColor(context, true))!!, 1f)) - appWidgetView.setImageViewBitmap(R.id.button_prev, createBitmap(RetroUtil.getTintedVectorDrawable(context, R.drawable.ic_skip_previous_white_24dp, MaterialValueHelper.getSecondaryTextColor(context, true))!!, 1f)) - appWidgetView.setImageViewBitmap(R.id.button_toggle_play_pause, createBitmap(RetroUtil.getTintedVectorDrawable(context, R.drawable.ic_play_arrow_white_32dp, MaterialValueHelper.getSecondaryTextColor(context, true))!!, 1f)) + appWidgetView.setViewVisibility(R.id.media_titles, View.INVISIBLE) + appWidgetView.setImageViewResource(R.id.image, R.drawable.default_album_art) + appWidgetView.setImageViewBitmap( + R.id.button_next, createBitmap( + RetroUtil.getTintedVectorDrawable( + context, + R.drawable.ic_skip_next_white_24dp, + MaterialValueHelper.getSecondaryTextColor( + context, true + ) + )!!, 1f + ) + ) + appWidgetView.setImageViewBitmap( + R.id.button_prev, createBitmap( + RetroUtil.getTintedVectorDrawable( + context, + R.drawable.ic_skip_previous_white_24dp, + MaterialValueHelper.getSecondaryTextColor( + context, true + ) + )!!, 1f + ) + ) + appWidgetView.setImageViewBitmap( + R.id.button_toggle_play_pause, createBitmap( + RetroUtil.getTintedVectorDrawable( + context, + R.drawable.ic_play_arrow_white_32dp, + MaterialValueHelper.getSecondaryTextColor( + context, true + ) + )!!, 1f + ) + ) - linkButtons(context, appWidgetView) - pushUpdate(context, appWidgetIds, appWidgetView) - } + linkButtons(context, appWidgetView) + pushUpdate(context, appWidgetIds, appWidgetView) + } - /** - * Update all active widget instances by pushing changes - */ - override fun performUpdate(service: MusicService, appWidgetIds: IntArray?) { - val appWidgetView = RemoteViews(service.packageName, R.layout.app_widget_card) + /** + * Update all active widget instances by pushing changes + */ + override fun performUpdate(service: MusicService, appWidgetIds: IntArray?) { + val appWidgetView = RemoteViews(service.packageName, R.layout.app_widget_card) - val isPlaying = service.isPlaying - val song = service.currentSong + val isPlaying = service.isPlaying + val song = service.currentSong - // Set the titles and artwork - if (TextUtils.isEmpty(song.title) && TextUtils.isEmpty(song.artistName)) { - appWidgetView.setViewVisibility(R.id.media_titles, View.INVISIBLE) - } else { - appWidgetView.setViewVisibility(R.id.media_titles, View.VISIBLE) - appWidgetView.setTextViewText(R.id.title, song.title) - appWidgetView.setTextViewText(R.id.text, getSongArtistAndAlbum(song)) - } + // Set the titles and artwork + if (TextUtils.isEmpty(song.title) && TextUtils.isEmpty(song.artistName)) { + appWidgetView.setViewVisibility(R.id.media_titles, View.INVISIBLE) + } else { + appWidgetView.setViewVisibility(R.id.media_titles, View.VISIBLE) + appWidgetView.setTextViewText(R.id.title, song.title) + appWidgetView.setTextViewText(R.id.text, getSongArtistAndAlbum(song)) + } - // Set correct drawable for pause state - val playPauseRes = if (isPlaying) R.drawable.ic_pause_white_24dp else R.drawable.ic_play_arrow_white_32dp - appWidgetView.setImageViewBitmap(R.id.button_toggle_play_pause, createBitmap( - RetroUtil.getTintedVectorDrawable(service, playPauseRes, - MaterialValueHelper.getSecondaryTextColor(service, true))!!, 1f)) + // Set correct drawable for pause state + val playPauseRes = if (isPlaying) R.drawable.ic_pause_white_24dp else R.drawable.ic_play_arrow_white_32dp + appWidgetView.setImageViewBitmap( + R.id.button_toggle_play_pause, createBitmap( + RetroUtil.getTintedVectorDrawable( + service, + playPauseRes, + MaterialValueHelper.getSecondaryTextColor(service, true) + )!!, 1f + ) + ) - // Set prev/next button drawables - appWidgetView.setImageViewBitmap(R.id.button_next, createBitmap( - RetroUtil.getTintedVectorDrawable(service, R.drawable.ic_skip_next_white_24dp, - MaterialValueHelper.getSecondaryTextColor(service, true))!!, 1f)) - appWidgetView.setImageViewBitmap(R.id.button_prev, createBitmap( - RetroUtil.getTintedVectorDrawable(service, R.drawable.ic_skip_previous_white_24dp, - MaterialValueHelper.getSecondaryTextColor(service, true))!!, 1f)) + // Set prev/next button drawables + appWidgetView.setImageViewBitmap( + R.id.button_next, createBitmap( + RetroUtil.getTintedVectorDrawable( + service, + R.drawable.ic_skip_next_white_24dp, + MaterialValueHelper.getSecondaryTextColor(service, true) + )!!, 1f + ) + ) + appWidgetView.setImageViewBitmap( + R.id.button_prev, createBitmap( + RetroUtil.getTintedVectorDrawable( + service, + R.drawable.ic_skip_previous_white_24dp, + MaterialValueHelper.getSecondaryTextColor(service, true) + )!!, 1f + ) + ) - // Link actions buttons to intents - linkButtons(service, appWidgetView) + // Link actions buttons to intents + linkButtons(service, appWidgetView) - if (imageSize == 0) { - imageSize = service.resources.getDimensionPixelSize(code.name.monkey.retromusic.R.dimen.app_widget_card_image_size) - } - if (cardRadius == 0f) { - cardRadius = service.resources.getDimension(code.name.monkey.retromusic.R.dimen.app_widget_card_radius) - } - val appContext = service.applicationContext - // Load the album cover async and push the update on completion - service.runOnUiThread { - if (target != null) { - Glide.clear(target) - } - target = SongGlideRequest.Builder.from(Glide.with(service), song) - .checkIgnoreMediaStore(service) - .generatePalette(service).build() - .centerCrop() - .into(object : SimpleTarget(imageSize, imageSize) { - override fun onResourceReady(resource: BitmapPaletteWrapper, glideAnimation: GlideAnimation) { - val palette = resource.palette - update(resource.bitmap, palette.getVibrantColor(palette.getMutedColor(MaterialValueHelper.getSecondaryTextColor(service, true)))) - } + if (imageSize == 0) { + imageSize = service.resources.getDimensionPixelSize(code.name.monkey.retromusic.R.dimen.app_widget_card_image_size) + } + if (cardRadius == 0f) { + cardRadius = service.resources.getDimension(code.name.monkey.retromusic.R.dimen.app_widget_card_radius) + } + val appContext = service.applicationContext + // Load the album cover async and push the update on completion + service.runOnUiThread { + if (target != null) { + Glide.clear(target) + } + target = SongGlideRequest.Builder.from(Glide.with(service), song) + .checkIgnoreMediaStore(service).generatePalette(service).build().centerCrop() + .into(object : SimpleTarget(imageSize, imageSize) { + override fun onResourceReady( + resource: BitmapPaletteWrapper, + glideAnimation: GlideAnimation + ) { + val palette = resource.palette + update( + resource.bitmap, palette.getVibrantColor( + palette.getMutedColor( + MaterialValueHelper.getSecondaryTextColor( + service, true + ) + ) + ) + ) + } - override fun onLoadFailed(e: Exception?, errorDrawable: Drawable?) { - super.onLoadFailed(e, errorDrawable) - update(null, MaterialValueHelper.getSecondaryTextColor(service, true)) - } + override fun onLoadFailed(e: Exception?, errorDrawable: Drawable?) { + super.onLoadFailed(e, errorDrawable) + update(null, MaterialValueHelper.getSecondaryTextColor(service, true)) + } - private fun update(bitmap: Bitmap?, color: Int) { - // Set correct drawable for pause state - appWidgetView.setImageViewBitmap(R.id.button_toggle_play_pause, ImageUtil.createBitmap(ImageUtil.getTintedVectorDrawable(service, playPauseRes, color))) + private fun update(bitmap: Bitmap?, color: Int) { + // Set correct drawable for pause state + appWidgetView.setImageViewBitmap( + R.id.button_toggle_play_pause, ImageUtil.createBitmap( + ImageUtil.getTintedVectorDrawable( + service, playPauseRes, color + ) + ) + ) - // Set prev/next button drawables - appWidgetView.setImageViewBitmap(R.id.button_next, ImageUtil.createBitmap(ImageUtil.getTintedVectorDrawable(service, R.drawable.ic_skip_next_white_24dp, color))) - appWidgetView.setImageViewBitmap(R.id.button_prev, ImageUtil.createBitmap(ImageUtil.getTintedVectorDrawable(service, R.drawable.ic_skip_previous_white_24dp, color))) + // Set prev/next button drawables + appWidgetView.setImageViewBitmap( + R.id.button_next, ImageUtil.createBitmap( + ImageUtil.getTintedVectorDrawable( + service, R.drawable.ic_skip_next_white_24dp, color + ) + ) + ) + appWidgetView.setImageViewBitmap( + R.id.button_prev, ImageUtil.createBitmap( + ImageUtil.getTintedVectorDrawable( + service, R.drawable.ic_skip_previous_white_24dp, color + ) + ) + ) - val image = getAlbumArtDrawable(service.resources, bitmap) - val roundedBitmap = createRoundedBitmap(image, imageSize, imageSize, cardRadius, 0F, cardRadius, 0F) - appWidgetView.setImageViewBitmap(R.id.image, roundedBitmap) + val image = getAlbumArtDrawable(service.resources, bitmap) + val roundedBitmap = createRoundedBitmap( + image, imageSize, imageSize, cardRadius, 0F, cardRadius, 0F + ) + appWidgetView.setImageViewBitmap(R.id.image, roundedBitmap) - pushUpdate(service, appWidgetIds, appWidgetView) - } - }) - } - } + pushUpdate(service, appWidgetIds, appWidgetView) + } + }) + } + } - /** - * Link up various button actions using [PendingIntent]. - */ - private fun linkButtons(context: Context, views: RemoteViews) { - val action: Intent = Intent(context, MainActivity::class.java).putExtra("expand", true) - var pendingIntent: PendingIntent + /** + * Link up various button actions using [PendingIntent]. + */ + private fun linkButtons(context: Context, views: RemoteViews) { + val action: Intent = Intent(context, MainActivity::class.java).putExtra("expand", true) + var pendingIntent: PendingIntent - val serviceName = ComponentName(context, MusicService::class.java) + val serviceName = ComponentName(context, MusicService::class.java) - // Home - action.flags = Intent.FLAG_ACTIVITY_NEW_TASK or Intent.FLAG_ACTIVITY_CLEAR_TOP - pendingIntent = PendingIntent.getActivity(context, 0, action, 0) - views.setOnClickPendingIntent(R.id.image, pendingIntent) - views.setOnClickPendingIntent(R.id.media_titles, pendingIntent) + // Home + action.flags = Intent.FLAG_ACTIVITY_NEW_TASK or Intent.FLAG_ACTIVITY_CLEAR_TOP + pendingIntent = PendingIntent.getActivity(context, 0, action, 0) + views.setOnClickPendingIntent(R.id.image, pendingIntent) + views.setOnClickPendingIntent(R.id.media_titles, pendingIntent) - // Previous track - pendingIntent = buildPendingIntent(context, ACTION_REWIND, serviceName) - views.setOnClickPendingIntent(R.id.button_prev, pendingIntent) + // Previous track + pendingIntent = buildPendingIntent(context, ACTION_REWIND, serviceName) + views.setOnClickPendingIntent(R.id.button_prev, pendingIntent) - // Play and pause - pendingIntent = buildPendingIntent(context, ACTION_TOGGLE_PAUSE, serviceName) - views.setOnClickPendingIntent(R.id.button_toggle_play_pause, pendingIntent) + // Play and pause + pendingIntent = buildPendingIntent(context, ACTION_TOGGLE_PAUSE, serviceName) + views.setOnClickPendingIntent(R.id.button_toggle_play_pause, pendingIntent) - // Next track - pendingIntent = buildPendingIntent(context, ACTION_SKIP, serviceName) - views.setOnClickPendingIntent(R.id.button_next, pendingIntent) - } + // Next track + pendingIntent = buildPendingIntent(context, ACTION_SKIP, serviceName) + views.setOnClickPendingIntent(R.id.button_next, pendingIntent) + } - companion object { + companion object { - const val NAME = "app_widget_card" + const val NAME = "app_widget_card" - private var mInstance: AppWidgetCard? = null - private var imageSize = 0 - private var cardRadius = 0f + private var mInstance: AppWidgetCard? = null + private var imageSize = 0 + private var cardRadius = 0f - val instance: AppWidgetCard - @Synchronized get() { - if (mInstance == null) { - mInstance = AppWidgetCard() - } - return mInstance!! - } - } + val instance: AppWidgetCard + @Synchronized get() { + if (mInstance == null) { + mInstance = AppWidgetCard() + } + return mInstance!! + } + } } diff --git a/app/src/main/java/code/name/monkey/retromusic/appwidgets/AppWidgetClassic.kt b/app/src/main/java/code/name/monkey/retromusic/appwidgets/AppWidgetClassic.kt index 03a5141c..3a63d69f 100644 --- a/app/src/main/java/code/name/monkey/retromusic/appwidgets/AppWidgetClassic.kt +++ b/app/src/main/java/code/name/monkey/retromusic/appwidgets/AppWidgetClassic.kt @@ -15,9 +15,7 @@ package code.name.monkey.retromusic.appwidgets import android.app.PendingIntent -import android.content.ComponentName -import android.content.Context -import android.content.Intent +import android.content.* import android.graphics.Bitmap import android.graphics.drawable.Drawable import android.text.TextUtils @@ -31,147 +29,202 @@ import code.name.monkey.retromusic.glide.SongGlideRequest import code.name.monkey.retromusic.glide.palette.BitmapPaletteWrapper import code.name.monkey.retromusic.service.MusicService import code.name.monkey.retromusic.service.MusicService.* -import code.name.monkey.retromusic.util.ImageUtil -import code.name.monkey.retromusic.util.RetroUtil +import code.name.monkey.retromusic.util.* import com.bumptech.glide.Glide import com.bumptech.glide.request.animation.GlideAnimation -import com.bumptech.glide.request.target.SimpleTarget +import com.bumptech.glide.request.target.* import com.bumptech.glide.request.target.Target - class AppWidgetClassic : BaseAppWidget() { - private var target: Target? = null // for cancellation + private var target: Target? = null // for cancellation - /** - * Initialize given widgets to default state, where we launch Music on default click and hide - * actions if service not running. - */ - override fun defaultAppWidget(context: Context, appWidgetIds: IntArray) { - val appWidgetView = RemoteViews(context.packageName, R.layout.app_widget_classic) + /** + * Initialize given widgets to default state, where we launch Music on default click and hide + * actions if service not running. + */ + override fun defaultAppWidget(context: Context, appWidgetIds: IntArray) { + val appWidgetView = RemoteViews(context.packageName, R.layout.app_widget_classic) - appWidgetView.setViewVisibility(R.id.media_titles, View.INVISIBLE) - appWidgetView.setImageViewResource(R.id.image, R.drawable.default_album_art) - appWidgetView.setImageViewBitmap(R.id.button_next, createBitmap(RetroUtil.getTintedVectorDrawable(context, R.drawable.ic_skip_next_white_24dp, MaterialValueHelper.getSecondaryTextColor(context, true))!!, 1f)) - appWidgetView.setImageViewBitmap(R.id.button_prev, createBitmap(RetroUtil.getTintedVectorDrawable(context, R.drawable.ic_skip_previous_white_24dp, MaterialValueHelper.getSecondaryTextColor(context, true))!!, 1f)) - appWidgetView.setImageViewBitmap(R.id.button_toggle_play_pause, createBitmap(RetroUtil.getTintedVectorDrawable(context, R.drawable.ic_play_arrow_white_32dp, MaterialValueHelper.getSecondaryTextColor(context, true))!!, 1f)) + appWidgetView.setViewVisibility(R.id.media_titles, View.INVISIBLE) + appWidgetView.setImageViewResource(R.id.image, R.drawable.default_album_art) + appWidgetView.setImageViewBitmap( + R.id.button_next, createBitmap( + RetroUtil.getTintedVectorDrawable( + context, + R.drawable.ic_skip_next_white_24dp, + MaterialValueHelper.getSecondaryTextColor( + context, true + ) + )!!, 1f + ) + ) + appWidgetView.setImageViewBitmap( + R.id.button_prev, createBitmap( + RetroUtil.getTintedVectorDrawable( + context, + R.drawable.ic_skip_previous_white_24dp, + MaterialValueHelper.getSecondaryTextColor( + context, true + ) + )!!, 1f + ) + ) + appWidgetView.setImageViewBitmap( + R.id.button_toggle_play_pause, createBitmap( + RetroUtil.getTintedVectorDrawable( + context, + R.drawable.ic_play_arrow_white_32dp, + MaterialValueHelper.getSecondaryTextColor( + context, true + ) + )!!, 1f + ) + ) - linkButtons(context, appWidgetView) - pushUpdate(context, appWidgetIds, appWidgetView) - } + linkButtons(context, appWidgetView) + pushUpdate(context, appWidgetIds, appWidgetView) + } - /** - * Update all active widget instances by pushing changes - */ - override fun performUpdate(service: MusicService, appWidgetIds: IntArray?) { - val appWidgetView = RemoteViews(service.packageName, R.layout.app_widget_classic) + /** + * Update all active widget instances by pushing changes + */ + override fun performUpdate(service: MusicService, appWidgetIds: IntArray?) { + val appWidgetView = RemoteViews(service.packageName, R.layout.app_widget_classic) - val isPlaying = service.isPlaying - val song = service.currentSong + val isPlaying = service.isPlaying + val song = service.currentSong - // Set the titles and artwork - if (TextUtils.isEmpty(song.title) && TextUtils.isEmpty(song.artistName)) { - appWidgetView.setViewVisibility(R.id.media_titles, View.INVISIBLE) - } else { - appWidgetView.setViewVisibility(R.id.media_titles, View.VISIBLE) - appWidgetView.setTextViewText(R.id.title, song.title) - appWidgetView.setTextViewText(R.id.text, getSongArtistAndAlbum(song)) - } + // Set the titles and artwork + if (TextUtils.isEmpty(song.title) && TextUtils.isEmpty(song.artistName)) { + appWidgetView.setViewVisibility(R.id.media_titles, View.INVISIBLE) + } else { + appWidgetView.setViewVisibility(R.id.media_titles, View.VISIBLE) + appWidgetView.setTextViewText(R.id.title, song.title) + appWidgetView.setTextViewText(R.id.text, getSongArtistAndAlbum(song)) + } - // Link actions buttons to intents - linkButtons(service, appWidgetView) + // Link actions buttons to intents + linkButtons(service, appWidgetView) - if (imageSize == 0) { - imageSize = service.resources - .getDimensionPixelSize(R.dimen.app_widget_classic_image_size) - } - if (cardRadius == 0f) { - cardRadius = service.resources.getDimension(R.dimen.app_widget_card_radius) - } + if (imageSize == 0) { + imageSize = service.resources.getDimensionPixelSize(R.dimen.app_widget_classic_image_size) + } + if (cardRadius == 0f) { + cardRadius = service.resources.getDimension(R.dimen.app_widget_card_radius) + } - // Load the album cover async and push the update on completion - val appContext = service.applicationContext - service.runOnUiThread { - if (target != null) { - Glide.clear(target) - } - target = SongGlideRequest.Builder.from(Glide.with(service), song) - .checkIgnoreMediaStore(service) - .generatePalette(service).build() - .centerCrop() - .into(object : SimpleTarget(imageSize, imageSize) { - override fun onResourceReady(resource: BitmapPaletteWrapper, glideAnimation: GlideAnimation) { - val palette = resource.palette - update(resource.bitmap, palette.getVibrantColor(palette.getMutedColor(MaterialValueHelper.getSecondaryTextColor(service, true)))) - } + // Load the album cover async and push the update on completion + val appContext = service.applicationContext + service.runOnUiThread { + if (target != null) { + Glide.clear(target) + } + target = SongGlideRequest.Builder.from(Glide.with(service), song) + .checkIgnoreMediaStore(service).generatePalette(service).build().centerCrop() + .into(object : SimpleTarget(imageSize, imageSize) { + override fun onResourceReady( + resource: BitmapPaletteWrapper, + glideAnimation: GlideAnimation + ) { + val palette = resource.palette + update( + resource.bitmap, palette.getVibrantColor( + palette.getMutedColor( + MaterialValueHelper.getSecondaryTextColor( + service, true + ) + ) + ) + ) + } - override fun onLoadFailed(e: Exception?, errorDrawable: Drawable?) { - super.onLoadFailed(e, errorDrawable) - update(null, MaterialValueHelper.getSecondaryTextColor(service, true)) - } + override fun onLoadFailed(e: Exception?, errorDrawable: Drawable?) { + super.onLoadFailed(e, errorDrawable) + update(null, MaterialValueHelper.getSecondaryTextColor(service, true)) + } + private fun update(bitmap: Bitmap?, color: Int) { + // Set correct drawable for pause state + val playPauseRes = if (isPlaying) R.drawable.ic_pause_white_24dp else R.drawable.ic_play_arrow_white_24dp + appWidgetView.setImageViewBitmap( + R.id.button_toggle_play_pause, ImageUtil.createBitmap( + ImageUtil.getTintedVectorDrawable( + service, playPauseRes, color + ) + ) + ) - private fun update(bitmap: Bitmap?, color: Int) { - // Set correct drawable for pause state - val playPauseRes = if (isPlaying) R.drawable.ic_pause_white_24dp else R.drawable.ic_play_arrow_white_24dp - appWidgetView.setImageViewBitmap(R.id.button_toggle_play_pause, ImageUtil.createBitmap(ImageUtil.getTintedVectorDrawable(service, playPauseRes, color))) + // Set prev/next button drawables + appWidgetView.setImageViewBitmap( + R.id.button_next, ImageUtil.createBitmap( + ImageUtil.getTintedVectorDrawable( + service, R.drawable.ic_skip_next_white_24dp, color + ) + ) + ) + appWidgetView.setImageViewBitmap( + R.id.button_prev, ImageUtil.createBitmap( + ImageUtil.getTintedVectorDrawable( + service, R.drawable.ic_skip_previous_white_24dp, color + ) + ) + ) - // Set prev/next button drawables - appWidgetView.setImageViewBitmap(R.id.button_next, ImageUtil.createBitmap(ImageUtil.getTintedVectorDrawable(service, R.drawable.ic_skip_next_white_24dp, color))) - appWidgetView.setImageViewBitmap(R.id.button_prev, ImageUtil.createBitmap(ImageUtil.getTintedVectorDrawable(service, R.drawable.ic_skip_previous_white_24dp, color))) + val image = getAlbumArtDrawable(service.resources, bitmap) + val roundedBitmap = createRoundedBitmap( + image, imageSize, imageSize, cardRadius, 0F, cardRadius, 0F + ) + appWidgetView.setImageViewBitmap(R.id.image, roundedBitmap) - val image = getAlbumArtDrawable(service.resources, bitmap) - val roundedBitmap = createRoundedBitmap(image, imageSize, imageSize, cardRadius, 0F, cardRadius, 0F) - appWidgetView.setImageViewBitmap(R.id.image, roundedBitmap) + pushUpdate(appContext, appWidgetIds, appWidgetView) + } + }) + } + } - pushUpdate(appContext, appWidgetIds, appWidgetView) - } - }) - } - } + /** + * Link up various button actions using [PendingIntent]. + */ + private fun linkButtons(context: Context, views: RemoteViews) { + val action = Intent(context, MainActivity::class.java).putExtra("expand", true) + var pendingIntent: PendingIntent - /** - * Link up various button actions using [PendingIntent]. - */ - private fun linkButtons(context: Context, views: RemoteViews) { - val action = Intent(context, MainActivity::class.java).putExtra("expand", true) - var pendingIntent: PendingIntent + val serviceName = ComponentName(context, MusicService::class.java) - val serviceName = ComponentName(context, MusicService::class.java) + // Home + action.flags = Intent.FLAG_ACTIVITY_NEW_TASK or Intent.FLAG_ACTIVITY_CLEAR_TOP + pendingIntent = PendingIntent.getActivity(context, 0, action, 0) + views.setOnClickPendingIntent(R.id.image, pendingIntent) + views.setOnClickPendingIntent(R.id.media_titles, pendingIntent) - // Home - action.flags = Intent.FLAG_ACTIVITY_NEW_TASK or Intent.FLAG_ACTIVITY_CLEAR_TOP - pendingIntent = PendingIntent.getActivity(context, 0, action, 0) - views.setOnClickPendingIntent(R.id.image, pendingIntent) - views.setOnClickPendingIntent(R.id.media_titles, pendingIntent) + // Previous track + pendingIntent = buildPendingIntent(context, ACTION_REWIND, serviceName) + views.setOnClickPendingIntent(R.id.button_prev, pendingIntent) - // Previous track - pendingIntent = buildPendingIntent(context, ACTION_REWIND, serviceName) - views.setOnClickPendingIntent(R.id.button_prev, pendingIntent) + // Play and pause + pendingIntent = buildPendingIntent(context, ACTION_TOGGLE_PAUSE, serviceName) + views.setOnClickPendingIntent(R.id.button_toggle_play_pause, pendingIntent) - // Play and pause - pendingIntent = buildPendingIntent(context, ACTION_TOGGLE_PAUSE, serviceName) - views.setOnClickPendingIntent(R.id.button_toggle_play_pause, pendingIntent) + // Next track + pendingIntent = buildPendingIntent(context, ACTION_SKIP, serviceName) + views.setOnClickPendingIntent(R.id.button_next, pendingIntent) + } - // Next track - pendingIntent = buildPendingIntent(context, ACTION_SKIP, serviceName) - views.setOnClickPendingIntent(R.id.button_next, pendingIntent) - } + companion object { - companion object { + const val NAME = "app_widget_classic" - const val NAME = "app_widget_classic" + private var mInstance: AppWidgetClassic? = null + private var imageSize = 0 + private var cardRadius = 0f - private var mInstance: AppWidgetClassic? = null - private var imageSize = 0 - private var cardRadius = 0f - - val instance: AppWidgetClassic - @Synchronized get() { - if (mInstance == null) { - mInstance = AppWidgetClassic() - } - return mInstance!! - } - } + val instance: AppWidgetClassic + @Synchronized get() { + if (mInstance == null) { + mInstance = AppWidgetClassic() + } + return mInstance!! + } + } } diff --git a/app/src/main/java/code/name/monkey/retromusic/appwidgets/AppWidgetSmall.kt b/app/src/main/java/code/name/monkey/retromusic/appwidgets/AppWidgetSmall.kt index 48bd54ce..08f30b60 100644 --- a/app/src/main/java/code/name/monkey/retromusic/appwidgets/AppWidgetSmall.kt +++ b/app/src/main/java/code/name/monkey/retromusic/appwidgets/AppWidgetSmall.kt @@ -15,9 +15,7 @@ package code.name.monkey.retromusic.appwidgets import android.app.PendingIntent -import android.content.ComponentName -import android.content.Context -import android.content.Intent +import android.content.* import android.graphics.Bitmap import android.graphics.drawable.Drawable import android.text.TextUtils @@ -34,149 +32,207 @@ import code.name.monkey.retromusic.service.MusicService.* import code.name.monkey.retromusic.util.RetroUtil import com.bumptech.glide.Glide import com.bumptech.glide.request.animation.GlideAnimation -import com.bumptech.glide.request.target.SimpleTarget +import com.bumptech.glide.request.target.* import com.bumptech.glide.request.target.Target class AppWidgetSmall : BaseAppWidget() { - private var target: Target? = null // for cancellation + private var target: Target? = null // for cancellation - /** - * Initialize given widgets to default state, where we launch Music on default click and hide - * actions if service not running. - */ - override fun defaultAppWidget(context: Context, appWidgetIds: IntArray) { - val appWidgetView = RemoteViews(context.packageName, R.layout.app_widget_small) + /** + * Initialize given widgets to default state, where we launch Music on default click and hide + * actions if service not running. + */ + override fun defaultAppWidget(context: Context, appWidgetIds: IntArray) { + val appWidgetView = RemoteViews(context.packageName, R.layout.app_widget_small) - appWidgetView.setViewVisibility(R.id.media_titles, View.INVISIBLE) - appWidgetView.setImageViewResource(R.id.image, R.drawable.default_album_art) - appWidgetView.setImageViewBitmap(R.id.button_next, createBitmap(RetroUtil.getTintedVectorDrawable(context, R.drawable.ic_skip_next_white_24dp, MaterialValueHelper.getSecondaryTextColor(context, true))!!, 1f)) - appWidgetView.setImageViewBitmap(R.id.button_prev, createBitmap(RetroUtil.getTintedVectorDrawable(context, R.drawable.ic_skip_previous_white_24dp, MaterialValueHelper.getSecondaryTextColor(context, true))!!, 1f)) - appWidgetView.setImageViewBitmap(R.id.button_toggle_play_pause, createBitmap(RetroUtil.getTintedVectorDrawable(context, R.drawable.ic_play_arrow_white_32dp, MaterialValueHelper.getSecondaryTextColor(context, true))!!, 1f)) + appWidgetView.setViewVisibility(R.id.media_titles, View.INVISIBLE) + appWidgetView.setImageViewResource(R.id.image, R.drawable.default_album_art) + appWidgetView.setImageViewBitmap( + R.id.button_next, createBitmap( + RetroUtil.getTintedVectorDrawable( + context, + R.drawable.ic_skip_next_white_24dp, + MaterialValueHelper.getSecondaryTextColor( + context, true + ) + )!!, 1f + ) + ) + appWidgetView.setImageViewBitmap( + R.id.button_prev, createBitmap( + RetroUtil.getTintedVectorDrawable( + context, + R.drawable.ic_skip_previous_white_24dp, + MaterialValueHelper.getSecondaryTextColor( + context, true + ) + )!!, 1f + ) + ) + appWidgetView.setImageViewBitmap( + R.id.button_toggle_play_pause, createBitmap( + RetroUtil.getTintedVectorDrawable( + context, + R.drawable.ic_play_arrow_white_32dp, + MaterialValueHelper.getSecondaryTextColor( + context, true + ) + )!!, 1f + ) + ) - linkButtons(context, appWidgetView) - pushUpdate(context, appWidgetIds, appWidgetView) - } + linkButtons(context, appWidgetView) + pushUpdate(context, appWidgetIds, appWidgetView) + } - /** - * Update all active widget instances by pushing changes - */ - override fun performUpdate(service: MusicService, appWidgetIds: IntArray?) { - val appWidgetView = RemoteViews(service.packageName, - R.layout.app_widget_small) + /** + * Update all active widget instances by pushing changes + */ + override fun performUpdate(service: MusicService, appWidgetIds: IntArray?) { + val appWidgetView = RemoteViews( + service.packageName, R.layout.app_widget_small + ) - val isPlaying = service.isPlaying - val song = service.currentSong + val isPlaying = service.isPlaying + val song = service.currentSong - // Set the titles and artwork - if (TextUtils.isEmpty(song.title) && TextUtils.isEmpty(song.artistName)) { - appWidgetView.setViewVisibility(R.id.media_titles, View.INVISIBLE) - } else { - if (TextUtils.isEmpty(song.title) || TextUtils.isEmpty(song.artistName)) { - appWidgetView.setTextViewText(R.id.text_separator, "") - } else { - appWidgetView.setTextViewText(R.id.text_separator, "•") - } + // Set the titles and artwork + if (TextUtils.isEmpty(song.title) && TextUtils.isEmpty(song.artistName)) { + appWidgetView.setViewVisibility(R.id.media_titles, View.INVISIBLE) + } else { + if (TextUtils.isEmpty(song.title) || TextUtils.isEmpty(song.artistName)) { + appWidgetView.setTextViewText(R.id.text_separator, "") + } else { + appWidgetView.setTextViewText(R.id.text_separator, "•") + } - appWidgetView.setViewVisibility(R.id.media_titles, View.VISIBLE) - appWidgetView.setTextViewText(R.id.title, song.title) - appWidgetView.setTextViewText(R.id.text, song.artistName) - } + appWidgetView.setViewVisibility(R.id.media_titles, View.VISIBLE) + appWidgetView.setTextViewText(R.id.title, song.title) + appWidgetView.setTextViewText(R.id.text, song.artistName) + } - // Link actions buttons to intents - linkButtons(service, appWidgetView) + // Link actions buttons to intents + linkButtons(service, appWidgetView) - if (imageSize == 0) { - imageSize = service.resources.getDimensionPixelSize(R.dimen.app_widget_small_image_size) - } - if (cardRadius == 0f) { - cardRadius = service.resources.getDimension(R.dimen.app_widget_card_radius) - } + if (imageSize == 0) { + imageSize = service.resources.getDimensionPixelSize(R.dimen.app_widget_small_image_size) + } + if (cardRadius == 0f) { + cardRadius = service.resources.getDimension(R.dimen.app_widget_card_radius) + } - // Load the album cover async and push the update on completion - val appContext = service.applicationContext - service.runOnUiThread { - if (target != null) { - Glide.clear(target) - } - target = SongGlideRequest.Builder.from(Glide.with(service), song) - .checkIgnoreMediaStore(service) - .generatePalette(service).build() - .centerCrop() - .into(object : SimpleTarget(imageSize, imageSize) { - override fun onResourceReady(resource: BitmapPaletteWrapper, glideAnimation: GlideAnimation) { - val palette = resource.palette - update(resource.bitmap, palette.getVibrantColor(palette.getMutedColor(MaterialValueHelper.getSecondaryTextColor(service, true)))) - } + // Load the album cover async and push the update on completion + val appContext = service.applicationContext + service.runOnUiThread { + if (target != null) { + Glide.clear(target) + } + target = SongGlideRequest.Builder.from(Glide.with(service), song) + .checkIgnoreMediaStore(service).generatePalette(service).build().centerCrop() + .into(object : SimpleTarget(imageSize, imageSize) { + override fun onResourceReady( + resource: BitmapPaletteWrapper, + glideAnimation: GlideAnimation + ) { + val palette = resource.palette + update( + resource.bitmap, palette.getVibrantColor( + palette.getMutedColor( + MaterialValueHelper.getSecondaryTextColor( + service, true + ) + ) + ) + ) + } - override fun onLoadFailed(e: Exception?, errorDrawable: Drawable?) { - super.onLoadFailed(e, errorDrawable) - update(null, MaterialValueHelper.getSecondaryTextColor(service, true)) - } + override fun onLoadFailed(e: Exception?, errorDrawable: Drawable?) { + super.onLoadFailed(e, errorDrawable) + update(null, MaterialValueHelper.getSecondaryTextColor(service, true)) + } - private fun update(bitmap: Bitmap?, color: Int) { - // Set correct drawable for pause state - val playPauseRes = if (isPlaying) - R.drawable.ic_pause_white_24dp - else - R.drawable.ic_play_arrow_white_32dp - appWidgetView.setImageViewBitmap(R.id.button_toggle_play_pause, createBitmap(RetroUtil.getTintedVectorDrawable(service, playPauseRes, color)!!, 1f)) + private fun update(bitmap: Bitmap?, color: Int) { + // Set correct drawable for pause state + val playPauseRes = if (isPlaying) R.drawable.ic_pause_white_24dp + else R.drawable.ic_play_arrow_white_32dp + appWidgetView.setImageViewBitmap( + R.id.button_toggle_play_pause, createBitmap( + RetroUtil.getTintedVectorDrawable( + service, playPauseRes, color + )!!, 1f + ) + ) - // Set prev/next button drawables - appWidgetView.setImageViewBitmap(R.id.button_next, createBitmap(RetroUtil.getTintedVectorDrawable(service, R.drawable.ic_skip_next_white_24dp, color)!!, 1f)) - appWidgetView.setImageViewBitmap(R.id.button_prev, createBitmap(RetroUtil.getTintedVectorDrawable(service, R.drawable.ic_skip_previous_white_24dp, color)!!, 1f)) + // Set prev/next button drawables + appWidgetView.setImageViewBitmap( + R.id.button_next, createBitmap( + RetroUtil.getTintedVectorDrawable( + service, R.drawable.ic_skip_next_white_24dp, color + )!!, 1f + ) + ) + appWidgetView.setImageViewBitmap( + R.id.button_prev, createBitmap( + RetroUtil.getTintedVectorDrawable( + service, R.drawable.ic_skip_previous_white_24dp, color + )!!, 1f + ) + ) - val image = getAlbumArtDrawable(service.resources, bitmap) - val roundedBitmap = createRoundedBitmap(image, imageSize, imageSize, cardRadius, 0f, 0f, 0f) - appWidgetView.setImageViewBitmap(R.id.image, roundedBitmap) + val image = getAlbumArtDrawable(service.resources, bitmap) + val roundedBitmap = createRoundedBitmap( + image, imageSize, imageSize, cardRadius, 0f, 0f, 0f + ) + appWidgetView.setImageViewBitmap(R.id.image, roundedBitmap) - pushUpdate(appContext, appWidgetIds, appWidgetView) - } - }) - } - } + pushUpdate(appContext, appWidgetIds, appWidgetView) + } + }) + } + } - /** - * Link up various button actions using [PendingIntent]. - */ - private fun linkButtons(context: Context, views: RemoteViews) { - val action = Intent(context, MainActivity::class.java).putExtra("expand", true) - var pendingIntent: PendingIntent + /** + * Link up various button actions using [PendingIntent]. + */ + private fun linkButtons(context: Context, views: RemoteViews) { + val action = Intent(context, MainActivity::class.java).putExtra("expand", true) + var pendingIntent: PendingIntent - val serviceName = ComponentName(context, MusicService::class.java) + val serviceName = ComponentName(context, MusicService::class.java) - // Home - action.flags = Intent.FLAG_ACTIVITY_NEW_TASK or Intent.FLAG_ACTIVITY_CLEAR_TOP - pendingIntent = PendingIntent.getActivity(context, 0, action, 0) - views.setOnClickPendingIntent(R.id.image, pendingIntent) - views.setOnClickPendingIntent(R.id.media_titles, pendingIntent) + // Home + action.flags = Intent.FLAG_ACTIVITY_NEW_TASK or Intent.FLAG_ACTIVITY_CLEAR_TOP + pendingIntent = PendingIntent.getActivity(context, 0, action, 0) + views.setOnClickPendingIntent(R.id.image, pendingIntent) + views.setOnClickPendingIntent(R.id.media_titles, pendingIntent) - // Previous track - pendingIntent = buildPendingIntent(context, ACTION_REWIND, serviceName) - views.setOnClickPendingIntent(R.id.button_prev, pendingIntent) + // Previous track + pendingIntent = buildPendingIntent(context, ACTION_REWIND, serviceName) + views.setOnClickPendingIntent(R.id.button_prev, pendingIntent) - // Play and pause - pendingIntent = buildPendingIntent(context, ACTION_TOGGLE_PAUSE, serviceName) - views.setOnClickPendingIntent(R.id.button_toggle_play_pause, pendingIntent) + // Play and pause + pendingIntent = buildPendingIntent(context, ACTION_TOGGLE_PAUSE, serviceName) + views.setOnClickPendingIntent(R.id.button_toggle_play_pause, pendingIntent) - // Next track - pendingIntent = buildPendingIntent(context, ACTION_SKIP, serviceName) - views.setOnClickPendingIntent(R.id.button_next, pendingIntent) - } + // Next track + pendingIntent = buildPendingIntent(context, ACTION_SKIP, serviceName) + views.setOnClickPendingIntent(R.id.button_next, pendingIntent) + } - companion object { + companion object { - const val NAME: String = "app_widget_small" + const val NAME: String = "app_widget_small" - private var mInstance: AppWidgetSmall? = null - private var imageSize = 0 - private var cardRadius = 0f + private var mInstance: AppWidgetSmall? = null + private var imageSize = 0 + private var cardRadius = 0f - val instance: AppWidgetSmall - @Synchronized get() { - if (mInstance == null) { - mInstance = AppWidgetSmall() - } - return mInstance!! - } - } + val instance: AppWidgetSmall + @Synchronized get() { + if (mInstance == null) { + mInstance = AppWidgetSmall() + } + return mInstance!! + } + } } diff --git a/app/src/main/java/code/name/monkey/retromusic/appwidgets/AppWidgetText.kt b/app/src/main/java/code/name/monkey/retromusic/appwidgets/AppWidgetText.kt index 251bcb15..88bba6a8 100644 --- a/app/src/main/java/code/name/monkey/retromusic/appwidgets/AppWidgetText.kt +++ b/app/src/main/java/code/name/monkey/retromusic/appwidgets/AppWidgetText.kt @@ -15,15 +15,12 @@ package code.name.monkey.retromusic.appwidgets import android.app.PendingIntent -import android.content.ComponentName -import android.content.Context -import android.content.Intent +import android.content.* import android.text.TextUtils import android.view.View import android.widget.RemoteViews import androidx.core.content.ContextCompat -import code.name.monkey.retromusic.App -import code.name.monkey.retromusic.R +import code.name.monkey.retromusic.* import code.name.monkey.retromusic.activities.MainActivity import code.name.monkey.retromusic.appwidgets.base.BaseAppWidget import code.name.monkey.retromusic.service.MusicService @@ -31,93 +28,146 @@ import code.name.monkey.retromusic.service.MusicService.* import code.name.monkey.retromusic.util.RetroUtil class AppWidgetText : BaseAppWidget() { - override fun defaultAppWidget(context: Context, appWidgetIds: IntArray) { - val appWidgetView = RemoteViews(context.packageName, R.layout.app_widget_text) + override fun defaultAppWidget(context: Context, appWidgetIds: IntArray) { + val appWidgetView = RemoteViews(context.packageName, R.layout.app_widget_text) - appWidgetView.setImageViewBitmap(R.id.button_next, createBitmap(RetroUtil.getTintedVectorDrawable(context, R.drawable.ic_skip_next_white_24dp, ContextCompat.getColor(context, R.color.md_white_1000))!!, 1f)) - appWidgetView.setImageViewBitmap(R.id.button_prev, createBitmap(RetroUtil.getTintedVectorDrawable(context, R.drawable.ic_skip_previous_white_24dp, ContextCompat.getColor(context, R.color.md_white_1000))!!, 1f)) - appWidgetView.setImageViewBitmap(R.id.button_toggle_play_pause, createBitmap(RetroUtil.getTintedVectorDrawable(context, R.drawable.ic_play_arrow_white_32dp, ContextCompat.getColor(context, R.color.md_white_1000))!!, 1f)) + appWidgetView.setImageViewBitmap( + R.id.button_next, createBitmap( + RetroUtil.getTintedVectorDrawable( + context, R.drawable.ic_skip_next_white_24dp, ContextCompat.getColor( + context, R.color.md_white_1000 + ) + )!!, 1f + ) + ) + appWidgetView.setImageViewBitmap( + R.id.button_prev, createBitmap( + RetroUtil.getTintedVectorDrawable( + context, R.drawable.ic_skip_previous_white_24dp, ContextCompat.getColor( + context, R.color.md_white_1000 + ) + )!!, 1f + ) + ) + appWidgetView.setImageViewBitmap( + R.id.button_toggle_play_pause, createBitmap( + RetroUtil.getTintedVectorDrawable( + context, R.drawable.ic_play_arrow_white_32dp, ContextCompat.getColor( + context, R.color.md_white_1000 + ) + )!!, 1f + ) + ) - appWidgetView.setTextColor(R.id.title, ContextCompat.getColor(context, R.color.md_white_1000)) - appWidgetView.setTextColor(R.id.text, ContextCompat.getColor(context, R.color.md_white_1000)) + appWidgetView.setTextColor( + R.id.title, ContextCompat.getColor(context, R.color.md_white_1000) + ) + appWidgetView.setTextColor( + R.id.text, ContextCompat.getColor(context, R.color.md_white_1000) + ) - linkButtons(context, appWidgetView) - pushUpdate(context, appWidgetIds, appWidgetView) - } + linkButtons(context, appWidgetView) + pushUpdate(context, appWidgetIds, appWidgetView) + } - /** - * Link up various button actions using [PendingIntent]. - */ - private fun linkButtons(context: Context, views: RemoteViews) { - val action = Intent(context, MainActivity::class.java).putExtra("expand", true) - var pendingIntent: PendingIntent + /** + * Link up various button actions using [PendingIntent]. + */ + private fun linkButtons(context: Context, views: RemoteViews) { + val action = Intent(context, MainActivity::class.java).putExtra("expand", true) + var pendingIntent: PendingIntent - val serviceName = ComponentName(context, MusicService::class.java) + val serviceName = ComponentName(context, MusicService::class.java) - // Home - action.flags = Intent.FLAG_ACTIVITY_NEW_TASK or Intent.FLAG_ACTIVITY_CLEAR_TOP - pendingIntent = PendingIntent.getActivity(context, 0, action, 0) - views.setOnClickPendingIntent(R.id.image, pendingIntent) - views.setOnClickPendingIntent(R.id.media_titles, pendingIntent) + // Home + action.flags = Intent.FLAG_ACTIVITY_NEW_TASK or Intent.FLAG_ACTIVITY_CLEAR_TOP + pendingIntent = PendingIntent.getActivity(context, 0, action, 0) + views.setOnClickPendingIntent(R.id.image, pendingIntent) + views.setOnClickPendingIntent(R.id.media_titles, pendingIntent) - // Previous track - pendingIntent = buildPendingIntent(context, ACTION_REWIND, serviceName) - views.setOnClickPendingIntent(R.id.button_prev, pendingIntent) + // Previous track + pendingIntent = buildPendingIntent(context, ACTION_REWIND, serviceName) + views.setOnClickPendingIntent(R.id.button_prev, pendingIntent) - // Play and pause - pendingIntent = buildPendingIntent(context, ACTION_TOGGLE_PAUSE, serviceName) - views.setOnClickPendingIntent(R.id.button_toggle_play_pause, pendingIntent) + // Play and pause + pendingIntent = buildPendingIntent(context, ACTION_TOGGLE_PAUSE, serviceName) + views.setOnClickPendingIntent(R.id.button_toggle_play_pause, pendingIntent) - // Next track - pendingIntent = buildPendingIntent(context, ACTION_SKIP, serviceName) - views.setOnClickPendingIntent(R.id.button_next, pendingIntent) - } + // Next track + pendingIntent = buildPendingIntent(context, ACTION_SKIP, serviceName) + views.setOnClickPendingIntent(R.id.button_next, pendingIntent) + } - override fun performUpdate(service: MusicService, appWidgetIds: IntArray?) { - val appWidgetView = RemoteViews(service.packageName, R.layout.app_widget_text) + override fun performUpdate(service: MusicService, appWidgetIds: IntArray?) { + val appWidgetView = RemoteViews(service.packageName, R.layout.app_widget_text) - val isPlaying = service.isPlaying - val song = service.currentSong + val isPlaying = service.isPlaying + val song = service.currentSong - // Set the titles and artwork - if (TextUtils.isEmpty(song.title) && TextUtils.isEmpty(song.artistName)) { - appWidgetView.setViewVisibility(R.id.media_titles, View.INVISIBLE) - } else { - appWidgetView.setViewVisibility(R.id.media_titles, View.VISIBLE) - appWidgetView.setTextViewText(R.id.title, song.title) - appWidgetView.setTextViewText(R.id.text, song.artistName) - } - // Link actions buttons to intents - linkButtons(service, appWidgetView) + // Set the titles and artwork + if (TextUtils.isEmpty(song.title) && TextUtils.isEmpty(song.artistName)) { + appWidgetView.setViewVisibility(R.id.media_titles, View.INVISIBLE) + } else { + appWidgetView.setViewVisibility(R.id.media_titles, View.VISIBLE) + appWidgetView.setTextViewText(R.id.title, song.title) + appWidgetView.setTextViewText(R.id.text, song.artistName) + } + // Link actions buttons to intents + linkButtons(service, appWidgetView) - // Set correct drawable for pause state - val playPauseRes = if (isPlaying) - R.drawable.ic_pause_white_24dp - else - R.drawable.ic_play_arrow_white_32dp - appWidgetView.setImageViewBitmap(R.id.button_toggle_play_pause, createBitmap(RetroUtil.getTintedVectorDrawable(App.getContext(), playPauseRes, ContextCompat.getColor(App.getContext(), R.color.md_white_1000))!!, 1f)) - appWidgetView.setImageViewBitmap(R.id.button_next, createBitmap(RetroUtil.getTintedVectorDrawable(App.getContext(), R.drawable.ic_skip_next_white_24dp, ContextCompat.getColor(App.getContext(), R.color.md_white_1000))!!, 1f)) - appWidgetView.setImageViewBitmap(R.id.button_prev, createBitmap(RetroUtil.getTintedVectorDrawable(App.getContext(), R.drawable.ic_skip_previous_white_24dp, ContextCompat.getColor(App.getContext(), R.color.md_white_1000))!!, 1f)) + // Set correct drawable for pause state + val playPauseRes = if (isPlaying) R.drawable.ic_pause_white_24dp + else R.drawable.ic_play_arrow_white_32dp + appWidgetView.setImageViewBitmap( + R.id.button_toggle_play_pause, createBitmap( + RetroUtil.getTintedVectorDrawable( + App.getContext(), playPauseRes, ContextCompat.getColor( + App.getContext(), R.color.md_white_1000 + ) + )!!, 1f + ) + ) + appWidgetView.setImageViewBitmap( + R.id.button_next, createBitmap( + RetroUtil.getTintedVectorDrawable( + App.getContext(), + R.drawable.ic_skip_next_white_24dp, + ContextCompat.getColor( + App.getContext(), R.color.md_white_1000 + ) + )!!, 1f + ) + ) + appWidgetView.setImageViewBitmap( + R.id.button_prev, createBitmap( + RetroUtil.getTintedVectorDrawable( + App.getContext(), + R.drawable.ic_skip_previous_white_24dp, + ContextCompat.getColor( + App.getContext(), R.color.md_white_1000 + ) + )!!, 1f + ) + ) - pushUpdate(service.applicationContext, appWidgetIds, appWidgetView) + pushUpdate(service.applicationContext, appWidgetIds, appWidgetView) - } + } - companion object { + companion object { - const val NAME: String = "app_widget_text" + const val NAME: String = "app_widget_text" - private var mInstance: AppWidgetText? = null + private var mInstance: AppWidgetText? = null - - val instance: AppWidgetText - @Synchronized get() { - if (mInstance == null) { - mInstance = AppWidgetText() - } - return mInstance!! - } - } + val instance: AppWidgetText + @Synchronized get() { + if (mInstance == null) { + mInstance = AppWidgetText() + } + return mInstance!! + } + } } diff --git a/app/src/main/java/code/name/monkey/retromusic/appwidgets/BootReceiver.kt b/app/src/main/java/code/name/monkey/retromusic/appwidgets/BootReceiver.kt index 55b3c463..90a9cf8a 100644 --- a/app/src/main/java/code/name/monkey/retromusic/appwidgets/BootReceiver.kt +++ b/app/src/main/java/code/name/monkey/retromusic/appwidgets/BootReceiver.kt @@ -15,27 +15,36 @@ package code.name.monkey.retromusic.appwidgets import android.appwidget.AppWidgetManager -import android.content.BroadcastReceiver -import android.content.ComponentName -import android.content.Context -import android.content.Intent +import android.content.* import android.os.Build - import code.name.monkey.retromusic.service.MusicService class BootReceiver : BroadcastReceiver() { - override fun onReceive(context: Context, intent: Intent) { - val widgetManager = AppWidgetManager.getInstance(context) + override fun onReceive(context: Context, intent: Intent) { + val widgetManager = AppWidgetManager.getInstance(context) - // Start music service if there are any existing widgets - if (widgetManager.getAppWidgetIds(ComponentName(context, AppWidgetBig::class.java)).isNotEmpty() || - widgetManager.getAppWidgetIds(ComponentName(context, AppWidgetClassic::class.java)).isNotEmpty() || - widgetManager.getAppWidgetIds(ComponentName(context, AppWidgetSmall::class.java)).isNotEmpty() || - widgetManager.getAppWidgetIds(ComponentName(context, AppWidgetCard::class.java)).isNotEmpty()) { - val serviceIntent = Intent(context, MusicService::class.java) - if (Build.VERSION.SDK_INT < Build.VERSION_CODES.O) { // not allowed on Oreo - context.startService(serviceIntent) - } - } - } + // Start music service if there are any existing widgets + if (widgetManager.getAppWidgetIds( + ComponentName( + context, AppWidgetBig::class.java + ) + ).isNotEmpty() || widgetManager.getAppWidgetIds( + ComponentName( + context, AppWidgetClassic::class.java + ) + ).isNotEmpty() || widgetManager.getAppWidgetIds( + ComponentName( + context, AppWidgetSmall::class.java + ) + ).isNotEmpty() || widgetManager.getAppWidgetIds( + ComponentName( + context, AppWidgetCard::class.java + ) + ).isNotEmpty()) { + val serviceIntent = Intent(context, MusicService::class.java) + if (Build.VERSION.SDK_INT < Build.VERSION_CODES.O) { // not allowed on Oreo + context.startService(serviceIntent) + } + } + } } diff --git a/app/src/main/res/drawable/retro.png b/app/src/main/res/drawable/retro.png new file mode 100644 index 0000000000000000000000000000000000000000..ca283b56305fb79b6cd4bdd2467f8d28fb823906 GIT binary patch literal 9643 zcmd6NWmr^i*YC_Qzzp48(k)%m(jC%B2uLa^41zFp&d}Y`U4oQ!4+1huC?F|}grtCk zhyQcVb)0(Mr?RRRE-lkjisvF~*$Cv(l`y1D?~dl>=%#<&8&_Y&})=ytp6wfbMxgX{Sg4b!KA68^aKVxc#5Cys2bStD9MSLpCp2;sIEte>BI;W&xbQI zoXx^dtfT^R7aJ>e(Ls(qW*>D(94lovWKF<>D1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Ksoyd;kMeh zKCm%V-yHH88df3-f3>%<>tHq144WM4MKpVTZ)9TXeRVt{Re#VL^ex1@u^zon&vJX( zEIXIT(jVA!wi|&q(Q5wV=#rMdgT5kx+`d%%&c-JksC@Rs! zA7sJRX|F*~ht)54p`Yp4n5qyZjWtUm#b$t1Q!KS(7<4Z5HNO+^4t4eZXNA4kEbZdQ zzaNIV{C$_X+WZbgeH7AHI!wY&^pOmrUAR%lHY7N^8Z1QUCA>#_)^Z=Ans}*;5pP1KEr0H5 zP$t5(Xx0F_X}VQ3a_qI2@%>?l;m2;aAUMizD!68a-&c#fZjn}czOMEVoFn0Po+WGF8qH1gPN9p literal 0 HcmV?d00001 diff --git a/app/src/main/res/drawable/splash.xml b/app/src/main/res/drawable/splash.xml new file mode 100644 index 00000000..de634d1a --- /dev/null +++ b/app/src/main/res/drawable/splash.xml @@ -0,0 +1,25 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/values/styles.xml b/app/src/main/res/values/styles.xml index 66bd544a..2a8a6387 100644 --- a/app/src/main/res/values/styles.xml +++ b/app/src/main/res/values/styles.xml @@ -174,4 +174,9 @@ 0dp + +