Added default color drawable
|
@ -27,6 +27,7 @@ import code.name.monkey.retromusic.dialogs.AddToPlaylistDialog
|
||||||
import code.name.monkey.retromusic.dialogs.DeleteSongsDialog
|
import code.name.monkey.retromusic.dialogs.DeleteSongsDialog
|
||||||
import code.name.monkey.retromusic.extensions.ripAlpha
|
import code.name.monkey.retromusic.extensions.ripAlpha
|
||||||
import code.name.monkey.retromusic.extensions.show
|
import code.name.monkey.retromusic.extensions.show
|
||||||
|
import code.name.monkey.retromusic.glide.AlbumGlideRequest
|
||||||
import code.name.monkey.retromusic.glide.ArtistGlideRequest
|
import code.name.monkey.retromusic.glide.ArtistGlideRequest
|
||||||
import code.name.monkey.retromusic.glide.RetroMusicColoredTarget
|
import code.name.monkey.retromusic.glide.RetroMusicColoredTarget
|
||||||
import code.name.monkey.retromusic.glide.SongGlideRequest
|
import code.name.monkey.retromusic.glide.SongGlideRequest
|
||||||
|
@ -250,19 +251,25 @@ class AlbumDetailsActivity : AbsSlidingMusicPanelActivity(), AlbumDetailsView, C
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun loadArtistImage(artist: Artist) {
|
override fun loadArtistImage(artist: Artist) {
|
||||||
ArtistGlideRequest.Builder.from(Glide.with(this), artist).generatePalette(this).build()
|
ArtistGlideRequest.Builder.from(Glide.with(this), artist)
|
||||||
.dontAnimate().dontTransform().into(object : RetroMusicColoredTarget(artistImage) {
|
.generatePalette(this)
|
||||||
|
.build()
|
||||||
|
.dontAnimate()
|
||||||
|
.dontTransform()
|
||||||
|
.into(object : RetroMusicColoredTarget(artistImage) {
|
||||||
override fun onColorReady(color: Int) {
|
override fun onColorReady(color: Int) {
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun loadAlbumCover() {
|
private fun loadAlbumCover() {
|
||||||
SongGlideRequest.Builder.from(Glide.with(this), album.safeGetFirstSong())
|
AlbumGlideRequest.Builder.from(Glide.with(this), album.safeGetFirstSong())
|
||||||
.checkIgnoreMediaStore(this)
|
.checkIgnoreMediaStore(this)
|
||||||
.ignoreMediaStore(PreferenceUtil.getInstance(this).ignoreMediaStoreArtwork())
|
.ignoreMediaStore(PreferenceUtil.getInstance(this).ignoreMediaStoreArtwork())
|
||||||
.generatePalette(this)
|
.generatePalette(this)
|
||||||
.build().dontAnimate().dontTransform()
|
.build()
|
||||||
|
.dontAnimate()
|
||||||
|
.dontTransform()
|
||||||
.into(object : RetroMusicColoredTarget(image) {
|
.into(object : RetroMusicColoredTarget(image) {
|
||||||
override fun onColorReady(color: Int) {
|
override fun onColorReady(color: Int) {
|
||||||
setColors(color)
|
setColors(color)
|
||||||
|
|
|
@ -322,7 +322,7 @@ abstract class AbsTagEditorActivity : AbsBaseActivity() {
|
||||||
|
|
||||||
protected fun setImageBitmap(bitmap: Bitmap?, bgColor: Int) {
|
protected fun setImageBitmap(bitmap: Bitmap?, bgColor: Int) {
|
||||||
if (bitmap == null) {
|
if (bitmap == null) {
|
||||||
editorImage.setImageResource(drawable.default_album_art)
|
editorImage.setImageResource(drawable.default_audio_art)
|
||||||
} else {
|
} else {
|
||||||
editorImage.setImageBitmap(bitmap)
|
editorImage.setImageBitmap(bitmap)
|
||||||
}
|
}
|
||||||
|
|
|
@ -154,7 +154,7 @@ class AlbumTagEditorActivity : AbsTagEditorActivity(), TextWatcher {
|
||||||
|
|
||||||
override fun deleteImage() {
|
override fun deleteImage() {
|
||||||
setImageBitmap(
|
setImageBitmap(
|
||||||
BitmapFactory.decodeResource(resources, R.drawable.default_album_art),
|
BitmapFactory.decodeResource(resources, R.drawable.default_audio_art),
|
||||||
ATHUtil.resolveColor(this, R.attr.defaultFooterColor)
|
ATHUtil.resolveColor(this, R.attr.defaultFooterColor)
|
||||||
)
|
)
|
||||||
deleteAlbumArt = true
|
deleteAlbumArt = true
|
||||||
|
|
|
@ -22,15 +22,19 @@ import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
import androidx.recyclerview.widget.ItemTouchHelper;
|
import androidx.recyclerview.widget.ItemTouchHelper;
|
||||||
import androidx.recyclerview.widget.RecyclerView;
|
import androidx.recyclerview.widget.RecyclerView;
|
||||||
|
|
||||||
|
import com.google.android.material.checkbox.MaterialCheckBox;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
import code.name.monkey.appthemehelper.ThemeStore;
|
import code.name.monkey.appthemehelper.ThemeStore;
|
||||||
import code.name.monkey.retromusic.R;
|
import code.name.monkey.retromusic.R;
|
||||||
import code.name.monkey.retromusic.model.CategoryInfo;
|
import code.name.monkey.retromusic.model.CategoryInfo;
|
||||||
import code.name.monkey.retromusic.util.SwipeAndDragHelper;
|
import code.name.monkey.retromusic.util.SwipeAndDragHelper;
|
||||||
import com.google.android.material.checkbox.MaterialCheckBox;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
public class CategoryInfoAdapter extends RecyclerView.Adapter<CategoryInfoAdapter.ViewHolder>
|
public class CategoryInfoAdapter extends RecyclerView.Adapter<CategoryInfoAdapter.ViewHolder>
|
||||||
implements SwipeAndDragHelper.ActionCompletionContract {
|
implements SwipeAndDragHelper.ActionCompletionContract {
|
||||||
|
|
|
@ -9,7 +9,7 @@ import code.name.monkey.retromusic.R
|
||||||
import code.name.monkey.retromusic.adapter.base.MediaEntryViewHolder
|
import code.name.monkey.retromusic.adapter.base.MediaEntryViewHolder
|
||||||
import code.name.monkey.retromusic.model.Genre
|
import code.name.monkey.retromusic.model.Genre
|
||||||
import code.name.monkey.retromusic.util.NavigationUtil
|
import code.name.monkey.retromusic.util.NavigationUtil
|
||||||
import java.util.Locale
|
import java.util.*
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Hemanth S (h4h13).
|
* @author Hemanth S (h4h13).
|
||||||
|
|
|
@ -115,7 +115,8 @@ class HomeAdapter(
|
||||||
if (list.isNotEmpty()) {
|
if (list.isNotEmpty()) {
|
||||||
recyclerView.apply {
|
recyclerView.apply {
|
||||||
show()
|
show()
|
||||||
layoutManager = LinearLayoutManager(activity, LinearLayoutManager.HORIZONTAL, false)
|
layoutManager =
|
||||||
|
LinearLayoutManager(activity, LinearLayoutManager.HORIZONTAL, false)
|
||||||
val artistAdapter = ArtistAdapter(
|
val artistAdapter = ArtistAdapter(
|
||||||
activity,
|
activity,
|
||||||
list,
|
list,
|
||||||
|
@ -136,8 +137,10 @@ class HomeAdapter(
|
||||||
if (songs.isNotEmpty()) {
|
if (songs.isNotEmpty()) {
|
||||||
recyclerView.apply {
|
recyclerView.apply {
|
||||||
show()
|
show()
|
||||||
val songAdapter = SongAdapter(activity, songs, R.layout.item_album_card, null)
|
val songAdapter =
|
||||||
layoutManager = GridLayoutManager(activity, 1, GridLayoutManager.HORIZONTAL, false)
|
SongAdapter(activity, songs, R.layout.item_album_card, null)
|
||||||
|
layoutManager =
|
||||||
|
GridLayoutManager(activity, 1, GridLayoutManager.HORIZONTAL, false)
|
||||||
adapter = songAdapter
|
adapter = songAdapter
|
||||||
}
|
}
|
||||||
title.text = activity.getString(titleRes)
|
title.text = activity.getString(titleRes)
|
||||||
|
|
|
@ -9,16 +9,12 @@ import androidx.recyclerview.widget.RecyclerView
|
||||||
import code.name.monkey.appthemehelper.ThemeStore
|
import code.name.monkey.appthemehelper.ThemeStore
|
||||||
import code.name.monkey.retromusic.R
|
import code.name.monkey.retromusic.R
|
||||||
import code.name.monkey.retromusic.adapter.base.MediaEntryViewHolder
|
import code.name.monkey.retromusic.adapter.base.MediaEntryViewHolder
|
||||||
|
import code.name.monkey.retromusic.glide.AlbumGlideRequest
|
||||||
import code.name.monkey.retromusic.glide.ArtistGlideRequest
|
import code.name.monkey.retromusic.glide.ArtistGlideRequest
|
||||||
import code.name.monkey.retromusic.glide.SongGlideRequest
|
|
||||||
import code.name.monkey.retromusic.helper.MusicPlayerRemote
|
import code.name.monkey.retromusic.helper.MusicPlayerRemote
|
||||||
import code.name.monkey.retromusic.helper.menu.SongMenuHelper
|
import code.name.monkey.retromusic.helper.menu.SongMenuHelper
|
||||||
import code.name.monkey.retromusic.loaders.PlaylistSongsLoader
|
import code.name.monkey.retromusic.loaders.PlaylistSongsLoader
|
||||||
import code.name.monkey.retromusic.model.Album
|
import code.name.monkey.retromusic.model.*
|
||||||
import code.name.monkey.retromusic.model.Artist
|
|
||||||
import code.name.monkey.retromusic.model.Genre
|
|
||||||
import code.name.monkey.retromusic.model.Playlist
|
|
||||||
import code.name.monkey.retromusic.model.Song
|
|
||||||
import code.name.monkey.retromusic.model.smartplaylist.AbsSmartPlaylist
|
import code.name.monkey.retromusic.model.smartplaylist.AbsSmartPlaylist
|
||||||
import code.name.monkey.retromusic.util.MusicUtil
|
import code.name.monkey.retromusic.util.MusicUtil
|
||||||
import code.name.monkey.retromusic.util.NavigationUtil
|
import code.name.monkey.retromusic.util.NavigationUtil
|
||||||
|
@ -52,7 +48,10 @@ class SearchAdapter(
|
||||||
), viewType
|
), viewType
|
||||||
)
|
)
|
||||||
else
|
else
|
||||||
ViewHolder(LayoutInflater.from(activity).inflate(R.layout.item_list, parent, false), viewType)
|
ViewHolder(
|
||||||
|
LayoutInflater.from(activity).inflate(R.layout.item_list, parent, false),
|
||||||
|
viewType
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onBindViewHolder(holder: ViewHolder, position: Int) {
|
override fun onBindViewHolder(holder: ViewHolder, position: Int) {
|
||||||
|
@ -61,7 +60,7 @@ class SearchAdapter(
|
||||||
val album = dataSet?.get(position) as Album
|
val album = dataSet?.get(position) as Album
|
||||||
holder.title?.text = album.title
|
holder.title?.text = album.title
|
||||||
holder.text?.text = album.artistName
|
holder.text?.text = album.artistName
|
||||||
SongGlideRequest.Builder.from(Glide.with(activity), album.safeGetFirstSong())
|
AlbumGlideRequest.Builder.from(Glide.with(activity), album.safeGetFirstSong())
|
||||||
.checkIgnoreMediaStore(activity).build().into(holder.image)
|
.checkIgnoreMediaStore(activity).build().into(holder.image)
|
||||||
}
|
}
|
||||||
ARTIST -> {
|
ARTIST -> {
|
||||||
|
|
|
@ -20,7 +20,7 @@ import com.bumptech.glide.signature.MediaStoreSignature
|
||||||
import me.zhanghai.android.fastscroll.PopupTextProvider
|
import me.zhanghai.android.fastscroll.PopupTextProvider
|
||||||
import java.io.File
|
import java.io.File
|
||||||
import java.text.DecimalFormat
|
import java.text.DecimalFormat
|
||||||
import java.util.ArrayList
|
import java.util.*
|
||||||
import kotlin.math.log10
|
import kotlin.math.log10
|
||||||
import kotlin.math.pow
|
import kotlin.math.pow
|
||||||
|
|
||||||
|
@ -87,7 +87,12 @@ class SongFileAdapter(
|
||||||
it.setColorFilter(iconColor, PorterDuff.Mode.SRC_IN)
|
it.setColorFilter(iconColor, PorterDuff.Mode.SRC_IN)
|
||||||
it.setImageResource(R.drawable.ic_folder_white_24dp)
|
it.setImageResource(R.drawable.ic_folder_white_24dp)
|
||||||
}
|
}
|
||||||
holder.imageTextContainer?.setCardBackgroundColor(ATHUtil.resolveColor(activity, R.attr.colorSurface))
|
holder.imageTextContainer?.setCardBackgroundColor(
|
||||||
|
ATHUtil.resolveColor(
|
||||||
|
activity,
|
||||||
|
R.attr.colorSurface
|
||||||
|
)
|
||||||
|
)
|
||||||
} else {
|
} else {
|
||||||
val error = RetroUtil.getTintedVectorDrawable(
|
val error = RetroUtil.getTintedVectorDrawable(
|
||||||
activity, R.drawable.ic_file_music_white_24dp, iconColor
|
activity, R.drawable.ic_file_music_white_24dp, iconColor
|
||||||
|
|
|
@ -13,8 +13,8 @@ import code.name.monkey.appthemehelper.util.MaterialValueHelper
|
||||||
import code.name.monkey.retromusic.R
|
import code.name.monkey.retromusic.R
|
||||||
import code.name.monkey.retromusic.adapter.base.AbsMultiSelectAdapter
|
import code.name.monkey.retromusic.adapter.base.AbsMultiSelectAdapter
|
||||||
import code.name.monkey.retromusic.adapter.base.MediaEntryViewHolder
|
import code.name.monkey.retromusic.adapter.base.MediaEntryViewHolder
|
||||||
|
import code.name.monkey.retromusic.glide.AlbumGlideRequest
|
||||||
import code.name.monkey.retromusic.glide.RetroMusicColoredTarget
|
import code.name.monkey.retromusic.glide.RetroMusicColoredTarget
|
||||||
import code.name.monkey.retromusic.glide.SongGlideRequest
|
|
||||||
import code.name.monkey.retromusic.helper.MusicPlayerRemote
|
import code.name.monkey.retromusic.helper.MusicPlayerRemote
|
||||||
import code.name.monkey.retromusic.helper.SortOrder
|
import code.name.monkey.retromusic.helper.SortOrder
|
||||||
import code.name.monkey.retromusic.helper.menu.SongsMenuHelper
|
import code.name.monkey.retromusic.helper.menu.SongsMenuHelper
|
||||||
|
@ -106,12 +106,14 @@ open class AlbumAdapter(
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
SongGlideRequest.Builder.from(Glide.with(activity), album.safeGetFirstSong())
|
AlbumGlideRequest.Builder.from(Glide.with(activity), album.safeGetFirstSong())
|
||||||
.checkIgnoreMediaStore(activity).generatePalette(activity).build()
|
.checkIgnoreMediaStore(activity)
|
||||||
|
.generatePalette(activity)
|
||||||
|
.build()
|
||||||
.into(object : RetroMusicColoredTarget(holder.image!!) {
|
.into(object : RetroMusicColoredTarget(holder.image!!) {
|
||||||
override fun onLoadCleared(placeholder: Drawable?) {
|
override fun onLoadCleared(placeholder: Drawable?) {
|
||||||
super.onLoadCleared(placeholder)
|
super.onLoadCleared(placeholder)
|
||||||
setColors(defaultFooterColor, holder)
|
//setColors(defaultFooterColor, holder)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onColorReady(color: Int) {
|
override fun onColorReady(color: Int) {
|
||||||
|
@ -185,7 +187,11 @@ open class AlbumAdapter(
|
||||||
imageContainerCard ?: image,
|
imageContainerCard ?: image,
|
||||||
"${activity.getString(R.string.transition_album_art)}_${dataSet[adapterPosition].id}"
|
"${activity.getString(R.string.transition_album_art)}_${dataSet[adapterPosition].id}"
|
||||||
)
|
)
|
||||||
NavigationUtil.goToAlbumOptions(activity, dataSet[adapterPosition].id, activityOptions)
|
NavigationUtil.goToAlbumOptions(
|
||||||
|
activity,
|
||||||
|
dataSet[adapterPosition].id,
|
||||||
|
activityOptions
|
||||||
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -16,7 +16,7 @@ import code.name.monkey.retromusic.model.Song
|
||||||
import code.name.monkey.retromusic.util.NavigationUtil
|
import code.name.monkey.retromusic.util.NavigationUtil
|
||||||
import code.name.monkey.retromusic.util.PreferenceUtil
|
import code.name.monkey.retromusic.util.PreferenceUtil
|
||||||
import com.bumptech.glide.Glide
|
import com.bumptech.glide.Glide
|
||||||
import java.util.ArrayList
|
import java.util.*
|
||||||
|
|
||||||
class AlbumCoverPagerAdapter(
|
class AlbumCoverPagerAdapter(
|
||||||
fragmentManager: FragmentManager,
|
fragmentManager: FragmentManager,
|
||||||
|
@ -85,7 +85,7 @@ class AlbumCoverPagerAdapter(
|
||||||
override fun onCreate(savedInstanceState: Bundle?) {
|
override fun onCreate(savedInstanceState: Bundle?) {
|
||||||
super.onCreate(savedInstanceState)
|
super.onCreate(savedInstanceState)
|
||||||
if (arguments != null) {
|
if (arguments != null) {
|
||||||
song = arguments!!.getParcelable(SONG_ARG)!!
|
song = requireArguments().getParcelable(SONG_ARG)!!
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -22,8 +22,8 @@ import android.view.LayoutInflater
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import android.view.ViewGroup
|
import android.view.ViewGroup
|
||||||
import code.name.monkey.retromusic.R
|
import code.name.monkey.retromusic.R
|
||||||
|
import code.name.monkey.retromusic.glide.AlbumGlideRequest
|
||||||
import code.name.monkey.retromusic.glide.RetroMusicColoredTarget
|
import code.name.monkey.retromusic.glide.RetroMusicColoredTarget
|
||||||
import code.name.monkey.retromusic.glide.SongGlideRequest
|
|
||||||
import code.name.monkey.retromusic.helper.MusicPlayerRemote
|
import code.name.monkey.retromusic.helper.MusicPlayerRemote
|
||||||
import code.name.monkey.retromusic.model.Album
|
import code.name.monkey.retromusic.model.Album
|
||||||
import code.name.monkey.retromusic.util.NavigationUtil
|
import code.name.monkey.retromusic.util.NavigationUtil
|
||||||
|
@ -37,7 +37,13 @@ class AlbumFullWidthAdapter(
|
||||||
) : MetalRecyclerViewPager.MetalAdapter<AlbumFullWidthAdapter.FullMetalViewHolder>(metrics) {
|
) : MetalRecyclerViewPager.MetalAdapter<AlbumFullWidthAdapter.FullMetalViewHolder>(metrics) {
|
||||||
|
|
||||||
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): FullMetalViewHolder {
|
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): FullMetalViewHolder {
|
||||||
return FullMetalViewHolder(LayoutInflater.from(parent.context).inflate(R.layout.pager_item, parent, false))
|
return FullMetalViewHolder(
|
||||||
|
LayoutInflater.from(parent.context).inflate(
|
||||||
|
R.layout.pager_item,
|
||||||
|
parent,
|
||||||
|
false
|
||||||
|
)
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onBindViewHolder(holder: FullMetalViewHolder, position: Int) {
|
override fun onBindViewHolder(holder: FullMetalViewHolder, position: Int) {
|
||||||
|
@ -70,7 +76,7 @@ class AlbumFullWidthAdapter(
|
||||||
if (holder.image == null) {
|
if (holder.image == null) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
SongGlideRequest.Builder.from(Glide.with(activity), album.safeGetFirstSong())
|
AlbumGlideRequest.Builder.from(Glide.with(activity), album.safeGetFirstSong())
|
||||||
.checkIgnoreMediaStore(activity)
|
.checkIgnoreMediaStore(activity)
|
||||||
.generatePalette(activity)
|
.generatePalette(activity)
|
||||||
.build()
|
.build()
|
||||||
|
@ -84,7 +90,8 @@ class AlbumFullWidthAdapter(
|
||||||
return dataSet.size
|
return dataSet.size
|
||||||
}
|
}
|
||||||
|
|
||||||
inner class FullMetalViewHolder(itemView: View) : MetalRecyclerViewPager.MetalViewHolder(itemView) {
|
inner class FullMetalViewHolder(itemView: View) :
|
||||||
|
MetalRecyclerViewPager.MetalViewHolder(itemView) {
|
||||||
|
|
||||||
override fun onClick(v: View?) {
|
override fun onClick(v: View?) {
|
||||||
val activityOptions = ActivityOptions.makeSceneTransitionAnimation(
|
val activityOptions = ActivityOptions.makeSceneTransitionAnimation(
|
||||||
|
|
|
@ -5,8 +5,8 @@ import android.view.View
|
||||||
import android.view.ViewGroup
|
import android.view.ViewGroup
|
||||||
import androidx.appcompat.app.AppCompatActivity
|
import androidx.appcompat.app.AppCompatActivity
|
||||||
import code.name.monkey.appthemehelper.util.ATHUtil
|
import code.name.monkey.appthemehelper.util.ATHUtil
|
||||||
|
import code.name.monkey.retromusic.glide.AlbumGlideRequest
|
||||||
import code.name.monkey.retromusic.glide.RetroMusicColoredTarget
|
import code.name.monkey.retromusic.glide.RetroMusicColoredTarget
|
||||||
import code.name.monkey.retromusic.glide.SongGlideRequest
|
|
||||||
import code.name.monkey.retromusic.helper.HorizontalAdapterHelper
|
import code.name.monkey.retromusic.helper.HorizontalAdapterHelper
|
||||||
import code.name.monkey.retromusic.interfaces.CabHolder
|
import code.name.monkey.retromusic.interfaces.CabHolder
|
||||||
import code.name.monkey.retromusic.model.Album
|
import code.name.monkey.retromusic.model.Album
|
||||||
|
@ -34,8 +34,10 @@ class HorizontalAlbumAdapter(
|
||||||
|
|
||||||
override fun loadAlbumCover(album: Album, holder: ViewHolder) {
|
override fun loadAlbumCover(album: Album, holder: ViewHolder) {
|
||||||
if (holder.image == null) return
|
if (holder.image == null) return
|
||||||
SongGlideRequest.Builder.from(Glide.with(activity), album.safeGetFirstSong())
|
AlbumGlideRequest.Builder.from(Glide.with(activity), album.safeGetFirstSong())
|
||||||
.checkIgnoreMediaStore(activity).generatePalette(activity).build()
|
.checkIgnoreMediaStore(activity)
|
||||||
|
.generatePalette(activity)
|
||||||
|
.build()
|
||||||
.into(object : RetroMusicColoredTarget(holder.image!!) {
|
.into(object : RetroMusicColoredTarget(holder.image!!) {
|
||||||
override fun onLoadCleared(placeholder: Drawable?) {
|
override fun onLoadCleared(placeholder: Drawable?) {
|
||||||
super.onLoadCleared(placeholder)
|
super.onLoadCleared(placeholder)
|
||||||
|
|
|
@ -24,7 +24,7 @@ import code.name.monkey.retromusic.util.MusicUtil
|
||||||
import code.name.monkey.retromusic.util.NavigationUtil
|
import code.name.monkey.retromusic.util.NavigationUtil
|
||||||
import com.bumptech.glide.Glide
|
import com.bumptech.glide.Glide
|
||||||
import me.zhanghai.android.fastscroll.PopupTextProvider
|
import me.zhanghai.android.fastscroll.PopupTextProvider
|
||||||
import java.util.ArrayList
|
import java.util.*
|
||||||
|
|
||||||
class ArtistAdapter(
|
class ArtistAdapter(
|
||||||
val activity: AppCompatActivity,
|
val activity: AppCompatActivity,
|
||||||
|
@ -85,8 +85,10 @@ class ArtistAdapter(
|
||||||
if (holder.image == null) {
|
if (holder.image == null) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
ArtistGlideRequest.Builder.from(Glide.with(activity), artist).generatePalette(activity)
|
ArtistGlideRequest.Builder.from(Glide.with(activity), artist)
|
||||||
.build().into(object : RetroMusicColoredTarget(holder.image!!) {
|
.generatePalette(activity)
|
||||||
|
.build()
|
||||||
|
.into(object : RetroMusicColoredTarget(holder.image!!) {
|
||||||
override fun onLoadCleared(placeholder: Drawable?) {
|
override fun onLoadCleared(placeholder: Drawable?) {
|
||||||
super.onLoadCleared(placeholder)
|
super.onLoadCleared(placeholder)
|
||||||
setColors(defaultFooterColor, holder)
|
setColors(defaultFooterColor, holder)
|
||||||
|
|
|
@ -6,7 +6,7 @@ import androidx.appcompat.app.AppCompatActivity
|
||||||
import code.name.monkey.retromusic.interfaces.CabHolder
|
import code.name.monkey.retromusic.interfaces.CabHolder
|
||||||
import code.name.monkey.retromusic.model.Song
|
import code.name.monkey.retromusic.model.Song
|
||||||
import code.name.monkey.retromusic.util.MusicUtil
|
import code.name.monkey.retromusic.util.MusicUtil
|
||||||
import java.util.ArrayList
|
import java.util.*
|
||||||
|
|
||||||
class SimpleSongAdapter(
|
class SimpleSongAdapter(
|
||||||
context: AppCompatActivity,
|
context: AppCompatActivity,
|
||||||
|
|
|
@ -26,7 +26,7 @@ import code.name.monkey.retromusic.util.PreferenceUtil
|
||||||
import com.afollestad.materialcab.MaterialCab
|
import com.afollestad.materialcab.MaterialCab
|
||||||
import com.bumptech.glide.Glide
|
import com.bumptech.glide.Glide
|
||||||
import me.zhanghai.android.fastscroll.PopupTextProvider
|
import me.zhanghai.android.fastscroll.PopupTextProvider
|
||||||
import java.util.ArrayList
|
import java.util.*
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by hemanths on 13/08/17.
|
* Created by hemanths on 13/08/17.
|
||||||
|
@ -86,8 +86,6 @@ open class SongAdapter(
|
||||||
private fun setColors(color: Int, holder: ViewHolder) {
|
private fun setColors(color: Int, holder: ViewHolder) {
|
||||||
if (holder.paletteColorContainer != null) {
|
if (holder.paletteColorContainer != null) {
|
||||||
holder.paletteColorContainer?.setBackgroundColor(color)
|
holder.paletteColorContainer?.setBackgroundColor(color)
|
||||||
//holder.title?.setTextColor(MaterialValueHelper.getPrimaryTextColor(activity, ColorUtil.isColorLight(color)))
|
|
||||||
//holder.text?.setTextColor(MaterialValueHelper.getSecondaryTextColor(activity, ColorUtil.isColorLight(color)))
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -95,7 +93,8 @@ open class SongAdapter(
|
||||||
if (holder.image == null) {
|
if (holder.image == null) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
SongGlideRequest.Builder.from(Glide.with(activity), song).checkIgnoreMediaStore(activity)
|
SongGlideRequest.Builder.from(Glide.with(activity), song)
|
||||||
|
.checkIgnoreMediaStore(activity)
|
||||||
.generatePalette(activity).build()
|
.generatePalette(activity).build()
|
||||||
.into(object : RetroMusicColoredTarget(holder.image!!) {
|
.into(object : RetroMusicColoredTarget(holder.image!!) {
|
||||||
override fun onLoadCleared(placeholder: Drawable?) {
|
override fun onLoadCleared(placeholder: Drawable?) {
|
||||||
|
|
|
@ -52,7 +52,7 @@ class AppWidgetBig : BaseAppWidget() {
|
||||||
code.name.monkey.retromusic.R.id.media_titles,
|
code.name.monkey.retromusic.R.id.media_titles,
|
||||||
View.INVISIBLE
|
View.INVISIBLE
|
||||||
)
|
)
|
||||||
appWidgetView.setImageViewResource(R.id.image, R.drawable.default_album_art)
|
appWidgetView.setImageViewResource(R.id.image, R.drawable.default_audio_art)
|
||||||
appWidgetView.setImageViewBitmap(
|
appWidgetView.setImageViewBitmap(
|
||||||
R.id.button_next, BaseAppWidget.createBitmap(
|
R.id.button_next, BaseAppWidget.createBitmap(
|
||||||
RetroUtil.getTintedVectorDrawable(
|
RetroUtil.getTintedVectorDrawable(
|
||||||
|
@ -176,7 +176,7 @@ class AppWidgetBig : BaseAppWidget() {
|
||||||
if (bitmap == null) {
|
if (bitmap == null) {
|
||||||
appWidgetView.setImageViewResource(
|
appWidgetView.setImageViewResource(
|
||||||
R.id.image,
|
R.id.image,
|
||||||
R.drawable.default_album_art
|
R.drawable.default_audio_art
|
||||||
)
|
)
|
||||||
} else {
|
} else {
|
||||||
appWidgetView.setImageViewBitmap(R.id.image, bitmap)
|
appWidgetView.setImageViewBitmap(R.id.image, bitmap)
|
||||||
|
|
|
@ -46,7 +46,7 @@ class AppWidgetCard : BaseAppWidget() {
|
||||||
val appWidgetView = RemoteViews(context.packageName, R.layout.app_widget_card)
|
val appWidgetView = RemoteViews(context.packageName, R.layout.app_widget_card)
|
||||||
|
|
||||||
appWidgetView.setViewVisibility(R.id.media_titles, View.INVISIBLE)
|
appWidgetView.setViewVisibility(R.id.media_titles, View.INVISIBLE)
|
||||||
appWidgetView.setImageViewResource(R.id.image, R.drawable.default_album_art)
|
appWidgetView.setImageViewResource(R.id.image, R.drawable.default_audio_art)
|
||||||
appWidgetView.setImageViewBitmap(
|
appWidgetView.setImageViewBitmap(
|
||||||
R.id.button_next, createBitmap(
|
R.id.button_next, createBitmap(
|
||||||
RetroUtil.getTintedVectorDrawable(
|
RetroUtil.getTintedVectorDrawable(
|
||||||
|
|
|
@ -53,7 +53,7 @@ class AppWidgetClassic : BaseAppWidget() {
|
||||||
|
|
||||||
|
|
||||||
appWidgetView.setViewVisibility(R.id.media_titles, View.INVISIBLE)
|
appWidgetView.setViewVisibility(R.id.media_titles, View.INVISIBLE)
|
||||||
appWidgetView.setImageViewResource(R.id.image, R.drawable.default_album_art)
|
appWidgetView.setImageViewResource(R.id.image, R.drawable.default_audio_art)
|
||||||
appWidgetView.setImageViewBitmap(
|
appWidgetView.setImageViewBitmap(
|
||||||
R.id.button_next,
|
R.id.button_next,
|
||||||
createBitmap(
|
createBitmap(
|
||||||
|
|
|
@ -48,7 +48,7 @@ class AppWidgetSmall : BaseAppWidget() {
|
||||||
val appWidgetView = RemoteViews(context.packageName, R.layout.app_widget_small)
|
val appWidgetView = RemoteViews(context.packageName, R.layout.app_widget_small)
|
||||||
|
|
||||||
appWidgetView.setViewVisibility(R.id.media_titles, View.INVISIBLE)
|
appWidgetView.setViewVisibility(R.id.media_titles, View.INVISIBLE)
|
||||||
appWidgetView.setImageViewResource(R.id.image, R.drawable.default_album_art)
|
appWidgetView.setImageViewResource(R.id.image, R.drawable.default_audio_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_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_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.setImageViewBitmap(R.id.button_toggle_play_pause, createBitmap(RetroUtil.getTintedVectorDrawable(context, R.drawable.ic_play_arrow_white_32dp, MaterialValueHelper.getSecondaryTextColor(context, true))!!, 1f))
|
||||||
|
|
|
@ -98,7 +98,7 @@ abstract class BaseAppWidget : AppWidgetProvider() {
|
||||||
|
|
||||||
protected fun getAlbumArtDrawable(resources: Resources, bitmap: Bitmap?): Drawable {
|
protected fun getAlbumArtDrawable(resources: Resources, bitmap: Bitmap?): Drawable {
|
||||||
return if (bitmap == null) {
|
return if (bitmap == null) {
|
||||||
ContextCompat.getDrawable(App.getContext(), R.drawable.default_album_art)!!
|
ContextCompat.getDrawable(App.getContext(), R.drawable.default_audio_art)!!
|
||||||
} else {
|
} else {
|
||||||
BitmapDrawable(resources, bitmap)
|
BitmapDrawable(resources, bitmap)
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,138 @@
|
||||||
|
package code.name.monkey.retromusic.glide;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
import android.graphics.Bitmap;
|
||||||
|
import android.graphics.Color;
|
||||||
|
import android.graphics.drawable.ColorDrawable;
|
||||||
|
import android.graphics.drawable.Drawable;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
|
||||||
|
import com.bumptech.glide.BitmapRequestBuilder;
|
||||||
|
import com.bumptech.glide.DrawableRequestBuilder;
|
||||||
|
import com.bumptech.glide.DrawableTypeRequest;
|
||||||
|
import com.bumptech.glide.RequestManager;
|
||||||
|
import com.bumptech.glide.load.Key;
|
||||||
|
import com.bumptech.glide.load.engine.DiskCacheStrategy;
|
||||||
|
import com.bumptech.glide.load.resource.drawable.GlideDrawable;
|
||||||
|
import com.bumptech.glide.signature.MediaStoreSignature;
|
||||||
|
|
||||||
|
import code.name.monkey.appthemehelper.ThemeStore;
|
||||||
|
import code.name.monkey.appthemehelper.util.TintHelper;
|
||||||
|
import code.name.monkey.retromusic.R;
|
||||||
|
import code.name.monkey.retromusic.glide.audiocover.AudioFileCover;
|
||||||
|
import code.name.monkey.retromusic.glide.palette.BitmapPaletteTranscoder;
|
||||||
|
import code.name.monkey.retromusic.glide.palette.BitmapPaletteWrapper;
|
||||||
|
import code.name.monkey.retromusic.model.Song;
|
||||||
|
import code.name.monkey.retromusic.util.MusicUtil;
|
||||||
|
import code.name.monkey.retromusic.util.PreferenceUtil;
|
||||||
|
|
||||||
|
public class AlbumGlideRequest {
|
||||||
|
private static final DiskCacheStrategy DEFAULT_DISK_CACHE_STRATEGY = DiskCacheStrategy.NONE;
|
||||||
|
private static final int DEFAULT_ERROR_IMAGE = R.drawable.default_album_art;
|
||||||
|
private static final int DEFAULT_ANIMATION = android.R.anim.fade_in;
|
||||||
|
|
||||||
|
public static class Builder {
|
||||||
|
final RequestManager requestManager;
|
||||||
|
final Song song;
|
||||||
|
boolean ignoreMediaStore;
|
||||||
|
|
||||||
|
@NonNull
|
||||||
|
public static Builder from(@NonNull RequestManager requestManager, Song song) {
|
||||||
|
return new Builder(requestManager, song);
|
||||||
|
}
|
||||||
|
|
||||||
|
private Builder(@NonNull RequestManager requestManager, Song song) {
|
||||||
|
this.requestManager = requestManager;
|
||||||
|
this.song = song;
|
||||||
|
}
|
||||||
|
|
||||||
|
@NonNull
|
||||||
|
public PaletteBuilder generatePalette(@NonNull Context context) {
|
||||||
|
return new PaletteBuilder(this, context);
|
||||||
|
}
|
||||||
|
|
||||||
|
@NonNull
|
||||||
|
public BitmapBuilder asBitmap() {
|
||||||
|
return new BitmapBuilder(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@NonNull
|
||||||
|
public Builder checkIgnoreMediaStore(@NonNull Context context) {
|
||||||
|
return ignoreMediaStore(PreferenceUtil.getInstance(context).ignoreMediaStoreArtwork());
|
||||||
|
}
|
||||||
|
|
||||||
|
@NonNull
|
||||||
|
public Builder ignoreMediaStore(boolean ignoreMediaStore) {
|
||||||
|
this.ignoreMediaStore = ignoreMediaStore;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
@NonNull
|
||||||
|
public DrawableRequestBuilder<GlideDrawable> build() {
|
||||||
|
//noinspection unchecked
|
||||||
|
return createBaseRequest(requestManager, song, ignoreMediaStore)
|
||||||
|
.diskCacheStrategy(DEFAULT_DISK_CACHE_STRATEGY)
|
||||||
|
.error(new ColorDrawable(Color.RED))
|
||||||
|
.animate(DEFAULT_ANIMATION)
|
||||||
|
.signature(createSignature(song));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class BitmapBuilder {
|
||||||
|
private final Builder builder;
|
||||||
|
|
||||||
|
public BitmapBuilder(Builder builder) {
|
||||||
|
this.builder = builder;
|
||||||
|
}
|
||||||
|
|
||||||
|
public BitmapRequestBuilder<?, Bitmap> build() {
|
||||||
|
//noinspection unchecked
|
||||||
|
return createBaseRequest(builder.requestManager, builder.song, builder.ignoreMediaStore)
|
||||||
|
.asBitmap()
|
||||||
|
.diskCacheStrategy(DEFAULT_DISK_CACHE_STRATEGY)
|
||||||
|
.error(new ColorDrawable(Color.GREEN))
|
||||||
|
.animate(DEFAULT_ANIMATION)
|
||||||
|
.signature(createSignature(builder.song));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class PaletteBuilder {
|
||||||
|
final Context context;
|
||||||
|
private final Builder builder;
|
||||||
|
|
||||||
|
public PaletteBuilder(Builder builder, Context context) {
|
||||||
|
this.builder = builder;
|
||||||
|
this.context = context;
|
||||||
|
}
|
||||||
|
|
||||||
|
public BitmapRequestBuilder<?, BitmapPaletteWrapper> build() {
|
||||||
|
Drawable drawable = TintHelper.createTintedDrawable(context, DEFAULT_ERROR_IMAGE, ThemeStore.Companion.accentColor(context));
|
||||||
|
//noinspection unchecked
|
||||||
|
return createBaseRequest(builder.requestManager, builder.song, builder.ignoreMediaStore)
|
||||||
|
.asBitmap()
|
||||||
|
.transcode(new BitmapPaletteTranscoder(context), BitmapPaletteWrapper.class)
|
||||||
|
.diskCacheStrategy(DEFAULT_DISK_CACHE_STRATEGY)
|
||||||
|
.placeholder(drawable)
|
||||||
|
.error(drawable)
|
||||||
|
.animate(DEFAULT_ANIMATION)
|
||||||
|
.signature(createSignature(builder.song));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@NonNull
|
||||||
|
private static DrawableTypeRequest createBaseRequest(@NonNull RequestManager requestManager,
|
||||||
|
@NonNull Song song,
|
||||||
|
boolean ignoreMediaStore) {
|
||||||
|
if (ignoreMediaStore) {
|
||||||
|
return requestManager.load(new AudioFileCover(song.getData()));
|
||||||
|
} else {
|
||||||
|
return requestManager.loadFromMediaStore(MusicUtil.getMediaStoreAlbumCoverUri(song.getAlbumId()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@NonNull
|
||||||
|
private static Key createSignature(@NonNull Song song) {
|
||||||
|
return new MediaStoreSignature("", song.getDateModified(), 0);
|
||||||
|
}
|
||||||
|
}
|
|
@ -16,15 +16,10 @@ package code.name.monkey.retromusic.glide;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.graphics.Bitmap;
|
import android.graphics.Bitmap;
|
||||||
|
import android.graphics.drawable.Drawable;
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
import code.name.monkey.retromusic.App;
|
|
||||||
import code.name.monkey.retromusic.R;
|
|
||||||
import code.name.monkey.retromusic.glide.artistimage.ArtistImage;
|
|
||||||
import code.name.monkey.retromusic.glide.palette.BitmapPaletteTranscoder;
|
|
||||||
import code.name.monkey.retromusic.glide.palette.BitmapPaletteWrapper;
|
|
||||||
import code.name.monkey.retromusic.model.Artist;
|
|
||||||
import code.name.monkey.retromusic.util.ArtistSignatureUtil;
|
|
||||||
import code.name.monkey.retromusic.util.CustomArtistImageUtil;
|
|
||||||
import com.bumptech.glide.BitmapRequestBuilder;
|
import com.bumptech.glide.BitmapRequestBuilder;
|
||||||
import com.bumptech.glide.DrawableRequestBuilder;
|
import com.bumptech.glide.DrawableRequestBuilder;
|
||||||
import com.bumptech.glide.DrawableTypeRequest;
|
import com.bumptech.glide.DrawableTypeRequest;
|
||||||
|
@ -35,8 +30,24 @@ import com.bumptech.glide.load.engine.DiskCacheStrategy;
|
||||||
import com.bumptech.glide.load.resource.drawable.GlideDrawable;
|
import com.bumptech.glide.load.resource.drawable.GlideDrawable;
|
||||||
import com.bumptech.glide.request.target.Target;
|
import com.bumptech.glide.request.target.Target;
|
||||||
|
|
||||||
|
import code.name.monkey.appthemehelper.ThemeStore;
|
||||||
|
import code.name.monkey.appthemehelper.util.TintHelper;
|
||||||
|
import code.name.monkey.retromusic.App;
|
||||||
|
import code.name.monkey.retromusic.R;
|
||||||
|
import code.name.monkey.retromusic.glide.artistimage.ArtistImage;
|
||||||
|
import code.name.monkey.retromusic.glide.palette.BitmapPaletteTranscoder;
|
||||||
|
import code.name.monkey.retromusic.glide.palette.BitmapPaletteWrapper;
|
||||||
|
import code.name.monkey.retromusic.model.Artist;
|
||||||
|
import code.name.monkey.retromusic.util.ArtistSignatureUtil;
|
||||||
|
import code.name.monkey.retromusic.util.CustomArtistImageUtil;
|
||||||
|
|
||||||
|
|
||||||
public class ArtistGlideRequest {
|
public class ArtistGlideRequest {
|
||||||
|
private static final int DEFAULT_ANIMATION = android.R.anim.fade_in;
|
||||||
|
|
||||||
|
private static final DiskCacheStrategy DEFAULT_DISK_CACHE_STRATEGY = DiskCacheStrategy.SOURCE;
|
||||||
|
|
||||||
|
private static final int DEFAULT_ERROR_IMAGE = R.drawable.default_artist_art;
|
||||||
|
|
||||||
public static class Builder {
|
public static class Builder {
|
||||||
|
|
||||||
|
@ -121,13 +132,15 @@ public class ArtistGlideRequest {
|
||||||
}
|
}
|
||||||
|
|
||||||
public BitmapRequestBuilder<?, BitmapPaletteWrapper> build() {
|
public BitmapRequestBuilder<?, BitmapPaletteWrapper> build() {
|
||||||
|
Drawable drawable = TintHelper.createTintedDrawable(context, DEFAULT_ERROR_IMAGE, ThemeStore.Companion.accentColor(context));
|
||||||
//noinspection unchecked
|
//noinspection unchecked
|
||||||
return createBaseRequest(builder.requestManager, builder.artist, builder.noCustomImage,
|
return createBaseRequest(builder.requestManager, builder.artist, builder.noCustomImage,
|
||||||
builder.forceDownload)
|
builder.forceDownload)
|
||||||
.asBitmap()
|
.asBitmap()
|
||||||
.transcode(new BitmapPaletteTranscoder(context), BitmapPaletteWrapper.class)
|
.transcode(new BitmapPaletteTranscoder(context), BitmapPaletteWrapper.class)
|
||||||
.diskCacheStrategy(DEFAULT_DISK_CACHE_STRATEGY)
|
.diskCacheStrategy(DEFAULT_DISK_CACHE_STRATEGY)
|
||||||
.error(DEFAULT_ERROR_IMAGE)
|
.placeholder(drawable)
|
||||||
|
.error(drawable)
|
||||||
.animate(DEFAULT_ANIMATION)
|
.animate(DEFAULT_ANIMATION)
|
||||||
.priority(Priority.LOW)
|
.priority(Priority.LOW)
|
||||||
.override(Target.SIZE_ORIGINAL, Target.SIZE_ORIGINAL)
|
.override(Target.SIZE_ORIGINAL, Target.SIZE_ORIGINAL)
|
||||||
|
@ -135,11 +148,6 @@ public class ArtistGlideRequest {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static final int DEFAULT_ANIMATION = android.R.anim.fade_in;
|
|
||||||
|
|
||||||
private static final DiskCacheStrategy DEFAULT_DISK_CACHE_STRATEGY = DiskCacheStrategy.SOURCE;
|
|
||||||
|
|
||||||
private static final int DEFAULT_ERROR_IMAGE = R.drawable.default_artist_art;
|
|
||||||
|
|
||||||
@NonNull
|
@NonNull
|
||||||
public static Key createSignature(@NonNull Artist artist) {
|
public static Key createSignature(@NonNull Artist artist) {
|
||||||
|
@ -148,8 +156,8 @@ public class ArtistGlideRequest {
|
||||||
|
|
||||||
@NonNull
|
@NonNull
|
||||||
private static DrawableTypeRequest createBaseRequest(@NonNull RequestManager requestManager,
|
private static DrawableTypeRequest createBaseRequest(@NonNull RequestManager requestManager,
|
||||||
@NonNull Artist artist,
|
@NonNull Artist artist,
|
||||||
boolean noCustomImage, boolean forceDownload) {
|
boolean noCustomImage, boolean forceDownload) {
|
||||||
boolean hasCustomImage = CustomArtistImageUtil.Companion.getInstance(App.Companion.getContext())
|
boolean hasCustomImage = CustomArtistImageUtil.Companion.getInstance(App.Companion.getContext())
|
||||||
.hasCustomArtistImage(artist);
|
.hasCustomArtistImage(artist);
|
||||||
if (noCustomImage || !hasCustomImage) {
|
if (noCustomImage || !hasCustomImage) {
|
||||||
|
|
|
@ -16,6 +16,7 @@ package code.name.monkey.retromusic.glide;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.graphics.Bitmap;
|
import android.graphics.Bitmap;
|
||||||
|
import android.graphics.drawable.Drawable;
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
|
|
||||||
|
@ -28,6 +29,8 @@ import com.bumptech.glide.load.engine.DiskCacheStrategy;
|
||||||
import com.bumptech.glide.load.resource.drawable.GlideDrawable;
|
import com.bumptech.glide.load.resource.drawable.GlideDrawable;
|
||||||
import com.bumptech.glide.signature.MediaStoreSignature;
|
import com.bumptech.glide.signature.MediaStoreSignature;
|
||||||
|
|
||||||
|
import code.name.monkey.appthemehelper.ThemeStore;
|
||||||
|
import code.name.monkey.appthemehelper.util.TintHelper;
|
||||||
import code.name.monkey.retromusic.R;
|
import code.name.monkey.retromusic.R;
|
||||||
import code.name.monkey.retromusic.glide.audiocover.AudioFileCover;
|
import code.name.monkey.retromusic.glide.audiocover.AudioFileCover;
|
||||||
import code.name.monkey.retromusic.glide.palette.BitmapPaletteTranscoder;
|
import code.name.monkey.retromusic.glide.palette.BitmapPaletteTranscoder;
|
||||||
|
@ -42,7 +45,7 @@ import code.name.monkey.retromusic.util.PreferenceUtil;
|
||||||
public class SongGlideRequest {
|
public class SongGlideRequest {
|
||||||
|
|
||||||
private static final DiskCacheStrategy DEFAULT_DISK_CACHE_STRATEGY = DiskCacheStrategy.NONE;
|
private static final DiskCacheStrategy DEFAULT_DISK_CACHE_STRATEGY = DiskCacheStrategy.NONE;
|
||||||
private static final int DEFAULT_ERROR_IMAGE = R.drawable.default_album_art;
|
private static final int DEFAULT_ERROR_IMAGE = R.drawable.default_audio_art;
|
||||||
private static final int DEFAULT_ANIMATION = android.R.anim.fade_in;
|
private static final int DEFAULT_ANIMATION = android.R.anim.fade_in;
|
||||||
|
|
||||||
public static class Builder {
|
public static class Builder {
|
||||||
|
@ -87,6 +90,7 @@ public class SongGlideRequest {
|
||||||
return createBaseRequest(requestManager, song, ignoreMediaStore)
|
return createBaseRequest(requestManager, song, ignoreMediaStore)
|
||||||
.diskCacheStrategy(DEFAULT_DISK_CACHE_STRATEGY)
|
.diskCacheStrategy(DEFAULT_DISK_CACHE_STRATEGY)
|
||||||
.error(DEFAULT_ERROR_IMAGE)
|
.error(DEFAULT_ERROR_IMAGE)
|
||||||
|
.placeholder(DEFAULT_ERROR_IMAGE)
|
||||||
.animate(DEFAULT_ANIMATION)
|
.animate(DEFAULT_ANIMATION)
|
||||||
.signature(createSignature(song));
|
.signature(createSignature(song));
|
||||||
}
|
}
|
||||||
|
@ -105,6 +109,7 @@ public class SongGlideRequest {
|
||||||
.asBitmap()
|
.asBitmap()
|
||||||
.diskCacheStrategy(DEFAULT_DISK_CACHE_STRATEGY)
|
.diskCacheStrategy(DEFAULT_DISK_CACHE_STRATEGY)
|
||||||
.error(DEFAULT_ERROR_IMAGE)
|
.error(DEFAULT_ERROR_IMAGE)
|
||||||
|
.placeholder(DEFAULT_ERROR_IMAGE)
|
||||||
.animate(DEFAULT_ANIMATION)
|
.animate(DEFAULT_ANIMATION)
|
||||||
.signature(createSignature(builder.song));
|
.signature(createSignature(builder.song));
|
||||||
}
|
}
|
||||||
|
@ -120,12 +125,14 @@ public class SongGlideRequest {
|
||||||
}
|
}
|
||||||
|
|
||||||
public BitmapRequestBuilder<?, BitmapPaletteWrapper> build() {
|
public BitmapRequestBuilder<?, BitmapPaletteWrapper> build() {
|
||||||
|
Drawable drawable = TintHelper.createTintedDrawable(context, DEFAULT_ERROR_IMAGE, ThemeStore.Companion.accentColor(context));
|
||||||
//noinspection unchecked
|
//noinspection unchecked
|
||||||
return createBaseRequest(builder.requestManager, builder.song, builder.ignoreMediaStore)
|
return createBaseRequest(builder.requestManager, builder.song, builder.ignoreMediaStore)
|
||||||
.asBitmap()
|
.asBitmap()
|
||||||
.transcode(new BitmapPaletteTranscoder(context), BitmapPaletteWrapper.class)
|
.transcode(new BitmapPaletteTranscoder(context), BitmapPaletteWrapper.class)
|
||||||
.diskCacheStrategy(DEFAULT_DISK_CACHE_STRATEGY)
|
.diskCacheStrategy(DEFAULT_DISK_CACHE_STRATEGY)
|
||||||
.error(DEFAULT_ERROR_IMAGE)
|
.placeholder(drawable)
|
||||||
|
.error(drawable)
|
||||||
.animate(DEFAULT_ANIMATION)
|
.animate(DEFAULT_ANIMATION)
|
||||||
.signature(createSignature(builder.song));
|
.signature(createSignature(builder.song));
|
||||||
}
|
}
|
||||||
|
|
|
@ -87,7 +87,7 @@ class PlayingNotificationImpl : PlayingNotification() {
|
||||||
fun update(bitmap: Bitmap?, color: Int) {
|
fun update(bitmap: Bitmap?, color: Int) {
|
||||||
var bitmapFinal = bitmap
|
var bitmapFinal = bitmap
|
||||||
if (bitmapFinal == null) {
|
if (bitmapFinal == null) {
|
||||||
bitmapFinal = BitmapFactory.decodeResource(service.resources, R.drawable.default_album_art)
|
bitmapFinal = BitmapFactory.decodeResource(service.resources, R.drawable.default_audio_art)
|
||||||
}
|
}
|
||||||
|
|
||||||
val toggleFavorite = NotificationCompat.Action(favoriteResId, service.getString(R.string.action_toggle_favorite), retrievePlaybackAction(TOGGLE_FAVORITE))
|
val toggleFavorite = NotificationCompat.Action(favoriteResId, service.getString(R.string.action_toggle_favorite), retrievePlaybackAction(TOGGLE_FAVORITE))
|
||||||
|
|
|
@ -112,8 +112,8 @@ class PlayingNotificationOreo : PlayingNotification() {
|
||||||
notificationLayout.setImageViewBitmap(R.id.largeIcon, bitmap)
|
notificationLayout.setImageViewBitmap(R.id.largeIcon, bitmap)
|
||||||
notificationLayoutBig.setImageViewBitmap(R.id.largeIcon, bitmap)
|
notificationLayoutBig.setImageViewBitmap(R.id.largeIcon, bitmap)
|
||||||
} else {
|
} else {
|
||||||
notificationLayout.setImageViewResource(R.id.largeIcon, R.drawable.default_album_art)
|
notificationLayout.setImageViewResource(R.id.largeIcon, R.drawable.default_audio_art)
|
||||||
notificationLayoutBig.setImageViewResource(R.id.largeIcon, R.drawable.default_album_art)
|
notificationLayoutBig.setImageViewResource(R.id.largeIcon, R.drawable.default_audio_art)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!PreferenceUtil.getInstance(service).coloredNotification()) {
|
if (!PreferenceUtil.getInstance(service).coloredNotification()) {
|
||||||
|
|
|
@ -26,24 +26,19 @@ import code.name.monkey.retromusic.util.PreferenceUtil
|
||||||
import code.name.monkey.retromusic.util.RetroColorUtil
|
import code.name.monkey.retromusic.util.RetroColorUtil
|
||||||
|
|
||||||
|
|
||||||
class ColorIconsImageView : AppCompatImageView {
|
class ColorIconsImageView @JvmOverloads constructor(
|
||||||
|
context: Context,
|
||||||
|
attrs: AttributeSet? = null,
|
||||||
|
defStyleAttr: Int = -1
|
||||||
|
) : AppCompatImageView(context, attrs, defStyleAttr) {
|
||||||
|
|
||||||
constructor(context: Context) : super(context) {
|
|
||||||
init(context, null)
|
|
||||||
}
|
|
||||||
|
|
||||||
constructor(context: Context, attrs: AttributeSet) : super(context, attrs) {
|
init {
|
||||||
init(context, attrs)
|
|
||||||
}
|
|
||||||
|
|
||||||
constructor(context: Context, attrs: AttributeSet, defStyleAttr: Int) : super(context, attrs, defStyleAttr) {
|
|
||||||
init(context, attrs)
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun init(context: Context, attrs: AttributeSet?) {
|
|
||||||
// Load the styled attributes and set their properties
|
// Load the styled attributes and set their properties
|
||||||
val attributes = context.obtainStyledAttributes(attrs, R.styleable.ColorIconsImageView, 0, 0)
|
val attributes =
|
||||||
val color = attributes.getColor(R.styleable.ColorIconsImageView_iconBackgroundColor, Color.RED);
|
context.obtainStyledAttributes(attrs, R.styleable.ColorIconsImageView, 0, 0)
|
||||||
|
val color =
|
||||||
|
attributes.getColor(R.styleable.ColorIconsImageView_iconBackgroundColor, Color.RED);
|
||||||
setIconBackgroundColor(color)
|
setIconBackgroundColor(color)
|
||||||
attributes.recycle()
|
attributes.recycle()
|
||||||
}
|
}
|
||||||
|
@ -53,7 +48,8 @@ class ColorIconsImageView : AppCompatImageView {
|
||||||
if (ATHUtil.isWindowBackgroundDark(context) && PreferenceUtil.getInstance(context).desaturatedColor()) {
|
if (ATHUtil.isWindowBackgroundDark(context) && PreferenceUtil.getInstance(context).desaturatedColor()) {
|
||||||
val desaturatedColor = RetroColorUtil.desaturateColor(color, 0.4f)
|
val desaturatedColor = RetroColorUtil.desaturateColor(color, 0.4f)
|
||||||
backgroundTintList = ColorStateList.valueOf(desaturatedColor)
|
backgroundTintList = ColorStateList.valueOf(desaturatedColor)
|
||||||
imageTintList = ColorStateList.valueOf(ATHUtil.resolveColor(context, R.attr.colorSurface))
|
imageTintList =
|
||||||
|
ColorStateList.valueOf(ATHUtil.resolveColor(context, R.attr.colorSurface))
|
||||||
} else {
|
} else {
|
||||||
backgroundTintList = ColorStateList.valueOf(ColorUtil.adjustAlpha(color, 0.22f))
|
backgroundTintList = ColorStateList.valueOf(ColorUtil.adjustAlpha(color, 0.22f))
|
||||||
imageTintList = ColorStateList.valueOf(ColorUtil.withAlpha(color, 0.75f))
|
imageTintList = ColorStateList.valueOf(ColorUtil.withAlpha(color, 0.75f))
|
||||||
|
|
|
@ -27,14 +27,24 @@ class RetroShapeableImageView @JvmOverloads constructor(
|
||||||
defStyle: Int = -1
|
defStyle: Int = -1
|
||||||
) : ShapeableImageView(context, attrs, defStyle) {
|
) : ShapeableImageView(context, attrs, defStyle) {
|
||||||
|
|
||||||
|
|
||||||
init {
|
init {
|
||||||
val typedArray =
|
val typedArray =
|
||||||
context.obtainStyledAttributes(attrs, R.styleable.RetroShapeableImageView, defStyle, -1)
|
context.obtainStyledAttributes(attrs, R.styleable.RetroShapeableImageView, defStyle, -1)
|
||||||
val cornerSize =
|
val cornerSize =
|
||||||
typedArray.getDimension(R.styleable.RetroShapeableImageView_retroCornerSize, 0f);
|
typedArray.getDimension(R.styleable.RetroShapeableImageView_retroCornerSize, 0f);
|
||||||
|
updateCornerSize(cornerSize)
|
||||||
|
typedArray.recycle()
|
||||||
|
}
|
||||||
|
|
||||||
|
fun updateCornerSize(cornerSize: Float) {
|
||||||
shapeAppearanceModel = ShapeAppearanceModel.Builder()
|
shapeAppearanceModel = ShapeAppearanceModel.Builder()
|
||||||
.setAllCorners(CornerFamily.ROUNDED, cornerSize)
|
.setAllCorners(CornerFamily.ROUNDED, cornerSize)
|
||||||
.build()
|
.build()
|
||||||
typedArray.recycle()
|
}
|
||||||
|
|
||||||
|
//For square
|
||||||
|
override fun onMeasure(widthMeasureSpec: Int, heightMeasureSpec: Int) {
|
||||||
|
super.onMeasure(widthMeasureSpec, widthMeasureSpec)
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -24,31 +24,26 @@ import kotlinx.android.synthetic.main.list_setting_item_view.view.*
|
||||||
/**
|
/**
|
||||||
* Created by hemanths on 2019-12-10.
|
* Created by hemanths on 2019-12-10.
|
||||||
*/
|
*/
|
||||||
class SettingListItemView : FrameLayout {
|
class SettingListItemView @JvmOverloads constructor(
|
||||||
constructor(context: Context) : super(context) {
|
context: Context,
|
||||||
init(context, null)
|
attrs: AttributeSet? = null,
|
||||||
}
|
defStyleAttr: Int = -1,
|
||||||
|
defStyleRes: Int = -1
|
||||||
constructor(context: Context, attrs: AttributeSet?) : super(context, attrs) {
|
) : FrameLayout(context, attrs, defStyleAttr, defStyleRes) {
|
||||||
init(context, attrs)
|
init {
|
||||||
}
|
|
||||||
|
|
||||||
constructor(context: Context, attrs: AttributeSet?, defStyleAttr: Int) : super(context, attrs, defStyleAttr) {
|
|
||||||
init(context, attrs)
|
|
||||||
}
|
|
||||||
|
|
||||||
constructor(context: Context, attrs: AttributeSet?, defStyleAttr: Int, defStyleRes: Int) : super(context, attrs, defStyleAttr, defStyleRes) {
|
|
||||||
init(context, attrs)
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun init(context: Context, attributeSet: AttributeSet?) {
|
|
||||||
View.inflate(context, R.layout.list_setting_item_view, this)
|
View.inflate(context, R.layout.list_setting_item_view, this)
|
||||||
val typedArray = context.obtainStyledAttributes(attributeSet, R.styleable.SettingListItemView)
|
val typedArray =
|
||||||
|
context.obtainStyledAttributes(attrs, R.styleable.SettingListItemView)
|
||||||
icon as ColorIconsImageView
|
icon as ColorIconsImageView
|
||||||
if (typedArray.hasValue(R.styleable.SettingListItemView_settingListItemIcon)) {
|
if (typedArray.hasValue(R.styleable.SettingListItemView_settingListItemIcon)) {
|
||||||
icon.setImageDrawable(typedArray.getDrawable(R.styleable.SettingListItemView_settingListItemIcon))
|
icon.setImageDrawable(typedArray.getDrawable(R.styleable.SettingListItemView_settingListItemIcon))
|
||||||
}
|
}
|
||||||
icon.setIconBackgroundColor(typedArray.getColor(R.styleable.SettingListItemView_settingListItemIconColor, Color.WHITE))
|
icon.setIconBackgroundColor(
|
||||||
|
typedArray.getColor(
|
||||||
|
R.styleable.SettingListItemView_settingListItemIconColor,
|
||||||
|
Color.WHITE
|
||||||
|
)
|
||||||
|
)
|
||||||
title.text = typedArray.getText(R.styleable.SettingListItemView_settingListItemTitle)
|
title.text = typedArray.getText(R.styleable.SettingListItemView_settingListItemTitle)
|
||||||
text.text = typedArray.getText(R.styleable.SettingListItemView_settingListItemText)
|
text.text = typedArray.getText(R.styleable.SettingListItemView_settingListItemText)
|
||||||
typedArray.recycle()
|
typedArray.recycle()
|
||||||
|
|
Before Width: | Height: | Size: 1.8 KiB After Width: | Height: | Size: 5.8 KiB |
Before Width: | Height: | Size: 2.4 KiB After Width: | Height: | Size: 4 KiB |
BIN
app/src/main/res/drawable-hdpi/default_audio_art.webp
Normal file
After Width: | Height: | Size: 2.7 KiB |
Before Width: | Height: | Size: 996 B After Width: | Height: | Size: 3.5 KiB |
Before Width: | Height: | Size: 1.4 KiB After Width: | Height: | Size: 2.4 KiB |
BIN
app/src/main/res/drawable-mdpi/default_audio_art.webp
Normal file
After Width: | Height: | Size: 1.5 KiB |
Before Width: | Height: | Size: 2.9 KiB After Width: | Height: | Size: 8.1 KiB |
Before Width: | Height: | Size: 3.6 KiB After Width: | Height: | Size: 5.9 KiB |
BIN
app/src/main/res/drawable-xhdpi/default_audio_art.webp
Normal file
After Width: | Height: | Size: 4.1 KiB |
Before Width: | Height: | Size: 5.8 KiB After Width: | Height: | Size: 14 KiB |
Before Width: | Height: | Size: 7 KiB After Width: | Height: | Size: 11 KiB |
BIN
app/src/main/res/drawable-xxhdpi/default_audio_art.webp
Normal file
After Width: | Height: | Size: 7.9 KiB |
Before Width: | Height: | Size: 9.7 KiB After Width: | Height: | Size: 21 KiB |
Before Width: | Height: | Size: 11 KiB After Width: | Height: | Size: 17 KiB |
BIN
app/src/main/res/drawable-xxxhdpi/default_audio_art.webp
Normal file
After Width: | Height: | Size: 13 KiB |
|
@ -17,7 +17,7 @@
|
||||||
android:layout_height="@dimen/app_widget_card_image_size"
|
android:layout_height="@dimen/app_widget_card_image_size"
|
||||||
android:scaleType="centerInside"
|
android:scaleType="centerInside"
|
||||||
tools:ignore="ContentDescription"
|
tools:ignore="ContentDescription"
|
||||||
tools:src="@drawable/default_album_art" />
|
tools:src="@drawable/default_audio_art" />
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:id="@+id/media_titles"
|
android:id="@+id/media_titles"
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
android:layout_height="@dimen/app_widget_small_image_size"
|
android:layout_height="@dimen/app_widget_small_image_size"
|
||||||
android:scaleType="centerInside"
|
android:scaleType="centerInside"
|
||||||
tools:ignore="ContentDescription"
|
tools:ignore="ContentDescription"
|
||||||
tools:src="@drawable/default_album_art" />
|
tools:src="@drawable/default_audio_art" />
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:id="@+id/media_actions"
|
android:id="@+id/media_actions"
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_margin="2dp"
|
android:layout_margin="4dp"
|
||||||
android:background="?rectSelector"
|
android:background="?rectSelector"
|
||||||
android:clickable="true"
|
android:clickable="true"
|
||||||
android:focusable="true"
|
android:focusable="true"
|
||||||
|
@ -16,21 +16,14 @@
|
||||||
android:orientation="vertical"
|
android:orientation="vertical"
|
||||||
tools:ignore="UnusedAttribute,UselessParent">
|
tools:ignore="UnusedAttribute,UselessParent">
|
||||||
|
|
||||||
<code.name.monkey.retromusic.views.WidthFitSquareCardView
|
<code.name.monkey.retromusic.views.RetroShapeableImageView
|
||||||
android:id="@+id/imageContainerCard"
|
android:id="@+id/image"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
app:cardCornerRadius="8dp"
|
android:scaleType="centerCrop"
|
||||||
app:cardUseCompatPadding="true">
|
app:retroCornerSize="8dp"
|
||||||
|
tools:ignore="ContentDescription"
|
||||||
<androidx.appcompat.widget.AppCompatImageView
|
tools:srcCompat="@tools:sample/backgrounds/scenic" />
|
||||||
android:id="@+id/image"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="match_parent"
|
|
||||||
android:scaleType="centerCrop"
|
|
||||||
tools:ignore="ContentDescription"
|
|
||||||
tools:srcCompat="@tools:sample/backgrounds/scenic" />
|
|
||||||
</code.name.monkey.retromusic.views.WidthFitSquareCardView>
|
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
|
|
|
@ -7,6 +7,6 @@
|
||||||
android:layout_gravity="start"
|
android:layout_gravity="start"
|
||||||
android:gravity="start"
|
android:gravity="start"
|
||||||
android:padding="16dp"
|
android:padding="16dp"
|
||||||
android:textAppearance="@style/TextViewHeadline5"
|
android:textAppearance="@style/TextViewHeadline6"
|
||||||
android:textStyle="bold"
|
android:textStyle="bold"
|
||||||
tools:text="@tools:sample/lorem" />
|
tools:text="@tools:sample/lorem" />
|