Updates edittext views with corner rounded
This commit is contained in:
parent
7a42723b9e
commit
f9f30c8387
46 changed files with 1127 additions and 1286 deletions
|
@ -14,7 +14,6 @@
|
|||
|
||||
package code.name.monkey.retromusic.dialogs
|
||||
|
||||
import android.content.Context
|
||||
import android.content.res.ColorStateList
|
||||
import android.os.Bundle
|
||||
import android.view.LayoutInflater
|
||||
|
@ -22,28 +21,26 @@ import android.view.View
|
|||
import android.view.ViewGroup
|
||||
import code.name.monkey.appthemehelper.ThemeStore
|
||||
import code.name.monkey.appthemehelper.util.MaterialUtil
|
||||
|
||||
import code.name.monkey.retromusic.R
|
||||
import code.name.monkey.retromusic.model.Song
|
||||
import code.name.monkey.retromusic.util.PlaylistsUtil
|
||||
import code.name.monkey.retromusic.views.RoundedBottomSheetDialogFragment
|
||||
import kotlinx.android.synthetic.main.dialog_playlist.*
|
||||
|
||||
import java.util.*
|
||||
|
||||
class CreatePlaylistDialog : RoundedBottomSheetDialogFragment() {
|
||||
|
||||
|
||||
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {
|
||||
|
||||
return inflater.inflate(R.layout.dialog_playlist, container, false)
|
||||
}
|
||||
|
||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||
super.onViewCreated(view, savedInstanceState)
|
||||
val accentColor = ThemeStore.accentColor(Objects.requireNonNull<Context>(context))
|
||||
|
||||
val songs = arguments!!.getParcelableArrayList<Song>("songs")
|
||||
bannerTitle.setTextColor(ThemeStore.textColorPrimary(context!!))
|
||||
|
||||
val accentColor = ThemeStore.accentColor(context!!)
|
||||
|
||||
MaterialUtil.setTint(actionCreate, true)
|
||||
MaterialUtil.setTint(actionCancel, false)
|
||||
|
@ -51,17 +48,17 @@ class CreatePlaylistDialog : RoundedBottomSheetDialogFragment() {
|
|||
|
||||
actionNewPlaylist.setHintTextColor(ColorStateList.valueOf(accentColor))
|
||||
actionNewPlaylist.setTextColor(ThemeStore.textColorPrimary(context!!))
|
||||
bannerTitle.setTextColor(ThemeStore.textColorPrimary(context!!))
|
||||
|
||||
|
||||
val songs = arguments!!.getParcelableArrayList<Song>("songs")
|
||||
|
||||
actionCancel.setOnClickListener { dismiss() }
|
||||
actionCreate.setOnClickListener {
|
||||
if (activity == null) {
|
||||
return@setOnClickListener
|
||||
}
|
||||
if (!actionNewPlaylist!!.text!!.toString().trim { it <= ' ' }.isEmpty()) {
|
||||
val playlistId = PlaylistsUtil
|
||||
.createPlaylist(activity!!, actionNewPlaylist!!.text!!.toString())
|
||||
val playlistId = PlaylistsUtil.createPlaylist(activity!!, actionNewPlaylist!!.text!!.toString())
|
||||
if (playlistId != -1 && activity != null) {
|
||||
if (songs != null) {
|
||||
PlaylistsUtil.addToPlaylist(activity!!, songs, playlistId, true)
|
||||
|
|
|
@ -48,8 +48,8 @@ class DeletePlaylistDialog : RoundedBottomSheetDialogFragment() {
|
|||
} else {
|
||||
Html.fromHtml(getString(R.string.delete_playlist_x, playlists[0].name))
|
||||
}
|
||||
dialogTitle.text = content
|
||||
dialogTitle.setTextColor(ThemeStore.textColorPrimary(context!!))
|
||||
bannerTitle.text = content
|
||||
bannerTitle.setTextColor(ThemeStore.textColorPrimary(context!!))
|
||||
|
||||
actionDelete.apply {
|
||||
setText(R.string.action_delete)
|
||||
|
|
|
@ -34,7 +34,7 @@ class DeleteSongsDialog : RoundedBottomSheetDialogFragment() {
|
|||
|
||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||
super.onViewCreated(view, savedInstanceState)
|
||||
dialogTitle.setTextColor(ThemeStore.textColorPrimary(context!!))
|
||||
bannerTitle.setTextColor(ThemeStore.textColorPrimary(context!!))
|
||||
//noinspection unchecked,ConstantConditions
|
||||
val songs = arguments!!.getParcelableArrayList<Song>("songs")
|
||||
val content: CharSequence
|
||||
|
@ -44,7 +44,7 @@ class DeleteSongsDialog : RoundedBottomSheetDialogFragment() {
|
|||
} else {
|
||||
getString(R.string.delete_song_x, songs[0].title)
|
||||
}
|
||||
dialogTitle.text = Html.fromHtml(content)
|
||||
bannerTitle.text = Html.fromHtml(content)
|
||||
}
|
||||
actionDelete.apply {
|
||||
setOnClickListener {
|
||||
|
|
|
@ -27,35 +27,33 @@ import code.name.monkey.retromusic.model.PlaylistSong
|
|||
import code.name.monkey.retromusic.model.Song
|
||||
import code.name.monkey.retromusic.util.PlaylistsUtil
|
||||
import code.name.monkey.retromusic.views.RoundedBottomSheetDialogFragment
|
||||
import kotlinx.android.synthetic.main.dialog_remove_from_playlist.*
|
||||
import kotlinx.android.synthetic.main.dialog_delete.*
|
||||
|
||||
|
||||
class RemoveFromPlaylistDialog : RoundedBottomSheetDialogFragment() {
|
||||
|
||||
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {
|
||||
return inflater.inflate(R.layout.dialog_remove_from_playlist, container, false)
|
||||
return inflater.inflate(R.layout.dialog_delete, container, false)
|
||||
}
|
||||
|
||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||
super.onViewCreated(view, savedInstanceState)
|
||||
|
||||
val songs = arguments!!.getParcelableArrayList<Song>("songs")
|
||||
val title: Int
|
||||
val content: CharSequence
|
||||
if (songs!!.size > 1) {
|
||||
title = R.string.remove_songs_from_playlist_title
|
||||
content = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
|
||||
Html.fromHtml(getString(R.string.remove_x_songs_from_playlist, songs.size), Html.FROM_HTML_MODE_LEGACY)
|
||||
} else {
|
||||
Html.fromHtml(getString(R.string.remove_x_songs_from_playlist, songs.size))
|
||||
}
|
||||
} else {
|
||||
title = R.string.remove_song_from_playlist_title
|
||||
content = Html.fromHtml(getString(R.string.remove_song_x_from_playlist, songs[0].title))
|
||||
}
|
||||
bannerTitle.setTextColor(ThemeStore.textColorPrimary(context!!))
|
||||
bannerTitle.text = content;
|
||||
actionDelete.apply {
|
||||
setText(title)
|
||||
setIconResource(R.drawable.ic_delete_white_24dp)
|
||||
setText(R.string.remove_action)
|
||||
setTextColor(ThemeStore.textColorSecondary(context))
|
||||
setOnClickListener {
|
||||
val playlistSongs = ArrayList<PlaylistSong>()
|
||||
|
@ -68,6 +66,7 @@ class RemoveFromPlaylistDialog : RoundedBottomSheetDialogFragment() {
|
|||
|
||||
|
||||
actionCancel.apply {
|
||||
setIconResource(R.drawable.ic_close_white_24dp)
|
||||
setTextColor(ThemeStore.textColorSecondary(context))
|
||||
setOnClickListener { dismiss() }
|
||||
MaterialUtil.setTint(this, false)
|
||||
|
|
|
@ -36,10 +36,14 @@ class RenamePlaylistDialog : RoundedBottomSheetDialogFragment() {
|
|||
|
||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||
super.onViewCreated(view, savedInstanceState)
|
||||
val accentColor = ThemeStore.accentColor(context!!)
|
||||
|
||||
bannerTitle.setTextColor(ThemeStore.textColorPrimary(context!!))
|
||||
bannerTitle.setText(R.string.rename_playlist_title)
|
||||
|
||||
MaterialUtil.setTint(actionNewPlaylistContainer, false)
|
||||
val accentColor = ThemeStore.accentColor(context!!)
|
||||
actionNewPlaylist.setHintTextColor(ColorStateList.valueOf(accentColor))
|
||||
actionNewPlaylist.setTextColor(ThemeStore.textColorPrimary(context!!))
|
||||
|
||||
actionNewPlaylist.apply {
|
||||
var playlistId: Long = 0
|
||||
|
@ -47,14 +51,10 @@ class RenamePlaylistDialog : RoundedBottomSheetDialogFragment() {
|
|||
playlistId = arguments!!.getLong("playlist_id")
|
||||
}
|
||||
setText(PlaylistsUtil.getNameForPlaylist(activity!!, playlistId))
|
||||
setHintTextColor(ColorStateList.valueOf(accentColor))
|
||||
setTextColor(ThemeStore.textColorPrimary(context!!))
|
||||
}
|
||||
|
||||
bannerTitle.setTextColor(ThemeStore.textColorPrimary(context!!))
|
||||
bannerTitle.setText(R.string.rename_playlist_title)
|
||||
actionCancel.apply {
|
||||
MaterialUtil.setTint(actionCancel, false)
|
||||
MaterialUtil.setTint(this, false)
|
||||
setOnClickListener { dismiss() }
|
||||
icon = ContextCompat.getDrawable(context, R.drawable.ic_close_white_24dp)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue