Fix edit text handle colors
This commit is contained in:
parent
1145405832
commit
b7ed2488f2
9 changed files with 72 additions and 115 deletions
|
@ -18,6 +18,7 @@ import code.name.monkey.appthemehelper.util.MaterialUtil
|
|||
import code.name.monkey.appthemehelper.util.TintHelper
|
||||
import code.name.monkey.appthemehelper.util.ToolbarContentTintHelper
|
||||
import code.name.monkey.retromusic.R
|
||||
import code.name.monkey.retromusic.extensions.appHandleColor
|
||||
import code.name.monkey.retromusic.glide.GlideApp
|
||||
import code.name.monkey.retromusic.glide.RetroSimpleTarget
|
||||
import code.name.monkey.retromusic.glide.palette.BitmapPaletteWrapper
|
||||
|
@ -95,10 +96,10 @@ class AlbumTagEditorActivity : AbsTagEditorActivity(), TextWatcher {
|
|||
MaterialUtil.setTint(albumTitleContainer, false)
|
||||
MaterialUtil.setTint(albumArtistContainer, false)
|
||||
|
||||
albumText.addTextChangedListener(this)
|
||||
albumArtistText.addTextChangedListener(this)
|
||||
genreTitle.addTextChangedListener(this)
|
||||
yearTitle.addTextChangedListener(this)
|
||||
albumText.appHandleColor().addTextChangedListener(this)
|
||||
albumArtistText.appHandleColor().addTextChangedListener(this)
|
||||
genreTitle.appHandleColor().addTextChangedListener(this)
|
||||
yearTitle.appHandleColor().addTextChangedListener(this)
|
||||
}
|
||||
|
||||
private fun fillViewsWithFileTags() {
|
||||
|
|
|
@ -9,6 +9,7 @@ import code.name.monkey.appthemehelper.ThemeStore
|
|||
import code.name.monkey.appthemehelper.util.MaterialUtil
|
||||
import code.name.monkey.appthemehelper.util.TintHelper
|
||||
import code.name.monkey.retromusic.R
|
||||
import code.name.monkey.retromusic.extensions.appHandleColor
|
||||
import code.name.monkey.retromusic.loaders.SongLoader
|
||||
import kotlinx.android.synthetic.main.activity_song_tag_editor.*
|
||||
import org.jaudiotagger.tag.FieldKey
|
||||
|
@ -44,6 +45,7 @@ class SongTagEditorActivity : AbsTagEditorActivity(), TextWatcher {
|
|||
private fun setUpViews() {
|
||||
fillViewsWithFileTags()
|
||||
MaterialUtil.setTint(songTextContainer, false)
|
||||
|
||||
MaterialUtil.setTint(composerContainer, false)
|
||||
MaterialUtil.setTint(albumTextContainer, false)
|
||||
MaterialUtil.setTint(artistContainer, false)
|
||||
|
@ -53,15 +55,14 @@ class SongTagEditorActivity : AbsTagEditorActivity(), TextWatcher {
|
|||
MaterialUtil.setTint(trackNumberContainer, false)
|
||||
MaterialUtil.setTint(lyricsContainer, false)
|
||||
|
||||
albumText.addTextChangedListener(this)
|
||||
songText.addTextChangedListener(this)
|
||||
albumText.addTextChangedListener(this)
|
||||
artistText.addTextChangedListener(this)
|
||||
genreText.addTextChangedListener(this)
|
||||
yearText.addTextChangedListener(this)
|
||||
trackNumberText.addTextChangedListener(this)
|
||||
lyricsText.addTextChangedListener(this)
|
||||
songComposerText.addTextChangedListener(this)
|
||||
songText.appHandleColor().addTextChangedListener(this)
|
||||
albumText.appHandleColor().addTextChangedListener(this)
|
||||
artistText.appHandleColor().addTextChangedListener(this)
|
||||
genreText.appHandleColor().addTextChangedListener(this)
|
||||
yearText.appHandleColor().addTextChangedListener(this)
|
||||
trackNumberText.appHandleColor().addTextChangedListener(this)
|
||||
lyricsText.appHandleColor().addTextChangedListener(this)
|
||||
songComposerText.appHandleColor().addTextChangedListener(this)
|
||||
}
|
||||
|
||||
private fun fillViewsWithFileTags() {
|
||||
|
@ -132,3 +133,5 @@ class SongTagEditorActivity : AbsTagEditorActivity(), TextWatcher {
|
|||
val TAG: String = SongTagEditorActivity::class.java.simpleName
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -24,6 +24,7 @@ import code.name.monkey.appthemehelper.util.MaterialUtil
|
|||
import code.name.monkey.retromusic.R
|
||||
import code.name.monkey.retromusic.R.layout
|
||||
import code.name.monkey.retromusic.R.string
|
||||
import code.name.monkey.retromusic.extensions.appHandleColor
|
||||
import code.name.monkey.retromusic.model.Song
|
||||
import code.name.monkey.retromusic.util.PlaylistsUtil
|
||||
import com.afollestad.materialdialogs.MaterialDialog
|
||||
|
@ -70,7 +71,7 @@ class CreatePlaylistDialog : DialogFragment() {
|
|||
MaterialUtil.setTint(actionNewPlaylistContainer, false)
|
||||
|
||||
val playlistId = arguments!!.getLong(MediaStore.Audio.Playlists.Members.PLAYLIST_ID)
|
||||
playlistView.setText(PlaylistsUtil.getNameForPlaylist(context!!, playlistId), TextView.BufferType.EDITABLE)
|
||||
playlistView.appHandleColor().setText(PlaylistsUtil.getNameForPlaylist(context!!, playlistId), TextView.BufferType.EDITABLE)
|
||||
return materialDialog
|
||||
}
|
||||
|
||||
|
|
|
@ -24,6 +24,7 @@ import code.name.monkey.appthemehelper.util.MaterialUtil
|
|||
import code.name.monkey.retromusic.R
|
||||
import code.name.monkey.retromusic.R.layout
|
||||
import code.name.monkey.retromusic.R.string
|
||||
import code.name.monkey.retromusic.extensions.appHandleColor
|
||||
import code.name.monkey.retromusic.util.PlaylistsUtil
|
||||
import com.afollestad.materialdialogs.MaterialDialog
|
||||
import com.afollestad.materialdialogs.WhichButton
|
||||
|
@ -36,46 +37,6 @@ import com.google.android.material.textfield.TextInputLayout
|
|||
|
||||
|
||||
class RenamePlaylistDialog : DialogFragment() {
|
||||
|
||||
/*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)
|
||||
|
||||
|
||||
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
|
||||
if (arguments != null) {
|
||||
playlistId = arguments!!.getLong("playlist_id")
|
||||
}
|
||||
setText(PlaylistsUtil.getNameForPlaylist(activity!!, playlistId))
|
||||
}
|
||||
|
||||
actionCancel.apply {
|
||||
MaterialUtil.setTint(this, false)
|
||||
setOnClickListener { dismiss() }
|
||||
icon = ContextCompat.getDrawable(context, R.drawable.ic_close_white_24dp)
|
||||
}
|
||||
|
||||
actionCreate.apply {
|
||||
setText(R.string.action_rename)
|
||||
setOnClickListener {
|
||||
if (actionNewPlaylist.toString().trim { it <= ' ' } != "") {
|
||||
val playlistId = arguments!!.getLong("playlist_id")
|
||||
PlaylistsUtil.renamePlaylist(context!!, playlistId, actionNewPlaylist.text!!.toString())
|
||||
}
|
||||
}
|
||||
MaterialUtil.setTint(this)
|
||||
icon = ContextCompat.getDrawable(context, R.drawable.ic_edit_white_24dp)
|
||||
}
|
||||
}*/
|
||||
private lateinit var playlistView: TextInputEditText
|
||||
private lateinit var actionNewPlaylistContainer: TextInputLayout
|
||||
|
||||
|
@ -101,7 +62,7 @@ class RenamePlaylistDialog : DialogFragment() {
|
|||
MaterialUtil.setTint(actionNewPlaylistContainer, false)
|
||||
|
||||
val playlistId = arguments!!.getLong(PLAYLIST_ID)
|
||||
playlistView.setText(PlaylistsUtil.getNameForPlaylist(context!!, playlistId), TextView.BufferType.EDITABLE)
|
||||
playlistView.appHandleColor().setText(PlaylistsUtil.getNameForPlaylist(context!!, playlistId), TextView.BufferType.EDITABLE)
|
||||
return materialDialog
|
||||
}
|
||||
|
||||
|
|
|
@ -17,7 +17,10 @@ package code.name.monkey.retromusic.extensions
|
|||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import android.widget.EditText
|
||||
import androidx.annotation.LayoutRes
|
||||
import code.name.monkey.appthemehelper.ThemeStore
|
||||
import code.name.monkey.appthemehelper.util.TintHelper
|
||||
|
||||
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
|
@ -33,4 +36,9 @@ fun View.hide() {
|
|||
visibility = View.GONE
|
||||
}
|
||||
|
||||
fun View.showOrHide(show: Boolean) = if (show) show() else hide()
|
||||
fun View.showOrHide(show: Boolean) = if (show) show() else hide()
|
||||
|
||||
fun EditText.appHandleColor(): EditText {
|
||||
TintHelper.colorHandles(this, ThemeStore.accentColor(context))
|
||||
return this
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue