diff --git a/app/build.gradle b/app/build.gradle index 161deb51..91df9694 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -24,7 +24,7 @@ android { vectorDrawables.useSupportLibrary = true applicationId "code.name.monkey.retromusic" - versionCode 417 + versionCode 418 versionName '3.5.100' multiDexEnabled true diff --git a/app/src/main/java/code/name/monkey/retromusic/activities/AlbumDetailsActivity.kt b/app/src/main/java/code/name/monkey/retromusic/activities/AlbumDetailsActivity.kt index 7be3cbeb..0505fe14 100644 --- a/app/src/main/java/code/name/monkey/retromusic/activities/AlbumDetailsActivity.kt +++ b/app/src/main/java/code/name/monkey/retromusic/activities/AlbumDetailsActivity.kt @@ -176,6 +176,14 @@ class AlbumDetailsActivity : AbsSlidingMusicPanelActivity(), AlbumDetailsView, C this.album = album albumTitle.text = album.title + val songText = + resources.getQuantityString( + R.plurals.albumSongs, + album.songCount, + album.songCount + ) + songTitle.text = songText + if (MusicUtil.getYearString(album.year) == "-") { albumText.text = String.format( "%s • %s", @@ -193,7 +201,7 @@ class AlbumDetailsActivity : AbsSlidingMusicPanelActivity(), AlbumDetailsView, C loadAlbumCover() simpleSongAdapter.swapDataSet(album.songs) albumDetailsPresenter.loadMore(album.artistId) - albumDetailsPresenter.aboutAlbum(album.artistName!!, album.title!!) + albumDetailsPresenter.aboutAlbum(album.artistName ?: "-", album.title ?: "-") } override fun moreAlbums(albums: List) { @@ -216,7 +224,8 @@ class AlbumDetailsActivity : AbsSlidingMusicPanelActivity(), AlbumDetailsView, C if (lastFmAlbum.album.wiki != null) { aboutAlbumText.show() aboutAlbumTitle.show() - aboutAlbumTitle.text = String.format(getString(R.string.about_album_label), lastFmAlbum.album.name) + aboutAlbumTitle.text = + String.format(getString(R.string.about_album_label), lastFmAlbum.album.name) aboutAlbumText.text = lastFmAlbum.album.wiki.content } if (lastFmAlbum.album.listeners.isNotEmpty()) { diff --git a/app/src/main/java/code/name/monkey/retromusic/activities/ArtistDetailActivity.kt b/app/src/main/java/code/name/monkey/retromusic/activities/ArtistDetailActivity.kt index e0fdbe4a..86a6bbf3 100755 --- a/app/src/main/java/code/name/monkey/retromusic/activities/ArtistDetailActivity.kt +++ b/app/src/main/java/code/name/monkey/retromusic/activities/ArtistDetailActivity.kt @@ -2,9 +2,7 @@ package code.name.monkey.retromusic.activities import android.app.Activity import android.content.Intent -import android.os.Build import android.os.Bundle -import android.text.Html import android.text.Spanned import android.transition.Slide import android.view.Menu @@ -188,8 +186,21 @@ class ArtistDetailActivity : AbsSlidingMusicPanelActivity(), ArtistDetailsView, MusicUtil.getArtistInfoString(this, artist), MusicUtil.getReadableDurationString(MusicUtil.getTotalDuration(artist.songs)) ) - - songAdapter.swapDataSet(artist.songs) + val songText = + resources.getQuantityString( + R.plurals.albumSongs, + artist.songCount, + artist.songCount + ) + val albumText = + resources.getQuantityString( + R.plurals.albums, + artist.songCount, + artist.songCount + ) + songTitle.text = songText + albumTitle.text =albumText + songAdapter.swapDataSet(artist.songs) albumAdapter.swapDataSet(artist.albums!!) } @@ -208,7 +219,7 @@ class ArtistDetailActivity : AbsSlidingMusicPanelActivity(), ArtistDetailsView, if (bioContent != null && bioContent.trim { it <= ' ' }.isNotEmpty()) { biographyText.visibility = View.VISIBLE biographyTitle.visibility = View.VISIBLE - biography = HtmlCompat.fromHtml(bioContent,HtmlCompat.FROM_HTML_MODE_LEGACY) + biography = HtmlCompat.fromHtml(bioContent, HtmlCompat.FROM_HTML_MODE_LEGACY) biographyText.text = biography if (lastFmArtist.artist.stats.listeners.isNotEmpty()) { listeners.show() diff --git a/app/src/main/java/code/name/monkey/retromusic/activities/MainActivity.java b/app/src/main/java/code/name/monkey/retromusic/activities/MainActivity.java index ad33cfa8..2c90f52b 100644 --- a/app/src/main/java/code/name/monkey/retromusic/activities/MainActivity.java +++ b/app/src/main/java/code/name/monkey/retromusic/activities/MainActivity.java @@ -51,21 +51,20 @@ import org.jetbrains.annotations.Nullable; import java.util.ArrayList; import java.util.List; -import java.util.Locale; import code.name.monkey.appthemehelper.util.ATHUtil; import code.name.monkey.appthemehelper.util.ToolbarContentTintHelper; import code.name.monkey.retromusic.R; import code.name.monkey.retromusic.activities.base.AbsSlidingMusicPanelActivity; import code.name.monkey.retromusic.dialogs.CreatePlaylistDialog; -import code.name.monkey.retromusic.fragments.base.AbsLibraryPagerRecyclerViewCustomGridSizeFragment; import code.name.monkey.retromusic.fragments.albums.AlbumsFragment; import code.name.monkey.retromusic.fragments.artists.ArtistsFragment; +import code.name.monkey.retromusic.fragments.base.AbsLibraryPagerRecyclerViewCustomGridSizeFragment; +import code.name.monkey.retromusic.fragments.genres.GenresFragment; import code.name.monkey.retromusic.fragments.home.BannerHomeFragment; import code.name.monkey.retromusic.fragments.mainactivity.FoldersFragment; -import code.name.monkey.retromusic.fragments.genres.GenresFragment; -import code.name.monkey.retromusic.fragments.queue.PlayingQueueFragment; import code.name.monkey.retromusic.fragments.playlists.PlaylistsFragment; +import code.name.monkey.retromusic.fragments.queue.PlayingQueueFragment; import code.name.monkey.retromusic.fragments.songs.SongsFragment; import code.name.monkey.retromusic.helper.MusicPlayerRemote; import code.name.monkey.retromusic.helper.SearchQueryHelper; @@ -765,16 +764,9 @@ public class MainActivity extends AbsSlidingMusicPanelActivity @Override public void run() { TransitionManager.beginDelayedTransition(mToolbar); - Log.i(TAG, "run: " + Thread.currentThread().getName()); mAppTitle.setVisibility(View.GONE); setTitle(R.string.action_search); } }, 3000); - - Locale[] locales = Locale.getAvailableLocales(); - - for (Locale l : locales) { - Log.d(TAG, "setupToolbar: " + l.toLanguageTag()); - } } } diff --git a/app/src/main/java/code/name/monkey/retromusic/adapter/song/ShuffleButtonSongAdapter.kt b/app/src/main/java/code/name/monkey/retromusic/adapter/song/ShuffleButtonSongAdapter.kt index 32a4d141..4f3935ad 100644 --- a/app/src/main/java/code/name/monkey/retromusic/adapter/song/ShuffleButtonSongAdapter.kt +++ b/app/src/main/java/code/name/monkey/retromusic/adapter/song/ShuffleButtonSongAdapter.kt @@ -2,13 +2,11 @@ package code.name.monkey.retromusic.adapter.song import android.view.View import androidx.appcompat.app.AppCompatActivity -import androidx.appcompat.widget.PopupMenu import code.name.monkey.retromusic.R import code.name.monkey.retromusic.helper.MusicPlayerRemote import code.name.monkey.retromusic.interfaces.CabHolder import code.name.monkey.retromusic.model.Song -import code.name.monkey.retromusic.util.PreferenceUtil -import com.google.android.material.textview.MaterialTextView +import com.google.android.material.button.MaterialButton class ShuffleButtonSongAdapter( activity: AppCompatActivity, @@ -17,75 +15,38 @@ class ShuffleButtonSongAdapter( cabHolder: CabHolder? ) : AbsOffsetSongAdapter(activity, dataSet, itemLayoutRes, cabHolder) { - override fun createViewHolder(view: View): ViewHolder { + override fun createViewHolder(view: View): SongAdapter.ViewHolder { return ViewHolder(view) } override fun onBindViewHolder(holder: SongAdapter.ViewHolder, position: Int) { if (holder.itemViewType == OFFSET_ITEM) { val viewHolder = holder as ViewHolder - val info = - activity.resources.getQuantityString( - R.plurals.numSongs, - dataSet.size, - dataSet.size - ) - viewHolder.info?.text = info - viewHolder.shuffleAction?.setOnClickListener { - MusicPlayerRemote.openAndShuffleQueue(dataSet, true) + viewHolder.playAction?.let { + it.setOnClickListener { + MusicPlayerRemote.openQueue(dataSet, 0, true) + } + } + viewHolder.shuffleAction?.let { + it.setOnClickListener { + MusicPlayerRemote.openAndShuffleQueue(dataSet, true) + } } - showChangeLayout(viewHolder) - showSortMenu(viewHolder) - } else { super.onBindViewHolder(holder, position - 1) } } - private fun showChangeLayout(viewHolder: ViewHolder) { - viewHolder.changeLayoutType?.setOnClickListener { - val popupMenu = PopupMenu(activity, viewHolder.changeLayoutType) - popupMenu.inflate(R.menu.menu_layout_types) - popupMenu.setOnMenuItemClickListener { - when (it.itemId) { - R.layout.item_card -> - popupMenu.menu.findItem(R.id.action_layout_card).isChecked = true - R.layout.item_grid -> - popupMenu.menu.findItem(R.id.action_layout_normal).isChecked = true - - R.layout.item_card_color -> - popupMenu.menu.findItem(R.id.action_layout_colored_card).isChecked = true - - R.layout.item_grid_circle -> - popupMenu.menu.findItem(R.id.action_layout_circular).isChecked = true - - R.layout.image -> - popupMenu.menu.findItem(R.id.action_layout_image).isChecked = true - - R.layout.item_image_gradient -> - popupMenu.menu.findItem(R.id.action_layout_gradient_image).isChecked = true - } - PreferenceUtil.getInstance(activity).songGridStyle = it.itemId - true - } - popupMenu.show() - popupMenu.menu - .findItem(PreferenceUtil.getInstance(activity).songGridStyle).isChecked = true - } - } - - private fun showSortMenu(viewHolder: ViewHolder) { - viewHolder.sortOrder?.setOnClickListener { - val popupMenu = PopupMenu(activity, viewHolder.sortOrder) - popupMenu.inflate(R.menu.menu_song_sort_order) - popupMenu.show() - } - } - inner class ViewHolder(itemView: View) : AbsOffsetSongAdapter.ViewHolder(itemView) { - val sortOrder: View? = itemView.findViewById(R.id.sortOrder) - val changeLayoutType: View? = itemView.findViewById(R.id.changeLayoutType) - val shuffleAction: View? = itemView.findViewById(R.id.shuffleAction) - val info: MaterialTextView? = itemView.findViewById(R.id.info) + val playAction: MaterialButton? = itemView.findViewById(R.id.playAction) + val shuffleAction: MaterialButton? = itemView.findViewById(R.id.shuffleAction) + + override fun onClick(v: View?) { + if (itemViewType == OFFSET_ITEM) { + MusicPlayerRemote.openAndShuffleQueue(dataSet, true) + return + } + super.onClick(v) + } } } \ No newline at end of file diff --git a/app/src/main/java/code/name/monkey/retromusic/glide/ArtistGlideRequest.java b/app/src/main/java/code/name/monkey/retromusic/glide/ArtistGlideRequest.java index c1e1390d..e45bf46d 100644 --- a/app/src/main/java/code/name/monkey/retromusic/glide/ArtistGlideRequest.java +++ b/app/src/main/java/code/name/monkey/retromusic/glide/ArtistGlideRequest.java @@ -125,6 +125,7 @@ public class ArtistGlideRequest { .asBitmap() .diskCacheStrategy(DEFAULT_DISK_CACHE_STRATEGY) .animate(DEFAULT_ANIMATION) + .error(DEFAULT_ERROR_IMAGE) .priority(Priority.LOW) .override(Target.SIZE_ORIGINAL, Target.SIZE_ORIGINAL) .dontTransform() @@ -150,6 +151,7 @@ public class ArtistGlideRequest { .asBitmap() .transcode(new BitmapPaletteTranscoder(context), BitmapPaletteWrapper.class) .diskCacheStrategy(DEFAULT_DISK_CACHE_STRATEGY) + .error(DEFAULT_ERROR_IMAGE) .animate(DEFAULT_ANIMATION) .priority(Priority.LOW) .override(Target.SIZE_ORIGINAL, Target.SIZE_ORIGINAL) diff --git a/app/src/main/res/layout/item_list_quick_actions.xml b/app/src/main/res/layout/item_list_quick_actions.xml index 4339cd71..c90ac8a2 100644 --- a/app/src/main/res/layout/item_list_quick_actions.xml +++ b/app/src/main/res/layout/item_list_quick_actions.xml @@ -12,71 +12,35 @@ ~ See the GNU General Public License for more details. --> - + android:orientation="horizontal" + android:paddingStart="8dp" + android:paddingEnd="8dp"> - - - + app:backgroundTint="?attr/colorSurface" + app:icon="@drawable/ic_play_arrow_white_24dp" /> - - - - - + app:backgroundTint="?attr/colorSurface" + app:icon="@drawable/ic_shuffle_white_24dp" /> - \ No newline at end of file + \ No newline at end of file diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 20b728aa..1b104003 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -851,6 +851,14 @@ Translators The people who helped translate this app + + Song + Songs + + + Album + Albums + %d Song %d Songs