Adding copy right signature
This commit is contained in:
parent
147b8b5292
commit
8efadd9a79
23 changed files with 245 additions and 120 deletions
|
@ -40,7 +40,6 @@ abstract class AbsMainActivityFragment : AbsMusicServiceFragment() {
|
|||
|
||||
fun setStatusbarColorAuto(view: View) {
|
||||
// we don't want to use statusbar color because we are doing the color darkening on our own to support KitKat
|
||||
|
||||
if (VersionUtils.hasMarshmallow()) {
|
||||
setStatusbarColor(view, ThemeStore.primaryColor(context!!))
|
||||
} else {
|
||||
|
|
|
@ -89,32 +89,35 @@ class BannerHomeFragment : AbsMainActivityFragment(), MainActivityFragmentCallba
|
|||
|
||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||
super.onViewCreated(view, savedInstanceState)
|
||||
|
||||
|
||||
toolbar = view.findViewById(R.id.toolbar)
|
||||
|
||||
bannerImage?.setOnClickListener {
|
||||
NavigationUtil.goToUserInfo(activity!!)
|
||||
NavigationUtil.goToUserInfo(requireActivity())
|
||||
}
|
||||
if (!PreferenceUtil.getInstance().isHomeBanner)
|
||||
setStatusbarColorAuto(view)
|
||||
|
||||
lastAdded.setOnClickListener {
|
||||
NavigationUtil.goToPlaylistNew(mainActivity, LastAddedPlaylist(mainActivity))
|
||||
NavigationUtil.goToPlaylistNew(requireActivity(), LastAddedPlaylist(requireActivity()))
|
||||
}
|
||||
|
||||
topPlayed.setOnClickListener {
|
||||
NavigationUtil.goToPlaylistNew(mainActivity, MyTopTracksPlaylist(mainActivity))
|
||||
NavigationUtil.goToPlaylistNew(requireActivity(), MyTopTracksPlaylist(requireActivity()))
|
||||
}
|
||||
|
||||
actionShuffle.setOnClickListener {
|
||||
MusicPlayerRemote.openAndShuffleQueue(SongLoader.getAllSongs(mainActivity) , true)
|
||||
MusicPlayerRemote.openAndShuffleQueue(SongLoader.getAllSongs(requireActivity()) , true)
|
||||
}
|
||||
|
||||
history.setOnClickListener {
|
||||
NavigationUtil.goToPlaylistNew(mainActivity, HistoryPlaylist(mainActivity))
|
||||
NavigationUtil.goToPlaylistNew(requireActivity(), HistoryPlaylist(requireActivity()))
|
||||
}
|
||||
|
||||
homePresenter = HomePresenter(this)
|
||||
|
||||
contentContainer.setBackgroundColor(ThemeStore.primaryColor(context!!))
|
||||
contentContainer.setBackgroundColor(ThemeStore.primaryColor(requireContext()))
|
||||
|
||||
setupToolbar()
|
||||
homeAdapter = HomeAdapter(mainActivity, ArrayList(), displayMetrics)
|
||||
|
@ -124,16 +127,16 @@ class BannerHomeFragment : AbsMainActivityFragment(), MainActivityFragmentCallba
|
|||
checkPadding()
|
||||
|
||||
userInfoContainer.setOnClickListener {
|
||||
NavigationUtil.goToUserInfo(activity!!)
|
||||
NavigationUtil.goToUserInfo(requireActivity())
|
||||
}
|
||||
titleWelcome.setTextColor(ThemeStore.textColorPrimary(context!!))
|
||||
titleWelcome.setTextColor(ThemeStore.textColorPrimary(requireContext()))
|
||||
titleWelcome.text = String.format("%s", PreferenceUtil.getInstance().userName)
|
||||
}
|
||||
|
||||
private fun checkPadding() {
|
||||
val marginSpan = when {
|
||||
MusicPlayerRemote.playingQueue.isEmpty() -> RetroUtil.convertDpToPixel(52f, context!!).toInt()
|
||||
else -> RetroUtil.convertDpToPixel(0f, context!!).toInt()
|
||||
else -> RetroUtil.convertDpToPixel(0f, requireContext()).toInt()
|
||||
}
|
||||
|
||||
(recyclerView.layoutParams as ViewGroup.MarginLayoutParams).bottomMargin = (marginSpan * 2.3f).toInt()
|
||||
|
@ -154,7 +157,7 @@ class BannerHomeFragment : AbsMainActivityFragment(), MainActivityFragmentCallba
|
|||
setNavigationIcon(R.drawable.ic_menu_white_24dp)
|
||||
setOnClickListener {
|
||||
val pairImageView = Pair.create<View, String>(toolbarContainer, resources.getString(R.string.transition_toolbar))
|
||||
NavigationUtil.goToSearch(activity!!, pairImageView)
|
||||
NavigationUtil.goToSearch(requireActivity(), pairImageView)
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -219,20 +222,18 @@ class BannerHomeFragment : AbsMainActivityFragment(), MainActivityFragmentCallba
|
|||
super.onCreateOptionsMenu(menu, inflater)
|
||||
inflater.inflate(R.menu.menu_search, menu)
|
||||
|
||||
val activity = activity ?: return
|
||||
ToolbarContentTintHelper.handleOnCreateOptionsMenu(activity, toolbar, menu, ATHToolbarActivity.getToolbarBackgroundColor(toolbar))
|
||||
ToolbarContentTintHelper.handleOnCreateOptionsMenu(requireActivity(), toolbar, menu, ATHToolbarActivity.getToolbarBackgroundColor(toolbar))
|
||||
}
|
||||
|
||||
override fun onPrepareOptionsMenu(menu: Menu) {
|
||||
super.onPrepareOptionsMenu(menu)
|
||||
val activity = activity ?: return
|
||||
ToolbarContentTintHelper.handleOnPrepareOptionsMenu(activity, toolbar)
|
||||
ToolbarContentTintHelper.handleOnPrepareOptionsMenu(requireActivity(), toolbar)
|
||||
}
|
||||
|
||||
override fun onOptionsItemSelected(item: MenuItem): Boolean {
|
||||
if (item.itemId == R.id.action_search) {
|
||||
val pairImageView = Pair.create<View, String>(toolbarContainer, resources.getString(R.string.transition_toolbar))
|
||||
NavigationUtil.goToSearch(mainActivity, true, pairImageView)
|
||||
NavigationUtil.goToSearch(requireActivity(), true, pairImageView)
|
||||
}
|
||||
return super.onOptionsItemSelected(item)
|
||||
}
|
||||
|
@ -258,13 +259,13 @@ class BannerHomeFragment : AbsMainActivityFragment(), MainActivityFragmentCallba
|
|||
private fun loadTimeImage(day: String) {
|
||||
if (bannerImage != null) {
|
||||
if (PreferenceUtil.getInstance().bannerImage.isEmpty()) {
|
||||
GlideApp.with(activity!!)
|
||||
GlideApp.with(requireActivity())
|
||||
.load(day)
|
||||
.placeholder(R.drawable.material_design_default)
|
||||
.diskCacheStrategy(DiskCacheStrategy.ALL)
|
||||
.into(bannerImage!!)
|
||||
} else {
|
||||
disposable.add(Compressor(context!!)
|
||||
disposable.add(Compressor(requireActivity())
|
||||
.setQuality(100)
|
||||
.setCompressFormat(Bitmap.CompressFormat.WEBP)
|
||||
.compressToBitmapAsFlowable(File(PreferenceUtil.getInstance().bannerImage, USER_BANNER))
|
||||
|
|
|
@ -169,47 +169,6 @@ class ColorFragment : AbsPlayerFragment() {
|
|||
setColors(backgroundColor, textColor)
|
||||
}
|
||||
})
|
||||
|
||||
/*SongGlideRequest.Builder.from(Glide.with(activity), MusicPlayerRemote.currentSong)
|
||||
.checkIgnoreMediaStore(activity!!)
|
||||
.generatePalette(activity).build().dontAnimate()
|
||||
.into(object : RetroMusicColoredTarget(playerImage) {
|
||||
override fun onColorReady(color: Int) {
|
||||
//setColors(color);
|
||||
}
|
||||
|
||||
override fun onLoadFailed(e: Exception?, errorDrawable: Drawable?) {
|
||||
super.onLoadFailed(e, errorDrawable)
|
||||
|
||||
val backgroundColor = defaultFooterColor
|
||||
val textColor = if (ColorUtil.isColorLight(defaultFooterColor))
|
||||
MaterialValueHelper.getPrimaryTextColor(context, true)
|
||||
else
|
||||
MaterialValueHelper.getPrimaryTextColor(context, false)
|
||||
|
||||
setColors(backgroundColor, textColor)
|
||||
}
|
||||
|
||||
override fun onResourceReady(resource: BitmapPaletteWrapper,
|
||||
glideAnimation: GlideAnimation<in BitmapPaletteWrapper>?) {
|
||||
super.onResourceReady(resource, glideAnimation)
|
||||
*//* MediaNotificationProcessor processor = new MediaNotificationProcessor(getContext(),
|
||||
getContext());
|
||||
Palette.Builder builder = MediaNotificationProcessor
|
||||
.generatePalette(resource.getBitmap());
|
||||
|
||||
int backgroundColor = processor.getBackgroundColor(builder);
|
||||
int textColor = processor.getTextColor(builder);*//*
|
||||
|
||||
val palette = resource.palette
|
||||
val swatch = RetroColorUtil.getSwatch(palette)
|
||||
|
||||
val textColor = RetroColorUtil.getTextColor(palette)
|
||||
val backgroundColor = swatch.rgb
|
||||
|
||||
setColors(backgroundColor, textColor)
|
||||
}
|
||||
})*/
|
||||
}
|
||||
|
||||
private fun setColors(backgroundColor: Int, textColor: Int) {
|
||||
|
|
|
@ -5,7 +5,8 @@ import android.os.Bundle
|
|||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import code.name.monkey.appthemehelper.ThemeStore
|
||||
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.fragments.base.AbsPlayerControlsFragment
|
||||
import code.name.monkey.retromusic.helper.MusicPlayerRemote
|
||||
|
@ -28,8 +29,13 @@ class TinyPlaybackControlsFragment : AbsPlayerControlsFragment() {
|
|||
|
||||
override fun setDark(color: Int) {
|
||||
|
||||
lastPlaybackControlsColor = ThemeStore.textColorPrimary(requireContext())
|
||||
lastDisabledPlaybackControlsColor = ThemeStore.textColorSecondary(requireContext())
|
||||
if (ColorUtil.isColorLight(color)) {
|
||||
lastPlaybackControlsColor = MaterialValueHelper.getSecondaryTextColor(requireContext(), true)
|
||||
lastDisabledPlaybackControlsColor = MaterialValueHelper.getSecondaryDisabledTextColor(requireContext(), true)
|
||||
} else {
|
||||
lastPlaybackControlsColor = MaterialValueHelper.getPrimaryTextColor(requireContext(), false)
|
||||
lastDisabledPlaybackControlsColor = MaterialValueHelper.getPrimaryDisabledTextColor(requireContext(), false)
|
||||
}
|
||||
|
||||
updateRepeatState();
|
||||
updateShuffleState();
|
||||
|
|
|
@ -11,7 +11,6 @@ import androidx.appcompat.widget.Toolbar
|
|||
import code.name.monkey.appthemehelper.ThemeStore
|
||||
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.appthemehelper.util.ToolbarContentTintHelper
|
||||
import code.name.monkey.retromusic.R
|
||||
import code.name.monkey.retromusic.fragments.MiniPlayerFragment
|
||||
|
@ -23,6 +22,7 @@ import code.name.monkey.retromusic.helper.PlayPauseButtonOnClickHandler
|
|||
import code.name.monkey.retromusic.model.Song
|
||||
import code.name.monkey.retromusic.util.MusicUtil
|
||||
import code.name.monkey.retromusic.util.PreferenceUtil
|
||||
import code.name.monkey.retromusic.util.ViewUtil
|
||||
import kotlinx.android.synthetic.main.fragment_tiny_player.*
|
||||
|
||||
class TinyPlayerFragment : AbsPlayerFragment(), MusicProgressViewUpdateHelper.Callback {
|
||||
|
@ -59,28 +59,46 @@ class TinyPlayerFragment : AbsPlayerFragment(), MusicProgressViewUpdateHelper.Ca
|
|||
}
|
||||
|
||||
override fun toolbarIconColor(): Int {
|
||||
return ThemeStore.textColorSecondary(requireContext())
|
||||
return textColorPrimary
|
||||
}
|
||||
|
||||
private var lastColor: Int = 0
|
||||
override val paletteColor: Int
|
||||
get() = lastColor
|
||||
|
||||
private var textColorPrimary = 0
|
||||
private var textColorPrimaryDisabled = 0
|
||||
|
||||
override fun onColorChanged(color: Int) {
|
||||
|
||||
val lastColor = if (PreferenceUtil.getInstance().adaptiveColor) {
|
||||
val colorFinal = if (PreferenceUtil.getInstance().adaptiveColor) {
|
||||
color
|
||||
} else {
|
||||
ThemeStore.accentColor(requireContext())
|
||||
}
|
||||
|
||||
if (ColorUtil.isColorLight(color)) {
|
||||
textColorPrimary = MaterialValueHelper.getSecondaryTextColor(requireContext(), true)
|
||||
textColorPrimaryDisabled = MaterialValueHelper.getSecondaryTextColor(requireContext(), true)
|
||||
} else {
|
||||
textColorPrimary = MaterialValueHelper.getPrimaryTextColor(requireContext(), false)
|
||||
textColorPrimaryDisabled = MaterialValueHelper.getSecondaryTextColor(requireContext(), false)
|
||||
}
|
||||
|
||||
this.lastColor = colorFinal
|
||||
|
||||
callbacks?.onPaletteColorChanged()
|
||||
|
||||
tinyPlaybackControlsFragment.setDark(lastColor)
|
||||
tinyPlaybackControlsFragment.setDark(colorFinal)
|
||||
|
||||
TintHelper.setTintAuto(progressBar, lastColor, false)
|
||||
ViewUtil.setProgressDrawable(progressBar, colorFinal)
|
||||
|
||||
val iconColor = ThemeStore.textColorSecondary(requireContext())
|
||||
ToolbarContentTintHelper.colorizeToolbar(playerToolbar, iconColor, requireActivity())
|
||||
songTitle.setTextColor(textColorPrimary)
|
||||
songText.setTextColor(textColorPrimaryDisabled)
|
||||
|
||||
playerSongTotalTime.setTextColor(textColorPrimary)
|
||||
|
||||
ToolbarContentTintHelper.colorizeToolbar(playerToolbar, textColorPrimary, requireActivity())
|
||||
}
|
||||
|
||||
override fun onFavoriteToggled() {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue