Merge branch 'dev' of https://github.com/h4h13/RetroMusicPlayer into dev
This commit is contained in:
commit
f94316b8b8
22 changed files with 83 additions and 152 deletions
|
@ -34,8 +34,9 @@ android {
|
|||
}
|
||||
buildTypes {
|
||||
release {
|
||||
debuggable true
|
||||
minifyEnabled true
|
||||
shrinkResources true
|
||||
//shrinkResources true
|
||||
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
|
||||
signingConfig signingConfigs.release
|
||||
}
|
||||
|
|
23
app/proguard-rules.pro
vendored
23
app/proguard-rules.pro
vendored
|
@ -26,13 +26,11 @@
|
|||
|
||||
-dontwarn java.lang.invoke.*
|
||||
-dontwarn **$$Lambda$*
|
||||
-dontwarn javax.annotation.**
|
||||
|
||||
# RetroFit
|
||||
-dontwarn retrofit.**
|
||||
-keep class retrofit.** { *; }
|
||||
-keepattributes Signature
|
||||
-keepattributes Exceptions
|
||||
-dontwarn javax.annotation.**
|
||||
|
||||
# Glide
|
||||
-keep public class * implements com.bumptech.glide.module.GlideModule
|
||||
|
@ -41,17 +39,20 @@
|
|||
public *;
|
||||
}
|
||||
|
||||
# OkHttp
|
||||
-keepattributes Signature
|
||||
-keepattributes *Annotation*
|
||||
-keep interface com.squareup.okhttp3.** { *; }
|
||||
-dontwarn com.squareup.okhttp3.**
|
||||
|
||||
-dontwarn
|
||||
-ignorewarnings
|
||||
#-dontwarn
|
||||
#-ignorewarnings
|
||||
-dontshrink
|
||||
-dontobfuscate
|
||||
|
||||
#-dontwarn android.support.v8.renderscript.*
|
||||
#-keepclassmembers class android.support.v8.renderscript.RenderScript {
|
||||
# native *** rsn*(...);
|
||||
# native *** n*(...);
|
||||
#}
|
||||
-dontwarn org.jaudiotagger.**
|
||||
-keep class org.jaudiotagger.** { *; }
|
||||
|
||||
#-keep class org.jaudiotagger.** { *; }
|
||||
-keepclassmembers enum * { *; }
|
||||
-keepattributes *Annotation*, Signature, Exception
|
||||
-keepnames class androidx.navigation.fragment.NavHostFragment
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
package="code.name.monkey.retromusic">
|
||||
|
||||
<uses-permission android:name="android.permission.BLUETOOTH" />
|
||||
<uses-permission android:name="android.permission.DISABLE_KEYGUARD" />
|
||||
<uses-permission android:name="android.permission.WAKE_LOCK" />
|
||||
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
|
||||
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
|
||||
|
@ -119,11 +120,7 @@
|
|||
<activity android:name=".activities.ShareInstagramStory" />
|
||||
<activity android:name=".activities.DriveModeActivity" />
|
||||
<activity android:name=".activities.PermissionActivity" />
|
||||
|
||||
<activity
|
||||
android:name=".activities.LockScreenActivity"
|
||||
android:noHistory="true"
|
||||
android:showOnLockScreen="true" />
|
||||
<activity android:name=".activities.LockScreenActivity" />
|
||||
|
||||
<activity
|
||||
android:name=".appshortcuts.AppShortcutLauncherActivity"
|
||||
|
|
|
@ -13,7 +13,10 @@ import code.name.monkey.retromusic.fragments.artists.ArtistDetailsViewModel
|
|||
import code.name.monkey.retromusic.fragments.genres.GenreDetailsViewModel
|
||||
import code.name.monkey.retromusic.fragments.playlists.PlaylistDetailsViewModel
|
||||
import code.name.monkey.retromusic.model.Genre
|
||||
import code.name.monkey.retromusic.network.*
|
||||
import code.name.monkey.retromusic.network.provideDefaultCache
|
||||
import code.name.monkey.retromusic.network.provideLastFmRest
|
||||
import code.name.monkey.retromusic.network.provideLastFmRetrofit
|
||||
import code.name.monkey.retromusic.network.provideOkHttp
|
||||
import code.name.monkey.retromusic.repository.*
|
||||
import code.name.monkey.retromusic.util.FilePathUtil
|
||||
import kotlinx.coroutines.Dispatchers.IO
|
||||
|
@ -35,15 +38,9 @@ val networkModule = module {
|
|||
single {
|
||||
provideLastFmRetrofit(get())
|
||||
}
|
||||
single {
|
||||
provideDeezerRest(get())
|
||||
}
|
||||
single {
|
||||
provideLastFmRest(get())
|
||||
}
|
||||
single {
|
||||
provideLyrics(get())
|
||||
}
|
||||
}
|
||||
|
||||
private val roomModule = module {
|
||||
|
@ -92,7 +89,6 @@ private val mainModule = module {
|
|||
single {
|
||||
androidContext().contentResolver
|
||||
}
|
||||
|
||||
}
|
||||
private val dataModule = module {
|
||||
single {
|
||||
|
@ -109,7 +105,6 @@ private val dataModule = module {
|
|||
get(),
|
||||
get(),
|
||||
get(),
|
||||
get()
|
||||
)
|
||||
} bind Repository::class
|
||||
|
||||
|
|
|
@ -9,7 +9,8 @@ import android.view.WindowManager
|
|||
import androidx.core.view.ViewCompat
|
||||
import code.name.monkey.retromusic.R
|
||||
import code.name.monkey.retromusic.activities.base.AbsMusicServiceActivity
|
||||
import code.name.monkey.retromusic.fragments.player.lockscreen.LockScreenPlayerControlsFragment
|
||||
import code.name.monkey.retromusic.extensions.whichFragment
|
||||
import code.name.monkey.retromusic.fragments.player.lockscreen.LockScreenControlsFragment
|
||||
import code.name.monkey.retromusic.glide.RetroMusicColoredTarget
|
||||
import code.name.monkey.retromusic.glide.SongGlideRequest
|
||||
import code.name.monkey.retromusic.helper.MusicPlayerRemote
|
||||
|
@ -22,19 +23,19 @@ import com.r0adkll.slidr.model.SlidrPosition
|
|||
import kotlinx.android.synthetic.main.activity_lock_screen.*
|
||||
|
||||
class LockScreenActivity : AbsMusicServiceActivity() {
|
||||
private var fragment: LockScreenPlayerControlsFragment? = null
|
||||
private var fragment: LockScreenControlsFragment? = null
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
setDrawUnderStatusBar()
|
||||
super.onCreate(savedInstanceState)
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O_MR1) {
|
||||
setShowWhenLocked(true)
|
||||
setTurnScreenOn(true)
|
||||
val keyguardManager = getSystemService(Context.KEYGUARD_SERVICE) as KeyguardManager
|
||||
keyguardManager.requestDismissKeyguard(this, null)
|
||||
} else {
|
||||
this.window.addFlags(
|
||||
WindowManager.LayoutParams.FLAG_DISMISS_KEYGUARD or
|
||||
WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED or
|
||||
WindowManager.LayoutParams.FLAG_TURN_SCREEN_ON
|
||||
WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED
|
||||
)
|
||||
}
|
||||
setContentView(R.layout.activity_lock_screen)
|
||||
|
@ -67,8 +68,7 @@ class LockScreenActivity : AbsMusicServiceActivity() {
|
|||
|
||||
Slidr.attach(this, config)
|
||||
|
||||
fragment =
|
||||
supportFragmentManager.findFragmentById(R.id.playback_controls_fragment) as LockScreenPlayerControlsFragment?
|
||||
fragment = whichFragment<LockScreenControlsFragment>(R.id.playback_controls_fragment)
|
||||
|
||||
findViewById<View>(R.id.slide).apply {
|
||||
translationY = 100f
|
||||
|
|
|
@ -39,7 +39,7 @@ class PermissionActivity : AbsMusicServiceActivity() {
|
|||
}
|
||||
finish.accentBackgroundColor()
|
||||
finish.setOnClickListener {
|
||||
if (hasPermissions() && !RingtoneManager.requiresDialog(this)) {
|
||||
if (hasPermissions() ) {
|
||||
startActivity(
|
||||
Intent(this, MainActivity::class.java).addFlags(
|
||||
Intent.FLAG_ACTIVITY_NEW_TASK or
|
||||
|
|
|
@ -330,7 +330,7 @@ abstract class AbsSlidingMusicPanelActivity : AbsMusicServiceActivity() {
|
|||
ViewCompat.setElevation(slidingPanel, 0f)
|
||||
ViewCompat.setElevation(bottomNavigationView, 10f)
|
||||
bottomSheetBehavior.isHideable = true
|
||||
bottomSheetBehavior.setPeekHeight(0, true)
|
||||
bottomSheetBehavior.setPeekHeight(0, false)
|
||||
bottomSheetBehavior.state = STATE_COLLAPSED
|
||||
}
|
||||
COLLAPSED_WITH -> {
|
||||
|
@ -341,7 +341,7 @@ abstract class AbsSlidingMusicPanelActivity : AbsMusicServiceActivity() {
|
|||
bottomSheetBehavior.isHideable = false
|
||||
bottomSheetBehavior.setPeekHeight(
|
||||
if (isQueueEmpty) 0 else (heightOfBar * 2) - 24,
|
||||
true
|
||||
false
|
||||
)
|
||||
bottomNavigationView.isVisible = true
|
||||
}
|
||||
|
@ -353,7 +353,7 @@ abstract class AbsSlidingMusicPanelActivity : AbsMusicServiceActivity() {
|
|||
bottomSheetBehavior.isHideable = false
|
||||
bottomSheetBehavior.setPeekHeight(
|
||||
if (isQueueEmpty) 0 else heightOfBar - 24,
|
||||
true
|
||||
false
|
||||
)
|
||||
bottomNavigationView.isGone = true
|
||||
}
|
||||
|
|
|
@ -1,60 +0,0 @@
|
|||
package code.name.monkey.retromusic.dialogs
|
||||
|
||||
import android.os.Bundle
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import androidx.fragment.app.DialogFragment
|
||||
import androidx.lifecycle.lifecycleScope
|
||||
import code.name.monkey.retromusic.R
|
||||
import code.name.monkey.retromusic.extensions.accentTextColor
|
||||
import code.name.monkey.retromusic.extensions.hide
|
||||
import code.name.monkey.retromusic.helper.MusicPlayerRemote
|
||||
import code.name.monkey.retromusic.network.Result
|
||||
import code.name.monkey.retromusic.repository.Repository
|
||||
import kotlinx.android.synthetic.main.lyrics_dialog.*
|
||||
import kotlinx.coroutines.Dispatchers.IO
|
||||
import kotlinx.coroutines.Dispatchers.Main
|
||||
import kotlinx.coroutines.launch
|
||||
import kotlinx.coroutines.withContext
|
||||
import org.koin.android.ext.android.inject
|
||||
|
||||
class LyricsDialog : DialogFragment() {
|
||||
override fun getTheme(): Int {
|
||||
return R.style.MaterialAlertDialogTheme
|
||||
}
|
||||
|
||||
private val repository by inject<Repository>()
|
||||
|
||||
override fun onCreateView(
|
||||
inflater: LayoutInflater,
|
||||
container: ViewGroup?,
|
||||
savedInstanceState: Bundle?
|
||||
): View? {
|
||||
return inflater.inflate(R.layout.lyrics_dialog, container, false)
|
||||
}
|
||||
|
||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||
super.onViewCreated(view, savedInstanceState)
|
||||
val song = MusicPlayerRemote.currentSong
|
||||
dialogTitle.text = song.title
|
||||
syncedLyrics.accentTextColor()
|
||||
lifecycleScope.launch(IO) {
|
||||
val result: Result<String> = repository.lyrics(
|
||||
song.artistName,
|
||||
song.title
|
||||
)
|
||||
withContext(Main) {
|
||||
|
||||
when (result) {
|
||||
is Result.Error -> progressBar.hide()
|
||||
is Result.Loading -> println("Loading")
|
||||
is Result.Success -> {
|
||||
progressBar.hide()
|
||||
lyricsText.text = result.data
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -10,11 +10,13 @@ import androidx.navigation.fragment.findNavController
|
|||
import androidx.navigation.fragment.navArgs
|
||||
import androidx.recyclerview.widget.GridLayoutManager
|
||||
import androidx.recyclerview.widget.LinearLayoutManager
|
||||
import androidx.recyclerview.widget.RecyclerView.AdapterDataObserver
|
||||
import code.name.monkey.retromusic.*
|
||||
import code.name.monkey.retromusic.adapter.album.AlbumAdapter
|
||||
import code.name.monkey.retromusic.adapter.artist.ArtistAdapter
|
||||
import code.name.monkey.retromusic.adapter.song.SongAdapter
|
||||
import code.name.monkey.retromusic.db.toSong
|
||||
import code.name.monkey.retromusic.extensions.dipToPix
|
||||
import code.name.monkey.retromusic.fragments.albums.AlbumClickListener
|
||||
import code.name.monkey.retromusic.fragments.artists.ArtistClickListener
|
||||
import code.name.monkey.retromusic.fragments.base.AbsMainActivityFragment
|
||||
|
@ -52,6 +54,15 @@ class DetailListFragment : AbsMainActivityFragment(R.layout.fragment_playlist_de
|
|||
LAST_ADDED_PLAYLIST -> lastAddedSongs()
|
||||
TOP_PLAYED_PLAYLIST -> topPlayed()
|
||||
}
|
||||
|
||||
|
||||
recyclerView.adapter?.registerAdapterDataObserver(object : AdapterDataObserver() {
|
||||
override fun onChanged() {
|
||||
super.onChanged()
|
||||
val height = dipToPix(52f)
|
||||
recyclerView.setPadding(0, 0, 0, height.toInt())
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
private fun lastAddedSongs() {
|
||||
|
@ -84,7 +95,6 @@ class DetailListFragment : AbsMainActivityFragment(R.layout.fragment_playlist_de
|
|||
libraryViewModel.playCountSongs().observe(viewLifecycleOwner, Observer { songs ->
|
||||
songAdapter.swapDataSet(songs)
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
private fun loadHistory() {
|
||||
|
@ -116,8 +126,8 @@ class DetailListFragment : AbsMainActivityFragment(R.layout.fragment_playlist_de
|
|||
adapter = songAdapter
|
||||
layoutManager = linearLayoutManager()
|
||||
}
|
||||
libraryViewModel.favorites().observe(viewLifecycleOwner, {
|
||||
val songs = it.map { songEntity -> songEntity.toSong() }
|
||||
libraryViewModel.favorites().observe(viewLifecycleOwner, { songEntities ->
|
||||
val songs = songEntities.map { songEntity -> songEntity.toSong() }
|
||||
songAdapter.swapDataSet(songs)
|
||||
})
|
||||
}
|
||||
|
|
|
@ -22,11 +22,6 @@ import com.google.android.material.transition.platform.MaterialFadeThrough
|
|||
class AlbumsFragment : AbsRecyclerViewCustomGridSizeFragment<AlbumAdapter, GridLayoutManager>(),
|
||||
AlbumClickListener {
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
enterTransition = MaterialFadeThrough()
|
||||
}
|
||||
|
||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||
super.onViewCreated(view, savedInstanceState)
|
||||
libraryViewModel.getAlbums().observe(viewLifecycleOwner, Observer {
|
||||
|
|
|
@ -20,11 +20,6 @@ import com.google.android.material.transition.platform.MaterialFadeThrough
|
|||
|
||||
class ArtistsFragment : AbsRecyclerViewCustomGridSizeFragment<ArtistAdapter, GridLayoutManager>(),
|
||||
ArtistClickListener {
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
enterTransition = MaterialFadeThrough()
|
||||
}
|
||||
|
||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||
super.onViewCreated(view, savedInstanceState)
|
||||
libraryViewModel.getArtists().observe(viewLifecycleOwner, Observer {
|
||||
|
|
|
@ -21,14 +21,8 @@ import androidx.recyclerview.widget.LinearLayoutManager
|
|||
import code.name.monkey.retromusic.R
|
||||
import code.name.monkey.retromusic.adapter.GenreAdapter
|
||||
import code.name.monkey.retromusic.fragments.base.AbsRecyclerViewFragment
|
||||
import com.google.android.material.transition.platform.MaterialFadeThrough
|
||||
|
||||
class GenresFragment : AbsRecyclerViewFragment<GenreAdapter, LinearLayoutManager>() {
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
enterTransition = MaterialFadeThrough()
|
||||
}
|
||||
|
||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||
super.onViewCreated(view, savedInstanceState)
|
||||
libraryViewModel.getGenre().observe(viewLifecycleOwner, Observer {
|
||||
|
|
|
@ -44,11 +44,6 @@ import org.koin.androidx.viewmodel.ext.android.sharedViewModel
|
|||
|
||||
class HomeFragment :
|
||||
AbsMainActivityFragment(if (PreferenceUtil.isHomeBanner) R.layout.fragment_banner_home else R.layout.fragment_home) {
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
enterTransition = MaterialFadeThrough()
|
||||
}
|
||||
|
||||
private val libraryViewModel: LibraryViewModel by sharedViewModel()
|
||||
|
||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||
|
|
|
@ -43,7 +43,7 @@ import kotlinx.android.synthetic.main.fragment_lock_screen_playback_controls.*
|
|||
/**
|
||||
* @author Hemanth S (h4h13).
|
||||
*/
|
||||
class LockScreenPlayerControlsFragment :
|
||||
class LockScreenControlsFragment :
|
||||
AbsPlayerControlsFragment(R.layout.fragment_lock_screen_playback_controls) {
|
||||
|
||||
private var progressViewUpdateHelper: MusicProgressViewUpdateHelper? = null
|
|
@ -15,11 +15,6 @@ import com.google.android.material.transition.platform.MaterialFadeThrough
|
|||
import kotlinx.android.synthetic.main.fragment_library.*
|
||||
|
||||
class PlaylistsFragment : AbsRecyclerViewFragment<PlaylistAdapter, LinearLayoutManager>() {
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
enterTransition = MaterialFadeThrough()
|
||||
}
|
||||
|
||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||
super.onViewCreated(view, savedInstanceState)
|
||||
libraryViewModel.getPlaylists().observe(viewLifecycleOwner, Observer {
|
||||
|
|
|
@ -12,15 +12,9 @@ import code.name.monkey.retromusic.fragments.base.AbsRecyclerViewCustomGridSizeF
|
|||
import code.name.monkey.retromusic.helper.SortOrder.SongSortOrder
|
||||
import code.name.monkey.retromusic.util.PreferenceUtil
|
||||
import code.name.monkey.retromusic.util.RetroUtil
|
||||
import com.google.android.material.transition.platform.MaterialFadeThrough
|
||||
|
||||
|
||||
class SongsFragment : AbsRecyclerViewCustomGridSizeFragment<SongAdapter, GridLayoutManager>() {
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
enterTransition = MaterialFadeThrough()
|
||||
}
|
||||
|
||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||
super.onViewCreated(view, savedInstanceState)
|
||||
libraryViewModel.getSongs().observe(viewLifecycleOwner, Observer {
|
||||
|
|
|
@ -3,13 +3,17 @@ package code.name.monkey.retromusic.model
|
|||
import com.google.gson.annotations.SerializedName
|
||||
|
||||
data class Data(
|
||||
@SerializedName("id")
|
||||
val id: String,
|
||||
@SerializedName("link")
|
||||
val link: String,
|
||||
@SerializedName("name")
|
||||
val name: String,
|
||||
@SerializedName("nb_album")
|
||||
val nbAlbum: Int,
|
||||
@SerializedName("nb_fan")
|
||||
val nbFan: Int,
|
||||
@SerializedName("picture")
|
||||
val picture: String,
|
||||
@SerializedName("picture_big")
|
||||
val pictureBig: String,
|
||||
|
@ -19,13 +23,19 @@ data class Data(
|
|||
val pictureSmall: String,
|
||||
@SerializedName("picture_xl")
|
||||
val pictureXl: String,
|
||||
@SerializedName("radio")
|
||||
val radio: Boolean,
|
||||
@SerializedName("tracklist")
|
||||
val tracklist: String,
|
||||
@SerializedName("type")
|
||||
val type: String
|
||||
)
|
||||
|
||||
data class DeezerResponse(
|
||||
@SerializedName("data")
|
||||
val data: List<Data>,
|
||||
@SerializedName("next")
|
||||
val next: String,
|
||||
@SerializedName("total")
|
||||
val total: Int
|
||||
)
|
|
@ -21,7 +21,6 @@ import code.name.monkey.retromusic.db.*
|
|||
import code.name.monkey.retromusic.model.*
|
||||
import code.name.monkey.retromusic.model.smartplaylist.NotPlayedPlaylist
|
||||
import code.name.monkey.retromusic.network.LastFMService
|
||||
import code.name.monkey.retromusic.network.LyricsRestService
|
||||
import code.name.monkey.retromusic.network.Result
|
||||
import code.name.monkey.retromusic.network.Result.*
|
||||
import code.name.monkey.retromusic.network.model.LastFmAlbum
|
||||
|
@ -96,7 +95,6 @@ interface Repository {
|
|||
suspend fun checkSongExistInPlayCount(songId: Long): List<PlayCountEntity>
|
||||
suspend fun playCountSongs(): List<PlayCountEntity>
|
||||
suspend fun blackListPaths(): List<BlackListStoreEntity>
|
||||
suspend fun lyrics(artist: String, title: String): Result<String>
|
||||
suspend fun deleteSongs(songs: List<Song>)
|
||||
suspend fun contributor(): List<Contributor>
|
||||
}
|
||||
|
@ -113,16 +111,10 @@ class RealRepository(
|
|||
private val searchRepository: RealSearchRepository,
|
||||
private val topPlayedRepository: TopPlayedRepository,
|
||||
private val roomRepository: RoomRepository,
|
||||
private val lyricsRestService: LyricsRestService,
|
||||
private val localDataRepository: LocalDataRepository
|
||||
) : Repository {
|
||||
|
||||
override suspend fun lyrics(artist: String, title: String): Result<String> = try {
|
||||
Success(lyricsRestService.getLyrics(artist, title))
|
||||
} catch (e: Exception) {
|
||||
println(e)
|
||||
Error(e)
|
||||
}
|
||||
|
||||
|
||||
override suspend fun deleteSongs(songs: List<Song>) = roomRepository.deleteSongs(songs)
|
||||
|
||||
|
|
|
@ -154,13 +154,17 @@ class RealSongRepository(private val context: Context) : SongRepository {
|
|||
} else {
|
||||
Media.EXTERNAL_CONTENT_URI
|
||||
}
|
||||
return context.contentResolver.query(
|
||||
return try {
|
||||
context.contentResolver.query(
|
||||
uri,
|
||||
baseProjection,
|
||||
selectionFinal,
|
||||
selectionValuesFinal,
|
||||
sortOrder
|
||||
)
|
||||
} catch (ex: SecurityException) {
|
||||
return null
|
||||
}
|
||||
}
|
||||
|
||||
private fun generateBlacklistSelection(
|
||||
|
|
|
@ -63,6 +63,7 @@ import java.util.Objects;
|
|||
import java.util.Random;
|
||||
|
||||
import code.name.monkey.retromusic.R;
|
||||
import code.name.monkey.retromusic.activities.LockScreenActivity;
|
||||
import code.name.monkey.retromusic.appwidgets.AppWidgetBig;
|
||||
import code.name.monkey.retromusic.appwidgets.AppWidgetCard;
|
||||
import code.name.monkey.retromusic.appwidgets.AppWidgetClassic;
|
||||
|
@ -245,7 +246,16 @@ public class MusicService extends Service implements
|
|||
updateNotification();
|
||||
}
|
||||
};
|
||||
|
||||
private final BroadcastReceiver lockScreenReceiver = new BroadcastReceiver() {
|
||||
@Override
|
||||
public void onReceive(Context context, Intent intent) {
|
||||
if (PreferenceUtil.INSTANCE.isLockScreen() && isPlaying()) {
|
||||
Intent lockIntent = new Intent(context, LockScreenActivity.class);
|
||||
lockIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TOP);
|
||||
startActivity(lockIntent);
|
||||
}
|
||||
}
|
||||
};
|
||||
private QueueSaveHandler queueSaveHandler;
|
||||
private HandlerThread queueSaveHandlerThread;
|
||||
private boolean queuesRestored;
|
||||
|
@ -362,6 +372,7 @@ public class MusicService extends Service implements
|
|||
|
||||
registerReceiver(widgetIntentReceiver, new IntentFilter(APP_WIDGET_UPDATE));
|
||||
registerReceiver(updateFavoriteReceiver, new IntentFilter(FAVORITE_STATE_CHANGED));
|
||||
registerReceiver(lockScreenReceiver, new IntentFilter(Intent.ACTION_SCREEN_OFF));
|
||||
|
||||
initNotification();
|
||||
|
||||
|
@ -403,6 +414,7 @@ public class MusicService extends Service implements
|
|||
public void onDestroy() {
|
||||
unregisterReceiver(widgetIntentReceiver);
|
||||
unregisterReceiver(updateFavoriteReceiver);
|
||||
unregisterReceiver(lockScreenReceiver);
|
||||
if (becomingNoisyReceiverRegistered) {
|
||||
unregisterReceiver(becomingNoisyReceiver);
|
||||
becomingNoisyReceiverRegistered = false;
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
|
||||
<fragment
|
||||
android:id="@+id/playback_controls_fragment"
|
||||
android:name="code.name.monkey.retromusic.fragments.player.lockscreen.LockScreenPlayerControlsFragment"
|
||||
android:name="code.name.monkey.retromusic.fragments.player.lockscreen.LockScreenControlsFragment"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
tools:layout="@layout/fragment_lock_screen_playback_controls" />
|
||||
|
|
|
@ -145,8 +145,9 @@
|
|||
android:text="New music mix"
|
||||
android:textAppearance="@style/TextViewNormal"
|
||||
android:textStyle="bold"
|
||||
android:textSize="32sp"
|
||||
app:autoSizeMaxTextSize="32sp"
|
||||
app:autoSizeMinTextSize="18sp"
|
||||
app:autoSizeMinTextSize="24sp"
|
||||
app:autoSizeStepGranularity="1sp" />
|
||||
</com.google.android.material.card.MaterialCardView>
|
||||
|
||||
|
|
Loading…
Reference in a new issue