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