diff --git a/app/build.gradle b/app/build.gradle index 90c0d4dc..0f689455 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -62,11 +62,11 @@ android { } dependencies { - implementation 'com.github.SimpleMobileTools:Simple-Commons:df457fe86a' + implementation 'com.github.SimpleMobileTools:Simple-Commons:8a92635fb0' implementation 'org.greenrobot:eventbus:3.2.0' implementation 'androidx.media:media:1.4.2' implementation 'androidx.swiperefreshlayout:swiperefreshlayout:1.1.0' - implementation 'androidx.constraintlayout:constraintlayout:2.1.1' + implementation 'androidx.constraintlayout:constraintlayout:2.1.2' implementation 'com.google.android.material:material:1.4.0' implementation 'com.airbnb.android:lottie:3.6.1' diff --git a/app/src/main/kotlin/com/simplemobiletools/musicplayer/activities/AlbumsActivity.kt b/app/src/main/kotlin/com/simplemobiletools/musicplayer/activities/AlbumsActivity.kt index f435bf48..26ccb1fa 100644 --- a/app/src/main/kotlin/com/simplemobiletools/musicplayer/activities/AlbumsActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/musicplayer/activities/AlbumsActivity.kt @@ -7,7 +7,6 @@ import com.google.gson.Gson import com.google.gson.reflect.TypeToken import com.simplemobiletools.commons.extensions.areSystemAnimationsEnabled import com.simplemobiletools.commons.extensions.getAdjustedPrimaryColor -import com.simplemobiletools.commons.extensions.getContrastColor import com.simplemobiletools.commons.extensions.getFormattedDuration import com.simplemobiletools.musicplayer.R import com.simplemobiletools.musicplayer.adapters.AlbumsTracksAdapter @@ -37,7 +36,7 @@ class AlbumsActivity : SimpleActivity() { bus = EventBus.getDefault() bus!!.register(this) - albums_fastscroller.updateColors(getAdjustedPrimaryColor(), getAdjustedPrimaryColor().getContrastColor()) + albums_fastscroller.updateColors(getAdjustedPrimaryColor()) val artistType = object : TypeToken() {}.type val artist = Gson().fromJson(intent.getStringExtra(ARTIST), artistType) diff --git a/app/src/main/kotlin/com/simplemobiletools/musicplayer/activities/QueueActivity.kt b/app/src/main/kotlin/com/simplemobiletools/musicplayer/activities/QueueActivity.kt index ae715686..cb3af6d8 100644 --- a/app/src/main/kotlin/com/simplemobiletools/musicplayer/activities/QueueActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/musicplayer/activities/QueueActivity.kt @@ -33,7 +33,7 @@ class QueueActivity : SimpleActivity() { bus = EventBus.getDefault() bus!!.register(this) setupAdapter() - queue_fastscroller.updateColors(getAdjustedPrimaryColor(), getAdjustedPrimaryColor().getContrastColor()) + queue_fastscroller.updateColors(getAdjustedPrimaryColor()) } override fun onDestroy() { diff --git a/app/src/main/kotlin/com/simplemobiletools/musicplayer/activities/TracksActivity.kt b/app/src/main/kotlin/com/simplemobiletools/musicplayer/activities/TracksActivity.kt index e2b7d1cd..cd171ca7 100644 --- a/app/src/main/kotlin/com/simplemobiletools/musicplayer/activities/TracksActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/musicplayer/activities/TracksActivity.kt @@ -50,7 +50,7 @@ class TracksActivity : SimpleActivity() { title = playlist?.title ?: album.title val adjustedPrimaryColor = getAdjustedPrimaryColor() - tracks_fastscroller.updateColors(adjustedPrimaryColor, adjustedPrimaryColor.getContrastColor()) + tracks_fastscroller.updateColors(adjustedPrimaryColor) tracks_placeholder.setTextColor(config.textColor) tracks_placeholder_2.setTextColor(adjustedPrimaryColor) tracks_placeholder_2.underlineText() diff --git a/app/src/main/kotlin/com/simplemobiletools/musicplayer/adapters/AlbumsAdapter.kt b/app/src/main/kotlin/com/simplemobiletools/musicplayer/adapters/AlbumsAdapter.kt index 727ff560..cb73b369 100644 --- a/app/src/main/kotlin/com/simplemobiletools/musicplayer/adapters/AlbumsAdapter.kt +++ b/app/src/main/kotlin/com/simplemobiletools/musicplayer/adapters/AlbumsAdapter.kt @@ -23,7 +23,7 @@ import kotlinx.android.synthetic.main.item_album.view.* import java.util.* class AlbumsAdapter(activity: SimpleActivity, var albums: ArrayList, recyclerView: MyRecyclerView, itemClick: (Any) -> Unit) : - MyRecyclerViewAdapter(activity, recyclerView, null, itemClick), RecyclerViewFastScroller.OnPopupTextUpdate { + MyRecyclerViewAdapter(activity, recyclerView, itemClick), RecyclerViewFastScroller.OnPopupTextUpdate { private var textToHighlight = "" private val placeholderBig = resources.getColoredDrawableWithColor(R.drawable.ic_headset, textColor) @@ -146,7 +146,6 @@ class AlbumsAdapter(activity: SimpleActivity, var albums: ArrayList, recy textToHighlight = highlightText notifyDataSetChanged() } - fastScroller?.measureRecyclerView() } private fun setupView(view: View, album: Album) { diff --git a/app/src/main/kotlin/com/simplemobiletools/musicplayer/adapters/AlbumsTracksAdapter.kt b/app/src/main/kotlin/com/simplemobiletools/musicplayer/adapters/AlbumsTracksAdapter.kt index 786d1c28..8219bc80 100644 --- a/app/src/main/kotlin/com/simplemobiletools/musicplayer/adapters/AlbumsTracksAdapter.kt +++ b/app/src/main/kotlin/com/simplemobiletools/musicplayer/adapters/AlbumsTracksAdapter.kt @@ -33,7 +33,7 @@ import java.util.* class AlbumsTracksAdapter( activity: SimpleActivity, val items: ArrayList, recyclerView: MyRecyclerView, itemClick: (Any) -> Unit -) : MyRecyclerViewAdapter(activity, recyclerView, null, itemClick), RecyclerViewFastScroller.OnPopupTextUpdate { +) : MyRecyclerViewAdapter(activity, recyclerView, itemClick), RecyclerViewFastScroller.OnPopupTextUpdate { private val ITEM_SECTION = 0 private val ITEM_ALBUM = 1 diff --git a/app/src/main/kotlin/com/simplemobiletools/musicplayer/adapters/ArtistsAdapter.kt b/app/src/main/kotlin/com/simplemobiletools/musicplayer/adapters/ArtistsAdapter.kt index dcaaadbc..ea6be2d4 100644 --- a/app/src/main/kotlin/com/simplemobiletools/musicplayer/adapters/ArtistsAdapter.kt +++ b/app/src/main/kotlin/com/simplemobiletools/musicplayer/adapters/ArtistsAdapter.kt @@ -25,7 +25,7 @@ import kotlinx.android.synthetic.main.item_artist.view.* import java.util.* class ArtistsAdapter(activity: SimpleActivity, var artists: ArrayList, recyclerView: MyRecyclerView, itemClick: (Any) -> Unit) : - MyRecyclerViewAdapter(activity, recyclerView, null, itemClick), RecyclerViewFastScroller.OnPopupTextUpdate { + MyRecyclerViewAdapter(activity, recyclerView, itemClick), RecyclerViewFastScroller.OnPopupTextUpdate { private var textToHighlight = "" private val placeholder = resources.getColoredDrawableWithColor(R.drawable.ic_headset_padded, textColor) @@ -154,7 +154,6 @@ class ArtistsAdapter(activity: SimpleActivity, var artists: ArrayList, r textToHighlight = highlightText notifyDataSetChanged() } - fastScroller?.measureRecyclerView() } private fun setupView(view: View, artist: Artist) { diff --git a/app/src/main/kotlin/com/simplemobiletools/musicplayer/adapters/OldSongAdapter.kt b/app/src/main/kotlin/com/simplemobiletools/musicplayer/adapters/OldSongAdapter.kt index 18c6dc62..94525c31 100644 --- a/app/src/main/kotlin/com/simplemobiletools/musicplayer/adapters/OldSongAdapter.kt +++ b/app/src/main/kotlin/com/simplemobiletools/musicplayer/adapters/OldSongAdapter.kt @@ -7,7 +7,6 @@ import android.view.ViewGroup import com.simplemobiletools.commons.adapters.MyRecyclerViewAdapter import com.simplemobiletools.commons.dialogs.PropertiesDialog import com.simplemobiletools.commons.extensions.sharePathsIntent -import com.simplemobiletools.commons.views.FastScroller import com.simplemobiletools.commons.views.MyRecyclerView import com.simplemobiletools.musicplayer.BuildConfig import com.simplemobiletools.musicplayer.R @@ -20,9 +19,11 @@ import com.simplemobiletools.musicplayer.helpers.REFRESH_LIST import com.simplemobiletools.musicplayer.models.Track import com.simplemobiletools.musicplayer.services.MusicService -class OldSongAdapter(activity: SimpleActivity, var songs: ArrayList, val transparentView: View, - recyclerView: MyRecyclerView, fastScroller: FastScroller, itemClick: (Any) -> Unit) : - MyRecyclerViewAdapter(activity, recyclerView, fastScroller, itemClick) { +class OldSongAdapter( + activity: SimpleActivity, var songs: ArrayList, val transparentView: View, + recyclerView: MyRecyclerView, itemClick: (Any) -> Unit +) : + MyRecyclerViewAdapter(activity, recyclerView, itemClick) { private val VIEW_TYPE_TRANSPARENT = 0 private val VIEW_TYPE_NAVIGATION = 1 diff --git a/app/src/main/kotlin/com/simplemobiletools/musicplayer/adapters/PlaylistsAdapter.kt b/app/src/main/kotlin/com/simplemobiletools/musicplayer/adapters/PlaylistsAdapter.kt index 8d0018c6..d9d5fb7d 100644 --- a/app/src/main/kotlin/com/simplemobiletools/musicplayer/adapters/PlaylistsAdapter.kt +++ b/app/src/main/kotlin/com/simplemobiletools/musicplayer/adapters/PlaylistsAdapter.kt @@ -25,7 +25,7 @@ import java.util.* class PlaylistsAdapter( activity: SimpleActivity, var playlists: ArrayList, recyclerView: MyRecyclerView, itemClick: (Any) -> Unit -) : MyRecyclerViewAdapter(activity, recyclerView, null, itemClick), RecyclerViewFastScroller.OnPopupTextUpdate { +) : MyRecyclerViewAdapter(activity, recyclerView, itemClick), RecyclerViewFastScroller.OnPopupTextUpdate { private var textToHighlight = "" @@ -139,7 +139,6 @@ class PlaylistsAdapter( textToHighlight = highlightText notifyDataSetChanged() } - fastScroller?.measureRecyclerView() } private fun showRenameDialog() { diff --git a/app/src/main/kotlin/com/simplemobiletools/musicplayer/adapters/QueueAdapter.kt b/app/src/main/kotlin/com/simplemobiletools/musicplayer/adapters/QueueAdapter.kt index 29633ae4..c60930a9 100644 --- a/app/src/main/kotlin/com/simplemobiletools/musicplayer/adapters/QueueAdapter.kt +++ b/app/src/main/kotlin/com/simplemobiletools/musicplayer/adapters/QueueAdapter.kt @@ -36,7 +36,7 @@ import kotlinx.android.synthetic.main.item_track_queue.view.* import java.util.* class QueueAdapter(activity: SimpleActivity, val items: ArrayList, recyclerView: MyRecyclerView, itemClick: (Any) -> Unit) : - MyRecyclerViewAdapter(activity, recyclerView, null, itemClick), ItemTouchHelperContract, RecyclerViewFastScroller.OnPopupTextUpdate { + MyRecyclerViewAdapter(activity, recyclerView, itemClick), ItemTouchHelperContract, RecyclerViewFastScroller.OnPopupTextUpdate { private val placeholder = resources.getColoredDrawableWithColor(R.drawable.ic_headset, textColor) private var startReorderDragListener: StartReorderDragListener diff --git a/app/src/main/kotlin/com/simplemobiletools/musicplayer/adapters/TracksAdapter.kt b/app/src/main/kotlin/com/simplemobiletools/musicplayer/adapters/TracksAdapter.kt index 21c61a20..4851d796 100644 --- a/app/src/main/kotlin/com/simplemobiletools/musicplayer/adapters/TracksAdapter.kt +++ b/app/src/main/kotlin/com/simplemobiletools/musicplayer/adapters/TracksAdapter.kt @@ -1,7 +1,5 @@ package com.simplemobiletools.musicplayer.adapters -import android.content.ContentUris -import android.provider.MediaStore import android.view.Menu import android.view.View import android.view.ViewGroup @@ -12,7 +10,6 @@ import com.bumptech.glide.request.RequestOptions import com.qtalk.recyclerviewfastscroller.RecyclerViewFastScroller import com.simplemobiletools.commons.adapters.MyRecyclerViewAdapter import com.simplemobiletools.commons.dialogs.ConfirmationDialog -import com.simplemobiletools.commons.dialogs.PropertiesDialog import com.simplemobiletools.commons.extensions.* import com.simplemobiletools.commons.helpers.ensureBackgroundThread import com.simplemobiletools.commons.views.MyRecyclerView @@ -29,7 +26,7 @@ import java.util.* class TracksAdapter( activity: SimpleActivity, var tracks: ArrayList, val isPlaylistContent: Boolean, recyclerView: MyRecyclerView, itemClick: (Any) -> Unit -) : MyRecyclerViewAdapter(activity, recyclerView, null, itemClick), RecyclerViewFastScroller.OnPopupTextUpdate { +) : MyRecyclerViewAdapter(activity, recyclerView, itemClick), RecyclerViewFastScroller.OnPopupTextUpdate { private val tagHelper by lazy { TagHelper(activity) } private var textToHighlight = "" @@ -172,7 +169,6 @@ class TracksAdapter( textToHighlight = highlightText notifyDataSetChanged() } - fastScroller?.measureRecyclerView() } private fun setupView(view: View, track: Track) { diff --git a/app/src/main/kotlin/com/simplemobiletools/musicplayer/adapters/TracksHeaderAdapter.kt b/app/src/main/kotlin/com/simplemobiletools/musicplayer/adapters/TracksHeaderAdapter.kt index 33f7662d..b29cc2fa 100644 --- a/app/src/main/kotlin/com/simplemobiletools/musicplayer/adapters/TracksHeaderAdapter.kt +++ b/app/src/main/kotlin/com/simplemobiletools/musicplayer/adapters/TracksHeaderAdapter.kt @@ -29,7 +29,7 @@ import kotlinx.android.synthetic.main.item_track.view.* import java.util.* class TracksHeaderAdapter(activity: SimpleActivity, val items: ArrayList, recyclerView: MyRecyclerView, itemClick: (Any) -> Unit) : - MyRecyclerViewAdapter(activity, recyclerView, null, itemClick), RecyclerViewFastScroller.OnPopupTextUpdate { + MyRecyclerViewAdapter(activity, recyclerView, itemClick), RecyclerViewFastScroller.OnPopupTextUpdate { private val ITEM_HEADER = 0 private val ITEM_TRACK = 1 diff --git a/app/src/main/kotlin/com/simplemobiletools/musicplayer/fragments/AlbumsFragment.kt b/app/src/main/kotlin/com/simplemobiletools/musicplayer/fragments/AlbumsFragment.kt index f4af98b7..27f84b9f 100644 --- a/app/src/main/kotlin/com/simplemobiletools/musicplayer/fragments/AlbumsFragment.kt +++ b/app/src/main/kotlin/com/simplemobiletools/musicplayer/fragments/AlbumsFragment.kt @@ -128,6 +128,6 @@ class AlbumsFragment(context: Context, attributeSet: AttributeSet) : MyViewPager override fun setupColors(textColor: Int, adjustedPrimaryColor: Int) { albums_placeholder.setTextColor(textColor) - albums_fastscroller.updateColors(adjustedPrimaryColor, adjustedPrimaryColor.getContrastColor()) + albums_fastscroller.updateColors(adjustedPrimaryColor) } } diff --git a/app/src/main/kotlin/com/simplemobiletools/musicplayer/fragments/ArtistsFragment.kt b/app/src/main/kotlin/com/simplemobiletools/musicplayer/fragments/ArtistsFragment.kt index 3df3d519..a12e2f72 100644 --- a/app/src/main/kotlin/com/simplemobiletools/musicplayer/fragments/ArtistsFragment.kt +++ b/app/src/main/kotlin/com/simplemobiletools/musicplayer/fragments/ArtistsFragment.kt @@ -125,6 +125,6 @@ class ArtistsFragment(context: Context, attributeSet: AttributeSet) : MyViewPage override fun setupColors(textColor: Int, adjustedPrimaryColor: Int) { artists_placeholder.setTextColor(textColor) - artists_fastscroller.updateColors(adjustedPrimaryColor, adjustedPrimaryColor.getContrastColor()) + artists_fastscroller.updateColors(adjustedPrimaryColor) } } diff --git a/app/src/main/kotlin/com/simplemobiletools/musicplayer/fragments/PlaylistsFragment.kt b/app/src/main/kotlin/com/simplemobiletools/musicplayer/fragments/PlaylistsFragment.kt index 8be68aae..16426bf2 100644 --- a/app/src/main/kotlin/com/simplemobiletools/musicplayer/fragments/PlaylistsFragment.kt +++ b/app/src/main/kotlin/com/simplemobiletools/musicplayer/fragments/PlaylistsFragment.kt @@ -102,7 +102,6 @@ class PlaylistsFragment(context: Context, attributeSet: AttributeSet) : MyViewPa override fun setupColors(textColor: Int, adjustedPrimaryColor: Int) { playlists_placeholder.setTextColor(textColor) playlists_placeholder_2.setTextColor(adjustedPrimaryColor) - - playlists_fastscroller.updateColors(adjustedPrimaryColor, adjustedPrimaryColor.getContrastColor()) + playlists_fastscroller.updateColors(adjustedPrimaryColor) } } diff --git a/app/src/main/kotlin/com/simplemobiletools/musicplayer/fragments/TracksFragment.kt b/app/src/main/kotlin/com/simplemobiletools/musicplayer/fragments/TracksFragment.kt index 9c0493c5..35e445c4 100644 --- a/app/src/main/kotlin/com/simplemobiletools/musicplayer/fragments/TracksFragment.kt +++ b/app/src/main/kotlin/com/simplemobiletools/musicplayer/fragments/TracksFragment.kt @@ -98,6 +98,6 @@ class TracksFragment(context: Context, attributeSet: AttributeSet) : MyViewPager override fun setupColors(textColor: Int, adjustedPrimaryColor: Int) { tracks_placeholder.setTextColor(textColor) - tracks_fastscroller.updateColors(adjustedPrimaryColor, adjustedPrimaryColor.getContrastColor()) + tracks_fastscroller.updateColors(adjustedPrimaryColor) } } diff --git a/app/src/main/kotlin/com/simplemobiletools/musicplayer/services/MusicService.kt b/app/src/main/kotlin/com/simplemobiletools/musicplayer/services/MusicService.kt index fd2f6ccb..39a03641 100644 --- a/app/src/main/kotlin/com/simplemobiletools/musicplayer/services/MusicService.kt +++ b/app/src/main/kotlin/com/simplemobiletools/musicplayer/services/MusicService.kt @@ -794,12 +794,12 @@ class MusicService : Service(), MediaPlayer.OnPreparedListener, MediaPlayer.OnEr private fun getAlbumImage(): Pair { if (File(mCurrTrack?.path ?: "").exists()) { try { - val mediaMetadataRetriever = MediaMetadataRetriever() - mediaMetadataRetriever.setDataSource(mCurrTrack!!.path) - val rawArt = mediaMetadataRetriever.embeddedPicture - if (rawArt != null) { - val options = BitmapFactory.Options() - try { + try { + val mediaMetadataRetriever = MediaMetadataRetriever() + mediaMetadataRetriever.setDataSource(mCurrTrack!!.path) + val rawArt = mediaMetadataRetriever.embeddedPicture + if (rawArt != null) { + val options = BitmapFactory.Options() val bitmap = BitmapFactory.decodeByteArray(rawArt, 0, rawArt.size, options) if (bitmap != null) { val resultBitmap = if (bitmap.height > mCoverArtHeight * 2) { @@ -810,9 +810,9 @@ class MusicService : Service(), MediaPlayer.OnPreparedListener, MediaPlayer.OnEr } return Pair(resultBitmap, true) } - } catch (ignored: OutOfMemoryError) { - } catch (ignored: Exception) { } + } catch (ignored: OutOfMemoryError) { + } catch (ignored: Exception) { } val trackParentDirectory = File(mCurrTrack!!.path).parent.trimEnd('/') diff --git a/build.gradle b/build.gradle index e681b55b..26027b91 100644 --- a/build.gradle +++ b/build.gradle @@ -9,7 +9,7 @@ buildscript { } dependencies { - classpath 'com.android.tools.build:gradle:7.0.3' + classpath 'com.android.tools.build:gradle:7.0.4' classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" // NOTE: Do not place your application dependencies here; they belong