Added link to lyrics page from peak theme
parent
cf402a27c2
commit
27190d5b74
|
@ -1,6 +1,6 @@
|
||||||
package code.name.monkey.retromusic.adapter.album
|
package code.name.monkey.retromusic.adapter.album
|
||||||
|
|
||||||
import android.content.Intent
|
import android.app.ActivityOptions
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import android.view.LayoutInflater
|
import android.view.LayoutInflater
|
||||||
import android.view.View
|
import android.view.View
|
||||||
|
@ -8,12 +8,13 @@ import android.view.ViewGroup
|
||||||
import android.widget.ImageView
|
import android.widget.ImageView
|
||||||
import androidx.fragment.app.Fragment
|
import androidx.fragment.app.Fragment
|
||||||
import androidx.fragment.app.FragmentManager
|
import androidx.fragment.app.FragmentManager
|
||||||
import code.name.monkey.retromusic.activities.LyricsActivity
|
import code.name.monkey.retromusic.R
|
||||||
import code.name.monkey.retromusic.fragments.AlbumCoverStyle
|
import code.name.monkey.retromusic.fragments.AlbumCoverStyle
|
||||||
import code.name.monkey.retromusic.glide.RetroMusicColoredTarget
|
import code.name.monkey.retromusic.glide.RetroMusicColoredTarget
|
||||||
import code.name.monkey.retromusic.glide.SongGlideRequest
|
import code.name.monkey.retromusic.glide.SongGlideRequest
|
||||||
import code.name.monkey.retromusic.misc.CustomFragmentStatePagerAdapter
|
import code.name.monkey.retromusic.misc.CustomFragmentStatePagerAdapter
|
||||||
import code.name.monkey.retromusic.model.Song
|
import code.name.monkey.retromusic.model.Song
|
||||||
|
import code.name.monkey.retromusic.util.NavigationUtil
|
||||||
import code.name.monkey.retromusic.util.PreferenceUtil
|
import code.name.monkey.retromusic.util.PreferenceUtil
|
||||||
import com.bumptech.glide.Glide
|
import com.bumptech.glide.Glide
|
||||||
import java.util.*
|
import java.util.*
|
||||||
|
@ -69,14 +70,14 @@ class AlbumCoverPagerAdapter(fm: FragmentManager, private val dataSet: ArrayList
|
||||||
private val layout: Int
|
private val layout: Int
|
||||||
get() {
|
get() {
|
||||||
return when (PreferenceUtil.getInstance(activity).albumCoverStyle) {
|
return when (PreferenceUtil.getInstance(activity).albumCoverStyle) {
|
||||||
AlbumCoverStyle.NORMAL -> code.name.monkey.retromusic.R.layout.fragment_album_cover
|
AlbumCoverStyle.NORMAL -> R.layout.fragment_album_cover
|
||||||
AlbumCoverStyle.FLAT -> code.name.monkey.retromusic.R.layout.fragment_album_flat_cover
|
AlbumCoverStyle.FLAT -> R.layout.fragment_album_flat_cover
|
||||||
AlbumCoverStyle.CIRCLE -> code.name.monkey.retromusic.R.layout.fragment_album_circle_cover
|
AlbumCoverStyle.CIRCLE -> R.layout.fragment_album_circle_cover
|
||||||
AlbumCoverStyle.CARD -> code.name.monkey.retromusic.R.layout.fragment_album_card_cover
|
AlbumCoverStyle.CARD -> R.layout.fragment_album_card_cover
|
||||||
AlbumCoverStyle.MATERIAL -> code.name.monkey.retromusic.R.layout.fragment_album_material_cover
|
AlbumCoverStyle.MATERIAL -> R.layout.fragment_album_material_cover
|
||||||
AlbumCoverStyle.FULL -> code.name.monkey.retromusic.R.layout.fragment_album_full_cover
|
AlbumCoverStyle.FULL -> R.layout.fragment_album_full_cover
|
||||||
AlbumCoverStyle.FULL_CARD -> code.name.monkey.retromusic.R.layout.fragment_album_full_card_cover
|
AlbumCoverStyle.FULL_CARD -> R.layout.fragment_album_full_card_cover
|
||||||
else -> code.name.monkey.retromusic.R.layout.fragment_album_cover
|
else -> R.layout.fragment_album_cover
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -89,12 +90,15 @@ class AlbumCoverPagerAdapter(fm: FragmentManager, private val dataSet: ArrayList
|
||||||
|
|
||||||
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {
|
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {
|
||||||
val finalLayout = when {
|
val finalLayout = when {
|
||||||
PreferenceUtil.getInstance(activity).carouselEffect() -> code.name.monkey.retromusic.R.layout.fragment_album_carousel_cover
|
PreferenceUtil.getInstance(activity).carouselEffect() -> R.layout.fragment_album_carousel_cover
|
||||||
else -> layout
|
else -> layout
|
||||||
}
|
}
|
||||||
val view = inflater.inflate(finalLayout, container, false)
|
val view = inflater.inflate(finalLayout, container, false)
|
||||||
albumCover = view.findViewById(code.name.monkey.retromusic.R.id.player_image)
|
albumCover = view.findViewById(R.id.player_image)
|
||||||
albumCover.setOnClickListener { startActivity(Intent(context, LyricsActivity::class.java)) }
|
albumCover.setOnClickListener {
|
||||||
|
val options = ActivityOptions.makeSceneTransitionAnimation(requireActivity(), it, getString(R.string.transition_lyrics))
|
||||||
|
NavigationUtil.goToLyrics(requireActivity(), options)
|
||||||
|
}
|
||||||
return view
|
return view
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -109,7 +109,7 @@ abstract class AbsPlayerFragment : AbsMusicServiceFragment(),
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
R.id.action_show_lyrics -> {
|
R.id.action_show_lyrics -> {
|
||||||
NavigationUtil.goToLyrics(requireActivity())
|
NavigationUtil.goToLyrics(requireActivity(), null)
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
R.id.action_equalizer -> {
|
R.id.action_equalizer -> {
|
||||||
|
|
|
@ -14,6 +14,7 @@
|
||||||
|
|
||||||
package code.name.monkey.retromusic.fragments.player.peak
|
package code.name.monkey.retromusic.fragments.player.peak
|
||||||
|
|
||||||
|
import android.app.ActivityOptions
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import android.view.LayoutInflater
|
import android.view.LayoutInflater
|
||||||
import android.view.View
|
import android.view.View
|
||||||
|
@ -26,6 +27,7 @@ import code.name.monkey.retromusic.fragments.base.AbsPlayerFragment
|
||||||
import code.name.monkey.retromusic.glide.RetroMusicColoredTarget
|
import code.name.monkey.retromusic.glide.RetroMusicColoredTarget
|
||||||
import code.name.monkey.retromusic.glide.SongGlideRequest
|
import code.name.monkey.retromusic.glide.SongGlideRequest
|
||||||
import code.name.monkey.retromusic.helper.MusicPlayerRemote
|
import code.name.monkey.retromusic.helper.MusicPlayerRemote
|
||||||
|
import code.name.monkey.retromusic.util.NavigationUtil
|
||||||
import com.bumptech.glide.Glide
|
import com.bumptech.glide.Glide
|
||||||
import kotlinx.android.synthetic.main.fragment_peak_player.*
|
import kotlinx.android.synthetic.main.fragment_peak_player.*
|
||||||
|
|
||||||
|
@ -46,6 +48,11 @@ class PeakPlayerFragment : AbsPlayerFragment() {
|
||||||
super.onViewCreated(view, savedInstanceState)
|
super.onViewCreated(view, savedInstanceState)
|
||||||
setUpPlayerToolbar()
|
setUpPlayerToolbar()
|
||||||
setUpSubFragments()
|
setUpSubFragments()
|
||||||
|
|
||||||
|
playerImage.setOnClickListener {
|
||||||
|
val options = ActivityOptions.makeSceneTransitionAnimation(requireActivity(), it, getString(R.string.transition_lyrics))
|
||||||
|
NavigationUtil.goToLyrics(requireActivity(), options)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun setUpSubFragments() {
|
private fun setUpSubFragments() {
|
||||||
|
@ -111,10 +118,6 @@ class PeakPlayerFragment : AbsPlayerFragment() {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onPlayStateChanged() {
|
|
||||||
super.onPlayStateChanged()
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onServiceConnected() {
|
override fun onServiceConnected() {
|
||||||
super.onServiceConnected()
|
super.onServiceConnected()
|
||||||
updateSong()
|
updateSong()
|
||||||
|
@ -124,7 +127,4 @@ class PeakPlayerFragment : AbsPlayerFragment() {
|
||||||
super.onPlayingMetaChanged()
|
super.onPlayingMetaChanged()
|
||||||
updateSong()
|
updateSong()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
|
@ -23,6 +23,7 @@ import android.media.audiofx.AudioEffect;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
|
import androidx.annotation.Nullable;
|
||||||
import androidx.appcompat.app.AppCompatActivity;
|
import androidx.appcompat.app.AppCompatActivity;
|
||||||
import androidx.core.app.ActivityCompat;
|
import androidx.core.app.ActivityCompat;
|
||||||
|
|
||||||
|
@ -116,9 +117,10 @@ public class NavigationUtil {
|
||||||
ActivityCompat.startActivity(activity, intent, null);
|
ActivityCompat.startActivity(activity, intent, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void goToLyrics(@NonNull Activity activity) {
|
public static void goToLyrics(@NonNull Activity activity,
|
||||||
|
@Nullable ActivityOptions activityOptions) {
|
||||||
Intent intent = new Intent(activity, LyricsActivity.class);
|
Intent intent = new Intent(activity, LyricsActivity.class);
|
||||||
ActivityCompat.startActivity(activity, intent, null);
|
ActivityCompat.startActivity(activity, intent, activityOptions != null ? activityOptions.toBundle() : null);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void goToGenre(@NonNull Activity activity, @NonNull Genre genre) {
|
public static void goToGenre(@NonNull Activity activity, @NonNull Genre genre) {
|
||||||
|
|
|
@ -3,8 +3,8 @@
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent">
|
android:layout_height="match_parent"
|
||||||
|
android:transitionName="@string/transition_lyrics">
|
||||||
|
|
||||||
<com.google.android.material.appbar.AppBarLayout
|
<com.google.android.material.appbar.AppBarLayout
|
||||||
android:id="@+id/appBarLayout"
|
android:id="@+id/appBarLayout"
|
||||||
|
|
|
@ -9,4 +9,5 @@
|
||||||
<string name="transition_artist_text" translatable="false">artist_image_transition</string>
|
<string name="transition_artist_text" translatable="false">artist_image_transition</string>
|
||||||
<string name="transition_mini_player" translatable="false">mini_player_transition</string>
|
<string name="transition_mini_player" translatable="false">mini_player_transition</string>
|
||||||
<string name="transition_toolbar" translatable="false">toolbar_transition</string>
|
<string name="transition_toolbar" translatable="false">toolbar_transition</string>
|
||||||
|
<string name="transition_lyrics" translatable="false">toolbar_transition</string>
|
||||||
</resources>
|
</resources>
|
Loading…
Reference in New Issue