diff --git a/app/src/main/assets/retro-changelog.html b/app/src/main/assets/retro-changelog.html index 96a43f89..06dd1a17 100644 --- a/app/src/main/assets/retro-changelog.html +++ b/app/src/main/assets/retro-changelog.html @@ -1 +1 @@ -
If you see entire app white or dark or black select same theme in settings to fix
*If you face any UI related issues you clear app data and cache, if its not working try to uninstall and install again.
\ No newline at end of file +If you see entire app white or dark or black select same theme in settings to fix
*If you face any UI related issues you clear app data and cache, if its not working try to uninstall and install again.
\ No newline at end of file diff --git a/app/src/main/java/code/name/monkey/retromusic/activities/tageditor/AlbumTagEditorActivity.kt b/app/src/main/java/code/name/monkey/retromusic/activities/tageditor/AlbumTagEditorActivity.kt index bd843394..244989eb 100755 --- a/app/src/main/java/code/name/monkey/retromusic/activities/tageditor/AlbumTagEditorActivity.kt +++ b/app/src/main/java/code/name/monkey/retromusic/activities/tageditor/AlbumTagEditorActivity.kt @@ -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() { diff --git a/app/src/main/java/code/name/monkey/retromusic/activities/tageditor/SongTagEditorActivity.kt b/app/src/main/java/code/name/monkey/retromusic/activities/tageditor/SongTagEditorActivity.kt index f42faca7..ed909898 100755 --- a/app/src/main/java/code/name/monkey/retromusic/activities/tageditor/SongTagEditorActivity.kt +++ b/app/src/main/java/code/name/monkey/retromusic/activities/tageditor/SongTagEditorActivity.kt @@ -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 } } + + diff --git a/app/src/main/java/code/name/monkey/retromusic/dialogs/CreatePlaylistDialog.kt b/app/src/main/java/code/name/monkey/retromusic/dialogs/CreatePlaylistDialog.kt index 6e361e27..ba89e4a6 100644 --- a/app/src/main/java/code/name/monkey/retromusic/dialogs/CreatePlaylistDialog.kt +++ b/app/src/main/java/code/name/monkey/retromusic/dialogs/CreatePlaylistDialog.kt @@ -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 } diff --git a/app/src/main/java/code/name/monkey/retromusic/dialogs/RenamePlaylistDialog.kt b/app/src/main/java/code/name/monkey/retromusic/dialogs/RenamePlaylistDialog.kt index 78db3913..8e5173c6 100644 --- a/app/src/main/java/code/name/monkey/retromusic/dialogs/RenamePlaylistDialog.kt +++ b/app/src/main/java/code/name/monkey/retromusic/dialogs/RenamePlaylistDialog.kt @@ -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 } diff --git a/app/src/main/java/code/name/monkey/retromusic/extensions/ViewExtensions.kt b/app/src/main/java/code/name/monkey/retromusic/extensions/ViewExtensions.kt index ea6c128b..371ec454 100644 --- a/app/src/main/java/code/name/monkey/retromusic/extensions/ViewExtensions.kt +++ b/app/src/main/java/code/name/monkey/retromusic/extensions/ViewExtensions.kt @@ -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() \ No newline at end of file +fun View.showOrHide(show: Boolean) = if (show) show() else hide() + +fun EditText.appHandleColor(): EditText { + TintHelper.colorHandles(this, ThemeStore.accentColor(context)) + return this +} \ No newline at end of file diff --git a/appthemehelper/src/main/java/code/name/monkey/appthemehelper/common/views/ATEEditText.kt b/appthemehelper/src/main/java/code/name/monkey/appthemehelper/common/views/ATEEditText.kt deleted file mode 100755 index b53be36f..00000000 --- a/appthemehelper/src/main/java/code/name/monkey/appthemehelper/common/views/ATEEditText.kt +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright (c) 2019 Hemanth Savarala. - * - * Licensed under the GNU General Public License v3 - * - * This is free software: you can redistribute it and/or modify it under - * the terms of the GNU General Public License as published by - * the Free Software Foundation either version 3 of the License, or (at your option) any later version. - * - * This software is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * See the GNU General Public License for more details. - */ - -package code.name.monkey.appthemehelper.common.views - -import android.content.Context -import android.util.AttributeSet -import code.name.monkey.appthemehelper.ATH -import code.name.monkey.appthemehelper.ThemeStore -import com.google.android.material.textfield.TextInputEditText - -class ATEEditText @JvmOverloads constructor( - context: Context, - attrs: AttributeSet? = null, - defStyleAttr: Int = 0 -) : TextInputEditText(context, attrs, defStyleAttr) { - - init { - ATH.setTint(this, ThemeStore.accentColor(context)) - setTextColor(ThemeStore.textColorPrimary(context)) - } -} diff --git a/appthemehelper/src/main/java/code/name/monkey/appthemehelper/util/MaterialUtil.kt b/appthemehelper/src/main/java/code/name/monkey/appthemehelper/util/MaterialUtil.kt index ebf07e31..642343f0 100644 --- a/appthemehelper/src/main/java/code/name/monkey/appthemehelper/util/MaterialUtil.kt +++ b/appthemehelper/src/main/java/code/name/monkey/appthemehelper/util/MaterialUtil.kt @@ -47,31 +47,6 @@ object MaterialUtil { textInputLayout.defaultHintTextColor = colorState textInputLayout.isHintAnimationEnabled = true } - } - - private fun setCursorPointerColor(view: EditText, @ColorInt color: Int) { - try { - //get the pointer resource id - var field = TextView::class.java.getDeclaredField("mTextSelectHandleRes") - field.isAccessible = true - val drawableResId = field.getInt(view) - - //get the editor - field = TextView::class.java.getDeclaredField("mEditor") - field.isAccessible = true - val editor = field.get(view) - - //tint drawable - val drawable = ContextCompat.getDrawable(view.context, drawableResId)!! - drawable.setColorFilter(color, PorterDuff.Mode.SRC_IN) - - //set the drawable - field = editor.javaClass.getDeclaredField("mSelectHandleCenter") - field.isAccessible = true - field.set(editor, drawable) - - } catch (ex: Exception) { - } } } diff --git a/appthemehelper/src/main/java/code/name/monkey/appthemehelper/util/TintHelper.java b/appthemehelper/src/main/java/code/name/monkey/appthemehelper/util/TintHelper.java index d399742e..037e2ca1 100755 --- a/appthemehelper/src/main/java/code/name/monkey/appthemehelper/util/TintHelper.java +++ b/appthemehelper/src/main/java/code/name/monkey/appthemehelper/util/TintHelper.java @@ -407,4 +407,45 @@ public final class TintHelper { e.printStackTrace(); } } + @SuppressWarnings("JavaReflectionMemberAccess") + public static void colorHandles(@NonNull TextView view, int color) { + try { + Field editorField = TextView.class.getDeclaredField("mEditor"); + if (!editorField.isAccessible()) { + editorField.setAccessible(true); + } + + Object editor = editorField.get(view); + Class> editorClass = editor.getClass(); + + String[] handleNames = {"mSelectHandleLeft", "mSelectHandleRight", "mSelectHandleCenter"}; + String[] resNames = {"mTextSelectHandleLeftRes", "mTextSelectHandleRightRes", "mTextSelectHandleRes"}; + + for (int i = 0; i < handleNames.length; i++) { + Field handleField = editorClass.getDeclaredField(handleNames[i]); + if (!handleField.isAccessible()) { + handleField.setAccessible(true); + } + + Drawable handleDrawable = (Drawable) handleField.get(editor); + + if (handleDrawable == null) { + Field resField = TextView.class.getDeclaredField(resNames[i]); + if (!resField.isAccessible()) { + resField.setAccessible(true); + } + int resId = resField.getInt(view); + handleDrawable = view.getResources().getDrawable(resId); + } + + if (handleDrawable != null) { + Drawable drawable = handleDrawable.mutate(); + drawable.setColorFilter(color, PorterDuff.Mode.SRC_IN); + handleField.set(editor, drawable); + } + } + } catch (Exception e) { + e.printStackTrace(); + } + } } \ No newline at end of file