Fix issues
This commit is contained in:
parent
870cf4ce2e
commit
0e8010ad78
12 changed files with 24 additions and 120 deletions
17
app/proguard-rules.pro
vendored
17
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,18 @@
|
|||
public *;
|
||||
}
|
||||
|
||||
# OkHttp
|
||||
-keepattributes Signature
|
||||
-keepattributes *Annotation*
|
||||
-keep interface com.squareup.okhttp3.** { *; }
|
||||
-dontwarn com.squareup.okhttp3.**
|
||||
|
||||
-dontwarn
|
||||
-ignorewarnings
|
||||
|
||||
#-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
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -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?) {
|
||||
|
|
|
@ -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)
|
||||
|
||||
|
|
Loading…
Reference in a new issue