Added retro icon, fix color, drive mode

This commit is contained in:
h4h13 2020-02-04 13:39:10 +05:30
parent 03fa8399dd
commit 5754141b0e
25 changed files with 615 additions and 54 deletions

View file

@ -120,6 +120,7 @@
<activity android:name=".activities.WhatsNewActivity" />
<activity android:name=".activities.bugreport.BugReportActivity" />
<activity android:name=".activities.ShareInstagramStory" />
<activity android:name=".activities.DriveModeActivity" />
<activity
android:name=".activities.SearchActivity"
android:windowSoftInputMode="stateVisible" />

View file

@ -0,0 +1,240 @@
/*
* 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.
*/
package code.name.monkey.retromusic.activities
import android.animation.ObjectAnimator
import android.graphics.Color
import android.graphics.PorterDuff
import android.os.Bundle
import android.view.animation.LinearInterpolator
import android.widget.SeekBar
import code.name.monkey.appthemehelper.ThemeStore
import code.name.monkey.retromusic.R
import code.name.monkey.retromusic.activities.base.AbsMusicServiceActivity
import code.name.monkey.retromusic.fragments.base.AbsPlayerControlsFragment
import code.name.monkey.retromusic.glide.BlurTransformation
import code.name.monkey.retromusic.glide.RetroMusicColoredTarget
import code.name.monkey.retromusic.glide.SongGlideRequest
import code.name.monkey.retromusic.helper.MusicPlayerRemote
import code.name.monkey.retromusic.helper.MusicProgressViewUpdateHelper
import code.name.monkey.retromusic.helper.MusicProgressViewUpdateHelper.Callback
import code.name.monkey.retromusic.helper.PlayPauseButtonOnClickHandler
import code.name.monkey.retromusic.misc.SimpleOnSeekbarChangeListener
import code.name.monkey.retromusic.service.MusicService
import code.name.monkey.retromusic.util.MusicUtil
import com.bumptech.glide.Glide
import kotlinx.android.synthetic.main.activity_drive_mode.close
import kotlinx.android.synthetic.main.activity_drive_mode.image
import kotlinx.android.synthetic.main.activity_drive_mode.nextButton
import kotlinx.android.synthetic.main.activity_drive_mode.playPauseButton
import kotlinx.android.synthetic.main.activity_drive_mode.previousButton
import kotlinx.android.synthetic.main.activity_drive_mode.progressSlider
import kotlinx.android.synthetic.main.activity_drive_mode.repeatButton
import kotlinx.android.synthetic.main.activity_drive_mode.shuffleButton
import kotlinx.android.synthetic.main.activity_drive_mode.songCurrentProgress
import kotlinx.android.synthetic.main.activity_drive_mode.songFavourite
import kotlinx.android.synthetic.main.activity_drive_mode.songText
import kotlinx.android.synthetic.main.activity_drive_mode.songTitle
import kotlinx.android.synthetic.main.activity_drive_mode.songTotalTime
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.launch
import kotlinx.coroutines.withContext
/**
* Created by hemanths on 2020-02-02.
*/
class DriveModeActivity : AbsMusicServiceActivity(), Callback {
private var lastPlaybackControlsColor: Int = Color.GRAY
private var lastDisabledPlaybackControlsColor: Int = Color.GRAY
private lateinit var progressViewUpdateHelper: MusicProgressViewUpdateHelper
override fun onCreate(savedInstanceState: Bundle?) {
setDrawUnderStatusBar()
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_drive_mode)
setUpMusicControllers()
progressViewUpdateHelper = MusicProgressViewUpdateHelper(this)
lastPlaybackControlsColor = ThemeStore.accentColor(this)
close.setOnClickListener {
onBackPressed()
}
}
private fun setUpMusicControllers() {
setUpPlayPauseFab()
setUpPrevNext()
setUpRepeatButton()
setUpShuffleButton()
setUpProgressSlider()
setupFavouriteToggle()
}
private fun setupFavouriteToggle() {
songFavourite.setOnClickListener {
MusicUtil.toggleFavorite(
this@DriveModeActivity,
MusicPlayerRemote.currentSong
)
}
}
private fun toggleFavourite() {
CoroutineScope(Dispatchers.IO).launch {
val isFavourite = MusicUtil.isFavorite(this@DriveModeActivity, MusicPlayerRemote.currentSong)
withContext(Dispatchers.Main) {
songFavourite.setImageResource(if (isFavourite) R.drawable.ic_favorite_white_24dp else R.drawable.ic_favorite_border_white_24dp)
}
}
}
private fun setUpProgressSlider() {
progressSlider.setOnSeekBarChangeListener(object : SimpleOnSeekbarChangeListener() {
override fun onProgressChanged(seekBar: SeekBar, progress: Int, fromUser: Boolean) {
if (fromUser) {
MusicPlayerRemote.seekTo(progress)
onUpdateProgressViews(
MusicPlayerRemote.songProgressMillis,
MusicPlayerRemote.songDurationMillis
)
}
}
})
}
override fun onPause() {
super.onPause()
progressViewUpdateHelper.stop()
}
override fun onResume() {
super.onResume()
progressViewUpdateHelper.start()
}
private fun setUpPrevNext() {
nextButton.setOnClickListener { MusicPlayerRemote.playNextSong() }
previousButton.setOnClickListener { MusicPlayerRemote.back() }
}
private fun setUpShuffleButton() {
shuffleButton.setOnClickListener { MusicPlayerRemote.toggleShuffleMode() }
}
private fun setUpRepeatButton() {
repeatButton.setOnClickListener { MusicPlayerRemote.cycleRepeatMode() }
}
private fun setUpPlayPauseFab() {
playPauseButton.setOnClickListener(PlayPauseButtonOnClickHandler())
}
override fun onRepeatModeChanged() {
super.onRepeatModeChanged()
updateRepeatState()
}
override fun onShuffleModeChanged() {
super.onShuffleModeChanged()
updateShuffleState()
}
override fun onPlayStateChanged() {
super.onPlayStateChanged()
updatePlayPauseDrawableState()
}
override fun onServiceConnected() {
super.onServiceConnected()
updatePlayPauseDrawableState()
updateSong()
updateRepeatState()
updateShuffleState()
toggleFavourite()
}
private fun updatePlayPauseDrawableState() {
if (MusicPlayerRemote.isPlaying) {
playPauseButton.setImageResource(R.drawable.ic_pause_white_24dp)
} else {
playPauseButton.setImageResource(R.drawable.ic_play_arrow_white_24dp)
}
}
fun updateShuffleState() {
when (MusicPlayerRemote.shuffleMode) {
MusicService.SHUFFLE_MODE_SHUFFLE -> shuffleButton.setColorFilter(
lastPlaybackControlsColor,
PorterDuff.Mode.SRC_IN
)
else -> shuffleButton.setColorFilter(lastDisabledPlaybackControlsColor, PorterDuff.Mode.SRC_IN)
}
}
private fun updateRepeatState() {
when (MusicPlayerRemote.repeatMode) {
MusicService.REPEAT_MODE_NONE -> {
repeatButton.setImageResource(R.drawable.ic_repeat_white_24dp)
repeatButton.setColorFilter(lastDisabledPlaybackControlsColor, PorterDuff.Mode.SRC_IN)
}
MusicService.REPEAT_MODE_ALL -> {
repeatButton.setImageResource(R.drawable.ic_repeat_white_24dp)
repeatButton.setColorFilter(lastPlaybackControlsColor, PorterDuff.Mode.SRC_IN)
}
MusicService.REPEAT_MODE_THIS -> {
repeatButton.setImageResource(R.drawable.ic_repeat_one_white_24dp)
repeatButton.setColorFilter(lastPlaybackControlsColor, PorterDuff.Mode.SRC_IN)
}
}
}
override fun onPlayingMetaChanged() {
super.onPlayingMetaChanged()
updateSong()
toggleFavourite()
}
private fun updateSong() {
val song = MusicPlayerRemote.currentSong
songTitle.text = song.title
songText.text = song.artistName
SongGlideRequest.Builder.from(Glide.with(this), song)
.checkIgnoreMediaStore(this)
.generatePalette(this)
.build()
.transform(BlurTransformation.Builder(this).build())
.into(object : RetroMusicColoredTarget(image) {
override fun onColorReady(color: Int) {
}
})
}
override fun onUpdateProgressViews(progress: Int, total: Int) {
progressSlider.max = total
val animator = ObjectAnimator.ofInt(progressSlider, "progress", progress)
animator.duration = AbsPlayerControlsFragment.SLIDER_ANIMATION_TIME
animator.interpolator = LinearInterpolator()
animator.start()
songTotalTime.text = MusicUtil.getReadableDurationString(total.toLong())
songCurrentProgress.text = MusicUtil.getReadableDurationString(progress.toLong())
}
}

View file

@ -21,7 +21,6 @@ import code.name.monkey.retromusic.mvp.presenter.GenreDetailsPresenter
import code.name.monkey.retromusic.mvp.presenter.GenreDetailsView
import code.name.monkey.retromusic.util.DensityUtil
import code.name.monkey.retromusic.util.RetroColorUtil
import code.name.monkey.retromusic.util.ViewUtil
import com.afollestad.materialcab.MaterialCab
import kotlinx.android.synthetic.main.activity_playlist_detail.empty
import kotlinx.android.synthetic.main.activity_playlist_detail.emptyEmoji
@ -115,7 +114,7 @@ class GenreDetailsActivity : AbsSlidingMusicPanelActivity(), CabHolder, GenreDet
}
private fun setupRecyclerView() {
ViewUtil.setUpFastScrollRecyclerViewColor(this, recyclerView)
//ViewUtil.setUpFastScrollRecyclerViewColor(this, recyclerView)
songAdapter = ShuffleButtonSongAdapter(this, ArrayList(), R.layout.item_list, this)
recyclerView.apply {
itemAnimator = DefaultItemAnimator()

View file

@ -14,7 +14,6 @@ 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 code.name.monkey.retromusic.util.ViewUtil
import com.h6ah4i.android.widget.advrecyclerview.animator.DraggableItemAnimator
import com.h6ah4i.android.widget.advrecyclerview.draggable.RecyclerViewDragDropManager
import com.h6ah4i.android.widget.advrecyclerview.swipeable.RecyclerViewSwipeManager
@ -107,7 +106,7 @@ open class PlayingQueueActivity : AbsMusicServiceActivity() {
}
}
})
ViewUtil.setUpFastScrollRecyclerViewColor(this, recyclerView)
//ViewUtil.setUpFastScrollRecyclerViewColor(this, recyclerView)
}
private fun checkForPadding() {

View file

@ -24,7 +24,6 @@ import code.name.monkey.retromusic.mvp.presenter.PlaylistSongsView
import code.name.monkey.retromusic.util.DensityUtil
import code.name.monkey.retromusic.util.PlaylistsUtil
import code.name.monkey.retromusic.util.RetroColorUtil
import code.name.monkey.retromusic.util.ViewUtil
import com.afollestad.materialcab.MaterialCab
import com.h6ah4i.android.widget.advrecyclerview.animator.RefactoredDefaultItemAnimator
import com.h6ah4i.android.widget.advrecyclerview.draggable.RecyclerViewDragDropManager
@ -114,8 +113,6 @@ class PlaylistDetailActivity : AbsSlidingMusicPanelActivity(), CabHolder, Playli
checkIsEmpty()
}
})
ViewUtil.setUpFastScrollRecyclerViewColor(this, recyclerView)
}
override fun onResume() {

View file

@ -107,9 +107,9 @@ class ShareInstagramStory : AbsBaseActivity() {
}
private fun setColors(colorLight: Boolean, color: Int) {
setLightStatusbar(ColorUtil.isColorLight(color))
setLightStatusbar(colorLight)
toolbar.setTitleTextColor(MaterialValueHelper.getPrimaryTextColor(this@ShareInstagramStory, colorLight))
toolbar.navigationIcon?.setTintList(ColorStateList.valueOf(Color.WHITE))
toolbar.navigationIcon?.setTintList(ColorStateList.valueOf(MaterialValueHelper.getPrimaryTextColor(this@ShareInstagramStory, colorLight)))
mainContent.background =
GradientDrawable(GradientDrawable.Orientation.TOP_BOTTOM, intArrayOf(color, Color.BLACK))
}

View file

@ -22,6 +22,7 @@ import com.h6ah4i.android.widget.advrecyclerview.swipeable.action.SwipeResultAct
import com.h6ah4i.android.widget.advrecyclerview.swipeable.action.SwipeResultActionDefault
import com.h6ah4i.android.widget.advrecyclerview.swipeable.action.SwipeResultActionRemoveItem
import com.h6ah4i.android.widget.advrecyclerview.swipeable.annotation.SwipeableItemResults
import me.zhanghai.android.fastscroll.PopupTextProvider
import java.util.ArrayList
class PlayingQueueAdapter(
@ -31,7 +32,8 @@ class PlayingQueueAdapter(
itemLayoutRes: Int
) : SongAdapter(
activity, dataSet, itemLayoutRes, null
), DraggableItemAdapter<PlayingQueueAdapter.ViewHolder>, SwipeableItemAdapter<PlayingQueueAdapter.ViewHolder> {
), DraggableItemAdapter<PlayingQueueAdapter.ViewHolder>, SwipeableItemAdapter<PlayingQueueAdapter.ViewHolder>,
PopupTextProvider {
private var color = -1
private var songToRemove: Song? = null
@ -100,6 +102,10 @@ class PlayingQueueAdapter(
holder.menu?.alpha = alpha
}
override fun getPopupText(position: Int): String {
return MusicUtil.getSectionName(dataSet[position].title)
}
override fun onCheckCanStartDrag(holder: ViewHolder, position: Int, x: Int, y: Int): Boolean {
return ViewUtil.hitTest(holder.imageText!!, x, y) || ViewUtil.hitTest(holder.dragView!!, x, y)
}

View file

@ -144,7 +144,7 @@ open class SongAdapter(
return ""
}
}
println("File name -> $sectionName")
return MusicUtil.getSectionName(sectionName)
}

View file

@ -38,6 +38,7 @@ class OptionsSheetDialogFragment : DialogFragment(), View.OnClickListener {
R.id.actionFolders -> mainActivity.setMusicChooser(MainActivity.FOLDER)
R.id.actionLibrary -> mainActivity.setMusicChooser(MainActivity.LIBRARY)
R.id.actionSettings -> NavigationUtil.goToSettings(mainActivity)
R.id.actionDriveMode -> NavigationUtil.gotoDriveMode(mainActivity)
R.id.actionRate -> NavigationUtil.goToPlayStore(mainActivity)
}
materialDialog.dismiss()
@ -47,6 +48,7 @@ class OptionsSheetDialogFragment : DialogFragment(), View.OnClickListener {
private lateinit var actionLibrary: OptionMenuItemView
private lateinit var actionFolders: OptionMenuItemView
private lateinit var actionRate: OptionMenuItemView
private lateinit var actionDriveMode: OptionMenuItemView
private lateinit var materialDialog: MaterialDialog
override fun onCreateDialog(savedInstanceState: Bundle?): Dialog {
@ -56,6 +58,7 @@ class OptionsSheetDialogFragment : DialogFragment(), View.OnClickListener {
actionRate = layout.findViewById(R.id.actionRate)
actionLibrary = layout.findViewById(R.id.actionLibrary)
actionFolders = layout.findViewById(R.id.actionFolders)
actionDriveMode = layout.findViewById(R.id.actionDriveMode)
when (arguments?.getInt(WHICH_ONE)) {
@ -67,7 +70,7 @@ class OptionsSheetDialogFragment : DialogFragment(), View.OnClickListener {
actionRate.setOnClickListener(this)
actionLibrary.setOnClickListener(this)
actionFolders.setOnClickListener(this)
actionDriveMode.setOnClickListener(this)
materialDialog = MaterialDialog(requireActivity(), BottomSheet(LayoutMode.WRAP_CONTENT))
.show {

View file

@ -32,8 +32,8 @@ abstract class AbsLibraryPagerRecyclerViewCustomGridSizeFragment<A : RecyclerVie
protected abstract fun setLayoutRes(layoutRes: Int)
fun setAndSaveLayoutRes(layoutRes: Int) {
saveLayoutRes(layoutRes)
setLayoutRes(layoutRes)
saveLayoutRes(layoutRes)
}
private val maxGridSizeForList: Int

View file

@ -84,7 +84,7 @@ open class AlbumsFragment : AbsLibraryPagerRecyclerViewCustomGridSizeFragment<Al
}
override fun loadGridSize(): Int {
return PreferenceUtil.getInstance(requireContext()).getAlbumGridSize(activity!!)
return PreferenceUtil.getInstance(requireContext()).getAlbumGridSize(requireContext())
}
override fun saveGridSize(gridColumns: Int) {
@ -92,7 +92,7 @@ open class AlbumsFragment : AbsLibraryPagerRecyclerViewCustomGridSizeFragment<Al
}
override fun loadGridSizeLand(): Int {
return PreferenceUtil.getInstance(requireContext()).getAlbumGridSizeLand(activity!!)
return PreferenceUtil.getInstance(requireContext()).getAlbumGridSizeLand(requireContext())
}
override fun saveGridSizeLand(gridColumns: Int) {

View file

@ -3,6 +3,7 @@ package code.name.monkey.retromusic.fragments.mainactivity;
import android.app.Activity;
import android.app.ActivityOptions;
import android.content.res.ColorStateList;
import android.graphics.Color;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.Menu;
@ -132,14 +133,16 @@ public class LibraryFragment extends AbsMainActivityFragment implements CabHolde
setUpSortOrderMenu(fragment, menu.findItem(R.id.action_sort_order).getSubMenu());
} else if (currentFragment instanceof GenresFragment) {
} else if (currentFragment instanceof GenresFragment || currentFragment instanceof PlayingQueueFragment) {
menu.removeItem(R.id.action_new_playlist);
menu.removeItem(R.id.action_layout_type);
menu.removeItem(R.id.action_grid_size);
menu.removeItem(R.id.action_sort_order);
} else {
menu.add(0, R.id.action_new_playlist, 0, R.string.new_playlist_title)
.setIcon(R.drawable.ic_playlist_add_white_24dp).setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM);
menu.removeItem(R.id.action_grid_size);
menu.removeItem(R.id.action_layout_type);
}
ToolbarContentTintHelper.handleOnCreateOptionsMenu(requireActivity(), toolbar, menu,
ATHToolbarActivity.getToolbarBackgroundColor(toolbar));
@ -507,7 +510,8 @@ public class LibraryFragment extends AbsMainActivityFragment implements CabHolde
}
private void setupToolbar() {
toolbar.setBackgroundTintList(
toolbar.setBackgroundColor(Color.TRANSPARENT);
toolbarContainer.setCardBackgroundColor(
ColorStateList.valueOf(ATHUtil.INSTANCE.resolveColor(requireContext(), R.attr.colorSurface)));
toolbar.setNavigationIcon(R.drawable.ic_menu_white_24dp);
toolbar.setOnClickListener(v -> {

View file

@ -22,7 +22,6 @@ import code.name.monkey.retromusic.R
import code.name.monkey.retromusic.adapter.song.PlayingQueueAdapter
import code.name.monkey.retromusic.fragments.base.AbsLibraryPagerRecyclerViewFragment
import code.name.monkey.retromusic.helper.MusicPlayerRemote
import code.name.monkey.retromusic.util.ViewUtil
import com.h6ah4i.android.widget.advrecyclerview.animator.DraggableItemAnimator
import com.h6ah4i.android.widget.advrecyclerview.draggable.RecyclerViewDragDropManager
import com.h6ah4i.android.widget.advrecyclerview.swipeable.RecyclerViewSwipeManager
@ -62,7 +61,6 @@ class PlayingQueueFragment : AbsLibraryPagerRecyclerViewFragment<PlayingQueueAda
recyclerViewSwipeManager?.attachRecyclerView(recyclerView)
layoutManager?.scrollToPositionWithOffset(MusicPlayerRemote.position + 1, 0)
ViewUtil.setUpFastScrollRecyclerViewColor(requireContext(), recyclerView)
}
override fun createLayoutManager(): LinearLayoutManager {

View file

@ -39,8 +39,16 @@ import code.name.monkey.retromusic.service.MusicService
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_lock_screen_playback_controls.*
import kotlinx.android.synthetic.main.fragment_lock_screen_playback_controls.nextButton
import kotlinx.android.synthetic.main.fragment_lock_screen_playback_controls.playPauseButton
import kotlinx.android.synthetic.main.fragment_lock_screen_playback_controls.previousButton
import kotlinx.android.synthetic.main.fragment_lock_screen_playback_controls.progressSlider
import kotlinx.android.synthetic.main.fragment_lock_screen_playback_controls.repeatButton
import kotlinx.android.synthetic.main.fragment_lock_screen_playback_controls.shuffleButton
import kotlinx.android.synthetic.main.fragment_lock_screen_playback_controls.songCurrentProgress
import kotlinx.android.synthetic.main.fragment_lock_screen_playback_controls.songTotalTime
import kotlinx.android.synthetic.main.fragment_lock_screen_playback_controls.text
import kotlinx.android.synthetic.main.fragment_lock_screen_playback_controls.title
/**
* @author Hemanth S (h4h13).
@ -56,8 +64,10 @@ class LockScreenPlayerControlsFragment : AbsPlayerControlsFragment() {
progressViewUpdateHelper = MusicProgressViewUpdateHelper(this)
}
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?,
savedInstanceState: Bundle?): View? {
override fun onCreateView(
inflater: LayoutInflater, container: ViewGroup?,
savedInstanceState: Bundle?
): View? {
return inflater.inflate(R.layout.fragment_lock_screen_playback_controls, container, false)
}
@ -72,7 +82,6 @@ class LockScreenPlayerControlsFragment : AbsPlayerControlsFragment() {
val song = MusicPlayerRemote.currentSong
title.text = song.title
text.text = String.format("%s - %s", song.artistName, song.albumName)
}
override fun onResume() {
@ -114,10 +123,12 @@ class LockScreenPlayerControlsFragment : AbsPlayerControlsFragment() {
val colorBg = ATHUtil.resolveColor(requireContext(), android.R.attr.colorBackground)
if (ColorUtil.isColorLight(colorBg)) {
lastPlaybackControlsColor = MaterialValueHelper.getSecondaryTextColor(requireContext(), true)
lastDisabledPlaybackControlsColor = MaterialValueHelper.getSecondaryDisabledTextColor(requireContext(), true)
lastDisabledPlaybackControlsColor =
MaterialValueHelper.getSecondaryDisabledTextColor(requireContext(), true)
} else {
lastPlaybackControlsColor = MaterialValueHelper.getPrimaryTextColor(requireContext(), false)
lastDisabledPlaybackControlsColor = MaterialValueHelper.getPrimaryDisabledTextColor(requireContext(), false)
lastDisabledPlaybackControlsColor =
MaterialValueHelper.getPrimaryDisabledTextColor(requireContext(), false)
}
val colorFinal = if (PreferenceUtil.getInstance(requireContext()).adaptiveColor) {
@ -134,7 +145,11 @@ class LockScreenPlayerControlsFragment : AbsPlayerControlsFragment() {
val isDark = ColorUtil.isColorLight(colorFinal)
text.setTextColor(colorFinal)
TintHelper.setTintAuto(playPauseButton, MaterialValueHelper.getPrimaryTextColor(requireContext(), isDark), false)
TintHelper.setTintAuto(
playPauseButton,
MaterialValueHelper.getPrimaryTextColor(requireContext(), isDark),
false
)
TintHelper.setTintAuto(playPauseButton, colorFinal, true)
}
@ -150,7 +165,6 @@ class LockScreenPlayerControlsFragment : AbsPlayerControlsFragment() {
}
}
private fun setUpMusicControllers() {
setUpPlayPauseFab()
setUpPrevNext()
@ -176,7 +190,10 @@ class LockScreenPlayerControlsFragment : AbsPlayerControlsFragment() {
override fun updateShuffleState() {
when (MusicPlayerRemote.shuffleMode) {
MusicService.SHUFFLE_MODE_SHUFFLE -> shuffleButton.setColorFilter(lastPlaybackControlsColor, PorterDuff.Mode.SRC_IN)
MusicService.SHUFFLE_MODE_SHUFFLE -> shuffleButton.setColorFilter(
lastPlaybackControlsColor,
PorterDuff.Mode.SRC_IN
)
else -> shuffleButton.setColorFilter(lastDisabledPlaybackControlsColor, PorterDuff.Mode.SRC_IN)
}
}
@ -204,11 +221,11 @@ class LockScreenPlayerControlsFragment : AbsPlayerControlsFragment() {
public override fun show() {
playPauseButton!!.animate()
.scaleX(1f)
.scaleY(1f)
.rotation(360f)
.setInterpolator(DecelerateInterpolator())
.start()
.scaleX(1f)
.scaleY(1f)
.rotation(360f)
.setInterpolator(DecelerateInterpolator())
.start()
}
public override fun hide() {
@ -226,8 +243,10 @@ class LockScreenPlayerControlsFragment : AbsPlayerControlsFragment() {
override fun onProgressChanged(seekBar: SeekBar, progress: Int, fromUser: Boolean) {
if (fromUser) {
MusicPlayerRemote.seekTo(progress)
onUpdateProgressViews(MusicPlayerRemote.songProgressMillis,
MusicPlayerRemote.songDurationMillis)
onUpdateProgressViews(
MusicPlayerRemote.songProgressMillis,
MusicPlayerRemote.songDurationMillis
)
}
}
})

View file

@ -30,6 +30,7 @@ import code.name.monkey.retromusic.R;
import code.name.monkey.retromusic.activities.AboutActivity;
import code.name.monkey.retromusic.activities.AlbumDetailsActivity;
import code.name.monkey.retromusic.activities.ArtistDetailActivity;
import code.name.monkey.retromusic.activities.DriveModeActivity;
import code.name.monkey.retromusic.activities.GenreDetailsActivity;
import code.name.monkey.retromusic.activities.LicenseActivity;
import code.name.monkey.retromusic.activities.LyricsActivity;
@ -148,6 +149,10 @@ public class NavigationUtil {
activityOptions.toBundle());
}
public static void gotoDriveMode(@NotNull final Activity activity) {
ActivityCompat.startActivity(activity, new Intent(activity, DriveModeActivity.class), null);
}
public static void gotoWhatNews(@NonNull Activity activity) {
ActivityCompat.startActivity(activity, new Intent(activity, WhatsNewActivity.class), null);
}

View file

@ -18,7 +18,7 @@
<item android:id="@android:id/background">
<shape>
<corners android:radius="8dip" />
<solid android:color="?colorButtonNormal" />
<solid android:color="?android:attr/colorControlHighlight" />
</shape>
</item>
@ -26,7 +26,7 @@
<clip>
<shape>
<corners android:radius="8dip" />
<solid android:color="?colorButtonNormal" />
<solid android:color="?attr/colorControlNormal" />
</shape>
</clip>
</item>

View file

@ -0,0 +1,19 @@
<!--
~ 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.
-->
<vector android:height="24dp" android:tint="#FFFFFF"
android:viewportHeight="24.0" android:viewportWidth="24.0"
android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="#FF000000" android:pathData="M18.92,5.01C18.72,4.42 18.16,4 17.5,4h-11c-0.66,0 -1.21,0.42 -1.42,1.01L3,11v8c0,0.55 0.45,1 1,1h1c0.55,0 1,-0.45 1,-1v-1h12v1c0,0.55 0.45,1 1,1h1c0.55,0 1,-0.45 1,-1v-8l-2.08,-5.99zM6.5,15c-0.83,0 -1.5,-0.67 -1.5,-1.5S5.67,12 6.5,12s1.5,0.67 1.5,1.5S7.33,15 6.5,15zM17.5,15c-0.83,0 -1.5,-0.67 -1.5,-1.5s0.67,-1.5 1.5,-1.5 1.5,0.67 1.5,1.5 -0.67,1.5 -1.5,1.5zM5,10l1.5,-4.5h11L19,10L5,10z"/>
</vector>

View file

@ -0,0 +1,22 @@
<?xml version="1.0" encoding="utf-8"?><!--
~ 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.
-->
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<gradient
android:angle="270"
android:centerColor="@color/transparent"
android:endColor="@color/md_black_1000"
android:startColor="@color/md_black_1000" />
</shape>

View file

@ -0,0 +1,219 @@
<?xml version="1.0" encoding="utf-8"?><!--
~ 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.
-->
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<code.name.monkey.retromusic.views.StatusBarView
android:id="@+id/status_bar"
android:layout_width="match_parent"
android:layout_height="0dp"
android:background="?attr/colorSurface"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
tools:ignore="UnusedAttribute" />
<androidx.appcompat.widget.AppCompatImageView
android:id="@+id/image"
android:layout_width="0dp"
android:layout_height="0dp"
android:scaleType="centerCrop"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
tools:src="@tools:sample/avatars" />
<View
android:layout_width="0dp"
android:layout_height="0dp"
android:background="@drawable/shadow_up_down"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<androidx.appcompat.widget.AppCompatImageView
android:id="@+id/close"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="16dp"
android:background="@drawable/color_circle_gradient"
android:backgroundTint="@color/semi_transparent"
android:padding="8dp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/status_bar"
app:srcCompat="@drawable/ic_close_white_24dp" />
<androidx.appcompat.widget.AppCompatImageView
android:id="@+id/playPauseButton"
android:layout_width="112dp"
android:layout_height="112dp"
android:layout_marginBottom="32dp"
android:background="?roundSelector"
android:src="@drawable/ic_pause_white_24dp"
app:layout_constraintBottom_toTopOf="@+id/repeatButton"
app:layout_constraintEnd_toStartOf="@+id/nextButton"
app:layout_constraintHorizontal_bias="0.5"
app:layout_constraintStart_toEndOf="@+id/previousButton" />
<androidx.appcompat.widget.AppCompatImageView
android:id="@+id/nextButton"
android:layout_width="72dp"
android:layout_height="72dp"
android:background="?roundSelector"
app:layout_constraintBottom_toBottomOf="@+id/playPauseButton"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.5"
app:layout_constraintStart_toEndOf="@+id/playPauseButton"
app:layout_constraintTop_toTopOf="@+id/playPauseButton"
app:srcCompat="@drawable/ic_skip_next_white_24dp" />
<androidx.appcompat.widget.AppCompatImageView
android:id="@+id/previousButton"
android:layout_width="72dp"
android:layout_height="72dp"
android:background="?roundSelector"
app:layout_constraintBottom_toBottomOf="@+id/playPauseButton"
app:layout_constraintEnd_toStartOf="@+id/playPauseButton"
app:layout_constraintHorizontal_bias="0.5"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="@+id/playPauseButton"
app:srcCompat="@drawable/ic_skip_previous_white_24dp" />
<androidx.appcompat.widget.AppCompatImageView
android:id="@+id/repeatButton"
android:layout_width="72dp"
android:layout_height="72dp"
android:layout_marginBottom="32dp"
android:background="?roundSelector"
app:layout_constraintBottom_toBottomOf="@+id/image"
app:layout_constraintEnd_toStartOf="@+id/songFavourite"
app:layout_constraintHorizontal_bias="0.5"
app:layout_constraintStart_toStartOf="parent"
app:srcCompat="@drawable/ic_repeat_white_24dp" />
<androidx.appcompat.widget.AppCompatImageView
android:id="@+id/songFavourite"
android:layout_width="72dp"
android:layout_height="72dp"
android:background="?roundSelector"
app:layout_constraintBottom_toBottomOf="@+id/repeatButton"
app:layout_constraintEnd_toStartOf="@+id/shuffleButton"
app:layout_constraintHorizontal_bias="0.5"
app:layout_constraintStart_toEndOf="@+id/repeatButton"
app:layout_constraintTop_toTopOf="@+id/repeatButton"
app:srcCompat="@drawable/ic_favorite_border_white_24dp" />
<androidx.appcompat.widget.AppCompatImageView
android:id="@+id/shuffleButton"
android:layout_width="72dp"
android:layout_height="72dp"
android:background="?roundSelector"
app:layout_constraintBottom_toBottomOf="@+id/songFavourite"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.5"
app:layout_constraintStart_toEndOf="@+id/songFavourite"
app:layout_constraintTop_toTopOf="@+id/songFavourite"
app:srcCompat="@drawable/ic_shuffle_white_24dp" />
<LinearLayout
android:id="@+id/titleContainer"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
app:layout_constraintBottom_toTopOf="@id/playPauseButton"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/close">
<com.google.android.material.textview.MaterialTextView
android:id="@+id/songTitle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:maxLines="3"
android:textAppearance="@style/TextViewHeadline5"
android:textColor="@color/md_white_1000"
android:textStyle="bold"
tools:text="@tools:sample/lorem/random" />
<com.google.android.material.textview.MaterialTextView
android:id="@+id/songText"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:maxLines="3"
android:textAppearance="@style/TextViewHeadline6"
android:textColor="@color/md_grey_200"
tools:text="@tools:sample/lorem/random" />
</LinearLayout>
<com.google.android.material.textview.MaterialTextView
android:id="@+id/songCurrentProgress"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:gravity="center"
android:minWidth="40dp"
android:singleLine="true"
android:textColor="@color/md_white_1000"
android:textSize="12sp"
app:layout_constraintBottom_toBottomOf="@+id/progressSlider"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="@id/progressSlider"
tools:ignore="RtlHardcoded,RtlSymmetry"
tools:text="00:22" />
<androidx.appcompat.widget.AppCompatSeekBar
android:id="@+id/progressSlider"
style="@style/Widget.MaterialProgressBar.ProgressBar.Horizontal"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="8"
android:maxHeight="3dp"
android:progressDrawable="@drawable/color_progress_seek"
android:progressTint="@color/md_white_1000"
android:splitTrack="false"
android:thumb="@drawable/switch_thumb_material"
app:layout_constraintBottom_toTopOf="@id/playPauseButton"
app:layout_constraintEnd_toStartOf="@id/songTotalTime"
app:layout_constraintStart_toEndOf="@id/songCurrentProgress"
tools:ignore="RtlHardcoded,UnusedAttribute"
tools:progress="20" />
<com.google.android.material.textview.MaterialTextView
android:id="@+id/songTotalTime"
android:layout_width="40dp"
android:layout_height="wrap_content"
android:layout_marginEnd="16dp"
android:gravity="center"
android:minWidth="40dp"
android:singleLine="true"
android:textColor="@color/md_white_1000"
android:textSize="12sp"
app:layout_constraintBottom_toBottomOf="@+id/progressSlider"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="@id/progressSlider"
tools:ignore="RtlHardcoded,RtlSymmetry"
tools:text="00:22" />
</androidx.constraintlayout.widget.ConstraintLayout>

View file

@ -57,7 +57,7 @@
</com.google.android.material.appbar.AppBarLayout>
<com.simplecityapps.recyclerview_fastscroll.views.FastScrollRecyclerView
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recyclerView"
android:layout_width="match_parent"
android:layout_height="match_parent"

View file

@ -16,8 +16,8 @@
</FrameLayout>
<androidx.coordinatorlayout.widget.CoordinatorLayout
android:layout_width="match_parent"
android:id="@+id/container"
android:layout_width="match_parent"
android:layout_height="match_parent">
<com.google.android.material.appbar.AppBarLayout
@ -48,7 +48,7 @@
</FrameLayout>
</com.google.android.material.appbar.AppBarLayout>
<com.simplecityapps.recyclerview_fastscroll.views.FastScrollRecyclerView
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recyclerView"
android:layout_width="match_parent"
android:layout_height="wrap_content"

View file

@ -37,15 +37,35 @@
android:layout_width="match_parent"
android:layout_height="match_parent">
<androidx.appcompat.widget.AppCompatImageView
android:id="@+id/appIcon"
android:layout_width="16dp"
android:layout_height="16dp"
app:layout_constraintStart_toStartOf="@+id/imageContainerCard"
app:layout_constraintTop_toTopOf="parent"
app:srcCompat="@mipmap/ic_launcher_round" />
<com.google.android.material.textview.MaterialTextView
android:id="@+id/appName"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:text="@string/app_name"
android:textColor="@color/md_white_1000"
app:layout_constraintBottom_toBottomOf="@id/appIcon"
app:layout_constraintStart_toEndOf="@id/appIcon"
app:layout_constraintTop_toTopOf="@id/appIcon" />
<code.name.monkey.retromusic.views.WidthFitSquareCardView
android:id="@+id/imageContainerCard"
android:layout_width="290dp"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
app:cardCornerRadius="16dp"
app:layout_constraintDimensionRatio="1:1"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
app:layout_constraintTop_toBottomOf="@id/appIcon">
<androidx.appcompat.widget.AppCompatImageView
android:id="@+id/image"

View file

@ -25,6 +25,14 @@
app:optionIcon="@drawable/ic_folder_white_24dp"
app:optionTitle="@string/folders" />
<code.name.monkey.retromusic.views.OptionMenuItemView
android:id="@+id/actionDriveMode"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="2dp"
app:optionIcon="@drawable/ic_drive_eta_white_24dp"
app:optionTitle="@string/drive_mode" />
<code.name.monkey.retromusic.views.OptionMenuItemView
android:id="@+id/actionSettings"
android:layout_width="match_parent"

View file

@ -32,18 +32,6 @@
<include layout="@layout/status_bar" />
</FrameLayout>
<FrameLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="0">
<com.google.android.material.appbar.MaterialToolbar
android:id="@+id/playerToolbar"
style="@style/Toolbar"
android:layout_gravity="bottom"
android:navigationIcon="@drawable/ic_keyboard_arrow_down_black_24dp"
app:navigationIcon="@drawable/ic_keyboard_arrow_down_black_24dp" />
</FrameLayout>
<code.name.monkey.retromusic.views.WidthFitSquareLayout
android:id="@+id/playerAlbumCoverContainer"
@ -71,5 +59,18 @@
android:layout_height="match_parent"
tools:layout="@layout/fragment_player_playback_controls" />
</FrameLayout>
<FrameLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="0">
<com.google.android.material.appbar.MaterialToolbar
android:id="@+id/playerToolbar"
style="@style/Toolbar"
android:layout_gravity="bottom"
android:navigationIcon="@drawable/ic_keyboard_arrow_down_black_24dp"
app:navigationIcon="@drawable/ic_keyboard_arrow_down_black_24dp" />
</FrameLayout>
</LinearLayout>
</FrameLayout>

View file

@ -823,4 +823,5 @@
<string name="scrobbles_label">Scrobbles</string>
<string name="social_stories">Share story</string>
<string name="share_to_stories">Share to Stories</string>
<string name="drive_mode">Drive mode</string>
</resources>