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 801fd1ab..2714447b 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 @@ -1,16 +1,12 @@ package code.name.monkey.retromusic.adapter.song import android.view.View -import android.widget.PopupMenu import androidx.appcompat.app.AppCompatActivity -import androidx.appcompat.widget.AppCompatImageView import code.name.monkey.retromusic.R import code.name.monkey.retromusic.helper.MusicPlayerRemote -import code.name.monkey.retromusic.helper.SortOrder.SongSortOrder 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, @@ -32,77 +28,14 @@ class ShuffleButtonSongAdapter( viewHolder.shuffleAction?.setOnClickListener { MusicPlayerRemote.openAndShuffleQueue(dataSet, true) } - val songCount = activity.resources.getQuantityString(R.plurals.songCount, dataSet.size, dataSet.size) - viewHolder.songCount?.text = songCount - viewHolder.sortAction?.setOnClickListener { - showSortPopupMenu(it) - } } else { super.onBindViewHolder(holder, position - 1) } } - private fun showGridPopupMenu(view: View) { - val popupMenu = PopupMenu(activity, view) - popupMenu.menuInflater.inflate(R.menu.menu_grid_options, popupMenu.menu) - popupMenu.setOnMenuItemClickListener { - when (it.itemId) { - R.id.action_grid_size_1 -> { - PreferenceUtil.getInstance(activity).setSongGridSize(1) - } - R.id.action_grid_size_2 -> { - PreferenceUtil.getInstance(activity).setSongGridSize(2) - } - R.id.action_grid_size_3 -> { - PreferenceUtil.getInstance(activity).setSongGridSize(3) - } - R.id.action_grid_size_4 -> { - PreferenceUtil.getInstance(activity).setSongGridSize(4) - } - - } - return@setOnMenuItemClickListener true - } - popupMenu.show() - } - - private fun showSortPopupMenu(view: View) { - val popupMenu = PopupMenu(activity, view) - popupMenu.menuInflater.inflate(R.menu.menu_song_sort, popupMenu.menu) - popupMenu.setOnMenuItemClickListener { - when (it.itemId) { - R.id.action_song_sort_order_asc -> { - PreferenceUtil.getInstance(activity).songSortOrder = SongSortOrder.SONG_A_Z - } - R.id.action_song_sort_order_desc -> { - PreferenceUtil.getInstance(activity).songSortOrder = SongSortOrder.SONG_Z_A - } - R.id.action_song_sort_order_artist -> { - PreferenceUtil.getInstance(activity).songSortOrder = SongSortOrder.SONG_ARTIST - } - R.id.action_song_sort_order_album -> { - PreferenceUtil.getInstance(activity).songSortOrder = SongSortOrder.SONG_ALBUM - } - R.id.action_song_sort_order_date -> { - PreferenceUtil.getInstance(activity).songSortOrder = SongSortOrder.SONG_DATE - } - R.id.action_song_sort_order_composer -> { - PreferenceUtil.getInstance(activity).songSortOrder = SongSortOrder.COMPOSER - } - R.id.action_song_sort_order_year -> { - PreferenceUtil.getInstance(activity).songSortOrder = SongSortOrder.SONG_YEAR - } - } - return@setOnMenuItemClickListener true - } - popupMenu.show() - } - inner class ViewHolder(itemView: View) : AbsOffsetSongAdapter.ViewHolder(itemView) { - val playAction: AppCompatImageView? = itemView.findViewById(R.id.playAction) - val shuffleAction: AppCompatImageView? = itemView.findViewById(R.id.shuffleAction) - val sortAction: AppCompatImageView? = itemView.findViewById(R.id.sortAction) - val songCount: MaterialTextView? = itemView.findViewById(R.id.songCount) + 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) { diff --git a/app/src/main/java/code/name/monkey/retromusic/fragments/mainactivity/SongsFragment.kt b/app/src/main/java/code/name/monkey/retromusic/fragments/mainactivity/SongsFragment.kt index b2ceea28..66529505 100644 --- a/app/src/main/java/code/name/monkey/retromusic/fragments/mainactivity/SongsFragment.kt +++ b/app/src/main/java/code/name/monkey/retromusic/fragments/mainactivity/SongsFragment.kt @@ -1,7 +1,5 @@ package code.name.monkey.retromusic.fragments.mainactivity -import android.content.SharedPreferences -import android.content.SharedPreferences.OnSharedPreferenceChangeListener import android.os.Bundle import android.view.View import androidx.annotation.LayoutRes @@ -20,7 +18,7 @@ import java.util.ArrayList import javax.inject.Inject class SongsFragment : AbsLibraryPagerRecyclerViewCustomGridSizeFragment(), - SongView, MainActivityFragmentCallbacks, OnSharedPreferenceChangeListener { + SongView, MainActivityFragmentCallbacks { @Inject lateinit var songPresenter: SongPresenter @@ -84,13 +82,11 @@ class SongsFragment : AbsLibraryPagerRecyclerViewCustomGridSizeFragment - - - - - \ No newline at end of file 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 4e67689a..c90ac8a2 100644 --- a/app/src/main/res/layout/item_list_quick_actions.xml +++ b/app/src/main/res/layout/item_list_quick_actions.xml @@ -14,44 +14,33 @@ + android:paddingStart="8dp" + android:paddingEnd="8dp"> - + android:text="@string/action_play_all" + app:backgroundTint="?attr/colorSurface" + app:icon="@drawable/ic_play_arrow_white_24dp" /> - - - - - + android:layout_marginStart="4dp" + android:layout_marginEnd="4dp" + android:layout_weight="1" + android:text="@string/shuffle" + app:backgroundTint="?attr/colorSurface" + app:icon="@drawable/ic_shuffle_white_24dp" /> \ No newline at end of file diff --git a/app/src/main/res/menu/menu_grid_options.xml b/app/src/main/res/menu/menu_grid_options.xml deleted file mode 100644 index 156927e6..00000000 --- a/app/src/main/res/menu/menu_grid_options.xml +++ /dev/null @@ -1,28 +0,0 @@ - - - - - - - - \ No newline at end of file diff --git a/app/src/main/res/menu/menu_song_sort.xml b/app/src/main/res/menu/menu_song_sort.xml deleted file mode 100644 index b6126f42..00000000 --- a/app/src/main/res/menu/menu_song_sort.xml +++ /dev/null @@ -1,37 +0,0 @@ - - - - - - - - - - - \ No newline at end of file diff --git a/app/src/main/res/values-night-v27/styles.xml b/app/src/main/res/values-night-v27/styles.xml index accac239..ba94dab7 100644 --- a/app/src/main/res/values-night-v27/styles.xml +++ b/app/src/main/res/values-night-v27/styles.xml @@ -34,7 +34,6 @@ false @color/darkColorSurface - @style/RetroPopupTheme - @style/RetroPopupTheme + \ No newline at end of file diff --git a/app/src/main/res/values-night/styles.xml b/app/src/main/res/values-night/styles.xml index 0f585cd0..e53f21ee 100644 --- a/app/src/main/res/values-night/styles.xml +++ b/app/src/main/res/values-night/styles.xml @@ -34,6 +34,5 @@ @color/darkColorPrimary @color/darkColorSurface - @style/RetroPopupTheme \ No newline at end of file diff --git a/app/src/main/res/values-v27/styles_parents.xml b/app/src/main/res/values-v27/styles_parents.xml index 95975838..bb5dd329 100644 --- a/app/src/main/res/values-v27/styles_parents.xml +++ b/app/src/main/res/values-v27/styles_parents.xml @@ -31,8 +31,7 @@ @drawable/rect_selector @style/Widget.ActionButton.Overflow true - @style/RetroPopupTheme - @style/RetroPopupTheme + \ 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 b26236b0..3b09e0dd 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -827,8 +827,4 @@ Retro Music Player Pro Free - - %d Song - %d Songs - diff --git a/app/src/main/res/values/styles.xml b/app/src/main/res/values/styles.xml index 0976e75a..6a4338d2 100644 --- a/app/src/main/res/values/styles.xml +++ b/app/src/main/res/values/styles.xml @@ -183,9 +183,4 @@ @drawable/splash @android:color/transparent - - diff --git a/app/src/main/res/values/styles_parents.xml b/app/src/main/res/values/styles_parents.xml index 0b9290a7..a4ffc86f 100644 --- a/app/src/main/res/values/styles_parents.xml +++ b/app/src/main/res/values/styles_parents.xml @@ -17,8 +17,7 @@ @drawable/round_selector @drawable/rect_selector @style/Widget.ActionButton.Overflow - @style/RetroPopupTheme - @style/RetroPopupTheme +