Adding copy right signature

This commit is contained in:
h4h13 2019-08-05 23:14:05 +05:30
parent 147b8b5292
commit 8efadd9a79
23 changed files with 245 additions and 120 deletions

View file

@ -30,7 +30,9 @@ class PlayingQueueActivity : AbsMusicServiceActivity() {
private val upNextAndQueueTime: String
get() = resources.getString(R.string.up_next) + "" + MusicUtil.getReadableDurationString(MusicPlayerRemote.getQueueDurationMillis(MusicPlayerRemote.position))
override fun onCreate(savedInstanceState: Bundle?) {
override fun onCreate(
savedInstanceState: Bundle?
) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_playing_queue)

View file

@ -260,6 +260,8 @@ abstract class AbsSlidingMusicPanelActivity : AbsMusicServiceActivity(), Sliding
super.setTaskDescriptionColor(paletteColor)
val isColorLight = ColorUtil.isColorLight(paletteColor)
if (PreferenceUtil.getInstance().adaptiveColor &&
(currentNowPlayingScreen == NORMAL || currentNowPlayingScreen == FLAT)) {
super.setLightNavigationBar(true)
@ -269,7 +271,7 @@ abstract class AbsSlidingMusicPanelActivity : AbsMusicServiceActivity(), Sliding
currentNowPlayingScreen == BLUR || currentNowPlayingScreen == BLUR_CARD) {
super.setLightStatusbar(false)
super.setLightNavigationBar(true)
} else if (currentNowPlayingScreen == COLOR) {
} else if (currentNowPlayingScreen == COLOR || currentNowPlayingScreen == TINY) {
super.setNavigationbarColor(paletteColor)
super.setLightNavigationBar(isColorLight)
super.setLightStatusbar(isColorLight)
@ -310,7 +312,7 @@ abstract class AbsSlidingMusicPanelActivity : AbsMusicServiceActivity(), Sliding
}
fun updateTabs() {
private fun updateTabs() {
bottomNavigationView.menu.clear()
val currentTabs = PreferenceUtil.getInstance().libraryCategoryInfos
for (tab in currentTabs) {

View file

@ -77,11 +77,7 @@ abstract class AbsThemeActivity : ATHActivity(), Runnable {
}
fun setDrawUnderStatusBar() {
if (VersionUtils.hasLollipop()) {
RetroUtil.setAllowDrawUnderStatusBar(window)
} else if (VersionUtils.hasKitKat()) {
RetroUtil.setStatusBarTranslucent(window)
}
RetroUtil.setAllowDrawUnderStatusBar(window)
}
fun setDrawUnderNavigationBar() {
@ -95,19 +91,17 @@ abstract class AbsThemeActivity : ATHActivity(), Runnable {
* @param color the new statusbar color (will be shifted down on Lollipop and above)
*/
fun setStatusbarColor(color: Int) {
if (VersionUtils.hasKitKat()) {
val statusBar = window.decorView.rootView.findViewById<View>(R.id.status_bar)
if (statusBar != null) {
when {
VersionUtils.hasMarshmallow() -> window.statusBarColor = color
VersionUtils.hasLollipop() -> statusBar.setBackgroundColor(ColorUtil.darkenColor(color))
else -> statusBar.setBackgroundColor(color)
}
} else {
when {
VersionUtils.hasMarshmallow() -> window.statusBarColor = color
else -> window.statusBarColor = ColorUtil.darkenColor(color)
}
val statusBar = window.decorView.rootView.findViewById<View>(R.id.status_bar)
if (statusBar != null) {
when {
VersionUtils.hasMarshmallow() -> window.statusBarColor = color
VersionUtils.hasLollipop() -> statusBar.setBackgroundColor(ColorUtil.darkenColor(color))
else -> statusBar.setBackgroundColor(color)
}
} else {
when {
VersionUtils.hasMarshmallow() -> window.statusBarColor = color
else -> window.statusBarColor = ColorUtil.darkenColor(color)
}
}
setLightStatusbarAuto(color)

View file

@ -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 {

View file

@ -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))

View file

@ -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) {

View file

@ -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();

View file

@ -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() {

View file

@ -60,12 +60,14 @@ object ViewUtil {
val ld = progressSlider.progressDrawable as LayerDrawable
val clipDrawableProgress = ld.findDrawableByLayerId(android.R.id.progress)
clipDrawableProgress.setColorFilter(newColor, PorterDuff.Mode.SRC_IN)
val progress = ld.findDrawableByLayerId(android.R.id.progress)
progress.setColorFilter(newColor, PorterDuff.Mode.SRC_IN)
val clipDrawableBackground = ld.findDrawableByLayerId(android.R.id.background)
clipDrawableBackground.setColorFilter(MaterialValueHelper.getPrimaryDisabledTextColor(progressSlider.context, ColorUtil.isColorLight(ThemeStore.primaryColor(progressSlider.context))), PorterDuff.Mode.SRC_IN)
val background = ld.findDrawableByLayerId(android.R.id.background)
background.setColorFilter(MaterialValueHelper.getPrimaryDisabledTextColor(progressSlider.context, ColorUtil.isColorLight(ThemeStore.primaryColor(progressSlider.context))), PorterDuff.Mode.SRC_IN)
val secondaryProgress = ld.findDrawableByLayerId(android.R.id.secondaryProgress)
secondaryProgress.setColorFilter(ColorUtil.withAlpha(newColor, 0.65f), PorterDuff.Mode.SRC_IN)
}
private fun createColorAnimator(target: Any, propertyName: String, @ColorInt startColor: Int, @ColorInt endColor: Int): Animator {