WIP theme

This commit is contained in:
h4h13 2019-12-01 20:57:01 +05:30
parent bb72a16b84
commit 9f1e6cb98e
87 changed files with 1694 additions and 1697 deletions

View file

@ -4,10 +4,12 @@ import android.content.Intent
import android.content.pm.PackageManager
import android.net.Uri
import android.os.Bundle
import android.view.*
import android.view.MenuItem
import android.view.View
import androidx.core.app.ShareCompat
import androidx.recyclerview.widget.*
import code.name.monkey.appthemehelper.util.*
import androidx.recyclerview.widget.DefaultItemAnimator
import androidx.recyclerview.widget.LinearLayoutManager
import code.name.monkey.appthemehelper.util.ToolbarContentTintHelper
import code.name.monkey.retromusic.Constants.APP_INSTAGRAM_LINK
import code.name.monkey.retromusic.Constants.APP_TELEGRAM_LINK
import code.name.monkey.retromusic.Constants.APP_TWITTER_LINK
@ -20,9 +22,12 @@ import code.name.monkey.retromusic.Constants.TRANSLATE
import code.name.monkey.retromusic.R
import code.name.monkey.retromusic.activities.base.AbsBaseActivity
import code.name.monkey.retromusic.adapter.ContributorAdapter
import code.name.monkey.retromusic.extensions.surfaceColor
import code.name.monkey.retromusic.model.Contributor
import code.name.monkey.retromusic.util.*
import com.afollestad.materialdialogs.*
import code.name.monkey.retromusic.util.NavigationUtil
import code.name.monkey.retromusic.util.PreferenceUtil
import com.afollestad.materialdialogs.LayoutMode
import com.afollestad.materialdialogs.MaterialDialog
import com.afollestad.materialdialogs.bottomsheets.BottomSheet
import com.afollestad.materialdialogs.list.listItems
import com.google.gson.Gson
@ -62,11 +67,11 @@ class AboutActivity : AbsBaseActivity(), View.OnClickListener {
setNavigationBarColorPrimary()
setLightNavigationBar(true)
loadContributors()
setSupportActionBar(toolbar)
toolbar.apply {
setTitleTextColor(ATHUtil.resolveColor(this@AboutActivity, R.attr.colorOnPrimary))
setBackgroundColor(ATHUtil.resolveColor(this@AboutActivity, R.attr.colorPrimary))
setBackgroundColor(surfaceColor(context))
setNavigationOnClickListener { onBackPressed() }
ToolbarContentTintHelper.colorBackButton(toolbar)
}

View file

@ -2,7 +2,6 @@ package code.name.monkey.retromusic.activities
import android.app.ActivityOptions
import android.content.Intent
import android.graphics.Color
import android.os.Bundle
import android.view.Menu
import android.view.MenuItem
@ -15,7 +14,7 @@ import androidx.recyclerview.widget.GridLayoutManager
import androidx.recyclerview.widget.LinearLayoutManager
import code.name.monkey.appthemehelper.ThemeStore
import code.name.monkey.appthemehelper.util.ATHUtil
import code.name.monkey.appthemehelper.util.ColorUtil
import code.name.monkey.appthemehelper.util.MaterialUtil
import code.name.monkey.retromusic.App
import code.name.monkey.retromusic.R
import code.name.monkey.retromusic.activities.base.AbsSlidingMusicPanelActivity
@ -44,6 +43,7 @@ import com.afollestad.materialcab.MaterialCab
import com.bumptech.glide.Glide
import kotlinx.android.synthetic.main.activity_album.*
import kotlinx.android.synthetic.main.activity_album_content.*
import kotlinx.android.synthetic.main.status_bar.*
import java.util.*
import javax.inject.Inject
import android.util.Pair as UtilPair
@ -80,11 +80,10 @@ class AlbumDetailsActivity : AbsSlidingMusicPanelActivity(), AlbumDetailsView, C
setDrawUnderStatusBar()
super.onCreate(savedInstanceState)
toggleBottomNavigationView(true)
setStatusbarColor(Color.TRANSPARENT)
setStatusbarColorAuto()
setNavigationbarColorAuto()
setTaskDescriptionColorAuto()
setLightNavigationBar(true)
setLightStatusbar(ColorUtil.isColorLight(ATHUtil.resolveColor(this, R.attr.colorPrimary)))
ActivityCompat.postponeEnterTransition(this)
@ -191,18 +190,20 @@ class AlbumDetailsActivity : AbsSlidingMusicPanelActivity(), AlbumDetailsView, C
val themeColor = if (PreferenceUtil.getInstance(this).adaptiveColor) color
else ThemeStore.accentColor(this)
songTitle.setTextColor(ThemeStore.accentColor(this))
moreTitle.setTextColor(ThemeStore.accentColor(this))
songTitle.setTextColor(themeColor)
moreTitle.setTextColor(themeColor)
val buttonColor = if (PreferenceUtil.getInstance(this).adaptiveColor)
color
else
ATHUtil.resolveColor(this, R.attr.cardBackgroundColor)
ATHUtil.resolveColor(this, R.attr.colorControlNormal)
//MaterialUtil.setTint(button = shuffleAction, color = buttonColor)
//MaterialUtil.setTint(button = playAction, color = buttonColor)
MaterialUtil.setTint(button = shuffleAction, color = buttonColor)
MaterialUtil.setTint(button = playAction, color = buttonColor)
toolbar.setBackgroundColor(ATHUtil.resolveColor(this, R.attr.colorPrimary))
val toolbarColor = ATHUtil.resolveColor(this, R.attr.colorSurface)
status_bar.setBackgroundColor(toolbarColor)
toolbar.setBackgroundColor(toolbarColor)
setSupportActionBar(toolbar)
supportActionBar?.title = null
}

View file

@ -2,7 +2,6 @@ package code.name.monkey.retromusic.activities
import android.app.Activity
import android.content.Intent
import android.graphics.Color
import android.os.Build
import android.os.Bundle
import android.text.Html
@ -17,7 +16,6 @@ import androidx.recyclerview.widget.GridLayoutManager
import androidx.recyclerview.widget.LinearLayoutManager
import code.name.monkey.appthemehelper.ThemeStore
import code.name.monkey.appthemehelper.util.ATHUtil
import code.name.monkey.appthemehelper.util.ColorUtil
import code.name.monkey.appthemehelper.util.MaterialUtil
import code.name.monkey.retromusic.App
import code.name.monkey.retromusic.R
@ -39,6 +37,7 @@ import com.afollestad.materialcab.MaterialCab
import com.bumptech.glide.Glide
import kotlinx.android.synthetic.main.activity_artist_content.*
import kotlinx.android.synthetic.main.activity_artist_details.*
import kotlinx.android.synthetic.main.status_bar.*
import java.util.*
import javax.inject.Inject
import kotlin.collections.ArrayList
@ -74,11 +73,10 @@ class ArtistDetailActivity : AbsSlidingMusicPanelActivity(), ArtistDetailsView,
setDrawUnderStatusBar()
super.onCreate(savedInstanceState)
toggleBottomNavigationView(true)
setStatusbarColor(Color.TRANSPARENT)
setStatusbarColorAuto()
setNavigationbarColorAuto()
setTaskDescriptionColorAuto()
setLightNavigationBar(true)
setLightStatusbar(ColorUtil.isColorLight(ATHUtil.resolveColor(this, R.attr.colorPrimary)))
ActivityCompat.postponeEnterTransition(this)
@ -240,7 +238,10 @@ class ArtistDetailActivity : AbsSlidingMusicPanelActivity(), ArtistDetailsView,
MaterialUtil.setTint(button = shuffleAction, color = buttonColor)
MaterialUtil.setTint(button = playAction, color = buttonColor)
toolbar.setBackgroundColor(ATHUtil.resolveColor(this, R.attr.colorPrimary))
val toolbarColor = ATHUtil.resolveColor(this, R.attr.colorSurface)
status_bar.setBackgroundColor(toolbarColor)
toolbar.setBackgroundColor(toolbarColor)
setSupportActionBar(toolbar)
supportActionBar?.title = null
}

View file

@ -1,19 +1,25 @@
package code.name.monkey.retromusic.activities
import android.graphics.Color
import android.os.Bundle
import android.view.*
import androidx.recyclerview.widget.*
import code.name.monkey.appthemehelper.util.*
import code.name.monkey.retromusic.*
import android.view.Menu
import android.view.MenuItem
import android.view.View
import androidx.recyclerview.widget.DefaultItemAnimator
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
import code.name.monkey.appthemehelper.util.ATHUtil
import code.name.monkey.retromusic.App
import code.name.monkey.retromusic.R
import code.name.monkey.retromusic.activities.base.AbsSlidingMusicPanelActivity
import code.name.monkey.retromusic.adapter.song.ShuffleButtonSongAdapter
import code.name.monkey.retromusic.extensions.applyToolbar
import code.name.monkey.retromusic.helper.menu.GenreMenuHelper
import code.name.monkey.retromusic.interfaces.CabHolder
import code.name.monkey.retromusic.model.*
import code.name.monkey.retromusic.mvp.presenter.*
import code.name.monkey.retromusic.util.*
import code.name.monkey.retromusic.model.Genre
import code.name.monkey.retromusic.model.Song
import code.name.monkey.retromusic.mvp.presenter.GenreDetailsPresenter
import code.name.monkey.retromusic.mvp.presenter.GenreDetailsView
import code.name.monkey.retromusic.util.RetroColorUtil
import code.name.monkey.retromusic.util.ViewUtil
import com.afollestad.materialcab.MaterialCab
import kotlinx.android.synthetic.main.activity_playlist_detail.*
@ -26,127 +32,123 @@ import javax.inject.Inject
class GenreDetailsActivity : AbsSlidingMusicPanelActivity(), CabHolder, GenreDetailsView {
@Inject
lateinit var genreDetailsPresenter: GenreDetailsPresenter
@Inject
lateinit var genreDetailsPresenter: GenreDetailsPresenter
private lateinit var genre: Genre
private lateinit var songAdapter: ShuffleButtonSongAdapter
private var cab: MaterialCab? = null
private lateinit var genre: Genre
private lateinit var songAdapter: ShuffleButtonSongAdapter
private var cab: MaterialCab? = null
private fun checkIsEmpty() {
empty?.visibility = if (songAdapter.itemCount == 0) View.VISIBLE else View.GONE
}
private fun checkIsEmpty() {
empty?.visibility = if (songAdapter.itemCount == 0) View.VISIBLE else View.GONE
}
override fun onCreate(savedInstanceState: Bundle?) {
setDrawUnderStatusBar()
super.onCreate(savedInstanceState)
override fun onCreate(savedInstanceState: Bundle?) {
setDrawUnderStatusBar()
super.onCreate(savedInstanceState)
setStatusbarColorAuto()
setNavigationbarColorAuto()
setTaskDescriptionColorAuto()
setLightNavigationBar(true)
toggleBottomNavigationView(true)
setStatusbarColor(Color.TRANSPARENT)
setNavigationbarColorAuto()
setTaskDescriptionColorAuto()
setLightNavigationBar(true)
setLightStatusbar(ColorUtil.isColorLight(ATHUtil.resolveColor(this, R.attr.colorPrimary)))
toggleBottomNavigationView(true)
if (intent.extras != null) {
genre = intent?.extras?.getParcelable(EXTRA_GENRE_ID)!!
} else {
finish()
}
if (intent.extras != null) {
genre = intent?.extras?.getParcelable(EXTRA_GENRE_ID)!!
} else {
finish()
}
setUpToolBar()
setupRecyclerView()
setUpToolBar()
setupRecyclerView()
App.musicComponent.inject(this)
genreDetailsPresenter.attachView(this)
App.musicComponent.inject(this)
genreDetailsPresenter.attachView(this)
}
}
private fun setUpToolBar() {
applyToolbar(toolbar)
title = genre.name
}
private fun setUpToolBar() {
val primaryColor = ATHUtil.resolveColor(this, R.attr.colorPrimary)
appBarLayout.setBackgroundColor(primaryColor)
applyToolbar(toolbar)
title = genre.name
}
override fun onResume() {
super.onResume()
genreDetailsPresenter.loadGenreSongs(genre.id)
}
override fun onResume() {
super.onResume()
genreDetailsPresenter.loadGenreSongs(genre.id)
}
override fun onDestroy() {
super.onDestroy()
genreDetailsPresenter.detachView()
}
override fun onDestroy() {
super.onDestroy()
genreDetailsPresenter.detachView()
}
override fun createContentView(): View {
return wrapSlidingMusicPanel(R.layout.activity_playlist_detail)
}
override fun createContentView(): View {
return wrapSlidingMusicPanel(R.layout.activity_playlist_detail)
}
override fun showEmptyView() {
override fun showEmptyView() {
}
}
override fun onCreateOptionsMenu(menu: Menu): Boolean {
menuInflater.inflate(R.menu.menu_genre_detail, menu)
return super.onCreateOptionsMenu(menu)
}
override fun onCreateOptionsMenu(menu: Menu): Boolean {
menuInflater.inflate(R.menu.menu_genre_detail, menu)
return super.onCreateOptionsMenu(menu)
}
override fun onOptionsItemSelected(item: MenuItem): Boolean {
if (item.itemId == android.R.id.home) {
onBackPressed()
}
return GenreMenuHelper.handleMenuClick(this, genre, item)
}
override fun onOptionsItemSelected(item: MenuItem): Boolean {
if (item.itemId == android.R.id.home) {
onBackPressed()
}
return GenreMenuHelper.handleMenuClick(this, genre, item)
}
private fun setupRecyclerView() {
ViewUtil.setUpFastScrollRecyclerViewColor(this, recyclerView)
songAdapter = ShuffleButtonSongAdapter(this, ArrayList(), R.layout.item_list, false, this)
recyclerView.apply {
itemAnimator = DefaultItemAnimator()
layoutManager = LinearLayoutManager(this@GenreDetailsActivity)
adapter = songAdapter
}
songAdapter.registerAdapterDataObserver(object : RecyclerView.AdapterDataObserver() {
override fun onChanged() {
super.onChanged()
checkIsEmpty()
}
})
}
private fun setupRecyclerView() {
ViewUtil.setUpFastScrollRecyclerViewColor(this, recyclerView)
songAdapter = ShuffleButtonSongAdapter(this, ArrayList(), R.layout.item_list, false, this)
recyclerView.apply {
itemAnimator = DefaultItemAnimator()
layoutManager = LinearLayoutManager(this@GenreDetailsActivity)
adapter = songAdapter
}
songAdapter.registerAdapterDataObserver(object : RecyclerView.AdapterDataObserver() {
override fun onChanged() {
super.onChanged()
checkIsEmpty()
}
})
}
override fun songs(songs: ArrayList<Song>) {
songAdapter.swapDataSet(songs)
}
override fun songs(songs: ArrayList<Song>) {
songAdapter.swapDataSet(songs)
}
override fun openCab(menuRes: Int, callback: MaterialCab.Callback): MaterialCab {
if (cab != null && cab!!.isActive) cab!!.finish()
cab = MaterialCab(this, R.id.cab_stub).setMenu(menuRes)
.setCloseDrawableRes(R.drawable.ic_close_white_24dp).setBackgroundColor(
RetroColorUtil.shiftBackgroundColorForLightText(
ATHUtil.resolveColor(
this,
R.attr.colorPrimary
)
)
).start(callback)
return cab!!
}
override fun openCab(menuRes: Int, callback: MaterialCab.Callback): MaterialCab {
if (cab != null && cab!!.isActive) cab!!.finish()
cab = MaterialCab(this, R.id.cab_stub).setMenu(menuRes)
.setCloseDrawableRes(R.drawable.ic_close_white_24dp).setBackgroundColor(
RetroColorUtil.shiftBackgroundColorForLightText(
ATHUtil.resolveColor(
this,
R.attr.colorPrimary
)
)
).start(callback)
return cab!!
}
override fun onBackPressed() {
if (cab != null && cab!!.isActive) cab!!.finish()
else {
recyclerView!!.stopScroll()
super.onBackPressed()
}
}
override fun onBackPressed() {
if (cab != null && cab!!.isActive) cab!!.finish()
else {
recyclerView!!.stopScroll()
super.onBackPressed()
}
}
override fun onMediaStoreChanged() {
super.onMediaStoreChanged()
genreDetailsPresenter.loadGenreSongs(genre.id)
}
override fun onMediaStoreChanged() {
super.onMediaStoreChanged()
genreDetailsPresenter.loadGenreSongs(genre.id)
}
companion object {
const val EXTRA_GENRE_ID = "extra_genre_id"
}
companion object {
const val EXTRA_GENRE_ID = "extra_genre_id"
}
}

View file

@ -65,7 +65,7 @@ public class LicenseActivity extends AbsBaseActivity {
Toolbar toolbar = findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
ToolbarContentTintHelper.colorBackButton(toolbar);
toolbar.setBackgroundColor(INSTANCE.resolveColor(this, R.attr.colorPrimary));
toolbar.setBackgroundColor(INSTANCE.resolveColor(this, R.attr.colorSurface));
WebView webView = findViewById(R.id.license);
try {
StringBuilder buf = new StringBuilder();
@ -78,7 +78,7 @@ public class LicenseActivity extends AbsBaseActivity {
// Inject color values for WebView body background and links
final boolean isDark = INSTANCE.isWindowBackgroundDark(this);
final String backgroundColor = colorToCSS(INSTANCE.resolveColor(this, R.attr.colorPrimary, Color.parseColor(isDark ? "#424242" : "#ffffff")));
final String backgroundColor = colorToCSS(INSTANCE.resolveColor(this, android.R.attr.windowBackground, Color.parseColor(isDark ? "#424242" : "#ffffff")));
final String contentColor = colorToCSS(Color.parseColor(isDark ? "#ffffff" : "#000000"));
final String changeLog = buf.toString()
.replace("{style-placeholder}",

View file

@ -2,28 +2,44 @@ package code.name.monkey.retromusic.activities
import android.annotation.SuppressLint
import android.content.res.ColorStateList
import android.os.*
import android.text.*
import android.os.AsyncTask
import android.os.Build
import android.os.Bundle
import android.text.InputType
import android.text.TextUtils
import android.view.*
import androidx.annotation.StringRes
import androidx.core.content.ContextCompat
import androidx.fragment.app.*
import androidx.fragment.app.Fragment
import androidx.fragment.app.FragmentManager
import androidx.fragment.app.FragmentStatePagerAdapter
import androidx.viewpager.widget.ViewPager
import code.name.monkey.appthemehelper.ThemeStore
import code.name.monkey.appthemehelper.util.*
import code.name.monkey.retromusic.*
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.retromusic.App
import code.name.monkey.retromusic.R
import code.name.monkey.retromusic.activities.base.AbsMusicServiceActivity
import code.name.monkey.retromusic.activities.tageditor.WriteTagsAsyncTask
import code.name.monkey.retromusic.extensions.applyToolbar
import code.name.monkey.retromusic.fragments.base.AbsMusicServiceFragment
import code.name.monkey.retromusic.helper.*
import code.name.monkey.retromusic.lyrics.*
import code.name.monkey.retromusic.helper.MusicPlayerRemote
import code.name.monkey.retromusic.helper.MusicProgressViewUpdateHelper
import code.name.monkey.retromusic.lyrics.LrcHelper
import code.name.monkey.retromusic.lyrics.LrcView
import code.name.monkey.retromusic.model.Song
import code.name.monkey.retromusic.model.lyrics.Lyrics
import code.name.monkey.retromusic.util.*
import com.afollestad.materialdialogs.*
import code.name.monkey.retromusic.util.LyricUtil
import code.name.monkey.retromusic.util.MusicUtil
import code.name.monkey.retromusic.util.PreferenceUtil
import code.name.monkey.retromusic.util.RetroUtil
import com.afollestad.materialdialogs.LayoutMode
import com.afollestad.materialdialogs.MaterialDialog
import com.afollestad.materialdialogs.bottomsheets.BottomSheet
import com.afollestad.materialdialogs.input.*
import com.afollestad.materialdialogs.input.getInputLayout
import com.afollestad.materialdialogs.input.input
import kotlinx.android.synthetic.main.activity_lyrics.*
import kotlinx.android.synthetic.main.fragment_lyrics.*
import kotlinx.android.synthetic.main.fragment_synced.*
@ -33,393 +49,373 @@ import java.util.*
import kotlin.collections.ArrayList
class LyricsActivity : AbsMusicServiceActivity(), View.OnClickListener, ViewPager.OnPageChangeListener {
override fun onPageScrollStateChanged(state: Int) {
when (state) {
ViewPager.SCROLL_STATE_IDLE -> fab.show()
ViewPager.SCROLL_STATE_DRAGGING, ViewPager.SCROLL_STATE_SETTLING -> fab.hide()
}
}
override fun onPageScrollStateChanged(state: Int) {
when (state) {
ViewPager.SCROLL_STATE_IDLE -> fab.show()
ViewPager.SCROLL_STATE_DRAGGING, ViewPager.SCROLL_STATE_SETTLING -> fab.hide()
}
}
override fun onPageScrolled(position: Int, positionOffset: Float, positionOffsetPixels: Int) {
}
override fun onPageScrolled(position: Int, positionOffset: Float, positionOffsetPixels: Int) {
}
override fun onPageSelected(position: Int) {
PreferenceUtil.getInstance(this).lyricsOptions = position
if (position == 0) fab.text = getString(R.string.synced_lyrics)
else if (position == 1) fab.text = getString(R.string.lyrics)
}
override fun onPageSelected(position: Int) {
PreferenceUtil.getInstance(this).lyricsOptions = position
if (position == 0) fab.text = getString(R.string.synced_lyrics)
else if (position == 1) fab.text = getString(R.string.lyrics)
}
override fun onClick(v: View?) {
when (viewPager.currentItem) {
0 -> showSyncedLyrics()
1 -> showLyricsSaveDialog()
}
}
override fun onClick(v: View?) {
when (viewPager.currentItem) {
0 -> showSyncedLyrics()
1 -> showLyricsSaveDialog()
}
}
private lateinit var song: Song
private var lyricsString: String? = null
private lateinit var song: Song
private var lyricsString: String? = null
private val googleSearchLrcUrl: String
get() {
var baseUrl = "http://www.google.com/search?"
var query = song.title + "+" + song.artistName
query = "q=" + query.replace(" ", "+") + " .lrc"
baseUrl += query
return baseUrl
}
private val googleSearchLrcUrl: String
get() {
var baseUrl = "http://www.google.com/search?"
var query = song.title + "+" + song.artistName
query = "q=" + query.replace(" ", "+") + " .lrc"
baseUrl += query
return baseUrl
}
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_lyrics)
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_lyrics)
setStatusbarColorAuto()
setTaskDescriptionColorAuto()
setNavigationBarColorPrimary()
setStatusbarColorAuto()
setTaskDescriptionColorAuto()
setNavigationBarColorPrimary()
applyToolbar(toolbar)
fab.backgroundTintList = ColorStateList.valueOf(ThemeStore.accentColor(this))
ColorStateList.valueOf(MaterialValueHelper.getPrimaryTextColor(this, ColorUtil.isColorLight(ThemeStore.accentColor(this))))
.apply {
fab.setTextColor(this)
fab.iconTint = this
}
setupWakelock()
val primaryColor = ATHUtil.resolveColor(this, R.attr.colorPrimary)
appBarLayout.setBackgroundColor(primaryColor)
toolbar.apply {
setBackgroundColor(primaryColor)
navigationIcon = TintHelper.createTintedDrawable(
ContextCompat.getDrawable(
this@LyricsActivity, R.drawable.ic_keyboard_backspace_black_24dp
), ThemeStore.textColorSecondary(this@LyricsActivity)
)
setSupportActionBar(toolbar)
}
viewPager.apply {
adapter = PagerAdapter(supportFragmentManager)
currentItem = PreferenceUtil.getInstance(this@LyricsActivity).lyricsOptions
addOnPageChangeListener(this@LyricsActivity)
}
tabs.apply {
setupWithViewPager(viewPager)
setSelectedTabIndicator(
TintHelper.createTintedDrawable(
ContextCompat.getDrawable(
this@LyricsActivity, R.drawable.tab_indicator
), ThemeStore.accentColor(this@LyricsActivity)
)
)
setTabTextColors(
ThemeStore.textColorSecondary(this@LyricsActivity),
ThemeStore.accentColor(this@LyricsActivity)
)
setSelectedTabIndicatorColor(ThemeStore.accentColor(context))
}
fab.setOnClickListener(this)
}
fab.backgroundTintList = ColorStateList.valueOf(ThemeStore.accentColor(this))
ColorStateList.valueOf(
MaterialValueHelper.getPrimaryTextColor(
this, ColorUtil.isColorLight(
ThemeStore.accentColor(
this
)
)
)
).apply {
fab.setTextColor(this)
fab.iconTint = this
}
setupWakelock()
override fun onPlayingMetaChanged() {
super.onPlayingMetaChanged()
song = MusicPlayerRemote.currentSong
toolbar.title = song.title
toolbar.subtitle = song.artistName
}
viewPager.apply {
adapter = PagerAdapter(supportFragmentManager)
currentItem = PreferenceUtil.getInstance(this@LyricsActivity).lyricsOptions
addOnPageChangeListener(this@LyricsActivity)
}
override fun onServiceConnected() {
super.onServiceConnected()
song = MusicPlayerRemote.currentSong
toolbar.title = song.title
toolbar.subtitle = song.artistName
}
tabs.apply {
setupWithViewPager(viewPager)
setSelectedTabIndicator(
TintHelper.createTintedDrawable(
ContextCompat.getDrawable(
this@LyricsActivity, R.drawable.tab_indicator
), ThemeStore.accentColor(this@LyricsActivity)
)
)
setTabTextColors(
ThemeStore.textColorSecondary(this@LyricsActivity),
ThemeStore.accentColor(this@LyricsActivity)
)
setSelectedTabIndicatorColor(ThemeStore.accentColor(context))
}
fab.setOnClickListener(this)
}
private fun setupWakelock() {
window.addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON)
}
override fun onPlayingMetaChanged() {
super.onPlayingMetaChanged()
song = MusicPlayerRemote.currentSong
toolbar.title = song.title
toolbar.subtitle = song.artistName
}
override fun onOptionsItemSelected(item: MenuItem): Boolean {
if (item.itemId == android.R.id.home) {
onBackPressed()
}
return super.onOptionsItemSelected(item)
}
override fun onServiceConnected() {
super.onServiceConnected()
song = MusicPlayerRemote.currentSong
toolbar.title = song.title
toolbar.subtitle = song.artistName
}
private fun showSyncedLyrics() {
var content = ""
try {
content = LyricUtil.getStringFromFile(song.data, song.artistName)
} catch (e: Exception) {
try {
content = LyricUtil.getStringFromFile(song.title, song.artistName)
} catch (e2: Exception) {
private fun setupWakelock() {
window.addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON)
}
}
e.printStackTrace()
}
override fun onOptionsItemSelected(item: MenuItem): Boolean {
if (item.itemId == android.R.id.home) {
onBackPressed()
}
return super.onOptionsItemSelected(item)
}
val materialDialog = MaterialDialog(
this, BottomSheet(LayoutMode.WRAP_CONTENT)
).show {
title(R.string.add_time_framed_lryics)
negativeButton(R.string.action_search) {
RetroUtil.openUrl(
this@LyricsActivity, googleSearchLrcUrl
)
}
input(
hint = getString(R.string.paste_lyrics_here),
prefill = content,
inputType = InputType.TYPE_CLASS_TEXT or InputType.TYPE_TEXT_FLAG_MULTI_LINE
) { _, input ->
LyricUtil.writeLrcToLoc(song.data, song.artistName, input.toString())
}
positiveButton(android.R.string.ok) {
updateSong()
}
}
MaterialUtil.setTint(materialDialog.getInputLayout(), false)
}
private fun showSyncedLyrics() {
var content = ""
try {
content = LyricUtil.getStringFromFile(song.data, song.artistName)
} catch (e: Exception) {
try {
content = LyricUtil.getStringFromFile(song.title, song.artistName)
} catch (e2: Exception) {
private fun updateSong() {
val page = supportFragmentManager.findFragmentByTag("android:switcher:" + R.id.viewPager + ":" + viewPager.currentItem)
if (viewPager.currentItem == 0 && page != null) {
(page as BaseLyricsFragment).upDateSong()
}
}
}
e.printStackTrace()
}
private fun showLyricsSaveDialog() {
val content: String = if (lyricsString == null) {
""
} else {
lyricsString!!
}
val materialDialog = MaterialDialog(
this, BottomSheet(LayoutMode.WRAP_CONTENT)
).show {
title(R.string.add_time_framed_lryics)
negativeButton(R.string.action_search) {
RetroUtil.openUrl(
this@LyricsActivity, googleSearchLrcUrl
)
}
input(
hint = getString(R.string.paste_lyrics_here),
prefill = content,
inputType = InputType.TYPE_CLASS_TEXT or InputType.TYPE_TEXT_FLAG_MULTI_LINE
) { _, input ->
LyricUtil.writeLrcToLoc(song.data, song.artistName, input.toString())
}
positiveButton(android.R.string.ok) {
updateSong()
}
}
MaterialUtil.setTint(materialDialog.getInputLayout(), false)
}
val materialDialog = MaterialDialog(
this, BottomSheet(LayoutMode.WRAP_CONTENT)
).show {
title(R.string.add_lyrics)
negativeButton(R.string.action_search) {
RetroUtil.openUrl(
this@LyricsActivity, getGoogleSearchUrl()
)
}
input(
hint = getString(R.string.paste_lyrics_here),
prefill = content,
inputType = InputType.TYPE_CLASS_TEXT or InputType.TYPE_TEXT_FLAG_MULTI_LINE
) { _, input ->
val fieldKeyValueMap = EnumMap<FieldKey, String>(FieldKey::class.java)
fieldKeyValueMap[FieldKey.LYRICS] = input.toString()
WriteTagsAsyncTask(this@LyricsActivity).execute(
WriteTagsAsyncTask.LoadingInfo(
getSongPaths(song), fieldKeyValueMap, null
)
)
}
positiveButton(android.R.string.ok) {
updateSong()
}
}
MaterialUtil.setTint(materialDialog.getInputLayout(), false)
}
private fun updateSong() {
val page = supportFragmentManager.findFragmentByTag("android:switcher:" + R.id.viewPager + ":" + viewPager.currentItem)
if (viewPager.currentItem == 0 && page != null) {
(page as BaseLyricsFragment).upDateSong()
}
}
private fun getSongPaths(song: Song): ArrayList<String> {
val paths = ArrayList<String>(1)
paths.add(song.data)
return paths
}
private fun showLyricsSaveDialog() {
val content: String = if (lyricsString == null) {
""
} else {
lyricsString!!
}
private fun getGoogleSearchUrl(): String {
var baseUrl = "http://www.google.com/search?"
var query = song.title + "+" + song.artistName
query = "q=" + query.replace(" ", "+") + " lyrics"
baseUrl += query
return baseUrl
}
val materialDialog = MaterialDialog(
this, BottomSheet(LayoutMode.WRAP_CONTENT)
).show {
title(R.string.add_lyrics)
negativeButton(R.string.action_search) {
RetroUtil.openUrl(
this@LyricsActivity, getGoogleSearchUrl()
)
}
input(
hint = getString(R.string.paste_lyrics_here),
prefill = content,
inputType = InputType.TYPE_CLASS_TEXT or InputType.TYPE_TEXT_FLAG_MULTI_LINE
) { _, input ->
val fieldKeyValueMap = EnumMap<FieldKey, String>(FieldKey::class.java)
fieldKeyValueMap[FieldKey.LYRICS] = input.toString()
WriteTagsAsyncTask(this@LyricsActivity).execute(
WriteTagsAsyncTask.LoadingInfo(
getSongPaths(song), fieldKeyValueMap, null
)
)
}
positiveButton(android.R.string.ok) {
updateSong()
}
}
MaterialUtil.setTint(materialDialog.getInputLayout(), false)
}
class PagerAdapter(fm: FragmentManager) : FragmentStatePagerAdapter(
fm, BEHAVIOR_RESUME_ONLY_CURRENT_FRAGMENT
) {
class Tabs(
@StringRes val title: Int, val fragment: Fragment
)
private fun getSongPaths(song: Song): ArrayList<String> {
val paths = ArrayList<String>(1)
paths.add(song.data)
return paths
}
private var tabs = ArrayList<Tabs>()
private fun getGoogleSearchUrl(): String {
var baseUrl = "http://www.google.com/search?"
var query = song.title + "+" + song.artistName
query = "q=" + query.replace(" ", "+") + " lyrics"
baseUrl += query
return baseUrl
}
init {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP_MR1) {
tabs.add(Tabs(R.string.synced_lyrics, SyncedLyricsFragment()))
}
tabs.add(Tabs(R.string.normal_lyrics, OfflineLyricsFragment()))
}
class PagerAdapter(fm: FragmentManager) : FragmentStatePagerAdapter(
fm, BEHAVIOR_RESUME_ONLY_CURRENT_FRAGMENT
) {
class Tabs(
@StringRes val title: Int, val fragment: Fragment
)
override fun getItem(position: Int): Fragment {
return tabs[position].fragment
}
private var tabs = ArrayList<Tabs>()
override fun getPageTitle(position: Int): CharSequence? {
return App.getContext().getString(tabs[position].title)
}
init {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP_MR1) {
tabs.add(Tabs(R.string.synced_lyrics, SyncedLyricsFragment()))
}
tabs.add(Tabs(R.string.normal_lyrics, OfflineLyricsFragment()))
}
override fun getCount(): Int {
return tabs.size
}
override fun getItem(position: Int): Fragment {
return tabs[position].fragment
}
}
override fun getPageTitle(position: Int): CharSequence? {
return App.getContext().getString(tabs[position].title)
}
abstract class BaseLyricsFragment : AbsMusicServiceFragment() {
abstract fun upDateSong()
override fun getCount(): Int {
return tabs.size
}
override fun onPlayingMetaChanged() {
super.onPlayingMetaChanged()
upDateSong()
}
}
override fun onServiceConnected() {
super.onServiceConnected()
upDateSong()
}
abstract class BaseLyricsFragment : AbsMusicServiceFragment() {
abstract fun upDateSong()
}
override fun onPlayingMetaChanged() {
super.onPlayingMetaChanged()
upDateSong()
}
class OfflineLyricsFragment : BaseLyricsFragment() {
override fun upDateSong() {
loadSongLyrics()
}
override fun onServiceConnected() {
super.onServiceConnected()
upDateSong()
}
private var updateLyricsAsyncTask: AsyncTask<*, *, *>? = null
private var lyrics: Lyrics? = null
}
@SuppressLint("StaticFieldLeak")
private fun loadSongLyrics() {
if (updateLyricsAsyncTask != null) {
updateLyricsAsyncTask!!.cancel(false)
}
val song = MusicPlayerRemote.currentSong
updateLyricsAsyncTask = object : AsyncTask<Void?, Void?, Lyrics?>() {
override fun doInBackground(vararg params: Void?): Lyrics? {
val data = MusicUtil.getLyrics(song)
return if (TextUtils.isEmpty(data)) {
null
} else Lyrics.parse(song, data!!)
}
class OfflineLyricsFragment : BaseLyricsFragment() {
override fun upDateSong() {
loadSongLyrics()
}
override fun onPreExecute() {
super.onPreExecute()
lyrics = null
}
private var updateLyricsAsyncTask: AsyncTask<*, *, *>? = null
private var lyrics: Lyrics? = null
override fun onPostExecute(l: Lyrics?) {
lyrics = l
offlineLyrics?.visibility = View.VISIBLE
if (l == null) {
offlineLyrics?.setText(R.string.no_lyrics_found)
return
}
(activity as LyricsActivity).lyricsString = l.text
offlineLyrics?.text = l.text
}
@SuppressLint("StaticFieldLeak")
private fun loadSongLyrics() {
if (updateLyricsAsyncTask != null) {
updateLyricsAsyncTask!!.cancel(false)
}
val song = MusicPlayerRemote.currentSong
updateLyricsAsyncTask = object : AsyncTask<Void?, Void?, Lyrics?>() {
override fun doInBackground(vararg params: Void?): Lyrics? {
val data = MusicUtil.getLyrics(song)
return if (TextUtils.isEmpty(data)) {
null
} else Lyrics.parse(song, data!!)
}
override fun onCancelled(s: Lyrics?) {
onPostExecute(null)
}
}.execute()
}
override fun onPreExecute() {
super.onPreExecute()
lyrics = null
}
override fun onActivityCreated(savedInstanceState: Bundle?) {
super.onActivityCreated(savedInstanceState)
loadSongLyrics()
}
override fun onPostExecute(l: Lyrics?) {
lyrics = l
offlineLyrics?.visibility = View.VISIBLE
if (l == null) {
offlineLyrics?.setText(R.string.no_lyrics_found)
return
}
(activity as LyricsActivity).lyricsString = l.text
offlineLyrics?.text = l.text
}
override fun onDestroyView() {
super.onDestroyView()
if (updateLyricsAsyncTask != null && !updateLyricsAsyncTask!!.isCancelled) {
updateLyricsAsyncTask?.cancel(true)
}
}
override fun onCancelled(s: Lyrics?) {
onPostExecute(null)
}
}.execute()
}
override fun onCreateView(
inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?
): View? {
return inflater.inflate(R.layout.fragment_lyrics, container, false)
}
}
override fun onActivityCreated(savedInstanceState: Bundle?) {
super.onActivityCreated(savedInstanceState)
loadSongLyrics()
}
class SyncedLyricsFragment : BaseLyricsFragment(), MusicProgressViewUpdateHelper.Callback {
override fun upDateSong() {
loadLRCLyrics()
}
override fun onDestroyView() {
super.onDestroyView()
if (updateLyricsAsyncTask != null && !updateLyricsAsyncTask!!.isCancelled) {
updateLyricsAsyncTask?.cancel(true)
}
}
private lateinit var updateHelper: MusicProgressViewUpdateHelper
override fun onCreateView(
inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?
): View? {
return inflater.inflate(R.layout.fragment_synced, container, false)
}
override fun onCreateView(
inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?
): View? {
return inflater.inflate(R.layout.fragment_lyrics, container, false)
}
}
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
updateHelper = MusicProgressViewUpdateHelper(this, 500, 1000)
}
class SyncedLyricsFragment : BaseLyricsFragment(), MusicProgressViewUpdateHelper.Callback {
override fun upDateSong() {
loadLRCLyrics()
}
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
setupLyricsView()
}
private lateinit var updateHelper: MusicProgressViewUpdateHelper
override fun onCreateView(
inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?
): View? {
return inflater.inflate(R.layout.fragment_synced, container, false)
}
private fun setupLyricsView() {
lyricsView.apply {
val context = activity!!
setCurrentPlayLineColor(ThemeStore.accentColor(context))
setIndicatorTextColor(ThemeStore.accentColor(context))
setCurrentIndicateLineTextColor(ThemeStore.textColorPrimary(context))
setNoLrcTextColor(ThemeStore.textColorPrimary(context))
setOnPlayIndicatorLineListener(object : LrcView.OnPlayIndicatorLineListener {
override fun onPlay(time: Long, content: String) {
MusicPlayerRemote.seekTo(time.toInt())
}
})
}
}
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
updateHelper = MusicProgressViewUpdateHelper(this, 500, 1000)
}
override fun onResume() {
super.onResume()
updateHelper.start()
}
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
setupLyricsView()
}
override fun onPause() {
super.onPause()
updateHelper.stop()
}
private fun setupLyricsView() {
lyricsView.apply {
val context = activity!!
setCurrentPlayLineColor(ThemeStore.accentColor(context))
setIndicatorTextColor(ThemeStore.accentColor(context))
setCurrentIndicateLineTextColor(ThemeStore.textColorPrimary(context))
setNoLrcTextColor(ThemeStore.textColorPrimary(context))
setOnPlayIndicatorLineListener(object : LrcView.OnPlayIndicatorLineListener {
override fun onPlay(time: Long, content: String) {
MusicPlayerRemote.seekTo(time.toInt())
}
})
}
}
override fun onUpdateProgressViews(progress: Int, total: Int) {
lyricsView.updateTime(progress.toLong())
}
override fun onResume() {
super.onResume()
updateHelper.start()
}
private fun loadLRCLyrics() {
val song = MusicPlayerRemote.currentSong
if (LyricUtil.isLrcFile2Exist(song.data, song.artistName)) {
showLyricsLocal(LyricUtil.getLocalLyricFile(song.data, song.artistName))
} else {
if (LyricUtil.isLrcFileExist(song.title, song.artistName)) {
showLyricsLocal(LyricUtil.getLocalLyricFile(song.title, song.artistName))
}
}
}
override fun onPause() {
super.onPause()
updateHelper.stop()
}
override fun onUpdateProgressViews(progress: Int, total: Int) {
lyricsView.updateTime(progress.toLong())
}
private fun loadLRCLyrics() {
val song = MusicPlayerRemote.currentSong
if (LyricUtil.isLrcFile2Exist(song.data, song.artistName)) {
showLyricsLocal(LyricUtil.getLocalLyricFile(song.data, song.artistName))
} else {
if (LyricUtil.isLrcFileExist(song.title, song.artistName)) {
showLyricsLocal(LyricUtil.getLocalLyricFile(song.title, song.artistName))
}
}
}
private fun showLyricsLocal(file: File?) {
if (file != null) {
lyricsView.setLrcData(LrcHelper.parseLrcFromFile(file))
}
}
}
private fun showLyricsLocal(file: File?) {
if (file != null) {
lyricsView.setLrcData(LrcHelper.parseLrcFromFile(file))
}
}
}
}

View file

@ -3,15 +3,17 @@ package code.name.monkey.retromusic.activities
import android.content.res.ColorStateList
import android.os.Bundle
import android.view.MenuItem
import androidx.recyclerview.widget.*
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
import code.name.monkey.appthemehelper.ThemeStore
import code.name.monkey.appthemehelper.util.*
import code.name.monkey.appthemehelper.util.ColorUtil
import code.name.monkey.appthemehelper.util.MaterialValueHelper
import code.name.monkey.retromusic.R
import code.name.monkey.retromusic.activities.base.AbsMusicServiceActivity
import code.name.monkey.retromusic.adapter.song.PlayingQueueAdapter
import code.name.monkey.retromusic.extensions.applyToolbar
import code.name.monkey.retromusic.helper.MusicPlayerRemote
import code.name.monkey.retromusic.util.*
import code.name.monkey.retromusic.util.MusicUtil
import code.name.monkey.retromusic.util.ViewUtil
import com.h6ah4i.android.widget.advrecyclerview.animator.RefactoredDefaultItemAnimator
import com.h6ah4i.android.widget.advrecyclerview.draggable.RecyclerViewDragDropManager
@ -20,169 +22,161 @@ import kotlinx.android.synthetic.main.activity_playing_queue.*
open class PlayingQueueActivity : AbsMusicServiceActivity() {
private var wrappedAdapter: RecyclerView.Adapter<*>? = null
private var recyclerViewDragDropManager: RecyclerViewDragDropManager? = null
private var playingQueueAdapter: PlayingQueueAdapter? = null
private lateinit var linearLayoutManager: LinearLayoutManager
private var wrappedAdapter: RecyclerView.Adapter<*>? = null
private var recyclerViewDragDropManager: RecyclerViewDragDropManager? = null
private var playingQueueAdapter: PlayingQueueAdapter? = null
private lateinit var linearLayoutManager: LinearLayoutManager
private fun getUpNextAndQueueTime(): String {
val duration = MusicPlayerRemote.getQueueDurationMillis(MusicPlayerRemote.position)
private fun getUpNextAndQueueTime(): String {
val duration = MusicPlayerRemote.getQueueDurationMillis(MusicPlayerRemote.position)
return MusicUtil.buildInfoString(resources.getString(R.string.up_next), MusicUtil.getReadableDurationString(duration))
}
return MusicUtil.buildInfoString(
resources.getString(R.string.up_next), MusicUtil.getReadableDurationString(duration)
)
}
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_playing_queue)
setStatusbarColorAuto()
setNavigationBarColorPrimary()
setTaskDescriptionColorAuto()
setLightNavigationBar(true)
override fun onCreate(
savedInstanceState: Bundle?
) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_playing_queue)
setupToolbar()
setUpRecyclerView()
setStatusbarColorAuto()
setNavigationBarColorPrimary()
setTaskDescriptionColorAuto()
setLightNavigationBar(true)
clearQueue.setOnClickListener {
MusicPlayerRemote.clearQueue()
}
checkForPadding()
}
setupToolbar()
setUpRecyclerView()
override fun onOptionsItemSelected(item: MenuItem): Boolean {
return when (item.itemId) {
android.R.id.home -> {
onBackPressed()
true
}
else -> super.onOptionsItemSelected(item)
}
}
clearQueue.setOnClickListener {
MusicPlayerRemote.clearQueue()
}
checkForPadding()
}
private fun setUpRecyclerView() {
recyclerViewDragDropManager = RecyclerViewDragDropManager()
val animator = RefactoredDefaultItemAnimator()
override fun onOptionsItemSelected(item: MenuItem): Boolean {
return when (item.itemId) {
android.R.id.home -> {
onBackPressed()
true
}
else -> super.onOptionsItemSelected(item)
}
}
playingQueueAdapter = PlayingQueueAdapter(
this,
MusicPlayerRemote.playingQueue,
MusicPlayerRemote.position,
R.layout.item_queue
)
wrappedAdapter = recyclerViewDragDropManager?.createWrappedAdapter(playingQueueAdapter!!)
private fun setUpRecyclerView() {
recyclerViewDragDropManager = RecyclerViewDragDropManager()
val animator = RefactoredDefaultItemAnimator()
linearLayoutManager = LinearLayoutManager(this)
playingQueueAdapter = PlayingQueueAdapter(
this,
MusicPlayerRemote.playingQueue,
MusicPlayerRemote.position,
R.layout.item_queue
)
wrappedAdapter = recyclerViewDragDropManager?.createWrappedAdapter(playingQueueAdapter!!)
recyclerView.apply {
layoutManager = linearLayoutManager
adapter = wrappedAdapter
itemAnimator = animator
recyclerViewDragDropManager?.attachRecyclerView(this)
}
linearLayoutManager = LinearLayoutManager(this)
linearLayoutManager.scrollToPositionWithOffset(MusicPlayerRemote.position + 1, 0)
recyclerView.apply {
layoutManager = linearLayoutManager
adapter = wrappedAdapter
itemAnimator = animator
recyclerViewDragDropManager?.attachRecyclerView(this)
}
recyclerView.addOnScrollListener(object : RecyclerView.OnScrollListener() {
override fun onScrolled(recyclerView: RecyclerView, dx: Int, dy: Int) {
super.onScrolled(recyclerView, dx, dy)
if (dy > 0) {
clearQueue.shrink()
} else if (dy < 0) {
clearQueue.extend()
}
}
})
ViewUtil.setUpFastScrollRecyclerViewColor(this, recyclerView)
}
linearLayoutManager.scrollToPositionWithOffset(MusicPlayerRemote.position + 1, 0)
private fun checkForPadding() {
recyclerView.addOnScrollListener(object : RecyclerView.OnScrollListener() {
override fun onScrolled(recyclerView: RecyclerView, dx: Int, dy: Int) {
super.onScrolled(recyclerView, dx, dy)
if (dy > 0) {
clearQueue.shrink()
} else if (dy < 0) {
clearQueue.extend()
}
}
})
ViewUtil.setUpFastScrollRecyclerViewColor(this, recyclerView)
}
}
private fun checkForPadding() {
override fun onQueueChanged() {
if (MusicPlayerRemote.playingQueue.isEmpty()) {
finish()
return
}
checkForPadding()
updateQueue()
updateCurrentSong()
}
}
override fun onMediaStoreChanged() {
updateQueue()
updateCurrentSong()
}
override fun onQueueChanged() {
if (MusicPlayerRemote.playingQueue.isEmpty()) {
finish()
return
}
checkForPadding()
updateQueue()
updateCurrentSong()
}
private fun updateCurrentSong() {
playerQueueSubHeader.text = getUpNextAndQueueTime()
}
override fun onMediaStoreChanged() {
updateQueue()
updateCurrentSong()
}
override fun onPlayingMetaChanged() {
updateQueuePosition()
}
private fun updateCurrentSong() {
playerQueueSubHeader.text = getUpNextAndQueueTime()
}
private fun updateQueuePosition() {
playingQueueAdapter?.setCurrent(MusicPlayerRemote.position)
resetToCurrentPosition()
playerQueueSubHeader.text = getUpNextAndQueueTime()
}
override fun onPlayingMetaChanged() {
updateQueuePosition()
}
private fun updateQueue() {
playingQueueAdapter?.swapDataSet(MusicPlayerRemote.playingQueue, MusicPlayerRemote.position)
resetToCurrentPosition()
}
private fun updateQueuePosition() {
playingQueueAdapter?.setCurrent(MusicPlayerRemote.position)
resetToCurrentPosition()
playerQueueSubHeader.text = getUpNextAndQueueTime()
}
private fun resetToCurrentPosition() {
recyclerView.stopScroll()
linearLayoutManager.scrollToPositionWithOffset(MusicPlayerRemote.position + 1, 0)
}
private fun updateQueue() {
playingQueueAdapter?.swapDataSet(MusicPlayerRemote.playingQueue, MusicPlayerRemote.position)
resetToCurrentPosition()
}
override fun onPause() {
if (recyclerViewDragDropManager != null) {
recyclerViewDragDropManager!!.cancelDrag()
}
super.onPause()
}
private fun resetToCurrentPosition() {
recyclerView.stopScroll()
linearLayoutManager.scrollToPositionWithOffset(MusicPlayerRemote.position + 1, 0)
}
override fun onDestroy() {
if (recyclerViewDragDropManager != null) {
recyclerViewDragDropManager!!.release()
recyclerViewDragDropManager = null
}
override fun onPause() {
if (recyclerViewDragDropManager != null) {
recyclerViewDragDropManager!!.cancelDrag()
}
super.onPause()
}
if (wrappedAdapter != null) {
WrapperAdapterUtils.releaseAll(wrappedAdapter)
wrappedAdapter = null
}
playingQueueAdapter = null
super.onDestroy()
}
override fun onDestroy() {
if (recyclerViewDragDropManager != null) {
recyclerViewDragDropManager!!.release()
recyclerViewDragDropManager = null
}
private fun setupToolbar() {
playerQueueSubHeader.text = getUpNextAndQueueTime()
playerQueueSubHeader.setTextColor(ThemeStore.accentColor(this))
if (wrappedAdapter != null) {
WrapperAdapterUtils.releaseAll(wrappedAdapter)
wrappedAdapter = null
}
playingQueueAdapter = null
super.onDestroy()
}
private fun setupToolbar() {
playerQueueSubHeader.text = getUpNextAndQueueTime()
playerQueueSubHeader.setTextColor(ThemeStore.accentColor(this))
applyToolbar(toolbar)
appBarLayout.setBackgroundColor(ATHUtil.resolveColor(this, R.attr.colorPrimary))
clearQueue.backgroundTintList = ColorStateList.valueOf(ThemeStore.accentColor(this))
ColorStateList.valueOf(
MaterialValueHelper.getPrimaryTextColor(
this,
ColorUtil.isColorLight(
ThemeStore.accentColor(
this
)
)
)
).apply {
clearQueue.setTextColor(this)
clearQueue.iconTint = this
}
}
applyToolbar(toolbar)
clearQueue.backgroundTintList = ColorStateList.valueOf(ThemeStore.accentColor(this))
ColorStateList.valueOf(
MaterialValueHelper.getPrimaryTextColor(
this,
ColorUtil.isColorLight(
ThemeStore.accentColor(
this
)
)
)
).apply {
clearQueue.setTextColor(this)
clearQueue.iconTint = this
}
}
}

View file

@ -1,20 +1,29 @@
package code.name.monkey.retromusic.activities
import android.graphics.Color
import android.os.Bundle
import android.view.*
import androidx.recyclerview.widget.*
import code.name.monkey.appthemehelper.util.*
import code.name.monkey.retromusic.*
import android.view.Menu
import android.view.MenuItem
import android.view.View
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
import code.name.monkey.appthemehelper.util.ATHUtil
import code.name.monkey.retromusic.App
import code.name.monkey.retromusic.R
import code.name.monkey.retromusic.activities.base.AbsSlidingMusicPanelActivity
import code.name.monkey.retromusic.adapter.song.*
import code.name.monkey.retromusic.extensions.applyToolbar
import code.name.monkey.retromusic.adapter.song.OrderablePlaylistSongAdapter
import code.name.monkey.retromusic.adapter.song.PlaylistSongAdapter
import code.name.monkey.retromusic.adapter.song.SongAdapter
import code.name.monkey.retromusic.helper.menu.PlaylistMenuHelper
import code.name.monkey.retromusic.interfaces.CabHolder
import code.name.monkey.retromusic.loaders.PlaylistLoader
import code.name.monkey.retromusic.model.*
import code.name.monkey.retromusic.mvp.presenter.*
import code.name.monkey.retromusic.util.*
import code.name.monkey.retromusic.model.AbsCustomPlaylist
import code.name.monkey.retromusic.model.Playlist
import code.name.monkey.retromusic.model.Song
import code.name.monkey.retromusic.mvp.presenter.PlaylistSongsPresenter
import code.name.monkey.retromusic.mvp.presenter.PlaylistSongsView
import code.name.monkey.retromusic.util.DensityUtil
import code.name.monkey.retromusic.util.PlaylistsUtil
import code.name.monkey.retromusic.util.RetroColorUtil
import code.name.monkey.retromusic.util.ViewUtil
import com.afollestad.materialcab.MaterialCab
import com.h6ah4i.android.widget.advrecyclerview.animator.RefactoredDefaultItemAnimator
@ -25,217 +34,202 @@ import javax.inject.Inject
class PlaylistDetailActivity : AbsSlidingMusicPanelActivity(), CabHolder, PlaylistSongsView {
@Inject
lateinit var playlistSongsPresenter: PlaylistSongsPresenter
@Inject
lateinit var playlistSongsPresenter: PlaylistSongsPresenter
private lateinit var playlist: Playlist
private var cab: MaterialCab? = null
private lateinit var adapter: SongAdapter
private var wrappedAdapter: RecyclerView.Adapter<*>? = null
private var recyclerViewDragDropManager: RecyclerViewDragDropManager? = null
private lateinit var playlist: Playlist
private var cab: MaterialCab? = null
private lateinit var adapter: SongAdapter
private var wrappedAdapter: RecyclerView.Adapter<*>? = null
private var recyclerViewDragDropManager: RecyclerViewDragDropManager? = null
override fun onCreate(savedInstanceState: Bundle?) {
setDrawUnderStatusBar()
super.onCreate(savedInstanceState)
App.musicComponent.inject(this)
override fun onCreate(savedInstanceState: Bundle?) {
setDrawUnderStatusBar()
super.onCreate(savedInstanceState)
setStatusbarColorAuto()
setNavigationbarColorAuto()
setTaskDescriptionColorAuto()
setLightNavigationBar(true)
toggleBottomNavigationView(true)
playlistSongsPresenter.attachView(this)
App.musicComponent.inject(this)
playlistSongsPresenter.attachView(this)
setStatusbarColor(Color.TRANSPARENT)
setNavigationbarColorAuto()
setTaskDescriptionColorAuto()
setLightNavigationBar(true)
setLightStatusbar(ColorUtil.isColorLight(ATHUtil.resolveColor(this, R.attr.colorPrimary)))
if (intent.extras != null) {
playlist = intent.extras!!.getParcelable(EXTRA_PLAYLIST)!!
} else {
finish()
}
toggleBottomNavigationView(true)
setUpToolBar()
setUpRecyclerView()
}
if (intent.extras != null) {
playlist = intent.extras!!.getParcelable(EXTRA_PLAYLIST)!!
} else {
finish()
}
override fun createContentView(): View {
return wrapSlidingMusicPanel(R.layout.activity_playlist_detail)
}
setUpToolBar()
setUpRecyclerView()
}
private fun setUpRecyclerView() {
ViewUtil.setUpFastScrollRecyclerViewColor(this, recyclerView)
recyclerView.layoutManager = LinearLayoutManager(this)
if (playlist is AbsCustomPlaylist) {
adapter = PlaylistSongAdapter(this, ArrayList(), R.layout.item_list, false, this)
recyclerView.adapter = adapter
} else {
recyclerViewDragDropManager = RecyclerViewDragDropManager()
val animator = RefactoredDefaultItemAnimator()
adapter = OrderablePlaylistSongAdapter(this,
ArrayList(),
R.layout.item_list,
false,
this,
object : OrderablePlaylistSongAdapter.OnMoveItemListener {
override fun onMoveItem(fromPosition: Int, toPosition: Int) {
if (PlaylistsUtil.moveItem(this@PlaylistDetailActivity, playlist.id, fromPosition, toPosition)) {
val song = adapter.dataSet.removeAt(fromPosition)
adapter.dataSet.add(toPosition, song)
adapter.notifyItemMoved(fromPosition, toPosition)
}
}
})
wrappedAdapter = recyclerViewDragDropManager!!.createWrappedAdapter(adapter)
override fun createContentView(): View {
return wrapSlidingMusicPanel(R.layout.activity_playlist_detail)
}
recyclerView.adapter = wrappedAdapter
recyclerView.itemAnimator = animator
private fun setUpRecyclerView() {
ViewUtil.setUpFastScrollRecyclerViewColor(this, recyclerView)
recyclerView.layoutManager = LinearLayoutManager(this)
if (playlist is AbsCustomPlaylist) {
adapter = PlaylistSongAdapter(this, ArrayList(), R.layout.item_list, false, this)
recyclerView.adapter = adapter
} else {
recyclerViewDragDropManager = RecyclerViewDragDropManager()
val animator = RefactoredDefaultItemAnimator()
adapter = OrderablePlaylistSongAdapter(this,
ArrayList(),
R.layout.item_list,
false,
this,
object : OrderablePlaylistSongAdapter.OnMoveItemListener {
override fun onMoveItem(
fromPosition: Int,
toPosition: Int
) {
if (PlaylistsUtil.moveItem(
this@PlaylistDetailActivity,
playlist.id,
fromPosition,
toPosition
)) {
val song = adapter.dataSet.removeAt(
fromPosition
)
adapter.dataSet.add(toPosition, song)
adapter.notifyItemMoved(
fromPosition,
toPosition
)
}
}
})
wrappedAdapter = recyclerViewDragDropManager!!.createWrappedAdapter(adapter)
recyclerViewDragDropManager?.attachRecyclerView(recyclerView)
}
adapter.registerAdapterDataObserver(object : RecyclerView.AdapterDataObserver() {
override fun onChanged() {
super.onChanged()
checkIsEmpty()
}
})
}
recyclerView.adapter = wrappedAdapter
recyclerView.itemAnimator = animator
override fun onResume() {
super.onResume()
playlistSongsPresenter.loadPlaylistSongs(playlist)
}
recyclerViewDragDropManager?.attachRecyclerView(recyclerView)
}
adapter.registerAdapterDataObserver(object : RecyclerView.AdapterDataObserver() {
override fun onChanged() {
super.onChanged()
checkIsEmpty()
}
})
}
private fun setUpToolBar() {
toolbar.setBackgroundColor(ATHUtil.resolveColor(this, R.attr.colorSurface))
setSupportActionBar(toolbar)
title = playlist.name
}
override fun onResume() {
super.onResume()
playlistSongsPresenter.loadPlaylistSongs(playlist)
}
override fun onCreateOptionsMenu(menu: Menu): Boolean {
menuInflater.inflate(
if (playlist is AbsCustomPlaylist) R.menu.menu_smart_playlist_detail
else R.menu.menu_playlist_detail, menu
)
return super.onCreateOptionsMenu(menu)
}
private fun setUpToolBar() {
applyToolbar(toolbar)
title = playlist.name
}
override fun onOptionsItemSelected(item: MenuItem): Boolean {
when (item.itemId) {
android.R.id.home -> {
onBackPressed()
return true
}
}
return PlaylistMenuHelper.handleMenuClick(this, playlist, item)
}
override fun onCreateOptionsMenu(menu: Menu): Boolean {
menuInflater.inflate(
if (playlist is AbsCustomPlaylist) R.menu.menu_smart_playlist_detail
else R.menu.menu_playlist_detail, menu
)
return super.onCreateOptionsMenu(menu)
}
override fun openCab(menuRes: Int, callback: MaterialCab.Callback): MaterialCab {
if (cab != null && cab!!.isActive) {
cab!!.finish()
}
cab = MaterialCab(this, R.id.cab_stub).setMenu(menuRes)
.setCloseDrawableRes(R.drawable.ic_close_white_24dp).setBackgroundColor(
RetroColorUtil.shiftBackgroundColorForLightText(
ATHUtil.resolveColor(
this,
R.attr.colorPrimary
)
)
).start(callback)
return cab!!
}
override fun onOptionsItemSelected(item: MenuItem): Boolean {
when (item.itemId) {
android.R.id.home -> {
onBackPressed()
return true
}
}
return PlaylistMenuHelper.handleMenuClick(this, playlist, item)
}
override fun onBackPressed() {
if (cab != null && cab!!.isActive) {
cab!!.finish()
} else {
recyclerView!!.stopScroll()
super.onBackPressed()
}
}
override fun openCab(menuRes: Int, callback: MaterialCab.Callback): MaterialCab {
if (cab != null && cab!!.isActive) {
cab!!.finish()
}
cab = MaterialCab(this, R.id.cab_stub).setMenu(menuRes)
.setCloseDrawableRes(R.drawable.ic_close_white_24dp).setBackgroundColor(
RetroColorUtil.shiftBackgroundColorForLightText(
ATHUtil.resolveColor(
this,
R.attr.colorPrimary
)
)
).start(callback)
return cab!!
}
override fun onMediaStoreChanged() {
super.onMediaStoreChanged()
if (playlist !is AbsCustomPlaylist) {
// Playlist deleted
if (!PlaylistsUtil.doesPlaylistExist(this, playlist.id)) {
finish()
return
}
// Playlist renamed
val playlistName = PlaylistsUtil.getNameForPlaylist(this, playlist.id.toLong())
if (playlistName != playlist.name) {
playlist = PlaylistLoader.getPlaylist(this, playlist.id)
setToolbarTitle(playlist.name)
}
}
playlistSongsPresenter.loadPlaylistSongs(playlist)
}
override fun onBackPressed() {
if (cab != null && cab!!.isActive) {
cab!!.finish()
} else {
recyclerView!!.stopScroll()
super.onBackPressed()
}
}
private fun setToolbarTitle(title: String) {
supportActionBar!!.title = title
}
override fun onMediaStoreChanged() {
super.onMediaStoreChanged()
if (playlist !is AbsCustomPlaylist) {
// Playlist deleted
if (!PlaylistsUtil.doesPlaylistExist(this, playlist.id)) {
finish()
return
}
// Playlist renamed
val playlistName = PlaylistsUtil.getNameForPlaylist(this, playlist.id.toLong())
if (playlistName != playlist.name) {
playlist = PlaylistLoader.getPlaylist(this, playlist.id)
setToolbarTitle(playlist.name)
}
}
playlistSongsPresenter.loadPlaylistSongs(playlist)
}
private fun checkForPadding() {
val height = DensityUtil.dip2px(this, 52f)
recyclerView.setPadding(0, 0, 0, (height))
}
private fun setToolbarTitle(title: String) {
supportActionBar!!.title = title
}
private fun checkIsEmpty() {
checkForPadding()
empty.visibility = if (adapter.itemCount == 0) View.VISIBLE else View.GONE
emptyText.visibility = if (adapter.itemCount == 0) View.VISIBLE else View.GONE
}
private fun checkForPadding() {
val height = DensityUtil.dip2px(this, 52f)
recyclerView.setPadding(0, 0, 0, (height))
}
public override fun onPause() {
if (recyclerViewDragDropManager != null) {
recyclerViewDragDropManager!!.cancelDrag()
}
super.onPause()
}
private fun checkIsEmpty() {
checkForPadding()
empty.visibility = if (adapter.itemCount == 0) View.VISIBLE else View.GONE
emptyText.visibility = if (adapter.itemCount == 0) View.VISIBLE else View.GONE
}
override fun onDestroy() {
if (recyclerViewDragDropManager != null) {
recyclerViewDragDropManager!!.release()
recyclerViewDragDropManager = null
}
public override fun onPause() {
if (recyclerViewDragDropManager != null) {
recyclerViewDragDropManager!!.cancelDrag()
}
super.onPause()
}
if (recyclerView != null) {
recyclerView!!.itemAnimator = null
recyclerView!!.adapter = null
}
override fun onDestroy() {
if (recyclerViewDragDropManager != null) {
recyclerViewDragDropManager!!.release()
recyclerViewDragDropManager = null
}
if (wrappedAdapter != null) {
WrapperAdapterUtils.releaseAll(wrappedAdapter)
wrappedAdapter = null
}
super.onDestroy()
playlistSongsPresenter.detachView()
}
if (recyclerView != null) {
recyclerView!!.itemAnimator = null
recyclerView!!.adapter = null
}
override fun showEmptyView() {
empty.visibility = View.VISIBLE
emptyText.visibility = View.VISIBLE
}
if (wrappedAdapter != null) {
WrapperAdapterUtils.releaseAll(wrappedAdapter)
wrappedAdapter = null
}
super.onDestroy()
playlistSongsPresenter.detachView()
}
override fun songs(songs: ArrayList<Song>) {
adapter.swapDataSet(songs)
}
override fun showEmptyView() {
empty.visibility = View.VISIBLE
emptyText.visibility = View.VISIBLE
}
override fun songs(songs: ArrayList<Song>) {
adapter.swapDataSet(songs)
}
companion object {
var EXTRA_PLAYLIST = "extra_playlist"
}
companion object {
var EXTRA_PLAYLIST = "extra_playlist"
}
}

View file

@ -1,16 +1,19 @@
package code.name.monkey.retromusic.activities
import android.content.Intent
import android.os.*
import android.os.AsyncTask
import android.os.Bundle
import android.util.Log
import android.view.MenuItem
import android.widget.Toast
import code.name.monkey.appthemehelper.util.*
import code.name.monkey.retromusic.*
import code.name.monkey.appthemehelper.util.MaterialUtil
import code.name.monkey.retromusic.App
import code.name.monkey.retromusic.BuildConfig
import code.name.monkey.retromusic.R
import code.name.monkey.retromusic.activities.base.AbsBaseActivity
import code.name.monkey.retromusic.extensions.applyToolbar
import com.anjlab.android.iab.v3.*
import com.anjlab.android.iab.v3.BillingProcessor
import com.anjlab.android.iab.v3.TransactionDetails
import kotlinx.android.synthetic.main.activity_pro_version.*
import java.lang.ref.WeakReference
@ -23,16 +26,11 @@ class PurchaseActivity : AbsBaseActivity(), BillingProcessor.IBillingHandler {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_pro_version)
setDrawUnderStatusBar()
setStatusbarColorAuto()
setNavigationBarColorPrimary()
setTaskDescriptionColorAuto()
setLightNavigationBar(true)
val primaryColor = ATHUtil.resolveColor(this, R.attr.colorPrimary)
toolbar.setBackgroundColor(primaryColor)
appBarLayout.setBackgroundColor(primaryColor)
applyToolbar(toolbar)
restoreButton.isEnabled = false

View file

@ -18,7 +18,6 @@ import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
import androidx.transition.TransitionManager
import code.name.monkey.appthemehelper.ThemeStore
import code.name.monkey.appthemehelper.util.ATHUtil
import code.name.monkey.appthemehelper.util.ColorUtil
import code.name.monkey.appthemehelper.util.MaterialValueHelper
import code.name.monkey.retromusic.App
@ -125,7 +124,6 @@ class SearchActivity : AbsMusicServiceActivity(), OnQueryTextListener, TextWatch
private fun setUpToolBar() {
title = null
appBarLayout.setBackgroundColor(ATHUtil.resolveColor(this, R.attr.colorPrimary))
}
private fun search(query: String) {

View file

@ -5,7 +5,8 @@ import android.view.MenuItem
import androidx.annotation.StringRes
import androidx.fragment.app.Fragment
import androidx.transition.TransitionManager
import code.name.monkey.appthemehelper.util.*
import code.name.monkey.appthemehelper.util.ATHUtil
import code.name.monkey.appthemehelper.util.ToolbarContentTintHelper
import code.name.monkey.retromusic.R
import code.name.monkey.retromusic.activities.base.AbsBaseActivity
import code.name.monkey.retromusic.fragments.settings.MainSettingsFragment
@ -25,8 +26,7 @@ class SettingsActivity : AbsBaseActivity() {
setupToolbar()
if (savedInstanceState == null) {
fragmentManager.beginTransaction().replace(R.id.contentFrame, MainSettingsFragment())
.commit()
fragmentManager.beginTransaction().replace(R.id.contentFrame, MainSettingsFragment()).commit()
}
}
@ -34,13 +34,10 @@ class SettingsActivity : AbsBaseActivity() {
setSupportActionBar(toolbar)
setTitle(R.string.action_settings)
toolbar.apply {
setTitleTextColor(ATHUtil.resolveColor(this@SettingsActivity, R.attr.colorOnPrimary))
setBackgroundColor(ATHUtil.resolveColor(this@SettingsActivity, R.attr.colorPrimary))
setBackgroundColor(ATHUtil.resolveColor(this@SettingsActivity, R.attr.colorSurface))
setNavigationOnClickListener { onBackPressed() }
ToolbarContentTintHelper.colorBackButton(toolbar)
}
appBarLayout.setBackgroundColor(ATHUtil.resolveColor(this@SettingsActivity, R.attr.colorPrimary))
}
fun setupFragment(fragment: Fragment, @StringRes titleName: Int) {

View file

@ -2,20 +2,30 @@ package code.name.monkey.retromusic.activities
import android.content.Intent
import android.graphics.Paint
import android.os.*
import android.os.AsyncTask
import android.os.Bundle
import android.util.Log
import android.view.*
import android.widget.*
import android.view.LayoutInflater
import android.view.MenuItem
import android.view.View
import android.view.ViewGroup
import android.widget.TextView
import android.widget.Toast
import androidx.annotation.LayoutRes
import androidx.appcompat.widget.AppCompatImageView
import androidx.recyclerview.widget.*
import androidx.recyclerview.widget.DefaultItemAnimator
import androidx.recyclerview.widget.GridLayoutManager
import androidx.recyclerview.widget.RecyclerView
import code.name.monkey.appthemehelper.ThemeStore
import code.name.monkey.appthemehelper.util.*
import code.name.monkey.retromusic.*
import code.name.monkey.appthemehelper.util.ATHUtil
import code.name.monkey.appthemehelper.util.TintHelper
import code.name.monkey.retromusic.BuildConfig
import code.name.monkey.retromusic.R
import code.name.monkey.retromusic.activities.base.AbsBaseActivity
import code.name.monkey.retromusic.extensions.applyToolbar
import com.anjlab.android.iab.v3.*
import com.anjlab.android.iab.v3.BillingProcessor
import com.anjlab.android.iab.v3.SkuDetails
import com.anjlab.android.iab.v3.TransactionDetails
import kotlinx.android.synthetic.main.activity_donation.*
import java.lang.ref.WeakReference
import java.util.*
@ -61,8 +71,6 @@ class SupportDevelopmentActivity : AbsBaseActivity(), BillingProcessor.IBillingH
}
private fun setupToolbar() {
val primaryColor = ATHUtil.resolveColor(this, R.attr.colorPrimary)
appBarLayout.setBackgroundColor(primaryColor)
applyToolbar(toolbar)
}

View file

@ -1,7 +1,10 @@
package code.name.monkey.retromusic.activities
import android.app.Activity
import android.content.*
import android.content.ContentUris
import android.content.Context
import android.content.ContextWrapper
import android.content.Intent
import android.content.res.ColorStateList
import android.graphics.Bitmap
import android.net.Uri
@ -13,298 +16,266 @@ import android.text.TextUtils
import android.view.MenuItem
import android.widget.Toast
import code.name.monkey.appthemehelper.ThemeStore
import code.name.monkey.appthemehelper.util.*
import code.name.monkey.retromusic.*
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.retromusic.App
import code.name.monkey.retromusic.Constants.USER_BANNER
import code.name.monkey.retromusic.Constants.USER_PROFILE
import code.name.monkey.retromusic.R
import code.name.monkey.retromusic.activities.base.AbsBaseActivity
import code.name.monkey.retromusic.extensions.applyToolbar
import code.name.monkey.retromusic.util.*
import code.name.monkey.retromusic.util.Compressor
import code.name.monkey.retromusic.util.ImageUtil.getResizedBitmap
import com.afollestad.materialdialogs.*
import code.name.monkey.retromusic.util.PreferenceUtil
import com.afollestad.materialdialogs.LayoutMode
import com.afollestad.materialdialogs.MaterialDialog
import com.afollestad.materialdialogs.bottomsheets.BottomSheet
import com.afollestad.materialdialogs.list.listItems
import io.reactivex.android.schedulers.AndroidSchedulers
import io.reactivex.disposables.CompositeDisposable
import io.reactivex.schedulers.Schedulers
import kotlinx.android.synthetic.main.activity_user_info.*
import java.io.*
import java.io.File
import java.io.FileOutputStream
import java.io.IOException
class UserInfoActivity : AbsBaseActivity() {
private var disposable = CompositeDisposable()
private var disposable = CompositeDisposable()
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_user_info)
setStatusbarColorAuto()
setNavigationBarColorPrimary()
setTaskDescriptionColorAuto()
setLightNavigationBar(true)
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_user_info)
setStatusbarColorAuto()
setNavigationBarColorPrimary()
setTaskDescriptionColorAuto()
setLightNavigationBar(true)
setupToolbar()
applyToolbar(toolbar)
MaterialUtil.setTint(nameContainer, false)
name.setText(PreferenceUtil.getInstance(this).userName)
MaterialUtil.setTint(nameContainer, false)
name.setText(PreferenceUtil.getInstance(this).userName)
if (PreferenceUtil.getInstance(this).profileImage.isNotEmpty()) {
loadImageFromStorage(PreferenceUtil.getInstance(this).profileImage)
}
if (PreferenceUtil.getInstance(this).bannerImage.isNotEmpty()) {
loadBannerFromStorage(PreferenceUtil.getInstance(this).bannerImage)
}
userImage.setOnClickListener {
MaterialDialog(this, BottomSheet(LayoutMode.WRAP_CONTENT)).show {
title(text = getString(R.string.set_photo))
listItems(
items = listOf(
getString(R.string.new_profile_photo),
getString(R.string.remove_profile_photo)
)
) { _, position, _ ->
when (position) {
0 -> pickNewPhoto()
1 -> PreferenceUtil.getInstance(this@UserInfoActivity).saveProfileImage("")
}
}
}
}
bannerSelect.setOnClickListener {
showBannerOptions()
}
next.setOnClickListener {
val nameString = name.text.toString().trim { it <= ' ' }
if (TextUtils.isEmpty(nameString)) {
Toast.makeText(this, "Umm name is empty", Toast.LENGTH_SHORT).show()
return@setOnClickListener
}
/*val bioString = bio.text.toString().trim() { it <= ' ' }
if (TextUtils.isEmpty(bioString)) {
Toast.makeText(this, "Umm bio is empty", Toast.LENGTH_SHORT).show()
return@setOnClickListener
if (PreferenceUtil.getInstance(this).profileImage.isNotEmpty()) {
loadImageFromStorage(PreferenceUtil.getInstance(this).profileImage)
}
if (PreferenceUtil.getInstance(this).bannerImage.isNotEmpty()) {
loadBannerFromStorage(PreferenceUtil.getInstance(this).bannerImage)
}
userImage.setOnClickListener {
MaterialDialog(this, BottomSheet(LayoutMode.WRAP_CONTENT)).show {
cornerRadius(PreferenceUtil.getInstance(this@UserInfoActivity).dialogCorner)
title(text = getString(R.string.set_photo))
listItems(items = listOf(getString(R.string.new_profile_photo), getString(R.string.remove_profile_photo))) { _, position, _ ->
when (position) {
0 -> pickNewPhoto()
1 -> PreferenceUtil.getInstance(this@UserInfoActivity).saveProfileImage("")
}
}
}
}
bannerSelect.setOnClickListener {
MaterialDialog(this, BottomSheet(LayoutMode.WRAP_CONTENT)).show {
cornerRadius(PreferenceUtil.getInstance(this@UserInfoActivity).dialogCorner)
title(R.string.select_banner_photo)
listItems(items = listOf(getString(R.string.new_banner_photo), getString(R.string.remove_banner_photo)))
{ _, position, _ ->
when (position) {
0 -> selectBannerImage()
1 -> PreferenceUtil.getInstance(this@UserInfoActivity).setBannerImagePath("")
}
}
}
}
next.setOnClickListener {
val nameString = name.text.toString().trim { it <= ' ' }
if (TextUtils.isEmpty(nameString)) {
Toast.makeText(this, "Umm name is empty", Toast.LENGTH_SHORT).show()
return@setOnClickListener
}
PreferenceUtil.getInstance(this).userName = nameString
setResult(Activity.RESULT_OK)
finish()
}
next.backgroundTintList = ColorStateList.valueOf(ThemeStore.accentColor(this))
ColorStateList.valueOf(MaterialValueHelper.getPrimaryTextColor(this, ColorUtil.isColorLight(ThemeStore.accentColor(this))))
.apply {
next.setTextColor(this)
next.iconTint = this
}
}
}*/
PreferenceUtil.getInstance(this).userName = nameString
//PreferenceUtil.getInstance().userBio = bioString
setResult(Activity.RESULT_OK)
finish()
}
next.backgroundTintList = ColorStateList.valueOf(ThemeStore.accentColor(this))
ColorStateList.valueOf(
MaterialValueHelper.getPrimaryTextColor(
this,
ColorUtil.isColorLight(
ThemeStore.accentColor(
this
)
)
)
).apply {
next.setTextColor(this)
next.iconTint = this
}
}
override fun onOptionsItemSelected(item: MenuItem): Boolean {
if (item.itemId == android.R.id.home) {
onBackPressed()
}
return super.onOptionsItemSelected(item)
}
override fun onOptionsItemSelected(item: MenuItem): Boolean {
if (item.itemId == android.R.id.home) {
onBackPressed()
}
return super.onOptionsItemSelected(item)
}
private fun selectBannerImage() {
val pickImageIntent = Intent(Intent.ACTION_PICK, Media.EXTERNAL_CONTENT_URI)
pickImageIntent.type = "image/*"
//pickImageIntent.putExtra("crop", "true")
pickImageIntent.putExtra("outputX", 1290)
pickImageIntent.putExtra("outputY", 720)
pickImageIntent.putExtra("aspectX", 16)
pickImageIntent.putExtra("aspectY", 9)
pickImageIntent.putExtra("scale", true)
//intent.setAction(Intent.ACTION_GET_CONTENT);
startActivityForResult(
Intent.createChooser(pickImageIntent, "Select Picture"),
PICK_BANNER_REQUEST
)
}
private fun setupToolbar() {
val primaryColor = ATHUtil.resolveColor(this, R.attr.colorPrimary)
applyToolbar(toolbar)
appBarLayout.setBackgroundColor(primaryColor)
}
private fun pickNewPhoto() {
val pickImageIntent = Intent(Intent.ACTION_PICK, Media.EXTERNAL_CONTENT_URI)
pickImageIntent.type = "image/*"
pickImageIntent.putExtra("crop", "true")
pickImageIntent.putExtra("outputX", 512)
pickImageIntent.putExtra("outputY", 512)
pickImageIntent.putExtra("aspectX", 1)
pickImageIntent.putExtra("aspectY", 1)
pickImageIntent.putExtra("scale", true)
startActivityForResult(
Intent.createChooser(pickImageIntent, "Select Picture"),
PICK_IMAGE_REQUEST
)
}
private fun showBannerOptions() {
MaterialDialog(this, BottomSheet(LayoutMode.WRAP_CONTENT)).show {
title(R.string.select_banner_photo)
listItems(
items = listOf(
getString(R.string.new_banner_photo),
getString(R.string.remove_banner_photo)
)
) { _, position, _ ->
when (position) {
0 -> selectBannerImage()
1 -> PreferenceUtil.getInstance(this@UserInfoActivity).setBannerImagePath("")
}
}
}
}
public override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
super.onActivityResult(requestCode, resultCode, data)
if (resultCode == Activity.RESULT_OK && data != null) {
when (requestCode) {
PICK_IMAGE_REQUEST -> {
try {
data.data?.let {
val bitmap = getResizedBitmap(
getBitmap(contentResolver, it),
PROFILE_ICON_SIZE
)
val profileImagePath = saveToInternalStorage(bitmap, USER_PROFILE)
PreferenceUtil.getInstance(this).saveProfileImage(profileImagePath)
loadImageFromStorage(profileImagePath)
}
private fun selectBannerImage() {
} catch (e: IOException) {
e.printStackTrace()
}
}
PICK_BANNER_REQUEST -> {
try {
data.data?.let {
val bitmap = getBitmap(contentResolver, it)
val profileImagePath = saveToInternalStorage(bitmap, USER_BANNER)
PreferenceUtil.getInstance(this).setBannerImagePath(profileImagePath)
loadBannerFromStorage(profileImagePath)
}
} catch (e: IOException) {
e.printStackTrace()
}
}
}
}
}
if (TextUtils.isEmpty(PreferenceUtil.getInstance(this).bannerImage)) {
val pickImageIntent = Intent(Intent.ACTION_PICK, Media.EXTERNAL_CONTENT_URI)
pickImageIntent.type = "image/*"
//pickImageIntent.putExtra("crop", "true")
pickImageIntent.putExtra("outputX", 1290)
pickImageIntent.putExtra("outputY", 720)
pickImageIntent.putExtra("aspectX", 16)
pickImageIntent.putExtra("aspectY", 9)
pickImageIntent.putExtra("scale", true)
//intent.setAction(Intent.ACTION_GET_CONTENT);
startActivityForResult(
Intent.createChooser(pickImageIntent, "Select Picture"),
PICK_BANNER_REQUEST
)
} else {
PreferenceUtil.getInstance(this).setBannerImagePath("")
bannerImage.setImageResource(android.R.color.transparent)
}
}
private fun getImagePathFromUri(aUri: Uri?): String? {
var imagePath: String? = null
if (aUri == null) {
return imagePath
}
if (DocumentsContract.isDocumentUri(App.getContext(), aUri)) {
val documentId = DocumentsContract.getDocumentId(aUri)
if ("com.android.providers.media.documents" == aUri.authority) {
val id = documentId.split(":".toRegex()).dropLastWhile { it.isEmpty() }.toTypedArray()[1]
val selection = Media._ID + "=" + id
imagePath = getImagePath(Media.EXTERNAL_CONTENT_URI, selection)
} else if ("com.android.providers.downloads.documents" == aUri.authority) {
val contentUri = ContentUris.withAppendedId(
Uri.parse("content://downloads/public_downloads"),
java.lang.Long.valueOf(documentId)
)
imagePath = getImagePath(contentUri, null)
}
} else if ("content".equals(aUri.scheme!!, ignoreCase = true)) {
imagePath = getImagePath(aUri, null)
} else if ("file".equals(aUri.scheme!!, ignoreCase = true)) {
imagePath = aUri.path
}
return imagePath
}
private fun pickNewPhoto() {
val pickImageIntent = Intent(Intent.ACTION_PICK, Media.EXTERNAL_CONTENT_URI)
pickImageIntent.type = "image/*"
pickImageIntent.putExtra("crop", "true")
pickImageIntent.putExtra("outputX", 512)
pickImageIntent.putExtra("outputY", 512)
pickImageIntent.putExtra("aspectX", 1)
pickImageIntent.putExtra("aspectY", 1)
pickImageIntent.putExtra("scale", true)
startActivityForResult(
Intent.createChooser(pickImageIntent, "Select Picture"),
PICK_IMAGE_REQUEST
)
}
private fun getImagePath(aUri: Uri, aSelection: String?): String? {
var path: String? = null
val cursor = App.getContext().contentResolver.query(aUri, null, aSelection, null, null)
if (cursor != null) {
if (cursor.moveToFirst()) {
path = cursor.getString(cursor.getColumnIndex(Media.DATA))
}
cursor.close()
}
return path
}
public override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
super.onActivityResult(requestCode, resultCode, data)
if (resultCode == Activity.RESULT_OK && data != null) {
when (requestCode) {
PICK_IMAGE_REQUEST -> {
try {
data.data?.let {
val bitmap = getResizedBitmap(
getBitmap(contentResolver, it),
PROFILE_ICON_SIZE
)
val profileImagePath = saveToInternalStorage(bitmap, USER_PROFILE)
PreferenceUtil.getInstance(this).saveProfileImage(profileImagePath)
loadImageFromStorage(profileImagePath)
}
private fun loadBannerFromStorage(profileImagePath: String) {
disposable.add(
Compressor(this).setQuality(100).setCompressFormat(Bitmap.CompressFormat.WEBP).compressToBitmapAsFlowable(
File(profileImagePath, USER_BANNER)
).subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread()).subscribe(
{ bitmap -> bannerImage.setImageBitmap(bitmap) },
{ t -> println() })
)
}
} catch (e: IOException) {
e.printStackTrace()
}
}
PICK_BANNER_REQUEST -> {
try {
data.data?.let {
val bitmap = getBitmap(contentResolver, it)
val profileImagePath = saveToInternalStorage(bitmap, USER_BANNER)
PreferenceUtil.getInstance(this).setBannerImagePath(profileImagePath)
loadBannerFromStorage(profileImagePath)
}
} catch (e: IOException) {
e.printStackTrace()
}
}
}
}
}
private fun loadImageFromStorage(path: String) {
disposable.add(
Compressor(this).setMaxHeight(300).setMaxWidth(300).setQuality(75).setCompressFormat(
Bitmap.CompressFormat.WEBP
).compressToBitmapAsFlowable(
File(
path,
USER_PROFILE
)
).subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread()).subscribe(
{ bitmap -> userImage!!.setImageBitmap(bitmap) },
{ t -> println() })
)
}
private fun getImagePathFromUri(aUri: Uri?): String? {
var imagePath: String? = null
if (aUri == null) {
return imagePath
}
if (DocumentsContract.isDocumentUri(App.getContext(), aUri)) {
val documentId = DocumentsContract.getDocumentId(aUri)
if ("com.android.providers.media.documents" == aUri.authority) {
val id = documentId.split(":".toRegex()).dropLastWhile { it.isEmpty() }.toTypedArray()[1]
val selection = Media._ID + "=" + id
imagePath = getImagePath(Media.EXTERNAL_CONTENT_URI, selection)
} else if ("com.android.providers.downloads.documents" == aUri.authority) {
val contentUri = ContentUris.withAppendedId(
Uri.parse("content://downloads/public_downloads"),
java.lang.Long.valueOf(documentId)
)
imagePath = getImagePath(contentUri, null)
}
} else if ("content".equals(aUri.scheme!!, ignoreCase = true)) {
imagePath = getImagePath(aUri, null)
} else if ("file".equals(aUri.scheme!!, ignoreCase = true)) {
imagePath = aUri.path
}
return imagePath
}
private fun saveToInternalStorage(bitmapImage: Bitmap, userBanner: String): String {
val cw = ContextWrapper(this)
val directory = cw.getDir("imageDir", Context.MODE_PRIVATE)
val myPath = File(directory, userBanner)
var fos: FileOutputStream? = null
try {
fos = FileOutputStream(myPath)
// Use the compress method on the BitMap object to write image to the OutputStream
bitmapImage.compress(Bitmap.CompressFormat.WEBP, 100, fos)
} catch (e: Exception) {
e.printStackTrace()
} finally {
try {
fos?.close()
} catch (e: IOException) {
e.printStackTrace()
}
}
return directory.absolutePath
}
private fun getImagePath(aUri: Uri, aSelection: String?): String? {
var path: String? = null
val cursor = App.getContext().contentResolver.query(aUri, null, aSelection, null, null)
if (cursor != null) {
if (cursor.moveToFirst()) {
path = cursor.getString(cursor.getColumnIndex(Media.DATA))
}
cursor.close()
}
return path
}
companion object {
private fun loadBannerFromStorage(profileImagePath: String) {
disposable.add(
Compressor(this).setQuality(100).setCompressFormat(Bitmap.CompressFormat.WEBP).compressToBitmapAsFlowable(
File(profileImagePath, USER_BANNER)
).subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread()).subscribe(
{ bitmap -> bannerImage.setImageBitmap(bitmap) },
{ t -> println() })
)
}
private fun loadImageFromStorage(path: String) {
disposable.add(
Compressor(this).setMaxHeight(300).setMaxWidth(300).setQuality(75).setCompressFormat(
Bitmap.CompressFormat.WEBP
).compressToBitmapAsFlowable(
File(
path,
USER_PROFILE
)
).subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread()).subscribe(
{ bitmap -> userImage!!.setImageBitmap(bitmap) },
{ t -> println() })
)
}
private fun saveToInternalStorage(bitmapImage: Bitmap, userBanner: String): String {
val cw = ContextWrapper(this)
val directory = cw.getDir("imageDir", Context.MODE_PRIVATE)
val myPath = File(directory, userBanner)
var fos: FileOutputStream? = null
try {
fos = FileOutputStream(myPath)
// Use the compress method on the BitMap object to write image to the OutputStream
bitmapImage.compress(Bitmap.CompressFormat.WEBP, 100, fos)
} catch (e: Exception) {
e.printStackTrace()
} finally {
try {
fos?.close()
} catch (e: IOException) {
e.printStackTrace()
}
}
return directory.absolutePath
}
companion object {
private const val PICK_IMAGE_REQUEST = 9002
private const val PICK_BANNER_REQUEST = 9004
private const val PROFILE_ICON_SIZE = 400
}
private const val PICK_IMAGE_REQUEST = 9002
private const val PICK_BANNER_REQUEST = 9004
private const val PROFILE_ICON_SIZE = 400
}
}
fun Activity.pickImage(requestCode: Int) {
Intent(Intent.ACTION_GET_CONTENT).apply {
addCategory(Intent.CATEGORY_OPENABLE)
type = "image/*"
startActivityForResult(this, requestCode)
}
Intent(Intent.ACTION_GET_CONTENT).apply {
addCategory(Intent.CATEGORY_OPENABLE)
type = "image/*"
startActivityForResult(this, requestCode)
}
}

View file

@ -60,7 +60,7 @@ public class WhatsNewActivity extends AbsBaseActivity {
toolbar = findViewById(R.id.toolbar);
appBarLayout = findViewById(R.id.appBarLayout);
int primaryColor = INSTANCE.resolveColor(this, R.attr.colorPrimary);
int primaryColor = INSTANCE.resolveColor(this, R.attr.colorSurface);
toolbar.setBackgroundColor(primaryColor);
appBarLayout.setBackgroundColor(primaryColor);
//setSupportActionBar(toolbar);
@ -79,11 +79,10 @@ public class WhatsNewActivity extends AbsBaseActivity {
// Inject color values for WebView body background and links
final boolean isDark = INSTANCE.isWindowBackgroundDark(this);
final String backgroundColor = colorToCSS(INSTANCE.resolveColor(this, R.attr.colorPrimary, Color.parseColor(isDark ? "#424242" : "#ffffff")));
final String backgroundColor = colorToCSS(INSTANCE.resolveColor(this, android.R.attr.windowBackground, Color.parseColor(isDark ? "#424242" : "#ffffff")));
final String contentColor = colorToCSS(Color.parseColor(isDark ? "#ffffff" : "#000000"));
final String changeLog = buf.toString()
.replace("{style-placeholder}",
String.format("body { background-color: %s; color: %s; }", backgroundColor, contentColor))
.replace("{style-placeholder}", String.format("body { background-color: %s; color: %s; }", backgroundColor, contentColor))
.replace("{link-color}", colorToCSS(ThemeStore.Companion.accentColor(this)))
.replace("{link-color-active}", colorToCSS(ColorUtil.INSTANCE.lightenColor(ThemeStore.Companion.accentColor(this))));

View file

@ -1,7 +1,6 @@
package code.name.monkey.retromusic.activities.base
import android.animation.ValueAnimator
import android.annotation.SuppressLint
import android.graphics.Color
import android.graphics.Rect
import android.os.Bundle
@ -35,6 +34,7 @@ import code.name.monkey.retromusic.fragments.player.plain.PlainPlayerFragment
import code.name.monkey.retromusic.fragments.player.simple.SimplePlayerFragment
import code.name.monkey.retromusic.fragments.player.tiny.TinyPlayerFragment
import code.name.monkey.retromusic.helper.MusicPlayerRemote
import code.name.monkey.retromusic.model.CategoryInfo
import code.name.monkey.retromusic.util.DensityUtil
import code.name.monkey.retromusic.util.PreferenceUtil
import code.name.monkey.retromusic.views.BottomNavigationBarTinted
@ -114,13 +114,11 @@ abstract class AbsSlidingMusicPanelActivity : AbsMusicServiceActivity(), AbsPlay
override fun onDestroy() {
super.onDestroy()
bottomSheetBehavior.removeBottomSheetCallback(bottomSheetCallbackList)
if (navigationBarColorAnimator != null) navigationBarColorAnimator!!.cancel() // just in case
if (navigationBarColorAnimator != null) navigationBarColorAnimator?.cancel() // just in case
}
protected fun wrapSlidingMusicPanel(@LayoutRes resId: Int): View {
@SuppressLint("InflateParams") val slidingMusicPanelLayout = layoutInflater.inflate(
R.layout.sliding_music_panel_layout, null
)
val slidingMusicPanelLayout = layoutInflater.inflate(R.layout.sliding_music_panel_layout, null)
val contentContainer = slidingMusicPanelLayout.findViewById<ViewGroup>(R.id.mainContentFrame)
layoutInflater.inflate(resId, contentContainer)
return slidingMusicPanelLayout
@ -143,7 +141,7 @@ abstract class AbsSlidingMusicPanelActivity : AbsMusicServiceActivity(), AbsPlay
miniPlayerFragment?.view?.visibility = if (alpha == 0f) View.GONE else View.VISIBLE
bottomNavigationView.translationY = progress * 500
bottomNavigationView.alpha = alpha
//bottomNavigationView.alpha = alpha
}
open fun onPanelCollapsed() {
@ -296,13 +294,7 @@ abstract class AbsSlidingMusicPanelActivity : AbsMusicServiceActivity(), AbsPlay
super.setLightNavigationBar(isColorLight)
super.setLightStatusbar(isColorLight)
} else {
super.setLightStatusbar(
ColorUtil.isColorLight(
ATHUtil.resolveColor(
this, R.attr.colorPrimary
)
)
)
super.setLightStatusbar(ColorUtil.isColorLight(ATHUtil.resolveColor(this, android.R.attr.windowBackground)))
super.setLightNavigationBar(true)
}
}
@ -339,15 +331,16 @@ abstract class AbsSlidingMusicPanelActivity : AbsMusicServiceActivity(), AbsPlay
private fun updateTabs() {
bottomNavigationView.menu.clear()
val currentTabs = PreferenceUtil.getInstance(this).libraryCategoryInfos
val currentTabs: List<CategoryInfo> = PreferenceUtil.getInstance(this).libraryCategoryInfos
for (tab in currentTabs) {
if (tab.visible) {
val menu = tab.category
bottomNavigationView.menu.add(
0, menu.id, 0, menu.stringRes
).setIcon(menu.icon)
bottomNavigationView.menu.add(0, menu.id, 0, menu.stringRes).setIcon(menu.icon)
}
}
if (currentTabs.size <= 1) {
toggleBottomNavigationView(true)
}
}
override fun dispatchTouchEvent(ev: MotionEvent?): Boolean {

View file

@ -91,11 +91,7 @@ abstract class AbsThemeActivity : ATHToolbarActivity(), Runnable {
if (statusBar != null) {
when {
VersionUtils.hasMarshmallow() -> window.statusBarColor = color
VersionUtils.hasLollipop() -> statusBar.setBackgroundColor(
ColorUtil.darkenColor(
color
)
)
VersionUtils.hasLollipop() -> statusBar.setBackgroundColor(ColorUtil.darkenColor(color))
else -> statusBar.setBackgroundColor(color)
}
} else {
@ -104,12 +100,13 @@ abstract class AbsThemeActivity : ATHToolbarActivity(), Runnable {
else -> window.statusBarColor = ColorUtil.darkenColor(color)
}
}
setLightStatusbarAuto(color)
setLightStatusbarAuto(ATHUtil.resolveColor(this, android.R.attr.windowBackground))
}
fun setStatusbarColorAuto() {
// we don't want to use statusbar color because we are doing the color darkening on our own to support KitKat
//setStatusbarColor(ATHUtil.resolveColor(this, android.R.attr.windowBackground))
setLightStatusbarAuto(ATHUtil.resolveColor(this, android.R.attr.windowBackground))
}
open fun setTaskDescriptionColor(@ColorInt color: Int) {
@ -117,7 +114,7 @@ abstract class AbsThemeActivity : ATHToolbarActivity(), Runnable {
}
fun setTaskDescriptionColorAuto() {
setTaskDescriptionColor(ATHUtil.resolveColor(this, R.attr.colorPrimary))
setTaskDescriptionColor(ATHUtil.resolveColor(this, android.R.attr.windowBackground))
}
open fun setNavigationbarColor(color: Int) {
@ -129,11 +126,11 @@ abstract class AbsThemeActivity : ATHToolbarActivity(), Runnable {
}
open fun setNavigationBarColorPrimary() {
ATH.setNavigationbarColor(this, ATHUtil.resolveColor(this, R.attr.colorPrimary))
ATH.setNavigationbarColor(this, ATHUtil.resolveColor(this, android.R.attr.windowBackground))
}
fun setNavigationbarColorAuto() {
setNavigationbarColor(ATHUtil.resolveColor(this, R.attr.colorSecondary))
setNavigationbarColor(ATHUtil.resolveColor(this, android.R.attr.windowBackground))
}
open fun setLightStatusbar(enabled: Boolean) {

View file

@ -1,21 +1,32 @@
package code.name.monkey.retromusic.activities.bugreport
import android.app.*
import android.content.*
import android.app.Activity
import android.app.Dialog
import android.content.ClipData
import android.content.ClipboardManager
import android.content.Context
import android.content.Intent
import android.net.Uri
import android.os.Bundle
import android.text.TextUtils
import android.view.MenuItem
import android.view.inputmethod.EditorInfo
import android.widget.Toast
import androidx.annotation.*
import androidx.annotation.StringDef
import androidx.annotation.StringRes
import androidx.appcompat.app.AlertDialog
import code.name.monkey.appthemehelper.ThemeStore
import code.name.monkey.appthemehelper.util.*
import code.name.monkey.appthemehelper.util.ATHUtil
import code.name.monkey.appthemehelper.util.MaterialUtil
import code.name.monkey.appthemehelper.util.TintHelper
import code.name.monkey.appthemehelper.util.ToolbarContentTintHelper
import code.name.monkey.retromusic.R
import code.name.monkey.retromusic.activities.base.AbsThemeActivity
import code.name.monkey.retromusic.activities.bugreport.model.*
import code.name.monkey.retromusic.activities.bugreport.model.github.*
import code.name.monkey.retromusic.activities.bugreport.model.DeviceInfo
import code.name.monkey.retromusic.activities.bugreport.model.Report
import code.name.monkey.retromusic.activities.bugreport.model.github.ExtraInfo
import code.name.monkey.retromusic.activities.bugreport.model.github.GithubLogin
import code.name.monkey.retromusic.activities.bugreport.model.github.GithubTarget
import code.name.monkey.retromusic.misc.DialogAsyncTask
import com.afollestad.materialdialogs.MaterialDialog
import com.afollestad.materialdialogs.callbacks.onCancel
@ -25,7 +36,8 @@ import kotlinx.android.synthetic.main.activity_bug_report.*
import kotlinx.android.synthetic.main.bug_report_card_device_info.*
import kotlinx.android.synthetic.main.bug_report_card_report.*
import org.eclipse.egit.github.core.Issue
import org.eclipse.egit.github.core.client.*
import org.eclipse.egit.github.core.client.GitHubClient
import org.eclipse.egit.github.core.client.RequestException
import org.eclipse.egit.github.core.service.IssueService
import java.io.IOException
@ -52,7 +64,6 @@ open class BugReportActivity : AbsThemeActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_bug_report)
setStatusbarColorAuto()
setNavigationbarColorAuto()
setTaskDescriptionColorAuto()
@ -67,7 +78,7 @@ open class BugReportActivity : AbsThemeActivity() {
private fun initViews() {
val accentColor = ThemeStore.accentColor(this)
val primaryColor = ATHUtil.resolveColor(this, R.attr.colorPrimary)
val primaryColor = ATHUtil.resolveColor(this, R.attr.colorSurface)
toolbar.setBackgroundColor(primaryColor)
setSupportActionBar(toolbar)
ToolbarContentTintHelper.colorBackButton(toolbar)

View file

@ -48,44 +48,23 @@ class HomeAdapter(
when (getItemViewType(position)) {
RECENT_ALBUMS -> {
val viewHolder = holder as AlbumViewHolder
viewHolder.bindView(
list[position].arrayList.toAlbums(),
R.string.recent_albums,
R.string.recent_added_albums
)
viewHolder.bindView(list[position].arrayList.toAlbums(), R.string.recent_albums)
}
TOP_ALBUMS -> {
val viewHolder = holder as AlbumViewHolder
viewHolder.bindView(
list[position].arrayList.toAlbums(),
R.string.top_albums,
R.string.most_played_albums
)
viewHolder.bindView(list[position].arrayList.toAlbums(), R.string.top_albums)
}
RECENT_ARTISTS -> {
val viewHolder = holder as ArtistViewHolder
viewHolder.bindView(
list[position].arrayList.toArtists(),
R.string.recent_artists,
R.string.recent_added_artists
)
viewHolder.bindView(list[position].arrayList.toArtists(), R.string.recent_artists)
}
TOP_ARTISTS -> {
val viewHolder = holder as ArtistViewHolder
viewHolder.bindView(
list[position].arrayList.toArtists(),
R.string.top_artists,
R.string.most_played_artists
)
viewHolder.bindView(list[position].arrayList.toArtists(), R.string.top_artists)
}
PLAYLISTS -> {
val viewHolder = holder as PlaylistViewHolder
viewHolder.bindView(
list[position].arrayList.toPlaylist(),
R.string.favorites,
R.string.favorites_songs
)
viewHolder.bindView(list[position].arrayList.toPlaylist(), R.string.favorites)
}
}
}
@ -114,7 +93,7 @@ class HomeAdapter(
}
private inner class AlbumViewHolder(view: View) : AbsHomeViewItem(view) {
fun bindView(list: ArrayList<Album>, titleRes: Int, subtitleRes: Int) {
fun bindView(list: ArrayList<Album>, titleRes: Int) {
if (list.isNotEmpty()) {
recyclerView.apply {
show()
@ -126,7 +105,7 @@ class HomeAdapter(
}
inner class ArtistViewHolder(view: View) : AbsHomeViewItem(view) {
fun bindView(list: ArrayList<Artist>, titleRes: Int, subtitleRes: Int) {
fun bindView(list: ArrayList<Artist>, titleRes: Int) {
if (list.isNotEmpty()) {
recyclerView.apply {
show()
@ -148,7 +127,7 @@ class HomeAdapter(
}
private inner class PlaylistViewHolder(view: View) : AbsHomeViewItem(view) {
fun bindView(arrayList: ArrayList<Playlist>, titleRes: Int, subtitleRes: Int) {
fun bindView(arrayList: ArrayList<Playlist>, titleRes: Int) {
if (arrayList.isNotEmpty()) {
val songs = PlaylistSongsLoader.getPlaylistSongList(activity, arrayList[0])
if (songs.isNotEmpty()) {

View file

@ -93,7 +93,7 @@ public class MediaEntryViewHolder extends RecyclerView.ViewHolder implements Vie
playSongs = itemView.findViewById(R.id.playSongs);
if (imageContainerCard != null) {
imageContainerCard.setCardBackgroundColor(ATHUtil.INSTANCE.resolveColor(itemView.getContext(), R.attr.colorPrimary));
imageContainerCard.setCardBackgroundColor(ATHUtil.INSTANCE.resolveColor(itemView.getContext(), R.attr.colorSurface));
}
itemView.setOnClickListener(this);
itemView.setOnLongClickListener(this);

View file

@ -1,222 +1,216 @@
package code.name.monkey.retromusic.adapter.playlist
import android.graphics.drawable.Drawable
import android.view.*
import android.view.LayoutInflater
import android.view.MenuItem
import android.view.View
import android.view.ViewGroup
import androidx.appcompat.app.AppCompatActivity
import androidx.appcompat.widget.PopupMenu
import code.name.monkey.appthemehelper.ThemeStore
import code.name.monkey.appthemehelper.util.*
import code.name.monkey.appthemehelper.util.ATHUtil
import code.name.monkey.appthemehelper.util.TintHelper
import code.name.monkey.retromusic.R
import code.name.monkey.retromusic.adapter.base.*
import code.name.monkey.retromusic.dialogs.*
import code.name.monkey.retromusic.helper.menu.*
import code.name.monkey.retromusic.adapter.base.AbsMultiSelectAdapter
import code.name.monkey.retromusic.adapter.base.MediaEntryViewHolder
import code.name.monkey.retromusic.dialogs.ClearSmartPlaylistDialog
import code.name.monkey.retromusic.dialogs.DeletePlaylistDialog
import code.name.monkey.retromusic.helper.menu.PlaylistMenuHelper
import code.name.monkey.retromusic.helper.menu.SongsMenuHelper
import code.name.monkey.retromusic.interfaces.CabHolder
import code.name.monkey.retromusic.loaders.PlaylistSongsLoader
import code.name.monkey.retromusic.model.*
import code.name.monkey.retromusic.model.smartplaylist.*
import code.name.monkey.retromusic.util.*
import code.name.monkey.retromusic.model.AbsCustomPlaylist
import code.name.monkey.retromusic.model.Playlist
import code.name.monkey.retromusic.model.Song
import code.name.monkey.retromusic.model.smartplaylist.AbsSmartPlaylist
import code.name.monkey.retromusic.model.smartplaylist.LastAddedPlaylist
import code.name.monkey.retromusic.util.MusicUtil
import code.name.monkey.retromusic.util.NavigationUtil
import java.util.*
class PlaylistAdapter(
private val activity: AppCompatActivity,
var dataSet: ArrayList<Playlist>,
private var itemLayoutRes: Int,
cabHolder: CabHolder?
private val activity: AppCompatActivity,
var dataSet: ArrayList<Playlist>,
private var itemLayoutRes: Int,
cabHolder: CabHolder?
) : AbsMultiSelectAdapter<PlaylistAdapter.ViewHolder, Playlist>(
activity,
cabHolder,
R.menu.menu_playlists_selection
activity,
cabHolder,
R.menu.menu_playlists_selection
) {
var songs = ArrayList<Song>()
var songs = ArrayList<Song>()
init {
setHasStableIds(true)
}
init {
setHasStableIds(true)
}
fun swapDataSet(dataSet: ArrayList<Playlist>) {
this.dataSet = dataSet
notifyDataSetChanged()
}
fun swapDataSet(dataSet: ArrayList<Playlist>) {
this.dataSet = dataSet
notifyDataSetChanged()
}
override fun getItemId(position: Int): Long {
return dataSet[position].id.toLong()
}
override fun getItemId(position: Int): Long {
return dataSet[position].id.toLong()
}
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ViewHolder {
val view = LayoutInflater.from(activity).inflate(itemLayoutRes, parent, false)
return createViewHolder(view)
}
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ViewHolder {
val view = LayoutInflater.from(activity).inflate(itemLayoutRes, parent, false)
return createViewHolder(view)
}
protected fun createViewHolder(view: View): ViewHolder {
return ViewHolder(view)
}
protected fun createViewHolder(view: View): ViewHolder {
return ViewHolder(view)
}
protected fun getPlaylistTitle(playlist: Playlist): String {
return playlist.name
}
protected fun getPlaylistTitle(playlist: Playlist): String {
return playlist.name
}
protected fun getPlaylistText(playlist: Playlist): String {
return MusicUtil.getPlaylistInfoString(activity, getSongs(playlist))
}
protected fun getPlaylistText(playlist: Playlist): String {
return MusicUtil.getPlaylistInfoString(activity, getSongs(playlist))
}
override fun onBindViewHolder(holder: ViewHolder, position: Int) {
val playlist = dataSet[position]
holder.itemView.isActivated = isChecked(playlist)
holder.title?.text = getPlaylistTitle(playlist)
holder.text?.text = getPlaylistText(playlist)
holder.image?.setImageDrawable(getIconRes(playlist))
}
override fun onBindViewHolder(holder: ViewHolder, position: Int) {
val playlist = dataSet[position]
holder.itemView.isActivated = isChecked(playlist)
holder.title?.text = getPlaylistTitle(playlist)
holder.text?.text = getPlaylistText(playlist)
holder.image?.setImageDrawable(getIconRes(playlist))
}
private fun getIconRes(playlist: Playlist): Drawable {
if (playlist is AbsSmartPlaylist) {
return TintHelper.createTintedDrawable(
activity,
playlist.iconRes,
ATHUtil.resolveColor(activity, R.attr.iconColor)
)!!
}
return if (MusicUtil.isFavoritePlaylist(
activity,
playlist
)) TintHelper.createTintedDrawable(
activity,
R.drawable.ic_favorite_white_24dp,
ThemeStore.accentColor(activity)
)!!
else TintHelper.createTintedDrawable(
activity,
R.drawable.ic_playlist_play_white_24dp,
ATHUtil.resolveColor(activity, R.attr.iconColor)
)!!
}
private fun getIconRes(playlist: Playlist): Drawable {
return if (MusicUtil.isFavoritePlaylist(activity, playlist))
TintHelper.createTintedDrawable(activity, R.drawable.ic_favorite_white_24dp, ThemeStore.accentColor(activity))!!
else TintHelper.createTintedDrawable(activity, R.drawable.ic_playlist_play_white_24dp, ATHUtil.resolveColor(activity, R.attr.colorControlNormal))!!
}
override fun getItemViewType(position: Int): Int {
return if (dataSet[position] is AbsSmartPlaylist) SMART_PLAYLIST else DEFAULT_PLAYLIST
}
override fun getItemViewType(position: Int): Int {
return if (dataSet[position] is AbsSmartPlaylist) SMART_PLAYLIST else DEFAULT_PLAYLIST
}
override fun getItemCount(): Int {
return dataSet.size
}
override fun getItemCount(): Int {
return dataSet.size
}
override fun getIdentifier(position: Int): Playlist? {
return dataSet[position]
}
override fun getIdentifier(position: Int): Playlist? {
return dataSet[position]
}
override fun getName(playlist: Playlist): String {
return playlist.name
}
override fun getName(playlist: Playlist): String {
return playlist.name
}
override fun onMultipleItemAction(menuItem: MenuItem, selection: ArrayList<Playlist>) {
when (menuItem.itemId) {
R.id.action_delete_playlist -> {
var i = 0
while (i < selection.size) {
val playlist = selection[i]
if (playlist is AbsSmartPlaylist) {
ClearSmartPlaylistDialog.create(playlist).show(
activity.supportFragmentManager, "CLEAR_PLAYLIST_" + playlist.name
)
selection.remove(playlist)
i--
}
i++
}
if (selection.size > 0) {
DeletePlaylistDialog.create(selection)
.show(activity.supportFragmentManager, "DELETE_PLAYLIST")
}
}
else -> SongsMenuHelper.handleMenuClick(
activity,
getSongList(selection),
menuItem.itemId
)
}
}
override fun onMultipleItemAction(menuItem: MenuItem, selection: ArrayList<Playlist>) {
when (menuItem.itemId) {
R.id.action_delete_playlist -> {
var i = 0
while (i < selection.size) {
val playlist = selection[i]
if (playlist is AbsSmartPlaylist) {
ClearSmartPlaylistDialog.create(playlist).show(
activity.supportFragmentManager, "CLEAR_PLAYLIST_" + playlist.name
)
selection.remove(playlist)
i--
}
i++
}
if (selection.size > 0) {
DeletePlaylistDialog.create(selection)
.show(activity.supportFragmentManager, "DELETE_PLAYLIST")
}
}
else -> SongsMenuHelper.handleMenuClick(
activity,
getSongList(selection),
menuItem.itemId
)
}
}
private fun getSongList(playlists: List<Playlist>): ArrayList<Song> {
val songs = ArrayList<Song>()
for (playlist in playlists) {
if (playlist is AbsCustomPlaylist) {
songs.addAll(playlist.getSongs(activity))
} else {
songs.addAll(PlaylistSongsLoader.getPlaylistSongList(activity, playlist.id))
}
}
return songs
}
private fun getSongList(playlists: List<Playlist>): ArrayList<Song> {
val songs = ArrayList<Song>()
for (playlist in playlists) {
if (playlist is AbsCustomPlaylist) {
songs.addAll(playlist.getSongs(activity))
} else {
songs.addAll(PlaylistSongsLoader.getPlaylistSongList(activity, playlist.id))
}
}
return songs
}
private fun getSongs(playlist: Playlist): ArrayList<Song> {
val songs = ArrayList<Song>()
if (playlist is AbsSmartPlaylist) {
songs.addAll(playlist.getSongs(activity))
} else {
songs.addAll(PlaylistSongsLoader.getPlaylistSongList(activity, playlist.id))
}
return songs
}
private fun getSongs(playlist: Playlist): ArrayList<Song> {
val songs = ArrayList<Song>()
if (playlist is AbsSmartPlaylist) {
songs.addAll(playlist.getSongs(activity))
} else {
songs.addAll(PlaylistSongsLoader.getPlaylistSongList(activity, playlist.id))
}
return songs
}
inner class ViewHolder(itemView: View) : MediaEntryViewHolder(itemView) {
init {
inner class ViewHolder(itemView: View) : MediaEntryViewHolder(itemView) {
init {
image?.apply {
val iconPadding = activity.resources.getDimensionPixelSize(R.dimen.list_item_image_icon_padding)
setPadding(iconPadding, iconPadding, iconPadding, iconPadding)
//setColorFilter(ATHUtil.resolveColor(activity, R.attr.iconColor), PorterDuff.Mode.SRC_IN)
}
image?.apply {
val iconPadding = activity.resources.getDimensionPixelSize(R.dimen.list_item_image_icon_padding)
setPadding(iconPadding, iconPadding, iconPadding, iconPadding)
//setColorFilter(ATHUtil.resolveColor(activity, R.attr.iconColor), PorterDuff.Mode.SRC_IN)
}
menu?.setOnClickListener { view ->
val playlist = dataSet[adapterPosition]
val popupMenu = PopupMenu(activity, view)
popupMenu.inflate(
if (itemViewType == SMART_PLAYLIST) R.menu.menu_item_smart_playlist
else R.menu.menu_item_playlist
)
if (playlist is LastAddedPlaylist) {
popupMenu.menu.findItem(R.id.action_clear_playlist).isVisible = false
}
popupMenu.setOnMenuItemClickListener { item ->
if (item.itemId == R.id.action_clear_playlist) {
if (playlist is AbsSmartPlaylist) {
ClearSmartPlaylistDialog.create(playlist).show(
activity.supportFragmentManager,
"CLEAR_SMART_PLAYLIST_" + playlist.name
)
return@setOnMenuItemClickListener true
}
}
PlaylistMenuHelper.handleMenuClick(
activity, dataSet[adapterPosition], item
)
}
popupMenu.show()
}
menu?.setOnClickListener { view ->
val playlist = dataSet[adapterPosition]
val popupMenu = PopupMenu(activity, view)
popupMenu.inflate(
if (itemViewType == SMART_PLAYLIST) R.menu.menu_item_smart_playlist
else R.menu.menu_item_playlist
)
if (playlist is LastAddedPlaylist) {
popupMenu.menu.findItem(R.id.action_clear_playlist).isVisible = false
}
popupMenu.setOnMenuItemClickListener { item ->
if (item.itemId == R.id.action_clear_playlist) {
if (playlist is AbsSmartPlaylist) {
ClearSmartPlaylistDialog.create(playlist).show(
activity.supportFragmentManager,
"CLEAR_SMART_PLAYLIST_" + playlist.name
)
return@setOnMenuItemClickListener true
}
}
PlaylistMenuHelper.handleMenuClick(
activity, dataSet[adapterPosition], item
)
}
popupMenu.show()
}
imageTextContainer?.apply {
cardElevation = 0f
setCardBackgroundColor(ATHUtil.resolveColor(activity, R.attr.colorPrimary))
}
}
imageTextContainer?.apply {
cardElevation = 0f
setCardBackgroundColor(ATHUtil.resolveColor(activity, R.attr.colorSurface))
}
}
override fun onClick(v: View?) {
if (isInQuickSelectMode) {
toggleChecked(adapterPosition)
} else {
val playlist = dataSet[adapterPosition]
NavigationUtil.goToPlaylistNew(activity, playlist)
}
}
override fun onClick(v: View?) {
if (isInQuickSelectMode) {
toggleChecked(adapterPosition)
} else {
val playlist = dataSet[adapterPosition]
NavigationUtil.goToPlaylistNew(activity, playlist)
}
}
override fun onLongClick(v: View?): Boolean {
toggleChecked(adapterPosition)
return true
}
}
override fun onLongClick(v: View?): Boolean {
toggleChecked(adapterPosition)
return true
}
}
companion object {
val TAG: String = PlaylistAdapter::class.java.simpleName
private const val SMART_PLAYLIST = 0
private const val DEFAULT_PLAYLIST = 1
}
companion object {
val TAG: String = PlaylistAdapter::class.java.simpleName
private const val SMART_PLAYLIST = 0
private const val DEFAULT_PLAYLIST = 1
}
}

View file

@ -1,18 +1,14 @@
package code.name.monkey.retromusic.adapter.song
import android.app.ActivityOptions
import android.content.res.ColorStateList
import android.view.MenuItem
import android.view.View
import androidx.appcompat.app.AppCompatActivity
import code.name.monkey.appthemehelper.util.ColorUtil
import code.name.monkey.appthemehelper.util.MaterialValueHelper
import code.name.monkey.retromusic.R
import code.name.monkey.retromusic.helper.MusicPlayerRemote
import code.name.monkey.retromusic.interfaces.CabHolder
import code.name.monkey.retromusic.model.Song
import code.name.monkey.retromusic.util.NavigationUtil
import code.name.monkey.retromusic.util.RetroColorUtil
import com.google.android.material.button.MaterialButton
import java.util.*
@ -33,30 +29,18 @@ open class PlaylistSongAdapter(
}
override fun onBindViewHolder(holder: SongAdapter.ViewHolder, position: Int) {
if (holder.itemViewType == OFFSET_ITEM) {
val buttonColor = RetroColorUtil.toolbarColor(activity)
val textColor = MaterialValueHelper.getPrimaryTextColor(activity, ColorUtil.isColorLight(buttonColor))
val viewHolder = holder as ViewHolder
viewHolder.playAction?.let {
it.backgroundTintList = ColorStateList.valueOf(buttonColor)
it.setTextColor(textColor)
it.iconTint = ColorStateList.valueOf(textColor)
it.setOnClickListener {
MusicPlayerRemote.openQueue(dataSet, 0, true)
}
}
viewHolder.shuffleAction?.let {
it.backgroundTintList = ColorStateList.valueOf(buttonColor)
it.setTextColor(textColor)
it.iconTint = ColorStateList.valueOf(textColor)
it.setOnClickListener {
MusicPlayerRemote.openAndShuffleQueue(dataSet, true)
}
}
} else {
super.onBindViewHolder(holder, position - 1)
}

View file

@ -14,6 +14,7 @@
package code.name.monkey.retromusic.extensions
import android.content.res.ColorStateList
import androidx.appcompat.app.AppCompatActivity
import androidx.appcompat.widget.Toolbar
import code.name.monkey.appthemehelper.util.ATHUtil
@ -25,7 +26,7 @@ fun AppCompatActivity.applyToolbar(toolbar: Toolbar) {
setNavigationOnClickListener { onBackPressed() }
setNavigationIcon(R.drawable.ic_keyboard_backspace_black_24dp)
ToolbarContentTintHelper.colorBackButton(toolbar)
setBackgroundColor(ATHUtil.resolveColor(this@applyToolbar, R.attr.colorPrimary))
backgroundTintList = ColorStateList.valueOf(ATHUtil.resolveColor(this@applyToolbar, R.attr.colorSurface))
}
setSupportActionBar(toolbar)
}
}

View file

@ -14,8 +14,16 @@
package code.name.monkey.retromusic.extensions
import android.content.Context
import android.graphics.Color
import code.name.monkey.appthemehelper.util.ATHUtil
import code.name.monkey.appthemehelper.util.ColorUtil
import code.name.monkey.retromusic.R
fun Int.ripAlpha(): Int {
return ColorUtil.stripAlpha(this)
}
fun Any.surfaceColor(context: Context): Int {
return ATHUtil.resolveColor(context, R.attr.colorSurface, Color.WHITE)
}

View file

@ -2,6 +2,7 @@ package code.name.monkey.retromusic.fragments.mainactivity;
import android.app.Activity;
import android.app.ActivityOptions;
import android.content.res.ColorStateList;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.Menu;
@ -140,7 +141,7 @@ public class LibraryFragment extends AbsMainActivityFragment implements CabHolde
@SuppressWarnings("ConstantConditions")
private void setupToolbar() {
toolbar.setBackgroundColor(RetroColorUtil.toolbarColor(getMainActivity()));
toolbar.setBackgroundTintList(ColorStateList.valueOf(ATHUtil.INSTANCE.resolveColor(requireContext(), R.attr.colorSurface)));
toolbar.setNavigationIcon(R.drawable.ic_menu_white_24dp);
toolbar.setOnClickListener(v -> {
ActivityOptions options = ActivityOptions.makeSceneTransitionAnimation(getMainActivity(), toolbarContainer, getString(R.string.transition_toolbar));

View file

@ -72,15 +72,13 @@ class BannerHomeFragment : AbsMainActivityFragment(), MainActivityFragmentCallba
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
setStatusBarColorAuto(view)
toolbar = view.findViewById(R.id.toolbar)
bannerImage?.setOnClickListener {
val options = ActivityOptions.makeSceneTransitionAnimation(mainActivity, userImage, getString(R.string.transition_user_image))
NavigationUtil.goToUserInfo(requireActivity(), options)
}
if (!PreferenceUtil.getInstance(requireContext()).isHomeBanner)
setStatusBarColorAuto(view)
lastAdded.setOnClickListener {
NavigationUtil.goToPlaylistNew(requireActivity(), LastAddedPlaylist(requireActivity()))
@ -127,7 +125,7 @@ class BannerHomeFragment : AbsMainActivityFragment(), MainActivityFragmentCallba
private fun setupToolbar() {
toolbar.apply {
setBackgroundColor(toolbarColor())
setBackgroundColor(RetroColorUtil.toolbarColor(mainActivity))
setNavigationIcon(R.drawable.ic_menu_white_24dp)
setOnClickListener {
val options = ActivityOptions.makeSceneTransitionAnimation(mainActivity, toolbarContainer, getString(R.string.transition_toolbar))

View file

@ -63,7 +63,7 @@ abstract class AbsSettingsFragment : ATEPreferenceFragmentCompat() {
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
setDivider(ColorDrawable(Color.TRANSPARENT))
listView.setBackgroundColor(ATHUtil.resolveColor(requireContext(), R.attr.colorPrimary))
listView.setBackgroundColor(ATHUtil.resolveColor(requireContext(), R.attr.colorSurface))
listView.overScrollMode = View.OVER_SCROLL_NEVER
listView.setPadding(0, 0, 0, 0)
listView.setPaddingRelative(0, 0, 0, 0)

View file

@ -63,7 +63,7 @@ class MainSettingsFragment : Fragment(), View.OnClickListener {
aboutSettings.setOnClickListener(this)
buyProContainer.apply {
if (!App.isProVersion()) show() else hide()
if (App.isProVersion()) show() else hide()
setOnClickListener {
NavigationUtil.goToProVersion(requireContext())
}

View file

@ -30,8 +30,6 @@ class OtherSettingsFragment : AbsSettingsFragment() {
}
override fun onCreatePreferences(savedInstanceState: Bundle?, rootKey: String?) {
addPreferencesFromResource(R.xml.pref_blacklist)
addPreferencesFromResource(R.xml.pref_playlists)
addPreferencesFromResource(R.xml.pref_advanced)
}

View file

@ -36,7 +36,6 @@ class PersonalizeSettingsFragment : AbsSettingsFragment(), SharedPreferences.OnS
override fun onCreatePreferences(savedInstanceState: Bundle?, rootKey: String?) {
addPreferencesFromResource(R.xml.pref_ui)
addPreferencesFromResource(R.xml.pref_lockscreen)
}
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {

View file

@ -20,7 +20,6 @@ import code.name.monkey.retromusic.adapter.HomeAdapter.Companion.HomeSection
class Home(val priority: Int,
@StringRes val title: Int,
@StringRes val subTitle: Int,
val arrayList: ArrayList<*>,
@HomeSection
val homeSection: Int,

View file

@ -144,7 +144,6 @@ class RepositoryImpl(private val context: Context) : Repository {
} else {
Success(Home(0,
R.string.recent_artists,
R.string.recent_added_artists,
artists,
HomeAdapter.RECENT_ARTISTS,
R.drawable.ic_artist_white_24dp))
@ -162,7 +161,6 @@ class RepositoryImpl(private val context: Context) : Repository {
} else {
Success(Home(1,
R.string.recent_albums,
R.string.recent_added_albums,
albums,
HomeAdapter.RECENT_ALBUMS,
R.drawable.ic_album_white_24dp
@ -181,7 +179,6 @@ class RepositoryImpl(private val context: Context) : Repository {
} else {
Success(Home(3,
R.string.top_albums,
R.string.most_played_albums,
albums,
HomeAdapter.TOP_ALBUMS,
R.drawable.ic_album_white_24dp
@ -201,7 +198,6 @@ class RepositoryImpl(private val context: Context) : Repository {
} else {
Success(Home(2,
R.string.top_artists,
R.string.most_played_artists,
artists,
HomeAdapter.TOP_ARTISTS,
R.drawable.ic_artist_white_24dp
@ -220,7 +216,6 @@ class RepositoryImpl(private val context: Context) : Repository {
} else {
Success(Home(4,
R.string.favorites,
R.string.favorites_songs,
playlists,
HomeAdapter.PLAYLISTS,
R.drawable.ic_favorite_white_24dp

View file

@ -38,12 +38,13 @@ public class RetroColorUtil {
float[] hsv = new float[3];
Color.colorToHSV(color, hsv);
hsv[1] = ( hsv[1] / 1 * ratio ) + ( 0.2f * (1.0f - ratio) );
hsv[1] = (hsv[1] / 1 * ratio) + (0.2f * (1.0f - ratio));
return Color.HSVToColor(hsv);
}
public static int toolbarColor(@NonNull Context context) {
return ATHUtil.INSTANCE.resolveColor(context, R.attr.colorSurface);
return ATHUtil.INSTANCE.resolveColor(context, R.attr.colorButtonNormal);
}
@Nullable

View file

@ -38,12 +38,14 @@ class BottomNavigationBarTinted @JvmOverloads constructor(
labelVisibilityMode = PreferenceUtil.getInstance(context).tabTitleMode
selectedItemId = PreferenceUtil.getInstance(context).lastPage
val iconColor = ATHUtil.resolveColor(context, R.attr.iconColor)
val iconColor = ATHUtil.resolveColor(context, android.R.attr.colorControlNormal)
val accentColor = ThemeStore.accentColor(context)
NavigationViewUtil.setItemIconColors(this, ColorUtil.withAlpha(iconColor, 0.5f), accentColor)
NavigationViewUtil.setItemTextColors(this, ColorUtil.withAlpha(iconColor, 0.5f), accentColor)
itemBackground = RippleDrawable(RippleUtils.convertToRippleDrawableColor(ColorStateList.valueOf(ThemeStore.accentColor(context).addAlpha())), ContextCompat.getDrawable(context, R.drawable.bottom_navigation_item_background), null)
setOnApplyWindowInsetsListener(null)
//itemRippleColor = ColorStateList.valueOf(accentColor)
backgroundTintList = ColorStateList.valueOf(ATHUtil.resolveColor(context, android.R.attr.windowBackground))
}
}

View file

@ -53,7 +53,7 @@ class ColorIconsImageView : AppCompatImageView {
if (ATHUtil.isWindowBackgroundDark(context) && PreferenceUtil.getInstance(context).desaturatedColor()) {
val desaturatedColor = RetroColorUtil.desaturateColor(color, 0.4f)
backgroundTintList = ColorStateList.valueOf(desaturatedColor)
imageTintList = ColorStateList.valueOf(ATHUtil.resolveColor(context, R.attr.colorPrimary))
imageTintList = ColorStateList.valueOf(ATHUtil.resolveColor(context, R.attr.colorSurface))
} else {
backgroundTintList = ColorStateList.valueOf(ColorUtil.adjustAlpha(color, 0.22f))
imageTintList = ColorStateList.valueOf(ColorUtil.withAlpha(color, 0.75f))

View file

@ -1,8 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid android:color="@color/md_black_1000" />
<corners
android:topLeftRadius="12dp"
android:topRightRadius="12dp" />
</shape>

View file

@ -1,9 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<corners
android:topLeftRadius="12dp"
android:topRightRadius="12dp" />
<solid android:color="?attr/cardBackgroundColor" />
</shape>

View file

@ -2,5 +2,5 @@
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<corners android:radius="8dp" />
<solid android:color="?attr/colorSurface" />
<solid android:color="?android:attr/windowBackground" />
</shape>

View file

@ -1,11 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<ripple xmlns:android="http://schemas.android.com/apk/res/android"
android:color="?android:attr/colorControlHighlight">
<item android:id="@android:id/mask">
<shape android:shape="rectangle">
<solid android:color="#000000" />
<corners android:radius="15dp" />
</shape>
</item>
<item android:drawable="@drawable/bottom_navigation_item_background" />
</ripple>

View file

@ -27,7 +27,7 @@
<item>
<shape android:shape="rectangle">
<corners android:radius="8dp" />
<solid android:color="?colorPrimary" />
<solid android:color="?attr/colorControlHighlight" />
</shape>
</item>
</ripple>

View file

@ -4,6 +4,7 @@
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="?attr/colorSurface"
android:orientation="vertical"
tools:ignore="UnusedAttribute">

View file

@ -4,6 +4,7 @@
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="?attr/colorSurface"
android:orientation="vertical"
tools:ignore="UnusedAttribute">

View file

@ -60,7 +60,7 @@
android:layout_height="24dp"
android:layout_gravity="bottom"
android:background="@drawable/shadow_up_full_theme"
android:backgroundTint="?colorPrimary" />
android:backgroundTint="?android:attr/windowBackground" />
</FrameLayout>
@ -89,7 +89,6 @@
app:cardBackgroundColor="@android:color/transparent"
app:cardCornerRadius="8dp"
app:cardElevation="6dp"
app:cardUseCompatPadding="true"
app:layout_collapseMode="pin"
app:layout_scrollFlags="scroll|enterAlways">
@ -116,16 +115,14 @@
android:layout_height="match_parent"
android:layout_marginStart="@dimen/toolbar_margin_horizontal"
android:layout_marginEnd="@dimen/toolbar_margin_horizontal"
android:elevation="@dimen/card_elevation"
app:behavior_overlapTop="72dp"
app:layout_behavior="com.google.android.material.appbar.AppBarLayout$ScrollingViewBehavior">
<com.google.android.material.card.MaterialCardView
android:layout_width="match_parent"
android:layout_height="match_parent"
app:cardBackgroundColor="?colorPrimary"
app:cardElevation="8dp"
app:shapeAppearanceOverlay="@style/TopCornerCardView">
app:cardCornerRadius="16dp"
app:cardElevation="8dp">
<include layout="@layout/home_content" />
</com.google.android.material.card.MaterialCardView>

View file

@ -36,8 +36,9 @@
android:id="@+id/appBarLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?colorPrimary"
app:liftOnScroll="true">
android:background="@android:color/transparent"
android:elevation="0dp"
app:elevation="0dp">
<com.google.android.material.card.MaterialCardView
android:id="@+id/toolbarContainer"

View file

@ -60,7 +60,7 @@
android:layout_gravity="fill_vertical"
android:layout_marginStart="128dp"
android:layout_marginEnd="128dp"
android:background="@drawable/bg_bottom_sheet_dialog_fragment"
android:background="?attr/colorSurface"
android:fillViewport="true"
android:overScrollMode="never"
app:layout_behavior="com.google.android.material.appbar.AppBarLayout$ScrollingViewBehavior">

View file

@ -35,9 +35,9 @@
app:layout_collapseMode="parallax" />
<FrameLayout
app:layout_collapseMode="pin"
android:layout_width="match_parent"
android:layout_height="wrap_content">
android:layout_height="wrap_content"
app:layout_collapseMode="pin">
<com.google.android.material.appbar.MaterialToolbar
android:id="@+id/toolbar"
@ -67,6 +67,7 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="6dp"
android:background="?attr/colorSurface"
app:cardElevation="8dp"
app:shapeAppearanceOverlay="@style/TopCornerCardView">
@ -75,7 +76,6 @@
android:layout_height="match_parent"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"

View file

@ -27,6 +27,9 @@
<com.google.android.material.appbar.AppBarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@android:color/transparent"
android:elevation="0dp"
app:elevation="0dp"
app:liftOnScroll="true">
<com.google.android.material.appbar.CollapsingToolbarLayout

View file

@ -37,8 +37,9 @@
android:id="@+id/appBarLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?colorPrimary"
app:liftOnScroll="true">
android:background="@android:color/transparent"
android:elevation="0dp"
app:elevation="0dp">
<com.google.android.material.card.MaterialCardView
android:id="@+id/toolbarContainer"

View file

@ -2,9 +2,9 @@
<androidx.coordinatorlayout.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/root"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="?attr/colorSurface"
android:transitionName="@string/transition_album_art">
<androidx.appcompat.widget.AppCompatImageView
@ -60,6 +60,7 @@
android:layout_gravity="fill_vertical"
android:layout_marginStart="96dp"
android:layout_marginEnd="96dp"
android:background="?attr/colorSurface"
android:fillViewport="true"
android:overScrollMode="never"
app:layout_behavior="com.google.android.material.appbar.AppBarLayout$ScrollingViewBehavior">

View file

@ -68,6 +68,7 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="6dp"
android:background="?attr/colorSurface"
app:cardElevation="8dp"
app:shapeAppearanceOverlay="@style/TopCornerCardView">

View file

@ -9,6 +9,7 @@
android:id="@+id/appBarLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@android:color/transparent"
android:elevation="0dp"
app:elevation="0dp">
@ -64,8 +65,8 @@
android:layout_gravity="center"
android:background="?roundSelector"
android:padding="16dp"
app:tint="@color/md_white_1000"
app:srcCompat="@drawable/ic_add_photo_white_24dp" />
app:srcCompat="@drawable/ic_add_photo_white_24dp"
app:tint="@color/md_white_1000" />
<FrameLayout
android:layout_width="wrap_content"

View file

@ -21,13 +21,14 @@
<androidx.coordinatorlayout.widget.CoordinatorLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="?colorPrimary">
android:layout_height="match_parent">
<com.google.android.material.appbar.AppBarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:liftOnScroll="true">
android:background="@android:color/transparent"
android:elevation="0dp"
app:elevation="0dp">
<com.google.android.material.appbar.CollapsingToolbarLayout
android:layout_width="match_parent"

View file

@ -38,8 +38,9 @@
android:id="@+id/appBarLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?colorPrimary"
app:liftOnScroll="true">
android:background="@android:color/transparent"
android:elevation="0dp"
app:elevation="0dp">
<com.google.android.material.card.MaterialCardView
android:id="@+id/toolbarContainer"

View file

@ -5,7 +5,7 @@
android:id="@+id/miniPlayerContent"
android:layout_width="match_parent"
android:layout_height="48dp"
android:background="?colorSecondary"
android:background="?android:attr/background"
android:clickable="true"
android:focusable="false"
android:transitionName="@string/transition_mini_player"

View file

@ -8,54 +8,16 @@
android:paddingBottom="12dp">
<code.name.monkey.retromusic.views.CircularImageView
android:id="@+id/userImage"
android:layout_width="42dp"
android:layout_height="42dp"
android:layout_marginStart="16dp"
android:layout_marginTop="16dp"
app:civ_border="false"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
tools:srcCompat="@tools:sample/avatars" />
<com.google.android.material.textview.MaterialTextView
android:id="@+id/text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:ellipsize="end"
android:text="@string/welcome"
android:textColor="?colorOnBackground"
app:layout_constraintStart_toEndOf="@+id/userImage"
app:layout_constraintTop_toTopOf="@+id/userImage" />
<com.google.android.material.textview.MaterialTextView
android:id="@+id/titleWelcome"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:padding="0dp"
android:textAppearance="@style/TextViewHeadline5"
android:textColor="?colorOnPrimary"
android:textStyle="bold"
app:layout_constraintBottom_toBottomOf="@+id/userImage"
app:layout_constraintStart_toEndOf="@+id/userImage"
app:layout_constraintTop_toBottomOf="@+id/text"
tools:text="@string/app_name" />
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/history"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="24dp"
app:layout_constraintHorizontal_chainStyle="spread_inside"
app:layout_constraintEnd_toStartOf="@+id/lastAdded"
app:layout_constraintHorizontal_bias="0.5"
app:layout_constraintHorizontal_chainStyle="spread_inside"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/titleWelcome">
app:layout_constraintTop_toTopOf="parent">
<code.name.monkey.retromusic.views.ColorIconsImageView
android:id="@+id/v1"
@ -80,7 +42,7 @@
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/v1"
tools:text="Hemanth savarala kumar dai" />
tools:text="@tools:sample/lorem" />
</androidx.constraintlayout.widget.ConstraintLayout>
@ -117,7 +79,7 @@
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/v2"
tools:text="Hemanth savarala" />
tools:text="@tools:sample/lorem" />
</androidx.constraintlayout.widget.ConstraintLayout>
@ -154,7 +116,7 @@
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/v3"
tools:text="Hemanth savarala" />
tools:text="@tools:sample/lorem" />
</androidx.constraintlayout.widget.ConstraintLayout>
@ -191,7 +153,7 @@
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/v4"
tools:text="Hemanth savarala" />
tools:text="@tools:sample/lorem" />
</androidx.constraintlayout.widget.ConstraintLayout>

View file

@ -16,7 +16,8 @@
<androidx.coordinatorlayout.widget.CoordinatorLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
android:layout_height="match_parent"
android:background="?attr/colorSurface">
<com.google.android.material.appbar.AppBarLayout
android:id="@+id/appBarLayout"
@ -49,16 +50,18 @@
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<code.name.monkey.retromusic.views.WidthFitSquareCardView
android:id="@+id/albumCoverContainer"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginEnd="16dp"
android:transitionName="@string/transition_album_art"
app:cardCornerRadius="24dp"
app:cardElevation="8dp"
app:cardUseCompatPadding="true"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">

View file

@ -16,7 +16,8 @@
<androidx.coordinatorlayout.widget.CoordinatorLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
android:layout_height="match_parent"
android:background="?attr/colorSurface">
<com.google.android.material.appbar.AppBarLayout
android:id="@+id/appBarLayout"

View file

@ -27,42 +27,36 @@
android:layout_height="wrap_content"
app:layout_behavior="com.google.android.material.appbar.AppBarLayout$ScrollingViewBehavior">
<FrameLayout
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1">
android:layout_height="wrap_content"
android:clipToPadding="false"
android:orientation="vertical">
<LinearLayout
<include
layout="@layout/bug_report_card_report"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:clipToPadding="false"
android:orientation="vertical">
android:layout_marginBottom="8dp" />
<include
layout="@layout/bug_report_card_report"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="8dp" />
<include
layout="@layout/bug_report_card_device_info"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<include
layout="@layout/bug_report_card_device_info"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<Space
android:layout_width="match_parent"
android:layout_height="56dp"
android:layout_margin="16dp" />
<Space
android:layout_width="match_parent"
android:layout_height="56dp"
android:layout_margin="16dp" />
</LinearLayout>
</LinearLayout>
<com.google.android.material.floatingactionbutton.FloatingActionButton
android:id="@+id/sendFab"
style="@style/Fab"
android:layout_gravity="bottom|end"
android:layout_margin="16dp"
app:srcCompat="@drawable/ic_send_white_24dp" />
</FrameLayout>
</androidx.core.widget.NestedScrollView>
<com.google.android.material.floatingactionbutton.FloatingActionButton
android:id="@+id/sendFab"
style="@style/Fab"
android:layout_gravity="bottom|end"
android:layout_margin="16dp"
app:srcCompat="@drawable/ic_send_white_24dp" />
</androidx.coordinatorlayout.widget.CoordinatorLayout>

View file

@ -9,7 +9,10 @@
<com.google.android.material.appbar.AppBarLayout
android:id="@+id/appBarLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content">
android:layout_height="wrap_content"
android:background="@android:color/transparent"
android:elevation="0dp"
app:elevation="0dp">
<com.google.android.material.appbar.MaterialToolbar
android:id="@+id/toolbar"
@ -19,7 +22,7 @@
app:contentInsetStart="0dp"
app:contentInsetStartWithNavigation="0dp"
app:layout_scrollFlags="scroll|enterAlways"
app:navigationIcon="@drawable/ic_keyboard_arrow_down_black_24dp"
app:navigationIcon="@drawable/ic_keyboard_backspace_black_24dp"
app:subtitleTextAppearance="@style/TextAppearance.AppCompat.Caption"
app:titleMargin="0dp"
app:titleMarginStart="0dp"

View file

@ -10,6 +10,7 @@
android:id="@+id/appBarLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@android:color/transparent"
app:liftOnScroll="true">
<com.google.android.material.appbar.CollapsingToolbarLayout

View file

@ -4,6 +4,7 @@
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="?attr/colorSurface"
android:orientation="vertical"
tools:ignore="UnusedAttribute">
@ -20,9 +21,11 @@
<com.google.android.material.appbar.AppBarLayout
android:id="@+id/appBarLayout"
android:background="?attr/colorPrimary"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@android:color/transparent"
android:elevation="0dp"
app:elevation="0dp"
app:liftOnScroll="true">
<FrameLayout
@ -33,7 +36,6 @@
<com.google.android.material.appbar.MaterialToolbar
android:id="@+id/toolbar"
style="@style/Toolbar"
android:background="?attr/colorPrimary"
app:navigationIcon="@drawable/ic_keyboard_backspace_black_24dp"
app:titleTextAppearance="@style/ToolbarTextAppearanceNormal" />
@ -49,6 +51,7 @@
android:id="@+id/recyclerView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:clipToPadding="false"
android:scrollbars="none"
app:layout_behavior="com.google.android.material.appbar.AppBarLayout$ScrollingViewBehavior" />

View file

@ -25,6 +25,7 @@
android:id="@+id/appBarLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@android:color/transparent"
android:elevation="0dp"
app:elevation="0dp">

View file

@ -5,13 +5,14 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
android:background="?attr/colorSurface"
android:orientation="vertical">
<com.google.android.material.appbar.AppBarLayout
android:id="@+id/appBarLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?colorPrimary"
android:background="@android:color/transparent"
android:fitsSystemWindows="true"
app:liftOnScroll="true">
@ -77,9 +78,9 @@
android:layout_height="wrap_content"
android:background="?roundSelector"
android:padding="12dp"
android:visibility="gone"
app:srcCompat="@drawable/ic_close_white_24dp"
app:tint="?colorOnSurface"
android:visibility="gone"
tools:visibility="visible" />
</FrameLayout>
</LinearLayout>

View file

@ -10,6 +10,7 @@
android:id="@+id/appBarLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@android:color/transparent"
app:liftOnScroll="true">
<com.google.android.material.appbar.MaterialToolbar

View file

@ -4,7 +4,6 @@
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:cardBackgroundColor="?cardBackgroundColor"
app:cardCornerRadius="8dp"
app:cardUseCompatPadding="true">
@ -33,7 +32,7 @@
android:padding="16dp"
android:textAppearance="@style/TextAppearance.MaterialComponents.Body1"
android:textColor="?android:textColorSecondary"
tools:text="@string/donate_summary" />
tools:text="@tools:sample/lorem/random" />
</LinearLayout>
</com.google.android.material.card.MaterialCardView>

View file

@ -34,22 +34,6 @@
app:statusBarScrim="@color/md_black_1000"
app:titleEnabled="false">
<FrameLayout
android:id="@+id/imageContainer"
android:layout_width="match_parent"
android:layout_height="228dp"
app:layout_collapseMode="parallax">
<androidx.appcompat.widget.AppCompatImageView
android:id="@+id/bannerImage"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scaleType="centerCrop"
app:layout_collapseMode="parallax"
tools:background="@color/md_red_400"
tools:ignore="ContentDescription"
tools:srcCompat="@tools:sample/backgrounds/scenic[9]" />
</FrameLayout>
<LinearLayout
android:layout_width="match_parent"
@ -66,33 +50,6 @@
</FrameLayout>
<com.google.android.material.card.MaterialCardView
android:id="@+id/toolbarContainer"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/toolbar_margin_horizontal"
android:layout_marginTop="@dimen/toolbar_margin_vertical"
android:layout_marginEnd="@dimen/toolbar_margin_horizontal"
android:layout_marginBottom="@dimen/toolbar_margin_vertical"
app:cardBackgroundColor="@android:color/transparent"
app:cardCornerRadius="8dp"
app:cardUseCompatPadding="true"
app:layout_scrollFlags="scroll|enterAlways"
app:shapeAppearance="@style/ToolbarCornerCardView">
<com.google.android.material.appbar.MaterialToolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="@dimen/toolbar_height"
android:background="?colorSurface"
app:contentInsetStart="0dp"
app:contentInsetStartWithNavigation="0dp"
app:popupTheme="?toolbarPopupTheme"
app:title="@string/search_hint"
app:titleMarginStart="0dp"
app:titleTextAppearance="@style/ToolbarTextAppearanceSearch"
tools:ignore="UnusedAttribute" />
</com.google.android.material.card.MaterialCardView>
</LinearLayout>
</com.google.android.material.appbar.CollapsingToolbarLayout>
</com.google.android.material.appbar.AppBarLayout>
@ -100,17 +57,112 @@
<androidx.core.widget.NestedScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:behavior_overlapTop="24dp"
app:layout_behavior="com.google.android.material.appbar.AppBarLayout$ScrollingViewBehavior">
<com.google.android.material.card.MaterialCardView
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:cardBackgroundColor="?colorPrimary"
app:cardElevation="8dp"
app:shapeAppearanceOverlay="@style/TopCornerCardView">
android:orientation="vertical">
<com.google.android.material.card.MaterialCardView
android:id="@+id/imageContainer"
android:layout_width="match_parent"
android:layout_height="228dp"
app:cardCornerRadius="24dp"
app:cardUseCompatPadding="true">
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<androidx.appcompat.widget.AppCompatImageView
android:id="@+id/bannerImage"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scaleType="centerCrop"
app:layout_collapseMode="parallax"
tools:ignore="ContentDescription"
tools:srcCompat="@tools:sample/backgrounds/scenic[9]" />
<com.google.android.material.card.MaterialCardView
android:id="@+id/toolbarContainer"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/toolbar_margin_horizontal"
android:layout_marginTop="8dp"
android:layout_marginEnd="@dimen/toolbar_margin_horizontal"
app:cardBackgroundColor="@android:color/transparent"
app:cardCornerRadius="8dp"
app:cardUseCompatPadding="true"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_scrollFlags="scroll|enterAlways"
app:shapeAppearance="@style/ToolbarCornerCardView">
<com.google.android.material.appbar.MaterialToolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="@dimen/toolbar_height"
android:background="?attr/colorSurface"
app:contentInsetStart="0dp"
app:contentInsetStartWithNavigation="0dp"
app:popupTheme="?toolbarPopupTheme"
app:title="@string/search_hint"
app:titleMarginStart="0dp"
app:titleTextAppearance="@style/ToolbarTextAppearanceSearch"
tools:ignore="UnusedAttribute" />
</com.google.android.material.card.MaterialCardView>
<View
android:layout_width="match_parent"
android:layout_height="52dp"
android:background="@drawable/shadow_up"
app:layout_constraintBottom_toBottomOf="parent" />
<code.name.monkey.retromusic.views.CircularImageView
android:id="@+id/userImage"
android:layout_width="42dp"
android:layout_height="42dp"
android:layout_marginStart="16dp"
android:layout_marginBottom="8dp"
app:civ_border="false"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
tools:srcCompat="@tools:sample/avatars" />
<com.google.android.material.textview.MaterialTextView
android:id="@+id/text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:ellipsize="end"
android:text="@string/welcome"
android:textColor="@color/md_white_1000"
app:layout_constraintStart_toEndOf="@+id/userImage"
app:layout_constraintTop_toTopOf="@+id/userImage" />
<com.google.android.material.textview.MaterialTextView
android:id="@+id/titleWelcome"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:padding="0dp"
android:textAppearance="@style/TextViewHeadline5"
android:textColor="@color/md_white_1000"
android:textStyle="bold"
app:layout_constraintBottom_toBottomOf="@+id/userImage"
app:layout_constraintStart_toEndOf="@+id/userImage"
app:layout_constraintTop_toBottomOf="@+id/text"
tools:text="@string/app_name" />
</androidx.constraintlayout.widget.ConstraintLayout>
</com.google.android.material.card.MaterialCardView>
<include layout="@layout/home_content" />
</com.google.android.material.card.MaterialCardView>
</LinearLayout>
</androidx.core.widget.NestedScrollView>
</androidx.coordinatorlayout.widget.CoordinatorLayout>

View file

@ -16,7 +16,6 @@
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:background="?colorPrimary"
android:layout_height="match_parent"
android:orientation="vertical">
@ -35,7 +34,7 @@
android:id="@+id/appBarLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?colorPrimary"
android:background="@android:color/transparent"
app:liftOnScroll="true">
<com.google.android.material.card.MaterialCardView

View file

@ -7,7 +7,6 @@
app:layout_behavior="com.google.android.material.appbar.AppBarLayout$ScrollingViewBehavior">
<com.google.android.material.textview.MaterialTextView
android:textColor="?colorOnSecondary"
android:id="@+id/offlineLyrics"
android:layout_width="match_parent"
android:layout_height="wrap_content"
@ -18,5 +17,6 @@
android:paddingEnd="16dp"
android:paddingBottom="128dp"
android:text="@string/no_lyrics_found"
android:textAppearance="@style/TextViewBody1" />
android:textAppearance="@style/TextViewBody1"
android:textColor="?android:attr/textColorPrimary" />
</ScrollView>

View file

@ -49,7 +49,6 @@
android:paddingEnd="16dp"
android:text="@string/retro_music_pro"
android:textAppearance="@style/TextViewSubtitle1"
android:textColor="?colorOnPrimary"
android:textStyle="bold"
app:layout_constraintTop_toBottomOf="@id/diamondIcon" />
@ -83,6 +82,7 @@
android:textAllCaps="false"
android:textColor="?colorAccent"
android:textStyle="bold"
app:backgroundTint="?attr/colorSurface"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
@ -122,7 +122,6 @@
android:singleLine="true"
android:text="@string/general_settings_title"
android:textAppearance="@style/TextViewSubtitle1"
android:textColor="?colorOnPrimary"
android:textStyle="bold" />
<com.google.android.material.textview.MaterialTextView

View file

@ -1,7 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
<?xml version="1.0" encoding="utf-8"?><!--
~ Copyright (c) 2019 Hemanth Savarala.
~
~ Licensed under the GNU General Public License v3
@ -20,6 +17,7 @@
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="?attr/colorSurface"
android:descendantFocusability="blocksDescendants"
android:focusable="true"
android:focusableInTouchMode="true"
@ -53,16 +51,17 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_margin="24dp"
android:gravity="center_horizontal"
android:orientation="vertical"
android:visibility="gone"
tools:visibility="visible">
<androidx.appcompat.widget.AppCompatImageView
app:tint="?colorOnSecondary"
android:layout_width="96dp"
android:layout_height="96dp"
app:srcCompat="@drawable/ic_play_arrow_white_64dp" />
app:srcCompat="@drawable/ic_play_arrow_white_64dp"
app:tint="?colorOnSecondary" />
<com.google.android.material.textview.MaterialTextView
android:id="@+id/emptyText"

View file

@ -33,7 +33,7 @@
android:paddingEnd="8dp"
android:paddingBottom="4dp"
android:textAppearance="@style/TextViewNormal"
android:textColor="?attr/colorOnPrimary"
android:textColor="?android:attr/textColorPrimary"
tools:ignore="MissingPrefix"
tools:text="My top tracks" />
</LinearLayout>

View file

@ -28,6 +28,6 @@
android:gravity="center"
android:maxLines="1"
android:paddingTop="12dp"
android:textColor="?attr/colorOnPrimary"
android:textColor="?android:attr/textColorPrimary"
tools:text="Name" />
</LinearLayout>

View file

@ -41,6 +41,6 @@
android:layout_weight="1"
android:text="@string/folders"
android:textAppearance="@style/TextViewNormal"
android:textColor="?attr/colorOnPrimary"
android:textColor="?android:attr/textColorPrimary"
android:textSize="16sp" />
</LinearLayout>

View file

@ -42,9 +42,7 @@
android:paddingStart="16dp"
android:paddingTop="6dp"
android:paddingEnd="8dp"
android:paddingBottom="4dp"
android:textAppearance="@style/TextViewNormal"
android:textColor="?colorOnBackground"
android:paddingBottom="4dp"
tools:ignore="MissingPrefix"
tools:text="My top tracks" />

View file

@ -51,10 +51,9 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:background="?attr/colorSurface"
android:elevation="0dp"
android:visibility="gone"
app:itemBackground="@drawable/bottom_navigation_item_background"
app:backgroundTint="?android:attr/windowBackground"
app:itemHorizontalTranslationEnabled="false"
app:itemIconTint="@drawable/bottom_navigation_item_colors"
app:itemTextAppearanceActive="@style/BottomSheetItemTextAppearanceActive"

View file

@ -158,7 +158,6 @@
<string name="error">Hiba</string>
<string name="faq">GYIK</string>
<string name="favorites">Kedvencek</string>
<string name="favorites_songs">Te vagy a legkedvencebb dal</string>
<string name="finish_last_song">Fejezze be az utolsó dalt</string>
<string name="fit">Fit</string>
<string name="flat">Lapos</string>
@ -216,8 +215,6 @@
<string name="material">Materiál</string>
<string name="md_error_label">Hiba</string>
<string name="md_storage_perm_error">Engedély hiba</string>
<string name="most_played_albums">A legtöbb játszott albumok</string>
<string name="most_played_artists">A legtöbb játszott művész</string>
<string name="my_name">Név</string>
<string name="my_top_tracks">Legjobb számok</string>
<string name="never">Soha</string>
@ -361,8 +358,6 @@
<string name="queue">Sorban áll</string>
<string name="rate_app">Értékeld az alkalmazást</string>
<string name="rate_on_google_play_summary">Szereted ezt az app-ot a Google Play áruházban, hogy jobb élményt nyújtsunk</string>
<string name="recent_added_albums">Nemrégiben hozzáadott albumok</string>
<string name="recent_added_artists">Nemrégiben hozzáadott művészek</string>
<string name="recent_albums">Legutóbbi albumok</string>
<string name="recent_artists">Legújabb előadók</string>
<string name="remove_action">Eltávolítás</string>

View file

@ -272,8 +272,6 @@ https://play.google.com/store/apps/details?id=%s</string>
<string name="favorites">Preferiti</string>
<string name="favorites_songs">I tuoi brani preferiti</string>
<string name="finish_last_song">Termina ultimo brano</string>
<string name="fit">Adatta</string>
@ -376,9 +374,6 @@ https://play.google.com/store/apps/details?id=%s</string>
<string name="md_storage_perm_error">Errore di autorizzazione</string>
<string name="most_played_albums">Album più ascoltati</string>
<string name="most_played_artists">Artisti più ascoltati</string>
<string name="my_name">Nome</string>
<string name="my_top_tracks">I più riprodotti</string>
@ -584,9 +579,6 @@ https://play.google.com/store/apps/details?id=%s</string>
<string name="rate_on_google_play_summary">Adori quest\'app? Facci sapere sul Play Store come possiamo renderla ancora migliore</string>
<string name="recent_added_albums">Album aggiunti di recente</string>
<string name="recent_added_artists">Artisti aggiunti di recente</string>
<string name="recent_albums">Album recenti</string>
<string name="recent_artists">Artisti recenti</string>

View file

@ -158,7 +158,6 @@
<string name="error">Hata</string>
<string name="faq">SSS</string>
<string name="favorites">Gözdeler</string>
<string name="favorites_songs">Favori Şarkıların</string>
<string name="finish_last_song">Son şarkıyı bitir</string>
<string name="fit">Fit</string>
<string name="flat">Düz</string>
@ -216,8 +215,6 @@
<string name="material">Materyal</string>
<string name="md_error_label">Hata</string>
<string name="md_storage_perm_error">İzin hatası</string>
<string name="most_played_albums">En çok çalınan albümler</string>
<string name="most_played_artists">En çok çalınan sanatçılar</string>
<string name="my_name">İsim</string>
<string name="my_top_tracks">Sık oynatılanlar</string>
<string name="never">Asla</string>
@ -361,8 +358,6 @@
<string name="queue">Kuyruk</string>
<string name="rate_app">Uygulamayı Değerlendir</string>
<string name="rate_on_google_play_summary">Bu uygulamayı sevdin mi? Daha iyi bir gelişim için lütfen Google Play\'de nasıl daha iyi yapabileceğimizi bildir.</string>
<string name="recent_added_albums">Son eklenen albümler</string>
<string name="recent_added_artists">Son eklenen sanatçılar</string>
<string name="recent_albums">Son albümler</string>
<string name="recent_artists">Son sanatçılar</string>
<string name="remove_action">Kaldır</string>

View file

@ -158,7 +158,6 @@
<string name="error">錯誤</string>
<string name="faq">常見問題</string>
<string name="favorites">我的最愛</string>
<string name="favorites_songs">你最喜愛的歌曲</string>
<string name="finish_last_song">最後一首已經結束播放</string>
<string name="fit">Fit</string>
<string name="flat">平面</string>
@ -216,8 +215,6 @@
<string name="material">物質</string>
<string name="md_error_label">錯誤</string>
<string name="md_storage_perm_error">權限錯誤</string>
<string name="most_played_albums">最常播放的專輯</string>
<string name="most_played_artists">最常播放的歌手</string>
<string name="my_name">名字</string>
<string name="my_top_tracks">最常播放</string>
<string name="never">永不</string>
@ -361,8 +358,6 @@
<string name="queue">播放列表</string>
<string name="rate_app">為這個App評分</string>
<string name="rate_on_google_play_summary">喜歡這個App嗎?請讓我們知道如何提供更好的體驗</string>
<string name="recent_added_albums">最近新增的專輯</string>
<string name="recent_added_artists">最近新增的歌手</string>
<string name="recent_albums">近期專輯</string>
<string name="recent_artists">近期歌手</string>
<string name="remove_action">移除</string>

View file

@ -6,73 +6,105 @@
<string name="accent_color_desc">The theme accent color, defaults to purple</string>
<string name="action_about">About</string>
<string name="action_add_to_favorites">Add to favorites</string>
<string name="action_add_to_playing_queue">Add to playing queue</string>
<string name="action_add_to_playlist">Add to playlist</string>
<string name="action_clear_playing_queue">Clear playing queue</string>
<string name="action_clear_playlist">Clear playlist</string>
<string name="action_cycle_repeat">Cycle repeat mode</string>
<string name="action_delete">Delete</string>
<string name="action_delete_from_device">Delete from device</string>
<string name="action_details">Details</string>
<string name="action_go_to_album">Go to album</string>
<string name="action_go_to_artist">Go to artist</string>
<string name="action_go_to_genre">Go to genre</string>
<string name="action_go_to_start_directory">Go to start directory</string>
<string name="action_grant">Grant</string>
<string name="action_grid_size">Grid size</string>
<string name="action_grid_size_land">Grid size (land)</string>
<string name="action_new_playlist">New playlist</string>
<string name="action_next">Next</string>
<string name="action_play">Play</string>
<string name="action_play_all">Play all</string>
<string name="action_play_next">Play next</string>
<string name="action_play_pause">Play/Pause</string>
<string name="action_previous">Previous</string>
<string name="action_remove_from_favorites">Remove from favorites</string>
<string name="action_remove_from_playing_queue">Remove from playing queue</string>
<string name="action_remove_from_playlist">Remove from playlist</string>
<string name="action_rename">Rename</string>
<string name="action_save_playing_queue">Save playing queue</string>
<string name="action_scan">Scan</string>
<string name="action_search">Search</string>
<string name="action_set">Start</string>
<string name="action_set_as_ringtone">Set as ringtone</string>
<string name="action_set_as_start_directory">Set as start directory</string>
<string name="action_settings">"Settings"</string>
<string name="action_share">Share</string>
<string name="action_shuffle_all">Shuffle all</string>
<string name="action_shuffle_playlist">Shuffle playlist</string>
<string name="action_sleep_timer">Sleep timer</string>
<string name="action_sort_order">Sort order</string>
<string name="action_tag_editor">Tag editor</string>
<string name="action_toggle_favorite">Toggle favorite</string>
<string name="action_toggle_shuffle">Toggle shuffle mode</string>
<string name="adaptive">Adaptive</string>
<string name="add_action">Add</string>
<string name="add_lyrics">Add lyrics</string>
<string name="add_photo">Add \nphoto</string>
<string name="add_playlist_title">"Add to playlist"</string>
<string name="add_time_framed_lryics">Add time frame lyrics</string>
<string name="added_title_to_playing_queue">"Added 1 title to the playing queue."</string>
<string name="added_x_titles_to_playing_queue">Added %1$d titles to the playing queue.</string>
<string name="album">Album</string>
<string name="album_artist">Album artist</string>
<string name="album_or_artist_empty">The title or artist is empty.</string>
<string name="albums">Albums</string>
<string name="always">Always</string>
<string name="app_share">Hey check out this cool music player at: https://play.google.com/store/apps/details?id=%s</string>
<string name="app_shortcut_shuffle_all_short">Shuffle</string>
<string name="app_shortcut_top_tracks_short">Top Tracks</string>
<string name="app_widget_big_name">Retro music - Big</string>
<string name="app_widget_card_name">Retro music - Card</string>
<string name="app_widget_classic_name">Retro music - Classic</string>
@ -84,6 +116,7 @@
<string name="artists">Artists</string>
<string name="audio_focus_denied">Audio focus denied.</string>
<string name="audio_settings_summary">Change the sound settings and adjust the equalizer controls</string>
<string name="auto">Auto</string>
@ -101,6 +134,7 @@
<string name="blacklist">Blacklist</string>
<string name="blur">Blur</string>
<string name="blur_card">Blur Card</string>
<string name="bug_report_failed">Unable to send report</string>
@ -123,11 +157,15 @@
<string name="cancel_current_timer">Cancel</string>
<string name="card">Card</string>
<string name="card_circular_style">Circular</string>
<string name="card_color_style">Colored Card</string>
<string name="card_style">Card</string>
<string name="carousal">Carousel</string>
<string name="carousal_effect_on_now_playing_screen">Carousel effect on the now playing screen</string>
<string name="cascading">Cascading</string>
@ -135,6 +173,7 @@
<string name="cast">Cast</string>
<string name="changelog">Changelog</string>
<string name="changelog_summary">Changelog maintained on the Telegram channel</string>
<string name="circular">Circular</string>
@ -142,15 +181,20 @@
<string name="classic">Classic</string>
<string name="clear_action">Clear</string>
<string name="clear_app_data">Clear app data</string>
<string name="clear_blacklist">Clear blacklist</string>
<string name="clear_playing_queue">Clear queue</string>
<string name="clear_playlist_title">Clear playlist</string>
<string name="clear_playlist_x"><![CDATA[Clear the playlist <b>%1$s</b>? This can\u2019t be undone!]]></string>
<string name="close_notification">Close</string>
<string name="color">Color</string>
<string name="color_theme_name">Color</string>
<string name="colors">Colors</string>
@ -178,13 +222,16 @@
<string name="delete_playlist_title">Delete playlist</string>
<string name="delete_playlist_x"><![CDATA[Delete the playlist <b>%1$s</b>?]]></string>
<string name="delete_playlists_title">Delete playlists</string>
<string name="delete_song_title">Delete song</string>
<string name="delete_song_x"><![CDATA[Delete the song <b>%1$s</b>?]]></string>
<string name="delete_songs_title">Delete songs</string>
<string name="delete_x_playlists"><![CDATA[Delete <b>%1$d</b> playlists?]]></string>
<string name="delete_x_songs"><![CDATA[Delete <b>%1$d</b> songs?]]></string>
<string name="deleted_x_songs">Deleted %1$d songs.</string>
<string name="deleting_songs">Deleting songs</string>
@ -196,12 +243,14 @@
<string name="device_info">Device info</string>
<string name="dialog_message_set_ringtone">Allow Retro Music to modify audio settings</string>
<string name="dialog_title_set_ringtone">Set ringtone</string>
<string name="do_you_want_to_clear_the_blacklist">Do you want to clear the blacklist?</string>
<string name="do_you_want_to_remove_from_the_blacklist"><![CDATA[Do you want to remove <b>%1$s</b> from the blacklist?]]></string>
<string name="donate">Donate</string>
<string name="donate_summary">If you think I deserve to get paid for my work, you can leave some money here</string>
<string name="donation_header">Buy me a:</string>
@ -209,6 +258,7 @@
<string name="download_from_last_fm">Download from Last.fm</string>
<string name="edit">Edit</string>
<string name="edit_cover">Edit cover</string>
<string name="empty">Empty</string>
@ -220,7 +270,6 @@
<string name="faq">FAQ</string>
<string name="favorites">Favorites</string>
<string name="favorites_songs">You\'re most favorites songs</string>
<string name="finish_last_song">Finish last song</string>
@ -235,6 +284,7 @@
<string name="for_you">For you</string>
<string name="full">Full</string>
<string name="full_card">Full card</string>
<string name="general_settings_summary">Change the theme and colors of the app</string>
@ -256,6 +306,7 @@
<string name="grid_size_6">6</string>
<string name="grid_size_7">7</string>
<string name="grid_size_8">8</string>
<string name="grid_style_label"><![CDATA[Grids & Style]]></string>
<string name="hinge">Hinge</string>
@ -267,7 +318,9 @@
<string name="horizontal_flip">Horizontal flip</string>
<string name="image">Image</string>
<string name="image_gradient">Gradient image</string>
<string name="image_settings_summary">Change artist image download settings</string>
<string name="inserted_x_songs_into_playlist_x">Inserted %1$d songs into the playlist %2$s.</string>
@ -278,21 +331,28 @@
<string name="keyboard">Keyboard</string>
<string name="label_bit_rate">Bitrate</string>
<string name="label_file_format">Format</string>
<string name="label_file_name">File name</string>
<string name="label_file_path">File path</string>
<string name="label_file_size">Size</string>
<string name="label_more_from">More from %s</string>
<string name="label_sampling_rate">Sampling rate</string>
<string name="label_track_length">Length</string>
<string name="labeled">Labeled</string>
<string name="last_added">Last added</string>
<string name="last_song">Last song</string>
<string name="lets_play_something">Let\'s play some music</string>
<string name="library">Library</string>
<string name="library_categories">Library categories</string>
<string name="licenses">Licenses</string>
@ -312,36 +372,49 @@
<string name="material">Material</string>
<string name="md_error_label">Error</string>
<string name="md_storage_perm_error">Permission error</string>
<string name="most_played_albums">Most played albums</string>
<string name="most_played_artists">Most played artists</string>
<string name="my_name">Name</string>
<string name="my_top_tracks">Most played</string>
<string name="never">Never</string>
<string name="new_banner_photo">New banner photo</string>
<string name="new_playlist_title">New playlist</string>
<string name="new_profile_photo">New profile photo</string>
<string name="new_start_directory">%s is the new start directory.</string>
<string name="next_song">Next Song</string>
<string name="no_albums">You have no albums</string>
<string name="no_artists">You have no artists</string>
<string name="no_audio_ID">"Play a song first, then try again."</string>
<string name="no_equalizer">No equalizer found</string>
<string name="no_genres">You have no genres</string>
<string name="no_lyrics_found">No lyrics found</string>
<string name="no_playlists">You have no playlists</string>
<string name="no_purchase_found">No purchase found.</string>
<string name="no_results">No results</string>
<string name="no_songs">You have no songs</string>
<string name="normal">Normal</string>
<string name="normal_lyrics">Normal lyrics</string>
<string name="normal_style">Normal</string>
<string name="not_listed_in_media_store"><![CDATA[<b>%s</b> is not listed in the media store.]]></string>
@ -349,6 +422,7 @@
<string name="nothing_to_scan">Nothing to scan.</string>
<string name="notification">Notification</string>
<string name="notification_settings_summary">Customize the notification style</string>
<string name="now_playing">Now playing</string>
@ -375,9 +449,11 @@
<string name="permissions_denied">Permissions denied.</string>
<string name="personalize">Personalize</string>
<string name="personalize_settings_summary">Customize your now playing and UI controls</string>
<string name="pick_from_local_storage">Pick from local storage</string>
<string name="pick_image_intent_text">Pick image</string>
<string name="pinterest_page">Pinterest</string>
@ -389,16 +465,24 @@
<string name="playing_notification_name">Playing notification</string>
<string name="playlist_empty_text">Empty playlist</string>
<string name="playlist_is_empty">Playlist is empty</string>
<string name="playlist_name_empty">Playlist name</string>
<string name="playlists">Playlists</string>
<string name="pref_album_detail_style">Album detail style</string>
<string name="pref_blur_amount_summary">Amount of blur applied for blur themes, lower is faster</string>
<string name="pref_blur_amount_title">Blur amount</string>
<string name="pref_dialog_corner_summary">Adjust the bottom sheet dialog corners</string>
<string name="pref_dialog_corner_title">Dialog corner</string>
<string name="pref_filter_song_summary">Filter songs by length</string>
<string name="pref_filter_song_title">Filter song duration</string>
<string name="pref_header_album">Album style</string>
<string name="pref_header_audio">Audio</string>
<string name="pref_header_controls">Controls</string>
@ -407,14 +491,17 @@
<string name="pref_header_library">Library</string>
<string name="pref_header_lockscreen">Lockscreen</string>
<string name="pref_header_playlists">Playlists</string>
<string name="pref_keep_pause_on_zero_volume_summary">Pauses the song when the volume decreases to zero and starts playing back when the volume level rises. Also works outside the app</string>
<string name="pref_keep_pause_on_zero_volume_title">Pause on zero</string>
<string name="pref_keep_screen_on_summary">Keep in mind that enabling this feature may affect battery life</string>
<string name="pref_keep_screen_on_title">Keep the screen on</string>
<string name="pref_now_playing_screen_summary">Click to open with or slide to without transparent navigation of now playing screen</string>
<string name="pref_now_playing_screen_title">Click or Slide</string>
<string name="pref_snow_fall_title">Snow fall effect</string>
<string name="pref_summary_album_art_on_lockscreen">Use the currently playing song album cover as the lockscreen wallpaper</string>
<string name="pref_summary_audio_ducking">Lower the volume when a system sound is played or a notification is received</string>
<string name="pref_summary_blacklist">The content of blacklisted folders is hidden from your library.</string>
@ -441,6 +528,7 @@
<string name="pref_summary_toggle_headset">Start playing immediately after headphones are connected</string>
<string name="pref_summary_toggle_shuffle">Shuffle mode will turn off when playing a new list of songs</string>
<string name="pref_summary_toggle_volume">If enough space is available, show volume controls in the now playing screen</string>
<string name="pref_title_album_art_on_lockscreen">Show album cover</string>
<string name="pref_title_album_cover_style">Album cover theme</string>
<string name="pref_title_album_cover_transform">Album cover skip</string>
@ -487,34 +575,44 @@
<string name="profile">Profile</string>
<string name="purchase">Purchase</string>
<string name="purchase_summary">*Think before buying, don\'t ask for refund.</string>
<string name="queue">Queue</string>
<string name="rate_app">Rate the app</string>
<string name="rate_on_google_play_summary">Love this app? Let us know in the Google Play Store how we can make it even better</string>
<string name="recent_added_albums">Recently added albums</string>
<string name="recent_added_artists">Recently added artists</string>
<string name="recent_albums">Recent albums</string>
<string name="recent_artists">Recent artists</string>
<string name="remove_action">Remove</string>
<string name="remove_banner_photo">Remove banner photo</string>
<string name="remove_cover">Remove cover</string>
<string name="remove_from_blacklist">Remove from blacklist</string>
<string name="remove_profile_photo">Remove profile photo</string>
<string name="remove_song_from_playlist_title">Remove song from playlist</string>
<string name="remove_song_x_from_playlist"><![CDATA[Remove the song <b>%1$s</b> from the playlist?]]></string>
<string name="remove_songs_from_playlist_title">Remove songs from playlist</string>
<string name="remove_x_songs_from_playlist"><![CDATA[Remove <b>%1$d</b> songs from the playlist?]]></string>
<string name="rename_playlist_title">Rename playlist</string>
<string name="report_an_issue">Report an issue</string>
<string name="report_bug">Report bug</string>
<string name="reset_action">Reset</string>
<string name="reset_artist_image">Reset artist image</string>
<string name="restore">Restore</string>
@ -525,11 +623,14 @@
<string name="restoring_purchase">Restoring purchase…</string>
<string name="retro_equalizer">Retro Music Equalizer</string>
<string name="retro_music_pro">Retro Music Pro</string>
<string name="saf_delete_failed">File delete failed: %s</string>
<!-- SAF -->
<string name="saf_error_uri">Can\'t get SAF URI</string>
<string name="saf_guide_slide1_description">Open navigation drawer</string>
<string name="saf_guide_slide1_description_before_o">Enable \'Show SD card\' in overflow menu</string>
<!-- SAF guide -->
@ -538,12 +639,15 @@
<string name="saf_guide_slide2_title">Select your SD card in navigation drawer</string>
<string name="saf_guide_slide3_description">Do not open any sub-folders</string>
<string name="saf_guide_slide3_title">Tap \'select\' button at the bottom of the screen</string>
<string name="saf_write_failed">File write failed: %s</string>
<string name="save">Save</string>
<!-- SAF -->
<!-- SAF guide -->
<string name="save_playlist_title">Save as file</string>
<string name="save_playlists_title">Save as files</string>
<string name="saved_playlist_to">Saved playlist to %s.</string>
@ -557,6 +661,7 @@
<string name="search_hint">Search your library…</string>
<string name="select_all">Select all</string>
<string name="select_banner_photo">Select banner photo</string>
<string name="selected">Selected</string>
@ -564,7 +669,9 @@
<string name="send_crash_log">Send crash log</string>
<string name="set">Set</string>
<string name="set_artist_image">Set artist image</string>
<string name="set_photo">Set a profile photo</string>
<string name="share_app">Share app</string>
@ -583,6 +690,7 @@
<string name="social">Social</string>
<string name="song">Song</string>
<string name="song_duration">Song duration</string>
<string name="songs">Songs</string>
@ -597,6 +705,7 @@
<string name="sort_order_z_a">Descending</string>
<string name="speech_not_supported">Sorry! Your device doesn\'t support speech input</string>
<string name="speech_prompt">Search your library</string>
<string name="stack">Stack</string>
@ -624,29 +733,37 @@
<string name="the_audio_file">The audio file</string>
<string name="this_month">This month</string>
<string name="this_week">This week</string>
<string name="this_year">This year</string>
<string name="tiny">Tiny</string>
<string name="title">Title</string>
<string name="title_dashboard">Dashboard</string>
<string name="title_good_afternoon">Good afternoon</string>
<string name="title_good_day">Good day</string>
<string name="title_good_evening">Good evening</string>
<string name="title_good_morning">Good morning</string>
<string name="title_good_night">Good night</string>
<string name="title_user_info">What\'s Your Name</string>
<string name="today">Today</string>
<string name="top_albums">Top albums</string>
<string name="top_artists">Top artists</string>
<string name="track_hint">"Track (2 for track 2 or 3004 for CD3 track 4)"</string>
<string name="track_list">Track number</string>
<string name="translate">Translate</string>
<string name="translate_community">Help us translate the app to your language</string>
<string name="twitter_page">Twitter</string>
@ -679,19 +796,20 @@
<string name="whats_new">What\'s New</string>
<string name="window">Window</string>
<string name="window_corner_edges">Rounded corners</string>
<string name="x_has_been_set_as_ringtone">Set %1$s as your ringtone.</string>
<string name="x_selected">%1$d selected</string>
<string name="year">Year</string>
<string name="you_have_to_select_at_least_one_category">You have to select at least one category.</string>
<string name="you_will_be_forwarded_to_the_issue_tracker_website">You will be forwarded to the issue tracker website.</string>
<string name="your_account_data_is_only_used_for_authentication">Your account data is only used for authentication.</string>
<string name="label_more_from">More from %s</string>
<string name="pref_dialog_corner_summary" >Adjust the bottom sheet dialog corners</string>
<string name="pref_filter_song_summary">Filter songs by length</string>
<string name="pref_header_advanced">Advanced</string>
<string name="pref_header_blacklist">Blacklist</string>
</resources>

View file

@ -48,6 +48,7 @@
<item name="android:textAllCaps">false</item>
<item name="android:textSize">20sp</item>
<item name="android:letterSpacing">0.0125</item>
<item name="android:textColor">?android:attr/textColorPrimary</item>
</style>
<style name="BigTitleTextAppearanceToolbar">

View file

@ -20,6 +20,7 @@
<item name="roundSelector">@drawable/round_selector</item>
<item name="rectSelector">@drawable/rect_selector</item>
<item name="rectSelectorStrong">@drawable/rect_selector_strong</item>
</style>
<style name="Theme.RetroMusic.Base" parent="Theme.MaterialComponents.NoActionBar">

View file

@ -3,15 +3,45 @@
xmlns:app="http://schemas.android.com/apk/res-auto">
<code.name.monkey.appthemehelper.common.prefs.supportv7.ATEPreferenceCategory
android:layout="@layout/preference_category_title"
android:title="Advanced">
android:title="@string/pref_header_blacklist">
<code.name.monkey.retromusic.preferences.BlacklistPreference
android:key="blacklist"
android:layout="@layout/list_item_view"
android:summary="@string/pref_summary_blacklist"
android:title="@string/pref_title_blacklist"
app:enableCopying="true"
app:icon="@drawable/ic_music_note_off_white_24dp" />
</code.name.monkey.appthemehelper.common.prefs.supportv7.ATEPreferenceCategory>
<code.name.monkey.appthemehelper.common.prefs.supportv7.ATEPreferenceCategory
android:layout="@layout/preference_category_title"
android:title="@string/pref_header_playlists">
<code.name.monkey.retromusic.preferences.MaterialListPreference
android:defaultValue="this_month"
android:entries="@array/pref_playlists_last_added_interval_titles"
android:entryValues="@array/pref_playlists_last_added_interval_values"
android:key="last_added_interval"
android:layout="@layout/list_item_view"
android:negativeButtonText="@null"
android:positiveButtonText="@null"
android:title="@string/pref_title_last_added_interval"
app:enableCopying="true"
app:icon="@drawable/ic_playlist_add_white_24dp" />
</code.name.monkey.appthemehelper.common.prefs.supportv7.ATEPreferenceCategory>
<code.name.monkey.appthemehelper.common.prefs.supportv7.ATEPreferenceCategory
android:layout="@layout/preference_category_title"
android:title="@string/pref_header_advanced">
<code.name.monkey.appthemehelper.common.prefs.supportv7.ATESeekBarPreference
android:defaultValue="30"
android:key="filter_song"
android:layout="@layout/list_item_view_seekbar"
android:max="60"
android:title="@string/pref_filter_song_title"
android:summary="@string/pref_filter_song_summary"
android:title="@string/pref_filter_song_title"
app:enableCopying="true"
app:icon="@drawable/ic_filter_song_white_24dp"
app:showSeekBarValue="true" />

View file

@ -1,16 +0,0 @@
<androidx.preference.PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<code.name.monkey.appthemehelper.common.prefs.supportv7.ATEPreferenceCategory
android:layout="@layout/preference_category_title"
android:title="Blacklist">
<code.name.monkey.retromusic.preferences.BlacklistPreference
android:key="blacklist"
android:layout="@layout/list_item_view"
android:summary="@string/pref_summary_blacklist"
android:title="@string/pref_title_blacklist"
app:enableCopying="true"
app:icon="@drawable/ic_music_note_off_white_24dp" />
</code.name.monkey.appthemehelper.common.prefs.supportv7.ATEPreferenceCategory>
</androidx.preference.PreferenceScreen>

View file

@ -1,5 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.preference.PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
</androidx.preference.PreferenceScreen>

View file

@ -1,22 +0,0 @@
<androidx.preference.PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<code.name.monkey.appthemehelper.common.prefs.supportv7.ATEPreferenceCategory
android:layout="@layout/preference_category_title"
android:title="@string/pref_header_playlists">
<code.name.monkey.retromusic.preferences.MaterialListPreference
android:defaultValue="this_month"
android:entries="@array/pref_playlists_last_added_interval_titles"
android:entryValues="@array/pref_playlists_last_added_interval_values"
android:key="last_added_interval"
android:layout="@layout/list_item_view"
android:negativeButtonText="@null"
android:positiveButtonText="@null"
android:title="@string/pref_title_last_added_interval"
app:enableCopying="true"
app:icon="@drawable/ic_playlist_add_white_24dp" />
</code.name.monkey.appthemehelper.common.prefs.supportv7.ATEPreferenceCategory>
</androidx.preference.PreferenceScreen>

View file

@ -1,5 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.preference.PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
</androidx.preference.PreferenceScreen>

View file

@ -1,6 +1,6 @@
package code.name.monkey.appthemehelper.common;
import android.graphics.drawable.ColorDrawable;
import android.graphics.Color;
import android.view.Menu;
import androidx.annotation.Nullable;
@ -15,13 +15,11 @@ import code.name.monkey.appthemehelper.util.ToolbarContentTintHelper;
public class ATHToolbarActivity extends ATHActivity {
private Toolbar toolbar;
public static int getToolbarBackgroundColor(Toolbar toolbar) {
public static int getToolbarBackgroundColor(@Nullable Toolbar toolbar) {
if (toolbar != null) {
if (toolbar.getBackground() instanceof ColorDrawable) {
return ((ColorDrawable) toolbar.getBackground()).getColor();
}
return ATHUtil.INSTANCE.resolveColor(toolbar.getContext(), R.attr.colorSurface);
}
return 0;
return Color.BLACK;
}
@Override