updating commons

This commit is contained in:
tibbi 2021-12-15 15:26:19 +01:00
parent b77bc4cb56
commit 166a8ee9dd
18 changed files with 30 additions and 38 deletions

View file

@ -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'

View file

@ -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<Artist>() {}.type
val artist = Gson().fromJson<Artist>(intent.getStringExtra(ARTIST), artistType)

View file

@ -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() {

View file

@ -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()

View file

@ -23,7 +23,7 @@ import kotlinx.android.synthetic.main.item_album.view.*
import java.util.*
class AlbumsAdapter(activity: SimpleActivity, var albums: ArrayList<Album>, 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<Album>, recy
textToHighlight = highlightText
notifyDataSetChanged()
}
fastScroller?.measureRecyclerView()
}
private fun setupView(view: View, album: Album) {

View file

@ -33,7 +33,7 @@ import java.util.*
class AlbumsTracksAdapter(
activity: SimpleActivity, val items: ArrayList<ListItem>, 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

View file

@ -25,7 +25,7 @@ import kotlinx.android.synthetic.main.item_artist.view.*
import java.util.*
class ArtistsAdapter(activity: SimpleActivity, var artists: ArrayList<Artist>, 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<Artist>, r
textToHighlight = highlightText
notifyDataSetChanged()
}
fastScroller?.measureRecyclerView()
}
private fun setupView(view: View, artist: Artist) {

View file

@ -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<Track>, val transparentView: View,
recyclerView: MyRecyclerView, fastScroller: FastScroller, itemClick: (Any) -> Unit) :
MyRecyclerViewAdapter(activity, recyclerView, fastScroller, itemClick) {
class OldSongAdapter(
activity: SimpleActivity, var songs: ArrayList<Track>, val transparentView: View,
recyclerView: MyRecyclerView, itemClick: (Any) -> Unit
) :
MyRecyclerViewAdapter(activity, recyclerView, itemClick) {
private val VIEW_TYPE_TRANSPARENT = 0
private val VIEW_TYPE_NAVIGATION = 1

View file

@ -25,7 +25,7 @@ import java.util.*
class PlaylistsAdapter(
activity: SimpleActivity, var playlists: ArrayList<Playlist>, 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() {

View file

@ -36,7 +36,7 @@ import kotlinx.android.synthetic.main.item_track_queue.view.*
import java.util.*
class QueueAdapter(activity: SimpleActivity, val items: ArrayList<Track>, 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

View file

@ -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<Track>, 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) {

View file

@ -29,7 +29,7 @@ import kotlinx.android.synthetic.main.item_track.view.*
import java.util.*
class TracksHeaderAdapter(activity: SimpleActivity, val items: ArrayList<ListItem>, 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

View file

@ -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)
}
}

View file

@ -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)
}
}

View file

@ -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)
}
}

View file

@ -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)
}
}

View file

@ -794,12 +794,12 @@ class MusicService : Service(), MediaPlayer.OnPreparedListener, MediaPlayer.OnEr
private fun getAlbumImage(): Pair<Bitmap, Boolean> {
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('/')

View file

@ -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