Code refactor and Flat, Fit, Full, Circle theme toolbar shadow fixes
This commit is contained in:
parent
954dfb6327
commit
724f743627
304 changed files with 3874 additions and 3524 deletions
|
@ -24,8 +24,8 @@ android {
|
||||||
vectorDrawables.useSupportLibrary = true
|
vectorDrawables.useSupportLibrary = true
|
||||||
|
|
||||||
applicationId "code.name.monkey.retromusic"
|
applicationId "code.name.monkey.retromusic"
|
||||||
versionCode 411
|
versionCode 413
|
||||||
versionName '3.4.950'
|
versionName '3.4.970'
|
||||||
|
|
||||||
multiDexEnabled true
|
multiDexEnabled true
|
||||||
|
|
||||||
|
|
|
@ -2,8 +2,8 @@
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<meta charset="utf-8">
|
<meta charset="utf-8">
|
||||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
<meta content="IE=edge" http-equiv="X-UA-Compatible">
|
||||||
<style type="text/css" media="screen">
|
<style media="screen" type="text/css">
|
||||||
|
|
||||||
* {
|
* {
|
||||||
word-wrap: break-word;
|
word-wrap: break-word;
|
||||||
|
@ -24,6 +24,7 @@
|
||||||
padding-top: 8px;
|
padding-top: 8px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
</style>
|
</style>
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
<html>
<head>
<style type="text/css">
* {
word-wrap: break-word;
}
{style-placeholder}
a {
color: {link-color};
}
a:active {
color: {link-color-active};
}
ol {
list-style-position: inside;
padding-left: 0;
padding-right: 0;
}
li {
padding-top: 8px;
}
</style>
</head>
<body>
<h4>v3.4.950</h4>
<ul>
<li>Major code refactor for library tabs</li>
<li>Folder option now in available in tabs</li>
<li>Improved drive mode page</li>
<li>Added date modified option to sort songs</li>
<li>Added toggle bluetooth connection to play on device as soon as it connected</li>
<li>Fix tablet version of app</li>
<li>Fix Album and Artist details toolbar full width for better accessibility</li>
</ul>
<h4>v3.4.900</h4>
<ul>
<li>Added playlist search</li>
<li>Added Drive mode</li>
<li>Added Album and Artist layout change option in library</li>
<li>Added Show more album and artist information in details</li>
<li>Added Pixel style scroller bar</li>
<li>Added current now playing share</li>
<li>Fix font issues and colors in some places</li>
<li>Improved Full now playing theme</li>
</ul>
<h4>v3.4.850</h4>
<ul>
<li>Added new theme called circle</li>
<li>Added tiny color card style for home artists</li>
<li>Added extra track info details to now playing themes</li>
<li>Added scroll animation</li>
<li>Added smooth transition animations 🤔</li>
<li>Added current playing tab options for Bottom Navigation View</li>
<li>Added search in genre</li>
<li>Improved selecting feedback effect(ripple with corners)</li>
<li>Fix bugs & crashes</li>
<li>Fix crashing on lyrics</li>
<li>Fix genre details last song is under mini player</li>
<li>Fix colors mistakes and font sizes</li>
<li>Fix slider jumping while scrolling in now playing themes</li>
</ul>
<h4>v3.4.800</h4>
<ul>
<li>Improved dark theme colors and Follow system theme</li>
<li>Rounded rectangle ripple for BottomNavigationView</li>
<li>Follow sleep timer dialog checkbox color as accent</li>
<li>Added song list selection for Album and Artist details</li>
<li>Fixed Toolbar popup text color when selecting songs</li>
</ul>
<h4>v3.4.700</h4>
<ul>
<li>Added splash screen(for app loading time)</li>
<li>Updated dark theme colors</li>
<li>Added circular progress view</li>
<li>Hiding year if not showing</li>
</ul>
<h4>v3.4.600</h4>
<ul>
<li>Fix notification layout height</li>
<li>Fix folder list last item not showing</li>
<li>Added auto hide/ show controls according to first and last item</li>
</ul>
<h4>v3.4.500</h4>
<ul>
<li>Added peak theme</li>
<li>Added app rating dialog</li>
<li>Fix song name scrolling in now playing themes if it's long</li>
<li>Fix playing queue last item hiding FAB</li>
<li>Added desaturated color option for dark mode</li>
<li>Fix slow search loading</li>
<li>Fix last added slow loading</li>
<li>Fix home banner toolbar corner</li>
<li>Fix home crashing when switching between two tabs</li>
<li>Fix remaining time in playing queue</li>
<li>Fix font not applied for some components</li>
<li>Fix crashing on album details sorting</li>
<li>Fixed lot of internal bugs</li>
<li>Fix dialog expand</li>
<li>Fix list card color</li>
<li>Removed SlidingUpPanel to replace with BottomSheet</li>
<li>Removed color theme as per material design guidelines</li>
<li>Removed classic theme(We're bringing back)</li>
<li>Replace line switch to Material Switch in settings</li>
<li>Performance improved</li>
<li>Updated internal libraries</li>
<li>Updated translation</li>
<li>Limiting the use of Theme engine for making use of system colors</li>
<li>Change home icon from the user icon</li>
<li>Corrected all toolbar with elevation when scrolling</li>
</ul>
<p>If you see entire app white or dark or black select same theme in settings to fix </p>
<p style="line-height:150%"><a href="https://github.com/h4h13/RetroMusicPlayer/wiki/FAQ">FAQ's</a>
</p>
<p style="line-height:150%">*If you face any UI related issues you clear app data and cache, if its
not working try to
uninstall and install again. </p>
</body>
|
<html>
<head>
<style type="text/css">
* {
word-wrap: break-word;
}
{style-placeholder}
a {
color: {link-color};
}
a:active {
color: {link-color-active};
}
ol {
list-style-position: inside;
padding-left: 0;
padding-right: 0;
}
li {
padding-top: 8px;
}
</style>
</head>
<body>
<h4>v3.4.970</h4>
<ul>
<li>Updated internal libraries</li>
<li>Added default cover with accent color</li>
<li>Major code refactor for library tabs</li>
<li>Folder option now in available in tabs</li>
<li>Improved drive mode page</li>
<li>Added date modified option to sort songs</li>
<li>Added toggle bluetooth connection to play on device as soon as it connected</li>
<li>Fix tablet version of app</li>
<li>Fix Album and Artist details toolbar full width for better accessibility</li>
</ul>
<h4>v3.4.900</h4>
<ul>
<li>Added playlist search</li>
<li>Added Drive mode</li>
<li>Added Album and Artist layout change option in library</li>
<li>Added Show more album and artist information in details</li>
<li>Added Pixel style scroller bar</li>
<li>Added current now playing share</li>
<li>Fix font issues and colors in some places</li>
<li>Improved Full now playing theme</li>
</ul>
<h4>v3.4.850</h4>
<ul>
<li>Added new theme called circle</li>
<li>Added tiny color card style for home artists</li>
<li>Added extra track info details to now playing themes</li>
<li>Added scroll animation</li>
<li>Added smooth transition animations 🤔</li>
<li>Added current playing tab options for Bottom Navigation View</li>
<li>Added search in genre</li>
<li>Improved selecting feedback effect(ripple with corners)</li>
<li>Fix bugs & crashes</li>
<li>Fix crashing on lyrics</li>
<li>Fix genre details last song is under mini player</li>
<li>Fix colors mistakes and font sizes</li>
<li>Fix slider jumping while scrolling in now playing themes</li>
</ul>
<h4>v3.4.800</h4>
<ul>
<li>Improved dark theme colors and Follow system theme</li>
<li>Rounded rectangle ripple for BottomNavigationView</li>
<li>Follow sleep timer dialog checkbox color as accent</li>
<li>Added song list selection for Album and Artist details</li>
<li>Fixed Toolbar popup text color when selecting songs</li>
</ul>
<h4>v3.4.700</h4>
<ul>
<li>Added splash screen(for app loading time)</li>
<li>Updated dark theme colors</li>
<li>Added circular progress view</li>
<li>Hiding year if not showing</li>
</ul>
<h4>v3.4.600</h4>
<ul>
<li>Fix notification layout height</li>
<li>Fix folder list last item not showing</li>
<li>Added auto hide/ show controls according to first and last item</li>
</ul>
<h4>v3.4.500</h4>
<ul>
<li>Added peak theme</li>
<li>Added app rating dialog</li>
<li>Fix song name scrolling in now playing themes if it's long</li>
<li>Fix playing queue last item hiding FAB</li>
<li>Added desaturated color option for dark mode</li>
<li>Fix slow search loading</li>
<li>Fix last added slow loading</li>
<li>Fix home banner toolbar corner</li>
<li>Fix home crashing when switching between two tabs</li>
<li>Fix remaining time in playing queue</li>
<li>Fix font not applied for some components</li>
<li>Fix crashing on album details sorting</li>
<li>Fixed lot of internal bugs</li>
<li>Fix dialog expand</li>
<li>Fix list card color</li>
<li>Removed SlidingUpPanel to replace with BottomSheet</li>
<li>Removed color theme as per material design guidelines</li>
<li>Removed classic theme(We're bringing back)</li>
<li>Replace line switch to Material Switch in settings</li>
<li>Performance improved</li>
<li>Updated internal libraries</li>
<li>Updated translation</li>
<li>Limiting the use of Theme engine for making use of system colors</li>
<li>Change home icon from the user icon</li>
<li>Corrected all toolbar with elevation when scrolling</li>
</ul>
<p>If you see entire app white or dark or black select same theme in settings to fix </p>
<p style="line-height:150%"><a href="https://github.com/h4h13/RetroMusicPlayer/wiki/FAQ">FAQ's</a>
</p>
<p style="line-height:150%">*If you face any UI related issues you clear app data and cache, if its
not working try to
uninstall and install again. </p>
</body>
|
|
@ -51,7 +51,11 @@ class App : MultiDexApplication() {
|
||||||
override fun onProductPurchased(productId: String, details: TransactionDetails?) {}
|
override fun onProductPurchased(productId: String, details: TransactionDetails?) {}
|
||||||
|
|
||||||
override fun onPurchaseHistoryRestored() {
|
override fun onPurchaseHistoryRestored() {
|
||||||
Toast.makeText(this@App, R.string.restored_previous_purchase_please_restart, Toast.LENGTH_LONG)
|
Toast.makeText(
|
||||||
|
this@App,
|
||||||
|
R.string.restored_previous_purchase_please_restart,
|
||||||
|
Toast.LENGTH_LONG
|
||||||
|
)
|
||||||
.show()
|
.show()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -79,7 +83,9 @@ class App : MultiDexApplication() {
|
||||||
}
|
}
|
||||||
|
|
||||||
fun isProVersion(): Boolean {
|
fun isProVersion(): Boolean {
|
||||||
return BuildConfig.DEBUG || instance?.billingProcessor!!.isPurchased(PRO_VERSION_PRODUCT_ID)
|
return BuildConfig.DEBUG || instance?.billingProcessor!!.isPurchased(
|
||||||
|
PRO_VERSION_PRODUCT_ID
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
lateinit var musicComponent: MusicComponent
|
lateinit var musicComponent: MusicComponent
|
||||||
|
|
|
@ -19,7 +19,8 @@ import android.provider.MediaStore
|
||||||
|
|
||||||
object Constants {
|
object Constants {
|
||||||
|
|
||||||
const val RATE_ON_GOOGLE_PLAY = "https://play.google.com/store/apps/details?id=code.name.monkey.retromusic"
|
const val RATE_ON_GOOGLE_PLAY =
|
||||||
|
"https://play.google.com/store/apps/details?id=code.name.monkey.retromusic"
|
||||||
const val TRANSLATE = "http://monkeycodeapp.oneskyapp.com/collaboration/project?id=238534"
|
const val TRANSLATE = "http://monkeycodeapp.oneskyapp.com/collaboration/project?id=238534"
|
||||||
const val GITHUB_PROJECT = "https://github.com/h4h13/RetroMusicPlayer"
|
const val GITHUB_PROJECT = "https://github.com/h4h13/RetroMusicPlayer"
|
||||||
const val TELEGRAM_CHANGE_LOG = "https://t.me/retromusiclog"
|
const val TELEGRAM_CHANGE_LOG = "https://t.me/retromusiclog"
|
||||||
|
@ -31,9 +32,11 @@ object Constants {
|
||||||
const val FAQ_LINK = "https://github.com/h4h13/RetroMusicPlayer/blob/master/FAQ.md"
|
const val FAQ_LINK = "https://github.com/h4h13/RetroMusicPlayer/blob/master/FAQ.md"
|
||||||
const val PINTEREST = "https://in.pinterest.com/retromusicapp/"
|
const val PINTEREST = "https://in.pinterest.com/retromusicapp/"
|
||||||
|
|
||||||
const val BASE_SELECTION = MediaStore.Audio.AudioColumns.IS_MUSIC + "=1" + " AND " + MediaStore.Audio.AudioColumns.TITLE + " != ''"
|
const val BASE_SELECTION =
|
||||||
|
MediaStore.Audio.AudioColumns.IS_MUSIC + "=1" + " AND " + MediaStore.Audio.AudioColumns.TITLE + " != ''"
|
||||||
|
|
||||||
val baseProjection = arrayOf(BaseColumns._ID, // 0
|
val baseProjection = arrayOf(
|
||||||
|
BaseColumns._ID, // 0
|
||||||
MediaStore.Audio.AudioColumns.TITLE, // 1
|
MediaStore.Audio.AudioColumns.TITLE, // 1
|
||||||
MediaStore.Audio.AudioColumns.TRACK, // 2
|
MediaStore.Audio.AudioColumns.TRACK, // 2
|
||||||
MediaStore.Audio.AudioColumns.YEAR, // 3
|
MediaStore.Audio.AudioColumns.YEAR, // 3
|
||||||
|
@ -44,6 +47,7 @@ object Constants {
|
||||||
MediaStore.Audio.AudioColumns.ALBUM, // 8
|
MediaStore.Audio.AudioColumns.ALBUM, // 8
|
||||||
MediaStore.Audio.AudioColumns.ARTIST_ID, // 9
|
MediaStore.Audio.AudioColumns.ARTIST_ID, // 9
|
||||||
MediaStore.Audio.AudioColumns.ARTIST,// 10
|
MediaStore.Audio.AudioColumns.ARTIST,// 10
|
||||||
MediaStore.Audio.AudioColumns.COMPOSER)// 11
|
MediaStore.Audio.AudioColumns.COMPOSER
|
||||||
|
)// 11
|
||||||
const val NUMBER_OF_TOP_TRACKS = 99
|
const val NUMBER_OF_TOP_TRACKS = 99
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,22 +32,11 @@ import com.afollestad.materialdialogs.bottomsheets.BottomSheet
|
||||||
import com.afollestad.materialdialogs.list.listItems
|
import com.afollestad.materialdialogs.list.listItems
|
||||||
import com.google.gson.Gson
|
import com.google.gson.Gson
|
||||||
import com.google.gson.reflect.TypeToken
|
import com.google.gson.reflect.TypeToken
|
||||||
import kotlinx.android.synthetic.main.activity_about.toolbar
|
import kotlinx.android.synthetic.main.activity_about.*
|
||||||
import kotlinx.android.synthetic.main.card_credit.recyclerView
|
import kotlinx.android.synthetic.main.card_credit.*
|
||||||
import kotlinx.android.synthetic.main.card_other.changelog
|
import kotlinx.android.synthetic.main.card_other.*
|
||||||
import kotlinx.android.synthetic.main.card_other.openSource
|
import kotlinx.android.synthetic.main.card_retro_info.*
|
||||||
import kotlinx.android.synthetic.main.card_other.version
|
import kotlinx.android.synthetic.main.card_social.*
|
||||||
import kotlinx.android.synthetic.main.card_retro_info.appGithub
|
|
||||||
import kotlinx.android.synthetic.main.card_retro_info.appRate
|
|
||||||
import kotlinx.android.synthetic.main.card_retro_info.appShare
|
|
||||||
import kotlinx.android.synthetic.main.card_retro_info.appTranslation
|
|
||||||
import kotlinx.android.synthetic.main.card_retro_info.bugReportLink
|
|
||||||
import kotlinx.android.synthetic.main.card_retro_info.donateLink
|
|
||||||
import kotlinx.android.synthetic.main.card_retro_info.faqLink
|
|
||||||
import kotlinx.android.synthetic.main.card_social.instagramLink
|
|
||||||
import kotlinx.android.synthetic.main.card_social.pinterestLink
|
|
||||||
import kotlinx.android.synthetic.main.card_social.telegramLink
|
|
||||||
import kotlinx.android.synthetic.main.card_social.twitterLink
|
|
||||||
import java.io.IOException
|
import java.io.IOException
|
||||||
import java.nio.charset.StandardCharsets
|
import java.nio.charset.StandardCharsets
|
||||||
|
|
||||||
|
|
|
@ -30,7 +30,6 @@ import code.name.monkey.retromusic.extensions.show
|
||||||
import code.name.monkey.retromusic.glide.AlbumGlideRequest
|
import code.name.monkey.retromusic.glide.AlbumGlideRequest
|
||||||
import code.name.monkey.retromusic.glide.ArtistGlideRequest
|
import code.name.monkey.retromusic.glide.ArtistGlideRequest
|
||||||
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.helper.MusicPlayerRemote
|
import code.name.monkey.retromusic.helper.MusicPlayerRemote
|
||||||
import code.name.monkey.retromusic.helper.SortOrder.AlbumSongSortOrder
|
import code.name.monkey.retromusic.helper.SortOrder.AlbumSongSortOrder
|
||||||
import code.name.monkey.retromusic.interfaces.CabHolder
|
import code.name.monkey.retromusic.interfaces.CabHolder
|
||||||
|
@ -39,31 +38,12 @@ import code.name.monkey.retromusic.model.Artist
|
||||||
import code.name.monkey.retromusic.mvp.presenter.AlbumDetailsPresenter
|
import code.name.monkey.retromusic.mvp.presenter.AlbumDetailsPresenter
|
||||||
import code.name.monkey.retromusic.mvp.presenter.AlbumDetailsView
|
import code.name.monkey.retromusic.mvp.presenter.AlbumDetailsView
|
||||||
import code.name.monkey.retromusic.rest.model.LastFmAlbum
|
import code.name.monkey.retromusic.rest.model.LastFmAlbum
|
||||||
import code.name.monkey.retromusic.util.MusicUtil
|
import code.name.monkey.retromusic.util.*
|
||||||
import code.name.monkey.retromusic.util.NavigationUtil
|
|
||||||
import code.name.monkey.retromusic.util.PreferenceUtil
|
|
||||||
import code.name.monkey.retromusic.util.RetroColorUtil
|
|
||||||
import code.name.monkey.retromusic.util.RetroUtil
|
|
||||||
import com.afollestad.materialcab.MaterialCab
|
import com.afollestad.materialcab.MaterialCab
|
||||||
import com.bumptech.glide.Glide
|
import com.bumptech.glide.Glide
|
||||||
import kotlinx.android.synthetic.main.activity_album.albumCoverContainer
|
import kotlinx.android.synthetic.main.activity_album.*
|
||||||
import kotlinx.android.synthetic.main.activity_album.albumText
|
import kotlinx.android.synthetic.main.activity_album_content.*
|
||||||
import kotlinx.android.synthetic.main.activity_album.albumTitle
|
import java.util.*
|
||||||
import kotlinx.android.synthetic.main.activity_album.image
|
|
||||||
import kotlinx.android.synthetic.main.activity_album.toolbar
|
|
||||||
import kotlinx.android.synthetic.main.activity_album_content.aboutAlbumText
|
|
||||||
import kotlinx.android.synthetic.main.activity_album_content.aboutAlbumTitle
|
|
||||||
import kotlinx.android.synthetic.main.activity_album_content.listeners
|
|
||||||
import kotlinx.android.synthetic.main.activity_album_content.listenersLabel
|
|
||||||
import kotlinx.android.synthetic.main.activity_album_content.moreRecyclerView
|
|
||||||
import kotlinx.android.synthetic.main.activity_album_content.moreTitle
|
|
||||||
import kotlinx.android.synthetic.main.activity_album_content.playAction
|
|
||||||
import kotlinx.android.synthetic.main.activity_album_content.recyclerView
|
|
||||||
import kotlinx.android.synthetic.main.activity_album_content.scrobbles
|
|
||||||
import kotlinx.android.synthetic.main.activity_album_content.scrobblesLabel
|
|
||||||
import kotlinx.android.synthetic.main.activity_album_content.shuffleAction
|
|
||||||
import kotlinx.android.synthetic.main.activity_album_content.songTitle
|
|
||||||
import java.util.ArrayList
|
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
import android.util.Pair as UtilPair
|
import android.util.Pair as UtilPair
|
||||||
|
|
||||||
|
@ -127,7 +107,8 @@ class AlbumDetailsActivity : AbsSlidingMusicPanelActivity(), AlbumDetailsView, C
|
||||||
if (intent.extras!!.containsKey(EXTRA_ALBUM_ID)) {
|
if (intent.extras!!.containsKey(EXTRA_ALBUM_ID)) {
|
||||||
intent.extras?.getInt(EXTRA_ALBUM_ID)?.let {
|
intent.extras?.getInt(EXTRA_ALBUM_ID)?.let {
|
||||||
albumDetailsPresenter.loadAlbum(it)
|
albumDetailsPresenter.loadAlbum(it)
|
||||||
albumCoverContainer?.transitionName = "${getString(R.string.transition_album_art)}_$it"
|
albumCoverContainer?.transitionName =
|
||||||
|
"${getString(R.string.transition_album_art)}_$it"
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
finish()
|
finish()
|
||||||
|
@ -357,7 +338,8 @@ class AlbumDetailsActivity : AbsSlidingMusicPanelActivity(), AlbumDetailsView, C
|
||||||
R.id.action_sort_order_title -> sortOrder = AlbumSongSortOrder.SONG_A_Z
|
R.id.action_sort_order_title -> sortOrder = AlbumSongSortOrder.SONG_A_Z
|
||||||
R.id.action_sort_order_title_desc -> sortOrder = AlbumSongSortOrder.SONG_Z_A
|
R.id.action_sort_order_title_desc -> sortOrder = AlbumSongSortOrder.SONG_Z_A
|
||||||
R.id.action_sort_order_track_list -> sortOrder = AlbumSongSortOrder.SONG_TRACK_LIST
|
R.id.action_sort_order_track_list -> sortOrder = AlbumSongSortOrder.SONG_TRACK_LIST
|
||||||
R.id.action_sort_order_artist_song_duration -> sortOrder = AlbumSongSortOrder.SONG_DURATION
|
R.id.action_sort_order_artist_song_duration -> sortOrder =
|
||||||
|
AlbumSongSortOrder.SONG_DURATION
|
||||||
}
|
}
|
||||||
if (sortOrder != null) {
|
if (sortOrder != null) {
|
||||||
item.isChecked = true
|
item.isChecked = true
|
||||||
|
@ -368,9 +350,12 @@ class AlbumDetailsActivity : AbsSlidingMusicPanelActivity(), AlbumDetailsView, C
|
||||||
|
|
||||||
private fun setUpSortOrderMenu(sortOrder: SubMenu) {
|
private fun setUpSortOrderMenu(sortOrder: SubMenu) {
|
||||||
when (savedSortOrder) {
|
when (savedSortOrder) {
|
||||||
AlbumSongSortOrder.SONG_A_Z -> sortOrder.findItem(R.id.action_sort_order_title).isChecked = true
|
AlbumSongSortOrder.SONG_A_Z -> sortOrder.findItem(R.id.action_sort_order_title)
|
||||||
AlbumSongSortOrder.SONG_Z_A -> sortOrder.findItem(R.id.action_sort_order_title_desc).isChecked = true
|
.isChecked = true
|
||||||
AlbumSongSortOrder.SONG_TRACK_LIST -> sortOrder.findItem(R.id.action_sort_order_track_list).isChecked =
|
AlbumSongSortOrder.SONG_Z_A -> sortOrder.findItem(R.id.action_sort_order_title_desc)
|
||||||
|
.isChecked = true
|
||||||
|
AlbumSongSortOrder.SONG_TRACK_LIST -> sortOrder.findItem(R.id.action_sort_order_track_list)
|
||||||
|
.isChecked =
|
||||||
true
|
true
|
||||||
AlbumSongSortOrder.SONG_DURATION -> sortOrder.findItem(R.id.action_sort_order_artist_song_duration)
|
AlbumSongSortOrder.SONG_DURATION -> sortOrder.findItem(R.id.action_sort_order_artist_song_duration)
|
||||||
.isChecked = true
|
.isChecked = true
|
||||||
|
|
|
@ -33,32 +33,14 @@ import code.name.monkey.retromusic.model.Artist
|
||||||
import code.name.monkey.retromusic.mvp.presenter.ArtistDetailsPresenter
|
import code.name.monkey.retromusic.mvp.presenter.ArtistDetailsPresenter
|
||||||
import code.name.monkey.retromusic.mvp.presenter.ArtistDetailsView
|
import code.name.monkey.retromusic.mvp.presenter.ArtistDetailsView
|
||||||
import code.name.monkey.retromusic.rest.model.LastFmArtist
|
import code.name.monkey.retromusic.rest.model.LastFmArtist
|
||||||
import code.name.monkey.retromusic.util.CustomArtistImageUtil
|
import code.name.monkey.retromusic.util.*
|
||||||
import code.name.monkey.retromusic.util.MusicUtil
|
|
||||||
import code.name.monkey.retromusic.util.PreferenceUtil
|
|
||||||
import code.name.monkey.retromusic.util.RetroColorUtil
|
|
||||||
import code.name.monkey.retromusic.util.RetroUtil
|
|
||||||
import com.afollestad.materialcab.MaterialCab
|
import com.afollestad.materialcab.MaterialCab
|
||||||
import com.bumptech.glide.Glide
|
import com.bumptech.glide.Glide
|
||||||
import kotlinx.android.synthetic.main.activity_artist_content.albumRecyclerView
|
import kotlinx.android.synthetic.main.activity_artist_content.*
|
||||||
import kotlinx.android.synthetic.main.activity_artist_content.albumTitle
|
import kotlinx.android.synthetic.main.activity_artist_details.*
|
||||||
import kotlinx.android.synthetic.main.activity_artist_content.biographyText
|
import java.util.*
|
||||||
import kotlinx.android.synthetic.main.activity_artist_content.biographyTitle
|
|
||||||
import kotlinx.android.synthetic.main.activity_artist_content.listeners
|
|
||||||
import kotlinx.android.synthetic.main.activity_artist_content.listenersLabel
|
|
||||||
import kotlinx.android.synthetic.main.activity_artist_content.playAction
|
|
||||||
import kotlinx.android.synthetic.main.activity_artist_content.recyclerView
|
|
||||||
import kotlinx.android.synthetic.main.activity_artist_content.scrobbles
|
|
||||||
import kotlinx.android.synthetic.main.activity_artist_content.scrobblesLabel
|
|
||||||
import kotlinx.android.synthetic.main.activity_artist_content.shuffleAction
|
|
||||||
import kotlinx.android.synthetic.main.activity_artist_content.songTitle
|
|
||||||
import kotlinx.android.synthetic.main.activity_artist_details.artistCoverContainer
|
|
||||||
import kotlinx.android.synthetic.main.activity_artist_details.artistTitle
|
|
||||||
import kotlinx.android.synthetic.main.activity_artist_details.image
|
|
||||||
import kotlinx.android.synthetic.main.activity_artist_details.text
|
|
||||||
import kotlinx.android.synthetic.main.activity_artist_details.toolbar
|
|
||||||
import java.util.Locale
|
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
|
import kotlin.collections.ArrayList
|
||||||
|
|
||||||
class ArtistDetailActivity : AbsSlidingMusicPanelActivity(), ArtistDetailsView, CabHolder {
|
class ArtistDetailActivity : AbsSlidingMusicPanelActivity(), ArtistDetailsView, CabHolder {
|
||||||
override fun openCab(menuRes: Int, callback: MaterialCab.Callback): MaterialCab {
|
override fun openCab(menuRes: Int, callback: MaterialCab.Callback): MaterialCab {
|
||||||
|
@ -238,8 +220,10 @@ class ArtistDetailActivity : AbsSlidingMusicPanelActivity(), ArtistDetailsView,
|
||||||
scrobbles.show()
|
scrobbles.show()
|
||||||
scrobblesLabel.show()
|
scrobblesLabel.show()
|
||||||
|
|
||||||
listeners.text = RetroUtil.formatValue(lastFmArtist.artist.stats.listeners.toFloat())
|
listeners.text =
|
||||||
scrobbles.text = RetroUtil.formatValue(lastFmArtist.artist.stats.playcount.toFloat())
|
RetroUtil.formatValue(lastFmArtist.artist.stats.listeners.toFloat())
|
||||||
|
scrobbles.text =
|
||||||
|
RetroUtil.formatValue(lastFmArtist.artist.stats.playcount.toFloat())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -318,9 +302,14 @@ class ArtistDetailActivity : AbsSlidingMusicPanelActivity(), ArtistDetailsView,
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
R.id.action_reset_artist_image -> {
|
R.id.action_reset_artist_image -> {
|
||||||
Toast.makeText(this@ArtistDetailActivity, resources.getString(R.string.updating), Toast.LENGTH_SHORT)
|
Toast.makeText(
|
||||||
|
this@ArtistDetailActivity,
|
||||||
|
resources.getString(R.string.updating),
|
||||||
|
Toast.LENGTH_SHORT
|
||||||
|
)
|
||||||
.show()
|
.show()
|
||||||
CustomArtistImageUtil.getInstance(this@ArtistDetailActivity).resetCustomArtistImage(artist)
|
CustomArtistImageUtil.getInstance(this@ArtistDetailActivity)
|
||||||
|
.resetCustomArtistImage(artist)
|
||||||
forceDownload = true
|
forceDownload = true
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,19 +35,7 @@ import code.name.monkey.retromusic.misc.SimpleOnSeekbarChangeListener
|
||||||
import code.name.monkey.retromusic.service.MusicService
|
import code.name.monkey.retromusic.service.MusicService
|
||||||
import code.name.monkey.retromusic.util.MusicUtil
|
import code.name.monkey.retromusic.util.MusicUtil
|
||||||
import com.bumptech.glide.Glide
|
import com.bumptech.glide.Glide
|
||||||
import kotlinx.android.synthetic.main.activity_drive_mode.close
|
import kotlinx.android.synthetic.main.activity_drive_mode.*
|
||||||
import kotlinx.android.synthetic.main.activity_drive_mode.image
|
|
||||||
import kotlinx.android.synthetic.main.activity_drive_mode.nextButton
|
|
||||||
import kotlinx.android.synthetic.main.activity_drive_mode.playPauseButton
|
|
||||||
import kotlinx.android.synthetic.main.activity_drive_mode.previousButton
|
|
||||||
import kotlinx.android.synthetic.main.activity_drive_mode.progressSlider
|
|
||||||
import kotlinx.android.synthetic.main.activity_drive_mode.repeatButton
|
|
||||||
import kotlinx.android.synthetic.main.activity_drive_mode.shuffleButton
|
|
||||||
import kotlinx.android.synthetic.main.activity_drive_mode.songCurrentProgress
|
|
||||||
import kotlinx.android.synthetic.main.activity_drive_mode.songFavourite
|
|
||||||
import kotlinx.android.synthetic.main.activity_drive_mode.songText
|
|
||||||
import kotlinx.android.synthetic.main.activity_drive_mode.songTitle
|
|
||||||
import kotlinx.android.synthetic.main.activity_drive_mode.songTotalTime
|
|
||||||
import kotlinx.coroutines.CoroutineScope
|
import kotlinx.coroutines.CoroutineScope
|
||||||
import kotlinx.coroutines.Dispatchers
|
import kotlinx.coroutines.Dispatchers
|
||||||
import kotlinx.coroutines.launch
|
import kotlinx.coroutines.launch
|
||||||
|
@ -96,7 +84,8 @@ class DriveModeActivity : AbsMusicServiceActivity(), Callback {
|
||||||
|
|
||||||
private fun toggleFavourite() {
|
private fun toggleFavourite() {
|
||||||
CoroutineScope(Dispatchers.IO).launch {
|
CoroutineScope(Dispatchers.IO).launch {
|
||||||
val isFavourite = MusicUtil.isFavorite(this@DriveModeActivity, MusicPlayerRemote.currentSong)
|
val isFavourite =
|
||||||
|
MusicUtil.isFavorite(this@DriveModeActivity, MusicPlayerRemote.currentSong)
|
||||||
withContext(Dispatchers.Main) {
|
withContext(Dispatchers.Main) {
|
||||||
songFavourite.setImageResource(if (isFavourite) R.drawable.ic_favorite_white_24dp else R.drawable.ic_favorite_border_white_24dp)
|
songFavourite.setImageResource(if (isFavourite) R.drawable.ic_favorite_white_24dp else R.drawable.ic_favorite_border_white_24dp)
|
||||||
}
|
}
|
||||||
|
@ -183,7 +172,10 @@ class DriveModeActivity : AbsMusicServiceActivity(), Callback {
|
||||||
lastPlaybackControlsColor,
|
lastPlaybackControlsColor,
|
||||||
PorterDuff.Mode.SRC_IN
|
PorterDuff.Mode.SRC_IN
|
||||||
)
|
)
|
||||||
else -> shuffleButton.setColorFilter(lastDisabledPlaybackControlsColor, PorterDuff.Mode.SRC_IN)
|
else -> shuffleButton.setColorFilter(
|
||||||
|
lastDisabledPlaybackControlsColor,
|
||||||
|
PorterDuff.Mode.SRC_IN
|
||||||
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -191,7 +183,10 @@ class DriveModeActivity : AbsMusicServiceActivity(), Callback {
|
||||||
when (MusicPlayerRemote.repeatMode) {
|
when (MusicPlayerRemote.repeatMode) {
|
||||||
MusicService.REPEAT_MODE_NONE -> {
|
MusicService.REPEAT_MODE_NONE -> {
|
||||||
repeatButton.setImageResource(R.drawable.ic_repeat_white_24dp)
|
repeatButton.setImageResource(R.drawable.ic_repeat_white_24dp)
|
||||||
repeatButton.setColorFilter(lastDisabledPlaybackControlsColor, PorterDuff.Mode.SRC_IN)
|
repeatButton.setColorFilter(
|
||||||
|
lastDisabledPlaybackControlsColor,
|
||||||
|
PorterDuff.Mode.SRC_IN
|
||||||
|
)
|
||||||
}
|
}
|
||||||
MusicService.REPEAT_MODE_ALL -> {
|
MusicService.REPEAT_MODE_ALL -> {
|
||||||
repeatButton.setImageResource(R.drawable.ic_repeat_white_24dp)
|
repeatButton.setImageResource(R.drawable.ic_repeat_white_24dp)
|
||||||
|
|
|
@ -21,11 +21,8 @@ import code.name.monkey.retromusic.mvp.presenter.GenreDetailsView
|
||||||
import code.name.monkey.retromusic.util.DensityUtil
|
import code.name.monkey.retromusic.util.DensityUtil
|
||||||
import code.name.monkey.retromusic.util.RetroColorUtil
|
import code.name.monkey.retromusic.util.RetroColorUtil
|
||||||
import com.afollestad.materialcab.MaterialCab
|
import com.afollestad.materialcab.MaterialCab
|
||||||
import kotlinx.android.synthetic.main.activity_playlist_detail.empty
|
import kotlinx.android.synthetic.main.activity_playlist_detail.*
|
||||||
import kotlinx.android.synthetic.main.activity_playlist_detail.emptyEmoji
|
import java.util.*
|
||||||
import kotlinx.android.synthetic.main.activity_playlist_detail.recyclerView
|
|
||||||
import kotlinx.android.synthetic.main.activity_playlist_detail.toolbar
|
|
||||||
import java.util.ArrayList
|
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -134,7 +131,8 @@ class GenreDetailsActivity : AbsSlidingMusicPanelActivity(), CabHolder, GenreDet
|
||||||
|
|
||||||
override fun openCab(menuRes: Int, callback: MaterialCab.Callback): MaterialCab {
|
override fun openCab(menuRes: Int, callback: MaterialCab.Callback): MaterialCab {
|
||||||
if (cab != null && cab!!.isActive) cab?.finish()
|
if (cab != null && cab!!.isActive) cab?.finish()
|
||||||
cab = MaterialCab(this, R.id.cab_stub).setMenu(menuRes).setCloseDrawableRes(R.drawable.ic_close_white_24dp)
|
cab = MaterialCab(this, R.id.cab_stub).setMenu(menuRes)
|
||||||
|
.setCloseDrawableRes(R.drawable.ic_close_white_24dp)
|
||||||
.setBackgroundColor(
|
.setBackgroundColor(
|
||||||
RetroColorUtil.shiftBackgroundColorForLightText(
|
RetroColorUtil.shiftBackgroundColorForLightText(
|
||||||
ATHUtil.resolveColor(
|
ATHUtil.resolveColor(
|
||||||
|
|
|
@ -18,19 +18,23 @@ import android.graphics.Color;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.view.MenuItem;
|
import android.view.MenuItem;
|
||||||
import android.webkit.WebView;
|
import android.webkit.WebView;
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
import androidx.appcompat.widget.Toolbar;
|
import androidx.appcompat.widget.Toolbar;
|
||||||
|
|
||||||
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
|
||||||
|
import java.io.BufferedReader;
|
||||||
|
import java.io.InputStream;
|
||||||
|
import java.io.InputStreamReader;
|
||||||
|
import java.nio.charset.StandardCharsets;
|
||||||
|
|
||||||
import code.name.monkey.appthemehelper.ThemeStore;
|
import code.name.monkey.appthemehelper.ThemeStore;
|
||||||
import code.name.monkey.appthemehelper.util.ATHUtil;
|
import code.name.monkey.appthemehelper.util.ATHUtil;
|
||||||
import code.name.monkey.appthemehelper.util.ColorUtil;
|
import code.name.monkey.appthemehelper.util.ColorUtil;
|
||||||
import code.name.monkey.appthemehelper.util.ToolbarContentTintHelper;
|
import code.name.monkey.appthemehelper.util.ToolbarContentTintHelper;
|
||||||
import code.name.monkey.retromusic.R;
|
import code.name.monkey.retromusic.R;
|
||||||
import code.name.monkey.retromusic.activities.base.AbsBaseActivity;
|
import code.name.monkey.retromusic.activities.base.AbsBaseActivity;
|
||||||
import java.io.BufferedReader;
|
|
||||||
import java.io.InputStream;
|
|
||||||
import java.io.InputStreamReader;
|
|
||||||
import java.nio.charset.StandardCharsets;
|
|
||||||
import org.jetbrains.annotations.Nullable;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by hemanths on 2019-09-27.
|
* Created by hemanths on 2019-09-27.
|
||||||
|
|
|
@ -18,7 +18,7 @@ import com.r0adkll.slidr.Slidr
|
||||||
import com.r0adkll.slidr.model.SlidrConfig
|
import com.r0adkll.slidr.model.SlidrConfig
|
||||||
import com.r0adkll.slidr.model.SlidrListener
|
import com.r0adkll.slidr.model.SlidrListener
|
||||||
import com.r0adkll.slidr.model.SlidrPosition
|
import com.r0adkll.slidr.model.SlidrPosition
|
||||||
import kotlinx.android.synthetic.main.activity_lock_screen.image
|
import kotlinx.android.synthetic.main.activity_lock_screen.*
|
||||||
|
|
||||||
class LockScreenActivity : AbsMusicServiceActivity() {
|
class LockScreenActivity : AbsMusicServiceActivity() {
|
||||||
private var fragment: LockScreenPlayerControlsFragment? = null
|
private var fragment: LockScreenPlayerControlsFragment? = null
|
||||||
|
@ -29,9 +29,11 @@ class LockScreenActivity : AbsMusicServiceActivity() {
|
||||||
setShowWhenLocked(true)
|
setShowWhenLocked(true)
|
||||||
setTurnScreenOn(true)
|
setTurnScreenOn(true)
|
||||||
} else {
|
} else {
|
||||||
this.window.addFlags(WindowManager.LayoutParams.FLAG_DISMISS_KEYGUARD or
|
this.window.addFlags(
|
||||||
|
WindowManager.LayoutParams.FLAG_DISMISS_KEYGUARD or
|
||||||
WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED or
|
WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED or
|
||||||
WindowManager.LayoutParams.FLAG_TURN_SCREEN_ON)
|
WindowManager.LayoutParams.FLAG_TURN_SCREEN_ON
|
||||||
|
)
|
||||||
}
|
}
|
||||||
setDrawUnderStatusBar()
|
setDrawUnderStatusBar()
|
||||||
setContentView(R.layout.activity_lock_screen)
|
setContentView(R.layout.activity_lock_screen)
|
||||||
|
@ -53,7 +55,8 @@ class LockScreenActivity : AbsMusicServiceActivity() {
|
||||||
|
|
||||||
override fun onSlideClosed(): Boolean {
|
override fun onSlideClosed(): Boolean {
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||||
val keyguardManager = getSystemService(Context.KEYGUARD_SERVICE) as KeyguardManager
|
val keyguardManager =
|
||||||
|
getSystemService(Context.KEYGUARD_SERVICE) as KeyguardManager
|
||||||
keyguardManager.requestDismissKeyguard(this@LockScreenActivity, null)
|
keyguardManager.requestDismissKeyguard(this@LockScreenActivity, null)
|
||||||
}
|
}
|
||||||
finish()
|
finish()
|
||||||
|
|
|
@ -8,11 +8,7 @@ import android.os.Build
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import android.text.InputType
|
import android.text.InputType
|
||||||
import android.text.TextUtils
|
import android.text.TextUtils
|
||||||
import android.view.LayoutInflater
|
import android.view.*
|
||||||
import android.view.MenuItem
|
|
||||||
import android.view.View
|
|
||||||
import android.view.ViewGroup
|
|
||||||
import android.view.WindowManager
|
|
||||||
import androidx.annotation.StringRes
|
import androidx.annotation.StringRes
|
||||||
import androidx.core.content.ContextCompat
|
import androidx.core.content.ContextCompat
|
||||||
import androidx.fragment.app.Fragment
|
import androidx.fragment.app.Fragment
|
||||||
|
@ -20,13 +16,8 @@ import androidx.fragment.app.FragmentManager
|
||||||
import androidx.fragment.app.FragmentStatePagerAdapter
|
import androidx.fragment.app.FragmentStatePagerAdapter
|
||||||
import androidx.viewpager.widget.ViewPager
|
import androidx.viewpager.widget.ViewPager
|
||||||
import code.name.monkey.appthemehelper.ThemeStore
|
import code.name.monkey.appthemehelper.ThemeStore
|
||||||
import code.name.monkey.appthemehelper.util.ATHUtil
|
import code.name.monkey.appthemehelper.util.*
|
||||||
import code.name.monkey.appthemehelper.util.ATHUtil.resolveColor
|
import code.name.monkey.appthemehelper.util.ATHUtil.resolveColor
|
||||||
import code.name.monkey.appthemehelper.util.ColorUtil
|
|
||||||
import code.name.monkey.appthemehelper.util.MaterialUtil
|
|
||||||
import code.name.monkey.appthemehelper.util.MaterialValueHelper
|
|
||||||
import code.name.monkey.appthemehelper.util.TintHelper
|
|
||||||
import code.name.monkey.appthemehelper.util.ToolbarContentTintHelper
|
|
||||||
import code.name.monkey.retromusic.App
|
import code.name.monkey.retromusic.App
|
||||||
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
|
||||||
|
@ -47,17 +38,17 @@ import com.afollestad.materialdialogs.MaterialDialog
|
||||||
import com.afollestad.materialdialogs.bottomsheets.BottomSheet
|
import com.afollestad.materialdialogs.bottomsheets.BottomSheet
|
||||||
import com.afollestad.materialdialogs.input.getInputLayout
|
import com.afollestad.materialdialogs.input.getInputLayout
|
||||||
import com.afollestad.materialdialogs.input.input
|
import com.afollestad.materialdialogs.input.input
|
||||||
import kotlinx.android.synthetic.main.activity_lyrics.fab
|
import kotlinx.android.synthetic.main.activity_lyrics.*
|
||||||
import kotlinx.android.synthetic.main.activity_lyrics.tabs
|
import kotlinx.android.synthetic.main.fragment_lyrics.*
|
||||||
import kotlinx.android.synthetic.main.activity_lyrics.toolbar
|
import kotlinx.android.synthetic.main.fragment_synced.*
|
||||||
import kotlinx.android.synthetic.main.activity_lyrics.viewPager
|
|
||||||
import kotlinx.android.synthetic.main.fragment_lyrics.offlineLyrics
|
|
||||||
import kotlinx.android.synthetic.main.fragment_synced.lyricsView
|
|
||||||
import org.jaudiotagger.tag.FieldKey
|
import org.jaudiotagger.tag.FieldKey
|
||||||
import java.io.File
|
import java.io.File
|
||||||
import java.util.EnumMap
|
import java.util.*
|
||||||
|
import kotlin.collections.ArrayList
|
||||||
|
import kotlin.collections.set
|
||||||
|
|
||||||
class LyricsActivity : AbsMusicServiceActivity(), View.OnClickListener, ViewPager.OnPageChangeListener {
|
class LyricsActivity : AbsMusicServiceActivity(), View.OnClickListener,
|
||||||
|
ViewPager.OnPageChangeListener {
|
||||||
override fun onPageScrollStateChanged(state: Int) {
|
override fun onPageScrollStateChanged(state: Int) {
|
||||||
when (state) {
|
when (state) {
|
||||||
ViewPager.SCROLL_STATE_IDLE -> fab.show()
|
ViewPager.SCROLL_STATE_IDLE -> fab.show()
|
||||||
|
|
|
@ -33,11 +33,25 @@ import android.view.Menu;
|
||||||
import android.view.MenuItem;
|
import android.view.MenuItem;
|
||||||
import android.view.SubMenu;
|
import android.view.SubMenu;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
import androidx.appcompat.widget.Toolbar;
|
import androidx.appcompat.widget.Toolbar;
|
||||||
import androidx.core.app.ActivityCompat;
|
import androidx.core.app.ActivityCompat;
|
||||||
import androidx.fragment.app.Fragment;
|
import androidx.fragment.app.Fragment;
|
||||||
import androidx.transition.TransitionManager;
|
import androidx.transition.TransitionManager;
|
||||||
|
|
||||||
|
import com.afollestad.materialcab.MaterialCab;
|
||||||
|
import com.afollestad.materialcab.MaterialCab.Callback;
|
||||||
|
import com.google.android.material.appbar.AppBarLayout;
|
||||||
|
import com.google.android.material.card.MaterialCardView;
|
||||||
|
import com.google.android.material.textview.MaterialTextView;
|
||||||
|
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
import code.name.monkey.appthemehelper.util.ATHUtil;
|
import code.name.monkey.appthemehelper.util.ATHUtil;
|
||||||
import code.name.monkey.appthemehelper.util.ToolbarContentTintHelper;
|
import code.name.monkey.appthemehelper.util.ToolbarContentTintHelper;
|
||||||
import code.name.monkey.retromusic.R;
|
import code.name.monkey.retromusic.R;
|
||||||
|
@ -47,12 +61,12 @@ import code.name.monkey.retromusic.dialogs.OptionsSheetDialogFragment;
|
||||||
import code.name.monkey.retromusic.fragments.base.AbsLibraryPagerRecyclerViewCustomGridSizeFragment;
|
import code.name.monkey.retromusic.fragments.base.AbsLibraryPagerRecyclerViewCustomGridSizeFragment;
|
||||||
import code.name.monkey.retromusic.fragments.mainactivity.AlbumsFragment;
|
import code.name.monkey.retromusic.fragments.mainactivity.AlbumsFragment;
|
||||||
import code.name.monkey.retromusic.fragments.mainactivity.ArtistsFragment;
|
import code.name.monkey.retromusic.fragments.mainactivity.ArtistsFragment;
|
||||||
|
import code.name.monkey.retromusic.fragments.mainactivity.BannerHomeFragment;
|
||||||
|
import code.name.monkey.retromusic.fragments.mainactivity.FoldersFragment;
|
||||||
import code.name.monkey.retromusic.fragments.mainactivity.GenresFragment;
|
import code.name.monkey.retromusic.fragments.mainactivity.GenresFragment;
|
||||||
import code.name.monkey.retromusic.fragments.mainactivity.PlayingQueueFragment;
|
import code.name.monkey.retromusic.fragments.mainactivity.PlayingQueueFragment;
|
||||||
import code.name.monkey.retromusic.fragments.mainactivity.PlaylistsFragment;
|
import code.name.monkey.retromusic.fragments.mainactivity.PlaylistsFragment;
|
||||||
import code.name.monkey.retromusic.fragments.mainactivity.SongsFragment;
|
import code.name.monkey.retromusic.fragments.mainactivity.SongsFragment;
|
||||||
import code.name.monkey.retromusic.fragments.mainactivity.FoldersFragment;
|
|
||||||
import code.name.monkey.retromusic.fragments.mainactivity.BannerHomeFragment;
|
|
||||||
import code.name.monkey.retromusic.helper.MusicPlayerRemote;
|
import code.name.monkey.retromusic.helper.MusicPlayerRemote;
|
||||||
import code.name.monkey.retromusic.helper.SearchQueryHelper;
|
import code.name.monkey.retromusic.helper.SearchQueryHelper;
|
||||||
import code.name.monkey.retromusic.helper.SortOrder.AlbumSortOrder;
|
import code.name.monkey.retromusic.helper.SortOrder.AlbumSortOrder;
|
||||||
|
@ -70,15 +84,6 @@ import code.name.monkey.retromusic.util.NavigationUtil;
|
||||||
import code.name.monkey.retromusic.util.PreferenceUtil;
|
import code.name.monkey.retromusic.util.PreferenceUtil;
|
||||||
import code.name.monkey.retromusic.util.RetroColorUtil;
|
import code.name.monkey.retromusic.util.RetroColorUtil;
|
||||||
import code.name.monkey.retromusic.util.RetroUtil;
|
import code.name.monkey.retromusic.util.RetroUtil;
|
||||||
import com.afollestad.materialcab.MaterialCab;
|
|
||||||
import com.afollestad.materialcab.MaterialCab.Callback;
|
|
||||||
import com.google.android.material.appbar.AppBarLayout;
|
|
||||||
import com.google.android.material.card.MaterialCardView;
|
|
||||||
import com.google.android.material.textview.MaterialTextView;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
import org.jetbrains.annotations.NotNull;
|
|
||||||
import org.jetbrains.annotations.Nullable;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by hemanths on 2020-02-19.
|
* Created by hemanths on 2020-02-19.
|
||||||
|
@ -91,18 +96,6 @@ public class MainActivity extends AbsSlidingMusicPanelActivity
|
||||||
public static final int APP_INTRO_REQUEST = 100;
|
public static final int APP_INTRO_REQUEST = 100;
|
||||||
|
|
||||||
public static final String EXPAND_PANEL = "expand_panel";
|
public static final String EXPAND_PANEL = "expand_panel";
|
||||||
|
|
||||||
@Nullable
|
|
||||||
MainActivityFragmentCallbacks currentFragment;
|
|
||||||
|
|
||||||
private boolean blockRequestPermissions = false;
|
|
||||||
|
|
||||||
private MaterialCab cab;
|
|
||||||
|
|
||||||
private AppBarLayout mAppBarLayout;
|
|
||||||
|
|
||||||
private MaterialTextView mAppTitle;
|
|
||||||
|
|
||||||
private final BroadcastReceiver mBroadcastReceiver = new BroadcastReceiver() {
|
private final BroadcastReceiver mBroadcastReceiver = new BroadcastReceiver() {
|
||||||
@Override
|
@Override
|
||||||
public void onReceive(final Context context, final Intent intent) {
|
public void onReceive(final Context context, final Intent intent) {
|
||||||
|
@ -117,11 +110,14 @@ public class MainActivity extends AbsSlidingMusicPanelActivity
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
private final IntentFilter mIntentFilter = new IntentFilter(Intent.ACTION_SCREEN_OFF);
|
private final IntentFilter mIntentFilter = new IntentFilter(Intent.ACTION_SCREEN_OFF);
|
||||||
|
@Nullable
|
||||||
|
MainActivityFragmentCallbacks currentFragment;
|
||||||
|
private boolean blockRequestPermissions = false;
|
||||||
|
private MaterialCab cab;
|
||||||
|
private AppBarLayout mAppBarLayout;
|
||||||
|
private MaterialTextView mAppTitle;
|
||||||
private Toolbar mToolbar;
|
private Toolbar mToolbar;
|
||||||
|
|
||||||
private MaterialCardView mToolbarContainer;
|
private MaterialCardView mToolbarContainer;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -344,22 +340,14 @@ public class MainActivity extends AbsSlidingMusicPanelActivity
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!tag.equals(currentTag)) {
|
if (!tag.equals(currentTag)) {
|
||||||
getSupportFragmentManager().beginTransaction()
|
getSupportFragmentManager()
|
||||||
|
.beginTransaction()
|
||||||
.replace(R.id.fragment_container, fragment, tag)
|
.replace(R.id.fragment_container, fragment, tag)
|
||||||
.commit();
|
.commit();
|
||||||
currentFragment = (MainActivityFragmentCallbacks) fragment;
|
currentFragment = (MainActivityFragmentCallbacks) fragment;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setMusicChooser(final int option) {
|
|
||||||
PreferenceUtil.getInstance(this).setLastMusicChooser(option);
|
|
||||||
if (option == OptionsSheetDialogFragment.FOLDER) {
|
|
||||||
setCurrentFragment(FoldersFragment.newInstance(this), FoldersFragment.TAG);
|
|
||||||
} else {
|
|
||||||
selectedFragment(PreferenceUtil.getInstance(this).getLastPage());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
@Override
|
@Override
|
||||||
protected View createContentView() {
|
protected View createContentView() {
|
||||||
|
@ -641,6 +629,7 @@ public class MainActivity extends AbsSlidingMusicPanelActivity
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private void setUpGridSizeMenu(@NonNull AbsLibraryPagerRecyclerViewCustomGridSizeFragment fragment,
|
private void setUpGridSizeMenu(@NonNull AbsLibraryPagerRecyclerViewCustomGridSizeFragment fragment,
|
||||||
@NonNull SubMenu gridSizeMenu) {
|
@NonNull SubMenu gridSizeMenu) {
|
||||||
|
|
||||||
|
|
|
@ -19,9 +19,7 @@ import com.h6ah4i.android.widget.advrecyclerview.draggable.RecyclerViewDragDropM
|
||||||
import com.h6ah4i.android.widget.advrecyclerview.swipeable.RecyclerViewSwipeManager
|
import com.h6ah4i.android.widget.advrecyclerview.swipeable.RecyclerViewSwipeManager
|
||||||
import com.h6ah4i.android.widget.advrecyclerview.touchguard.RecyclerViewTouchActionGuardManager
|
import com.h6ah4i.android.widget.advrecyclerview.touchguard.RecyclerViewTouchActionGuardManager
|
||||||
import com.h6ah4i.android.widget.advrecyclerview.utils.WrapperAdapterUtils
|
import com.h6ah4i.android.widget.advrecyclerview.utils.WrapperAdapterUtils
|
||||||
import kotlinx.android.synthetic.main.activity_playing_queue.clearQueue
|
import kotlinx.android.synthetic.main.activity_playing_queue.*
|
||||||
import kotlinx.android.synthetic.main.activity_playing_queue.recyclerView
|
|
||||||
import kotlinx.android.synthetic.main.activity_playing_queue.toolbar
|
|
||||||
|
|
||||||
open class PlayingQueueActivity : AbsMusicServiceActivity() {
|
open class PlayingQueueActivity : AbsMusicServiceActivity() {
|
||||||
|
|
||||||
|
|
|
@ -28,11 +28,7 @@ import com.afollestad.materialcab.MaterialCab
|
||||||
import com.h6ah4i.android.widget.advrecyclerview.animator.RefactoredDefaultItemAnimator
|
import com.h6ah4i.android.widget.advrecyclerview.animator.RefactoredDefaultItemAnimator
|
||||||
import com.h6ah4i.android.widget.advrecyclerview.draggable.RecyclerViewDragDropManager
|
import com.h6ah4i.android.widget.advrecyclerview.draggable.RecyclerViewDragDropManager
|
||||||
import com.h6ah4i.android.widget.advrecyclerview.utils.WrapperAdapterUtils
|
import com.h6ah4i.android.widget.advrecyclerview.utils.WrapperAdapterUtils
|
||||||
import kotlinx.android.synthetic.main.activity_playlist_detail.empty
|
import kotlinx.android.synthetic.main.activity_playlist_detail.*
|
||||||
import kotlinx.android.synthetic.main.activity_playlist_detail.emptyEmoji
|
|
||||||
import kotlinx.android.synthetic.main.activity_playlist_detail.emptyText
|
|
||||||
import kotlinx.android.synthetic.main.activity_playlist_detail.recyclerView
|
|
||||||
import kotlinx.android.synthetic.main.activity_playlist_detail.toolbar
|
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
|
|
||||||
class PlaylistDetailActivity : AbsSlidingMusicPanelActivity(), CabHolder, PlaylistSongsView {
|
class PlaylistDetailActivity : AbsSlidingMusicPanelActivity(), CabHolder, PlaylistSongsView {
|
||||||
|
@ -148,7 +144,8 @@ class PlaylistDetailActivity : AbsSlidingMusicPanelActivity(), CabHolder, Playli
|
||||||
if (cab != null && cab!!.isActive) {
|
if (cab != null && cab!!.isActive) {
|
||||||
cab!!.finish()
|
cab!!.finish()
|
||||||
}
|
}
|
||||||
cab = MaterialCab(this, R.id.cab_stub).setMenu(menuRes).setCloseDrawableRes(R.drawable.ic_close_white_24dp)
|
cab = MaterialCab(this, R.id.cab_stub).setMenu(menuRes)
|
||||||
|
.setCloseDrawableRes(R.drawable.ic_close_white_24dp)
|
||||||
.setBackgroundColor(
|
.setBackgroundColor(
|
||||||
RetroColorUtil.shiftBackgroundColorForLightText(
|
RetroColorUtil.shiftBackgroundColorForLightText(
|
||||||
ATHUtil.resolveColor(
|
ATHUtil.resolveColor(
|
||||||
|
|
|
@ -14,9 +14,7 @@ import code.name.monkey.retromusic.R
|
||||||
import code.name.monkey.retromusic.activities.base.AbsBaseActivity
|
import code.name.monkey.retromusic.activities.base.AbsBaseActivity
|
||||||
import com.anjlab.android.iab.v3.BillingProcessor
|
import com.anjlab.android.iab.v3.BillingProcessor
|
||||||
import com.anjlab.android.iab.v3.TransactionDetails
|
import com.anjlab.android.iab.v3.TransactionDetails
|
||||||
import kotlinx.android.synthetic.main.activity_pro_version.purchaseButton
|
import kotlinx.android.synthetic.main.activity_pro_version.*
|
||||||
import kotlinx.android.synthetic.main.activity_pro_version.restoreButton
|
|
||||||
import kotlinx.android.synthetic.main.activity_pro_version.toolbar
|
|
||||||
import java.lang.ref.WeakReference
|
import java.lang.ref.WeakReference
|
||||||
|
|
||||||
class PurchaseActivity : AbsBaseActivity(), BillingProcessor.IBillingHandler {
|
class PurchaseActivity : AbsBaseActivity(), BillingProcessor.IBillingHandler {
|
||||||
|
|
|
@ -29,17 +29,12 @@ import code.name.monkey.retromusic.mvp.presenter.SearchPresenter
|
||||||
import code.name.monkey.retromusic.mvp.presenter.SearchView
|
import code.name.monkey.retromusic.mvp.presenter.SearchView
|
||||||
import code.name.monkey.retromusic.util.RetroUtil
|
import code.name.monkey.retromusic.util.RetroUtil
|
||||||
import com.google.android.material.textfield.TextInputEditText
|
import com.google.android.material.textfield.TextInputEditText
|
||||||
import kotlinx.android.synthetic.main.activity_search.appBarLayout
|
import kotlinx.android.synthetic.main.activity_search.*
|
||||||
import kotlinx.android.synthetic.main.activity_search.back
|
import java.util.*
|
||||||
import kotlinx.android.synthetic.main.activity_search.clearText
|
|
||||||
import kotlinx.android.synthetic.main.activity_search.empty
|
|
||||||
import kotlinx.android.synthetic.main.activity_search.keyboardPopup
|
|
||||||
import kotlinx.android.synthetic.main.activity_search.recyclerView
|
|
||||||
import kotlinx.android.synthetic.main.activity_search.searchContainer
|
|
||||||
import kotlinx.android.synthetic.main.activity_search.searchView
|
|
||||||
import kotlinx.android.synthetic.main.activity_search.voiceSearch
|
|
||||||
import java.util.Locale
|
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
|
import kotlin.collections.ArrayList
|
||||||
|
import kotlin.collections.MutableList
|
||||||
|
import kotlin.collections.emptyList
|
||||||
|
|
||||||
class SearchActivity : AbsMusicServiceActivity(), OnQueryTextListener, TextWatcher, SearchView {
|
class SearchActivity : AbsMusicServiceActivity(), OnQueryTextListener, TextWatcher, SearchView {
|
||||||
@Inject
|
@Inject
|
||||||
|
@ -71,7 +66,8 @@ class SearchActivity : AbsMusicServiceActivity(), OnQueryTextListener, TextWatch
|
||||||
back.setOnClickListener { onBackPressed() }
|
back.setOnClickListener { onBackPressed() }
|
||||||
voiceSearch.setOnClickListener { startMicSearch() }
|
voiceSearch.setOnClickListener { startMicSearch() }
|
||||||
clearText.setOnClickListener { searchView.clearText() }
|
clearText.setOnClickListener { searchView.clearText() }
|
||||||
searchContainer.backgroundTintList = ColorStateList.valueOf(ATHUtil.resolveColor(this, R.attr.colorSurface))
|
searchContainer.backgroundTintList =
|
||||||
|
ColorStateList.valueOf(ATHUtil.resolveColor(this, R.attr.colorSurface))
|
||||||
|
|
||||||
keyboardPopup.setOnClickListener {
|
keyboardPopup.setOnClickListener {
|
||||||
val inputManager = getSystemService(Service.INPUT_METHOD_SERVICE) as InputMethodManager
|
val inputManager = getSystemService(Service.INPUT_METHOD_SERVICE) as InputMethodManager
|
||||||
|
@ -80,7 +76,10 @@ class SearchActivity : AbsMusicServiceActivity(), OnQueryTextListener, TextWatch
|
||||||
|
|
||||||
keyboardPopup.backgroundTintList = ColorStateList.valueOf(ThemeStore.accentColor(this))
|
keyboardPopup.backgroundTintList = ColorStateList.valueOf(ThemeStore.accentColor(this))
|
||||||
ColorStateList.valueOf(
|
ColorStateList.valueOf(
|
||||||
MaterialValueHelper.getPrimaryTextColor(this, ColorUtil.isColorLight(ThemeStore.accentColor(this)))
|
MaterialValueHelper.getPrimaryTextColor(
|
||||||
|
this,
|
||||||
|
ColorUtil.isColorLight(ThemeStore.accentColor(this))
|
||||||
|
)
|
||||||
).apply {
|
).apply {
|
||||||
keyboardPopup.setTextColor(this)
|
keyboardPopup.setTextColor(this)
|
||||||
keyboardPopup.iconTint = this
|
keyboardPopup.iconTint = this
|
||||||
|
@ -175,7 +174,8 @@ class SearchActivity : AbsMusicServiceActivity(), OnQueryTextListener, TextWatch
|
||||||
when (requestCode) {
|
when (requestCode) {
|
||||||
REQ_CODE_SPEECH_INPUT -> {
|
REQ_CODE_SPEECH_INPUT -> {
|
||||||
if (resultCode == Activity.RESULT_OK && null != data) {
|
if (resultCode == Activity.RESULT_OK && null != data) {
|
||||||
val result: ArrayList<String>? = data.getStringArrayListExtra(RecognizerIntent.EXTRA_RESULTS)
|
val result: ArrayList<String>? =
|
||||||
|
data.getStringArrayListExtra(RecognizerIntent.EXTRA_RESULTS)
|
||||||
query = result?.get(0)
|
query = result?.get(0)
|
||||||
searchView.setText(query, BufferType.EDITABLE)
|
searchView.setText(query, BufferType.EDITABLE)
|
||||||
searchPresenter.search(query!!)
|
searchPresenter.search(query!!)
|
||||||
|
|
|
@ -4,14 +4,12 @@ import android.os.Bundle
|
||||||
import android.view.MenuItem
|
import android.view.MenuItem
|
||||||
import androidx.annotation.StringRes
|
import androidx.annotation.StringRes
|
||||||
import androidx.fragment.app.Fragment
|
import androidx.fragment.app.Fragment
|
||||||
import androidx.transition.TransitionManager
|
|
||||||
import code.name.monkey.appthemehelper.util.ATHUtil
|
import code.name.monkey.appthemehelper.util.ATHUtil
|
||||||
import code.name.monkey.appthemehelper.util.ToolbarContentTintHelper
|
import code.name.monkey.appthemehelper.util.ToolbarContentTintHelper
|
||||||
import code.name.monkey.retromusic.R
|
import code.name.monkey.retromusic.R
|
||||||
import code.name.monkey.retromusic.activities.base.AbsBaseActivity
|
import code.name.monkey.retromusic.activities.base.AbsBaseActivity
|
||||||
import code.name.monkey.retromusic.fragments.settings.MainSettingsFragment
|
import code.name.monkey.retromusic.fragments.settings.MainSettingsFragment
|
||||||
import kotlinx.android.synthetic.main.activity_settings.appBarLayout
|
import kotlinx.android.synthetic.main.activity_settings.*
|
||||||
import kotlinx.android.synthetic.main.activity_settings.toolbar
|
|
||||||
|
|
||||||
class SettingsActivity : AbsBaseActivity() {
|
class SettingsActivity : AbsBaseActivity() {
|
||||||
|
|
||||||
|
@ -28,7 +26,8 @@ class SettingsActivity : AbsBaseActivity() {
|
||||||
setupToolbar()
|
setupToolbar()
|
||||||
|
|
||||||
if (savedInstanceState == null) {
|
if (savedInstanceState == null) {
|
||||||
fragmentManager.beginTransaction().replace(R.id.contentFrame, MainSettingsFragment()).commit()
|
fragmentManager.beginTransaction().replace(R.id.contentFrame, MainSettingsFragment())
|
||||||
|
.commit()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -51,12 +50,10 @@ class SettingsActivity : AbsBaseActivity() {
|
||||||
android.R.anim.slide_in_left,
|
android.R.anim.slide_in_left,
|
||||||
android.R.anim.slide_out_right
|
android.R.anim.slide_out_right
|
||||||
)
|
)
|
||||||
|
|
||||||
fragmentTransaction.replace(R.id.contentFrame, fragment, fragment.tag)
|
fragmentTransaction.replace(R.id.contentFrame, fragment, fragment.tag)
|
||||||
fragmentTransaction.addToBackStack(null)
|
fragmentTransaction.addToBackStack(null)
|
||||||
fragmentTransaction.commit()
|
fragmentTransaction.commit()
|
||||||
|
|
||||||
TransitionManager.beginDelayedTransition(appBarLayout)
|
|
||||||
setTitle(titleName)
|
setTitle(titleName)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -33,12 +33,7 @@ import code.name.monkey.retromusic.glide.SongGlideRequest
|
||||||
import code.name.monkey.retromusic.model.Song
|
import code.name.monkey.retromusic.model.Song
|
||||||
import code.name.monkey.retromusic.util.Share
|
import code.name.monkey.retromusic.util.Share
|
||||||
import com.bumptech.glide.Glide
|
import com.bumptech.glide.Glide
|
||||||
import kotlinx.android.synthetic.main.activity_share_instagram.image
|
import kotlinx.android.synthetic.main.activity_share_instagram.*
|
||||||
import kotlinx.android.synthetic.main.activity_share_instagram.mainContent
|
|
||||||
import kotlinx.android.synthetic.main.activity_share_instagram.shareButton
|
|
||||||
import kotlinx.android.synthetic.main.activity_share_instagram.shareText
|
|
||||||
import kotlinx.android.synthetic.main.activity_share_instagram.shareTitle
|
|
||||||
import kotlinx.android.synthetic.main.activity_share_instagram.toolbar
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by hemanths on 2020-02-02.
|
* Created by hemanths on 2020-02-02.
|
||||||
|
@ -107,7 +102,12 @@ class ShareInstagramStory : AbsBaseActivity() {
|
||||||
|
|
||||||
private fun setColors(colorLight: Boolean, color: Int) {
|
private fun setColors(colorLight: Boolean, color: Int) {
|
||||||
setLightStatusbar(colorLight)
|
setLightStatusbar(colorLight)
|
||||||
toolbar.setTitleTextColor(MaterialValueHelper.getPrimaryTextColor(this@ShareInstagramStory, colorLight))
|
toolbar.setTitleTextColor(
|
||||||
|
MaterialValueHelper.getPrimaryTextColor(
|
||||||
|
this@ShareInstagramStory,
|
||||||
|
colorLight
|
||||||
|
)
|
||||||
|
)
|
||||||
toolbar.navigationIcon?.setTintList(
|
toolbar.navigationIcon?.setTintList(
|
||||||
ColorStateList.valueOf(
|
ColorStateList.valueOf(
|
||||||
MaterialValueHelper.getPrimaryTextColor(
|
MaterialValueHelper.getPrimaryTextColor(
|
||||||
|
@ -117,6 +117,9 @@ class ShareInstagramStory : AbsBaseActivity() {
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
mainContent.background =
|
mainContent.background =
|
||||||
GradientDrawable(GradientDrawable.Orientation.TOP_BOTTOM, intArrayOf(color, Color.BLACK))
|
GradientDrawable(
|
||||||
|
GradientDrawable.Orientation.TOP_BOTTOM,
|
||||||
|
intArrayOf(color, Color.BLACK)
|
||||||
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,10 +7,19 @@ import android.content.pm.PackageManager;
|
||||||
import android.graphics.Color;
|
import android.graphics.Color;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.webkit.WebView;
|
import android.webkit.WebView;
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
import androidx.annotation.Nullable;
|
import androidx.annotation.Nullable;
|
||||||
import androidx.appcompat.widget.Toolbar;
|
import androidx.appcompat.widget.Toolbar;
|
||||||
import androidx.core.widget.NestedScrollView;
|
import androidx.core.widget.NestedScrollView;
|
||||||
|
|
||||||
|
import com.google.android.material.appbar.AppBarLayout;
|
||||||
|
|
||||||
|
import java.io.BufferedReader;
|
||||||
|
import java.io.InputStream;
|
||||||
|
import java.io.InputStreamReader;
|
||||||
|
import java.nio.charset.StandardCharsets;
|
||||||
|
|
||||||
import code.name.monkey.appthemehelper.ThemeStore;
|
import code.name.monkey.appthemehelper.ThemeStore;
|
||||||
import code.name.monkey.appthemehelper.util.ATHUtil;
|
import code.name.monkey.appthemehelper.util.ATHUtil;
|
||||||
import code.name.monkey.appthemehelper.util.ColorUtil;
|
import code.name.monkey.appthemehelper.util.ColorUtil;
|
||||||
|
@ -18,11 +27,6 @@ import code.name.monkey.appthemehelper.util.ToolbarContentTintHelper;
|
||||||
import code.name.monkey.retromusic.R;
|
import code.name.monkey.retromusic.R;
|
||||||
import code.name.monkey.retromusic.activities.base.AbsBaseActivity;
|
import code.name.monkey.retromusic.activities.base.AbsBaseActivity;
|
||||||
import code.name.monkey.retromusic.util.PreferenceUtil;
|
import code.name.monkey.retromusic.util.PreferenceUtil;
|
||||||
import com.google.android.material.appbar.AppBarLayout;
|
|
||||||
import java.io.BufferedReader;
|
|
||||||
import java.io.InputStream;
|
|
||||||
import java.io.InputStreamReader;
|
|
||||||
import java.nio.charset.StandardCharsets;
|
|
||||||
|
|
||||||
public class WhatsNewActivity extends AbsBaseActivity {
|
public class WhatsNewActivity extends AbsBaseActivity {
|
||||||
|
|
||||||
|
@ -32,6 +36,21 @@ public class WhatsNewActivity extends AbsBaseActivity {
|
||||||
|
|
||||||
WebView webView;
|
WebView webView;
|
||||||
|
|
||||||
|
private static String colorToCSS(int color) {
|
||||||
|
return String.format("rgb(%d, %d, %d)", Color.red(color), Color.green(color),
|
||||||
|
Color.blue(color)); // on API 29, WebView doesn't load with hex colors
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void setChangelogRead(@NonNull Context context) {
|
||||||
|
try {
|
||||||
|
PackageInfo pInfo = context.getPackageManager().getPackageInfo(context.getPackageName(), 0);
|
||||||
|
int currentVersion = pInfo.versionCode;
|
||||||
|
PreferenceUtil.getInstance(context).setLastChangeLogVersion(currentVersion);
|
||||||
|
} catch (PackageManager.NameNotFoundException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(@Nullable Bundle savedInstanceState) {
|
protected void onCreate(@Nullable Bundle savedInstanceState) {
|
||||||
setDrawUnderStatusBar();
|
setDrawUnderStatusBar();
|
||||||
|
@ -80,19 +99,4 @@ public class WhatsNewActivity extends AbsBaseActivity {
|
||||||
}
|
}
|
||||||
setChangelogRead(this);
|
setChangelogRead(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static String colorToCSS(int color) {
|
|
||||||
return String.format("rgb(%d, %d, %d)", Color.red(color), Color.green(color),
|
|
||||||
Color.blue(color)); // on API 29, WebView doesn't load with hex colors
|
|
||||||
}
|
|
||||||
|
|
||||||
private static void setChangelogRead(@NonNull Context context) {
|
|
||||||
try {
|
|
||||||
PackageInfo pInfo = context.getPackageManager().getPackageInfo(context.getPackageName(), 0);
|
|
||||||
int currentVersion = pInfo.versionCode;
|
|
||||||
PreferenceUtil.getInstance(context).setLastChangeLogVersion(currentVersion);
|
|
||||||
} catch (PackageManager.NameNotFoundException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
|
@ -1,26 +1,15 @@
|
||||||
package code.name.monkey.retromusic.activities.base
|
package code.name.monkey.retromusic.activities.base
|
||||||
|
|
||||||
import android.Manifest
|
import android.Manifest
|
||||||
import android.content.BroadcastReceiver
|
import android.content.*
|
||||||
import android.content.ComponentName
|
|
||||||
import android.content.Context
|
|
||||||
import android.content.Intent
|
|
||||||
import android.content.IntentFilter
|
|
||||||
import android.content.ServiceConnection
|
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import android.os.IBinder
|
import android.os.IBinder
|
||||||
import code.name.monkey.retromusic.R
|
import code.name.monkey.retromusic.R
|
||||||
import code.name.monkey.retromusic.helper.MusicPlayerRemote
|
import code.name.monkey.retromusic.helper.MusicPlayerRemote
|
||||||
import code.name.monkey.retromusic.interfaces.MusicServiceEventListener
|
import code.name.monkey.retromusic.interfaces.MusicServiceEventListener
|
||||||
import code.name.monkey.retromusic.service.MusicService.FAVORITE_STATE_CHANGED
|
import code.name.monkey.retromusic.service.MusicService.*
|
||||||
import code.name.monkey.retromusic.service.MusicService.MEDIA_STORE_CHANGED
|
|
||||||
import code.name.monkey.retromusic.service.MusicService.META_CHANGED
|
|
||||||
import code.name.monkey.retromusic.service.MusicService.PLAY_STATE_CHANGED
|
|
||||||
import code.name.monkey.retromusic.service.MusicService.QUEUE_CHANGED
|
|
||||||
import code.name.monkey.retromusic.service.MusicService.REPEAT_MODE_CHANGED
|
|
||||||
import code.name.monkey.retromusic.service.MusicService.SHUFFLE_MODE_CHANGED
|
|
||||||
import java.lang.ref.WeakReference
|
import java.lang.ref.WeakReference
|
||||||
import java.util.ArrayList
|
import java.util.*
|
||||||
|
|
||||||
abstract class AbsMusicServiceActivity : AbsBaseActivity(), MusicServiceEventListener {
|
abstract class AbsMusicServiceActivity : AbsBaseActivity(), MusicServiceEventListener {
|
||||||
|
|
||||||
|
|
|
@ -16,21 +16,7 @@ import code.name.monkey.retromusic.extensions.hide
|
||||||
import code.name.monkey.retromusic.extensions.show
|
import code.name.monkey.retromusic.extensions.show
|
||||||
import code.name.monkey.retromusic.fragments.MiniPlayerFragment
|
import code.name.monkey.retromusic.fragments.MiniPlayerFragment
|
||||||
import code.name.monkey.retromusic.fragments.NowPlayingScreen
|
import code.name.monkey.retromusic.fragments.NowPlayingScreen
|
||||||
import code.name.monkey.retromusic.fragments.NowPlayingScreen.ADAPTIVE
|
import code.name.monkey.retromusic.fragments.NowPlayingScreen.*
|
||||||
import code.name.monkey.retromusic.fragments.NowPlayingScreen.BLUR
|
|
||||||
import code.name.monkey.retromusic.fragments.NowPlayingScreen.BLUR_CARD
|
|
||||||
import code.name.monkey.retromusic.fragments.NowPlayingScreen.CARD
|
|
||||||
import code.name.monkey.retromusic.fragments.NowPlayingScreen.CIRCLE
|
|
||||||
import code.name.monkey.retromusic.fragments.NowPlayingScreen.COLOR
|
|
||||||
import code.name.monkey.retromusic.fragments.NowPlayingScreen.FIT
|
|
||||||
import code.name.monkey.retromusic.fragments.NowPlayingScreen.FLAT
|
|
||||||
import code.name.monkey.retromusic.fragments.NowPlayingScreen.FULL
|
|
||||||
import code.name.monkey.retromusic.fragments.NowPlayingScreen.MATERIAL
|
|
||||||
import code.name.monkey.retromusic.fragments.NowPlayingScreen.NORMAL
|
|
||||||
import code.name.monkey.retromusic.fragments.NowPlayingScreen.PEAK
|
|
||||||
import code.name.monkey.retromusic.fragments.NowPlayingScreen.PLAIN
|
|
||||||
import code.name.monkey.retromusic.fragments.NowPlayingScreen.SIMPLE
|
|
||||||
import code.name.monkey.retromusic.fragments.NowPlayingScreen.TINY
|
|
||||||
import code.name.monkey.retromusic.fragments.base.AbsPlayerFragment
|
import code.name.monkey.retromusic.fragments.base.AbsPlayerFragment
|
||||||
import code.name.monkey.retromusic.fragments.player.adaptive.AdaptiveFragment
|
import code.name.monkey.retromusic.fragments.player.adaptive.AdaptiveFragment
|
||||||
import code.name.monkey.retromusic.fragments.player.blur.BlurPlayerFragment
|
import code.name.monkey.retromusic.fragments.player.blur.BlurPlayerFragment
|
||||||
|
@ -53,11 +39,10 @@ import code.name.monkey.retromusic.util.DensityUtil
|
||||||
import code.name.monkey.retromusic.util.PreferenceUtil
|
import code.name.monkey.retromusic.util.PreferenceUtil
|
||||||
import code.name.monkey.retromusic.views.BottomNavigationBarTinted
|
import code.name.monkey.retromusic.views.BottomNavigationBarTinted
|
||||||
import com.google.android.material.bottomsheet.BottomSheetBehavior
|
import com.google.android.material.bottomsheet.BottomSheetBehavior
|
||||||
import kotlinx.android.synthetic.main.sliding_music_panel_layout.bottomNavigationView
|
import kotlinx.android.synthetic.main.sliding_music_panel_layout.*
|
||||||
import kotlinx.android.synthetic.main.sliding_music_panel_layout.dimBackground
|
|
||||||
import kotlinx.android.synthetic.main.sliding_music_panel_layout.slidingPanel
|
|
||||||
|
|
||||||
abstract class AbsSlidingMusicPanelActivity : AbsMusicServiceActivity(), AbsPlayerFragment.Callbacks {
|
abstract class AbsSlidingMusicPanelActivity : AbsMusicServiceActivity(),
|
||||||
|
AbsPlayerFragment.Callbacks {
|
||||||
companion object {
|
companion object {
|
||||||
val TAG: String = AbsSlidingMusicPanelActivity::class.java.simpleName
|
val TAG: String = AbsSlidingMusicPanelActivity::class.java.simpleName
|
||||||
}
|
}
|
||||||
|
@ -133,8 +118,10 @@ abstract class AbsSlidingMusicPanelActivity : AbsMusicServiceActivity(), AbsPlay
|
||||||
}
|
}
|
||||||
|
|
||||||
protected fun wrapSlidingMusicPanel(@LayoutRes resId: Int): View {
|
protected fun wrapSlidingMusicPanel(@LayoutRes resId: Int): View {
|
||||||
val slidingMusicPanelLayout = layoutInflater.inflate(R.layout.sliding_music_panel_layout, null)
|
val slidingMusicPanelLayout =
|
||||||
val contentContainer = slidingMusicPanelLayout.findViewById<ViewGroup>(R.id.mainContentFrame)
|
layoutInflater.inflate(R.layout.sliding_music_panel_layout, null)
|
||||||
|
val contentContainer =
|
||||||
|
slidingMusicPanelLayout.findViewById<ViewGroup>(R.id.mainContentFrame)
|
||||||
layoutInflater.inflate(resId, contentContainer)
|
layoutInflater.inflate(resId, contentContainer)
|
||||||
return slidingMusicPanelLayout
|
return slidingMusicPanelLayout
|
||||||
}
|
}
|
||||||
|
@ -183,7 +170,8 @@ abstract class AbsSlidingMusicPanelActivity : AbsMusicServiceActivity(), AbsPlay
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun setupSlidingUpPanel() {
|
private fun setupSlidingUpPanel() {
|
||||||
slidingPanel.viewTreeObserver.addOnGlobalLayoutListener(object : ViewTreeObserver.OnGlobalLayoutListener {
|
slidingPanel.viewTreeObserver.addOnGlobalLayoutListener(object :
|
||||||
|
ViewTreeObserver.OnGlobalLayoutListener {
|
||||||
override fun onGlobalLayout() {
|
override fun onGlobalLayout() {
|
||||||
slidingPanel.viewTreeObserver.removeOnGlobalLayoutListener(this)
|
slidingPanel.viewTreeObserver.removeOnGlobalLayoutListener(this)
|
||||||
if (currentNowPlayingScreen != PEAK) {
|
if (currentNowPlayingScreen != PEAK) {
|
||||||
|
@ -210,7 +198,8 @@ abstract class AbsSlidingMusicPanelActivity : AbsMusicServiceActivity(), AbsPlay
|
||||||
|
|
||||||
private fun hideBottomBar(hide: Boolean) {
|
private fun hideBottomBar(hide: Boolean) {
|
||||||
val heightOfBar = resources.getDimensionPixelSize(R.dimen.mini_player_height)
|
val heightOfBar = resources.getDimensionPixelSize(R.dimen.mini_player_height)
|
||||||
val heightOfBarWithTabs = resources.getDimensionPixelSize(R.dimen.mini_player_height_expanded)
|
val heightOfBarWithTabs =
|
||||||
|
resources.getDimensionPixelSize(R.dimen.mini_player_height_expanded)
|
||||||
|
|
||||||
if (hide) {
|
if (hide) {
|
||||||
bottomSheetBehavior.isHideable = true
|
bottomSheetBehavior.isHideable = true
|
||||||
|
@ -258,15 +247,18 @@ abstract class AbsSlidingMusicPanelActivity : AbsMusicServiceActivity(), AbsPlay
|
||||||
.commit()
|
.commit()
|
||||||
supportFragmentManager.executePendingTransactions()
|
supportFragmentManager.executePendingTransactions()
|
||||||
|
|
||||||
playerFragment = supportFragmentManager.findFragmentById(R.id.playerFragmentContainer) as AbsPlayerFragment
|
playerFragment =
|
||||||
miniPlayerFragment = supportFragmentManager.findFragmentById(R.id.miniPlayerFragment) as MiniPlayerFragment
|
supportFragmentManager.findFragmentById(R.id.playerFragmentContainer) as AbsPlayerFragment
|
||||||
|
miniPlayerFragment =
|
||||||
|
supportFragmentManager.findFragmentById(R.id.miniPlayerFragment) as MiniPlayerFragment
|
||||||
miniPlayerFragment?.view?.setOnClickListener { expandPanel() }
|
miniPlayerFragment?.view?.setOnClickListener { expandPanel() }
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onServiceConnected() {
|
override fun onServiceConnected() {
|
||||||
super.onServiceConnected()
|
super.onServiceConnected()
|
||||||
if (MusicPlayerRemote.playingQueue.isNotEmpty()) {
|
if (MusicPlayerRemote.playingQueue.isNotEmpty()) {
|
||||||
slidingPanel.viewTreeObserver.addOnGlobalLayoutListener(object : ViewTreeObserver.OnGlobalLayoutListener {
|
slidingPanel.viewTreeObserver.addOnGlobalLayoutListener(object :
|
||||||
|
ViewTreeObserver.OnGlobalLayoutListener {
|
||||||
override fun onGlobalLayout() {
|
override fun onGlobalLayout() {
|
||||||
slidingPanel.viewTreeObserver.removeOnGlobalLayoutListener(this)
|
slidingPanel.viewTreeObserver.removeOnGlobalLayoutListener(this)
|
||||||
hideBottomBar(false)
|
hideBottomBar(false)
|
||||||
|
@ -303,7 +295,7 @@ abstract class AbsSlidingMusicPanelActivity : AbsMusicServiceActivity(), AbsPlay
|
||||||
if (PreferenceUtil.getInstance(this).adaptiveColor && (currentNowPlayingScreen == NORMAL || currentNowPlayingScreen == FLAT)) {
|
if (PreferenceUtil.getInstance(this).adaptiveColor && (currentNowPlayingScreen == NORMAL || currentNowPlayingScreen == FLAT)) {
|
||||||
super.setLightNavigationBar(true)
|
super.setLightNavigationBar(true)
|
||||||
super.setLightStatusbar(isColorLight)
|
super.setLightStatusbar(isColorLight)
|
||||||
} else if (currentNowPlayingScreen == FULL || currentNowPlayingScreen == CARD || currentNowPlayingScreen == FIT || currentNowPlayingScreen == BLUR || currentNowPlayingScreen == BLUR_CARD) {
|
} else if (currentNowPlayingScreen == FULL || currentNowPlayingScreen == CARD || currentNowPlayingScreen == BLUR || currentNowPlayingScreen == BLUR_CARD) {
|
||||||
super.setLightStatusbar(false)
|
super.setLightStatusbar(false)
|
||||||
super.setLightNavigationBar(true)
|
super.setLightNavigationBar(true)
|
||||||
super.setNavigationbarColor(Color.BLACK)
|
super.setNavigationbarColor(Color.BLACK)
|
||||||
|
@ -311,6 +303,8 @@ abstract class AbsSlidingMusicPanelActivity : AbsMusicServiceActivity(), AbsPlay
|
||||||
super.setNavigationbarColor(paletteColor)
|
super.setNavigationbarColor(paletteColor)
|
||||||
super.setLightNavigationBar(isColorLight)
|
super.setLightNavigationBar(isColorLight)
|
||||||
super.setLightStatusbar(isColorLight)
|
super.setLightStatusbar(isColorLight)
|
||||||
|
} else if (currentNowPlayingScreen == FIT) {
|
||||||
|
super.setLightStatusbar(false)
|
||||||
} else {
|
} else {
|
||||||
super.setLightStatusbar(
|
super.setLightStatusbar(
|
||||||
ColorUtil.isColorLight(
|
ColorUtil.isColorLight(
|
||||||
|
|
|
@ -69,7 +69,10 @@ abstract class AbsThemeActivity : ATHToolbarActivity(), Runnable {
|
||||||
ContextCompat.getDrawable(this, R.drawable.round_window)
|
ContextCompat.getDrawable(this, R.drawable.round_window)
|
||||||
else ContextCompat.getDrawable(this, R.drawable.square_window)
|
else ContextCompat.getDrawable(this, R.drawable.square_window)
|
||||||
background =
|
background =
|
||||||
TintHelper.createTintedDrawable(background, ATHUtil.resolveColor(this, android.R.attr.windowBackground))
|
TintHelper.createTintedDrawable(
|
||||||
|
background,
|
||||||
|
ATHUtil.resolveColor(this, android.R.attr.windowBackground)
|
||||||
|
)
|
||||||
window.setBackgroundDrawable(background)
|
window.setBackgroundDrawable(background)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -92,7 +95,11 @@ abstract class AbsThemeActivity : ATHToolbarActivity(), Runnable {
|
||||||
if (statusBar != null) {
|
if (statusBar != null) {
|
||||||
when {
|
when {
|
||||||
VersionUtils.hasMarshmallow() -> statusBar.setBackgroundColor(color)
|
VersionUtils.hasMarshmallow() -> statusBar.setBackgroundColor(color)
|
||||||
VersionUtils.hasLollipop() -> statusBar.setBackgroundColor(ColorUtil.darkenColor(color))
|
VersionUtils.hasLollipop() -> statusBar.setBackgroundColor(
|
||||||
|
ColorUtil.darkenColor(
|
||||||
|
color
|
||||||
|
)
|
||||||
|
)
|
||||||
else -> statusBar.setBackgroundColor(color)
|
else -> statusBar.setBackgroundColor(color)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -32,19 +32,9 @@ import com.afollestad.materialdialogs.MaterialDialog
|
||||||
import com.afollestad.materialdialogs.callbacks.onCancel
|
import com.afollestad.materialdialogs.callbacks.onCancel
|
||||||
import com.google.android.material.floatingactionbutton.FloatingActionButton
|
import com.google.android.material.floatingactionbutton.FloatingActionButton
|
||||||
import com.google.android.material.textfield.TextInputLayout
|
import com.google.android.material.textfield.TextInputLayout
|
||||||
import kotlinx.android.synthetic.main.activity_bug_report.sendFab
|
import kotlinx.android.synthetic.main.activity_bug_report.*
|
||||||
import kotlinx.android.synthetic.main.activity_bug_report.toolbar
|
import kotlinx.android.synthetic.main.bug_report_card_device_info.*
|
||||||
import kotlinx.android.synthetic.main.bug_report_card_device_info.airTextDeviceInfo
|
import kotlinx.android.synthetic.main.bug_report_card_report.*
|
||||||
import kotlinx.android.synthetic.main.bug_report_card_report.inputDescription
|
|
||||||
import kotlinx.android.synthetic.main.bug_report_card_report.inputLayoutDescription
|
|
||||||
import kotlinx.android.synthetic.main.bug_report_card_report.inputLayoutPassword
|
|
||||||
import kotlinx.android.synthetic.main.bug_report_card_report.inputLayoutTitle
|
|
||||||
import kotlinx.android.synthetic.main.bug_report_card_report.inputLayoutUsername
|
|
||||||
import kotlinx.android.synthetic.main.bug_report_card_report.inputPassword
|
|
||||||
import kotlinx.android.synthetic.main.bug_report_card_report.inputTitle
|
|
||||||
import kotlinx.android.synthetic.main.bug_report_card_report.inputUsername
|
|
||||||
import kotlinx.android.synthetic.main.bug_report_card_report.optionAnonymous
|
|
||||||
import kotlinx.android.synthetic.main.bug_report_card_report.optionUseAccount
|
|
||||||
import org.eclipse.egit.github.core.Issue
|
import org.eclipse.egit.github.core.Issue
|
||||||
import org.eclipse.egit.github.core.client.GitHubClient
|
import org.eclipse.egit.github.core.client.GitHubClient
|
||||||
import org.eclipse.egit.github.core.client.RequestException
|
import org.eclipse.egit.github.core.client.RequestException
|
||||||
|
|
|
@ -5,10 +5,13 @@ import android.content.Context;
|
||||||
import android.content.pm.PackageInfo;
|
import android.content.pm.PackageInfo;
|
||||||
import android.content.pm.PackageManager;
|
import android.content.pm.PackageManager;
|
||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
|
|
||||||
import androidx.annotation.IntRange;
|
import androidx.annotation.IntRange;
|
||||||
import code.name.monkey.retromusic.util.PreferenceUtil;
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
|
||||||
|
import code.name.monkey.retromusic.util.PreferenceUtil;
|
||||||
|
|
||||||
public class DeviceInfo {
|
public class DeviceInfo {
|
||||||
|
|
||||||
@SuppressLint("NewApi")
|
@SuppressLint("NewApi")
|
||||||
|
|
|
@ -16,11 +16,14 @@ package code.name.monkey.retromusic.activities.saf;
|
||||||
|
|
||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
|
||||||
import androidx.annotation.Nullable;
|
import androidx.annotation.Nullable;
|
||||||
import code.name.monkey.retromusic.R;
|
|
||||||
import com.heinrichreimersoftware.materialintro.app.IntroActivity;
|
import com.heinrichreimersoftware.materialintro.app.IntroActivity;
|
||||||
import com.heinrichreimersoftware.materialintro.slide.SimpleSlide;
|
import com.heinrichreimersoftware.materialintro.slide.SimpleSlide;
|
||||||
|
|
||||||
|
import code.name.monkey.retromusic.R;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by hemanths on 2019-07-31.
|
* Created by hemanths on 2019-07-31.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -30,13 +30,12 @@ import com.afollestad.materialdialogs.MaterialDialog
|
||||||
import com.afollestad.materialdialogs.bottomsheets.BottomSheet
|
import com.afollestad.materialdialogs.bottomsheets.BottomSheet
|
||||||
import com.afollestad.materialdialogs.list.listItems
|
import com.afollestad.materialdialogs.list.listItems
|
||||||
import com.google.android.material.button.MaterialButton
|
import com.google.android.material.button.MaterialButton
|
||||||
import kotlinx.android.synthetic.main.activity_album_tag_editor.editorImage
|
import kotlinx.android.synthetic.main.activity_album_tag_editor.*
|
||||||
import kotlinx.android.synthetic.main.activity_album_tag_editor.imageContainer
|
|
||||||
import org.jaudiotagger.audio.AudioFile
|
import org.jaudiotagger.audio.AudioFile
|
||||||
import org.jaudiotagger.audio.AudioFileIO
|
import org.jaudiotagger.audio.AudioFileIO
|
||||||
import org.jaudiotagger.tag.FieldKey
|
import org.jaudiotagger.tag.FieldKey
|
||||||
import java.io.File
|
import java.io.File
|
||||||
import java.util.Collections
|
import java.util.*
|
||||||
|
|
||||||
abstract class AbsTagEditorActivity : AbsBaseActivity() {
|
abstract class AbsTagEditorActivity : AbsBaseActivity() {
|
||||||
|
|
||||||
|
|
|
@ -27,19 +27,9 @@ import com.bumptech.glide.Glide
|
||||||
import com.bumptech.glide.load.engine.DiskCacheStrategy
|
import com.bumptech.glide.load.engine.DiskCacheStrategy
|
||||||
import com.bumptech.glide.request.animation.GlideAnimation
|
import com.bumptech.glide.request.animation.GlideAnimation
|
||||||
import com.bumptech.glide.request.target.SimpleTarget
|
import com.bumptech.glide.request.target.SimpleTarget
|
||||||
import kotlinx.android.synthetic.main.activity_album_tag_editor.albumArtistContainer
|
import kotlinx.android.synthetic.main.activity_album_tag_editor.*
|
||||||
import kotlinx.android.synthetic.main.activity_album_tag_editor.albumArtistText
|
|
||||||
import kotlinx.android.synthetic.main.activity_album_tag_editor.albumText
|
|
||||||
import kotlinx.android.synthetic.main.activity_album_tag_editor.albumTitleContainer
|
|
||||||
import kotlinx.android.synthetic.main.activity_album_tag_editor.genreContainer
|
|
||||||
import kotlinx.android.synthetic.main.activity_album_tag_editor.genreTitle
|
|
||||||
import kotlinx.android.synthetic.main.activity_album_tag_editor.imageContainer
|
|
||||||
import kotlinx.android.synthetic.main.activity_album_tag_editor.toolbar
|
|
||||||
import kotlinx.android.synthetic.main.activity_album_tag_editor.yearContainer
|
|
||||||
import kotlinx.android.synthetic.main.activity_album_tag_editor.yearTitle
|
|
||||||
import org.jaudiotagger.tag.FieldKey
|
import org.jaudiotagger.tag.FieldKey
|
||||||
import java.util.ArrayList
|
import java.util.*
|
||||||
import java.util.EnumMap
|
|
||||||
|
|
||||||
class AlbumTagEditorActivity : AbsTagEditorActivity(), TextWatcher {
|
class AlbumTagEditorActivity : AbsTagEditorActivity(), TextWatcher {
|
||||||
override val contentViewLayout: Int
|
override val contentViewLayout: Int
|
||||||
|
@ -71,7 +61,10 @@ class AlbumTagEditorActivity : AbsTagEditorActivity(), TextWatcher {
|
||||||
albumArtBitmap,
|
albumArtBitmap,
|
||||||
getColor(
|
getColor(
|
||||||
resource?.palette,
|
resource?.palette,
|
||||||
ATHUtil.resolveColor(this@AlbumTagEditorActivity, R.attr.defaultFooterColor)
|
ATHUtil.resolveColor(
|
||||||
|
this@AlbumTagEditorActivity,
|
||||||
|
R.attr.defaultFooterColor
|
||||||
|
)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
deleteAlbumArt = false
|
deleteAlbumArt = false
|
||||||
|
|
|
@ -9,28 +9,9 @@ import code.name.monkey.appthemehelper.util.MaterialUtil
|
||||||
import code.name.monkey.retromusic.R
|
import code.name.monkey.retromusic.R
|
||||||
import code.name.monkey.retromusic.extensions.appHandleColor
|
import code.name.monkey.retromusic.extensions.appHandleColor
|
||||||
import code.name.monkey.retromusic.loaders.SongLoader
|
import code.name.monkey.retromusic.loaders.SongLoader
|
||||||
import kotlinx.android.synthetic.main.activity_song_tag_editor.albumArtistContainer
|
import kotlinx.android.synthetic.main.activity_song_tag_editor.*
|
||||||
import kotlinx.android.synthetic.main.activity_song_tag_editor.albumArtistText
|
|
||||||
import kotlinx.android.synthetic.main.activity_song_tag_editor.albumText
|
|
||||||
import kotlinx.android.synthetic.main.activity_song_tag_editor.albumTextContainer
|
|
||||||
import kotlinx.android.synthetic.main.activity_song_tag_editor.artistContainer
|
|
||||||
import kotlinx.android.synthetic.main.activity_song_tag_editor.artistText
|
|
||||||
import kotlinx.android.synthetic.main.activity_song_tag_editor.composerContainer
|
|
||||||
import kotlinx.android.synthetic.main.activity_song_tag_editor.genreContainer
|
|
||||||
import kotlinx.android.synthetic.main.activity_song_tag_editor.genreText
|
|
||||||
import kotlinx.android.synthetic.main.activity_song_tag_editor.lyricsContainer
|
|
||||||
import kotlinx.android.synthetic.main.activity_song_tag_editor.lyricsText
|
|
||||||
import kotlinx.android.synthetic.main.activity_song_tag_editor.songComposerText
|
|
||||||
import kotlinx.android.synthetic.main.activity_song_tag_editor.songText
|
|
||||||
import kotlinx.android.synthetic.main.activity_song_tag_editor.songTextContainer
|
|
||||||
import kotlinx.android.synthetic.main.activity_song_tag_editor.toolbar
|
|
||||||
import kotlinx.android.synthetic.main.activity_song_tag_editor.trackNumberContainer
|
|
||||||
import kotlinx.android.synthetic.main.activity_song_tag_editor.trackNumberText
|
|
||||||
import kotlinx.android.synthetic.main.activity_song_tag_editor.yearContainer
|
|
||||||
import kotlinx.android.synthetic.main.activity_song_tag_editor.yearText
|
|
||||||
import org.jaudiotagger.tag.FieldKey
|
import org.jaudiotagger.tag.FieldKey
|
||||||
import java.util.ArrayList
|
import java.util.*
|
||||||
import java.util.EnumMap
|
|
||||||
|
|
||||||
class SongTagEditorActivity : AbsTagEditorActivity(), TextWatcher {
|
class SongTagEditorActivity : AbsTagEditorActivity(), TextWatcher {
|
||||||
|
|
||||||
|
|
|
@ -7,21 +7,12 @@ import android.graphics.Bitmap;
|
||||||
import android.media.MediaScannerConnection;
|
import android.media.MediaScannerConnection;
|
||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
import androidx.annotation.Nullable;
|
import androidx.annotation.Nullable;
|
||||||
import code.name.monkey.retromusic.R;
|
|
||||||
import code.name.monkey.retromusic.misc.DialogAsyncTask;
|
|
||||||
import code.name.monkey.retromusic.misc.UpdateToastMediaScannerCompletionListener;
|
|
||||||
import code.name.monkey.retromusic.util.MusicUtil;
|
|
||||||
import code.name.monkey.retromusic.util.SAFUtil;
|
|
||||||
import com.google.android.material.dialog.MaterialAlertDialogBuilder;
|
import com.google.android.material.dialog.MaterialAlertDialogBuilder;
|
||||||
import java.io.File;
|
|
||||||
import java.io.FileOutputStream;
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.lang.ref.WeakReference;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Collection;
|
|
||||||
import java.util.Map;
|
|
||||||
import org.jaudiotagger.audio.AudioFile;
|
import org.jaudiotagger.audio.AudioFile;
|
||||||
import org.jaudiotagger.audio.AudioFileIO;
|
import org.jaudiotagger.audio.AudioFileIO;
|
||||||
import org.jaudiotagger.tag.FieldKey;
|
import org.jaudiotagger.tag.FieldKey;
|
||||||
|
@ -29,28 +20,23 @@ import org.jaudiotagger.tag.Tag;
|
||||||
import org.jaudiotagger.tag.images.Artwork;
|
import org.jaudiotagger.tag.images.Artwork;
|
||||||
import org.jaudiotagger.tag.images.ArtworkFactory;
|
import org.jaudiotagger.tag.images.ArtworkFactory;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.FileOutputStream;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.lang.ref.WeakReference;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collection;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import code.name.monkey.retromusic.R;
|
||||||
|
import code.name.monkey.retromusic.misc.DialogAsyncTask;
|
||||||
|
import code.name.monkey.retromusic.misc.UpdateToastMediaScannerCompletionListener;
|
||||||
|
import code.name.monkey.retromusic.util.MusicUtil;
|
||||||
|
import code.name.monkey.retromusic.util.SAFUtil;
|
||||||
|
|
||||||
public class WriteTagsAsyncTask extends
|
public class WriteTagsAsyncTask extends
|
||||||
DialogAsyncTask<WriteTagsAsyncTask.LoadingInfo, Integer, String[]> {
|
DialogAsyncTask<WriteTagsAsyncTask.LoadingInfo, Integer, String[]> {
|
||||||
|
|
||||||
public static class LoadingInfo {
|
|
||||||
|
|
||||||
@Nullable
|
|
||||||
final Map<FieldKey, String> fieldKeyValueMap;
|
|
||||||
|
|
||||||
final Collection<String> filePaths;
|
|
||||||
|
|
||||||
@Nullable
|
|
||||||
private AbsTagEditorActivity.ArtworkInfo artworkInfo;
|
|
||||||
|
|
||||||
public LoadingInfo(Collection<String> filePaths,
|
|
||||||
@Nullable Map<FieldKey, String> fieldKeyValueMap,
|
|
||||||
@Nullable AbsTagEditorActivity.ArtworkInfo artworkInfo) {
|
|
||||||
this.filePaths = filePaths;
|
|
||||||
this.fieldKeyValueMap = fieldKeyValueMap;
|
|
||||||
this.artworkInfo = artworkInfo;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private WeakReference<Activity> activity;
|
private WeakReference<Activity> activity;
|
||||||
|
|
||||||
public WriteTagsAsyncTask(@NonNull Activity activity) {
|
public WriteTagsAsyncTask(@NonNull Activity activity) {
|
||||||
|
@ -184,4 +170,23 @@ public class WriteTagsAsyncTask extends
|
||||||
new UpdateToastMediaScannerCompletionListener(activity, toBeScanned));
|
new UpdateToastMediaScannerCompletionListener(activity, toBeScanned));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static class LoadingInfo {
|
||||||
|
|
||||||
|
@Nullable
|
||||||
|
final Map<FieldKey, String> fieldKeyValueMap;
|
||||||
|
|
||||||
|
final Collection<String> filePaths;
|
||||||
|
|
||||||
|
@Nullable
|
||||||
|
private AbsTagEditorActivity.ArtworkInfo artworkInfo;
|
||||||
|
|
||||||
|
public LoadingInfo(Collection<String> filePaths,
|
||||||
|
@Nullable Map<FieldKey, String> fieldKeyValueMap,
|
||||||
|
@Nullable AbsTagEditorActivity.ArtworkInfo artworkInfo) {
|
||||||
|
this.filePaths = filePaths;
|
||||||
|
this.fieldKeyValueMap = fieldKeyValueMap;
|
||||||
|
this.artworkInfo = artworkInfo;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -39,26 +39,7 @@ import code.name.monkey.retromusic.util.SwipeAndDragHelper;
|
||||||
public class CategoryInfoAdapter extends RecyclerView.Adapter<CategoryInfoAdapter.ViewHolder>
|
public class CategoryInfoAdapter extends RecyclerView.Adapter<CategoryInfoAdapter.ViewHolder>
|
||||||
implements SwipeAndDragHelper.ActionCompletionContract {
|
implements SwipeAndDragHelper.ActionCompletionContract {
|
||||||
|
|
||||||
static class ViewHolder extends RecyclerView.ViewHolder {
|
|
||||||
|
|
||||||
MaterialCheckBox checkBox;
|
|
||||||
|
|
||||||
View dragView;
|
|
||||||
|
|
||||||
TextView title;
|
|
||||||
|
|
||||||
ViewHolder(View view) {
|
|
||||||
super(view);
|
|
||||||
checkBox = view.findViewById(R.id.checkbox);
|
|
||||||
checkBox.setButtonTintList(
|
|
||||||
ColorStateList.valueOf(ThemeStore.Companion.accentColor(checkBox.getContext())));
|
|
||||||
title = view.findViewById(R.id.title);
|
|
||||||
dragView = view.findViewById(R.id.drag_view);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private List<CategoryInfo> categoryInfos;
|
private List<CategoryInfo> categoryInfos;
|
||||||
|
|
||||||
private ItemTouchHelper touchHelper;
|
private ItemTouchHelper touchHelper;
|
||||||
|
|
||||||
public CategoryInfoAdapter(@NonNull List<CategoryInfo> categoryInfos) {
|
public CategoryInfoAdapter(@NonNull List<CategoryInfo> categoryInfos) {
|
||||||
|
@ -139,4 +120,22 @@ public class CategoryInfoAdapter extends RecyclerView.Adapter<CategoryInfoAdapte
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static class ViewHolder extends RecyclerView.ViewHolder {
|
||||||
|
|
||||||
|
MaterialCheckBox checkBox;
|
||||||
|
|
||||||
|
View dragView;
|
||||||
|
|
||||||
|
TextView title;
|
||||||
|
|
||||||
|
ViewHolder(View view) {
|
||||||
|
super(view);
|
||||||
|
checkBox = view.findViewById(R.id.checkbox);
|
||||||
|
checkBox.setButtonTintList(
|
||||||
|
ColorStateList.valueOf(ThemeStore.Companion.accentColor(checkBox.getContext())));
|
||||||
|
title = view.findViewById(R.id.title);
|
||||||
|
dragView = view.findViewById(R.id.drag_view);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -9,7 +9,6 @@ import androidx.recyclerview.widget.RecyclerView
|
||||||
import code.name.monkey.retromusic.R
|
import code.name.monkey.retromusic.R
|
||||||
import code.name.monkey.retromusic.model.Contributor
|
import code.name.monkey.retromusic.model.Contributor
|
||||||
import code.name.monkey.retromusic.util.RetroUtil.openUrl
|
import code.name.monkey.retromusic.util.RetroUtil.openUrl
|
||||||
import code.name.monkey.retromusic.views.CircularImageView
|
|
||||||
import code.name.monkey.retromusic.views.RetroShapeableImageView
|
import code.name.monkey.retromusic.views.RetroShapeableImageView
|
||||||
import com.bumptech.glide.Glide
|
import com.bumptech.glide.Glide
|
||||||
|
|
||||||
|
|
|
@ -3,28 +3,28 @@ package code.name.monkey.retromusic.adapter.base;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.view.Menu;
|
import android.view.Menu;
|
||||||
import android.view.MenuItem;
|
import android.view.MenuItem;
|
||||||
|
|
||||||
import androidx.annotation.MenuRes;
|
import androidx.annotation.MenuRes;
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
import androidx.annotation.Nullable;
|
import androidx.annotation.Nullable;
|
||||||
import androidx.recyclerview.widget.RecyclerView;
|
import androidx.recyclerview.widget.RecyclerView;
|
||||||
|
|
||||||
|
import com.afollestad.materialcab.MaterialCab;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
|
||||||
import code.name.monkey.retromusic.R;
|
import code.name.monkey.retromusic.R;
|
||||||
import code.name.monkey.retromusic.interfaces.CabHolder;
|
import code.name.monkey.retromusic.interfaces.CabHolder;
|
||||||
import com.afollestad.materialcab.MaterialCab;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
|
|
||||||
|
|
||||||
public abstract class AbsMultiSelectAdapter<VH extends RecyclerView.ViewHolder, I> extends RecyclerView.Adapter<VH>
|
public abstract class AbsMultiSelectAdapter<VH extends RecyclerView.ViewHolder, I> extends RecyclerView.Adapter<VH>
|
||||||
implements MaterialCab.Callback {
|
implements MaterialCab.Callback {
|
||||||
|
|
||||||
private MaterialCab cab;
|
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
private final CabHolder cabHolder;
|
private final CabHolder cabHolder;
|
||||||
|
|
||||||
private ArrayList<I> checked;
|
|
||||||
|
|
||||||
private final Context context;
|
private final Context context;
|
||||||
|
private MaterialCab cab;
|
||||||
|
private ArrayList<I> checked;
|
||||||
private int menuRes;
|
private int menuRes;
|
||||||
|
|
||||||
public AbsMultiSelectAdapter(@NonNull Context context, @Nullable CabHolder cabHolder, @MenuRes int menuRes) {
|
public AbsMultiSelectAdapter(@NonNull Context context, @Nullable CabHolder cabHolder, @MenuRes int menuRes) {
|
||||||
|
|
|
@ -20,13 +20,16 @@ import android.view.ViewGroup;
|
||||||
import android.widget.ImageButton;
|
import android.widget.ImageButton;
|
||||||
import android.widget.ImageView;
|
import android.widget.ImageView;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
import androidx.annotation.Nullable;
|
import androidx.annotation.Nullable;
|
||||||
import androidx.recyclerview.widget.RecyclerView;
|
import androidx.recyclerview.widget.RecyclerView;
|
||||||
import code.name.monkey.retromusic.R;
|
|
||||||
import com.google.android.material.card.MaterialCardView;
|
import com.google.android.material.card.MaterialCardView;
|
||||||
import com.h6ah4i.android.widget.advrecyclerview.utils.AbstractDraggableSwipeableItemViewHolder;
|
import com.h6ah4i.android.widget.advrecyclerview.utils.AbstractDraggableSwipeableItemViewHolder;
|
||||||
|
|
||||||
|
import code.name.monkey.retromusic.R;
|
||||||
|
|
||||||
public class MediaEntryViewHolder extends AbstractDraggableSwipeableItemViewHolder
|
public class MediaEntryViewHolder extends AbstractDraggableSwipeableItemViewHolder
|
||||||
implements View.OnLongClickListener, View.OnClickListener {
|
implements View.OnLongClickListener, View.OnClickListener {
|
||||||
|
|
||||||
|
|
|
@ -30,7 +30,7 @@ import code.name.monkey.retromusic.model.smartplaylist.AbsSmartPlaylist
|
||||||
import code.name.monkey.retromusic.model.smartplaylist.LastAddedPlaylist
|
import code.name.monkey.retromusic.model.smartplaylist.LastAddedPlaylist
|
||||||
import code.name.monkey.retromusic.util.MusicUtil
|
import code.name.monkey.retromusic.util.MusicUtil
|
||||||
import code.name.monkey.retromusic.util.NavigationUtil
|
import code.name.monkey.retromusic.util.NavigationUtil
|
||||||
import java.util.ArrayList
|
import java.util.*
|
||||||
|
|
||||||
class PlaylistAdapter(
|
class PlaylistAdapter(
|
||||||
private val activity: AppCompatActivity,
|
private val activity: AppCompatActivity,
|
||||||
|
@ -172,7 +172,8 @@ class PlaylistAdapter(
|
||||||
init {
|
init {
|
||||||
|
|
||||||
image?.apply {
|
image?.apply {
|
||||||
val iconPadding = activity.resources.getDimensionPixelSize(R.dimen.list_item_image_icon_padding)
|
val iconPadding =
|
||||||
|
activity.resources.getDimensionPixelSize(R.dimen.list_item_image_icon_padding)
|
||||||
setPadding(iconPadding, iconPadding, iconPadding, iconPadding)
|
setPadding(iconPadding, iconPadding, iconPadding, iconPadding)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -19,7 +19,8 @@ abstract class AbsOffsetSongAdapter(
|
||||||
|
|
||||||
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): SongAdapter.ViewHolder {
|
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): SongAdapter.ViewHolder {
|
||||||
if (viewType == OFFSET_ITEM) {
|
if (viewType == OFFSET_ITEM) {
|
||||||
val view = LayoutInflater.from(activity).inflate(R.layout.item_list_quick_actions, parent, false)
|
val view = LayoutInflater.from(activity)
|
||||||
|
.inflate(R.layout.item_list_quick_actions, parent, false)
|
||||||
return createViewHolder(view)
|
return createViewHolder(view)
|
||||||
}
|
}
|
||||||
return super.onCreateViewHolder(parent, viewType)
|
return super.onCreateViewHolder(parent, viewType)
|
||||||
|
|
|
@ -91,7 +91,8 @@ class OrderablePlaylistSongAdapter(
|
||||||
fun onMoveItem(fromPosition: Int, toPosition: Int)
|
fun onMoveItem(fromPosition: Int, toPosition: Int)
|
||||||
}
|
}
|
||||||
|
|
||||||
inner class ViewHolder(itemView: View) : PlaylistSongAdapter.ViewHolder(itemView), DraggableItemViewHolder {
|
inner class ViewHolder(itemView: View) : PlaylistSongAdapter.ViewHolder(itemView),
|
||||||
|
DraggableItemViewHolder {
|
||||||
@DraggableItemStateFlags
|
@DraggableItemStateFlags
|
||||||
private var mDragStateFlags: Int = 0
|
private var mDragStateFlags: Int = 0
|
||||||
|
|
||||||
|
|
|
@ -23,7 +23,7 @@ import com.h6ah4i.android.widget.advrecyclerview.swipeable.action.SwipeResultAct
|
||||||
import com.h6ah4i.android.widget.advrecyclerview.swipeable.action.SwipeResultActionRemoveItem
|
import com.h6ah4i.android.widget.advrecyclerview.swipeable.action.SwipeResultActionRemoveItem
|
||||||
import com.h6ah4i.android.widget.advrecyclerview.swipeable.annotation.SwipeableItemResults
|
import com.h6ah4i.android.widget.advrecyclerview.swipeable.annotation.SwipeableItemResults
|
||||||
import me.zhanghai.android.fastscroll.PopupTextProvider
|
import me.zhanghai.android.fastscroll.PopupTextProvider
|
||||||
import java.util.ArrayList
|
import java.util.*
|
||||||
|
|
||||||
class PlayingQueueAdapter(
|
class PlayingQueueAdapter(
|
||||||
activity: AppCompatActivity,
|
activity: AppCompatActivity,
|
||||||
|
@ -32,7 +32,8 @@ class PlayingQueueAdapter(
|
||||||
itemLayoutRes: Int
|
itemLayoutRes: Int
|
||||||
) : SongAdapter(
|
) : SongAdapter(
|
||||||
activity, dataSet, itemLayoutRes, null
|
activity, dataSet, itemLayoutRes, null
|
||||||
), DraggableItemAdapter<PlayingQueueAdapter.ViewHolder>, SwipeableItemAdapter<PlayingQueueAdapter.ViewHolder>,
|
), DraggableItemAdapter<PlayingQueueAdapter.ViewHolder>,
|
||||||
|
SwipeableItemAdapter<PlayingQueueAdapter.ViewHolder>,
|
||||||
PopupTextProvider {
|
PopupTextProvider {
|
||||||
|
|
||||||
private var color = -1
|
private var color = -1
|
||||||
|
@ -107,7 +108,11 @@ class PlayingQueueAdapter(
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onCheckCanStartDrag(holder: ViewHolder, position: Int, x: Int, y: Int): Boolean {
|
override fun onCheckCanStartDrag(holder: ViewHolder, position: Int, x: Int, y: Int): Boolean {
|
||||||
return ViewUtil.hitTest(holder.imageText!!, x, y) || ViewUtil.hitTest(holder.dragView!!, x, y)
|
return ViewUtil.hitTest(holder.imageText!!, x, y) || ViewUtil.hitTest(
|
||||||
|
holder.dragView!!,
|
||||||
|
x,
|
||||||
|
y
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onGetItemDraggableRange(holder: ViewHolder, position: Int): ItemDraggableRange? {
|
override fun onGetItemDraggableRange(holder: ViewHolder, position: Int): ItemDraggableRange? {
|
||||||
|
|
|
@ -15,14 +15,18 @@
|
||||||
package code.name.monkey.retromusic.appshortcuts
|
package code.name.monkey.retromusic.appshortcuts
|
||||||
|
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import android.graphics.*
|
import android.graphics.Bitmap
|
||||||
import android.graphics.drawable.*
|
import android.graphics.Canvas
|
||||||
|
import android.graphics.drawable.Drawable
|
||||||
|
import android.graphics.drawable.Icon
|
||||||
|
import android.graphics.drawable.LayerDrawable
|
||||||
import android.os.Build
|
import android.os.Build
|
||||||
import android.util.TypedValue
|
import android.util.TypedValue
|
||||||
import androidx.annotation.RequiresApi
|
import androidx.annotation.RequiresApi
|
||||||
import code.name.monkey.appthemehelper.ThemeStore
|
import code.name.monkey.appthemehelper.ThemeStore
|
||||||
import code.name.monkey.retromusic.R
|
import code.name.monkey.retromusic.R
|
||||||
import code.name.monkey.retromusic.util.*
|
import code.name.monkey.retromusic.util.PreferenceUtil
|
||||||
|
import code.name.monkey.retromusic.util.RetroUtil
|
||||||
|
|
||||||
@RequiresApi(Build.VERSION_CODES.N_MR1)
|
@RequiresApi(Build.VERSION_CODES.N_MR1)
|
||||||
object AppShortcutIconGenerator {
|
object AppShortcutIconGenerator {
|
||||||
|
|
|
@ -18,9 +18,14 @@ import android.app.Activity
|
||||||
import android.content.Intent
|
import android.content.Intent
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import code.name.monkey.retromusic.activities.SearchActivity
|
import code.name.monkey.retromusic.activities.SearchActivity
|
||||||
import code.name.monkey.retromusic.appshortcuts.shortcuttype.*
|
import code.name.monkey.retromusic.appshortcuts.shortcuttype.LastAddedShortcutType
|
||||||
|
import code.name.monkey.retromusic.appshortcuts.shortcuttype.SearchShortCutType
|
||||||
|
import code.name.monkey.retromusic.appshortcuts.shortcuttype.ShuffleAllShortcutType
|
||||||
|
import code.name.monkey.retromusic.appshortcuts.shortcuttype.TopTracksShortcutType
|
||||||
import code.name.monkey.retromusic.model.Playlist
|
import code.name.monkey.retromusic.model.Playlist
|
||||||
import code.name.monkey.retromusic.model.smartplaylist.*
|
import code.name.monkey.retromusic.model.smartplaylist.LastAddedPlaylist
|
||||||
|
import code.name.monkey.retromusic.model.smartplaylist.MyTopTracksPlaylist
|
||||||
|
import code.name.monkey.retromusic.model.smartplaylist.ShuffleAllPlaylist
|
||||||
import code.name.monkey.retromusic.service.MusicService
|
import code.name.monkey.retromusic.service.MusicService
|
||||||
import code.name.monkey.retromusic.service.MusicService.*
|
import code.name.monkey.retromusic.service.MusicService.*
|
||||||
|
|
||||||
|
|
|
@ -15,16 +15,22 @@
|
||||||
package code.name.monkey.retromusic.appshortcuts
|
package code.name.monkey.retromusic.appshortcuts
|
||||||
|
|
||||||
import android.annotation.TargetApi
|
import android.annotation.TargetApi
|
||||||
import android.content.*
|
import android.content.Context
|
||||||
import android.content.pm.*
|
import android.content.Intent
|
||||||
|
import android.content.pm.ShortcutInfo
|
||||||
|
import android.content.pm.ShortcutManager
|
||||||
import android.graphics.drawable.Icon
|
import android.graphics.drawable.Icon
|
||||||
import android.os.Build
|
import android.os.Build
|
||||||
import code.name.monkey.retromusic.appshortcuts.shortcuttype.*
|
import code.name.monkey.retromusic.appshortcuts.shortcuttype.LastAddedShortcutType
|
||||||
|
import code.name.monkey.retromusic.appshortcuts.shortcuttype.SearchShortCutType
|
||||||
|
import code.name.monkey.retromusic.appshortcuts.shortcuttype.ShuffleAllShortcutType
|
||||||
|
import code.name.monkey.retromusic.appshortcuts.shortcuttype.TopTracksShortcutType
|
||||||
import java.util.*
|
import java.util.*
|
||||||
|
|
||||||
@TargetApi(Build.VERSION_CODES.N_MR1)
|
@TargetApi(Build.VERSION_CODES.N_MR1)
|
||||||
class DynamicShortcutManager(private val context: Context) {
|
class DynamicShortcutManager(private val context: Context) {
|
||||||
private val shortcutManager: ShortcutManager = this.context.getSystemService(ShortcutManager::class.java)
|
private val shortcutManager: ShortcutManager =
|
||||||
|
this.context.getSystemService(ShortcutManager::class.java)
|
||||||
|
|
||||||
private val defaultShortcuts: List<ShortcutInfo>
|
private val defaultShortcuts: List<ShortcutInfo>
|
||||||
get() = Arrays.asList(
|
get() = Arrays.asList(
|
||||||
|
|
|
@ -15,9 +15,11 @@
|
||||||
package code.name.monkey.retromusic.appshortcuts.shortcuttype
|
package code.name.monkey.retromusic.appshortcuts.shortcuttype
|
||||||
|
|
||||||
import android.annotation.TargetApi
|
import android.annotation.TargetApi
|
||||||
import android.content.*
|
import android.content.Context
|
||||||
|
import android.content.Intent
|
||||||
import android.content.pm.ShortcutInfo
|
import android.content.pm.ShortcutInfo
|
||||||
import android.os.*
|
import android.os.Build
|
||||||
|
import android.os.Bundle
|
||||||
import code.name.monkey.retromusic.appshortcuts.AppShortcutLauncherActivity
|
import code.name.monkey.retromusic.appshortcuts.AppShortcutLauncherActivity
|
||||||
|
|
||||||
@TargetApi(Build.VERSION_CODES.N_MR1)
|
@TargetApi(Build.VERSION_CODES.N_MR1)
|
||||||
|
|
|
@ -19,7 +19,8 @@ import android.content.Context
|
||||||
import android.content.pm.ShortcutInfo
|
import android.content.pm.ShortcutInfo
|
||||||
import android.os.Build
|
import android.os.Build
|
||||||
import code.name.monkey.retromusic.R
|
import code.name.monkey.retromusic.R
|
||||||
import code.name.monkey.retromusic.appshortcuts.*
|
import code.name.monkey.retromusic.appshortcuts.AppShortcutIconGenerator
|
||||||
|
import code.name.monkey.retromusic.appshortcuts.AppShortcutLauncherActivity
|
||||||
|
|
||||||
@TargetApi(Build.VERSION_CODES.N_MR1)
|
@TargetApi(Build.VERSION_CODES.N_MR1)
|
||||||
class LastAddedShortcutType(context: Context) : BaseShortcutType(context) {
|
class LastAddedShortcutType(context: Context) : BaseShortcutType(context) {
|
||||||
|
|
|
@ -19,7 +19,8 @@ import android.content.Context
|
||||||
import android.content.pm.ShortcutInfo
|
import android.content.pm.ShortcutInfo
|
||||||
import android.os.Build
|
import android.os.Build
|
||||||
import code.name.monkey.retromusic.R
|
import code.name.monkey.retromusic.R
|
||||||
import code.name.monkey.retromusic.appshortcuts.*
|
import code.name.monkey.retromusic.appshortcuts.AppShortcutIconGenerator
|
||||||
|
import code.name.monkey.retromusic.appshortcuts.AppShortcutLauncherActivity
|
||||||
|
|
||||||
@TargetApi(Build.VERSION_CODES.N_MR1)
|
@TargetApi(Build.VERSION_CODES.N_MR1)
|
||||||
class SearchShortCutType(context: Context) : BaseShortcutType(context) {
|
class SearchShortCutType(context: Context) : BaseShortcutType(context) {
|
||||||
|
|
|
@ -19,7 +19,8 @@ import android.content.Context
|
||||||
import android.content.pm.ShortcutInfo
|
import android.content.pm.ShortcutInfo
|
||||||
import android.os.Build
|
import android.os.Build
|
||||||
import code.name.monkey.retromusic.R
|
import code.name.monkey.retromusic.R
|
||||||
import code.name.monkey.retromusic.appshortcuts.*
|
import code.name.monkey.retromusic.appshortcuts.AppShortcutIconGenerator
|
||||||
|
import code.name.monkey.retromusic.appshortcuts.AppShortcutLauncherActivity
|
||||||
|
|
||||||
@TargetApi(Build.VERSION_CODES.N_MR1)
|
@TargetApi(Build.VERSION_CODES.N_MR1)
|
||||||
class ShuffleAllShortcutType(context: Context) : BaseShortcutType(context) {
|
class ShuffleAllShortcutType(context: Context) : BaseShortcutType(context) {
|
||||||
|
|
|
@ -19,7 +19,8 @@ import android.content.Context
|
||||||
import android.content.pm.ShortcutInfo
|
import android.content.pm.ShortcutInfo
|
||||||
import android.os.Build
|
import android.os.Build
|
||||||
import code.name.monkey.retromusic.R
|
import code.name.monkey.retromusic.R
|
||||||
import code.name.monkey.retromusic.appshortcuts.*
|
import code.name.monkey.retromusic.appshortcuts.AppShortcutIconGenerator
|
||||||
|
import code.name.monkey.retromusic.appshortcuts.AppShortcutLauncherActivity
|
||||||
|
|
||||||
@TargetApi(Build.VERSION_CODES.N_MR1)
|
@TargetApi(Build.VERSION_CODES.N_MR1)
|
||||||
class TopTracksShortcutType(context: Context) : BaseShortcutType(context) {
|
class TopTracksShortcutType(context: Context) : BaseShortcutType(context) {
|
||||||
|
|
|
@ -115,7 +115,8 @@ class AppWidgetBig : BaseAppWidget() {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set correct drawable for pause state
|
// Set correct drawable for pause state
|
||||||
val playPauseRes = if (isPlaying) code.name.monkey.retromusic.R.drawable.ic_pause_white_24dp else code.name.monkey.retromusic.R.drawable.ic_play_arrow_white_32dp
|
val playPauseRes =
|
||||||
|
if (isPlaying) code.name.monkey.retromusic.R.drawable.ic_pause_white_24dp else code.name.monkey.retromusic.R.drawable.ic_play_arrow_white_32dp
|
||||||
appWidgetView.setImageViewBitmap(
|
appWidgetView.setImageViewBitmap(
|
||||||
R.id.button_toggle_play_pause, BaseAppWidget.createBitmap(
|
R.id.button_toggle_play_pause, BaseAppWidget.createBitmap(
|
||||||
RetroUtil.getTintedVectorDrawable(
|
RetroUtil.getTintedVectorDrawable(
|
||||||
|
|
|
@ -15,7 +15,9 @@
|
||||||
package code.name.monkey.retromusic.appwidgets
|
package code.name.monkey.retromusic.appwidgets
|
||||||
|
|
||||||
import android.app.PendingIntent
|
import android.app.PendingIntent
|
||||||
import android.content.*
|
import android.content.ComponentName
|
||||||
|
import android.content.Context
|
||||||
|
import android.content.Intent
|
||||||
import android.graphics.Bitmap
|
import android.graphics.Bitmap
|
||||||
import android.graphics.drawable.Drawable
|
import android.graphics.drawable.Drawable
|
||||||
import android.text.TextUtils
|
import android.text.TextUtils
|
||||||
|
@ -29,10 +31,11 @@ import code.name.monkey.retromusic.glide.SongGlideRequest
|
||||||
import code.name.monkey.retromusic.glide.palette.BitmapPaletteWrapper
|
import code.name.monkey.retromusic.glide.palette.BitmapPaletteWrapper
|
||||||
import code.name.monkey.retromusic.service.MusicService
|
import code.name.monkey.retromusic.service.MusicService
|
||||||
import code.name.monkey.retromusic.service.MusicService.*
|
import code.name.monkey.retromusic.service.MusicService.*
|
||||||
import code.name.monkey.retromusic.util.*
|
import code.name.monkey.retromusic.util.ImageUtil
|
||||||
|
import code.name.monkey.retromusic.util.RetroUtil
|
||||||
import com.bumptech.glide.Glide
|
import com.bumptech.glide.Glide
|
||||||
import com.bumptech.glide.request.animation.GlideAnimation
|
import com.bumptech.glide.request.animation.GlideAnimation
|
||||||
import com.bumptech.glide.request.target.*
|
import com.bumptech.glide.request.target.SimpleTarget
|
||||||
import com.bumptech.glide.request.target.Target
|
import com.bumptech.glide.request.target.Target
|
||||||
|
|
||||||
class AppWidgetCard : BaseAppWidget() {
|
class AppWidgetCard : BaseAppWidget() {
|
||||||
|
@ -104,7 +107,8 @@ class AppWidgetCard : BaseAppWidget() {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set correct drawable for pause state
|
// Set correct drawable for pause state
|
||||||
val playPauseRes = if (isPlaying) R.drawable.ic_pause_white_24dp else R.drawable.ic_play_arrow_white_32dp
|
val playPauseRes =
|
||||||
|
if (isPlaying) R.drawable.ic_pause_white_24dp else R.drawable.ic_play_arrow_white_32dp
|
||||||
appWidgetView.setImageViewBitmap(
|
appWidgetView.setImageViewBitmap(
|
||||||
R.id.button_toggle_play_pause, createBitmap(
|
R.id.button_toggle_play_pause, createBitmap(
|
||||||
RetroUtil.getTintedVectorDrawable(
|
RetroUtil.getTintedVectorDrawable(
|
||||||
|
@ -139,10 +143,12 @@ class AppWidgetCard : BaseAppWidget() {
|
||||||
linkButtons(service, appWidgetView)
|
linkButtons(service, appWidgetView)
|
||||||
|
|
||||||
if (imageSize == 0) {
|
if (imageSize == 0) {
|
||||||
imageSize = service.resources.getDimensionPixelSize(code.name.monkey.retromusic.R.dimen.app_widget_card_image_size)
|
imageSize =
|
||||||
|
service.resources.getDimensionPixelSize(code.name.monkey.retromusic.R.dimen.app_widget_card_image_size)
|
||||||
}
|
}
|
||||||
if (cardRadius == 0f) {
|
if (cardRadius == 0f) {
|
||||||
cardRadius = service.resources.getDimension(code.name.monkey.retromusic.R.dimen.app_widget_card_radius)
|
cardRadius =
|
||||||
|
service.resources.getDimension(code.name.monkey.retromusic.R.dimen.app_widget_card_radius)
|
||||||
}
|
}
|
||||||
val appContext = service.applicationContext
|
val appContext = service.applicationContext
|
||||||
// Load the album cover async and push the update on completion
|
// Load the album cover async and push the update on completion
|
||||||
|
|
|
@ -31,9 +31,7 @@ import code.name.monkey.retromusic.appwidgets.base.BaseAppWidget
|
||||||
import code.name.monkey.retromusic.glide.SongGlideRequest
|
import code.name.monkey.retromusic.glide.SongGlideRequest
|
||||||
import code.name.monkey.retromusic.glide.palette.BitmapPaletteWrapper
|
import code.name.monkey.retromusic.glide.palette.BitmapPaletteWrapper
|
||||||
import code.name.monkey.retromusic.service.MusicService
|
import code.name.monkey.retromusic.service.MusicService
|
||||||
import code.name.monkey.retromusic.service.MusicService.ACTION_REWIND
|
import code.name.monkey.retromusic.service.MusicService.*
|
||||||
import code.name.monkey.retromusic.service.MusicService.ACTION_SKIP
|
|
||||||
import code.name.monkey.retromusic.service.MusicService.ACTION_TOGGLE_PAUSE
|
|
||||||
import code.name.monkey.retromusic.util.ImageUtil
|
import code.name.monkey.retromusic.util.ImageUtil
|
||||||
import code.name.monkey.retromusic.util.RetroUtil
|
import code.name.monkey.retromusic.util.RetroUtil
|
||||||
import com.bumptech.glide.Glide
|
import com.bumptech.glide.Glide
|
||||||
|
@ -111,7 +109,8 @@ class AppWidgetClassic : BaseAppWidget() {
|
||||||
linkButtons(service, appWidgetView)
|
linkButtons(service, appWidgetView)
|
||||||
|
|
||||||
if (imageSize == 0) {
|
if (imageSize == 0) {
|
||||||
imageSize = service.resources.getDimensionPixelSize(R.dimen.app_widget_classic_image_size)
|
imageSize =
|
||||||
|
service.resources.getDimensionPixelSize(R.dimen.app_widget_classic_image_size)
|
||||||
}
|
}
|
||||||
if (cardRadius == 0f) {
|
if (cardRadius == 0f) {
|
||||||
cardRadius = service.resources.getDimension(R.dimen.app_widget_card_radius)
|
cardRadius = service.resources.getDimension(R.dimen.app_widget_card_radius)
|
||||||
|
@ -155,7 +154,13 @@ class AppWidgetClassic : BaseAppWidget() {
|
||||||
if (isPlaying) R.drawable.ic_pause_white_24dp else R.drawable.ic_play_arrow_white_24dp
|
if (isPlaying) R.drawable.ic_pause_white_24dp else R.drawable.ic_play_arrow_white_24dp
|
||||||
appWidgetView.setImageViewBitmap(
|
appWidgetView.setImageViewBitmap(
|
||||||
R.id.button_toggle_play_pause,
|
R.id.button_toggle_play_pause,
|
||||||
ImageUtil.createBitmap(ImageUtil.getTintedVectorDrawable(service, playPauseRes, color))
|
ImageUtil.createBitmap(
|
||||||
|
ImageUtil.getTintedVectorDrawable(
|
||||||
|
service,
|
||||||
|
playPauseRes,
|
||||||
|
color
|
||||||
|
)
|
||||||
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
// Set prev/next button drawables
|
// Set prev/next button drawables
|
||||||
|
@ -182,7 +187,15 @@ class AppWidgetClassic : BaseAppWidget() {
|
||||||
|
|
||||||
val image = getAlbumArtDrawable(service.resources, bitmap)
|
val image = getAlbumArtDrawable(service.resources, bitmap)
|
||||||
val roundedBitmap =
|
val roundedBitmap =
|
||||||
createRoundedBitmap(image, imageSize, imageSize, cardRadius, 0F, cardRadius, 0F)
|
createRoundedBitmap(
|
||||||
|
image,
|
||||||
|
imageSize,
|
||||||
|
imageSize,
|
||||||
|
cardRadius,
|
||||||
|
0F,
|
||||||
|
cardRadius,
|
||||||
|
0F
|
||||||
|
)
|
||||||
appWidgetView.setImageViewBitmap(R.id.image, roundedBitmap)
|
appWidgetView.setImageViewBitmap(R.id.image, roundedBitmap)
|
||||||
|
|
||||||
pushUpdate(appContext, appWidgetIds, appWidgetView)
|
pushUpdate(appContext, appWidgetIds, appWidgetView)
|
||||||
|
|
|
@ -49,9 +49,36 @@ class AppWidgetSmall : BaseAppWidget() {
|
||||||
|
|
||||||
appWidgetView.setViewVisibility(R.id.media_titles, View.INVISIBLE)
|
appWidgetView.setViewVisibility(R.id.media_titles, View.INVISIBLE)
|
||||||
appWidgetView.setImageViewResource(R.id.image, R.drawable.default_audio_art)
|
appWidgetView.setImageViewResource(R.id.image, R.drawable.default_audio_art)
|
||||||
appWidgetView.setImageViewBitmap(R.id.button_next, createBitmap(RetroUtil.getTintedVectorDrawable(context, R.drawable.ic_skip_next_white_24dp, MaterialValueHelper.getSecondaryTextColor(context, true))!!, 1f))
|
appWidgetView.setImageViewBitmap(
|
||||||
appWidgetView.setImageViewBitmap(R.id.button_prev, createBitmap(RetroUtil.getTintedVectorDrawable(context, R.drawable.ic_skip_previous_white_24dp, MaterialValueHelper.getSecondaryTextColor(context, true))!!, 1f))
|
R.id.button_next,
|
||||||
appWidgetView.setImageViewBitmap(R.id.button_toggle_play_pause, createBitmap(RetroUtil.getTintedVectorDrawable(context, R.drawable.ic_play_arrow_white_32dp, MaterialValueHelper.getSecondaryTextColor(context, true))!!, 1f))
|
createBitmap(
|
||||||
|
RetroUtil.getTintedVectorDrawable(
|
||||||
|
context,
|
||||||
|
R.drawable.ic_skip_next_white_24dp,
|
||||||
|
MaterialValueHelper.getSecondaryTextColor(context, true)
|
||||||
|
)!!, 1f
|
||||||
|
)
|
||||||
|
)
|
||||||
|
appWidgetView.setImageViewBitmap(
|
||||||
|
R.id.button_prev,
|
||||||
|
createBitmap(
|
||||||
|
RetroUtil.getTintedVectorDrawable(
|
||||||
|
context,
|
||||||
|
R.drawable.ic_skip_previous_white_24dp,
|
||||||
|
MaterialValueHelper.getSecondaryTextColor(context, true)
|
||||||
|
)!!, 1f
|
||||||
|
)
|
||||||
|
)
|
||||||
|
appWidgetView.setImageViewBitmap(
|
||||||
|
R.id.button_toggle_play_pause,
|
||||||
|
createBitmap(
|
||||||
|
RetroUtil.getTintedVectorDrawable(
|
||||||
|
context,
|
||||||
|
R.drawable.ic_play_arrow_white_32dp,
|
||||||
|
MaterialValueHelper.getSecondaryTextColor(context, true)
|
||||||
|
)!!, 1f
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
linkButtons(context, appWidgetView)
|
linkButtons(context, appWidgetView)
|
||||||
pushUpdate(context, appWidgetIds, appWidgetView)
|
pushUpdate(context, appWidgetIds, appWidgetView)
|
||||||
|
|
|
@ -15,12 +15,15 @@
|
||||||
package code.name.monkey.retromusic.appwidgets
|
package code.name.monkey.retromusic.appwidgets
|
||||||
|
|
||||||
import android.app.PendingIntent
|
import android.app.PendingIntent
|
||||||
import android.content.*
|
import android.content.ComponentName
|
||||||
|
import android.content.Context
|
||||||
|
import android.content.Intent
|
||||||
import android.text.TextUtils
|
import android.text.TextUtils
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import android.widget.RemoteViews
|
import android.widget.RemoteViews
|
||||||
import androidx.core.content.ContextCompat
|
import androidx.core.content.ContextCompat
|
||||||
import code.name.monkey.retromusic.*
|
import code.name.monkey.retromusic.App
|
||||||
|
import code.name.monkey.retromusic.R
|
||||||
import code.name.monkey.retromusic.activities.MainActivity
|
import code.name.monkey.retromusic.activities.MainActivity
|
||||||
import code.name.monkey.retromusic.appwidgets.base.BaseAppWidget
|
import code.name.monkey.retromusic.appwidgets.base.BaseAppWidget
|
||||||
import code.name.monkey.retromusic.service.MusicService
|
import code.name.monkey.retromusic.service.MusicService
|
||||||
|
|
|
@ -15,7 +15,10 @@
|
||||||
package code.name.monkey.retromusic.appwidgets
|
package code.name.monkey.retromusic.appwidgets
|
||||||
|
|
||||||
import android.appwidget.AppWidgetManager
|
import android.appwidget.AppWidgetManager
|
||||||
import android.content.*
|
import android.content.BroadcastReceiver
|
||||||
|
import android.content.ComponentName
|
||||||
|
import android.content.Context
|
||||||
|
import android.content.Intent
|
||||||
import android.os.Build
|
import android.os.Build
|
||||||
import code.name.monkey.retromusic.service.MusicService
|
import code.name.monkey.retromusic.service.MusicService
|
||||||
|
|
||||||
|
@ -40,7 +43,8 @@ class BootReceiver : BroadcastReceiver() {
|
||||||
ComponentName(
|
ComponentName(
|
||||||
context, AppWidgetCard::class.java
|
context, AppWidgetCard::class.java
|
||||||
)
|
)
|
||||||
).isNotEmpty()) {
|
).isNotEmpty()
|
||||||
|
) {
|
||||||
val serviceIntent = Intent(context, MusicService::class.java)
|
val serviceIntent = Intent(context, MusicService::class.java)
|
||||||
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.O) { // not allowed on Oreo
|
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.O) { // not allowed on Oreo
|
||||||
context.startService(serviceIntent)
|
context.startService(serviceIntent)
|
||||||
|
|
|
@ -15,16 +15,21 @@
|
||||||
package code.name.monkey.retromusic.appwidgets.base
|
package code.name.monkey.retromusic.appwidgets.base
|
||||||
|
|
||||||
import android.app.PendingIntent
|
import android.app.PendingIntent
|
||||||
import android.appwidget.*
|
import android.appwidget.AppWidgetManager
|
||||||
import android.content.*
|
import android.appwidget.AppWidgetProvider
|
||||||
|
import android.content.ComponentName
|
||||||
|
import android.content.Context
|
||||||
|
import android.content.Intent
|
||||||
import android.content.res.Resources
|
import android.content.res.Resources
|
||||||
import android.graphics.*
|
import android.graphics.*
|
||||||
import android.graphics.drawable.*
|
import android.graphics.drawable.BitmapDrawable
|
||||||
|
import android.graphics.drawable.Drawable
|
||||||
import android.os.Build
|
import android.os.Build
|
||||||
import android.text.TextUtils
|
import android.text.TextUtils
|
||||||
import android.widget.RemoteViews
|
import android.widget.RemoteViews
|
||||||
import androidx.core.content.ContextCompat
|
import androidx.core.content.ContextCompat
|
||||||
import code.name.monkey.retromusic.*
|
import code.name.monkey.retromusic.App
|
||||||
|
import code.name.monkey.retromusic.R
|
||||||
import code.name.monkey.retromusic.model.Song
|
import code.name.monkey.retromusic.model.Song
|
||||||
import code.name.monkey.retromusic.service.MusicService
|
import code.name.monkey.retromusic.service.MusicService
|
||||||
import code.name.monkey.retromusic.service.MusicService.*
|
import code.name.monkey.retromusic.service.MusicService.*
|
||||||
|
|
|
@ -14,19 +14,10 @@
|
||||||
|
|
||||||
package code.name.monkey.retromusic.dagger
|
package code.name.monkey.retromusic.dagger
|
||||||
|
|
||||||
import code.name.monkey.retromusic.activities.AlbumDetailsActivity
|
import code.name.monkey.retromusic.activities.*
|
||||||
import code.name.monkey.retromusic.activities.ArtistDetailActivity
|
|
||||||
import code.name.monkey.retromusic.activities.GenreDetailsActivity
|
|
||||||
import code.name.monkey.retromusic.activities.PlaylistDetailActivity
|
|
||||||
import code.name.monkey.retromusic.activities.SearchActivity
|
|
||||||
import code.name.monkey.retromusic.dagger.module.AppModule
|
import code.name.monkey.retromusic.dagger.module.AppModule
|
||||||
import code.name.monkey.retromusic.dagger.module.PresenterModule
|
import code.name.monkey.retromusic.dagger.module.PresenterModule
|
||||||
import code.name.monkey.retromusic.fragments.mainactivity.AlbumsFragment
|
import code.name.monkey.retromusic.fragments.mainactivity.*
|
||||||
import code.name.monkey.retromusic.fragments.mainactivity.ArtistsFragment
|
|
||||||
import code.name.monkey.retromusic.fragments.mainactivity.GenresFragment
|
|
||||||
import code.name.monkey.retromusic.fragments.mainactivity.PlaylistsFragment
|
|
||||||
import code.name.monkey.retromusic.fragments.mainactivity.SongsFragment
|
|
||||||
import code.name.monkey.retromusic.fragments.mainactivity.BannerHomeFragment
|
|
||||||
import dagger.Component
|
import dagger.Component
|
||||||
import javax.inject.Singleton
|
import javax.inject.Singleton
|
||||||
|
|
||||||
|
|
|
@ -15,27 +15,17 @@
|
||||||
package code.name.monkey.retromusic.dagger.module
|
package code.name.monkey.retromusic.dagger.module
|
||||||
|
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import code.name.monkey.retromusic.mvp.presenter.AlbumDetailsPresenter
|
import code.name.monkey.retromusic.mvp.presenter.*
|
||||||
import code.name.monkey.retromusic.mvp.presenter.AlbumDetailsPresenter.AlbumDetailsPresenterImpl
|
import code.name.monkey.retromusic.mvp.presenter.AlbumDetailsPresenter.AlbumDetailsPresenterImpl
|
||||||
import code.name.monkey.retromusic.mvp.presenter.AlbumsPresenter
|
|
||||||
import code.name.monkey.retromusic.mvp.presenter.AlbumsPresenter.AlbumsPresenterImpl
|
import code.name.monkey.retromusic.mvp.presenter.AlbumsPresenter.AlbumsPresenterImpl
|
||||||
import code.name.monkey.retromusic.mvp.presenter.ArtistDetailsPresenter
|
|
||||||
import code.name.monkey.retromusic.mvp.presenter.ArtistDetailsPresenter.ArtistDetailsPresenterImpl
|
import code.name.monkey.retromusic.mvp.presenter.ArtistDetailsPresenter.ArtistDetailsPresenterImpl
|
||||||
import code.name.monkey.retromusic.mvp.presenter.ArtistsPresenter
|
|
||||||
import code.name.monkey.retromusic.mvp.presenter.ArtistsPresenter.ArtistsPresenterImpl
|
import code.name.monkey.retromusic.mvp.presenter.ArtistsPresenter.ArtistsPresenterImpl
|
||||||
import code.name.monkey.retromusic.mvp.presenter.GenreDetailsPresenter
|
|
||||||
import code.name.monkey.retromusic.mvp.presenter.GenreDetailsPresenter.GenreDetailsPresenterImpl
|
import code.name.monkey.retromusic.mvp.presenter.GenreDetailsPresenter.GenreDetailsPresenterImpl
|
||||||
import code.name.monkey.retromusic.mvp.presenter.GenresPresenter
|
|
||||||
import code.name.monkey.retromusic.mvp.presenter.GenresPresenter.GenresPresenterImpl
|
import code.name.monkey.retromusic.mvp.presenter.GenresPresenter.GenresPresenterImpl
|
||||||
import code.name.monkey.retromusic.mvp.presenter.HomePresenter
|
|
||||||
import code.name.monkey.retromusic.mvp.presenter.HomePresenter.HomePresenterImpl
|
import code.name.monkey.retromusic.mvp.presenter.HomePresenter.HomePresenterImpl
|
||||||
import code.name.monkey.retromusic.mvp.presenter.PlaylistSongsPresenter
|
|
||||||
import code.name.monkey.retromusic.mvp.presenter.PlaylistSongsPresenter.PlaylistSongsPresenterImpl
|
import code.name.monkey.retromusic.mvp.presenter.PlaylistSongsPresenter.PlaylistSongsPresenterImpl
|
||||||
import code.name.monkey.retromusic.mvp.presenter.PlaylistsPresenter
|
|
||||||
import code.name.monkey.retromusic.mvp.presenter.PlaylistsPresenter.PlaylistsPresenterImpl
|
import code.name.monkey.retromusic.mvp.presenter.PlaylistsPresenter.PlaylistsPresenterImpl
|
||||||
import code.name.monkey.retromusic.mvp.presenter.SearchPresenter
|
|
||||||
import code.name.monkey.retromusic.mvp.presenter.SearchPresenter.SearchPresenterImpl
|
import code.name.monkey.retromusic.mvp.presenter.SearchPresenter.SearchPresenterImpl
|
||||||
import code.name.monkey.retromusic.mvp.presenter.SongPresenter
|
|
||||||
import code.name.monkey.retromusic.mvp.presenter.SongPresenter.SongPresenterImpl
|
import code.name.monkey.retromusic.mvp.presenter.SongPresenter.SongPresenterImpl
|
||||||
import code.name.monkey.retromusic.providers.RepositoryImpl
|
import code.name.monkey.retromusic.providers.RepositoryImpl
|
||||||
import code.name.monkey.retromusic.providers.interfaces.Repository
|
import code.name.monkey.retromusic.providers.interfaces.Repository
|
||||||
|
|
|
@ -11,7 +11,7 @@ import retrofit2.create
|
||||||
import retrofit2.http.GET
|
import retrofit2.http.GET
|
||||||
import retrofit2.http.Query
|
import retrofit2.http.Query
|
||||||
import java.io.File
|
import java.io.File
|
||||||
import java.util.Locale
|
import java.util.*
|
||||||
|
|
||||||
private const val BASE_QUERY_ARTIST = "search/artist"
|
private const val BASE_QUERY_ARTIST = "search/artist"
|
||||||
private const val BASE_URL = "https://api.deezer.com/"
|
private const val BASE_URL = "https://api.deezer.com/"
|
||||||
|
|
|
@ -51,7 +51,12 @@ class AddToPlaylistDialog : DialogFragment() {
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
dialog.dismiss()
|
dialog.dismiss()
|
||||||
PlaylistsUtil.addToPlaylist(requireContext(), songs, playlists[index - 1].id, true)
|
PlaylistsUtil.addToPlaylist(
|
||||||
|
requireContext(),
|
||||||
|
songs,
|
||||||
|
playlists[index - 1].id,
|
||||||
|
true
|
||||||
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -81,7 +81,11 @@ class BlacklistFolderChooserDialog : DialogFragment() {
|
||||||
override fun onCreateDialog(savedInstanceState: Bundle?): Dialog {
|
override fun onCreateDialog(savedInstanceState: Bundle?): Dialog {
|
||||||
var savedInstanceStateFinal = savedInstanceState
|
var savedInstanceStateFinal = savedInstanceState
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M &&
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M &&
|
||||||
ActivityCompat.checkSelfPermission(requireActivity(), Manifest.permission.READ_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED) {
|
ActivityCompat.checkSelfPermission(
|
||||||
|
requireActivity(),
|
||||||
|
Manifest.permission.READ_EXTERNAL_STORAGE
|
||||||
|
) != PackageManager.PERMISSION_GRANTED
|
||||||
|
) {
|
||||||
return MaterialDialog(requireActivity(), BottomSheet(LayoutMode.WRAP_CONTENT)).show {
|
return MaterialDialog(requireActivity(), BottomSheet(LayoutMode.WRAP_CONTENT)).show {
|
||||||
title(R.string.md_error_label)
|
title(R.string.md_error_label)
|
||||||
cornerRadius(PreferenceUtil.getInstance(requireContext()).dialogCorner)
|
cornerRadius(PreferenceUtil.getInstance(requireContext()).dialogCorner)
|
||||||
|
|
|
@ -57,7 +57,10 @@ class CreatePlaylistDialog : DialogFragment() {
|
||||||
?: return@positiveButton
|
?: return@positiveButton
|
||||||
|
|
||||||
if (playlistView.text.toString().trim { it <= ' ' }.isNotEmpty()) {
|
if (playlistView.text.toString().trim { it <= ' ' }.isNotEmpty()) {
|
||||||
val playlistId = PlaylistsUtil.createPlaylist(requireContext(), playlistView.text.toString())
|
val playlistId = PlaylistsUtil.createPlaylist(
|
||||||
|
requireContext(),
|
||||||
|
playlistView.text.toString()
|
||||||
|
)
|
||||||
if (playlistId != -1 && activity != null) {
|
if (playlistId != -1 && activity != null) {
|
||||||
PlaylistsUtil.addToPlaylist(requireContext(), songs, playlistId, true)
|
PlaylistsUtil.addToPlaylist(requireContext(), songs, playlistId, true)
|
||||||
}
|
}
|
||||||
|
@ -73,7 +76,10 @@ class CreatePlaylistDialog : DialogFragment() {
|
||||||
|
|
||||||
val playlistId = arguments!!.getLong(MediaStore.Audio.Playlists.Members.PLAYLIST_ID)
|
val playlistId = arguments!!.getLong(MediaStore.Audio.Playlists.Members.PLAYLIST_ID)
|
||||||
playlistView.appHandleColor()
|
playlistView.appHandleColor()
|
||||||
.setText(PlaylistsUtil.getNameForPlaylist(requireContext(), playlistId), TextView.BufferType.EDITABLE)
|
.setText(
|
||||||
|
PlaylistsUtil.getNameForPlaylist(requireContext(), playlistId),
|
||||||
|
TextView.BufferType.EDITABLE
|
||||||
|
)
|
||||||
return materialDialog
|
return materialDialog
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -26,7 +26,7 @@ import code.name.monkey.retromusic.util.PreferenceUtil
|
||||||
import com.afollestad.materialdialogs.LayoutMode
|
import com.afollestad.materialdialogs.LayoutMode
|
||||||
import com.afollestad.materialdialogs.MaterialDialog
|
import com.afollestad.materialdialogs.MaterialDialog
|
||||||
import com.afollestad.materialdialogs.bottomsheets.BottomSheet
|
import com.afollestad.materialdialogs.bottomsheets.BottomSheet
|
||||||
import java.util.ArrayList
|
import java.util.*
|
||||||
|
|
||||||
class DeletePlaylistDialog : DialogFragment() {
|
class DeletePlaylistDialog : DialogFragment() {
|
||||||
|
|
||||||
|
|
|
@ -21,54 +21,29 @@ import android.content.Intent;
|
||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
import androidx.annotation.Nullable;
|
import androidx.annotation.Nullable;
|
||||||
import androidx.fragment.app.FragmentActivity;
|
import androidx.fragment.app.FragmentActivity;
|
||||||
|
|
||||||
|
import com.google.android.material.dialog.MaterialAlertDialogBuilder;
|
||||||
|
|
||||||
|
import java.lang.ref.WeakReference;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
import code.name.monkey.retromusic.R;
|
import code.name.monkey.retromusic.R;
|
||||||
import code.name.monkey.retromusic.activities.saf.SAFGuideActivity;
|
import code.name.monkey.retromusic.activities.saf.SAFGuideActivity;
|
||||||
import code.name.monkey.retromusic.misc.DialogAsyncTask;
|
import code.name.monkey.retromusic.misc.DialogAsyncTask;
|
||||||
import code.name.monkey.retromusic.model.Song;
|
import code.name.monkey.retromusic.model.Song;
|
||||||
import code.name.monkey.retromusic.util.SAFUtil;
|
import code.name.monkey.retromusic.util.SAFUtil;
|
||||||
import com.google.android.material.dialog.MaterialAlertDialogBuilder;
|
|
||||||
import java.lang.ref.WeakReference;
|
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by hemanths on 2019-07-31.
|
* Created by hemanths on 2019-07-31.
|
||||||
*/
|
*/
|
||||||
public class DeleteSongsAsyncTask extends DialogAsyncTask<DeleteSongsAsyncTask.LoadingInfo, Integer, Void> {
|
public class DeleteSongsAsyncTask extends DialogAsyncTask<DeleteSongsAsyncTask.LoadingInfo, Integer, Void> {
|
||||||
|
|
||||||
public static class LoadingInfo {
|
|
||||||
|
|
||||||
public Intent intent;
|
|
||||||
|
|
||||||
public boolean isIntent;
|
|
||||||
|
|
||||||
public int requestCode;
|
|
||||||
|
|
||||||
public int resultCode;
|
|
||||||
|
|
||||||
public List<Uri> safUris;
|
|
||||||
|
|
||||||
public List<Song> songs;
|
|
||||||
|
|
||||||
public LoadingInfo(List<Song> songs, List<Uri> safUris) {
|
|
||||||
this.isIntent = false;
|
|
||||||
this.songs = songs;
|
|
||||||
this.safUris = safUris;
|
|
||||||
}
|
|
||||||
|
|
||||||
public LoadingInfo(int requestCode, int resultCode, Intent intent) {
|
|
||||||
this.isIntent = true;
|
|
||||||
this.requestCode = requestCode;
|
|
||||||
this.resultCode = resultCode;
|
|
||||||
this.intent = intent;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private WeakReference<FragmentActivity> activityWeakReference;
|
private WeakReference<FragmentActivity> activityWeakReference;
|
||||||
|
|
||||||
private WeakReference<DeleteSongsDialog> dialogReference;
|
private WeakReference<DeleteSongsDialog> dialogReference;
|
||||||
|
|
||||||
public DeleteSongsAsyncTask(@NonNull DeleteSongsDialog dialog) {
|
public DeleteSongsAsyncTask(@NonNull DeleteSongsDialog dialog) {
|
||||||
|
@ -138,4 +113,32 @@ public class DeleteSongsAsyncTask extends DialogAsyncTask<DeleteSongsAsyncTask.L
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static class LoadingInfo {
|
||||||
|
|
||||||
|
public Intent intent;
|
||||||
|
|
||||||
|
public boolean isIntent;
|
||||||
|
|
||||||
|
public int requestCode;
|
||||||
|
|
||||||
|
public int resultCode;
|
||||||
|
|
||||||
|
public List<Uri> safUris;
|
||||||
|
|
||||||
|
public List<Song> songs;
|
||||||
|
|
||||||
|
public LoadingInfo(List<Song> songs, List<Uri> safUris) {
|
||||||
|
this.isIntent = false;
|
||||||
|
this.songs = songs;
|
||||||
|
this.safUris = safUris;
|
||||||
|
}
|
||||||
|
|
||||||
|
public LoadingInfo(int requestCode, int resultCode, Intent intent) {
|
||||||
|
this.isIntent = true;
|
||||||
|
this.requestCode = requestCode;
|
||||||
|
this.resultCode = resultCode;
|
||||||
|
this.intent = intent;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -87,7 +87,13 @@ class DeleteSongsDialog : DialogFragment() {
|
||||||
deleteSongsAsyncTask?.cancel(true)
|
deleteSongsAsyncTask?.cancel(true)
|
||||||
}
|
}
|
||||||
deleteSongsAsyncTask = DeleteSongsAsyncTask(this)
|
deleteSongsAsyncTask = DeleteSongsAsyncTask(this)
|
||||||
deleteSongsAsyncTask?.execute(DeleteSongsAsyncTask.LoadingInfo(requestCode, resultCode, data))
|
deleteSongsAsyncTask?.execute(
|
||||||
|
DeleteSongsAsyncTask.LoadingInfo(
|
||||||
|
requestCode,
|
||||||
|
resultCode,
|
||||||
|
data
|
||||||
|
)
|
||||||
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -74,7 +74,11 @@ class OptionsSheetDialogFragment : DialogFragment(), View.OnClickListener {
|
||||||
return materialDialog
|
return materialDialog
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {
|
override fun onCreateView(
|
||||||
|
inflater: LayoutInflater,
|
||||||
|
container: ViewGroup?,
|
||||||
|
savedInstanceState: Bundle?
|
||||||
|
): View? {
|
||||||
dialog?.window?.let {
|
dialog?.window?.let {
|
||||||
(requireActivity() as MainActivity).setNavigationbarColorAuto()
|
(requireActivity() as MainActivity).setNavigationbarColorAuto()
|
||||||
(requireActivity() as MainActivity).setLightNavigationBar(true)
|
(requireActivity() as MainActivity).setLightNavigationBar(true)
|
||||||
|
|
|
@ -48,7 +48,11 @@ class RenamePlaylistDialog : DialogFragment() {
|
||||||
positiveButton(string.action_rename) {
|
positiveButton(string.action_rename) {
|
||||||
if (playlistView.toString().trim { it <= ' ' } != "") {
|
if (playlistView.toString().trim { it <= ' ' } != "") {
|
||||||
val playlistId = arguments!!.getLong(PLAYLIST_ID)
|
val playlistId = arguments!!.getLong(PLAYLIST_ID)
|
||||||
PlaylistsUtil.renamePlaylist(context, playlistId, playlistView.text!!.toString())
|
PlaylistsUtil.renamePlaylist(
|
||||||
|
context,
|
||||||
|
playlistId,
|
||||||
|
playlistView.text!!.toString()
|
||||||
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -61,7 +65,10 @@ class RenamePlaylistDialog : DialogFragment() {
|
||||||
|
|
||||||
val playlistId = arguments!!.getLong(PLAYLIST_ID)
|
val playlistId = arguments!!.getLong(PLAYLIST_ID)
|
||||||
playlistView.appHandleColor()
|
playlistView.appHandleColor()
|
||||||
.setText(PlaylistsUtil.getNameForPlaylist(context!!, playlistId), TextView.BufferType.EDITABLE)
|
.setText(
|
||||||
|
PlaylistsUtil.getNameForPlaylist(context!!, playlistId),
|
||||||
|
TextView.BufferType.EDITABLE
|
||||||
|
)
|
||||||
return materialDialog
|
return materialDialog
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -62,7 +62,8 @@ class SleepTimerDialog : DialogFragment() {
|
||||||
.title(R.string.action_sleep_timer)
|
.title(R.string.action_sleep_timer)
|
||||||
.cornerRadius(PreferenceUtil.getInstance(requireContext()).dialogCorner)
|
.cornerRadius(PreferenceUtil.getInstance(requireContext()).dialogCorner)
|
||||||
.positiveButton(R.string.action_set) {
|
.positiveButton(R.string.action_set) {
|
||||||
PreferenceUtil.getInstance(requireContext()).sleepTimerFinishMusic = shouldFinishLastSong.isChecked
|
PreferenceUtil.getInstance(requireContext()).sleepTimerFinishMusic =
|
||||||
|
shouldFinishLastSong.isChecked
|
||||||
|
|
||||||
val minutes = seekArcProgress
|
val minutes = seekArcProgress
|
||||||
|
|
||||||
|
@ -119,10 +120,15 @@ class SleepTimerDialog : DialogFragment() {
|
||||||
return materialDialog
|
return materialDialog
|
||||||
}
|
}
|
||||||
|
|
||||||
shouldFinishLastSong = materialDialog.getCustomView().findViewById(R.id.shouldFinishLastSong)
|
shouldFinishLastSong =
|
||||||
|
materialDialog.getCustomView().findViewById(R.id.shouldFinishLastSong)
|
||||||
seekBar = materialDialog.getCustomView().findViewById(R.id.seekBar)
|
seekBar = materialDialog.getCustomView().findViewById(R.id.seekBar)
|
||||||
timerDisplay = materialDialog.getCustomView().findViewById(R.id.timerDisplay)
|
timerDisplay = materialDialog.getCustomView().findViewById(R.id.timerDisplay)
|
||||||
TintHelper.setTintAuto(shouldFinishLastSong, ThemeStore.accentColor(requireContext()), false)
|
TintHelper.setTintAuto(
|
||||||
|
shouldFinishLastSong,
|
||||||
|
ThemeStore.accentColor(requireContext()),
|
||||||
|
false
|
||||||
|
)
|
||||||
|
|
||||||
val finishMusic = PreferenceUtil.getInstance(requireContext()).sleepTimerFinishMusic
|
val finishMusic = PreferenceUtil.getInstance(requireContext()).sleepTimerFinishMusic
|
||||||
shouldFinishLastSong.isChecked = finishMusic
|
shouldFinishLastSong.isChecked = finishMusic
|
||||||
|
|
|
@ -86,22 +86,36 @@ class SongDetailDialog : DialogFragment() {
|
||||||
val songFile = File(song.data)
|
val songFile = File(song.data)
|
||||||
if (songFile.exists()) {
|
if (songFile.exists()) {
|
||||||
fileName.text = makeTextWithTitle(context, string.label_file_name, songFile.name)
|
fileName.text = makeTextWithTitle(context, string.label_file_name, songFile.name)
|
||||||
filePath.text = makeTextWithTitle(context, string.label_file_path, songFile.absolutePath)
|
filePath.text =
|
||||||
|
makeTextWithTitle(context, string.label_file_path, songFile.absolutePath)
|
||||||
fileSize.text =
|
fileSize.text =
|
||||||
makeTextWithTitle(context, string.label_file_size, getFileSizeString(songFile.length()))
|
makeTextWithTitle(
|
||||||
|
context,
|
||||||
|
string.label_file_size,
|
||||||
|
getFileSizeString(songFile.length())
|
||||||
|
)
|
||||||
try {
|
try {
|
||||||
val audioFile = AudioFileIO.read(songFile)
|
val audioFile = AudioFileIO.read(songFile)
|
||||||
val audioHeader = audioFile.audioHeader
|
val audioHeader = audioFile.audioHeader
|
||||||
|
|
||||||
fileFormat.text = makeTextWithTitle(context, string.label_file_format, audioHeader.format)
|
fileFormat.text =
|
||||||
|
makeTextWithTitle(context, string.label_file_format, audioHeader.format)
|
||||||
trackLength.text = makeTextWithTitle(
|
trackLength.text = makeTextWithTitle(
|
||||||
context,
|
context,
|
||||||
string.label_track_length,
|
string.label_track_length,
|
||||||
MusicUtil.getReadableDurationString((audioHeader.trackLength * 1000).toLong())
|
MusicUtil.getReadableDurationString((audioHeader.trackLength * 1000).toLong())
|
||||||
)
|
)
|
||||||
bitRate.text = makeTextWithTitle(context, string.label_bit_rate, audioHeader.bitRate + " kb/s")
|
bitRate.text = makeTextWithTitle(
|
||||||
|
context,
|
||||||
|
string.label_bit_rate,
|
||||||
|
audioHeader.bitRate + " kb/s"
|
||||||
|
)
|
||||||
samplingRate.text =
|
samplingRate.text =
|
||||||
makeTextWithTitle(context, string.label_sampling_rate, audioHeader.sampleRate + " Hz")
|
makeTextWithTitle(
|
||||||
|
context,
|
||||||
|
string.label_sampling_rate,
|
||||||
|
audioHeader.sampleRate + " Hz"
|
||||||
|
)
|
||||||
} catch (@NonNull e: CannotReadException) {
|
} catch (@NonNull e: CannotReadException) {
|
||||||
Log.e(TAG, "error while reading the song file", e)
|
Log.e(TAG, "error while reading the song file", e)
|
||||||
// fallback
|
// fallback
|
||||||
|
|
|
@ -68,7 +68,10 @@ class SongShareDialog : DialogFragment() {
|
||||||
2 -> {
|
2 -> {
|
||||||
if (song != null) {
|
if (song != null) {
|
||||||
startActivity(
|
startActivity(
|
||||||
Intent(requireContext(), ShareInstagramStory::class.java).putExtra(
|
Intent(
|
||||||
|
requireContext(),
|
||||||
|
ShareInstagramStory::class.java
|
||||||
|
).putExtra(
|
||||||
ShareInstagramStory.EXTRA_SONG,
|
ShareInstagramStory.EXTRA_SONG,
|
||||||
song
|
song
|
||||||
)
|
)
|
||||||
|
|
|
@ -5,10 +5,12 @@ import androidx.annotation.StringRes
|
||||||
import code.name.monkey.retromusic.R
|
import code.name.monkey.retromusic.R
|
||||||
|
|
||||||
|
|
||||||
enum class AlbumCoverStyle(@param:StringRes @field:StringRes
|
enum class AlbumCoverStyle(
|
||||||
|
@param:StringRes @field:StringRes
|
||||||
val titleRes: Int,
|
val titleRes: Int,
|
||||||
@param:DrawableRes @field:DrawableRes
|
@param:DrawableRes @field:DrawableRes
|
||||||
val drawableResId: Int, val id: Int) {
|
val drawableResId: Int, val id: Int
|
||||||
|
) {
|
||||||
NORMAL(R.string.normal, R.drawable.np_normal, 0),
|
NORMAL(R.string.normal, R.drawable.np_normal, 0),
|
||||||
FLAT(R.string.flat, R.drawable.np_flat, 1),
|
FLAT(R.string.flat, R.drawable.np_flat, 1),
|
||||||
CIRCLE(R.string.circular, R.drawable.np_circle, 2),
|
CIRCLE(R.string.circular, R.drawable.np_circle, 2),
|
||||||
|
|
|
@ -7,11 +7,7 @@ import android.os.Bundle
|
||||||
import android.text.SpannableString
|
import android.text.SpannableString
|
||||||
import android.text.SpannableStringBuilder
|
import android.text.SpannableStringBuilder
|
||||||
import android.text.style.ForegroundColorSpan
|
import android.text.style.ForegroundColorSpan
|
||||||
import android.view.GestureDetector
|
import android.view.*
|
||||||
import android.view.LayoutInflater
|
|
||||||
import android.view.MotionEvent
|
|
||||||
import android.view.View
|
|
||||||
import android.view.ViewGroup
|
|
||||||
import android.view.animation.DecelerateInterpolator
|
import android.view.animation.DecelerateInterpolator
|
||||||
import code.name.monkey.appthemehelper.ThemeStore
|
import code.name.monkey.appthemehelper.ThemeStore
|
||||||
import code.name.monkey.retromusic.R
|
import code.name.monkey.retromusic.R
|
||||||
|
@ -24,11 +20,7 @@ import code.name.monkey.retromusic.helper.PlayPauseButtonOnClickHandler
|
||||||
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 code.name.monkey.retromusic.util.ViewUtil
|
import code.name.monkey.retromusic.util.ViewUtil
|
||||||
import kotlinx.android.synthetic.main.fragment_mini_player.actionNext
|
import kotlinx.android.synthetic.main.fragment_mini_player.*
|
||||||
import kotlinx.android.synthetic.main.fragment_mini_player.actionPrevious
|
|
||||||
import kotlinx.android.synthetic.main.fragment_mini_player.miniPlayerPlayPauseButton
|
|
||||||
import kotlinx.android.synthetic.main.fragment_mini_player.miniPlayerTitle
|
|
||||||
import kotlinx.android.synthetic.main.fragment_mini_player.progressBar
|
|
||||||
import kotlin.math.abs
|
import kotlin.math.abs
|
||||||
|
|
||||||
open class MiniPlayerFragment : AbsMusicServiceFragment(), MusicProgressViewUpdateHelper.Callback,
|
open class MiniPlayerFragment : AbsMusicServiceFragment(), MusicProgressViewUpdateHelper.Callback,
|
||||||
|
@ -41,7 +33,11 @@ open class MiniPlayerFragment : AbsMusicServiceFragment(), MusicProgressViewUpda
|
||||||
progressViewUpdateHelper = MusicProgressViewUpdateHelper(this)
|
progressViewUpdateHelper = MusicProgressViewUpdateHelper(this)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {
|
override fun onCreateView(
|
||||||
|
inflater: LayoutInflater,
|
||||||
|
container: ViewGroup?,
|
||||||
|
savedInstanceState: Bundle?
|
||||||
|
): View? {
|
||||||
return inflater.inflate(R.layout.fragment_mini_player, container, false)
|
return inflater.inflate(R.layout.fragment_mini_player, container, false)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -11,6 +11,7 @@ import android.view.ViewGroup
|
||||||
import androidx.fragment.app.Fragment
|
import androidx.fragment.app.Fragment
|
||||||
import code.name.monkey.appthemehelper.ThemeStore
|
import code.name.monkey.appthemehelper.ThemeStore
|
||||||
import code.name.monkey.retromusic.R
|
import code.name.monkey.retromusic.R
|
||||||
|
import code.name.monkey.retromusic.extensions.setRange
|
||||||
import code.name.monkey.retromusic.helper.MusicPlayerRemote
|
import code.name.monkey.retromusic.helper.MusicPlayerRemote
|
||||||
import code.name.monkey.retromusic.util.PreferenceUtil
|
import code.name.monkey.retromusic.util.PreferenceUtil
|
||||||
import code.name.monkey.retromusic.util.ViewUtil
|
import code.name.monkey.retromusic.util.ViewUtil
|
||||||
|
@ -18,9 +19,7 @@ import code.name.monkey.retromusic.volume.AudioVolumeObserver
|
||||||
import code.name.monkey.retromusic.volume.OnAudioVolumeChangedListener
|
import code.name.monkey.retromusic.volume.OnAudioVolumeChangedListener
|
||||||
import com.google.android.material.slider.Slider
|
import com.google.android.material.slider.Slider
|
||||||
import com.google.android.material.slider.Slider.OnChangeListener
|
import com.google.android.material.slider.Slider.OnChangeListener
|
||||||
import kotlinx.android.synthetic.main.fragment_volume.volumeDown
|
import kotlinx.android.synthetic.main.fragment_volume.*
|
||||||
import kotlinx.android.synthetic.main.fragment_volume.volumeSeekBar
|
|
||||||
import kotlinx.android.synthetic.main.fragment_volume.volumeUp
|
|
||||||
|
|
||||||
class VolumeFragment : Fragment(), OnAudioVolumeChangedListener,
|
class VolumeFragment : Fragment(), OnAudioVolumeChangedListener,
|
||||||
View.OnClickListener, OnChangeListener {
|
View.OnClickListener, OnChangeListener {
|
||||||
|
@ -52,7 +51,8 @@ class VolumeFragment : Fragment(), OnAudioVolumeChangedListener,
|
||||||
|
|
||||||
val audioManager = audioManager
|
val audioManager = audioManager
|
||||||
if (audioManager != null) {
|
if (audioManager != null) {
|
||||||
volumeSeekBar.valueTo = audioManager.getStreamMaxVolume(AudioManager.STREAM_MUSIC).toFloat()
|
volumeSeekBar.valueTo =
|
||||||
|
audioManager.getStreamMaxVolume(AudioManager.STREAM_MUSIC).toFloat()
|
||||||
volumeSeekBar.value = audioManager.getStreamVolume(AudioManager.STREAM_MUSIC).toFloat()
|
volumeSeekBar.value = audioManager.getStreamVolume(AudioManager.STREAM_MUSIC).toFloat()
|
||||||
}
|
}
|
||||||
volumeSeekBar.addOnChangeListener(this)
|
volumeSeekBar.addOnChangeListener(this)
|
||||||
|
@ -62,11 +62,10 @@ class VolumeFragment : Fragment(), OnAudioVolumeChangedListener,
|
||||||
if (volumeSeekBar == null) {
|
if (volumeSeekBar == null) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if (maxVolume <= 0) {
|
if (maxVolume <= 0.0f) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
volumeSeekBar.valueTo = maxVolume
|
volumeSeekBar.setRange(currentVolume, maxVolume)
|
||||||
volumeSeekBar.valueFrom = currentVolume
|
|
||||||
volumeDown.setImageResource(if (currentVolume == 0.0f) R.drawable.ic_volume_off_white_24dp else R.drawable.ic_volume_down_white_24dp)
|
volumeDown.setImageResource(if (currentVolume == 0.0f) R.drawable.ic_volume_off_white_24dp else R.drawable.ic_volume_down_white_24dp)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -110,7 +109,6 @@ class VolumeFragment : Fragment(), OnAudioVolumeChangedListener,
|
||||||
fun setTintableColor(color: Int) {
|
fun setTintableColor(color: Int) {
|
||||||
volumeDown.setColorFilter(color, PorterDuff.Mode.SRC_IN)
|
volumeDown.setColorFilter(color, PorterDuff.Mode.SRC_IN)
|
||||||
volumeUp.setColorFilter(color, PorterDuff.Mode.SRC_IN)
|
volumeUp.setColorFilter(color, PorterDuff.Mode.SRC_IN)
|
||||||
//TintHelper.setTint(volumeSeekBar, color, false)
|
|
||||||
ViewUtil.setProgressDrawable(volumeSeekBar, color, true)
|
ViewUtil.setProgressDrawable(volumeSeekBar, color, true)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -13,7 +13,7 @@ import code.name.monkey.retromusic.util.RetroUtil
|
||||||
import org.jaudiotagger.audio.AudioFileIO
|
import org.jaudiotagger.audio.AudioFileIO
|
||||||
import java.io.File
|
import java.io.File
|
||||||
import java.net.URLEncoder
|
import java.net.URLEncoder
|
||||||
import java.util.Locale
|
import java.util.*
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by hemanths on 18/08/17.
|
* Created by hemanths on 18/08/17.
|
||||||
|
@ -81,7 +81,8 @@ open class AbsMusicServiceFragment : Fragment(), MusicServiceEventListener {
|
||||||
val uriFile = Uri.fromFile(file)
|
val uriFile = Uri.fromFile(file)
|
||||||
string.append(getMimeType(uriFile.toString())).append(" • ")
|
string.append(getMimeType(uriFile.toString())).append(" • ")
|
||||||
string.append(audioHeader.bitRate).append(" kb/s").append(" • ")
|
string.append(audioHeader.bitRate).append(" kb/s").append(" • ")
|
||||||
string.append(RetroUtil.frequencyCount(audioHeader.sampleRate.toInt())).append(" kHz")
|
string.append(RetroUtil.frequencyCount(audioHeader.sampleRate.toInt()))
|
||||||
|
.append(" kHz")
|
||||||
string.toString()
|
string.toString()
|
||||||
} catch (er: Exception) {
|
} catch (er: Exception) {
|
||||||
" - "
|
" - "
|
||||||
|
|
|
@ -13,7 +13,8 @@ import code.name.monkey.retromusic.util.PreferenceUtil
|
||||||
* Created by hemanths on 24/09/17.
|
* Created by hemanths on 24/09/17.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
abstract class AbsPlayerControlsFragment : AbsMusicServiceFragment(), MusicProgressViewUpdateHelper.Callback {
|
abstract class AbsPlayerControlsFragment : AbsMusicServiceFragment(),
|
||||||
|
MusicProgressViewUpdateHelper.Callback {
|
||||||
|
|
||||||
protected abstract fun show()
|
protected abstract fun show()
|
||||||
|
|
||||||
|
@ -61,9 +62,11 @@ abstract class AbsPlayerControlsFragment : AbsMusicServiceFragment(), MusicProgr
|
||||||
|
|
||||||
private fun hideVolumeIfAvailable() {
|
private fun hideVolumeIfAvailable() {
|
||||||
if (PreferenceUtil.getInstance(requireContext()).volumeToggle) {
|
if (PreferenceUtil.getInstance(requireContext()).volumeToggle) {
|
||||||
childFragmentManager.beginTransaction().replace(R.id.volumeFragmentContainer, VolumeFragment()).commit()
|
childFragmentManager.beginTransaction()
|
||||||
|
.replace(R.id.volumeFragmentContainer, VolumeFragment()).commit()
|
||||||
childFragmentManager.executePendingTransactions()
|
childFragmentManager.executePendingTransactions()
|
||||||
volumeFragment = childFragmentManager.findFragmentById(R.id.volumeFragmentContainer) as VolumeFragment?
|
volumeFragment =
|
||||||
|
childFragmentManager.findFragmentById(R.id.volumeFragmentContainer) as VolumeFragment?
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -18,25 +18,15 @@ import code.name.monkey.appthemehelper.util.ATHUtil
|
||||||
import code.name.monkey.retromusic.R
|
import code.name.monkey.retromusic.R
|
||||||
import code.name.monkey.retromusic.activities.tageditor.AbsTagEditorActivity
|
import code.name.monkey.retromusic.activities.tageditor.AbsTagEditorActivity
|
||||||
import code.name.monkey.retromusic.activities.tageditor.SongTagEditorActivity
|
import code.name.monkey.retromusic.activities.tageditor.SongTagEditorActivity
|
||||||
import code.name.monkey.retromusic.dialogs.AddToPlaylistDialog
|
import code.name.monkey.retromusic.dialogs.*
|
||||||
import code.name.monkey.retromusic.dialogs.CreatePlaylistDialog
|
|
||||||
import code.name.monkey.retromusic.dialogs.DeleteSongsDialog
|
|
||||||
import code.name.monkey.retromusic.dialogs.SleepTimerDialog
|
|
||||||
import code.name.monkey.retromusic.dialogs.SongDetailDialog
|
|
||||||
import code.name.monkey.retromusic.dialogs.SongShareDialog
|
|
||||||
import code.name.monkey.retromusic.extensions.hide
|
import code.name.monkey.retromusic.extensions.hide
|
||||||
import code.name.monkey.retromusic.fragments.player.PlayerAlbumCoverFragment
|
import code.name.monkey.retromusic.fragments.player.PlayerAlbumCoverFragment
|
||||||
import code.name.monkey.retromusic.helper.MusicPlayerRemote
|
import code.name.monkey.retromusic.helper.MusicPlayerRemote
|
||||||
import code.name.monkey.retromusic.interfaces.PaletteColorHolder
|
import code.name.monkey.retromusic.interfaces.PaletteColorHolder
|
||||||
import code.name.monkey.retromusic.model.Song
|
import code.name.monkey.retromusic.model.Song
|
||||||
import code.name.monkey.retromusic.model.lyrics.Lyrics
|
import code.name.monkey.retromusic.model.lyrics.Lyrics
|
||||||
import code.name.monkey.retromusic.util.LyricUtil
|
import code.name.monkey.retromusic.util.*
|
||||||
import code.name.monkey.retromusic.util.MusicUtil
|
import kotlinx.android.synthetic.main.shadow_statusbar_toolbar.*
|
||||||
import code.name.monkey.retromusic.util.NavigationUtil
|
|
||||||
import code.name.monkey.retromusic.util.PreferenceUtil
|
|
||||||
import code.name.monkey.retromusic.util.RetroUtil
|
|
||||||
import code.name.monkey.retromusic.util.RingtoneManager
|
|
||||||
import kotlinx.android.synthetic.main.shadow_statusbar_toolbar.statusBarShadow
|
|
||||||
import java.io.FileNotFoundException
|
import java.io.FileNotFoundException
|
||||||
|
|
||||||
abstract class AbsPlayerFragment : AbsMusicServiceFragment(),
|
abstract class AbsPlayerFragment : AbsMusicServiceFragment(),
|
||||||
|
@ -141,9 +131,13 @@ abstract class AbsPlayerFragment : AbsMusicServiceFragment(),
|
||||||
R.id.action_go_to_genre -> {
|
R.id.action_go_to_genre -> {
|
||||||
val retriever = MediaMetadataRetriever()
|
val retriever = MediaMetadataRetriever()
|
||||||
val trackUri =
|
val trackUri =
|
||||||
ContentUris.withAppendedId(MediaStore.Audio.Media.EXTERNAL_CONTENT_URI, song.id.toLong())
|
ContentUris.withAppendedId(
|
||||||
|
MediaStore.Audio.Media.EXTERNAL_CONTENT_URI,
|
||||||
|
song.id.toLong()
|
||||||
|
)
|
||||||
retriever.setDataSource(activity, trackUri)
|
retriever.setDataSource(activity, trackUri)
|
||||||
var genre: String? = retriever.extractMetadata(MediaMetadataRetriever.METADATA_KEY_GENRE)
|
var genre: String? =
|
||||||
|
retriever.extractMetadata(MediaMetadataRetriever.METADATA_KEY_GENRE)
|
||||||
if (genre == null) {
|
if (genre == null) {
|
||||||
genre = "Not Specified"
|
genre = "Not Specified"
|
||||||
}
|
}
|
||||||
|
@ -204,10 +198,14 @@ abstract class AbsPlayerFragment : AbsMusicServiceFragment(),
|
||||||
else
|
else
|
||||||
R.drawable.ic_favorite_border_white_24dp
|
R.drawable.ic_favorite_border_white_24dp
|
||||||
|
|
||||||
val drawable = RetroUtil.getTintedVectorDrawable(requireContext(), res, toolbarIconColor())
|
val drawable =
|
||||||
|
RetroUtil.getTintedVectorDrawable(requireContext(), res, toolbarIconColor())
|
||||||
if (playerToolbar() != null && playerToolbar()!!.menu.findItem(R.id.action_toggle_favorite) != null)
|
if (playerToolbar() != null && playerToolbar()!!.menu.findItem(R.id.action_toggle_favorite) != null)
|
||||||
playerToolbar()!!.menu.findItem(R.id.action_toggle_favorite).setIcon(drawable).title =
|
playerToolbar()!!.menu.findItem(R.id.action_toggle_favorite).setIcon(drawable)
|
||||||
if (isFavorite) getString(R.string.action_remove_from_favorites) else getString(R.string.action_add_to_favorites)
|
.title =
|
||||||
|
if (isFavorite) getString(R.string.action_remove_from_favorites) else getString(
|
||||||
|
R.string.action_add_to_favorites
|
||||||
|
)
|
||||||
}
|
}
|
||||||
}.execute(MusicPlayerRemote.currentSong)
|
}.execute(MusicPlayerRemote.currentSong)
|
||||||
}
|
}
|
||||||
|
@ -224,7 +222,8 @@ abstract class AbsPlayerFragment : AbsMusicServiceFragment(),
|
||||||
|
|
||||||
override fun doInBackground(vararg params: Song): Lyrics? {
|
override fun doInBackground(vararg params: Song): Lyrics? {
|
||||||
try {
|
try {
|
||||||
var data: String? = LyricUtil.getStringFromFile(params[0].title, params[0].artistName)
|
var data: String? =
|
||||||
|
LyricUtil.getStringFromFile(params[0].title, params[0].artistName)
|
||||||
return if (TextUtils.isEmpty(data)) {
|
return if (TextUtils.isEmpty(data)) {
|
||||||
data = MusicUtil.getLyrics(params[0])
|
data = MusicUtil.getLyrics(params[0])
|
||||||
return if (TextUtils.isEmpty(data)) {
|
return if (TextUtils.isEmpty(data)) {
|
||||||
|
|
|
@ -14,7 +14,8 @@ import code.name.monkey.retromusic.mvp.presenter.AlbumsView
|
||||||
import code.name.monkey.retromusic.util.PreferenceUtil
|
import code.name.monkey.retromusic.util.PreferenceUtil
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
|
|
||||||
class AlbumsFragment : AbsLibraryPagerRecyclerViewCustomGridSizeFragment<AlbumAdapter, GridLayoutManager>(),
|
class AlbumsFragment :
|
||||||
|
AbsLibraryPagerRecyclerViewCustomGridSizeFragment<AlbumAdapter, GridLayoutManager>(),
|
||||||
AlbumsView, MainActivityFragmentCallbacks {
|
AlbumsView, MainActivityFragmentCallbacks {
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
|
@ -118,6 +119,7 @@ class AlbumsFragment : AbsLibraryPagerRecyclerViewCustomGridSizeFragment<AlbumAd
|
||||||
companion object {
|
companion object {
|
||||||
@JvmField
|
@JvmField
|
||||||
var TAG: String = AlbumsFragment::class.java.simpleName
|
var TAG: String = AlbumsFragment::class.java.simpleName
|
||||||
|
|
||||||
@JvmStatic
|
@JvmStatic
|
||||||
fun newInstance(): AlbumsFragment {
|
fun newInstance(): AlbumsFragment {
|
||||||
val args = Bundle()
|
val args = Bundle()
|
||||||
|
|
|
@ -14,7 +14,8 @@ import code.name.monkey.retromusic.mvp.presenter.ArtistsView
|
||||||
import code.name.monkey.retromusic.util.PreferenceUtil
|
import code.name.monkey.retromusic.util.PreferenceUtil
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
|
|
||||||
class ArtistsFragment : AbsLibraryPagerRecyclerViewCustomGridSizeFragment<ArtistAdapter, GridLayoutManager>(),
|
class ArtistsFragment :
|
||||||
|
AbsLibraryPagerRecyclerViewCustomGridSizeFragment<ArtistAdapter, GridLayoutManager>(),
|
||||||
ArtistsView, MainActivityFragmentCallbacks {
|
ArtistsView, MainActivityFragmentCallbacks {
|
||||||
|
|
||||||
override fun handleBackPress(): Boolean {
|
override fun handleBackPress(): Boolean {
|
||||||
|
@ -111,6 +112,7 @@ class ArtistsFragment : AbsLibraryPagerRecyclerViewCustomGridSizeFragment<Artist
|
||||||
companion object {
|
companion object {
|
||||||
@JvmField
|
@JvmField
|
||||||
val TAG: String = ArtistsFragment::class.java.simpleName
|
val TAG: String = ArtistsFragment::class.java.simpleName
|
||||||
|
|
||||||
@JvmStatic
|
@JvmStatic
|
||||||
fun newInstance(): ArtistsFragment {
|
fun newInstance(): ArtistsFragment {
|
||||||
val args = Bundle()
|
val args = Bundle()
|
||||||
|
|
|
@ -41,18 +41,11 @@ import code.name.monkey.retromusic.util.NavigationUtil
|
||||||
import code.name.monkey.retromusic.util.PreferenceUtil
|
import code.name.monkey.retromusic.util.PreferenceUtil
|
||||||
import com.bumptech.glide.Glide
|
import com.bumptech.glide.Glide
|
||||||
import com.bumptech.glide.load.engine.DiskCacheStrategy
|
import com.bumptech.glide.load.engine.DiskCacheStrategy
|
||||||
import kotlinx.android.synthetic.main.abs_playlists.actionShuffle
|
import kotlinx.android.synthetic.main.abs_playlists.*
|
||||||
import kotlinx.android.synthetic.main.abs_playlists.history
|
import kotlinx.android.synthetic.main.fragment_banner_home.*
|
||||||
import kotlinx.android.synthetic.main.abs_playlists.lastAdded
|
import kotlinx.android.synthetic.main.home_content.*
|
||||||
import kotlinx.android.synthetic.main.abs_playlists.topPlayed
|
|
||||||
import kotlinx.android.synthetic.main.fragment_banner_home.bannerImage
|
|
||||||
import kotlinx.android.synthetic.main.fragment_banner_home.titleWelcome
|
|
||||||
import kotlinx.android.synthetic.main.fragment_banner_home.userImage
|
|
||||||
import kotlinx.android.synthetic.main.home_content.emptyContainer
|
|
||||||
import kotlinx.android.synthetic.main.home_content.recyclerView
|
|
||||||
import java.io.File
|
import java.io.File
|
||||||
import java.util.Calendar
|
import java.util.*
|
||||||
import java.util.Random
|
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
|
|
||||||
class BannerHomeFragment : AbsMainActivityFragment(), MainActivityFragmentCallbacks, HomeView {
|
class BannerHomeFragment : AbsMainActivityFragment(), MainActivityFragmentCallbacks, HomeView {
|
||||||
|
@ -65,7 +58,11 @@ class BannerHomeFragment : AbsMainActivityFragment(), MainActivityFragmentCallba
|
||||||
homeAdapter.swapData(sections)
|
homeAdapter.swapData(sections)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onCreateView(inflater: LayoutInflater, viewGroup: ViewGroup?, savedInstanceState: Bundle?): View? {
|
override fun onCreateView(
|
||||||
|
inflater: LayoutInflater,
|
||||||
|
viewGroup: ViewGroup?,
|
||||||
|
savedInstanceState: Bundle?
|
||||||
|
): View? {
|
||||||
return inflater.inflate(
|
return inflater.inflate(
|
||||||
if (PreferenceUtil.getInstance(requireContext()).isHomeBanner) R.layout.fragment_banner_home else R.layout.fragment_home,
|
if (PreferenceUtil.getInstance(requireContext()).isHomeBanner) R.layout.fragment_banner_home else R.layout.fragment_home,
|
||||||
viewGroup,
|
viewGroup,
|
||||||
|
@ -75,7 +72,12 @@ class BannerHomeFragment : AbsMainActivityFragment(), MainActivityFragmentCallba
|
||||||
|
|
||||||
private fun loadImageFromStorage() {
|
private fun loadImageFromStorage() {
|
||||||
Glide.with(requireContext())
|
Glide.with(requireContext())
|
||||||
.load(File(PreferenceUtil.getInstance(requireContext()).profileImage, Constants.USER_PROFILE))
|
.load(
|
||||||
|
File(
|
||||||
|
PreferenceUtil.getInstance(requireContext()).profileImage,
|
||||||
|
Constants.USER_PROFILE
|
||||||
|
)
|
||||||
|
)
|
||||||
.asBitmap()
|
.asBitmap()
|
||||||
.diskCacheStrategy(DiskCacheStrategy.NONE)
|
.diskCacheStrategy(DiskCacheStrategy.NONE)
|
||||||
.skipMemoryCache(true)
|
.skipMemoryCache(true)
|
||||||
|
@ -110,7 +112,10 @@ class BannerHomeFragment : AbsMainActivityFragment(), MainActivityFragmentCallba
|
||||||
}
|
}
|
||||||
|
|
||||||
topPlayed.setOnClickListener {
|
topPlayed.setOnClickListener {
|
||||||
NavigationUtil.goToPlaylistNew(requireActivity(), MyTopTracksPlaylist(requireActivity()))
|
NavigationUtil.goToPlaylistNew(
|
||||||
|
requireActivity(),
|
||||||
|
MyTopTracksPlaylist(requireActivity())
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
actionShuffle.setOnClickListener {
|
actionShuffle.setOnClickListener {
|
||||||
|
@ -129,7 +134,8 @@ class BannerHomeFragment : AbsMainActivityFragment(), MainActivityFragmentCallba
|
||||||
)
|
)
|
||||||
NavigationUtil.goToUserInfo(requireActivity(), options)
|
NavigationUtil.goToUserInfo(requireActivity(), options)
|
||||||
}
|
}
|
||||||
titleWelcome?.text = String.format("%s", PreferenceUtil.getInstance(requireContext()).userName)
|
titleWelcome?.text =
|
||||||
|
String.format("%s", PreferenceUtil.getInstance(requireContext()).userName)
|
||||||
|
|
||||||
App.musicComponent.inject(this)
|
App.musicComponent.inject(this)
|
||||||
homeAdapter = HomeAdapter(mainActivity, displayMetrics)
|
homeAdapter = HomeAdapter(mainActivity, displayMetrics)
|
||||||
|
@ -186,7 +192,12 @@ class BannerHomeFragment : AbsMainActivityFragment(), MainActivityFragmentCallba
|
||||||
.error(R.drawable.material_design_default)
|
.error(R.drawable.material_design_default)
|
||||||
.into(it)
|
.into(it)
|
||||||
} else {
|
} else {
|
||||||
request.load(File(PreferenceUtil.getInstance(requireContext()).bannerImage, USER_BANNER))
|
request.load(
|
||||||
|
File(
|
||||||
|
PreferenceUtil.getInstance(requireContext()).bannerImage,
|
||||||
|
USER_BANNER
|
||||||
|
)
|
||||||
|
)
|
||||||
.asBitmap()
|
.asBitmap()
|
||||||
.diskCacheStrategy(DiskCacheStrategy.NONE)
|
.diskCacheStrategy(DiskCacheStrategy.NONE)
|
||||||
.skipMemoryCache(true)
|
.skipMemoryCache(true)
|
||||||
|
|
|
@ -29,12 +29,29 @@ import android.webkit.MimeTypeMap;
|
||||||
import android.widget.PopupMenu;
|
import android.widget.PopupMenu;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
import androidx.annotation.Nullable;
|
import androidx.annotation.Nullable;
|
||||||
import androidx.loader.app.LoaderManager;
|
import androidx.loader.app.LoaderManager;
|
||||||
import androidx.loader.content.Loader;
|
import androidx.loader.content.Loader;
|
||||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||||
import androidx.recyclerview.widget.RecyclerView;
|
import androidx.recyclerview.widget.RecyclerView;
|
||||||
|
|
||||||
|
import com.afollestad.materialcab.MaterialCab;
|
||||||
|
import com.google.android.material.dialog.MaterialAlertDialogBuilder;
|
||||||
|
import com.google.android.material.snackbar.Snackbar;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.FileFilter;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.lang.ref.WeakReference;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.Comparator;
|
||||||
|
import java.util.LinkedList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
import code.name.monkey.appthemehelper.ThemeStore;
|
import code.name.monkey.appthemehelper.ThemeStore;
|
||||||
import code.name.monkey.appthemehelper.util.ATHUtil;
|
import code.name.monkey.appthemehelper.util.ATHUtil;
|
||||||
import code.name.monkey.retromusic.R;
|
import code.name.monkey.retromusic.R;
|
||||||
|
@ -57,19 +74,6 @@ import code.name.monkey.retromusic.util.RetroColorUtil;
|
||||||
import code.name.monkey.retromusic.util.ThemedFastScroller;
|
import code.name.monkey.retromusic.util.ThemedFastScroller;
|
||||||
import code.name.monkey.retromusic.views.BreadCrumbLayout;
|
import code.name.monkey.retromusic.views.BreadCrumbLayout;
|
||||||
import code.name.monkey.retromusic.views.ScrollingViewOnApplyWindowInsetsListener;
|
import code.name.monkey.retromusic.views.ScrollingViewOnApplyWindowInsetsListener;
|
||||||
import com.afollestad.materialcab.MaterialCab;
|
|
||||||
import com.google.android.material.dialog.MaterialAlertDialogBuilder;
|
|
||||||
import com.google.android.material.snackbar.Snackbar;
|
|
||||||
import java.io.File;
|
|
||||||
import java.io.FileFilter;
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.lang.ref.WeakReference;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.Comparator;
|
|
||||||
import java.util.LinkedList;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Objects;
|
|
||||||
import me.zhanghai.android.fastscroll.FastScroller;
|
import me.zhanghai.android.fastscroll.FastScroller;
|
||||||
|
|
||||||
public class FoldersFragment extends AbsMainActivityFragment implements
|
public class FoldersFragment extends AbsMainActivityFragment implements
|
||||||
|
@ -77,268 +81,19 @@ public class FoldersFragment extends AbsMainActivityFragment implements
|
||||||
CabHolder, BreadCrumbLayout.SelectionCallback, SongFileAdapter.Callbacks,
|
CabHolder, BreadCrumbLayout.SelectionCallback, SongFileAdapter.Callbacks,
|
||||||
LoaderManager.LoaderCallbacks<List<File>> {
|
LoaderManager.LoaderCallbacks<List<File>> {
|
||||||
|
|
||||||
public static class ListPathsAsyncTask extends
|
|
||||||
ListingFilesDialogAsyncTask<ListPathsAsyncTask.LoadingInfo, String, String[]> {
|
|
||||||
|
|
||||||
public static class LoadingInfo {
|
|
||||||
|
|
||||||
public final File file;
|
|
||||||
|
|
||||||
final FileFilter fileFilter;
|
|
||||||
|
|
||||||
public LoadingInfo(File file, FileFilter fileFilter) {
|
|
||||||
this.file = file;
|
|
||||||
this.fileFilter = fileFilter;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public interface OnPathsListedCallback {
|
|
||||||
|
|
||||||
void onPathsListed(@NonNull String[] paths);
|
|
||||||
}
|
|
||||||
|
|
||||||
private WeakReference<OnPathsListedCallback> onPathsListedCallbackWeakReference;
|
|
||||||
|
|
||||||
public ListPathsAsyncTask(Context context, OnPathsListedCallback callback) {
|
|
||||||
super(context);
|
|
||||||
onPathsListedCallbackWeakReference = new WeakReference<>(callback);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected String[] doInBackground(LoadingInfo... params) {
|
|
||||||
try {
|
|
||||||
if (isCancelled() || checkCallbackReference() == null) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
LoadingInfo info = params[0];
|
|
||||||
|
|
||||||
final String[] paths;
|
|
||||||
|
|
||||||
if (info.file.isDirectory()) {
|
|
||||||
List<File> files = FileUtil.listFilesDeep(info.file, info.fileFilter);
|
|
||||||
|
|
||||||
if (isCancelled() || checkCallbackReference() == null) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
paths = new String[files.size()];
|
|
||||||
for (int i = 0; i < files.size(); i++) {
|
|
||||||
File f = files.get(i);
|
|
||||||
paths[i] = FileUtil.safeGetCanonicalPath(f);
|
|
||||||
|
|
||||||
if (isCancelled() || checkCallbackReference() == null) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
paths = new String[1];
|
|
||||||
paths[0] = info.file.getPath();
|
|
||||||
}
|
|
||||||
|
|
||||||
return paths;
|
|
||||||
} catch (Exception e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
cancel(false);
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void onPostExecute(String[] paths) {
|
|
||||||
super.onPostExecute(paths);
|
|
||||||
OnPathsListedCallback callback = checkCallbackReference();
|
|
||||||
if (callback != null && paths != null) {
|
|
||||||
callback.onPathsListed(paths);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void onPreExecute() {
|
|
||||||
super.onPreExecute();
|
|
||||||
checkCallbackReference();
|
|
||||||
}
|
|
||||||
|
|
||||||
private OnPathsListedCallback checkCallbackReference() {
|
|
||||||
OnPathsListedCallback callback = onPathsListedCallbackWeakReference.get();
|
|
||||||
if (callback == null) {
|
|
||||||
cancel(false);
|
|
||||||
}
|
|
||||||
return callback;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private static class AsyncFileLoader extends WrappedAsyncTaskLoader<List<File>> {
|
|
||||||
|
|
||||||
private WeakReference<FoldersFragment> fragmentWeakReference;
|
|
||||||
|
|
||||||
AsyncFileLoader(FoldersFragment foldersFragment) {
|
|
||||||
super(Objects.requireNonNull(foldersFragment.getActivity()));
|
|
||||||
fragmentWeakReference = new WeakReference<>(foldersFragment);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<File> loadInBackground() {
|
|
||||||
FoldersFragment foldersFragment = fragmentWeakReference.get();
|
|
||||||
File directory = null;
|
|
||||||
if (foldersFragment != null) {
|
|
||||||
BreadCrumbLayout.Crumb crumb = foldersFragment.getActiveCrumb();
|
|
||||||
if (crumb != null) {
|
|
||||||
directory = crumb.getFile();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (directory != null) {
|
|
||||||
List<File> files = FileUtil.listFiles(directory, AUDIO_FILE_FILTER);
|
|
||||||
Collections.sort(files, foldersFragment.getFileComparator());
|
|
||||||
return files;
|
|
||||||
} else {
|
|
||||||
return new LinkedList<>();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private static class ListSongsAsyncTask
|
|
||||||
extends ListingFilesDialogAsyncTask<ListSongsAsyncTask.LoadingInfo, Void, ArrayList<Song>> {
|
|
||||||
|
|
||||||
static class LoadingInfo {
|
|
||||||
|
|
||||||
final Comparator<File> fileComparator;
|
|
||||||
|
|
||||||
final FileFilter fileFilter;
|
|
||||||
|
|
||||||
final List<File> files;
|
|
||||||
|
|
||||||
LoadingInfo(@NonNull List<File> files, @NonNull FileFilter fileFilter,
|
|
||||||
@NonNull Comparator<File> fileComparator) {
|
|
||||||
this.fileComparator = fileComparator;
|
|
||||||
this.fileFilter = fileFilter;
|
|
||||||
this.files = files;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public interface OnSongsListedCallback {
|
|
||||||
|
|
||||||
void onSongsListed(@NonNull ArrayList<Song> songs, Object extra);
|
|
||||||
}
|
|
||||||
|
|
||||||
private WeakReference<OnSongsListedCallback> callbackWeakReference;
|
|
||||||
|
|
||||||
private WeakReference<Context> contextWeakReference;
|
|
||||||
|
|
||||||
private final Object extra;
|
|
||||||
|
|
||||||
ListSongsAsyncTask(Context context, Object extra, OnSongsListedCallback callback) {
|
|
||||||
super(context);
|
|
||||||
this.extra = extra;
|
|
||||||
contextWeakReference = new WeakReference<>(context);
|
|
||||||
callbackWeakReference = new WeakReference<>(callback);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected ArrayList<Song> doInBackground(LoadingInfo... params) {
|
|
||||||
try {
|
|
||||||
LoadingInfo info = params[0];
|
|
||||||
List<File> files = FileUtil.listFilesDeep(info.files, info.fileFilter);
|
|
||||||
|
|
||||||
if (isCancelled() || checkContextReference() == null
|
|
||||||
|| checkCallbackReference() == null) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
Collections.sort(files, info.fileComparator);
|
|
||||||
|
|
||||||
Context context = checkContextReference();
|
|
||||||
if (isCancelled() || context == null || checkCallbackReference() == null) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
return FileUtil.matchFilesWithMediaStore(context, files);
|
|
||||||
} catch (Exception e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
cancel(false);
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void onPostExecute(ArrayList<Song> songs) {
|
|
||||||
super.onPostExecute(songs);
|
|
||||||
OnSongsListedCallback callback = checkCallbackReference();
|
|
||||||
if (songs != null && callback != null) {
|
|
||||||
callback.onSongsListed(songs, extra);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void onPreExecute() {
|
|
||||||
super.onPreExecute();
|
|
||||||
checkCallbackReference();
|
|
||||||
checkContextReference();
|
|
||||||
}
|
|
||||||
|
|
||||||
private OnSongsListedCallback checkCallbackReference() {
|
|
||||||
OnSongsListedCallback callback = callbackWeakReference.get();
|
|
||||||
if (callback == null) {
|
|
||||||
cancel(false);
|
|
||||||
}
|
|
||||||
return callback;
|
|
||||||
}
|
|
||||||
|
|
||||||
private Context checkContextReference() {
|
|
||||||
Context context = contextWeakReference.get();
|
|
||||||
if (context == null) {
|
|
||||||
cancel(false);
|
|
||||||
}
|
|
||||||
return context;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private static abstract class ListingFilesDialogAsyncTask<Params, Progress, Result> extends
|
|
||||||
DialogAsyncTask<Params, Progress, Result> {
|
|
||||||
|
|
||||||
ListingFilesDialogAsyncTask(Context context) {
|
|
||||||
super(context);
|
|
||||||
}
|
|
||||||
|
|
||||||
public ListingFilesDialogAsyncTask(Context context, int showDelay) {
|
|
||||||
super(context, showDelay);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected Dialog createDialog(@NonNull Context context) {
|
|
||||||
return new MaterialAlertDialogBuilder(context)
|
|
||||||
.setTitle(R.string.listing_files)
|
|
||||||
.setCancelable(false)
|
|
||||||
.setView(R.layout.loading)
|
|
||||||
.setOnCancelListener(dialog -> cancel(false))
|
|
||||||
.setOnDismissListener(dialog -> cancel(false))
|
|
||||||
.create();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static final String TAG = FoldersFragment.class.getSimpleName();
|
public static final String TAG = FoldersFragment.class.getSimpleName();
|
||||||
|
|
||||||
public static final FileFilter AUDIO_FILE_FILTER = file -> !file.isHidden() && (file.isDirectory() ||
|
public static final FileFilter AUDIO_FILE_FILTER = file -> !file.isHidden() && (file.isDirectory() ||
|
||||||
FileUtil.fileIsMimeType(file, "audio/*", MimeTypeMap.getSingleton()) ||
|
FileUtil.fileIsMimeType(file, "audio/*", MimeTypeMap.getSingleton()) ||
|
||||||
FileUtil.fileIsMimeType(file, "application/opus", MimeTypeMap.getSingleton()) ||
|
FileUtil.fileIsMimeType(file, "application/opus", MimeTypeMap.getSingleton()) ||
|
||||||
FileUtil.fileIsMimeType(file, "application/ogg", MimeTypeMap.getSingleton()));
|
FileUtil.fileIsMimeType(file, "application/ogg", MimeTypeMap.getSingleton()));
|
||||||
|
|
||||||
private static final String PATH = "path";
|
private static final String PATH = "path";
|
||||||
|
|
||||||
private static final String CRUMBS = "crumbs";
|
private static final String CRUMBS = "crumbs";
|
||||||
|
|
||||||
private static final int LOADER_ID = LoaderIds.Companion.getFOLDERS_FRAGMENT();
|
private static final int LOADER_ID = LoaderIds.Companion.getFOLDERS_FRAGMENT();
|
||||||
|
|
||||||
private SongFileAdapter adapter;
|
private SongFileAdapter adapter;
|
||||||
|
|
||||||
private BreadCrumbLayout breadCrumbs;
|
private BreadCrumbLayout breadCrumbs;
|
||||||
|
|
||||||
private MaterialCab cab;
|
private MaterialCab cab;
|
||||||
|
|
||||||
private View coordinatorLayout, empty;
|
private View coordinatorLayout, empty;
|
||||||
|
|
||||||
private TextView emojiText;
|
private TextView emojiText;
|
||||||
|
|
||||||
private Comparator<File> fileComparator = (lhs, rhs) -> {
|
private Comparator<File> fileComparator = (lhs, rhs) -> {
|
||||||
if (lhs.isDirectory() && !rhs.isDirectory()) {
|
if (lhs.isDirectory() && !rhs.isDirectory()) {
|
||||||
return -1;
|
return -1;
|
||||||
|
@ -349,9 +104,10 @@ public class FoldersFragment extends AbsMainActivityFragment implements
|
||||||
(rhs.getName());
|
(rhs.getName());
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
private RecyclerView recyclerView;
|
private RecyclerView recyclerView;
|
||||||
|
|
||||||
|
public FoldersFragment() {
|
||||||
|
}
|
||||||
|
|
||||||
public static File getDefaultStartDirectory() {
|
public static File getDefaultStartDirectory() {
|
||||||
File musicDir = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_MUSIC);
|
File musicDir = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_MUSIC);
|
||||||
|
@ -381,7 +137,13 @@ public class FoldersFragment extends AbsMainActivityFragment implements
|
||||||
return newInstance(PreferenceUtil.getInstance(context).getStartDirectory());
|
return newInstance(PreferenceUtil.getInstance(context).getStartDirectory());
|
||||||
}
|
}
|
||||||
|
|
||||||
public FoldersFragment() {
|
private static File tryGetCanonicalFile(File file) {
|
||||||
|
try {
|
||||||
|
return file.getCanonicalFile();
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
return file;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@NonNull
|
@NonNull
|
||||||
|
@ -737,12 +499,240 @@ public class FoldersFragment extends AbsMainActivityFragment implements
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static File tryGetCanonicalFile(File file) {
|
public static class ListPathsAsyncTask extends
|
||||||
|
ListingFilesDialogAsyncTask<ListPathsAsyncTask.LoadingInfo, String, String[]> {
|
||||||
|
|
||||||
|
private WeakReference<OnPathsListedCallback> onPathsListedCallbackWeakReference;
|
||||||
|
|
||||||
|
public ListPathsAsyncTask(Context context, OnPathsListedCallback callback) {
|
||||||
|
super(context);
|
||||||
|
onPathsListedCallbackWeakReference = new WeakReference<>(callback);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected String[] doInBackground(LoadingInfo... params) {
|
||||||
try {
|
try {
|
||||||
return file.getCanonicalFile();
|
if (isCancelled() || checkCallbackReference() == null) {
|
||||||
} catch (IOException e) {
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
LoadingInfo info = params[0];
|
||||||
|
|
||||||
|
final String[] paths;
|
||||||
|
|
||||||
|
if (info.file.isDirectory()) {
|
||||||
|
List<File> files = FileUtil.listFilesDeep(info.file, info.fileFilter);
|
||||||
|
|
||||||
|
if (isCancelled() || checkCallbackReference() == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
paths = new String[files.size()];
|
||||||
|
for (int i = 0; i < files.size(); i++) {
|
||||||
|
File f = files.get(i);
|
||||||
|
paths[i] = FileUtil.safeGetCanonicalPath(f);
|
||||||
|
|
||||||
|
if (isCancelled() || checkCallbackReference() == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
paths = new String[1];
|
||||||
|
paths[0] = info.file.getPath();
|
||||||
|
}
|
||||||
|
|
||||||
|
return paths;
|
||||||
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
return file;
|
cancel(false);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onPostExecute(String[] paths) {
|
||||||
|
super.onPostExecute(paths);
|
||||||
|
OnPathsListedCallback callback = checkCallbackReference();
|
||||||
|
if (callback != null && paths != null) {
|
||||||
|
callback.onPathsListed(paths);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onPreExecute() {
|
||||||
|
super.onPreExecute();
|
||||||
|
checkCallbackReference();
|
||||||
|
}
|
||||||
|
|
||||||
|
private OnPathsListedCallback checkCallbackReference() {
|
||||||
|
OnPathsListedCallback callback = onPathsListedCallbackWeakReference.get();
|
||||||
|
if (callback == null) {
|
||||||
|
cancel(false);
|
||||||
|
}
|
||||||
|
return callback;
|
||||||
|
}
|
||||||
|
|
||||||
|
public interface OnPathsListedCallback {
|
||||||
|
|
||||||
|
void onPathsListed(@NonNull String[] paths);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class LoadingInfo {
|
||||||
|
|
||||||
|
public final File file;
|
||||||
|
|
||||||
|
final FileFilter fileFilter;
|
||||||
|
|
||||||
|
public LoadingInfo(File file, FileFilter fileFilter) {
|
||||||
|
this.file = file;
|
||||||
|
this.fileFilter = fileFilter;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static class AsyncFileLoader extends WrappedAsyncTaskLoader<List<File>> {
|
||||||
|
|
||||||
|
private WeakReference<FoldersFragment> fragmentWeakReference;
|
||||||
|
|
||||||
|
AsyncFileLoader(FoldersFragment foldersFragment) {
|
||||||
|
super(Objects.requireNonNull(foldersFragment.getActivity()));
|
||||||
|
fragmentWeakReference = new WeakReference<>(foldersFragment);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<File> loadInBackground() {
|
||||||
|
FoldersFragment foldersFragment = fragmentWeakReference.get();
|
||||||
|
File directory = null;
|
||||||
|
if (foldersFragment != null) {
|
||||||
|
BreadCrumbLayout.Crumb crumb = foldersFragment.getActiveCrumb();
|
||||||
|
if (crumb != null) {
|
||||||
|
directory = crumb.getFile();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (directory != null) {
|
||||||
|
List<File> files = FileUtil.listFiles(directory, AUDIO_FILE_FILTER);
|
||||||
|
Collections.sort(files, foldersFragment.getFileComparator());
|
||||||
|
return files;
|
||||||
|
} else {
|
||||||
|
return new LinkedList<>();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static class ListSongsAsyncTask
|
||||||
|
extends ListingFilesDialogAsyncTask<ListSongsAsyncTask.LoadingInfo, Void, ArrayList<Song>> {
|
||||||
|
|
||||||
|
private final Object extra;
|
||||||
|
private WeakReference<OnSongsListedCallback> callbackWeakReference;
|
||||||
|
private WeakReference<Context> contextWeakReference;
|
||||||
|
|
||||||
|
ListSongsAsyncTask(Context context, Object extra, OnSongsListedCallback callback) {
|
||||||
|
super(context);
|
||||||
|
this.extra = extra;
|
||||||
|
contextWeakReference = new WeakReference<>(context);
|
||||||
|
callbackWeakReference = new WeakReference<>(callback);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected ArrayList<Song> doInBackground(LoadingInfo... params) {
|
||||||
|
try {
|
||||||
|
LoadingInfo info = params[0];
|
||||||
|
List<File> files = FileUtil.listFilesDeep(info.files, info.fileFilter);
|
||||||
|
|
||||||
|
if (isCancelled() || checkContextReference() == null
|
||||||
|
|| checkCallbackReference() == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
Collections.sort(files, info.fileComparator);
|
||||||
|
|
||||||
|
Context context = checkContextReference();
|
||||||
|
if (isCancelled() || context == null || checkCallbackReference() == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
return FileUtil.matchFilesWithMediaStore(context, files);
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
cancel(false);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onPostExecute(ArrayList<Song> songs) {
|
||||||
|
super.onPostExecute(songs);
|
||||||
|
OnSongsListedCallback callback = checkCallbackReference();
|
||||||
|
if (songs != null && callback != null) {
|
||||||
|
callback.onSongsListed(songs, extra);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onPreExecute() {
|
||||||
|
super.onPreExecute();
|
||||||
|
checkCallbackReference();
|
||||||
|
checkContextReference();
|
||||||
|
}
|
||||||
|
|
||||||
|
private OnSongsListedCallback checkCallbackReference() {
|
||||||
|
OnSongsListedCallback callback = callbackWeakReference.get();
|
||||||
|
if (callback == null) {
|
||||||
|
cancel(false);
|
||||||
|
}
|
||||||
|
return callback;
|
||||||
|
}
|
||||||
|
|
||||||
|
private Context checkContextReference() {
|
||||||
|
Context context = contextWeakReference.get();
|
||||||
|
if (context == null) {
|
||||||
|
cancel(false);
|
||||||
|
}
|
||||||
|
return context;
|
||||||
|
}
|
||||||
|
|
||||||
|
public interface OnSongsListedCallback {
|
||||||
|
|
||||||
|
void onSongsListed(@NonNull ArrayList<Song> songs, Object extra);
|
||||||
|
}
|
||||||
|
|
||||||
|
static class LoadingInfo {
|
||||||
|
|
||||||
|
final Comparator<File> fileComparator;
|
||||||
|
|
||||||
|
final FileFilter fileFilter;
|
||||||
|
|
||||||
|
final List<File> files;
|
||||||
|
|
||||||
|
LoadingInfo(@NonNull List<File> files, @NonNull FileFilter fileFilter,
|
||||||
|
@NonNull Comparator<File> fileComparator) {
|
||||||
|
this.fileComparator = fileComparator;
|
||||||
|
this.fileFilter = fileFilter;
|
||||||
|
this.files = files;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static abstract class ListingFilesDialogAsyncTask<Params, Progress, Result> extends
|
||||||
|
DialogAsyncTask<Params, Progress, Result> {
|
||||||
|
|
||||||
|
ListingFilesDialogAsyncTask(Context context) {
|
||||||
|
super(context);
|
||||||
|
}
|
||||||
|
|
||||||
|
public ListingFilesDialogAsyncTask(Context context, int showDelay) {
|
||||||
|
super(context, showDelay);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected Dialog createDialog(@NonNull Context context) {
|
||||||
|
return new MaterialAlertDialogBuilder(context)
|
||||||
|
.setTitle(R.string.listing_files)
|
||||||
|
.setCancelable(false)
|
||||||
|
.setView(R.layout.loading)
|
||||||
|
.setOnCancelListener(dialog -> cancel(false))
|
||||||
|
.setOnDismissListener(dialog -> cancel(false))
|
||||||
|
.create();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -85,6 +85,7 @@ class GenresFragment : AbsLibraryPagerRecyclerViewFragment<GenreAdapter, LinearL
|
||||||
companion object {
|
companion object {
|
||||||
@JvmField
|
@JvmField
|
||||||
val TAG: String = GenresFragment::class.java.simpleName
|
val TAG: String = GenresFragment::class.java.simpleName
|
||||||
|
|
||||||
@JvmStatic
|
@JvmStatic
|
||||||
fun newInstance(): GenresFragment {
|
fun newInstance(): GenresFragment {
|
||||||
return GenresFragment()
|
return GenresFragment()
|
||||||
|
|
|
@ -28,12 +28,13 @@ import com.h6ah4i.android.widget.advrecyclerview.draggable.RecyclerViewDragDropM
|
||||||
import com.h6ah4i.android.widget.advrecyclerview.swipeable.RecyclerViewSwipeManager
|
import com.h6ah4i.android.widget.advrecyclerview.swipeable.RecyclerViewSwipeManager
|
||||||
import com.h6ah4i.android.widget.advrecyclerview.touchguard.RecyclerViewTouchActionGuardManager
|
import com.h6ah4i.android.widget.advrecyclerview.touchguard.RecyclerViewTouchActionGuardManager
|
||||||
import com.h6ah4i.android.widget.advrecyclerview.utils.WrapperAdapterUtils
|
import com.h6ah4i.android.widget.advrecyclerview.utils.WrapperAdapterUtils
|
||||||
import kotlinx.android.synthetic.main.activity_playing_queue.recyclerView
|
import kotlinx.android.synthetic.main.activity_playing_queue.*
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by hemanths on 2019-12-08.
|
* Created by hemanths on 2019-12-08.
|
||||||
*/
|
*/
|
||||||
class PlayingQueueFragment : AbsLibraryPagerRecyclerViewFragment<PlayingQueueAdapter, LinearLayoutManager>(),
|
class PlayingQueueFragment :
|
||||||
|
AbsLibraryPagerRecyclerViewFragment<PlayingQueueAdapter, LinearLayoutManager>(),
|
||||||
MainActivityFragmentCallbacks {
|
MainActivityFragmentCallbacks {
|
||||||
|
|
||||||
override fun handleBackPress(): Boolean {
|
override fun handleBackPress(): Boolean {
|
||||||
|
@ -57,8 +58,10 @@ class PlayingQueueFragment : AbsLibraryPagerRecyclerViewFragment<PlayingQueueAda
|
||||||
|
|
||||||
val animator = DraggableItemAnimator()
|
val animator = DraggableItemAnimator()
|
||||||
animator.supportsChangeAnimations = false
|
animator.supportsChangeAnimations = false
|
||||||
wrappedAdapter = recyclerViewDragDropManager?.createWrappedAdapter(adapter!!) as RecyclerView.Adapter<*>
|
wrappedAdapter =
|
||||||
wrappedAdapter = recyclerViewSwipeManager?.createWrappedAdapter(wrappedAdapter) as RecyclerView.Adapter<*>
|
recyclerViewDragDropManager?.createWrappedAdapter(adapter!!) as RecyclerView.Adapter<*>
|
||||||
|
wrappedAdapter =
|
||||||
|
recyclerViewSwipeManager?.createWrappedAdapter(wrappedAdapter) as RecyclerView.Adapter<*>
|
||||||
recyclerView().layoutManager = layoutManager
|
recyclerView().layoutManager = layoutManager
|
||||||
recyclerView().adapter = wrappedAdapter
|
recyclerView().adapter = wrappedAdapter
|
||||||
recyclerView().itemAnimator = animator
|
recyclerView().itemAnimator = animator
|
||||||
|
@ -137,6 +140,7 @@ class PlayingQueueFragment : AbsLibraryPagerRecyclerViewFragment<PlayingQueueAda
|
||||||
companion object {
|
companion object {
|
||||||
@JvmField
|
@JvmField
|
||||||
val TAG: String = PlayingQueueFragment::class.java.simpleName
|
val TAG: String = PlayingQueueFragment::class.java.simpleName
|
||||||
|
|
||||||
@JvmStatic
|
@JvmStatic
|
||||||
fun newInstance(): PlayingQueueFragment {
|
fun newInstance(): PlayingQueueFragment {
|
||||||
return PlayingQueueFragment()
|
return PlayingQueueFragment()
|
||||||
|
|
|
@ -15,7 +15,8 @@ import code.name.monkey.retromusic.mvp.presenter.PlaylistView
|
||||||
import code.name.monkey.retromusic.mvp.presenter.PlaylistsPresenter
|
import code.name.monkey.retromusic.mvp.presenter.PlaylistsPresenter
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
|
|
||||||
class PlaylistsFragment : AbsLibraryPagerRecyclerViewFragment<PlaylistAdapter, LinearLayoutManager>(), PlaylistView,
|
class PlaylistsFragment :
|
||||||
|
AbsLibraryPagerRecyclerViewFragment<PlaylistAdapter, LinearLayoutManager>(), PlaylistView,
|
||||||
MainActivityFragmentCallbacks {
|
MainActivityFragmentCallbacks {
|
||||||
|
|
||||||
override fun handleBackPress(): Boolean {
|
override fun handleBackPress(): Boolean {
|
||||||
|
|
|
@ -14,10 +14,11 @@ import code.name.monkey.retromusic.model.Song
|
||||||
import code.name.monkey.retromusic.mvp.presenter.SongPresenter
|
import code.name.monkey.retromusic.mvp.presenter.SongPresenter
|
||||||
import code.name.monkey.retromusic.mvp.presenter.SongView
|
import code.name.monkey.retromusic.mvp.presenter.SongView
|
||||||
import code.name.monkey.retromusic.util.PreferenceUtil
|
import code.name.monkey.retromusic.util.PreferenceUtil
|
||||||
import java.util.ArrayList
|
import java.util.*
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
|
|
||||||
class SongsFragment : AbsLibraryPagerRecyclerViewCustomGridSizeFragment<SongAdapter, LinearLayoutManager>(),
|
class SongsFragment :
|
||||||
|
AbsLibraryPagerRecyclerViewCustomGridSizeFragment<SongAdapter, LinearLayoutManager>(),
|
||||||
SongView, MainActivityFragmentCallbacks {
|
SongView, MainActivityFragmentCallbacks {
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
|
|
|
@ -8,15 +8,13 @@ import androidx.viewpager.widget.ViewPager
|
||||||
import code.name.monkey.retromusic.R
|
import code.name.monkey.retromusic.R
|
||||||
import code.name.monkey.retromusic.adapter.album.AlbumCoverPagerAdapter
|
import code.name.monkey.retromusic.adapter.album.AlbumCoverPagerAdapter
|
||||||
import code.name.monkey.retromusic.adapter.album.AlbumCoverPagerAdapter.AlbumCoverFragment
|
import code.name.monkey.retromusic.adapter.album.AlbumCoverPagerAdapter.AlbumCoverFragment
|
||||||
import code.name.monkey.retromusic.fragments.NowPlayingScreen.ADAPTIVE
|
import code.name.monkey.retromusic.fragments.NowPlayingScreen.*
|
||||||
import code.name.monkey.retromusic.fragments.NowPlayingScreen.FIT
|
|
||||||
import code.name.monkey.retromusic.fragments.NowPlayingScreen.FULL
|
|
||||||
import code.name.monkey.retromusic.fragments.base.AbsMusicServiceFragment
|
import code.name.monkey.retromusic.fragments.base.AbsMusicServiceFragment
|
||||||
import code.name.monkey.retromusic.helper.MusicPlayerRemote
|
import code.name.monkey.retromusic.helper.MusicPlayerRemote
|
||||||
import code.name.monkey.retromusic.transform.CarousalPagerTransformer
|
import code.name.monkey.retromusic.transform.CarousalPagerTransformer
|
||||||
import code.name.monkey.retromusic.transform.ParallaxPagerTransformer
|
import code.name.monkey.retromusic.transform.ParallaxPagerTransformer
|
||||||
import code.name.monkey.retromusic.util.PreferenceUtil
|
import code.name.monkey.retromusic.util.PreferenceUtil
|
||||||
import kotlinx.android.synthetic.main.fragment_player_album_cover.viewPager
|
import kotlinx.android.synthetic.main.fragment_player_album_cover.*
|
||||||
|
|
||||||
class PlayerAlbumCoverFragment : AbsMusicServiceFragment(), ViewPager.OnPageChangeListener {
|
class PlayerAlbumCoverFragment : AbsMusicServiceFragment(), ViewPager.OnPageChangeListener {
|
||||||
private var callbacks: Callbacks? = null
|
private var callbacks: Callbacks? = null
|
||||||
|
@ -56,7 +54,10 @@ class PlayerAlbumCoverFragment : AbsMusicServiceFragment(), ViewPager.OnPageChan
|
||||||
viewPager.setPageTransformer(false, CarousalPagerTransformer(requireContext()))
|
viewPager.setPageTransformer(false, CarousalPagerTransformer(requireContext()))
|
||||||
} else {
|
} else {
|
||||||
viewPager.offscreenPageLimit = 2
|
viewPager.offscreenPageLimit = 2
|
||||||
viewPager.setPageTransformer(true, PreferenceUtil.getInstance(requireContext()).albumCoverTransform)
|
viewPager.setPageTransformer(
|
||||||
|
true,
|
||||||
|
PreferenceUtil.getInstance(requireContext()).albumCoverTransform
|
||||||
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -19,7 +19,7 @@ import code.name.monkey.retromusic.helper.MusicProgressViewUpdateHelper
|
||||||
import code.name.monkey.retromusic.model.Song
|
import code.name.monkey.retromusic.model.Song
|
||||||
import code.name.monkey.retromusic.model.lyrics.AbsSynchronizedLyrics
|
import code.name.monkey.retromusic.model.lyrics.AbsSynchronizedLyrics
|
||||||
import code.name.monkey.retromusic.model.lyrics.Lyrics
|
import code.name.monkey.retromusic.model.lyrics.Lyrics
|
||||||
import kotlinx.android.synthetic.main.fragment_adaptive_player.playerToolbar
|
import kotlinx.android.synthetic.main.fragment_adaptive_player.*
|
||||||
|
|
||||||
class AdaptiveFragment : AbsPlayerFragment(), MusicProgressViewUpdateHelper.Callback {
|
class AdaptiveFragment : AbsPlayerFragment(), MusicProgressViewUpdateHelper.Callback {
|
||||||
|
|
||||||
|
@ -55,7 +55,10 @@ class AdaptiveFragment : AbsPlayerFragment(), MusicProgressViewUpdateHelper.Call
|
||||||
lyricsLine2.visibility = View.VISIBLE
|
lyricsLine2.visibility = View.VISIBLE
|
||||||
|
|
||||||
lyricsLine2.measure(
|
lyricsLine2.measure(
|
||||||
View.MeasureSpec.makeMeasureSpec(lyricsLine2.measuredWidth, View.MeasureSpec.EXACTLY),
|
View.MeasureSpec.makeMeasureSpec(
|
||||||
|
lyricsLine2.measuredWidth,
|
||||||
|
View.MeasureSpec.EXACTLY
|
||||||
|
),
|
||||||
View.MeasureSpec.UNSPECIFIED
|
View.MeasureSpec.UNSPECIFIED
|
||||||
)
|
)
|
||||||
val h: Float = lyricsLine2.measuredHeight.toFloat()
|
val h: Float = lyricsLine2.measuredHeight.toFloat()
|
||||||
|
@ -79,7 +82,8 @@ class AdaptiveFragment : AbsPlayerFragment(), MusicProgressViewUpdateHelper.Call
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun hideLyricsLayout() {
|
private fun hideLyricsLayout() {
|
||||||
lyricsLayout.animate().alpha(0f).setDuration(VISIBILITY_ANIM_DURATION).withEndAction(Runnable {
|
lyricsLayout.animate().alpha(0f).setDuration(VISIBILITY_ANIM_DURATION)
|
||||||
|
.withEndAction(Runnable {
|
||||||
if (!isLyricsLayoutBound()) return@Runnable
|
if (!isLyricsLayoutBound()) return@Runnable
|
||||||
lyricsLayout.visibility = View.GONE
|
lyricsLayout.visibility = View.GONE
|
||||||
lyricsLine1.text = null
|
lyricsLine1.text = null
|
||||||
|
@ -116,7 +120,11 @@ class AdaptiveFragment : AbsPlayerFragment(), MusicProgressViewUpdateHelper.Call
|
||||||
private var lastColor: Int = 0
|
private var lastColor: Int = 0
|
||||||
private lateinit var playbackControlsFragment: AdaptivePlaybackControlsFragment
|
private lateinit var playbackControlsFragment: AdaptivePlaybackControlsFragment
|
||||||
|
|
||||||
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {
|
override fun onCreateView(
|
||||||
|
inflater: LayoutInflater,
|
||||||
|
container: ViewGroup?,
|
||||||
|
savedInstanceState: Bundle?
|
||||||
|
): View? {
|
||||||
return inflater.inflate(R.layout.fragment_adaptive_player, container, false)
|
return inflater.inflate(R.layout.fragment_adaptive_player, container, false)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -23,15 +23,7 @@ import code.name.monkey.retromusic.service.MusicService
|
||||||
import code.name.monkey.retromusic.util.MusicUtil
|
import code.name.monkey.retromusic.util.MusicUtil
|
||||||
import code.name.monkey.retromusic.util.PreferenceUtil
|
import code.name.monkey.retromusic.util.PreferenceUtil
|
||||||
import code.name.monkey.retromusic.util.ViewUtil
|
import code.name.monkey.retromusic.util.ViewUtil
|
||||||
import kotlinx.android.synthetic.main.fragment_adaptive_player_playback_controls.nextButton
|
import kotlinx.android.synthetic.main.fragment_adaptive_player_playback_controls.*
|
||||||
import kotlinx.android.synthetic.main.fragment_adaptive_player_playback_controls.playPauseButton
|
|
||||||
import kotlinx.android.synthetic.main.fragment_adaptive_player_playback_controls.previousButton
|
|
||||||
import kotlinx.android.synthetic.main.fragment_adaptive_player_playback_controls.progressSlider
|
|
||||||
import kotlinx.android.synthetic.main.fragment_adaptive_player_playback_controls.repeatButton
|
|
||||||
import kotlinx.android.synthetic.main.fragment_adaptive_player_playback_controls.shuffleButton
|
|
||||||
import kotlinx.android.synthetic.main.fragment_adaptive_player_playback_controls.songCurrentProgress
|
|
||||||
import kotlinx.android.synthetic.main.fragment_adaptive_player_playback_controls.songInfo
|
|
||||||
import kotlinx.android.synthetic.main.fragment_adaptive_player_playback_controls.songTotalTime
|
|
||||||
|
|
||||||
class AdaptivePlaybackControlsFragment : AbsPlayerControlsFragment() {
|
class AdaptivePlaybackControlsFragment : AbsPlayerControlsFragment() {
|
||||||
|
|
||||||
|
@ -48,7 +40,11 @@ class AdaptivePlaybackControlsFragment : AbsPlayerControlsFragment() {
|
||||||
inflater: LayoutInflater, container: ViewGroup?,
|
inflater: LayoutInflater, container: ViewGroup?,
|
||||||
savedInstanceState: Bundle?
|
savedInstanceState: Bundle?
|
||||||
): View? {
|
): View? {
|
||||||
return inflater.inflate(R.layout.fragment_adaptive_player_playback_controls, container, false)
|
return inflater.inflate(
|
||||||
|
R.layout.fragment_adaptive_player_playback_controls,
|
||||||
|
container,
|
||||||
|
false
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||||
|
@ -109,12 +105,20 @@ class AdaptivePlaybackControlsFragment : AbsPlayerControlsFragment() {
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun setDark(color: Int) {
|
override fun setDark(color: Int) {
|
||||||
if (ColorUtil.isColorLight(ATHUtil.resolveColor(context, android.R.attr.windowBackground))) {
|
if (ColorUtil.isColorLight(
|
||||||
|
ATHUtil.resolveColor(
|
||||||
|
context,
|
||||||
|
android.R.attr.windowBackground
|
||||||
|
)
|
||||||
|
)
|
||||||
|
) {
|
||||||
lastPlaybackControlsColor = MaterialValueHelper.getSecondaryTextColor(activity, true)
|
lastPlaybackControlsColor = MaterialValueHelper.getSecondaryTextColor(activity, true)
|
||||||
lastDisabledPlaybackControlsColor = MaterialValueHelper.getSecondaryDisabledTextColor(activity, true)
|
lastDisabledPlaybackControlsColor =
|
||||||
|
MaterialValueHelper.getSecondaryDisabledTextColor(activity, true)
|
||||||
} else {
|
} else {
|
||||||
lastPlaybackControlsColor = MaterialValueHelper.getPrimaryTextColor(activity, false)
|
lastPlaybackControlsColor = MaterialValueHelper.getPrimaryTextColor(activity, false)
|
||||||
lastDisabledPlaybackControlsColor = MaterialValueHelper.getPrimaryDisabledTextColor(activity, false)
|
lastDisabledPlaybackControlsColor =
|
||||||
|
MaterialValueHelper.getPrimaryDisabledTextColor(activity, false)
|
||||||
}
|
}
|
||||||
|
|
||||||
updateRepeatState()
|
updateRepeatState()
|
||||||
|
@ -183,7 +187,10 @@ class AdaptivePlaybackControlsFragment : AbsPlayerControlsFragment() {
|
||||||
lastPlaybackControlsColor,
|
lastPlaybackControlsColor,
|
||||||
PorterDuff.Mode.SRC_IN
|
PorterDuff.Mode.SRC_IN
|
||||||
)
|
)
|
||||||
else -> shuffleButton.setColorFilter(lastDisabledPlaybackControlsColor, PorterDuff.Mode.SRC_IN)
|
else -> shuffleButton.setColorFilter(
|
||||||
|
lastDisabledPlaybackControlsColor,
|
||||||
|
PorterDuff.Mode.SRC_IN
|
||||||
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -195,7 +202,10 @@ class AdaptivePlaybackControlsFragment : AbsPlayerControlsFragment() {
|
||||||
when (MusicPlayerRemote.repeatMode) {
|
when (MusicPlayerRemote.repeatMode) {
|
||||||
MusicService.REPEAT_MODE_NONE -> {
|
MusicService.REPEAT_MODE_NONE -> {
|
||||||
repeatButton.setImageResource(R.drawable.ic_repeat_white_24dp)
|
repeatButton.setImageResource(R.drawable.ic_repeat_white_24dp)
|
||||||
repeatButton.setColorFilter(lastDisabledPlaybackControlsColor, PorterDuff.Mode.SRC_IN)
|
repeatButton.setColorFilter(
|
||||||
|
lastDisabledPlaybackControlsColor,
|
||||||
|
PorterDuff.Mode.SRC_IN
|
||||||
|
)
|
||||||
}
|
}
|
||||||
MusicService.REPEAT_MODE_ALL -> {
|
MusicService.REPEAT_MODE_ALL -> {
|
||||||
repeatButton.setImageResource(R.drawable.ic_repeat_white_24dp)
|
repeatButton.setImageResource(R.drawable.ic_repeat_white_24dp)
|
||||||
|
|
|
@ -23,17 +23,7 @@ import code.name.monkey.retromusic.helper.PlayPauseButtonOnClickHandler
|
||||||
import code.name.monkey.retromusic.service.MusicService
|
import code.name.monkey.retromusic.service.MusicService
|
||||||
import code.name.monkey.retromusic.util.MusicUtil
|
import code.name.monkey.retromusic.util.MusicUtil
|
||||||
import code.name.monkey.retromusic.util.PreferenceUtil
|
import code.name.monkey.retromusic.util.PreferenceUtil
|
||||||
import kotlinx.android.synthetic.main.fragment_blur_player_playback_controls.nextButton
|
import kotlinx.android.synthetic.main.fragment_blur_player_playback_controls.*
|
||||||
import kotlinx.android.synthetic.main.fragment_blur_player_playback_controls.playPauseButton
|
|
||||||
import kotlinx.android.synthetic.main.fragment_blur_player_playback_controls.previousButton
|
|
||||||
import kotlinx.android.synthetic.main.fragment_blur_player_playback_controls.progressSlider
|
|
||||||
import kotlinx.android.synthetic.main.fragment_blur_player_playback_controls.repeatButton
|
|
||||||
import kotlinx.android.synthetic.main.fragment_blur_player_playback_controls.shuffleButton
|
|
||||||
import kotlinx.android.synthetic.main.fragment_blur_player_playback_controls.songCurrentProgress
|
|
||||||
import kotlinx.android.synthetic.main.fragment_blur_player_playback_controls.songInfo
|
|
||||||
import kotlinx.android.synthetic.main.fragment_blur_player_playback_controls.songTotalTime
|
|
||||||
import kotlinx.android.synthetic.main.fragment_blur_player_playback_controls.text
|
|
||||||
import kotlinx.android.synthetic.main.fragment_blur_player_playback_controls.title
|
|
||||||
|
|
||||||
class BlurPlaybackControlsFragment : AbsPlayerControlsFragment() {
|
class BlurPlaybackControlsFragment : AbsPlayerControlsFragment() {
|
||||||
|
|
||||||
|
@ -119,7 +109,8 @@ class BlurPlaybackControlsFragment : AbsPlayerControlsFragment() {
|
||||||
|
|
||||||
override fun setDark(color: Int) {
|
override fun setDark(color: Int) {
|
||||||
lastPlaybackControlsColor = Color.WHITE
|
lastPlaybackControlsColor = Color.WHITE
|
||||||
lastDisabledPlaybackControlsColor = ContextCompat.getColor(requireContext(), R.color.md_grey_500)
|
lastDisabledPlaybackControlsColor =
|
||||||
|
ContextCompat.getColor(requireContext(), R.color.md_grey_500)
|
||||||
|
|
||||||
title.setTextColor(lastPlaybackControlsColor)
|
title.setTextColor(lastPlaybackControlsColor)
|
||||||
|
|
||||||
|
@ -188,7 +179,10 @@ class BlurPlaybackControlsFragment : AbsPlayerControlsFragment() {
|
||||||
lastPlaybackControlsColor,
|
lastPlaybackControlsColor,
|
||||||
PorterDuff.Mode.SRC_IN
|
PorterDuff.Mode.SRC_IN
|
||||||
)
|
)
|
||||||
else -> shuffleButton.setColorFilter(lastDisabledPlaybackControlsColor, PorterDuff.Mode.SRC_IN)
|
else -> shuffleButton.setColorFilter(
|
||||||
|
lastDisabledPlaybackControlsColor,
|
||||||
|
PorterDuff.Mode.SRC_IN
|
||||||
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -200,7 +194,10 @@ class BlurPlaybackControlsFragment : AbsPlayerControlsFragment() {
|
||||||
when (MusicPlayerRemote.repeatMode) {
|
when (MusicPlayerRemote.repeatMode) {
|
||||||
MusicService.REPEAT_MODE_NONE -> {
|
MusicService.REPEAT_MODE_NONE -> {
|
||||||
repeatButton.setImageResource(R.drawable.ic_repeat_white_24dp)
|
repeatButton.setImageResource(R.drawable.ic_repeat_white_24dp)
|
||||||
repeatButton.setColorFilter(lastDisabledPlaybackControlsColor, PorterDuff.Mode.SRC_IN)
|
repeatButton.setColorFilter(
|
||||||
|
lastDisabledPlaybackControlsColor,
|
||||||
|
PorterDuff.Mode.SRC_IN
|
||||||
|
)
|
||||||
}
|
}
|
||||||
MusicService.REPEAT_MODE_ALL -> {
|
MusicService.REPEAT_MODE_ALL -> {
|
||||||
repeatButton.setImageResource(R.drawable.ic_repeat_white_24dp)
|
repeatButton.setImageResource(R.drawable.ic_repeat_white_24dp)
|
||||||
|
|
|
@ -19,8 +19,7 @@ import code.name.monkey.retromusic.helper.MusicPlayerRemote
|
||||||
import code.name.monkey.retromusic.model.Song
|
import code.name.monkey.retromusic.model.Song
|
||||||
import code.name.monkey.retromusic.util.PreferenceUtil
|
import code.name.monkey.retromusic.util.PreferenceUtil
|
||||||
import com.bumptech.glide.Glide
|
import com.bumptech.glide.Glide
|
||||||
import kotlinx.android.synthetic.main.fragment_blur.colorBackground
|
import kotlinx.android.synthetic.main.fragment_blur.*
|
||||||
import kotlinx.android.synthetic.main.fragment_blur.playerToolbar
|
|
||||||
|
|
||||||
class BlurPlayerFragment : AbsPlayerFragment(), SharedPreferences.OnSharedPreferenceChangeListener {
|
class BlurPlayerFragment : AbsPlayerFragment(), SharedPreferences.OnSharedPreferenceChangeListener {
|
||||||
|
|
||||||
|
@ -126,7 +125,8 @@ class BlurPlayerFragment : AbsPlayerFragment(), SharedPreferences.OnSharedPrefer
|
||||||
|
|
||||||
override fun onResume() {
|
override fun onResume() {
|
||||||
super.onResume()
|
super.onResume()
|
||||||
PreferenceManager.getDefaultSharedPreferences(requireContext()).registerOnSharedPreferenceChangeListener(this)
|
PreferenceManager.getDefaultSharedPreferences(requireContext())
|
||||||
|
.registerOnSharedPreferenceChangeListener(this)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onDestroyView() {
|
override fun onDestroyView() {
|
||||||
|
|
|
@ -13,7 +13,7 @@ import code.name.monkey.retromusic.fragments.player.PlayerAlbumCoverFragment
|
||||||
import code.name.monkey.retromusic.fragments.player.normal.PlayerFragment
|
import code.name.monkey.retromusic.fragments.player.normal.PlayerFragment
|
||||||
import code.name.monkey.retromusic.helper.MusicPlayerRemote
|
import code.name.monkey.retromusic.helper.MusicPlayerRemote
|
||||||
import code.name.monkey.retromusic.model.Song
|
import code.name.monkey.retromusic.model.Song
|
||||||
import kotlinx.android.synthetic.main.fragment_card_player.playerToolbar
|
import kotlinx.android.synthetic.main.fragment_card_player.*
|
||||||
|
|
||||||
class CardFragment : AbsPlayerFragment() {
|
class CardFragment : AbsPlayerFragment() {
|
||||||
override fun playerToolbar(): Toolbar {
|
override fun playerToolbar(): Toolbar {
|
||||||
|
|
|
@ -25,18 +25,8 @@ import code.name.monkey.retromusic.misc.SimpleOnSeekbarChangeListener
|
||||||
import code.name.monkey.retromusic.service.MusicService
|
import code.name.monkey.retromusic.service.MusicService
|
||||||
import code.name.monkey.retromusic.util.MusicUtil
|
import code.name.monkey.retromusic.util.MusicUtil
|
||||||
import code.name.monkey.retromusic.util.PreferenceUtil
|
import code.name.monkey.retromusic.util.PreferenceUtil
|
||||||
import kotlinx.android.synthetic.main.fragment_card_player_playback_controls.image
|
import kotlinx.android.synthetic.main.fragment_card_player_playback_controls.*
|
||||||
import kotlinx.android.synthetic.main.fragment_card_player_playback_controls.progressSlider
|
import kotlinx.android.synthetic.main.media_button.*
|
||||||
import kotlinx.android.synthetic.main.fragment_card_player_playback_controls.songCurrentProgress
|
|
||||||
import kotlinx.android.synthetic.main.fragment_card_player_playback_controls.songInfo
|
|
||||||
import kotlinx.android.synthetic.main.fragment_card_player_playback_controls.songTotalTime
|
|
||||||
import kotlinx.android.synthetic.main.fragment_card_player_playback_controls.text
|
|
||||||
import kotlinx.android.synthetic.main.fragment_card_player_playback_controls.title
|
|
||||||
import kotlinx.android.synthetic.main.media_button.nextButton
|
|
||||||
import kotlinx.android.synthetic.main.media_button.playPauseButton
|
|
||||||
import kotlinx.android.synthetic.main.media_button.previousButton
|
|
||||||
import kotlinx.android.synthetic.main.media_button.repeatButton
|
|
||||||
import kotlinx.android.synthetic.main.media_button.shuffleButton
|
|
||||||
|
|
||||||
class CardPlaybackControlsFragment : AbsPlayerControlsFragment() {
|
class CardPlaybackControlsFragment : AbsPlayerControlsFragment() {
|
||||||
|
|
||||||
|
@ -121,12 +111,20 @@ class CardPlaybackControlsFragment : AbsPlayerControlsFragment() {
|
||||||
|
|
||||||
override fun setDark(color: Int) {
|
override fun setDark(color: Int) {
|
||||||
|
|
||||||
if (ColorUtil.isColorLight(ATHUtil.resolveColor(context, android.R.attr.windowBackground))) {
|
if (ColorUtil.isColorLight(
|
||||||
|
ATHUtil.resolveColor(
|
||||||
|
context,
|
||||||
|
android.R.attr.windowBackground
|
||||||
|
)
|
||||||
|
)
|
||||||
|
) {
|
||||||
lastPlaybackControlsColor = MaterialValueHelper.getSecondaryTextColor(activity, true)
|
lastPlaybackControlsColor = MaterialValueHelper.getSecondaryTextColor(activity, true)
|
||||||
lastDisabledPlaybackControlsColor = MaterialValueHelper.getSecondaryDisabledTextColor(activity, true)
|
lastDisabledPlaybackControlsColor =
|
||||||
|
MaterialValueHelper.getSecondaryDisabledTextColor(activity, true)
|
||||||
} else {
|
} else {
|
||||||
lastPlaybackControlsColor = MaterialValueHelper.getPrimaryTextColor(activity, false)
|
lastPlaybackControlsColor = MaterialValueHelper.getPrimaryTextColor(activity, false)
|
||||||
lastDisabledPlaybackControlsColor = MaterialValueHelper.getPrimaryDisabledTextColor(activity, false)
|
lastDisabledPlaybackControlsColor =
|
||||||
|
MaterialValueHelper.getPrimaryDisabledTextColor(activity, false)
|
||||||
}
|
}
|
||||||
|
|
||||||
updateRepeatState()
|
updateRepeatState()
|
||||||
|
@ -196,7 +194,10 @@ class CardPlaybackControlsFragment : AbsPlayerControlsFragment() {
|
||||||
lastPlaybackControlsColor,
|
lastPlaybackControlsColor,
|
||||||
PorterDuff.Mode.SRC_IN
|
PorterDuff.Mode.SRC_IN
|
||||||
)
|
)
|
||||||
else -> shuffleButton.setColorFilter(lastDisabledPlaybackControlsColor, PorterDuff.Mode.SRC_IN)
|
else -> shuffleButton.setColorFilter(
|
||||||
|
lastDisabledPlaybackControlsColor,
|
||||||
|
PorterDuff.Mode.SRC_IN
|
||||||
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -208,7 +209,10 @@ class CardPlaybackControlsFragment : AbsPlayerControlsFragment() {
|
||||||
when (MusicPlayerRemote.repeatMode) {
|
when (MusicPlayerRemote.repeatMode) {
|
||||||
MusicService.REPEAT_MODE_NONE -> {
|
MusicService.REPEAT_MODE_NONE -> {
|
||||||
repeatButton.setImageResource(R.drawable.ic_repeat_white_24dp)
|
repeatButton.setImageResource(R.drawable.ic_repeat_white_24dp)
|
||||||
repeatButton.setColorFilter(lastDisabledPlaybackControlsColor, PorterDuff.Mode.SRC_IN)
|
repeatButton.setColorFilter(
|
||||||
|
lastDisabledPlaybackControlsColor,
|
||||||
|
PorterDuff.Mode.SRC_IN
|
||||||
|
)
|
||||||
}
|
}
|
||||||
MusicService.REPEAT_MODE_ALL -> {
|
MusicService.REPEAT_MODE_ALL -> {
|
||||||
repeatButton.setImageResource(R.drawable.ic_repeat_white_24dp)
|
repeatButton.setImageResource(R.drawable.ic_repeat_white_24dp)
|
||||||
|
@ -252,7 +256,10 @@ class CardPlaybackControlsFragment : AbsPlayerControlsFragment() {
|
||||||
override fun onProgressChanged(seekBar: SeekBar, progress: Int, fromUser: Boolean) {
|
override fun onProgressChanged(seekBar: SeekBar, progress: Int, fromUser: Boolean) {
|
||||||
if (fromUser) {
|
if (fromUser) {
|
||||||
MusicPlayerRemote.seekTo(progress)
|
MusicPlayerRemote.seekTo(progress)
|
||||||
onUpdateProgressViews(MusicPlayerRemote.songProgressMillis, MusicPlayerRemote.songDurationMillis)
|
onUpdateProgressViews(
|
||||||
|
MusicPlayerRemote.songProgressMillis,
|
||||||
|
MusicPlayerRemote.songDurationMillis
|
||||||
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
|
@ -20,8 +20,7 @@ import code.name.monkey.retromusic.helper.MusicPlayerRemote
|
||||||
import code.name.monkey.retromusic.model.Song
|
import code.name.monkey.retromusic.model.Song
|
||||||
import code.name.monkey.retromusic.util.PreferenceUtil
|
import code.name.monkey.retromusic.util.PreferenceUtil
|
||||||
import com.bumptech.glide.Glide
|
import com.bumptech.glide.Glide
|
||||||
import kotlinx.android.synthetic.main.fragment_card_blur_player.colorBackground
|
import kotlinx.android.synthetic.main.fragment_card_blur_player.*
|
||||||
import kotlinx.android.synthetic.main.fragment_card_blur_player.playerToolbar
|
|
||||||
|
|
||||||
class CardBlurFragment : AbsPlayerFragment(), SharedPreferences.OnSharedPreferenceChangeListener {
|
class CardBlurFragment : AbsPlayerFragment(), SharedPreferences.OnSharedPreferenceChangeListener {
|
||||||
override fun playerToolbar(): Toolbar {
|
override fun playerToolbar(): Toolbar {
|
||||||
|
@ -146,7 +145,8 @@ class CardBlurFragment : AbsPlayerFragment(), SharedPreferences.OnSharedPreferen
|
||||||
|
|
||||||
override fun onResume() {
|
override fun onResume() {
|
||||||
super.onResume()
|
super.onResume()
|
||||||
PreferenceManager.getDefaultSharedPreferences(requireContext()).registerOnSharedPreferenceChangeListener(this)
|
PreferenceManager.getDefaultSharedPreferences(requireContext())
|
||||||
|
.registerOnSharedPreferenceChangeListener(this)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onDestroyView() {
|
override fun onDestroyView() {
|
||||||
|
|
|
@ -22,15 +22,8 @@ import code.name.monkey.retromusic.service.MusicService
|
||||||
import code.name.monkey.retromusic.util.MusicUtil
|
import code.name.monkey.retromusic.util.MusicUtil
|
||||||
import code.name.monkey.retromusic.util.PreferenceUtil
|
import code.name.monkey.retromusic.util.PreferenceUtil
|
||||||
import code.name.monkey.retromusic.util.ViewUtil
|
import code.name.monkey.retromusic.util.ViewUtil
|
||||||
import kotlinx.android.synthetic.main.fragment_card_blur_player_playback_controls.progressSlider
|
import kotlinx.android.synthetic.main.fragment_card_blur_player_playback_controls.*
|
||||||
import kotlinx.android.synthetic.main.fragment_card_blur_player_playback_controls.songCurrentProgress
|
import kotlinx.android.synthetic.main.media_button.*
|
||||||
import kotlinx.android.synthetic.main.fragment_card_blur_player_playback_controls.songInfo
|
|
||||||
import kotlinx.android.synthetic.main.fragment_card_blur_player_playback_controls.songTotalTime
|
|
||||||
import kotlinx.android.synthetic.main.media_button.nextButton
|
|
||||||
import kotlinx.android.synthetic.main.media_button.playPauseButton
|
|
||||||
import kotlinx.android.synthetic.main.media_button.previousButton
|
|
||||||
import kotlinx.android.synthetic.main.media_button.repeatButton
|
|
||||||
import kotlinx.android.synthetic.main.media_button.shuffleButton
|
|
||||||
|
|
||||||
class CardBlurPlaybackControlsFragment : AbsPlayerControlsFragment() {
|
class CardBlurPlaybackControlsFragment : AbsPlayerControlsFragment() {
|
||||||
|
|
||||||
|
@ -48,7 +41,11 @@ class CardBlurPlaybackControlsFragment : AbsPlayerControlsFragment() {
|
||||||
savedInstanceState: Bundle?
|
savedInstanceState: Bundle?
|
||||||
): View? {
|
): View? {
|
||||||
|
|
||||||
return inflater.inflate(R.layout.fragment_card_blur_player_playback_controls, container, false)
|
return inflater.inflate(
|
||||||
|
R.layout.fragment_card_blur_player_playback_controls,
|
||||||
|
container,
|
||||||
|
false
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||||
|
@ -163,7 +160,10 @@ class CardBlurPlaybackControlsFragment : AbsPlayerControlsFragment() {
|
||||||
lastPlaybackControlsColor,
|
lastPlaybackControlsColor,
|
||||||
PorterDuff.Mode.SRC_IN
|
PorterDuff.Mode.SRC_IN
|
||||||
)
|
)
|
||||||
else -> shuffleButton.setColorFilter(lastDisabledPlaybackControlsColor, PorterDuff.Mode.SRC_IN)
|
else -> shuffleButton.setColorFilter(
|
||||||
|
lastDisabledPlaybackControlsColor,
|
||||||
|
PorterDuff.Mode.SRC_IN
|
||||||
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -175,7 +175,10 @@ class CardBlurPlaybackControlsFragment : AbsPlayerControlsFragment() {
|
||||||
when (MusicPlayerRemote.repeatMode) {
|
when (MusicPlayerRemote.repeatMode) {
|
||||||
MusicService.REPEAT_MODE_NONE -> {
|
MusicService.REPEAT_MODE_NONE -> {
|
||||||
repeatButton.setImageResource(R.drawable.ic_repeat_white_24dp)
|
repeatButton.setImageResource(R.drawable.ic_repeat_white_24dp)
|
||||||
repeatButton.setColorFilter(lastDisabledPlaybackControlsColor, PorterDuff.Mode.SRC_IN)
|
repeatButton.setColorFilter(
|
||||||
|
lastDisabledPlaybackControlsColor,
|
||||||
|
PorterDuff.Mode.SRC_IN
|
||||||
|
)
|
||||||
}
|
}
|
||||||
MusicService.REPEAT_MODE_ALL -> {
|
MusicService.REPEAT_MODE_ALL -> {
|
||||||
repeatButton.setImageResource(R.drawable.ic_repeat_white_24dp)
|
repeatButton.setImageResource(R.drawable.ic_repeat_white_24dp)
|
||||||
|
|
|
@ -43,23 +43,14 @@ import code.name.monkey.retromusic.views.SeekArc
|
||||||
import code.name.monkey.retromusic.views.SeekArc.OnSeekArcChangeListener
|
import code.name.monkey.retromusic.views.SeekArc.OnSeekArcChangeListener
|
||||||
import code.name.monkey.retromusic.volume.AudioVolumeObserver
|
import code.name.monkey.retromusic.volume.AudioVolumeObserver
|
||||||
import code.name.monkey.retromusic.volume.OnAudioVolumeChangedListener
|
import code.name.monkey.retromusic.volume.OnAudioVolumeChangedListener
|
||||||
import kotlinx.android.synthetic.main.fragment_circle_player.nextButton
|
import kotlinx.android.synthetic.main.fragment_circle_player.*
|
||||||
import kotlinx.android.synthetic.main.fragment_circle_player.playPauseButton
|
|
||||||
import kotlinx.android.synthetic.main.fragment_circle_player.playerToolbar
|
|
||||||
import kotlinx.android.synthetic.main.fragment_circle_player.previousButton
|
|
||||||
import kotlinx.android.synthetic.main.fragment_circle_player.progressSlider
|
|
||||||
import kotlinx.android.synthetic.main.fragment_circle_player.songCurrentProgress
|
|
||||||
import kotlinx.android.synthetic.main.fragment_circle_player.songInfo
|
|
||||||
import kotlinx.android.synthetic.main.fragment_circle_player.songTotalTime
|
|
||||||
import kotlinx.android.synthetic.main.fragment_circle_player.text
|
|
||||||
import kotlinx.android.synthetic.main.fragment_circle_player.title
|
|
||||||
import kotlinx.android.synthetic.main.fragment_circle_player.volumeSeekBar
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by hemanths on 2020-01-06.
|
* Created by hemanths on 2020-01-06.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class CirclePlayerFragment : AbsPlayerFragment(), Callback, OnAudioVolumeChangedListener, OnSeekArcChangeListener {
|
class CirclePlayerFragment : AbsPlayerFragment(), Callback, OnAudioVolumeChangedListener,
|
||||||
|
OnSeekArcChangeListener {
|
||||||
|
|
||||||
private lateinit var progressViewUpdateHelper: MusicProgressViewUpdateHelper
|
private lateinit var progressViewUpdateHelper: MusicProgressViewUpdateHelper
|
||||||
private var audioVolumeObserver: AudioVolumeObserver? = null
|
private var audioVolumeObserver: AudioVolumeObserver? = null
|
||||||
|
@ -72,7 +63,11 @@ class CirclePlayerFragment : AbsPlayerFragment(), Callback, OnAudioVolumeChanged
|
||||||
progressViewUpdateHelper = MusicProgressViewUpdateHelper(this)
|
progressViewUpdateHelper = MusicProgressViewUpdateHelper(this)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {
|
override fun onCreateView(
|
||||||
|
inflater: LayoutInflater,
|
||||||
|
container: ViewGroup?,
|
||||||
|
savedInstanceState: Bundle?
|
||||||
|
): View? {
|
||||||
return inflater.inflate(R.layout.fragment_circle_player, container, false)
|
return inflater.inflate(R.layout.fragment_circle_player, container, false)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -97,7 +92,11 @@ class CirclePlayerFragment : AbsPlayerFragment(), Callback, OnAudioVolumeChanged
|
||||||
|
|
||||||
private fun setupViews() {
|
private fun setupViews() {
|
||||||
setUpProgressSlider()
|
setUpProgressSlider()
|
||||||
ViewUtil.setProgressDrawable(progressSlider, ThemeStore.accentColor(requireContext()))
|
ViewUtil.setProgressDrawable(
|
||||||
|
progressSlider,
|
||||||
|
ThemeStore.accentColor(requireContext()),
|
||||||
|
false
|
||||||
|
)
|
||||||
volumeSeekBar.progressColor = ThemeStore.accentColor(requireContext())
|
volumeSeekBar.progressColor = ThemeStore.accentColor(requireContext())
|
||||||
setUpPlayPauseFab()
|
setUpPlayPauseFab()
|
||||||
setUpPrevNext()
|
setUpPrevNext()
|
||||||
|
@ -155,7 +154,8 @@ class CirclePlayerFragment : AbsPlayerFragment(), Callback, OnAudioVolumeChanged
|
||||||
|
|
||||||
override fun onBackPressed(): Boolean = false
|
override fun onBackPressed(): Boolean = false
|
||||||
|
|
||||||
override fun toolbarIconColor(): Int = ATHUtil.resolveColor(requireContext(), android.R.attr.colorControlNormal)
|
override fun toolbarIconColor(): Int =
|
||||||
|
ATHUtil.resolveColor(requireContext(), android.R.attr.colorControlNormal)
|
||||||
|
|
||||||
override val paletteColor: Int
|
override val paletteColor: Int
|
||||||
get() = Color.BLACK
|
get() = Color.BLACK
|
||||||
|
|
|
@ -22,9 +22,7 @@ import code.name.monkey.retromusic.util.NavigationUtil
|
||||||
import code.name.monkey.retromusic.util.RetroColorUtil
|
import code.name.monkey.retromusic.util.RetroColorUtil
|
||||||
import com.bumptech.glide.Glide
|
import com.bumptech.glide.Glide
|
||||||
import com.bumptech.glide.request.animation.GlideAnimation
|
import com.bumptech.glide.request.animation.GlideAnimation
|
||||||
import kotlinx.android.synthetic.main.fragment_color_player.colorGradientBackground
|
import kotlinx.android.synthetic.main.fragment_color_player.*
|
||||||
import kotlinx.android.synthetic.main.fragment_color_player.playerImage
|
|
||||||
import kotlinx.android.synthetic.main.fragment_color_player.playerToolbar
|
|
||||||
|
|
||||||
class ColorFragment : AbsPlayerFragment() {
|
class ColorFragment : AbsPlayerFragment() {
|
||||||
|
|
||||||
|
@ -80,7 +78,11 @@ class ColorFragment : AbsPlayerFragment() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {
|
override fun onCreateView(
|
||||||
|
inflater: LayoutInflater,
|
||||||
|
container: ViewGroup?,
|
||||||
|
savedInstanceState: Bundle?
|
||||||
|
): View? {
|
||||||
return inflater.inflate(R.layout.fragment_color_player, container, false)
|
return inflater.inflate(R.layout.fragment_color_player, container, false)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -94,7 +96,8 @@ class ColorFragment : AbsPlayerFragment() {
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun setUpSubFragments() {
|
private fun setUpSubFragments() {
|
||||||
playbackControlsFragment = childFragmentManager.findFragmentById(R.id.playbackControlsFragment) as ColorPlaybackControlsFragment
|
playbackControlsFragment =
|
||||||
|
childFragmentManager.findFragmentById(R.id.playbackControlsFragment) as ColorPlaybackControlsFragment
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun setUpPlayerToolbar() {
|
private fun setUpPlayerToolbar() {
|
||||||
|
@ -102,7 +105,11 @@ class ColorFragment : AbsPlayerFragment() {
|
||||||
inflateMenu(R.menu.menu_player)
|
inflateMenu(R.menu.menu_player)
|
||||||
setNavigationOnClickListener { requireActivity().onBackPressed() }
|
setNavigationOnClickListener { requireActivity().onBackPressed() }
|
||||||
setOnMenuItemClickListener(this@ColorFragment)
|
setOnMenuItemClickListener(this@ColorFragment)
|
||||||
ToolbarContentTintHelper.colorizeToolbar(this, ATHUtil.resolveColor(requireContext(), R.attr.colorControlNormal), requireActivity())
|
ToolbarContentTintHelper.colorizeToolbar(
|
||||||
|
this,
|
||||||
|
ATHUtil.resolveColor(requireContext(), R.attr.colorControlNormal),
|
||||||
|
requireActivity()
|
||||||
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -146,7 +153,11 @@ class ColorFragment : AbsPlayerFragment() {
|
||||||
override fun onLoadFailed(e: Exception?, errorDrawable: Drawable?) {
|
override fun onLoadFailed(e: Exception?, errorDrawable: Drawable?) {
|
||||||
super.onLoadFailed(e, errorDrawable)
|
super.onLoadFailed(e, errorDrawable)
|
||||||
val backgroundColor = defaultFooterColor
|
val backgroundColor = defaultFooterColor
|
||||||
val textColor = if (ColorUtil.isColorLight(defaultFooterColor)) MaterialValueHelper.getPrimaryTextColor(requireContext(), true)
|
val textColor =
|
||||||
|
if (ColorUtil.isColorLight(defaultFooterColor)) MaterialValueHelper.getPrimaryTextColor(
|
||||||
|
requireContext(),
|
||||||
|
true
|
||||||
|
)
|
||||||
else MaterialValueHelper.getPrimaryTextColor(requireContext(), false)
|
else MaterialValueHelper.getPrimaryTextColor(requireContext(), false)
|
||||||
setColors(backgroundColor, textColor)
|
setColors(backgroundColor, textColor)
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,7 +12,7 @@ import code.name.monkey.retromusic.fragments.base.AbsPlayerFragment
|
||||||
import code.name.monkey.retromusic.fragments.player.PlayerAlbumCoverFragment
|
import code.name.monkey.retromusic.fragments.player.PlayerAlbumCoverFragment
|
||||||
import code.name.monkey.retromusic.helper.MusicPlayerRemote
|
import code.name.monkey.retromusic.helper.MusicPlayerRemote
|
||||||
import code.name.monkey.retromusic.model.Song
|
import code.name.monkey.retromusic.model.Song
|
||||||
import kotlinx.android.synthetic.main.fragment_fit.playerToolbar
|
import kotlinx.android.synthetic.main.fragment_fit.*
|
||||||
|
|
||||||
class FitFragment : AbsPlayerFragment() {
|
class FitFragment : AbsPlayerFragment() {
|
||||||
override fun playerToolbar(): Toolbar {
|
override fun playerToolbar(): Toolbar {
|
||||||
|
|
|
@ -20,8 +20,7 @@ import code.name.monkey.retromusic.model.Song
|
||||||
import code.name.monkey.retromusic.util.PreferenceUtil
|
import code.name.monkey.retromusic.util.PreferenceUtil
|
||||||
import code.name.monkey.retromusic.util.ViewUtil
|
import code.name.monkey.retromusic.util.ViewUtil
|
||||||
import code.name.monkey.retromusic.views.DrawableGradient
|
import code.name.monkey.retromusic.views.DrawableGradient
|
||||||
import kotlinx.android.synthetic.main.fragment_flat_player.colorGradientBackground
|
import kotlinx.android.synthetic.main.fragment_flat_player.*
|
||||||
import kotlinx.android.synthetic.main.fragment_flat_player.playerToolbar
|
|
||||||
|
|
||||||
class FlatPlayerFragment : AbsPlayerFragment() {
|
class FlatPlayerFragment : AbsPlayerFragment() {
|
||||||
override fun playerToolbar(): Toolbar {
|
override fun playerToolbar(): Toolbar {
|
||||||
|
|
|
@ -25,10 +25,7 @@ import code.name.monkey.retromusic.model.lyrics.AbsSynchronizedLyrics
|
||||||
import code.name.monkey.retromusic.model.lyrics.Lyrics
|
import code.name.monkey.retromusic.model.lyrics.Lyrics
|
||||||
import code.name.monkey.retromusic.util.NavigationUtil
|
import code.name.monkey.retromusic.util.NavigationUtil
|
||||||
import com.bumptech.glide.Glide
|
import com.bumptech.glide.Glide
|
||||||
import kotlinx.android.synthetic.main.fragment_full.artistImage
|
import kotlinx.android.synthetic.main.fragment_full.*
|
||||||
import kotlinx.android.synthetic.main.fragment_full.nextSong
|
|
||||||
import kotlinx.android.synthetic.main.fragment_full.nextSongLabel
|
|
||||||
import kotlinx.android.synthetic.main.fragment_full.playerToolbar
|
|
||||||
import kotlinx.coroutines.CoroutineScope
|
import kotlinx.coroutines.CoroutineScope
|
||||||
import kotlinx.coroutines.Dispatchers
|
import kotlinx.coroutines.Dispatchers
|
||||||
import kotlinx.coroutines.launch
|
import kotlinx.coroutines.launch
|
||||||
|
@ -67,7 +64,10 @@ class FullPlayerFragment : AbsPlayerFragment(), MusicProgressViewUpdateHelper.Ca
|
||||||
lyricsLine2.visibility = View.VISIBLE
|
lyricsLine2.visibility = View.VISIBLE
|
||||||
|
|
||||||
lyricsLine2.measure(
|
lyricsLine2.measure(
|
||||||
View.MeasureSpec.makeMeasureSpec(lyricsLine2.measuredWidth, View.MeasureSpec.EXACTLY),
|
View.MeasureSpec.makeMeasureSpec(
|
||||||
|
lyricsLine2.measuredWidth,
|
||||||
|
View.MeasureSpec.EXACTLY
|
||||||
|
),
|
||||||
View.MeasureSpec.UNSPECIFIED
|
View.MeasureSpec.UNSPECIFIED
|
||||||
)
|
)
|
||||||
val h: Float = lyricsLine2.measuredHeight.toFloat()
|
val h: Float = lyricsLine2.measuredHeight.toFloat()
|
||||||
|
@ -91,7 +91,8 @@ class FullPlayerFragment : AbsPlayerFragment(), MusicProgressViewUpdateHelper.Ca
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun hideLyricsLayout() {
|
private fun hideLyricsLayout() {
|
||||||
lyricsLayout.animate().alpha(0f).setDuration(VISIBILITY_ANIM_DURATION).withEndAction(Runnable {
|
lyricsLayout.animate().alpha(0f).setDuration(VISIBILITY_ANIM_DURATION)
|
||||||
|
.withEndAction(Runnable {
|
||||||
if (!isLyricsLayoutBound()) return@Runnable
|
if (!isLyricsLayoutBound()) return@Runnable
|
||||||
lyricsLayout.visibility = View.GONE
|
lyricsLayout.visibility = View.GONE
|
||||||
lyricsLine1.text = null
|
lyricsLine1.text = null
|
||||||
|
@ -158,7 +159,11 @@ class FullPlayerFragment : AbsPlayerFragment(), MusicProgressViewUpdateHelper.Ca
|
||||||
val transitionName =
|
val transitionName =
|
||||||
"${getString(R.string.transition_artist_image)}_${MusicPlayerRemote.currentSong.artistId}"
|
"${getString(R.string.transition_artist_image)}_${MusicPlayerRemote.currentSong.artistId}"
|
||||||
val activityOptions =
|
val activityOptions =
|
||||||
ActivityOptions.makeSceneTransitionAnimation(requireActivity(), artistImage, transitionName)
|
ActivityOptions.makeSceneTransitionAnimation(
|
||||||
|
requireActivity(),
|
||||||
|
artistImage,
|
||||||
|
transitionName
|
||||||
|
)
|
||||||
NavigationUtil.goToArtistOptions(
|
NavigationUtil.goToArtistOptions(
|
||||||
requireActivity(),
|
requireActivity(),
|
||||||
MusicPlayerRemote.currentSong.artistId,
|
MusicPlayerRemote.currentSong.artistId,
|
||||||
|
@ -229,7 +234,8 @@ class FullPlayerFragment : AbsPlayerFragment(), MusicProgressViewUpdateHelper.Ca
|
||||||
|
|
||||||
private fun updateArtistImage() {
|
private fun updateArtistImage() {
|
||||||
CoroutineScope(Dispatchers.IO).launch {
|
CoroutineScope(Dispatchers.IO).launch {
|
||||||
val artist = ArtistLoader.getArtist(requireContext(), MusicPlayerRemote.currentSong.artistId)
|
val artist =
|
||||||
|
ArtistLoader.getArtist(requireContext(), MusicPlayerRemote.currentSong.artistId)
|
||||||
withContext(Dispatchers.Main) {
|
withContext(Dispatchers.Main) {
|
||||||
ArtistGlideRequest.Builder.from(Glide.with(requireContext()), artist)
|
ArtistGlideRequest.Builder.from(Glide.with(requireContext()), artist)
|
||||||
.generatePalette(requireContext())
|
.generatePalette(requireContext())
|
||||||
|
|
|
@ -39,16 +39,7 @@ import code.name.monkey.retromusic.service.MusicService
|
||||||
import code.name.monkey.retromusic.util.MusicUtil
|
import code.name.monkey.retromusic.util.MusicUtil
|
||||||
import code.name.monkey.retromusic.util.PreferenceUtil
|
import code.name.monkey.retromusic.util.PreferenceUtil
|
||||||
import code.name.monkey.retromusic.util.ViewUtil
|
import code.name.monkey.retromusic.util.ViewUtil
|
||||||
import kotlinx.android.synthetic.main.fragment_lock_screen_playback_controls.nextButton
|
import kotlinx.android.synthetic.main.fragment_lock_screen_playback_controls.*
|
||||||
import kotlinx.android.synthetic.main.fragment_lock_screen_playback_controls.playPauseButton
|
|
||||||
import kotlinx.android.synthetic.main.fragment_lock_screen_playback_controls.previousButton
|
|
||||||
import kotlinx.android.synthetic.main.fragment_lock_screen_playback_controls.progressSlider
|
|
||||||
import kotlinx.android.synthetic.main.fragment_lock_screen_playback_controls.repeatButton
|
|
||||||
import kotlinx.android.synthetic.main.fragment_lock_screen_playback_controls.shuffleButton
|
|
||||||
import kotlinx.android.synthetic.main.fragment_lock_screen_playback_controls.songCurrentProgress
|
|
||||||
import kotlinx.android.synthetic.main.fragment_lock_screen_playback_controls.songTotalTime
|
|
||||||
import kotlinx.android.synthetic.main.fragment_lock_screen_playback_controls.text
|
|
||||||
import kotlinx.android.synthetic.main.fragment_lock_screen_playback_controls.title
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Hemanth S (h4h13).
|
* @author Hemanth S (h4h13).
|
||||||
|
@ -122,11 +113,13 @@ class LockScreenPlayerControlsFragment : AbsPlayerControlsFragment() {
|
||||||
|
|
||||||
val colorBg = ATHUtil.resolveColor(requireContext(), android.R.attr.colorBackground)
|
val colorBg = ATHUtil.resolveColor(requireContext(), android.R.attr.colorBackground)
|
||||||
if (ColorUtil.isColorLight(colorBg)) {
|
if (ColorUtil.isColorLight(colorBg)) {
|
||||||
lastPlaybackControlsColor = MaterialValueHelper.getSecondaryTextColor(requireContext(), true)
|
lastPlaybackControlsColor =
|
||||||
|
MaterialValueHelper.getSecondaryTextColor(requireContext(), true)
|
||||||
lastDisabledPlaybackControlsColor =
|
lastDisabledPlaybackControlsColor =
|
||||||
MaterialValueHelper.getSecondaryDisabledTextColor(requireContext(), true)
|
MaterialValueHelper.getSecondaryDisabledTextColor(requireContext(), true)
|
||||||
} else {
|
} else {
|
||||||
lastPlaybackControlsColor = MaterialValueHelper.getPrimaryTextColor(requireContext(), false)
|
lastPlaybackControlsColor =
|
||||||
|
MaterialValueHelper.getPrimaryTextColor(requireContext(), false)
|
||||||
lastDisabledPlaybackControlsColor =
|
lastDisabledPlaybackControlsColor =
|
||||||
MaterialValueHelper.getPrimaryDisabledTextColor(requireContext(), false)
|
MaterialValueHelper.getPrimaryDisabledTextColor(requireContext(), false)
|
||||||
}
|
}
|
||||||
|
@ -194,7 +187,10 @@ class LockScreenPlayerControlsFragment : AbsPlayerControlsFragment() {
|
||||||
lastPlaybackControlsColor,
|
lastPlaybackControlsColor,
|
||||||
PorterDuff.Mode.SRC_IN
|
PorterDuff.Mode.SRC_IN
|
||||||
)
|
)
|
||||||
else -> shuffleButton.setColorFilter(lastDisabledPlaybackControlsColor, PorterDuff.Mode.SRC_IN)
|
else -> shuffleButton.setColorFilter(
|
||||||
|
lastDisabledPlaybackControlsColor,
|
||||||
|
PorterDuff.Mode.SRC_IN
|
||||||
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -206,7 +202,10 @@ class LockScreenPlayerControlsFragment : AbsPlayerControlsFragment() {
|
||||||
when (MusicPlayerRemote.repeatMode) {
|
when (MusicPlayerRemote.repeatMode) {
|
||||||
MusicService.REPEAT_MODE_NONE -> {
|
MusicService.REPEAT_MODE_NONE -> {
|
||||||
repeatButton.setImageResource(R.drawable.ic_repeat_white_24dp)
|
repeatButton.setImageResource(R.drawable.ic_repeat_white_24dp)
|
||||||
repeatButton.setColorFilter(lastDisabledPlaybackControlsColor, PorterDuff.Mode.SRC_IN)
|
repeatButton.setColorFilter(
|
||||||
|
lastDisabledPlaybackControlsColor,
|
||||||
|
PorterDuff.Mode.SRC_IN
|
||||||
|
)
|
||||||
}
|
}
|
||||||
MusicService.REPEAT_MODE_ALL -> {
|
MusicService.REPEAT_MODE_ALL -> {
|
||||||
repeatButton.setImageResource(R.drawable.ic_repeat_white_24dp)
|
repeatButton.setImageResource(R.drawable.ic_repeat_white_24dp)
|
||||||
|
|
|
@ -13,7 +13,7 @@ import code.name.monkey.retromusic.fragments.player.PlayerAlbumCoverFragment
|
||||||
import code.name.monkey.retromusic.fragments.player.normal.PlayerFragment
|
import code.name.monkey.retromusic.fragments.player.normal.PlayerFragment
|
||||||
import code.name.monkey.retromusic.helper.MusicPlayerRemote
|
import code.name.monkey.retromusic.helper.MusicPlayerRemote
|
||||||
import code.name.monkey.retromusic.model.Song
|
import code.name.monkey.retromusic.model.Song
|
||||||
import kotlinx.android.synthetic.main.fragment_material.playerToolbar
|
import kotlinx.android.synthetic.main.fragment_material.*
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Hemanth S (h4h13).
|
* @author Hemanth S (h4h13).
|
||||||
|
|
|
@ -36,12 +36,20 @@ class PlayerFragment : AbsPlayerFragment() {
|
||||||
valueAnimator?.cancel()
|
valueAnimator?.cancel()
|
||||||
}
|
}
|
||||||
|
|
||||||
valueAnimator = ValueAnimator.ofObject(ArgbEvaluator(), ATHUtil.resolveColor(requireContext(), R.attr.colorSurface), i)
|
valueAnimator = ValueAnimator.ofObject(
|
||||||
|
ArgbEvaluator(),
|
||||||
|
ATHUtil.resolveColor(requireContext(), R.attr.colorSurface),
|
||||||
|
i
|
||||||
|
)
|
||||||
valueAnimator?.addUpdateListener { animation ->
|
valueAnimator?.addUpdateListener { animation ->
|
||||||
if (isAdded) {
|
if (isAdded) {
|
||||||
val drawable = DrawableGradient(GradientDrawable.Orientation.TOP_BOTTOM,
|
val drawable = DrawableGradient(
|
||||||
intArrayOf(animation.animatedValue as Int,
|
GradientDrawable.Orientation.TOP_BOTTOM,
|
||||||
ATHUtil.resolveColor(requireContext(), R.attr.colorSurface)), 0)
|
intArrayOf(
|
||||||
|
animation.animatedValue as Int,
|
||||||
|
ATHUtil.resolveColor(requireContext(), R.attr.colorSurface)
|
||||||
|
), 0
|
||||||
|
)
|
||||||
colorGradientBackground?.background = drawable
|
colorGradientBackground?.background = drawable
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -70,7 +78,11 @@ class PlayerFragment : AbsPlayerFragment() {
|
||||||
lastColor = color
|
lastColor = color
|
||||||
callbacks?.onPaletteColorChanged()
|
callbacks?.onPaletteColorChanged()
|
||||||
|
|
||||||
ToolbarContentTintHelper.colorizeToolbar(playerToolbar, ATHUtil.resolveColor(context, R.attr.colorControlNormal), requireActivity())
|
ToolbarContentTintHelper.colorizeToolbar(
|
||||||
|
playerToolbar,
|
||||||
|
ATHUtil.resolveColor(context, R.attr.colorControlNormal),
|
||||||
|
requireActivity()
|
||||||
|
)
|
||||||
|
|
||||||
if (PreferenceUtil.getInstance(requireContext()).adaptiveColor) {
|
if (PreferenceUtil.getInstance(requireContext()).adaptiveColor) {
|
||||||
colorize(color)
|
colorize(color)
|
||||||
|
@ -89,8 +101,10 @@ class PlayerFragment : AbsPlayerFragment() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?,
|
override fun onCreateView(
|
||||||
savedInstanceState: Bundle?): View? {
|
inflater: LayoutInflater, container: ViewGroup?,
|
||||||
|
savedInstanceState: Bundle?
|
||||||
|
): View? {
|
||||||
|
|
||||||
return inflater.inflate(R.layout.fragment_player, container, false)
|
return inflater.inflate(R.layout.fragment_player, container, false)
|
||||||
}
|
}
|
||||||
|
@ -103,8 +117,10 @@ class PlayerFragment : AbsPlayerFragment() {
|
||||||
|
|
||||||
|
|
||||||
private fun setUpSubFragments() {
|
private fun setUpSubFragments() {
|
||||||
playbackControlsFragment = childFragmentManager.findFragmentById(R.id.playbackControlsFragment) as PlayerPlaybackControlsFragment
|
playbackControlsFragment =
|
||||||
val playerAlbumCoverFragment = childFragmentManager.findFragmentById(R.id.playerAlbumCoverFragment) as PlayerAlbumCoverFragment
|
childFragmentManager.findFragmentById(R.id.playbackControlsFragment) as PlayerPlaybackControlsFragment
|
||||||
|
val playerAlbumCoverFragment =
|
||||||
|
childFragmentManager.findFragmentById(R.id.playerAlbumCoverFragment) as PlayerAlbumCoverFragment
|
||||||
playerAlbumCoverFragment.setCallbacks(this)
|
playerAlbumCoverFragment.setCallbacks(this)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -113,7 +129,11 @@ class PlayerFragment : AbsPlayerFragment() {
|
||||||
playerToolbar.setNavigationOnClickListener { requireActivity().onBackPressed() }
|
playerToolbar.setNavigationOnClickListener { requireActivity().onBackPressed() }
|
||||||
playerToolbar.setOnMenuItemClickListener(this)
|
playerToolbar.setOnMenuItemClickListener(this)
|
||||||
|
|
||||||
ToolbarContentTintHelper.colorizeToolbar(playerToolbar, ATHUtil.resolveColor(context, R.attr.colorControlNormal), requireActivity())
|
ToolbarContentTintHelper.colorizeToolbar(
|
||||||
|
playerToolbar,
|
||||||
|
ATHUtil.resolveColor(context, R.attr.colorControlNormal),
|
||||||
|
requireActivity()
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onServiceConnected() {
|
override fun onServiceConnected() {
|
||||||
|
|
|
@ -31,11 +31,7 @@ import code.name.monkey.retromusic.helper.MusicPlayerRemote
|
||||||
import code.name.monkey.retromusic.util.NavigationUtil
|
import code.name.monkey.retromusic.util.NavigationUtil
|
||||||
import code.name.monkey.retromusic.util.PreferenceUtil
|
import code.name.monkey.retromusic.util.PreferenceUtil
|
||||||
import com.bumptech.glide.Glide
|
import com.bumptech.glide.Glide
|
||||||
import kotlinx.android.synthetic.main.fragment_peak_player.playerImage
|
import kotlinx.android.synthetic.main.fragment_peak_player.*
|
||||||
import kotlinx.android.synthetic.main.fragment_peak_player.playerToolbar
|
|
||||||
import kotlinx.android.synthetic.main.fragment_peak_player.songInfo
|
|
||||||
import kotlinx.android.synthetic.main.fragment_peak_player.text
|
|
||||||
import kotlinx.android.synthetic.main.fragment_peak_player.title
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by hemanths on 2019-10-03.
|
* Created by hemanths on 2019-10-03.
|
||||||
|
@ -46,7 +42,11 @@ class PeakPlayerFragment : AbsPlayerFragment() {
|
||||||
private lateinit var playbackControlsFragment: PeakPlayerControlFragment
|
private lateinit var playbackControlsFragment: PeakPlayerControlFragment
|
||||||
private var lastColor: Int = 0
|
private var lastColor: Int = 0
|
||||||
|
|
||||||
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {
|
override fun onCreateView(
|
||||||
|
inflater: LayoutInflater,
|
||||||
|
container: ViewGroup?,
|
||||||
|
savedInstanceState: Bundle?
|
||||||
|
): View? {
|
||||||
return inflater.inflate(R.layout.fragment_peak_player, container, false)
|
return inflater.inflate(R.layout.fragment_peak_player, container, false)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue