Fix blacklist dialog
This commit is contained in:
parent
eaa2e258c6
commit
fea94f7d78
2 changed files with 48 additions and 7 deletions
|
@ -2,7 +2,6 @@ package code.name.monkey.retromusic.adapter.song
|
||||||
|
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import androidx.appcompat.app.AppCompatActivity
|
import androidx.appcompat.app.AppCompatActivity
|
||||||
import androidx.appcompat.widget.AppCompatImageView
|
|
||||||
import androidx.appcompat.widget.PopupMenu
|
import androidx.appcompat.widget.PopupMenu
|
||||||
import code.name.monkey.retromusic.R
|
import code.name.monkey.retromusic.R
|
||||||
import code.name.monkey.retromusic.helper.MusicPlayerRemote
|
import code.name.monkey.retromusic.helper.MusicPlayerRemote
|
||||||
|
@ -25,8 +24,13 @@ class ShuffleButtonSongAdapter(
|
||||||
override fun onBindViewHolder(holder: SongAdapter.ViewHolder, position: Int) {
|
override fun onBindViewHolder(holder: SongAdapter.ViewHolder, position: Int) {
|
||||||
if (holder.itemViewType == OFFSET_ITEM) {
|
if (holder.itemViewType == OFFSET_ITEM) {
|
||||||
val viewHolder = holder as ViewHolder
|
val viewHolder = holder as ViewHolder
|
||||||
viewHolder.info?.text =
|
val info =
|
||||||
activity.resources.getQuantityString(R.plurals.numSongs, dataSet.size, dataSet.size)
|
activity.resources.getQuantityString(
|
||||||
|
R.plurals.numSongs,
|
||||||
|
dataSet.size,
|
||||||
|
dataSet.size
|
||||||
|
)
|
||||||
|
viewHolder.info?.text = info
|
||||||
viewHolder.shuffleAction?.setOnClickListener {
|
viewHolder.shuffleAction?.setOnClickListener {
|
||||||
MusicPlayerRemote.openAndShuffleQueue(dataSet, true)
|
MusicPlayerRemote.openAndShuffleQueue(dataSet, true)
|
||||||
}
|
}
|
||||||
|
@ -42,20 +46,45 @@ class ShuffleButtonSongAdapter(
|
||||||
viewHolder.changeLayoutType?.setOnClickListener {
|
viewHolder.changeLayoutType?.setOnClickListener {
|
||||||
val popupMenu = PopupMenu(activity, viewHolder.changeLayoutType)
|
val popupMenu = PopupMenu(activity, viewHolder.changeLayoutType)
|
||||||
popupMenu.inflate(R.menu.menu_layout_types)
|
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.show()
|
||||||
|
popupMenu.menu
|
||||||
|
.findItem(PreferenceUtil.getInstance(activity).songGridStyle).isChecked = true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun showSortMenu(viewHolder: ViewHolder) {
|
private fun showSortMenu(viewHolder: ViewHolder) {
|
||||||
viewHolder.sortOrder?.setOnClickListener {
|
viewHolder.sortOrder?.setOnClickListener {
|
||||||
val popupMenu = PopupMenu(activity, viewHolder.sortOrder)
|
val popupMenu = PopupMenu(activity, viewHolder.sortOrder)
|
||||||
|
popupMenu.inflate(R.menu.menu_song_sort_order)
|
||||||
popupMenu.show()
|
popupMenu.show()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
inner class ViewHolder(itemView: View) : AbsOffsetSongAdapter.ViewHolder(itemView) {
|
inner class ViewHolder(itemView: View) : AbsOffsetSongAdapter.ViewHolder(itemView) {
|
||||||
val sortOrder: AppCompatImageView? = itemView.findViewById(R.id.sortOrder)
|
val sortOrder: View? = itemView.findViewById(R.id.sortOrder)
|
||||||
val changeLayoutType: AppCompatImageView? = itemView.findViewById(R.id.changeLayoutType)
|
val changeLayoutType: View? = itemView.findViewById(R.id.changeLayoutType)
|
||||||
val shuffleAction: View? = itemView.findViewById(R.id.shuffleAction)
|
val shuffleAction: View? = itemView.findViewById(R.id.shuffleAction)
|
||||||
val info: MaterialTextView? = itemView.findViewById(R.id.info)
|
val info: MaterialTextView? = itemView.findViewById(R.id.info)
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,11 +26,23 @@
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:padding="16dp"
|
android:padding="16dp"
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
app:layout_constraintEnd_toStartOf="@id/sortOrder"
|
app:layout_constraintEnd_toStartOf="@id/gridSize"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintTop_toTopOf="parent"
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
tools:text="@tools:sample/full_names" />
|
tools:text="@tools:sample/full_names" />
|
||||||
|
|
||||||
|
<androidx.appcompat.widget.AppCompatImageView
|
||||||
|
android:id="@+id/gridSize"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:padding="16dp"
|
||||||
|
android:text="@string/action_play_all"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintEnd_toStartOf="@id/sortOrder"
|
||||||
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
|
app:srcCompat="@drawable/ic_grid_size_white_24dp"
|
||||||
|
app:tint="?android:attr/colorControlNormal" />
|
||||||
|
|
||||||
<androidx.appcompat.widget.AppCompatImageView
|
<androidx.appcompat.widget.AppCompatImageView
|
||||||
android:id="@+id/sortOrder"
|
android:id="@+id/sortOrder"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
|
@ -52,7 +64,7 @@
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
app:layout_constraintEnd_toStartOf="@id/shuffleAction"
|
app:layout_constraintEnd_toStartOf="@id/shuffleAction"
|
||||||
app:layout_constraintTop_toTopOf="parent"
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
app:srcCompat="@drawable/ic_grid_size_white_24dp"
|
app:srcCompat="@drawable/ic_dashboard_white_24dp"
|
||||||
app:tint="?android:attr/colorControlNormal" />
|
app:tint="?android:attr/colorControlNormal" />
|
||||||
|
|
||||||
<androidx.appcompat.widget.AppCompatImageView
|
<androidx.appcompat.widget.AppCompatImageView
|
||||||
|
|
Loading…
Reference in a new issue