Code clean

This commit is contained in:
h4h13 2020-02-22 17:40:12 +05:30
parent f84fe5d612
commit 00b16a27c9
61 changed files with 715 additions and 685 deletions

View file

@ -22,7 +22,7 @@ android {
vectorDrawables.useSupportLibrary = true
applicationId "code.name.monkey.retromusic"
versionCode 409
versionCode 410
versionName '3.4.950'
multiDexEnabled true

View file

@ -1 +1 @@
<html> <head> <style type="text/css"> * { word-wrap: break-word; } {style-placeholder} a { color: {link-color}; } a:active { color: {link-color-active}; } ol { list-style-position: inside; padding-left: 0; padding-right: 0; } li { padding-top: 8px; } </style> </head> <body> <h4>v3.4.950</h4> <ul> <li>Added bluetooth connection to play on device as soon as it connected</li> <li>Fix tablet version of app</li> <li>Fix Album and Artist details toolbar full width for better accessibility</li> </ul> <h4>v3.4.900</h4> <ul> <li>Added playlist search</li> <li>Added Drive mode</li> <li>Added Album and Artist layout change option in library</li> <li>Added Show more album and artist information in details</li> <li>Added Pixel style scroller bar</li> <li>Added current now playing share</li> <li>Fix font issues and colors in some places</li> <li>Improved Full now playing theme</li> </ul> <h4>v3.4.850</h4> <ul> <li>Added new theme called circle</li> <li>Added tiny color card style for home artists</li> <li>Added extra track info details to now playing themes</li> <li>Added scroll animation</li> <li>Added smooth transition animations 🤔</li> <li>Added current playing tab options for Bottom Navigation View</li> <li>Added search in genre</li> <li>Improved selecting feedback effect(ripple with corners)</li> <li>Fix bugs & crashes</li> <li>Fix crashing on lyrics</li> <li>Fix genre details last song is under mini player</li> <li>Fix colors mistakes and font sizes</li> <li>Fix slider jumping while scrolling in now playing themes</li> </ul> <h4>v3.4.800</h4> <ul> <li>Improved dark theme colors and Follow system theme</li> <li>Rounded rectangle ripple for BottomNavigationView</li> <li>Follow sleep timer dialog checkbox color as accent</li> <li>Added song list selection for Album and Artist details</li> <li>Fixed Toolbar popup text color when selecting songs</li> </ul> <h4>v3.4.700</h4> <ul> <li>Added splash screen(for app loading time)</li> <li>Updated dark theme colors</li> <li>Added circular progress view</li> <li>Hiding year if not showing</li> </ul> <h4>v3.4.600</h4> <ul> <li>Fix notification layout height</li> <li>Fix folder list last item not showing</li> <li>Added auto hide/ show controls according to first and last item</li> </ul> <h4>v3.4.500</h4> <ul> <li>Added peak theme</li> <li>Added app rating dialog</li> <li>Fix song name scrolling in now playing themes if it's long</li> <li>Fix playing queue last item hiding FAB</li> <li>Added desaturated color option for dark mode</li> <li>Fix slow search loading</li> <li>Fix last added slow loading</li> <li>Fix home banner toolbar corner</li> <li>Fix home crashing when switching between two tabs</li> <li>Fix remaining time in playing queue</li> <li>Fix font not applied for some components</li> <li>Fix crashing on album details sorting</li> <li>Fixed lot of internal bugs</li> <li>Fix dialog expand</li> <li>Fix list card color</li> <li>Removed SlidingUpPanel to replace with BottomSheet</li> <li>Removed color theme as per material design guidelines</li> <li>Removed classic theme(We're bringing back)</li> <li>Replace line switch to Material Switch in settings</li> <li>Performance improved</li> <li>Updated internal libraries</li> <li>Updated translation</li> <li>Limiting the use of Theme engine for making use of system colors</li> <li>Change home icon from the user icon</li> <li>Corrected all toolbar with elevation when scrolling</li> </ul> <p>If you see entire app white or dark or black select same theme in settings to fix </p> <p style="line-height:150%"><a href="https://github.com/h4h13/RetroMusicPlayer/wiki/FAQ">FAQ's</a> </p> <p style="line-height:150%">*If you face any UI related issues you clear app data and cache, if its not working try to uninstall and install again. </p> </body>
<html> <head> <style type="text/css"> * { word-wrap: break-word; } {style-placeholder} a { color: {link-color}; } a:active { color: {link-color-active}; } ol { list-style-position: inside; padding-left: 0; padding-right: 0; } li { padding-top: 8px; } </style> </head> <body> <h4>v3.4.950</h4> <ul> <li>Major code refactor for library tabs</li> <li>Folder option now in available in tabs</li> <li>Improved drive mode page</li> <li>Added date modified option to sort songs</li> <li>Added toggle bluetooth connection to play on device as soon as it connected</li> <li>Fix tablet version of app</li> <li>Fix Album and Artist details toolbar full width for better accessibility</li> </ul> <h4>v3.4.900</h4> <ul> <li>Added playlist search</li> <li>Added Drive mode</li> <li>Added Album and Artist layout change option in library</li> <li>Added Show more album and artist information in details</li> <li>Added Pixel style scroller bar</li> <li>Added current now playing share</li> <li>Fix font issues and colors in some places</li> <li>Improved Full now playing theme</li> </ul> <h4>v3.4.850</h4> <ul> <li>Added new theme called circle</li> <li>Added tiny color card style for home artists</li> <li>Added extra track info details to now playing themes</li> <li>Added scroll animation</li> <li>Added smooth transition animations 🤔</li> <li>Added current playing tab options for Bottom Navigation View</li> <li>Added search in genre</li> <li>Improved selecting feedback effect(ripple with corners)</li> <li>Fix bugs & crashes</li> <li>Fix crashing on lyrics</li> <li>Fix genre details last song is under mini player</li> <li>Fix colors mistakes and font sizes</li> <li>Fix slider jumping while scrolling in now playing themes</li> </ul> <h4>v3.4.800</h4> <ul> <li>Improved dark theme colors and Follow system theme</li> <li>Rounded rectangle ripple for BottomNavigationView</li> <li>Follow sleep timer dialog checkbox color as accent</li> <li>Added song list selection for Album and Artist details</li> <li>Fixed Toolbar popup text color when selecting songs</li> </ul> <h4>v3.4.700</h4> <ul> <li>Added splash screen(for app loading time)</li> <li>Updated dark theme colors</li> <li>Added circular progress view</li> <li>Hiding year if not showing</li> </ul> <h4>v3.4.600</h4> <ul> <li>Fix notification layout height</li> <li>Fix folder list last item not showing</li> <li>Added auto hide/ show controls according to first and last item</li> </ul> <h4>v3.4.500</h4> <ul> <li>Added peak theme</li> <li>Added app rating dialog</li> <li>Fix song name scrolling in now playing themes if it's long</li> <li>Fix playing queue last item hiding FAB</li> <li>Added desaturated color option for dark mode</li> <li>Fix slow search loading</li> <li>Fix last added slow loading</li> <li>Fix home banner toolbar corner</li> <li>Fix home crashing when switching between two tabs</li> <li>Fix remaining time in playing queue</li> <li>Fix font not applied for some components</li> <li>Fix crashing on album details sorting</li> <li>Fixed lot of internal bugs</li> <li>Fix dialog expand</li> <li>Fix list card color</li> <li>Removed SlidingUpPanel to replace with BottomSheet</li> <li>Removed color theme as per material design guidelines</li> <li>Removed classic theme(We're bringing back)</li> <li>Replace line switch to Material Switch in settings</li> <li>Performance improved</li> <li>Updated internal libraries</li> <li>Updated translation</li> <li>Limiting the use of Theme engine for making use of system colors</li> <li>Change home icon from the user icon</li> <li>Corrected all toolbar with elevation when scrolling</li> </ul> <p>If you see entire app white or dark or black select same theme in settings to fix </p> <p style="line-height:150%"><a href="https://github.com/h4h13/RetroMusicPlayer/wiki/FAQ">FAQ's</a> </p> <p style="line-height:150%">*If you face any UI related issues you clear app data and cache, if its not working try to uninstall and install again. </p> </body>

View file

@ -12,7 +12,6 @@ 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.Genre
@ -80,7 +79,8 @@ class GenreDetailsActivity : AbsSlidingMusicPanelActivity(), CabHolder, GenreDet
}
private fun setUpToolBar() {
applyToolbar(toolbar)
toolbar.setBackgroundColor(ATHUtil.resolveColor(this, R.attr.colorSurface))
setSupportActionBar(toolbar)
title = genre.name
}

View file

@ -1,5 +1,6 @@
package code.name.monkey.retromusic.activities
import android.R.attr
import android.annotation.SuppressLint
import android.content.res.ColorStateList
import android.os.AsyncTask
@ -20,6 +21,7 @@ import androidx.fragment.app.FragmentStatePagerAdapter
import androidx.viewpager.widget.ViewPager
import code.name.monkey.appthemehelper.ThemeStore
import code.name.monkey.appthemehelper.util.ATHUtil
import code.name.monkey.appthemehelper.util.ATHUtil.resolveColor
import code.name.monkey.appthemehelper.util.ColorUtil
import code.name.monkey.appthemehelper.util.MaterialUtil
import code.name.monkey.appthemehelper.util.MaterialValueHelper
@ -390,8 +392,8 @@ class LyricsActivity : AbsMusicServiceActivity(), View.OnClickListener, ViewPage
val context = activity!!
setCurrentPlayLineColor(ThemeStore.accentColor(context))
setIndicatorTextColor(ThemeStore.accentColor(context))
setCurrentIndicateLineTextColor(ThemeStore.textColorPrimary(context))
setNoLrcTextColor(ThemeStore.textColorPrimary(context))
setCurrentIndicateLineTextColor(resolveColor(activity, attr.textColorPrimary))
setNoLrcTextColor(resolveColor(activity, attr.textColorPrimary))
setOnPlayIndicatorLineListener(object : LrcView.OnPlayIndicatorLineListener {
override fun onPlay(time: Long, content: String) {
MusicPlayerRemote.seekTo(time.toInt())

View file

@ -26,6 +26,7 @@ import android.content.res.ColorStateList;
import android.graphics.Color;
import android.net.Uri;
import android.os.Bundle;
import android.os.Handler;
import android.provider.MediaStore;
import android.util.Log;
import android.view.Menu;
@ -36,6 +37,7 @@ import androidx.annotation.NonNull;
import androidx.appcompat.widget.Toolbar;
import androidx.core.app.ActivityCompat;
import androidx.fragment.app.Fragment;
import androidx.transition.TransitionManager;
import code.name.monkey.appthemehelper.util.ATHUtil;
import code.name.monkey.appthemehelper.util.ToolbarContentTintHelper;
import code.name.monkey.retromusic.R;
@ -72,6 +74,7 @@ import com.afollestad.materialcab.MaterialCab;
import com.afollestad.materialcab.MaterialCab.Callback;
import com.google.android.material.appbar.AppBarLayout;
import com.google.android.material.card.MaterialCardView;
import com.google.android.material.textview.MaterialTextView;
import java.util.ArrayList;
import java.util.List;
import org.jetbrains.annotations.NotNull;
@ -98,6 +101,8 @@ public class MainActivity extends AbsSlidingMusicPanelActivity
private AppBarLayout mAppBarLayout;
private MaterialTextView mAppTitle;
private final BroadcastReceiver mBroadcastReceiver = new BroadcastReceiver() {
@Override
public void onReceive(final Context context, final Intent intent) {
@ -144,6 +149,7 @@ public class MainActivity extends AbsSlidingMusicPanelActivity
}
mToolbarContainer = findViewById(R.id.toolbarContainer);
mAppTitle = findViewById(R.id.appTitle);
mToolbar = findViewById(R.id.toolbar);
mAppBarLayout = findViewById(R.id.appBarLayout);
@ -752,6 +758,7 @@ public class MainActivity extends AbsSlidingMusicPanelActivity
}
private void setupToolbar() {
setTitle(null);
mToolbar.setBackgroundColor(Color.TRANSPARENT);
mToolbarContainer.setCardBackgroundColor(
ColorStateList.valueOf(ATHUtil.INSTANCE.resolveColor(this, R.attr.colorSurface)));
@ -773,5 +780,15 @@ public class MainActivity extends AbsSlidingMusicPanelActivity
.show(getSupportFragmentManager(), "Main_Menu");
}
});
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
TransitionManager.beginDelayedTransition(mToolbar);
Log.i(TAG, "run: " + Thread.currentThread().getName());
mAppTitle.setVisibility(View.GONE);
setTitle(R.string.action_search);
}
}, 1500);
}
}

View file

@ -6,12 +6,12 @@ import android.view.MenuItem
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
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.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.MusicUtil
import com.h6ah4i.android.widget.advrecyclerview.animator.DraggableItemAnimator
@ -20,7 +20,6 @@ import com.h6ah4i.android.widget.advrecyclerview.swipeable.RecyclerViewSwipeMana
import com.h6ah4i.android.widget.advrecyclerview.touchguard.RecyclerViewTouchActionGuardManager
import com.h6ah4i.android.widget.advrecyclerview.utils.WrapperAdapterUtils
import kotlinx.android.synthetic.main.activity_playing_queue.clearQueue
import kotlinx.android.synthetic.main.activity_playing_queue.playerQueueSubHeader
import kotlinx.android.synthetic.main.activity_playing_queue.recyclerView
import kotlinx.android.synthetic.main.activity_playing_queue.toolbar
@ -128,7 +127,7 @@ open class PlayingQueueActivity : AbsMusicServiceActivity() {
}
private fun updateCurrentSong() {
playerQueueSubHeader.text = getUpNextAndQueueTime()
toolbar.subtitle = getUpNextAndQueueTime()
}
override fun onPlayingMetaChanged() {
@ -138,7 +137,7 @@ open class PlayingQueueActivity : AbsMusicServiceActivity() {
private fun updateQueuePosition() {
playingQueueAdapter?.setCurrent(MusicPlayerRemote.position)
resetToCurrentPosition()
playerQueueSubHeader.text = getUpNextAndQueueTime()
toolbar.subtitle = getUpNextAndQueueTime()
}
private fun updateQueue() {
@ -176,20 +175,14 @@ open class PlayingQueueActivity : AbsMusicServiceActivity() {
}
private fun setupToolbar() {
playerQueueSubHeader.text = getUpNextAndQueueTime()
playerQueueSubHeader.setTextColor(ThemeStore.accentColor(this))
toolbar.subtitle = getUpNextAndQueueTime()
applyToolbar(toolbar)
clearQueue.backgroundTintList = ColorStateList.valueOf(ThemeStore.accentColor(this))
toolbar.setBackgroundColor(ATHUtil.resolveColor(this, R.attr.colorSurface))
setSupportActionBar(toolbar)
val accentColor = ThemeStore.accentColor(this)
clearQueue.backgroundTintList = ColorStateList.valueOf(accentColor)
ColorStateList.valueOf(
MaterialValueHelper.getPrimaryTextColor(
this,
ColorUtil.isColorLight(
ThemeStore.accentColor(
this
)
)
)
MaterialValueHelper.getPrimaryTextColor(this, ColorUtil.isColorLight(accentColor))
).apply {
clearQueue.setTextColor(this)
clearQueue.iconTint = this

View file

@ -6,12 +6,12 @@ import android.os.Bundle
import android.util.Log
import android.view.MenuItem
import android.widget.Toast
import code.name.monkey.appthemehelper.util.ATHUtil
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.BillingProcessor
import com.anjlab.android.iab.v3.TransactionDetails
import kotlinx.android.synthetic.main.activity_pro_version.purchaseButton
@ -31,7 +31,8 @@ class PurchaseActivity : AbsBaseActivity(), BillingProcessor.IBillingHandler {
setStatusbarColorAuto()
setNavigationbarColorAuto()
setLightNavigationBar(true)
applyToolbar(toolbar)
toolbar.setBackgroundColor(ATHUtil.resolveColor(this, R.attr.colorSurface))
setSupportActionBar(toolbar)
restoreButton.isEnabled = false
purchaseButton.isEnabled = false

View file

@ -23,6 +23,8 @@ import code.name.monkey.appthemehelper.util.ToolbarContentTintHelper
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.textColorPrimary
import code.name.monkey.retromusic.extensions.textColorSecondary
import com.anjlab.android.iab.v3.BillingProcessor
import com.anjlab.android.iab.v3.SkuDetails
import com.anjlab.android.iab.v3.TransactionDetails
@ -216,11 +218,8 @@ class SkuDetailsAdapter(
val titleTextColor = if (purchased) ATHUtil.resolveColor(
donationsDialog,
android.R.attr.textColorHint
) else ThemeStore.textColorPrimary(donationsDialog)
val contentTextColor = if (purchased) titleTextColor else ThemeStore.textColorSecondary(
donationsDialog
)
) else textColorPrimary(donationsDialog)
val contentTextColor = if (purchased) titleTextColor else textColorSecondary(donationsDialog)
viewHolder.title.setTextColor(titleTextColor)
viewHolder.text.setTextColor(contentTextColor)

View file

@ -14,6 +14,7 @@ import android.text.TextUtils
import android.view.MenuItem
import android.widget.Toast
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.appthemehelper.util.MaterialValueHelper
@ -22,7 +23,6 @@ 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.Compressor
import code.name.monkey.retromusic.util.ImageUtil.getResizedBitmap
import code.name.monkey.retromusic.util.PreferenceUtil
@ -30,7 +30,13 @@ import com.afollestad.materialdialogs.LayoutMode
import com.afollestad.materialdialogs.MaterialDialog
import com.afollestad.materialdialogs.bottomsheets.BottomSheet
import com.afollestad.materialdialogs.list.listItems
import kotlinx.android.synthetic.main.activity_user_info.*
import kotlinx.android.synthetic.main.activity_user_info.bannerImage
import kotlinx.android.synthetic.main.activity_user_info.bannerSelect
import kotlinx.android.synthetic.main.activity_user_info.name
import kotlinx.android.synthetic.main.activity_user_info.nameContainer
import kotlinx.android.synthetic.main.activity_user_info.next
import kotlinx.android.synthetic.main.activity_user_info.toolbar
import kotlinx.android.synthetic.main.activity_user_info.userImage
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.launch
@ -49,7 +55,8 @@ class UserInfoActivity : AbsBaseActivity() {
setTaskDescriptionColorAuto()
setLightNavigationBar(true)
applyToolbar(toolbar)
toolbar.setBackgroundColor(ATHUtil.resolveColor(this, R.attr.colorSurface))
setSupportActionBar(toolbar)
MaterialUtil.setTint(nameContainer, false)
name.setText(PreferenceUtil.getInstance(this).userName)
@ -64,7 +71,12 @@ class UserInfoActivity : AbsBaseActivity() {
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, _ ->
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("")
@ -76,7 +88,12 @@ class UserInfoActivity : AbsBaseActivity() {
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)))
listItems(
items = listOf(
getString(R.string.new_banner_photo),
getString(R.string.remove_banner_photo)
)
)
{ _, position, _ ->
when (position) {
0 -> selectBannerImage()
@ -96,11 +113,16 @@ class UserInfoActivity : AbsBaseActivity() {
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
}
ColorStateList.valueOf(
MaterialValueHelper.getPrimaryTextColor(
this,
ColorUtil.isColorLight(ThemeStore.accentColor(this))
)
)
.apply {
next.setTextColor(this)
next.iconTint = this
}
}
override fun onOptionsItemSelected(item: MenuItem): Boolean {
@ -143,14 +165,13 @@ class UserInfoActivity : AbsBaseActivity() {
try {
data.data?.let {
val bitmap = getResizedBitmap(
getBitmap(contentResolver, it),
PROFILE_ICON_SIZE
getBitmap(contentResolver, it),
PROFILE_ICON_SIZE
)
val profileImagePath = saveToInternalStorage(bitmap, USER_PROFILE)
PreferenceUtil.getInstance(this).saveProfileImage(profileImagePath)
loadImageFromStorage(profileImagePath)
}
} catch (e: IOException) {
e.printStackTrace()
}
@ -187,8 +208,8 @@ class UserInfoActivity : AbsBaseActivity() {
CoroutineScope(Dispatchers.IO).launch {
withContext(Dispatchers.IO) {
val bitmap = Compressor(this@UserInfoActivity).setQuality(100)
.setCompressFormat(Bitmap.CompressFormat.WEBP)
.compressToBitmap(File(profileImagePath, USER_BANNER))
.setCompressFormat(Bitmap.CompressFormat.WEBP)
.compressToBitmap(File(profileImagePath, USER_BANNER))
withContext(Dispatchers.Main) { bannerImage.setImageBitmap(bitmap) }
}
}
@ -198,11 +219,11 @@ class UserInfoActivity : AbsBaseActivity() {
CoroutineScope(Dispatchers.IO).launch {
withContext(Dispatchers.IO) {
val bitmap = Compressor(this@UserInfoActivity)
.setMaxHeight(300)
.setMaxWidth(300)
.setQuality(75)
.setCompressFormat(Bitmap.CompressFormat.WEBP)
.compressToBitmap(File(path, USER_PROFILE))
.setMaxHeight(300)
.setMaxWidth(300)
.setQuality(75)
.setCompressFormat(Bitmap.CompressFormat.WEBP)
.compressToBitmap(File(path, USER_PROFILE))
withContext(Dispatchers.Main) { userImage.setImageBitmap(bitmap) }
}
}

View file

@ -16,7 +16,6 @@ import code.name.monkey.appthemehelper.util.ATHUtil
import code.name.monkey.appthemehelper.util.MaterialUtil
import code.name.monkey.retromusic.R
import code.name.monkey.retromusic.extensions.appHandleColor
import code.name.monkey.retromusic.extensions.applyToolbar
import code.name.monkey.retromusic.glide.palette.BitmapPaletteTranscoder
import code.name.monkey.retromusic.glide.palette.BitmapPaletteWrapper
import code.name.monkey.retromusic.loaders.AlbumLoader
@ -93,8 +92,8 @@ class AlbumTagEditorActivity : AbsTagEditorActivity(), TextWatcher {
private var lastFMRestClient: LastFMRestClient? = null
private fun setupToolbar() {
applyToolbar(toolbar)
supportActionBar?.setDisplayShowHomeEnabled(true)
toolbar.setBackgroundColor(ATHUtil.resolveColor(this, R.attr.colorSurface))
setSupportActionBar(toolbar)
}
override fun onCreate(savedInstanceState: Bundle?) {
@ -141,10 +140,6 @@ class AlbumTagEditorActivity : AbsTagEditorActivity(), TextWatcher {
deleteAlbumArt = false
}
override fun onPause() {
super.onPause()
}
private fun toastLoadingFailed() {
Toast.makeText(
this@AlbumTagEditorActivity,

View file

@ -4,10 +4,10 @@ import android.net.Uri
import android.os.Bundle
import android.text.Editable
import android.text.TextWatcher
import code.name.monkey.appthemehelper.util.ATHUtil
import code.name.monkey.appthemehelper.util.MaterialUtil
import code.name.monkey.retromusic.R
import code.name.monkey.retromusic.extensions.appHandleColor
import code.name.monkey.retromusic.extensions.applyToolbar
import code.name.monkey.retromusic.loaders.SongLoader
import kotlinx.android.synthetic.main.activity_song_tag_editor.albumArtistContainer
import kotlinx.android.synthetic.main.activity_song_tag_editor.albumArtistText
@ -42,8 +42,8 @@ class SongTagEditorActivity : AbsTagEditorActivity(), TextWatcher {
setNoImageMode()
setUpViews()
applyToolbar(toolbar)
toolbar.setBackgroundColor(ATHUtil.resolveColor(this, R.attr.colorSurface))
setSupportActionBar(toolbar)
}
private fun setUpViews() {

View file

@ -14,19 +14,3 @@
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
import code.name.monkey.appthemehelper.util.ToolbarContentTintHelper
import code.name.monkey.retromusic.R
fun AppCompatActivity.applyToolbar(toolbar: Toolbar) {
toolbar.apply {
setNavigationOnClickListener { onBackPressed() }
setNavigationIcon(R.drawable.ic_keyboard_backspace_black_24dp)
ToolbarContentTintHelper.colorBackButton(toolbar)
backgroundTintList = ColorStateList.valueOf(ATHUtil.resolveColor(this@applyToolbar, R.attr.colorSurface))
}
setSupportActionBar(toolbar)
}

View file

@ -35,3 +35,15 @@ fun Toolbar.backgroundTintList() {
val colorStateList = ColorStateList.valueOf(surfaceColor)
backgroundTintList = colorStateList
}
fun textColorSecondary(context: Context): Int {
return ATHUtil.resolveColor(context, android.R.attr.textColorSecondary)
}
fun colorControlNormal(context: Context): Int {
return ATHUtil.resolveColor(context, android.R.attr.colorControlNormal)
}
fun textColorPrimary(context: Context): Int {
return ATHUtil.resolveColor(context, android.R.attr.textColorPrimary)
}

View file

@ -15,6 +15,8 @@ import android.view.ViewGroup
import android.view.animation.DecelerateInterpolator
import code.name.monkey.appthemehelper.ThemeStore
import code.name.monkey.retromusic.R
import code.name.monkey.retromusic.extensions.textColorPrimary
import code.name.monkey.retromusic.extensions.textColorSecondary
import code.name.monkey.retromusic.fragments.base.AbsMusicServiceFragment
import code.name.monkey.retromusic.helper.MusicPlayerRemote
import code.name.monkey.retromusic.helper.MusicProgressViewUpdateHelper
@ -86,10 +88,10 @@ open class MiniPlayerFragment : AbsMusicServiceFragment(), MusicProgressViewUpda
val song = MusicPlayerRemote.currentSong
val title = SpannableString(song.title)
title.setSpan(ForegroundColorSpan(ThemeStore.textColorPrimary(requireContext())), 0, title.length, 0)
title.setSpan(ForegroundColorSpan(textColorPrimary(requireContext())), 0, title.length, 0)
val text = SpannableString(song.artistName)
text.setSpan(ForegroundColorSpan(ThemeStore.textColorSecondary(requireContext())), 0, text.length, 0)
text.setSpan(ForegroundColorSpan(textColorSecondary(requireContext())), 0, text.length, 0)
builder.append(title).append("").append(text)

View file

@ -7,10 +7,11 @@ import android.view.ViewGroup
import android.widget.FrameLayout
import android.widget.TextView
import androidx.appcompat.widget.Toolbar
import code.name.monkey.appthemehelper.ThemeStore
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.extensions.textColorPrimary
import code.name.monkey.retromusic.extensions.textColorSecondary
import code.name.monkey.retromusic.fragments.base.AbsPlayerFragment
import code.name.monkey.retromusic.fragments.player.PlayerAlbumCoverFragment
import code.name.monkey.retromusic.helper.MusicPlayerRemote
@ -149,8 +150,8 @@ class AdaptiveFragment : AbsPlayerFragment(), MusicProgressViewUpdateHelper.Call
inflateMenu(R.menu.menu_player)
setNavigationOnClickListener { requireActivity().onBackPressed() }
ToolbarContentTintHelper.colorizeToolbar(this, primaryColor, requireActivity())
setTitleTextColor(primaryColor)
setSubtitleTextColor(ThemeStore.textColorSecondary(requireContext()))
setTitleTextColor(textColorPrimary(requireContext()))
setSubtitleTextColor(textColorSecondary(requireContext()))
setOnMenuItemClickListener(this@AdaptiveFragment)
}
}

View file

@ -23,13 +23,13 @@ import android.view.ViewGroup
import android.view.animation.DecelerateInterpolator
import android.view.animation.LinearInterpolator
import android.widget.SeekBar
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.appthemehelper.util.TintHelper
import code.name.monkey.retromusic.R
import code.name.monkey.retromusic.extensions.ripAlpha
import code.name.monkey.retromusic.extensions.textColorSecondary
import code.name.monkey.retromusic.fragments.base.AbsPlayerControlsFragment
import code.name.monkey.retromusic.helper.MusicPlayerRemote
import code.name.monkey.retromusic.helper.MusicProgressViewUpdateHelper
@ -134,7 +134,7 @@ class LockScreenPlayerControlsFragment : AbsPlayerControlsFragment() {
val colorFinal = if (PreferenceUtil.getInstance(requireContext()).adaptiveColor) {
color
} else {
ThemeStore.textColorSecondary(requireContext())
textColorSecondary(requireContext())
}.ripAlpha()
volumeFragment?.setTintable(colorFinal)

View file

@ -8,7 +8,6 @@ import android.view.View
import android.view.ViewGroup
import android.view.animation.LinearInterpolator
import android.widget.SeekBar
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
@ -16,6 +15,7 @@ import code.name.monkey.retromusic.R
import code.name.monkey.retromusic.extensions.hide
import code.name.monkey.retromusic.extensions.ripAlpha
import code.name.monkey.retromusic.extensions.show
import code.name.monkey.retromusic.extensions.textColorSecondary
import code.name.monkey.retromusic.fragments.base.AbsPlayerControlsFragment
import code.name.monkey.retromusic.helper.MusicPlayerRemote
import code.name.monkey.retromusic.helper.MusicProgressViewUpdateHelper
@ -130,7 +130,7 @@ class MaterialControlsFragment : AbsPlayerControlsFragment() {
val colorFinal = if (PreferenceUtil.getInstance(requireContext()).adaptiveColor) {
color
} else {
ThemeStore.textColorSecondary(requireContext())
textColorSecondary(requireContext())
}.ripAlpha()
text.setTextColor(colorFinal)
@ -167,7 +167,7 @@ class MaterialControlsFragment : AbsPlayerControlsFragment() {
}
private fun setUpPrevNext() {
updatePrevNextColor(ThemeStore.textColorSecondary(requireContext()))
updatePrevNextColor(textColorSecondary(requireContext()))
nextButton.setOnClickListener { MusicPlayerRemote.playNextSong() }
previousButton.setOnClickListener { MusicPlayerRemote.back() }
}

View file

@ -23,13 +23,13 @@ import android.view.View
import android.view.ViewGroup
import android.view.animation.LinearInterpolator
import android.widget.SeekBar
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.appthemehelper.util.TintHelper
import code.name.monkey.retromusic.R
import code.name.monkey.retromusic.extensions.ripAlpha
import code.name.monkey.retromusic.extensions.textColorSecondary
import code.name.monkey.retromusic.fragments.base.AbsPlayerControlsFragment
import code.name.monkey.retromusic.helper.MusicPlayerRemote
import code.name.monkey.retromusic.helper.MusicProgressViewUpdateHelper
@ -111,7 +111,7 @@ class PeakPlayerControlFragment : AbsPlayerControlsFragment() {
lastPlaybackControlsColor = color
color
} else {
ThemeStore.textColorSecondary(requireContext())
textColorSecondary(requireContext())
}.ripAlpha()
ViewUtil.setProgressDrawable(progressSlider, colorFinal, true)

View file

@ -17,7 +17,6 @@ package code.name.monkey.retromusic.preferences
import android.annotation.SuppressLint
import android.app.Dialog
import android.content.Context
import android.graphics.PorterDuff
import android.os.Bundle
import android.util.AttributeSet
import android.view.LayoutInflater
@ -26,13 +25,15 @@ import android.view.ViewGroup
import android.widget.ImageView
import android.widget.TextView
import android.widget.Toast
import androidx.core.graphics.BlendModeColorFilterCompat
import androidx.core.graphics.BlendModeCompat.SRC_IN
import androidx.preference.PreferenceDialogFragmentCompat
import androidx.viewpager.widget.PagerAdapter
import androidx.viewpager.widget.ViewPager
import code.name.monkey.appthemehelper.ThemeStore
import code.name.monkey.appthemehelper.common.prefs.supportv7.ATEDialogPreference
import code.name.monkey.retromusic.App
import code.name.monkey.retromusic.R
import code.name.monkey.retromusic.extensions.colorControlNormal
import code.name.monkey.retromusic.fragments.AlbumCoverStyle
import code.name.monkey.retromusic.fragments.AlbumCoverStyle.CARD
import code.name.monkey.retromusic.fragments.AlbumCoverStyle.CIRCLE
@ -45,19 +46,12 @@ import com.afollestad.materialdialogs.MaterialDialog
import com.afollestad.materialdialogs.customview.customView
import com.bumptech.glide.Glide
class AlbumCoverStylePreference : ATEDialogPreference {
constructor(context: Context) : super(context)
constructor(context: Context, attrs: AttributeSet) : super(context, attrs)
constructor(context: Context, attrs: AttributeSet, defStyleAttr: Int) : super(context, attrs, defStyleAttr)
constructor(context: Context, attrs: AttributeSet, defStyleAttr: Int, defStyleRes: Int) : super(
context,
attrs,
defStyleAttr,
defStyleRes
)
class AlbumCoverStylePreference @JvmOverloads constructor(
context: Context,
attrs: AttributeSet? = null,
defStyleAttr: Int = -1,
defStyleRes: Int = -1
) : ATEDialogPreference(context, attrs, defStyleAttr, defStyleRes) {
private val mLayoutRes = R.layout.preference_dialog_now_playing_screen
@ -66,7 +60,8 @@ class AlbumCoverStylePreference : ATEDialogPreference {
}
init {
icon?.setColorFilter(ThemeStore.textColorSecondary(context), PorterDuff.Mode.SRC_IN)
icon?.colorFilter =
BlendModeColorFilterCompat.createBlendModeColorFilterCompat(colorControlNormal(context), SRC_IN)
}
}

View file

@ -16,15 +16,16 @@ package code.name.monkey.retromusic.preferences
import android.app.Dialog
import android.content.Context
import android.graphics.PorterDuff
import android.os.Bundle
import android.text.Html
import android.util.AttributeSet
import androidx.core.graphics.BlendModeColorFilterCompat
import androidx.core.graphics.BlendModeCompat.SRC_IN
import androidx.fragment.app.DialogFragment
import code.name.monkey.appthemehelper.ThemeStore
import code.name.monkey.appthemehelper.common.prefs.supportv7.ATEDialogPreference
import code.name.monkey.retromusic.R
import code.name.monkey.retromusic.dialogs.BlacklistFolderChooserDialog
import code.name.monkey.retromusic.extensions.colorControlNormal
import code.name.monkey.retromusic.providers.BlacklistStore
import code.name.monkey.retromusic.util.PreferenceUtil
import com.afollestad.materialdialogs.LayoutMode
@ -34,17 +35,16 @@ import com.afollestad.materialdialogs.list.listItems
import java.io.File
import java.util.ArrayList
class BlacklistPreference : ATEDialogPreference {
constructor(context: Context) : super(context)
constructor(context: Context, attrs: AttributeSet) : super(context, attrs)
constructor(context: Context, attrs: AttributeSet, defStyleAttr: Int) : super(context, attrs, defStyleAttr)
constructor(context: Context, attrs: AttributeSet, defStyleAttr: Int, defStyleRes: Int) : super(context, attrs, defStyleAttr, defStyleRes)
class BlacklistPreference @JvmOverloads constructor(
context: Context,
attrs: AttributeSet? = null,
defStyleAttr: Int = -1,
defStyleRes: Int = -1
) : ATEDialogPreference(context, attrs, defStyleAttr, defStyleRes) {
init {
icon?.setColorFilter(ThemeStore.textColorSecondary(context), PorterDuff.Mode.SRC_IN)
icon?.colorFilter =
BlendModeColorFilterCompat.createBlendModeColorFilterCompat(colorControlNormal(context), SRC_IN)
}
}
@ -55,9 +55,9 @@ class BlacklistPreferenceDialog : DialogFragment(), BlacklistFolderChooserDialog
}
}
override fun onCreateDialog(savedInstanceState: Bundle?): Dialog {
val blacklistFolderChooserDialog = childFragmentManager.findFragmentByTag("FOLDER_CHOOSER") as BlacklistFolderChooserDialog?
val blacklistFolderChooserDialog =
childFragmentManager.findFragmentByTag("FOLDER_CHOOSER") as BlacklistFolderChooserDialog?
blacklistFolderChooserDialog?.setCallback(this)
refreshBlacklistData()
return MaterialDialog(requireContext(), BottomSheet(LayoutMode.WRAP_CONTENT)).show {
@ -81,13 +81,20 @@ class BlacklistPreferenceDialog : DialogFragment(), BlacklistFolderChooserDialog
negativeButton(R.string.add_action) {
val dialog = BlacklistFolderChooserDialog.create()
dialog.setCallback(this@BlacklistPreferenceDialog)
dialog.show(childFragmentManager, "FOLDER_CHOOSER");
dialog.show(childFragmentManager, "FOLDER_CHOOSER")
}
listItems(items = paths, waitForPositiveButton = false) { _, _, text ->
MaterialDialog(context, BottomSheet(LayoutMode.WRAP_CONTENT)).show {
cornerRadius(PreferenceUtil.getInstance(requireContext()).dialogCorner)
title(code.name.monkey.retromusic.R.string.remove_from_blacklist)
message(text = Html.fromHtml(getString(code.name.monkey.retromusic.R.string.do_you_want_to_remove_from_the_blacklist, text)))
message(
text = Html.fromHtml(
getString(
code.name.monkey.retromusic.R.string.do_you_want_to_remove_from_the_blacklist,
text
)
)
)
positiveButton(code.name.monkey.retromusic.R.string.remove_action) {
BlacklistStore.getInstance(context).removePath(File(text.toString()))
refreshBlacklistData()
@ -108,7 +115,7 @@ class BlacklistPreferenceDialog : DialogFragment(), BlacklistFolderChooserDialog
}
override fun onFolderSelection(dialog: BlacklistFolderChooserDialog, folder: File) {
BlacklistStore.getInstance(context!!).addPath(folder);
refreshBlacklistData();
BlacklistStore.getInstance(context!!).addPath(folder)
refreshBlacklistData()
}
}

View file

@ -16,44 +16,43 @@ package code.name.monkey.retromusic.preferences
import android.app.Dialog
import android.content.Context
import android.graphics.PorterDuff
import android.os.Bundle
import android.util.AttributeSet
import android.widget.Toast
import androidx.core.graphics.BlendModeColorFilterCompat
import androidx.core.graphics.BlendModeCompat.SRC_IN
import androidx.preference.PreferenceDialogFragmentCompat
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
import code.name.monkey.appthemehelper.ThemeStore
import code.name.monkey.appthemehelper.common.prefs.supportv7.ATEDialogPreference
import code.name.monkey.retromusic.R
import code.name.monkey.retromusic.adapter.CategoryInfoAdapter
import code.name.monkey.retromusic.extensions.colorControlNormal
import code.name.monkey.retromusic.model.CategoryInfo
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.customview.customView
import java.util.*
import java.util.ArrayList
class LibraryPreference : ATEDialogPreference {
constructor(context: Context) : super(context)
constructor(context: Context, attrs: AttributeSet) : super(context, attrs)
constructor(context: Context, attrs: AttributeSet, defStyleAttr: Int) : super(context, attrs, defStyleAttr)
constructor(context: Context, attrs: AttributeSet, defStyleAttr: Int, defStyleRes: Int) : super(context, attrs, defStyleAttr, defStyleRes)
class LibraryPreference @JvmOverloads constructor(
context: Context,
attrs: AttributeSet? = null,
defStyleAttr: Int = -1,
defStyleRes: Int = -1
) :
ATEDialogPreference(context, attrs, defStyleAttr, defStyleRes) {
init {
icon?.setColorFilter(ThemeStore.textColorSecondary(context), PorterDuff.Mode.SRC_IN)
icon?.colorFilter =
BlendModeColorFilterCompat.createBlendModeColorFilterCompat(colorControlNormal(context), SRC_IN)
}
}
class LibraryPreferenceDialog : PreferenceDialogFragmentCompat() {
override fun onDialogClosed(positiveResult: Boolean) {
}
lateinit var adapter: CategoryInfoAdapter
@ -75,20 +74,20 @@ class LibraryPreferenceDialog : PreferenceDialogFragmentCompat() {
adapter.attachToRecyclerView(recyclerView)
return MaterialDialog(requireContext(), BottomSheet(LayoutMode.WRAP_CONTENT))
.title(R.string.library_categories)
.cornerRadius(PreferenceUtil.getInstance(requireContext()).dialogCorner)
.customView(view = view)
.positiveButton(android.R.string.ok) {
updateCategories(adapter.categoryInfos)
dismiss()
}
.negativeButton(android.R.string.cancel) {
dismiss()
}
.neutralButton(R.string.reset_action) {
adapter.categoryInfos = PreferenceUtil.getInstance(requireContext()).defaultLibraryCategoryInfos
}
.noAutoDismiss()
.title(R.string.library_categories)
.cornerRadius(PreferenceUtil.getInstance(requireContext()).dialogCorner)
.customView(view = view)
.positiveButton(android.R.string.ok) {
updateCategories(adapter.categoryInfos)
dismiss()
}
.negativeButton(android.R.string.cancel) {
dismiss()
}
.neutralButton(R.string.reset_action) {
adapter.categoryInfos = PreferenceUtil.getInstance(requireContext()).defaultLibraryCategoryInfos
}
.noAutoDismiss()
}
override fun onSaveInstanceState(outState: Bundle) {

View file

@ -17,41 +17,34 @@ package code.name.monkey.retromusic.preferences
import android.app.Dialog
import android.content.Context
import android.content.res.TypedArray
import android.graphics.PorterDuff
import android.os.Bundle
import android.util.AttributeSet
import androidx.core.graphics.BlendModeColorFilterCompat
import androidx.core.graphics.BlendModeCompat.SRC_IN
import androidx.preference.ListPreference
import androidx.preference.PreferenceDialogFragmentCompat
import code.name.monkey.appthemehelper.ThemeStore
import code.name.monkey.retromusic.R
import code.name.monkey.retromusic.extensions.colorControlNormal
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.listItemsSingleChoice
class MaterialListPreference @JvmOverloads constructor(
context: Context,
attrs: AttributeSet? = null,
defStyleAttr: Int = -1,
defStyleRes: Int = -1
) : ListPreference(context, attrs, defStyleAttr, defStyleRes) {
class MaterialListPreference : ListPreference {
private val mLayoutRes = R.layout.ate_preference_list
constructor(context: Context) : super(context) {
init(context)
}
private fun init(context: Context) {
icon?.setColorFilter(ThemeStore.textColorSecondary(context), PorterDuff.Mode.SRC_IN)
}
constructor(context: Context, attrs: AttributeSet) : super(context, attrs) {
init(context)
}
constructor(context: Context, attrs: AttributeSet, defStyleAttr: Int) : super(context, attrs, defStyleAttr) {
init(context)
}
constructor(context: Context, attrs: AttributeSet, defStyleAttr: Int, defStyleRes: Int) : super(context, attrs, defStyleAttr, defStyleRes) {
init(context)
init {
icon?.colorFilter = BlendModeColorFilterCompat.createBlendModeColorFilterCompat(
colorControlNormal(context),
SRC_IN
)
}
override fun getDialogLayoutResource(): Int {
@ -80,23 +73,27 @@ class MaterialListPreferenceDialog : PreferenceDialogFragmentCompat() {
val entriesValues = arguments?.getStringArrayList(EXTRA_ENTRIES_VALUES)
val position: Int = arguments?.getInt(EXTRA_POSITION) ?: 0
materialDialog = MaterialDialog(requireContext(), BottomSheet(LayoutMode.WRAP_CONTENT))
.title(text = materialListPreference.title.toString())
.positiveButton(R.string.set)
.cornerRadius(PreferenceUtil.getInstance(requireContext()).dialogCorner)
.listItemsSingleChoice(items = entries, initialSelection = position, waitForPositiveButton = true) { _, index, _ ->
entriesValues?.let {
materialListPreference.callChangeListener(it[index])
materialListPreference.setCustomValue(it[index])
}
entries?.let {
materialListPreference.summary = it[index]
val value = materialListPreference.entryValues[index].toString()
if (materialListPreference.callChangeListener(value)) {
materialListPreference.value = value
}
}
dismiss()
.title(text = materialListPreference.title.toString())
.positiveButton(R.string.set)
.cornerRadius(PreferenceUtil.getInstance(requireContext()).dialogCorner)
.listItemsSingleChoice(
items = entries,
initialSelection = position,
waitForPositiveButton = true
) { _, index, _ ->
entriesValues?.let {
materialListPreference.callChangeListener(it[index])
materialListPreference.setCustomValue(it[index])
}
entries?.let {
materialListPreference.summary = it[index]
val value = materialListPreference.entryValues[index].toString()
if (materialListPreference.callChangeListener(value)) {
materialListPreference.value = value
}
}
dismiss()
}
return materialDialog
}

View file

@ -16,7 +16,6 @@ package code.name.monkey.retromusic.preferences
import android.app.Dialog
import android.content.Context
import android.graphics.PorterDuff
import android.os.Bundle
import android.util.AttributeSet
import android.view.LayoutInflater
@ -25,13 +24,15 @@ import android.view.ViewGroup
import android.widget.ImageView
import android.widget.TextView
import android.widget.Toast
import androidx.core.graphics.BlendModeColorFilterCompat
import androidx.core.graphics.BlendModeCompat.SRC_IN
import androidx.preference.PreferenceDialogFragmentCompat
import androidx.viewpager.widget.PagerAdapter
import androidx.viewpager.widget.ViewPager
import code.name.monkey.appthemehelper.ThemeStore
import code.name.monkey.appthemehelper.common.prefs.supportv7.ATEDialogPreference
import code.name.monkey.retromusic.App
import code.name.monkey.retromusic.R
import code.name.monkey.retromusic.extensions.colorControlNormal
import code.name.monkey.retromusic.fragments.NowPlayingScreen
import code.name.monkey.retromusic.fragments.NowPlayingScreen.ADAPTIVE
import code.name.monkey.retromusic.fragments.NowPlayingScreen.BLUR
@ -50,20 +51,12 @@ import com.afollestad.materialdialogs.MaterialDialog
import com.afollestad.materialdialogs.customview.customView
import com.bumptech.glide.Glide
class NowPlayingScreenPreference : ATEDialogPreference {
constructor(context: Context) : super(context)
constructor(context: Context, attrs: AttributeSet) : super(context, attrs)
constructor(context: Context, attrs: AttributeSet, defStyleAttr: Int) : super(context, attrs, defStyleAttr)
constructor(context: Context, attrs: AttributeSet, defStyleAttr: Int, defStyleRes: Int) : super(
context,
attrs,
defStyleAttr,
defStyleRes
)
class NowPlayingScreenPreference @JvmOverloads constructor(
context: Context,
attrs: AttributeSet? = null,
defStyleAttr: Int = -1,
defStyleRes: Int = -1
) : ATEDialogPreference(context, attrs, defStyleAttr, defStyleRes) {
private val mLayoutRes = R.layout.preference_dialog_now_playing_screen
@ -72,7 +65,10 @@ class NowPlayingScreenPreference : ATEDialogPreference {
}
init {
icon?.setColorFilter(ThemeStore.textColorSecondary(context), PorterDuff.Mode.SRC_IN)
icon?.colorFilter = BlendModeColorFilterCompat.createBlendModeColorFilterCompat(
colorControlNormal(context),
SRC_IN
)
}
}

View file

@ -28,7 +28,7 @@ import android.widget.LinearLayout;
import android.widget.TextView;
import androidx.annotation.ColorInt;
import androidx.annotation.NonNull;
import code.name.monkey.appthemehelper.ThemeStore;
import code.name.monkey.appthemehelper.util.ATHUtil;
import code.name.monkey.retromusic.R;
import java.io.File;
import java.util.ArrayList;
@ -41,19 +41,47 @@ import java.util.List;
*/
public class BreadCrumbLayout extends HorizontalScrollView implements View.OnClickListener {
@ColorInt
private int contentColorActivated;
@ColorInt
private int contentColorDeactivated;
public static class Crumb implements Parcelable {
public static final Creator<Crumb> CREATOR = new Creator<Crumb>() {
@Override
public Crumb createFromParcel(Parcel source) {
return new Crumb(source);
}
@Override
public Crumb[] newArray(int size) {
return new Crumb[size];
}
};
private final File file;
private int scrollPos;
public Crumb(File file) {
this.file = file;
}
private final File file;
private int scrollPos;
protected Crumb(Parcel in) {
this.file = (File) in.readSerializable();
this.scrollPos = in.readInt();
}
@Override
public int describeContents() {
return 0;
}
@Override
public boolean equals(Object o) {
return (o instanceof Crumb) && ((Crumb) o).getFile() != null &&
((Crumb) o).getFile().equals(getFile());
}
public File getFile() {
return file;
}
public int getScrollPosition() {
return scrollPos;
@ -67,16 +95,6 @@ public class BreadCrumbLayout extends HorizontalScrollView implements View.OnCli
return file.getPath().equals("/") ? "root" : file.getName();
}
public File getFile() {
return file;
}
@Override
public boolean equals(Object o) {
return (o instanceof Crumb) && ((Crumb) o).getFile() != null &&
((Crumb) o).getFile().equals(getFile());
}
@Override
public String toString() {
return "Crumb{" +
@ -85,6 +103,43 @@ public class BreadCrumbLayout extends HorizontalScrollView implements View.OnCli
'}';
}
@Override
public void writeToParcel(Parcel dest, int flags) {
dest.writeSerializable(this.file);
dest.writeInt(this.scrollPos);
}
}
public static class SavedStateWrapper implements Parcelable {
public static final Creator<SavedStateWrapper> CREATOR = new Creator<SavedStateWrapper>() {
public SavedStateWrapper createFromParcel(Parcel source) {
return new SavedStateWrapper(source);
}
public SavedStateWrapper[] newArray(int size) {
return new SavedStateWrapper[size];
}
};
public final int mActive;
public final List<Crumb> mCrumbs;
public final int mVisibility;
public SavedStateWrapper(BreadCrumbLayout view) {
mActive = view.mActive;
mCrumbs = view.mCrumbs;
mVisibility = view.getVisibility();
}
protected SavedStateWrapper(Parcel in) {
this.mActive = in.readInt();
this.mCrumbs = in.createTypedArrayList(Crumb.CREATOR);
this.mVisibility = in.readInt();
}
@Override
public int describeContents() {
return 0;
@ -92,32 +147,38 @@ public class BreadCrumbLayout extends HorizontalScrollView implements View.OnCli
@Override
public void writeToParcel(Parcel dest, int flags) {
dest.writeSerializable(this.file);
dest.writeInt(this.scrollPos);
dest.writeInt(this.mActive);
dest.writeTypedList(mCrumbs);
dest.writeInt(this.mVisibility);
}
protected Crumb(Parcel in) {
this.file = (File) in.readSerializable();
this.scrollPos = in.readInt();
}
public static final Creator<Crumb> CREATOR = new Creator<Crumb>() {
@Override
public Crumb createFromParcel(Parcel source) {
return new Crumb(source);
}
@Override
public Crumb[] newArray(int size) {
return new Crumb[size];
}
};
}
public interface SelectionCallback {
void onCrumbSelection(Crumb crumb, int index);
}
@ColorInt
private int contentColorActivated;
@ColorInt
private int contentColorDeactivated;
private int mActive;
private SelectionCallback mCallback;
private LinearLayout mChildFrame;
// Stores currently visible crumbs
private List<Crumb> mCrumbs;
// Stores user's navigation history, like a fragment back stack
private List<Crumb> mHistory;
// Used in setActiveOrAdd() between clearing crumbs and adding the new set, nullified afterwards
private List<Crumb> mOldCrumbs;
public BreadCrumbLayout(Context context) {
super(context);
init();
@ -133,59 +194,9 @@ public class BreadCrumbLayout extends HorizontalScrollView implements View.OnCli
init();
}
// Stores currently visible crumbs
private List<Crumb> mCrumbs;
// Used in setActiveOrAdd() between clearing crumbs and adding the new set, nullified afterwards
private List<Crumb> mOldCrumbs;
// Stores user's navigation history, like a fragment back stack
private List<Crumb> mHistory;
private LinearLayout mChildFrame;
private int mActive;
private SelectionCallback mCallback;
private void init() {
contentColorActivated = ThemeStore.Companion.textColorPrimary(getContext());
contentColorDeactivated = ThemeStore.Companion.textColorSecondary(getContext());
setMinimumHeight((int) getResources().getDimension(R.dimen.tab_height));
setClipToPadding(false);
setHorizontalScrollBarEnabled(false);
mCrumbs = new ArrayList<>();
mHistory = new ArrayList<>();
mChildFrame = new LinearLayout(getContext());
addView(mChildFrame, new ViewGroup.LayoutParams(
ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.MATCH_PARENT));
}
public void addHistory(Crumb crumb) {
mHistory.add(crumb);
}
public Crumb lastHistory() {
if (mHistory.size() == 0) return null;
return mHistory.get(mHistory.size() - 1);
}
public boolean popHistory() {
if (mHistory.size() == 0) return false;
mHistory.remove(mHistory.size() - 1);
return mHistory.size() != 0;
}
public int historySize() {
return mHistory.size();
}
public void clearHistory() {
mHistory.clear();
}
public void reverseHistory() {
Collections.reverse(mHistory);
}
public void addCrumb(@NonNull Crumb crumb, boolean refreshLayout) {
LinearLayout view = (LinearLayout) LayoutInflater.from(getContext()).inflate(R.layout.bread_crumb, this, false);
LinearLayout view = (LinearLayout) LayoutInflater.from(getContext())
.inflate(R.layout.bread_crumb, this, false);
view.setTag(mCrumbs.size());
view.setOnClickListener(this);
@ -205,21 +216,8 @@ public class BreadCrumbLayout extends HorizontalScrollView implements View.OnCli
invalidateActivatedAll();
}
@Override
protected void onLayout(boolean changed, int l, int t, int r, int b) {
super.onLayout(changed, l, t, r, b);
//RTL works fine like this
View child = mChildFrame.getChildAt(mActive);
if (child != null)
smoothScrollTo(child.getLeft(), 0);
}
public Crumb findCrumb(@NonNull File forDir) {
for (int i = 0; i < mCrumbs.size(); i++) {
if (mCrumbs.get(i).getFile().equals(forDir))
return mCrumbs.get(i);
}
return null;
public void addHistory(Crumb crumb) {
mHistory.add(crumb);
}
public void clearCrumbs() {
@ -232,65 +230,75 @@ public class BreadCrumbLayout extends HorizontalScrollView implements View.OnCli
}
}
public void clearHistory() {
mHistory.clear();
}
public Crumb findCrumb(@NonNull File forDir) {
for (int i = 0; i < mCrumbs.size(); i++) {
if (mCrumbs.get(i).getFile().equals(forDir)) {
return mCrumbs.get(i);
}
}
return null;
}
public int getActiveIndex() {
return mActive;
}
public Crumb getCrumb(int index) {
return mCrumbs.get(index);
}
public void setCallback(SelectionCallback callback) {
mCallback = callback;
public SavedStateWrapper getStateWrapper() {
return new SavedStateWrapper(this);
}
private boolean setActive(Crumb newActive) {
mActive = mCrumbs.indexOf(newActive);
invalidateActivatedAll();
boolean success = mActive > -1;
if (success)
public int historySize() {
return mHistory.size();
}
public Crumb lastHistory() {
if (mHistory.size() == 0) {
return null;
}
return mHistory.get(mHistory.size() - 1);
}
@Override
public void onClick(View v) {
if (mCallback != null) {
int index = (Integer) v.getTag();
mCallback.onCrumbSelection(mCrumbs.get(index), index);
}
}
public boolean popHistory() {
if (mHistory.size() == 0) {
return false;
}
mHistory.remove(mHistory.size() - 1);
return mHistory.size() != 0;
}
public void restoreFromStateWrapper(SavedStateWrapper mSavedState) {
if (mSavedState != null) {
mActive = mSavedState.mActive;
for (Crumb c : mSavedState.mCrumbs) {
addCrumb(c, false);
}
requestLayout();
return success;
}
void invalidateActivatedAll() {
for (int i = 0; i < mCrumbs.size(); i++) {
Crumb crumb = mCrumbs.get(i);
invalidateActivated(mChildFrame.getChildAt(i), mActive == mCrumbs.indexOf(crumb), false, i < mCrumbs.size() - 1).setText(crumb.getTitle());
setVisibility(mSavedState.mVisibility);
}
}
void removeCrumbAt(int index) {
mCrumbs.remove(index);
mChildFrame.removeViewAt(index);
public void reverseHistory() {
Collections.reverse(mHistory);
}
public boolean trim(String path, boolean dir) {
if (!dir) return false;
int index = -1;
for (int i = mCrumbs.size() - 1; i >= 0; i--) {
File fi = mCrumbs.get(i).getFile();
if (fi.getPath().equals(path)) {
index = i;
break;
}
}
boolean removedActive = index >= mActive;
if (index > -1) {
while (index <= mCrumbs.size() - 1)
removeCrumbAt(index);
if (mChildFrame.getChildCount() > 0) {
int lastIndex = mCrumbs.size() - 1;
invalidateActivated(mChildFrame.getChildAt(lastIndex), mActive == lastIndex, false, false);
}
}
return removedActive || mCrumbs.size() == 0;
}
public boolean trim(File file) {
return trim(file.getPath(), file.isDirectory());
}
void updateIndices() {
for (int i = 0; i < mChildFrame.getChildCount(); i++)
mChildFrame.getChildAt(i).setTag(i);
public void setActivatedContentColor(@ColorInt int contentColorActivated) {
this.contentColorActivated = contentColorActivated;
}
public void setActiveOrAdd(@NonNull Crumb crumb, boolean forceRecreate) {
@ -329,99 +337,115 @@ public class BreadCrumbLayout extends HorizontalScrollView implements View.OnCli
}
}
public int size() {
return mCrumbs.size();
}
private TextView invalidateActivated(View view, final boolean isActive, final boolean noArrowIfAlone, final boolean allowArrowVisible) {
int contentColor = isActive ? contentColorActivated : contentColorDeactivated;
LinearLayout child = (LinearLayout) view;
TextView tv = (TextView) child.getChildAt(0);
tv.setTextColor(contentColor);
ImageView iv = (ImageView) child.getChildAt(1);
iv.setColorFilter(contentColor, PorterDuff.Mode.SRC_IN);
if (noArrowIfAlone && getChildCount() == 1)
iv.setVisibility(View.GONE);
else if (allowArrowVisible)
iv.setVisibility(View.VISIBLE);
else
iv.setVisibility(View.GONE);
return tv;
}
public int getActiveIndex() {
return mActive;
}
public void setActivatedContentColor(@ColorInt int contentColorActivated) {
this.contentColorActivated = contentColorActivated;
public void setCallback(SelectionCallback callback) {
mCallback = callback;
}
public void setDeactivatedContentColor(@ColorInt int contentColorDeactivated) {
this.contentColorDeactivated = contentColorDeactivated;
}
public int size() {
return mCrumbs.size();
}
public boolean trim(String path, boolean dir) {
if (!dir) {
return false;
}
int index = -1;
for (int i = mCrumbs.size() - 1; i >= 0; i--) {
File fi = mCrumbs.get(i).getFile();
if (fi.getPath().equals(path)) {
index = i;
break;
}
}
boolean removedActive = index >= mActive;
if (index > -1) {
while (index <= mCrumbs.size() - 1) {
removeCrumbAt(index);
}
if (mChildFrame.getChildCount() > 0) {
int lastIndex = mCrumbs.size() - 1;
invalidateActivated(mChildFrame.getChildAt(lastIndex), mActive == lastIndex, false, false);
}
}
return removedActive || mCrumbs.size() == 0;
}
public boolean trim(File file) {
return trim(file.getPath(), file.isDirectory());
}
@Override
public void onClick(View v) {
if (mCallback != null) {
int index = (Integer) v.getTag();
mCallback.onCrumbSelection(mCrumbs.get(index), index);
protected void onLayout(boolean changed, int l, int t, int r, int b) {
super.onLayout(changed, l, t, r, b);
//RTL works fine like this
View child = mChildFrame.getChildAt(mActive);
if (child != null) {
smoothScrollTo(child.getLeft(), 0);
}
}
public static class SavedStateWrapper implements Parcelable {
public final int mActive;
public final List<Crumb> mCrumbs;
public final int mVisibility;
public SavedStateWrapper(BreadCrumbLayout view) {
mActive = view.mActive;
mCrumbs = view.mCrumbs;
mVisibility = view.getVisibility();
void invalidateActivatedAll() {
for (int i = 0; i < mCrumbs.size(); i++) {
Crumb crumb = mCrumbs.get(i);
invalidateActivated(mChildFrame.getChildAt(i), mActive == mCrumbs.indexOf(crumb), false,
i < mCrumbs.size() - 1).setText(crumb.getTitle());
}
@Override
public int describeContents() {
return 0;
}
@Override
public void writeToParcel(Parcel dest, int flags) {
dest.writeInt(this.mActive);
dest.writeTypedList(mCrumbs);
dest.writeInt(this.mVisibility);
}
protected SavedStateWrapper(Parcel in) {
this.mActive = in.readInt();
this.mCrumbs = in.createTypedArrayList(Crumb.CREATOR);
this.mVisibility = in.readInt();
}
public static final Creator<SavedStateWrapper> CREATOR = new Creator<SavedStateWrapper>() {
public SavedStateWrapper createFromParcel(Parcel source) {
return new SavedStateWrapper(source);
}
public SavedStateWrapper[] newArray(int size) {
return new SavedStateWrapper[size];
}
};
}
public SavedStateWrapper getStateWrapper() {
return new SavedStateWrapper(this);
void removeCrumbAt(int index) {
mCrumbs.remove(index);
mChildFrame.removeViewAt(index);
}
public void restoreFromStateWrapper(SavedStateWrapper mSavedState) {
if (mSavedState != null) {
mActive = mSavedState.mActive;
for (Crumb c : mSavedState.mCrumbs) {
addCrumb(c, false);
}
void updateIndices() {
for (int i = 0; i < mChildFrame.getChildCount(); i++) {
mChildFrame.getChildAt(i).setTag(i);
}
}
private void init() {
contentColorActivated = ATHUtil.INSTANCE.resolveColor(getContext(), android.R.attr.textColorPrimary);
contentColorDeactivated = ATHUtil.INSTANCE.resolveColor(getContext(), android.R.attr.textColorSecondary);
setMinimumHeight((int) getResources().getDimension(R.dimen.tab_height));
setClipToPadding(false);
setHorizontalScrollBarEnabled(false);
mCrumbs = new ArrayList<>();
mHistory = new ArrayList<>();
mChildFrame = new LinearLayout(getContext());
addView(mChildFrame, new ViewGroup.LayoutParams(
ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.MATCH_PARENT));
}
private TextView invalidateActivated(View view, final boolean isActive, final boolean noArrowIfAlone,
final boolean allowArrowVisible) {
int contentColor = isActive ? contentColorActivated : contentColorDeactivated;
LinearLayout child = (LinearLayout) view;
TextView tv = (TextView) child.getChildAt(0);
tv.setTextColor(contentColor);
ImageView iv = (ImageView) child.getChildAt(1);
iv.setColorFilter(contentColor, PorterDuff.Mode.SRC_IN);
if (noArrowIfAlone && getChildCount() == 1) {
iv.setVisibility(View.GONE);
} else if (allowArrowVisible) {
iv.setVisibility(View.VISIBLE);
} else {
iv.setVisibility(View.GONE);
}
return tv;
}
private boolean setActive(Crumb newActive) {
mActive = mCrumbs.indexOf(newActive);
invalidateActivatedAll();
boolean success = mActive > -1;
if (success) {
requestLayout();
setVisibility(mSavedState.mVisibility);
}
return success;
}
}

View file

@ -71,5 +71,4 @@
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/titleWelcome" />
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.core.widget.NestedScrollView>

View file

@ -10,10 +10,8 @@
android:id="@+id/playAction"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/button_margin_horizontal"
android:layout_marginTop="8dp"
android:layout_marginEnd="@dimen/button_margin_horizontal"
android:layout_marginBottom="8dp"
android:layout_marginStart="8dp"
android:layout_marginEnd="4dp"
android:text="@string/action_play_all"
android:textColor="?android:attr/textColorPrimary"
app:backgroundTint="?attr/colorSurface"
@ -27,10 +25,8 @@
android:id="@+id/shuffleAction"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/button_margin_horizontal"
android:layout_marginTop="8dp"
android:layout_marginEnd="@dimen/button_margin_horizontal"
android:layout_marginBottom="8dp"
android:layout_marginStart="4dp"
android:layout_marginEnd="8dp"
android:text="@string/shuffle"
android:textColor="?android:attr/textColorPrimary"
app:backgroundTint="?attr/colorSurface"
@ -59,6 +55,7 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:nestedScrollingEnabled="false"
android:overScrollMode="never"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/songTitle"
@ -85,6 +82,7 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:nestedScrollingEnabled="false"
android:overScrollMode="never"
android:visibility="gone"
app:layoutManager="androidx.recyclerview.widget.GridLayoutManager"
app:layout_constraintEnd_toEndOf="parent"

View file

@ -19,9 +19,6 @@
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"
app:liftOnScroll="true">
<com.google.android.material.appbar.MaterialToolbar

View file

@ -6,14 +6,13 @@
android:layout_height="match_parent"
android:orientation="vertical">
<com.google.android.material.button.MaterialButton
android:id="@+id/playAction"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/button_margin_horizontal"
android:layout_marginEnd="@dimen/button_margin_horizontal"
android:text="@string/action_play_all"
android:layout_marginStart="4dp"
android:layout_marginEnd="4dp"
app:backgroundTint="?attr/colorSurface"
app:icon="@drawable/ic_play_arrow_white_24dp"
app:layout_constraintEnd_toStartOf="@+id/shuffleAction"
@ -24,9 +23,9 @@
<com.google.android.material.button.MaterialButton
android:id="@+id/shuffleAction"
android:layout_width="0dp"
android:layout_marginStart="4dp"
android:layout_marginEnd="4dp"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/button_margin_horizontal"
android:layout_marginEnd="@dimen/button_margin_horizontal"
android:text="@string/shuffle"
app:backgroundTint="?attr/colorSurface"
app:icon="@drawable/ic_shuffle_white_24dp"
@ -36,7 +35,6 @@
app:layout_constraintStart_toEndOf="@+id/playAction"
app:layout_constraintTop_toTopOf="@+id/playAction" />
<com.google.android.material.textview.MaterialTextView
android:id="@+id/albumTitle"
android:layout_width="0dp"
@ -55,6 +53,7 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:nestedScrollingEnabled="false"
android:overScrollMode="never"
app:barrierDirection="bottom"
app:layoutManager="androidx.recyclerview.widget.GridLayoutManager"
app:layout_constraintStart_toStartOf="parent"
@ -81,6 +80,7 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:nestedScrollingEnabled="false"
android:overScrollMode="never"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/songTitle"
tools:listitem="@layout/item_song" />

View file

@ -16,8 +16,8 @@
android:id="@+id/toolbar"
style="@style/Toolbar"
app:layout_collapseMode="pin"
app:navigationIcon="@drawable/ic_keyboard_backspace_black_24dp"
app:title="@string/support_development"
app:navigationIcon="@drawable/ic_keyboard_backspace_black_24dp"
app:titleTextAppearance="@style/ToolbarTextAppearanceNormal"
tools:ignore="UnusedAttribute" />

File diff suppressed because one or more lines are too long

View file

@ -29,8 +29,8 @@
android:id="@+id/toolbar"
style="@style/Toolbar"
app:layout_collapseMode="pin"
app:navigationIcon="@drawable/ic_keyboard_backspace_black_24dp"
app:title="@string/licenses"
app:navigationIcon="@drawable/ic_keyboard_backspace_black_24dp"
app:titleTextAppearance="@style/ToolbarTextAppearanceNormal"
tools:ignore="UnusedAttribute" />

View file

@ -23,10 +23,10 @@
app:contentInsetStartWithNavigation="0dp"
app:layout_scrollFlags="scroll|enterAlways"
app:navigationIcon="@drawable/ic_keyboard_backspace_black_24dp"
app:subtitleTextAppearance="@style/TextAppearance.AppCompat.Caption"
app:subtitleTextAppearance="@style/TextViewSubtitle1"
app:titleMargin="0dp"
app:titleMarginStart="0dp"
app:titleTextAppearance="@style/TextAppearance.AppCompat.Subhead"
app:titleTextAppearance="@style/ToolbarTextAppearanceNormal"
tools:subtitle="@tools:sample/full_names"
tools:title="@tools:sample/full_names" />

View file

@ -49,10 +49,17 @@
android:background="?attr/colorSurface"
app:navigationIcon="@drawable/ic_menu_white_24dp"
app:popupTheme="?attr/toolbarPopupTheme"
app:title="@string/action_search"
app:titleTextAppearance="@style/TextViewHeadline6"
app:titleTextColor="?android:attr/textColorSecondary"
tools:ignore="UnusedAttribute" />
tools:ignore="UnusedAttribute">
<com.google.android.material.textview.MaterialTextView
android:layout_width="wrap_content"
android:id="@+id/appTitle"
android:layout_height="wrap_content"
android:gravity="center"
android:textAppearance="@style/TextViewHeadline6"
android:text="@string/app_name" />
</androidx.appcompat.widget.Toolbar>
<ViewStub
android:id="@+id/cab_stub"

View file

@ -23,46 +23,27 @@
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"
app:liftOnScroll="true">
<com.google.android.material.appbar.CollapsingToolbarLayout
android:id="@+id/collapsingToolbarLayout"
<com.google.android.material.appbar.MaterialToolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_scrollFlags="scroll|enterAlways"
app:titleEnabled="false">
<com.google.android.material.appbar.MaterialToolbar
android:id="@+id/toolbar"
style="@style/Toolbar"
app:layout_collapseMode="pin"
app:title="@string/queue"
app:titleTextAppearance="@style/ToolbarTextAppearanceNormal"
tools:ignore="UnusedAttribute" />
</com.google.android.material.appbar.CollapsingToolbarLayout>
<com.google.android.material.textview.MaterialTextView
android:id="@+id/playerQueueSubHeader"
android:layout_width="match_parent"
android:layout_height="48dp"
android:gravity="center_vertical"
android:paddingLeft="16dp"
android:paddingRight="16dp"
android:text="@string/up_next"
android:textAppearance="@style/TextViewBody2" />
app:layout_collapseMode="pin"
app:navigationIcon="@drawable/ic_keyboard_backspace_black_24dp"
app:title="@string/queue"
app:titleTextAppearance="@style/ToolbarTextAppearanceNormal"
tools:ignore="UnusedAttribute" />
</com.google.android.material.appbar.AppBarLayout>
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recyclerView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:clipToPadding="false"
android:layoutAnimation="@anim/layout_animation_fall_down"
android:overScrollMode="never"
android:paddingBottom="96dp"
android:scrollbars="none"
app:layout_behavior="com.google.android.material.appbar.AppBarLayout$ScrollingViewBehavior" />

View file

@ -24,9 +24,6 @@
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"
app:liftOnScroll="true">
<FrameLayout
@ -36,7 +33,8 @@
<com.google.android.material.appbar.MaterialToolbar
android:id="@+id/toolbar"
style="@style/Toolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:navigationIcon="@drawable/ic_keyboard_backspace_black_24dp"
app:titleTextAppearance="@style/ToolbarTextAppearanceNormal" />
@ -53,6 +51,7 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:clipToPadding="false"
android:overScrollMode="never"
android:scrollbars="none"
app:layout_behavior="com.google.android.material.appbar.AppBarLayout$ScrollingViewBehavior" />

View file

@ -38,6 +38,7 @@
android:id="@+id/toolbar"
style="@style/Toolbar"
app:layout_collapseMode="pin"
app:navigationIcon="@drawable/ic_keyboard_backspace_black_24dp"
app:title="@string/retro_music_pro"
app:titleTextAppearance="@style/ToolbarTextAppearanceNormal"
tools:ignore="UnusedAttribute" />

View file

@ -110,6 +110,7 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:clipToPadding="false"
android:overScrollMode="never"
android:scrollbarStyle="outsideOverlay"
android:scrollbars="vertical"
app:layout_behavior="com.google.android.material.appbar.AppBarLayout$ScrollingViewBehavior" />

View file

@ -11,9 +11,6 @@
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"
app:liftOnScroll="true">
<com.google.android.material.appbar.MaterialToolbar

View file

@ -18,6 +18,7 @@
android:id="@+id/toolbar"
style="@style/Toolbar"
app:title="@string/profile"
app:navigationIcon="@drawable/ic_keyboard_backspace_black_24dp"
app:titleTextAppearance="@style/ToolbarTextAppearanceNormal" />
</com.google.android.material.appbar.AppBarLayout>

View file

@ -39,10 +39,10 @@
</com.google.android.material.appbar.AppBarLayout>
<androidx.core.widget.NestedScrollView
android:id="@+id/container"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="fill_vertical"
android:id="@+id/container"
app:layout_behavior="com.google.android.material.appbar.AppBarLayout$ScrollingViewBehavior">
<code.name.monkey.retromusic.views.LollipopFixedWebView

View file

@ -30,6 +30,7 @@
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recyclerView"
android:overScrollMode="never"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_constraintEnd_toEndOf="parent"

View file

@ -25,7 +25,6 @@
android:layout_height="wrap_content"
android:orientation="vertical">
<com.google.android.material.card.MaterialCardView
android:id="@+id/imageContainer"
android:layout_width="0dp"

View file

@ -13,6 +13,7 @@
android:clipToPadding="false"
android:layoutAnimation="@anim/layout_animation_fall_down"
android:scrollbars="none"
android:overScrollMode="never"
app:layout_dodgeInsetEdges="bottom"
tools:listitem="@layout/item_list" />

View file

@ -38,7 +38,11 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:nestedScrollingEnabled="false"
tools:visibility="gone" />
android:overScrollMode="never"
app:layoutManager="androidx.recyclerview.widget.GridLayoutManager"
app:spanCount="3"
tools:itemCount="3"
tools:listitem="@layout/item_album_card" />
<Space
android:layout_width="match_parent"

View file

@ -18,8 +18,7 @@
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:orientation="horizontal"
android:paddingStart="8dp"
android:paddingEnd="8dp">
>
<com.google.android.material.button.MaterialButton
android:id="@+id/playAction"

View file

@ -25,6 +25,7 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:nestedScrollingEnabled="false"
android:overScrollMode="never"
android:visibility="gone"
app:itemMargin="28dp"
app:layout_constraintEnd_toEndOf="parent"

View file

@ -27,6 +27,7 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:nestedScrollingEnabled="false"
android:overScrollMode="never"
android:visibility="gone"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"

View file

@ -20,22 +20,10 @@ object ATH {
@SuppressLint("CommitPrefEdits")
fun didThemeValuesChange(context: Context, since: Long): Boolean {
return ThemeStore.isConfigured(context) && ThemeStore.prefs(context).getLong(ThemeStorePrefKeys.VALUES_CHANGED, -1) > since
}
fun setStatusbarColorAuto(activity: Activity) {
setStatusbarColor(activity, ThemeStore.statusBarColor(activity))
}
fun setStatusbarColor(activity: Activity, color: Int) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
activity.window.statusBarColor = color
setLightStatusbarAuto(activity, color)
}
}
fun setLightStatusbarAuto(activity: Activity, bgColor: Int) {
setLightStatusbar(activity, ColorUtil.isColorLight(bgColor))
return ThemeStore.isConfigured(context) && ThemeStore.prefs(context).getLong(
ThemeStorePrefKeys.VALUES_CHANGED,
-1
) > since
}
fun setLightStatusbar(activity: Activity, enabled: Boolean) {
@ -84,8 +72,10 @@ object ATH {
setActivityToolbarColor(activity, toolbar, ThemeStore.primaryColor(activity))
}
fun setActivityToolbarColor(activity: Activity, toolbar: Toolbar?,
color: Int) {
fun setActivityToolbarColor(
activity: Activity, toolbar: Toolbar?,
color: Int
) {
if (toolbar == null) {
return
}

View file

@ -4,8 +4,12 @@ import android.annotation.SuppressLint
import android.content.Context
import android.content.SharedPreferences
import android.graphics.Color
import androidx.annotation.*
import androidx.annotation.AttrRes
import androidx.annotation.CheckResult
import androidx.annotation.ColorInt
import androidx.annotation.ColorRes
import androidx.annotation.IntRange
import androidx.annotation.StyleRes
import androidx.core.content.ContextCompat
import code.name.monkey.appthemehelper.util.ATHUtil
import code.name.monkey.appthemehelper.util.ColorUtil
@ -15,6 +19,7 @@ import code.name.monkey.appthemehelper.util.ColorUtil
*/
class ThemeStore @SuppressLint("CommitPrefEdits")
private constructor(private val mContext: Context) : ThemeStorePrefKeys, ThemeStoreInterface {
private val mEditor: SharedPreferences.Editor
init {
@ -166,8 +171,8 @@ private constructor(private val mContext: Context) : ThemeStorePrefKeys, ThemeSt
override fun commit() {
mEditor.putLong(ThemeStorePrefKeys.VALUES_CHANGED, System.currentTimeMillis())
.putBoolean(ThemeStorePrefKeys.IS_CONFIGURED_KEY, true)
.commit()
.putBoolean(ThemeStorePrefKeys.IS_CONFIGURED_KEY, true)
.commit()
}
companion object {
@ -194,29 +199,24 @@ private constructor(private val mContext: Context) : ThemeStorePrefKeys, ThemeSt
@CheckResult
@ColorInt
fun primaryColor(context: Context): Int {
return prefs(context).getInt(ThemeStorePrefKeys.KEY_PRIMARY_COLOR, ATHUtil.resolveColor(context, R.attr.colorPrimary, Color.parseColor("#455A64")))
}
@CheckResult
@ColorInt
fun primaryColorDark(context: Context): Int {
return prefs(context).getInt(ThemeStorePrefKeys.KEY_PRIMARY_COLOR_DARK, ATHUtil.resolveColor(context, R.attr.colorPrimaryDark, Color.parseColor("#37474F")))
return prefs(context).getInt(
ThemeStorePrefKeys.KEY_PRIMARY_COLOR,
ATHUtil.resolveColor(context, R.attr.colorPrimary, Color.parseColor("#455A64"))
)
}
@CheckResult
@ColorInt
fun accentColor(context: Context): Int {
val desaturatedColor = prefs(context).getBoolean("desaturated_color", false)
val color = prefs(context).getInt(ThemeStorePrefKeys.KEY_ACCENT_COLOR, ATHUtil.resolveColor(context, R.attr.colorAccent, Color.parseColor("#263238")))
return if (ATHUtil.isWindowBackgroundDark(context) && desaturatedColor) ColorUtil.desaturateColor(color, 0.4f) else color
}
@CheckResult
@ColorInt
fun statusBarColor(context: Context): Int {
return if (!coloredStatusBar(context)) {
Color.BLACK
} else prefs(context).getInt(ThemeStorePrefKeys.KEY_STATUS_BAR_COLOR, primaryColorDark(context))
val color = prefs(context).getInt(
ThemeStorePrefKeys.KEY_ACCENT_COLOR,
ATHUtil.resolveColor(context, R.attr.colorAccent, Color.parseColor("#263238"))
)
return if (ATHUtil.isWindowBackgroundDark(context) && desaturatedColor) ColorUtil.desaturateColor(
color,
0.4f
) else color
}
@CheckResult
@ -227,30 +227,6 @@ private constructor(private val mContext: Context) : ThemeStorePrefKeys, ThemeSt
} else prefs(context).getInt(ThemeStorePrefKeys.KEY_NAVIGATION_BAR_COLOR, primaryColor(context))
}
@CheckResult
@ColorInt
fun textColorPrimary(context: Context): Int {
return prefs(context).getInt(ThemeStorePrefKeys.KEY_TEXT_COLOR_PRIMARY, ATHUtil.resolveColor(context, android.R.attr.textColorPrimary))
}
@CheckResult
@ColorInt
fun textColorPrimaryInverse(context: Context): Int {
return prefs(context).getInt(ThemeStorePrefKeys.KEY_TEXT_COLOR_PRIMARY_INVERSE, ATHUtil.resolveColor(context, android.R.attr.textColorPrimaryInverse))
}
@CheckResult
@ColorInt
fun textColorSecondary(context: Context): Int {
return prefs(context).getInt(ThemeStorePrefKeys.KEY_TEXT_COLOR_SECONDARY, ATHUtil.resolveColor(context, android.R.attr.textColorSecondary))
}
@CheckResult
@ColorInt
fun textColorSecondaryInverse(context: Context): Int {
return prefs(context).getInt(ThemeStorePrefKeys.KEY_TEXT_COLOR_SECONDARY_INVERSE, ATHUtil.resolveColor(context, android.R.attr.textColorSecondaryInverse))
}
@CheckResult
fun coloredStatusBar(context: Context): Boolean {
return prefs(context).getBoolean(ThemeStorePrefKeys.KEY_APPLY_PRIMARYDARK_STATUSBAR, true)
@ -272,7 +248,12 @@ private constructor(private val mContext: Context) : ThemeStorePrefKeys, ThemeSt
}
@SuppressLint("CommitPrefEdits")
fun isConfigured(context: Context, @IntRange(from = 0, to = Integer.MAX_VALUE.toLong()) version: Int): Boolean {
fun isConfigured(
context: Context, @IntRange(
from = 0,
to = Integer.MAX_VALUE.toLong()
) version: Int
): Boolean {
val prefs = prefs(context)
val lastVersion = prefs.getInt(ThemeStorePrefKeys.IS_CONFIGURED_VERSION_KEY, -1)
if (version > lastVersion) {

View file

@ -15,14 +15,15 @@
package code.name.monkey.appthemehelper.common.prefs.supportv7
import android.content.Context
import android.graphics.PorterDuff
import android.util.AttributeSet
import android.view.View
import androidx.core.graphics.BlendModeColorFilterCompat
import androidx.core.graphics.BlendModeCompat
import androidx.preference.Preference
import androidx.preference.PreferenceViewHolder
import code.name.monkey.appthemehelper.R
import code.name.monkey.appthemehelper.ThemeStore
import code.name.monkey.appthemehelper.common.prefs.BorderCircleView
import code.name.monkey.appthemehelper.util.ATHUtil
class ATEColorPreference @JvmOverloads constructor(
context: Context,
@ -39,7 +40,12 @@ class ATEColorPreference @JvmOverloads constructor(
widgetLayoutResource = R.layout.ate_preference_color
isPersistent = false
icon?.setColorFilter(ThemeStore.textColorSecondary(context), PorterDuff.Mode.SRC_IN)
icon?.colorFilter = BlendModeColorFilterCompat.createBlendModeColorFilterCompat(
ATHUtil.resolveColor(
context,
android.R.attr.colorControlNormal
), BlendModeCompat.SRC_IN
)
}
override fun onBindViewHolder(holder: PreferenceViewHolder) {

View file

@ -1,50 +0,0 @@
/*
* Copyright (c) 2019 Hemanth Savarala.
*
* Licensed under the GNU General Public License v3
*
* This is free software: you can redistribute it and/or modify it under
* the terms of the GNU General Public License as published by
* the Free Software Foundation either version 3 of the License, or (at your option) any later version.
*
* This software is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details.
*/
package code.name.monkey.appthemehelper.common.prefs.supportv7;
import android.content.Context;
import android.util.AttributeSet;
import androidx.preference.ListPreference;
import code.name.monkey.appthemehelper.R;
public class ATEListPreference extends ListPreference {
public ATEListPreference(Context context) {
super(context);
init(context, null);
}
public ATEListPreference(Context context, AttributeSet attrs) {
super(context, attrs);
init(context, attrs);
}
public ATEListPreference(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
init(context, attrs);
}
public ATEListPreference(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
super(context, attrs, defStyleAttr, defStyleRes);
init(context, attrs);
}
private void init(Context context, AttributeSet attrs) {
setLayoutResource(R.layout.ate_preference_custom_support);
if (getSummary() == null || getSummary().toString().trim().isEmpty()) {
setSummary("%s");
}
}
}

View file

@ -0,0 +1,34 @@
/*
* Copyright (c) 2019 Hemanth Savarala.
*
* Licensed under the GNU General Public License v3
*
* This is free software: you can redistribute it and/or modify it under
* the terms of the GNU General Public License as published by
* the Free Software Foundation either version 3 of the License, or (at your option) any later version.
*
* This software is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details.
*/
package code.name.monkey.appthemehelper.common.prefs.supportv7
import android.content.Context
import android.util.AttributeSet
import androidx.preference.ListPreference
import code.name.monkey.appthemehelper.R.layout
class ATEListPreference @JvmOverloads constructor(
context: Context,
attrs: AttributeSet? = null,
defStyleAttr: Int = -1,
defStyleRes: Int = -1
) : ListPreference(context, attrs, defStyleAttr, defStyleRes) {
init {
layoutResource = layout.ate_preference_custom_support
if (summary == null || summary.toString().trim { it <= ' ' }.isEmpty()) {
summary = "%s"
}
}
}

View file

@ -15,10 +15,11 @@
package code.name.monkey.appthemehelper.common.prefs.supportv7
import android.content.Context
import android.graphics.PorterDuff
import android.util.AttributeSet
import androidx.core.graphics.BlendModeColorFilterCompat
import androidx.core.graphics.BlendModeCompat
import androidx.preference.Preference
import code.name.monkey.appthemehelper.ThemeStore
import code.name.monkey.appthemehelper.util.ATHUtil
class ATEPreference @JvmOverloads constructor(
context: Context,
@ -28,6 +29,11 @@ class ATEPreference @JvmOverloads constructor(
) : Preference(context, attrs, defStyleAttr, defStyleRes) {
init {
icon?.setColorFilter(ThemeStore.textColorSecondary(context), PorterDuff.Mode.SRC_IN)
icon?.colorFilter = BlendModeColorFilterCompat.createBlendModeColorFilterCompat(
ATHUtil.resolveColor(
context,
android.R.attr.colorControlNormal
), BlendModeCompat.SRC_IN
)
}
}

View file

@ -1,39 +1,31 @@
package code.name.monkey.appthemehelper.common.prefs.supportv7
import android.content.Context
import android.graphics.PorterDuff
import android.util.AttributeSet
import android.widget.SeekBar
import androidx.core.graphics.BlendModeColorFilterCompat
import androidx.core.graphics.BlendModeCompat
import androidx.preference.PreferenceViewHolder
import androidx.preference.SeekBarPreference
import code.name.monkey.appthemehelper.R
import code.name.monkey.appthemehelper.ThemeStore
import code.name.monkey.appthemehelper.util.ATHUtil
import code.name.monkey.appthemehelper.util.TintHelper
class ATESeekBarPreference : SeekBarPreference {
constructor(context: Context) : super(context) {
init()
}
class ATESeekBarPreference @JvmOverloads constructor(
context: Context,
attrs: AttributeSet? = null,
defStyleAttr: Int = -1,
defStyleRes: Int = -1
) : SeekBarPreference(context, attrs, defStyleAttr, defStyleRes) {
constructor(context: Context, attrs: AttributeSet) : super(context, attrs) {
init()
}
constructor(context: Context, attrs: AttributeSet, defStyleAttr: Int) : super(context, attrs, defStyleAttr) {
init()
}
constructor(context: Context, attrs: AttributeSet, defStyleAttr: Int, defStyleRes: Int) : super(
context,
attrs,
defStyleAttr,
defStyleRes
) {
init()
}
private fun init() {
icon?.setColorFilter(ThemeStore.textColorSecondary(context), PorterDuff.Mode.SRC_IN)
init {
icon?.colorFilter = BlendModeColorFilterCompat.createBlendModeColorFilterCompat(
ATHUtil.resolveColor(
context,
android.R.attr.colorControlNormal
), BlendModeCompat.SRC_IN
)
}
override fun onBindViewHolder(view: PreferenceViewHolder) {

View file

@ -1,38 +1,31 @@
package code.name.monkey.appthemehelper.common.prefs.supportv7
import android.annotation.TargetApi
import android.content.Context
import android.graphics.PorterDuff
import android.os.Build
import android.util.AttributeSet
import androidx.core.graphics.BlendModeColorFilterCompat
import androidx.core.graphics.BlendModeCompat
import androidx.preference.CheckBoxPreference
import code.name.monkey.appthemehelper.R
import code.name.monkey.appthemehelper.ThemeStore
import code.name.monkey.appthemehelper.util.ATHUtil
/**
* @author Aidan Follestad (afollestad)
*/
class ATESwitchPreference : CheckBoxPreference {
class ATESwitchPreference @JvmOverloads constructor(
context: Context,
attrs: AttributeSet? = null,
defStyleAttr: Int = -1,
defStyleRes: Int = -1
) :
CheckBoxPreference(context, attrs, defStyleAttr, defStyleRes) {
constructor(context: Context) : super(context) {
init()
}
constructor(context: Context, attrs: AttributeSet) : super(context, attrs) {
init()
}
constructor(context: Context, attrs: AttributeSet, defStyleAttr: Int) : super(context, attrs, defStyleAttr) {
init()
}
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
constructor(context: Context, attrs: AttributeSet, defStyleAttr: Int, defStyleRes: Int) : super(context, attrs, defStyleAttr, defStyleRes) {
init()
}
private fun init() {
init {
widgetLayoutResource = R.layout.ate_preference_switch_support
icon?.setColorFilter(ThemeStore.textColorSecondary(context), PorterDuff.Mode.SRC_IN)
icon?.colorFilter = BlendModeColorFilterCompat.createBlendModeColorFilterCompat(
ATHUtil.resolveColor(
context,
android.R.attr.colorControlNormal
), BlendModeCompat.SRC_IN
)
}
}

View file

@ -75,12 +75,4 @@ public class ATEListPreferenceDialogFragmentCompat extends ATEPreferenceDialogFr
}
}
}
/* @Override
public boolean onSelection(MaterialDialog dialog, View itemView, int which, CharSequence text) {
mClickedDialogEntryIndex = which;
onClick(dialog, DialogAction.POSITIVE);
dismiss();
return true;
}*/
}

View file

@ -18,21 +18,20 @@ package code.name.monkey.appthemehelper.common.prefs.supportv7.dialogs;
import android.app.Dialog;
import android.os.Bundle;
import android.view.Window;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.appcompat.app.AlertDialog;
import androidx.fragment.app.DialogFragment;
import androidx.fragment.app.Fragment;
import androidx.preference.DialogPreference;
import com.google.android.material.dialog.MaterialAlertDialogBuilder;
/**
* @author Karim Abou Zeid (kabouzeid)
*/
public class ATEPreferenceDialogFragment extends DialogFragment {
protected static final String ARG_KEY = "key";
static final String ARG_KEY = "key";
private DialogPreference mPreference;
@ -56,6 +55,10 @@ public class ATEPreferenceDialogFragment extends DialogFragment {
}
}
public DialogPreference getPreference() {
return this.mPreference;
}
@NonNull
public Dialog onCreateDialog(@Nullable Bundle savedInstanceState) {
MaterialAlertDialogBuilder materialDialog = new MaterialAlertDialogBuilder(requireActivity())
@ -77,23 +80,19 @@ public class ATEPreferenceDialogFragment extends DialogFragment {
return dialog;
}
public DialogPreference getPreference() {
return this.mPreference;
}
public void onDialogClosed(boolean positiveResult) {
protected void onPrepareDialogBuilder(MaterialAlertDialogBuilder builder) {
}
protected boolean needInputMethod() {
return false;
}
protected void onPrepareDialogBuilder(MaterialAlertDialogBuilder builder) {
}
private void requestInputMethod(Dialog dialog) {
Window window = dialog.getWindow();
window.setSoftInputMode(5);
}
public void onDialogClosed(boolean positiveResult) {
}
}

View file

@ -159,7 +159,8 @@ public final class ToolbarContentTintHelper {
radioButtonField.setAccessible(true);
final boolean isDark = !ColorUtil.INSTANCE.isColorLight(
ATHUtil.INSTANCE.resolveColor(context, android.R.attr.windowBackground));
ATHUtil.INSTANCE
.resolveColor(context, android.R.attr.windowBackground));
for (int i = 0; i < listView.getChildCount(); i++) {
View v = listView.getChildAt(i);
@ -351,8 +352,9 @@ public final class ToolbarContentTintHelper {
}
//Step 3: Changing the color of title and subtitle.
toolbarView.setTitleTextColor(ThemeStore.Companion.textColorPrimary(activity));
toolbarView.setSubtitleTextColor(ThemeStore.Companion.textColorSecondary(activity));
toolbarView.setTitleTextColor(ATHUtil.INSTANCE.resolveColor(activity, android.R.attr.textColorPrimary));
toolbarView
.setSubtitleTextColor(ATHUtil.INSTANCE.resolveColor(activity, android.R.attr.textColorSecondary));
//Step 4: Changing the color of the Overflow Menu icon.
setOverflowButtonColor(activity, toolbarView, toolbarIconsColor);

49
change-log.html Normal file
View file

@ -0,0 +1,49 @@
<!--
~ Copyright (c) 2020 Hemanth Savarala.
~
~ Licensed under the GNU General Public License v3
~
~ This is free software: you can redistribute it and/or modify it under
~ the terms of the GNU General Public License as published by
~ the Free Software Foundation either version 3 of the License, or (at your option) any later version.
~
~ This software is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
~ without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
~ See the GNU General Public License for more details.
-->
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Change log</title>
</head>
<body>
<h3>3.4.950</h3>
Stable
<h4>What's new?</h4>
<ul>
<li>Major refactor has been done for library tabs</li>
<li>Folder option now in available in tabs</li>
<li>Improved drive mode page</li>
<li>Added date modified option to sort songs</li>
<li>Added toggle bluetooth connection to play on device as soon as it connected</li>
<li>Fix tablet version of app</li>
<li>Fix Album and Artist details toolbar full width for better accessibility</li>
</ul>
<h4>Improvements and fixes</h4>
<ul>
<li>Major refactor has been done for library tabs</li>
<li>Folder option now in available in tabs</li>
<li>Improved drive mode page</li>
<li>Added date modified option to sort songs</li>
<li>Added toggle bluetooth connection to play on device as soon as it connected</li>
<li>Fix tablet version of app</li>
<li>Fix Album and Artist details toolbar full width for better accessibility</li>
</ul>
</body>
</html>

View file

@ -42,7 +42,7 @@ dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'androidx.core:core-ktx:1.1.0'
implementation 'androidx.core:core-ktx:1.2.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'

View file

@ -0,0 +1,5 @@
package dev.hemanths.fonts
/**
* Created by hemanths on 2020-02-22.
*/