Added retro icon, fix color, drive mode
This commit is contained in:
parent
03fa8399dd
commit
5754141b0e
25 changed files with 615 additions and 54 deletions
|
@ -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
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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 -> {
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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
|
||||
)
|
||||
}
|
||||
}
|
||||
})
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue