Add detail navigation

This commit is contained in:
Hemanth S 2020-08-12 03:01:09 +05:30
parent 4a87a900be
commit ec47bc3d2e
34 changed files with 381 additions and 324 deletions

View file

@ -106,7 +106,6 @@
</intent-filter> </intent-filter>
</activity> </activity>
<activity android:name=".activities.PlayingQueueActivity" /> <activity android:name=".activities.PlayingQueueActivity" />
<activity android:name="code.name.monkey.retromusic.fragments.about.AboutActivity" />
<activity android:name=".activities.tageditor.AlbumTagEditorActivity" /> <activity android:name=".activities.tageditor.AlbumTagEditorActivity" />
<activity android:name=".activities.tageditor.SongTagEditorActivity" /> <activity android:name=".activities.tageditor.SongTagEditorActivity" />
<activity android:name=".activities.LyricsActivity" /> <activity android:name=".activities.LyricsActivity" />
@ -118,9 +117,6 @@
<activity android:name=".activities.bugreport.BugReportActivity" /> <activity android:name=".activities.bugreport.BugReportActivity" />
<activity android:name=".activities.ShareInstagramStory" /> <activity android:name=".activities.ShareInstagramStory" />
<activity android:name=".activities.DriveModeActivity" /> <activity android:name=".activities.DriveModeActivity" />
<activity
android:name="code.name.monkey.retromusic.fragments.search.SearchActivity"
android:windowSoftInputMode="stateVisible" />
<activity <activity
android:name=".activities.LockScreenActivity" android:name=".activities.LockScreenActivity"

View file

@ -85,7 +85,6 @@ class MainActivity : AbsSlidingMusicPanelActivity(),
PreferenceUtil.unregisterOnSharedPreferenceChangedListener(this) PreferenceUtil.unregisterOnSharedPreferenceChangedListener(this)
} }
override fun requestPermissions() { override fun requestPermissions() {
if (!blockRequestPermissions) { if (!blockRequestPermissions) {
super.requestPermissions() super.requestPermissions()
@ -180,7 +179,6 @@ class MainActivity : AbsSlidingMusicPanelActivity(),
} }
override fun handleBackPress(): Boolean { override fun handleBackPress(): Boolean {
getBottomNavigationView().menu.getItem(0).isChecked = true
if (cab != null && cab!!.isActive) { if (cab != null && cab!!.isActive) {
cab?.finish() cab?.finish()
return true return true

View file

@ -118,7 +118,7 @@ abstract class AbsSlidingMusicPanelActivity() : AbsMusicServiceActivity() {
return slidingMusicPanelLayout return slidingMusicPanelLayout
} }
private fun collapsePanel() { fun collapsePanel() {
behavior.state = BottomSheetBehavior.STATE_COLLAPSED behavior.state = BottomSheetBehavior.STATE_COLLAPSED
} }
@ -302,7 +302,8 @@ abstract class AbsSlidingMusicPanelActivity() : AbsMusicServiceActivity() {
fun hideBottomNavigation() { fun hideBottomNavigation() {
behavior.isHideable = true behavior.isHideable = true
behavior.state == BottomSheetBehavior.STATE_HIDDEN behavior.peekHeight = 0
setBottomBarVisibility(View.GONE)
} }
fun updateTabs() { fun updateTabs() {

View file

@ -9,6 +9,7 @@ import androidx.appcompat.app.AppCompatActivity
import androidx.appcompat.widget.AppCompatTextView import androidx.appcompat.widget.AppCompatTextView
import androidx.core.os.bundleOf import androidx.core.os.bundleOf
import androidx.navigation.findNavController import androidx.navigation.findNavController
import androidx.navigation.fragment.FragmentNavigatorExtras
import androidx.recyclerview.widget.GridLayoutManager import androidx.recyclerview.widget.GridLayoutManager
import androidx.recyclerview.widget.LinearLayoutManager import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView import androidx.recyclerview.widget.RecyclerView
@ -167,10 +168,14 @@ class HomeAdapter(
} }
} }
override fun onAlbumClick(albumId: Int) { override fun onAlbumClick(albumId: Int, view: View) {
activity.findNavController(R.id.fragment_container).navigate( activity.findNavController(R.id.fragment_container).navigate(
R.id.albumDetailsFragment, R.id.albumDetailsFragment,
bundleOf(EXTRA_ALBUM_ID to albumId) bundleOf(EXTRA_ALBUM_ID to albumId),
null,
FragmentNavigatorExtras(
view to activity.getString(R.string.transition_album_art)
)
) )
} }
} }

View file

@ -1,6 +1,5 @@
package code.name.monkey.retromusic.adapter.album package code.name.monkey.retromusic.adapter.album
import android.app.ActivityOptions
import android.content.res.ColorStateList import android.content.res.ColorStateList
import android.content.res.Resources import android.content.res.Resources
import android.view.LayoutInflater import android.view.LayoutInflater
@ -173,17 +172,7 @@ open class AlbumAdapter(
if (isInQuickSelectMode) { if (isInQuickSelectMode) {
toggleChecked(layoutPosition) toggleChecked(layoutPosition)
} else { } else {
val activityOptions = ActivityOptions.makeSceneTransitionAnimation( image?.let { albumClickListener?.onAlbumClick(dataSet[layoutPosition].id, it) }
activity,
imageContainerCard ?: image,
activity.getString(R.string.transition_album_art)
)
albumClickListener?.onAlbumClick(dataSet[layoutPosition].id)
/*NavigationUtil.goToAlbumOptions(
activity,
dataSet[layoutPosition].id,
activityOptions
)*/
} }
} }

View file

@ -31,6 +31,7 @@ import code.name.monkey.appthemehelper.util.ColorUtil
import code.name.monkey.appthemehelper.util.MaterialValueHelper import code.name.monkey.appthemehelper.util.MaterialValueHelper
import code.name.monkey.retromusic.App import code.name.monkey.retromusic.App
import code.name.monkey.retromusic.R import code.name.monkey.retromusic.R
import com.google.android.material.button.MaterialButton
import com.google.android.material.floatingactionbutton.ExtendedFloatingActionButton import com.google.android.material.floatingactionbutton.ExtendedFloatingActionButton
fun Int.ripAlpha(): Int { fun Int.ripAlpha(): Int {
@ -103,3 +104,16 @@ fun ExtendedFloatingActionButton.accentColor() {
setTextColor(textColorStateList) setTextColor(textColorStateList)
iconTint = textColorStateList iconTint = textColorStateList
} }
fun MaterialButton.applyColor(color: Int) {
val backgroundColorStateList = ColorStateList.valueOf(color)
val textColorColorStateList = ColorStateList.valueOf(
MaterialValueHelper.getPrimaryTextColor(
context,
ColorUtil.isColorLight(color)
)
)
backgroundTintList = backgroundColorStateList
setTextColor(textColorColorStateList)
iconTint = textColorColorStateList
}

View file

@ -62,6 +62,10 @@ fun <T> AppCompatActivity.whichFragment(@IdRes id: Int): T {
return supportFragmentManager.findFragmentById(id) as T return supportFragmentManager.findFragmentById(id) as T
} }
@Suppress("UNCHECKED_CAST")
fun <T> Fragment.whichFragment(@IdRes id: Int): T {
return childFragmentManager.findFragmentById(id) as T
}
fun Fragment.showToast(@StringRes stringRes: Int) { fun Fragment.showToast(@StringRes stringRes: Int) {
showToast(getString(stringRes)) showToast(getString(stringRes))

View file

@ -55,10 +55,10 @@ class LibraryViewModel(
repository.topArtists(), repository.topArtists(),
repository.topAlbums(), repository.topAlbums(),
repository.recentArtists(), repository.recentArtists(),
repository.recentAlbums(), repository.recentAlbums()/*,
repository.suggestions(), repository.suggestions(),
repository.favoritePlaylist(), repository.favoritePlaylist(),
repository.homeGenres() repository.homeGenres()*/
) )
result.forEach { result.forEach {
if (it != null && it.arrayList.isNotEmpty()) { if (it != null && it.arrayList.isNotEmpty()) {

View file

@ -1,11 +0,0 @@
package code.name.monkey.retromusic.fragments
import androidx.annotation.LayoutRes
import code.name.monkey.retromusic.activities.MainActivity
import code.name.monkey.retromusic.fragments.base.AbsMusicServiceFragment
open class MainActivityFragment(@LayoutRes layoutRes: Int) : AbsMusicServiceFragment(layoutRes) {
val mainActivity by lazy {
requireActivity() as MainActivity
}
}

View file

@ -1,148 +0,0 @@
package code.name.monkey.retromusic.fragments.about
import android.content.Intent
import android.content.pm.PackageManager
import android.net.Uri
import android.os.Bundle
import android.view.MenuItem
import android.view.View
import androidx.core.app.ShareCompat
import androidx.recyclerview.widget.DefaultItemAnimator
import androidx.recyclerview.widget.LinearLayoutManager
import code.name.monkey.retromusic.App
import code.name.monkey.retromusic.Constants.APP_INSTAGRAM_LINK
import code.name.monkey.retromusic.Constants.APP_TELEGRAM_LINK
import code.name.monkey.retromusic.Constants.APP_TWITTER_LINK
import code.name.monkey.retromusic.Constants.FAQ_LINK
import code.name.monkey.retromusic.Constants.GITHUB_PROJECT
import code.name.monkey.retromusic.Constants.PINTEREST
import code.name.monkey.retromusic.Constants.RATE_ON_GOOGLE_PLAY
import code.name.monkey.retromusic.Constants.TELEGRAM_CHANGE_LOG
import code.name.monkey.retromusic.Constants.TRANSLATE
import code.name.monkey.retromusic.R
import code.name.monkey.retromusic.activities.base.AbsBaseActivity
import code.name.monkey.retromusic.adapter.ContributorAdapter
import code.name.monkey.retromusic.extensions.applyToolbar
import code.name.monkey.retromusic.model.Contributor
import code.name.monkey.retromusic.util.NavigationUtil
import com.google.gson.Gson
import com.google.gson.reflect.TypeToken
import kotlinx.android.synthetic.main.activity_about.*
import kotlinx.android.synthetic.main.card_credit.*
import kotlinx.android.synthetic.main.card_other.*
import kotlinx.android.synthetic.main.card_retro_info.*
import kotlinx.android.synthetic.main.card_social.*
import java.io.IOException
import java.nio.charset.StandardCharsets
class AboutActivity : AbsBaseActivity(), View.OnClickListener {
private val contributorsJson: String?
get() {
val json: String
try {
val inputStream = assets.open("contributors.json")
val size = inputStream.available()
val buffer = ByteArray(size)
inputStream.read(buffer)
inputStream.close()
json = String(buffer, StandardCharsets.UTF_8)
} catch (ex: IOException) {
ex.printStackTrace()
return null
}
return json
}
override fun onCreate(savedInstanceState: Bundle?) {
setDrawUnderStatusBar()
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_about)
setStatusbarColorAuto()
setNavigationbarColorAuto()
setLightNavigationBar(true)
applyToolbar(toolbar)
version.setSummary(getAppVersion())
setUpView()
loadContributors()
}
override fun onOptionsItemSelected(item: MenuItem): Boolean {
if (item.itemId == android.R.id.home) {
onBackPressed()
return true
}
return super.onOptionsItemSelected(item)
}
private fun openUrl(url: String) {
val i = Intent(Intent.ACTION_VIEW)
i.data = Uri.parse(url)
i.flags = Intent.FLAG_ACTIVITY_NEW_TASK
startActivity(i)
}
private fun setUpView() {
appGithub.setOnClickListener(this)
faqLink.setOnClickListener(this)
telegramLink.setOnClickListener(this)
appRate.setOnClickListener(this)
appTranslation.setOnClickListener(this)
appShare.setOnClickListener(this)
donateLink.setOnClickListener(this)
instagramLink.setOnClickListener(this)
twitterLink.setOnClickListener(this)
changelog.setOnClickListener(this)
openSource.setOnClickListener(this)
pinterestLink.setOnClickListener(this)
bugReportLink.setOnClickListener(this)
}
override fun onClick(view: View) {
when (view.id) {
R.id.pinterestLink -> openUrl(PINTEREST)
R.id.faqLink -> openUrl(FAQ_LINK)
R.id.telegramLink -> openUrl(APP_TELEGRAM_LINK)
R.id.appGithub -> openUrl(GITHUB_PROJECT)
R.id.appTranslation -> openUrl(TRANSLATE)
R.id.appRate -> openUrl(RATE_ON_GOOGLE_PLAY)
R.id.appShare -> shareApp()
R.id.donateLink -> NavigationUtil.goToSupportDevelopment(this)
R.id.instagramLink -> openUrl(APP_INSTAGRAM_LINK)
R.id.twitterLink -> openUrl(APP_TWITTER_LINK)
R.id.changelog -> openUrl(TELEGRAM_CHANGE_LOG)
R.id.openSource -> NavigationUtil.goToOpenSource(this)
R.id.bugReportLink -> NavigationUtil.bugReport(this)
}
}
private fun getAppVersion(): String {
return try {
val isPro = if (App.isProVersion()) "Pro" else "Free"
val packageInfo = packageManager.getPackageInfo(packageName, 0)
"${packageInfo.versionName} $isPro"
} catch (e: PackageManager.NameNotFoundException) {
e.printStackTrace()
"0.0.0"
}
}
private fun shareApp() {
ShareCompat.IntentBuilder.from(this).setType("text/plain")
.setChooserTitle(R.string.share_app)
.setText(String.format(getString(R.string.app_share), packageName)).startChooser()
}
private fun loadContributors() {
val type = object : TypeToken<List<Contributor>>() {
}.type
val contributors = Gson().fromJson<List<Contributor>>(contributorsJson, type)
val contributorAdapter = ContributorAdapter(contributors)
recyclerView.layoutManager = LinearLayoutManager(this)
recyclerView.itemAnimator = DefaultItemAnimator()
recyclerView.adapter = contributorAdapter
}
}

View file

@ -12,12 +12,11 @@ import code.name.monkey.retromusic.App
import code.name.monkey.retromusic.Constants import code.name.monkey.retromusic.Constants
import code.name.monkey.retromusic.R import code.name.monkey.retromusic.R
import code.name.monkey.retromusic.adapter.ContributorAdapter import code.name.monkey.retromusic.adapter.ContributorAdapter
import code.name.monkey.retromusic.fragments.MainActivityFragment import code.name.monkey.retromusic.fragments.base.AbsMainActivityFragment
import code.name.monkey.retromusic.model.Contributor import code.name.monkey.retromusic.model.Contributor
import code.name.monkey.retromusic.util.NavigationUtil import code.name.monkey.retromusic.util.NavigationUtil
import com.google.gson.Gson import com.google.gson.Gson
import com.google.gson.reflect.TypeToken import com.google.gson.reflect.TypeToken
import kotlinx.android.synthetic.main.activity_about.*
import kotlinx.android.synthetic.main.card_credit.* import kotlinx.android.synthetic.main.card_credit.*
import kotlinx.android.synthetic.main.card_other.* import kotlinx.android.synthetic.main.card_other.*
import kotlinx.android.synthetic.main.card_retro_info.* import kotlinx.android.synthetic.main.card_retro_info.*
@ -25,10 +24,9 @@ import kotlinx.android.synthetic.main.card_social.*
import java.io.IOException import java.io.IOException
import java.nio.charset.StandardCharsets import java.nio.charset.StandardCharsets
class AboutFragment : MainActivityFragment(R.layout.fragment_about), View.OnClickListener { class AboutFragment : AbsMainActivityFragment(R.layout.fragment_about), View.OnClickListener {
override fun onViewCreated(view: View, savedInstanceState: Bundle?) { override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState) super.onViewCreated(view, savedInstanceState)
mainActivity.setSupportActionBar(toolbar)
version.setSummary(getAppVersion()) version.setSummary(getAppVersion())
setUpView() setUpView()
loadContributors() loadContributors()

View file

@ -8,18 +8,17 @@ import androidx.core.os.bundleOf
import androidx.lifecycle.Observer import androidx.lifecycle.Observer
import androidx.navigation.findNavController import androidx.navigation.findNavController
import androidx.navigation.fragment.findNavController import androidx.navigation.fragment.findNavController
import androidx.navigation.fragment.navArgs
import androidx.recyclerview.widget.DefaultItemAnimator import androidx.recyclerview.widget.DefaultItemAnimator
import androidx.recyclerview.widget.GridLayoutManager import androidx.recyclerview.widget.GridLayoutManager
import androidx.recyclerview.widget.LinearLayoutManager import androidx.recyclerview.widget.LinearLayoutManager
import code.name.monkey.appthemehelper.util.MaterialUtil
import code.name.monkey.retromusic.EXTRA_ALBUM_ID
import code.name.monkey.retromusic.EXTRA_ARTIST_ID import code.name.monkey.retromusic.EXTRA_ARTIST_ID
import code.name.monkey.retromusic.R import code.name.monkey.retromusic.R
import code.name.monkey.retromusic.adapter.album.HorizontalAlbumAdapter import code.name.monkey.retromusic.adapter.album.HorizontalAlbumAdapter
import code.name.monkey.retromusic.adapter.song.SimpleSongAdapter import code.name.monkey.retromusic.adapter.song.SimpleSongAdapter
import code.name.monkey.retromusic.extensions.extraNotNull import code.name.monkey.retromusic.extensions.applyColor
import code.name.monkey.retromusic.extensions.show import code.name.monkey.retromusic.extensions.show
import code.name.monkey.retromusic.fragments.MainActivityFragment import code.name.monkey.retromusic.fragments.base.AbsMainActivityFragment
import code.name.monkey.retromusic.glide.AlbumGlideRequest import code.name.monkey.retromusic.glide.AlbumGlideRequest
import code.name.monkey.retromusic.glide.ArtistGlideRequest import code.name.monkey.retromusic.glide.ArtistGlideRequest
import code.name.monkey.retromusic.glide.RetroMusicColoredTarget import code.name.monkey.retromusic.glide.RetroMusicColoredTarget
@ -38,16 +37,17 @@ import org.koin.androidx.viewmodel.ext.android.viewModel
import org.koin.core.parameter.parametersOf import org.koin.core.parameter.parametersOf
import java.util.* import java.util.*
class AlbumDetailsFragment : MainActivityFragment(R.layout.fragment_album_details), class AlbumDetailsFragment : AbsMainActivityFragment(R.layout.fragment_album_details),
AlbumClickListener { AlbumClickListener {
private lateinit var simpleSongAdapter: SimpleSongAdapter private lateinit var simpleSongAdapter: SimpleSongAdapter
private lateinit var album: Album private lateinit var album: Album
private val args: AlbumDetailsFragmentArgs by navArgs()
private val savedSortOrder: String private val savedSortOrder: String
get() = PreferenceUtil.albumDetailSongSortOrder get() = PreferenceUtil.albumDetailSongSortOrder
private val detailsViewModel by viewModel<AlbumDetailsViewModel> { private val detailsViewModel by viewModel<AlbumDetailsViewModel> {
parametersOf(extraNotNull<Int>(EXTRA_ALBUM_ID).value) parametersOf(args.extraAlbumId)
} }
override fun onActivityCreated(savedInstanceState: Bundle?) { override fun onActivityCreated(savedInstanceState: Bundle?) {
@ -56,6 +56,8 @@ class AlbumDetailsFragment : MainActivityFragment(R.layout.fragment_album_detail
mainActivity.setBottomBarVisibility(View.GONE) mainActivity.setBottomBarVisibility(View.GONE)
toolbar.title = null toolbar.title = null
image.transitionName = getString(R.string.transition_album_art)
postponeEnterTransition() postponeEnterTransition()
playerActivity?.addMusicServiceEventListener(detailsViewModel) playerActivity?.addMusicServiceEventListener(detailsViewModel)
detailsViewModel.getAlbum().observe(viewLifecycleOwner, Observer { detailsViewModel.getAlbum().observe(viewLifecycleOwner, Observer {
@ -100,13 +102,6 @@ class AlbumDetailsFragment : MainActivityFragment(R.layout.fragment_album_detail
} }
} }
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
val activity = activity as AppCompatActivity
activity.supportActionBar?.setDisplayHomeAsUpEnabled(true)
}
override fun onDestroy() { override fun onDestroy() {
super.onDestroy() super.onDestroy()
playerActivity?.removeMusicServiceEventListener(detailsViewModel) playerActivity?.removeMusicServiceEventListener(detailsViewModel)
@ -234,19 +229,11 @@ class AlbumDetailsFragment : MainActivityFragment(R.layout.fragment_album_detail
} }
private fun setColors(color: MediaNotificationProcessor) { private fun setColors(color: MediaNotificationProcessor) {
MaterialUtil.tintColor( shuffleAction.applyColor(color.backgroundColor)
button = shuffleAction, playAction.applyColor(color.backgroundColor)
textColor = color.primaryTextColor,
backgroundColor = color.backgroundColor
)
MaterialUtil.tintColor(
button = playAction,
textColor = color.primaryTextColor,
backgroundColor = color.backgroundColor
)
} }
override fun onAlbumClick(albumId: Int) { override fun onAlbumClick(albumId: Int, view: View) {
findNavController().navigate( findNavController().navigate(
R.id.albumDetailsFragment, R.id.albumDetailsFragment,
bundleOf("extra_album_id" to albumId) bundleOf("extra_album_id" to albumId)

View file

@ -94,12 +94,15 @@ class AlbumsFragment :
} }
} }
override fun onAlbumClick(albumId: Int) { override fun onAlbumClick(albumId: Int, view: View) {
val controller = requireActivity().findNavController(R.id.fragment_container) val controller = requireActivity().findNavController(R.id.fragment_container)
controller.navigate(R.id.albumDetailsFragment, bundleOf(EXTRA_ALBUM_ID to albumId)) controller.navigate(
R.id.albumDetailsFragment,
bundleOf(EXTRA_ALBUM_ID to albumId)
)
} }
} }
interface AlbumClickListener { interface AlbumClickListener {
fun onAlbumClick(albumId: Int) fun onAlbumClick(albumId: Int, view: View)
} }

View file

@ -6,19 +6,20 @@ import android.view.View
import androidx.core.os.bundleOf import androidx.core.os.bundleOf
import androidx.core.text.HtmlCompat import androidx.core.text.HtmlCompat
import androidx.lifecycle.Observer import androidx.lifecycle.Observer
import androidx.navigation.fragment.FragmentNavigatorExtras
import androidx.navigation.fragment.findNavController import androidx.navigation.fragment.findNavController
import androidx.recyclerview.widget.DefaultItemAnimator import androidx.recyclerview.widget.DefaultItemAnimator
import androidx.recyclerview.widget.GridLayoutManager import androidx.recyclerview.widget.GridLayoutManager
import androidx.recyclerview.widget.LinearLayoutManager import androidx.recyclerview.widget.LinearLayoutManager
import code.name.monkey.appthemehelper.util.MaterialUtil
import code.name.monkey.retromusic.EXTRA_ARTIST_ID import code.name.monkey.retromusic.EXTRA_ARTIST_ID
import code.name.monkey.retromusic.R import code.name.monkey.retromusic.R
import code.name.monkey.retromusic.adapter.album.HorizontalAlbumAdapter import code.name.monkey.retromusic.adapter.album.HorizontalAlbumAdapter
import code.name.monkey.retromusic.adapter.song.SimpleSongAdapter import code.name.monkey.retromusic.adapter.song.SimpleSongAdapter
import code.name.monkey.retromusic.extensions.applyColor
import code.name.monkey.retromusic.extensions.extraNotNull import code.name.monkey.retromusic.extensions.extraNotNull
import code.name.monkey.retromusic.extensions.show import code.name.monkey.retromusic.extensions.show
import code.name.monkey.retromusic.fragments.MainActivityFragment
import code.name.monkey.retromusic.fragments.albums.AlbumClickListener import code.name.monkey.retromusic.fragments.albums.AlbumClickListener
import code.name.monkey.retromusic.fragments.base.AbsMainActivityFragment
import code.name.monkey.retromusic.glide.ArtistGlideRequest import code.name.monkey.retromusic.glide.ArtistGlideRequest
import code.name.monkey.retromusic.glide.RetroMusicColoredTarget import code.name.monkey.retromusic.glide.RetroMusicColoredTarget
import code.name.monkey.retromusic.helper.MusicPlayerRemote import code.name.monkey.retromusic.helper.MusicPlayerRemote
@ -35,7 +36,7 @@ import org.koin.core.parameter.parametersOf
import java.util.* import java.util.*
import kotlin.collections.ArrayList import kotlin.collections.ArrayList
class ArtistDetailsFragment : MainActivityFragment(R.layout.fragment_artist_details), class ArtistDetailsFragment : AbsMainActivityFragment(R.layout.fragment_artist_details),
AlbumClickListener { AlbumClickListener {
private var biography: Spanned? = null private var biography: Spanned? = null
@ -49,12 +50,12 @@ class ArtistDetailsFragment : MainActivityFragment(R.layout.fragment_artist_deta
parametersOf(extraNotNull<Int>(EXTRA_ARTIST_ID).value) parametersOf(extraNotNull<Int>(EXTRA_ARTIST_ID).value)
} }
override fun onViewCreated(view: View, savedInstanceState: Bundle?) { override fun onActivityCreated(savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState) super.onActivityCreated(savedInstanceState)
mainActivity.setSupportActionBar(toolbar) mainActivity.setSupportActionBar(toolbar)
mainActivity.setBottomBarVisibility(View.GONE) mainActivity.setBottomBarVisibility(View.GONE)
toolbar.title = null toolbar.title = null
setupRecyclerView()
postponeEnterTransition() postponeEnterTransition()
detailsViewModel.getArtist().observe(viewLifecycleOwner, Observer { detailsViewModel.getArtist().observe(viewLifecycleOwner, Observer {
startPostponedEnterTransition() startPostponedEnterTransition()
@ -63,7 +64,7 @@ class ArtistDetailsFragment : MainActivityFragment(R.layout.fragment_artist_deta
detailsViewModel.getArtistInfo().observe(viewLifecycleOwner, Observer { detailsViewModel.getArtistInfo().observe(viewLifecycleOwner, Observer {
artistInfo(it) artistInfo(it)
}) })
setupRecyclerView()
playAction.apply { playAction.apply {
setOnClickListener { MusicPlayerRemote.openQueue(artist.songs, 0, true) } setOnClickListener { MusicPlayerRemote.openQueue(artist.songs, 0, true) }
} }
@ -173,22 +174,18 @@ class ArtistDetailsFragment : MainActivityFragment(R.layout.fragment_artist_deta
} }
private fun setColors(color: MediaNotificationProcessor) { private fun setColors(color: MediaNotificationProcessor) {
MaterialUtil.tintColor( shuffleAction.applyColor(color.backgroundColor)
button = shuffleAction, playAction.applyColor(color.backgroundColor)
textColor = color.primaryTextColor,
backgroundColor = color.backgroundColor
)
MaterialUtil.tintColor(
button = playAction,
textColor = color.primaryTextColor,
backgroundColor = color.backgroundColor
)
} }
override fun onAlbumClick(albumId: Int) { override fun onAlbumClick(albumId: Int, view: View) {
findNavController().navigate( findNavController().navigate(
R.id.albumDetailsFragment, R.id.albumDetailsFragment,
bundleOf("extra_album_id" to albumId) bundleOf("extra_album_id" to albumId),
null,
FragmentNavigatorExtras(
view to getString(R.string.transition_album_art)
)
) )
} }
} }

View file

@ -7,6 +7,8 @@ import android.view.View
import android.webkit.MimeTypeMap import android.webkit.MimeTypeMap
import androidx.annotation.LayoutRes import androidx.annotation.LayoutRes
import androidx.fragment.app.Fragment import androidx.fragment.app.Fragment
import androidx.navigation.navOptions
import code.name.monkey.retromusic.R
import code.name.monkey.retromusic.activities.base.AbsMusicServiceActivity import code.name.monkey.retromusic.activities.base.AbsMusicServiceActivity
import code.name.monkey.retromusic.interfaces.MusicServiceEventListener import code.name.monkey.retromusic.interfaces.MusicServiceEventListener
import code.name.monkey.retromusic.model.Song import code.name.monkey.retromusic.model.Song
@ -22,7 +24,17 @@ import java.util.*
open class AbsMusicServiceFragment(@LayoutRes layout: Int) : Fragment(layout), open class AbsMusicServiceFragment(@LayoutRes layout: Int) : Fragment(layout),
MusicServiceEventListener { MusicServiceEventListener {
val navOptions by lazy {
navOptions {
launchSingleTop = true
anim {
enter = R.anim.retro_fragment_open_enter
exit = R.anim.retro_fragment_open_exit
popEnter = R.anim.retro_fragment_close_enter
popExit = R.anim.retro_fragment_close_exit
}
}
}
var playerActivity: AbsMusicServiceActivity? = null var playerActivity: AbsMusicServiceActivity? = null
private set private set

View file

@ -34,11 +34,8 @@ import kotlinx.android.synthetic.main.shadow_statusbar_toolbar.*
import org.koin.androidx.viewmodel.ext.android.sharedViewModel import org.koin.androidx.viewmodel.ext.android.sharedViewModel
import java.io.FileNotFoundException import java.io.FileNotFoundException
abstract class AbsPlayerFragment(@LayoutRes layout: Int) : AbsMusicServiceFragment(layout), abstract class AbsPlayerFragment(@LayoutRes layout: Int) : AbsMainActivityFragment(layout),
Toolbar.OnMenuItemClickListener, Toolbar.OnMenuItemClickListener, PaletteColorHolder, PlayerAlbumCoverFragment.Callbacks {
PaletteColorHolder,
PlayerAlbumCoverFragment.Callbacks {
private var updateIsFavoriteTask: AsyncTask<*, *, *>? = null private var updateIsFavoriteTask: AsyncTask<*, *, *>? = null
private var updateLyricsAsyncTask: AsyncTask<*, *, *>? = null private var updateLyricsAsyncTask: AsyncTask<*, *, *>? = null
@ -264,11 +261,6 @@ abstract class AbsPlayerFragment(@LayoutRes layout: Int) : AbsMusicServiceFragme
statusBarShadow?.hide() statusBarShadow?.hide()
} }
interface Callbacks {
fun onPaletteColorChanged()
}
companion object { companion object {
val TAG: String = AbsPlayerFragment::class.java.simpleName val TAG: String = AbsPlayerFragment::class.java.simpleName
const val VISIBILITY_ANIM_DURATION: Long = 300 const val VISIBILITY_ANIM_DURATION: Long = 300

View file

@ -24,7 +24,6 @@ abstract class AbsRecyclerViewFragment<A : RecyclerView.Adapter<*>, LM : Recycle
val libraryViewModel: LibraryViewModel by sharedViewModel() val libraryViewModel: LibraryViewModel by sharedViewModel()
override fun onActivityCreated(savedInstanceState: Bundle?) { override fun onActivityCreated(savedInstanceState: Bundle?) {
super.onActivityCreated(savedInstanceState) super.onActivityCreated(savedInstanceState)
setHasOptionsMenu(true) setHasOptionsMenu(true)

View file

@ -10,7 +10,7 @@ import code.name.monkey.retromusic.R
import code.name.monkey.retromusic.adapter.song.SongAdapter import code.name.monkey.retromusic.adapter.song.SongAdapter
import code.name.monkey.retromusic.extensions.dipToPix import code.name.monkey.retromusic.extensions.dipToPix
import code.name.monkey.retromusic.extensions.extraNotNull import code.name.monkey.retromusic.extensions.extraNotNull
import code.name.monkey.retromusic.fragments.MainActivityFragment import code.name.monkey.retromusic.fragments.base.AbsMainActivityFragment
import code.name.monkey.retromusic.model.Genre import code.name.monkey.retromusic.model.Genre
import code.name.monkey.retromusic.model.Song import code.name.monkey.retromusic.model.Song
import kotlinx.android.synthetic.main.fragment_playlist_detail.* import kotlinx.android.synthetic.main.fragment_playlist_detail.*
@ -18,7 +18,7 @@ import org.koin.androidx.viewmodel.ext.android.viewModel
import org.koin.core.parameter.parametersOf import org.koin.core.parameter.parametersOf
import java.util.* import java.util.*
class GenreDetailsFragment : MainActivityFragment(R.layout.fragment_playlist_detail) { class GenreDetailsFragment : AbsMainActivityFragment(R.layout.fragment_playlist_detail) {
private val detailsViewModel: GenreDetailsViewModel by viewModel { private val detailsViewModel: GenreDetailsViewModel by viewModel {
parametersOf(extraNotNull<Genre>(EXTRA_GENRE).value) parametersOf(extraNotNull<Genre>(EXTRA_GENRE).value)
} }

View file

@ -30,7 +30,6 @@ import code.name.monkey.retromusic.fragments.base.AbsMainActivityFragment
import code.name.monkey.retromusic.glide.ProfileBannerGlideRequest import code.name.monkey.retromusic.glide.ProfileBannerGlideRequest
import code.name.monkey.retromusic.glide.UserProfileGlideRequest import code.name.monkey.retromusic.glide.UserProfileGlideRequest
import code.name.monkey.retromusic.helper.MusicPlayerRemote import code.name.monkey.retromusic.helper.MusicPlayerRemote
import code.name.monkey.retromusic.interfaces.MainActivityFragmentCallbacks
import code.name.monkey.retromusic.loaders.SongLoader import code.name.monkey.retromusic.loaders.SongLoader
import code.name.monkey.retromusic.model.smartplaylist.HistoryPlaylist import code.name.monkey.retromusic.model.smartplaylist.HistoryPlaylist
import code.name.monkey.retromusic.model.smartplaylist.LastAddedPlaylist import code.name.monkey.retromusic.model.smartplaylist.LastAddedPlaylist
@ -44,12 +43,7 @@ import kotlinx.android.synthetic.main.home_content.*
import org.koin.androidx.viewmodel.ext.android.sharedViewModel import org.koin.androidx.viewmodel.ext.android.sharedViewModel
class HomeFragment : class HomeFragment :
AbsMainActivityFragment(if (PreferenceUtil.isHomeBanner) R.layout.fragment_banner_home else R.layout.fragment_home), AbsMainActivityFragment(if (PreferenceUtil.isHomeBanner) R.layout.fragment_banner_home else R.layout.fragment_home) {
MainActivityFragmentCallbacks {
override fun handleBackPress(): Boolean {
return false
}
private val libraryViewModel: LibraryViewModel by sharedViewModel() private val libraryViewModel: LibraryViewModel by sharedViewModel()

View file

@ -6,40 +6,17 @@ import android.view.MenuInflater
import android.view.MenuItem import android.view.MenuItem
import android.view.View import android.view.View
import androidx.navigation.fragment.findNavController import androidx.navigation.fragment.findNavController
import androidx.navigation.navOptions
import androidx.navigation.ui.AppBarConfiguration
import code.name.monkey.appthemehelper.common.ATHToolbarActivity.getToolbarBackgroundColor import code.name.monkey.appthemehelper.common.ATHToolbarActivity.getToolbarBackgroundColor
import code.name.monkey.appthemehelper.util.ToolbarContentTintHelper import code.name.monkey.appthemehelper.util.ToolbarContentTintHelper
import code.name.monkey.retromusic.R import code.name.monkey.retromusic.R
import code.name.monkey.retromusic.extensions.findNavController import code.name.monkey.retromusic.extensions.findNavController
import code.name.monkey.retromusic.fragments.MainActivityFragment import code.name.monkey.retromusic.fragments.base.AbsMainActivityFragment
import code.name.monkey.retromusic.fragments.folder.FoldersFragment import code.name.monkey.retromusic.fragments.folder.FoldersFragment
import code.name.monkey.retromusic.util.PreferenceUtil import code.name.monkey.retromusic.util.PreferenceUtil
import com.google.android.material.appbar.AppBarLayout import com.google.android.material.appbar.AppBarLayout
import kotlinx.android.synthetic.main.fragment_library.* import kotlinx.android.synthetic.main.fragment_library.*
class LibraryFragment : MainActivityFragment(R.layout.fragment_library) { class LibraryFragment : AbsMainActivityFragment(R.layout.fragment_library) {
private val navOptions by lazy {
navOptions {
launchSingleTop = true
anim {
enter = R.anim.retro_fragment_open_enter
exit = R.anim.retro_fragment_open_exit
popEnter = R.anim.retro_fragment_close_enter
popExit = R.anim.retro_fragment_close_exit
}
}
}
private val appBarConfiguration by lazy {
AppBarConfiguration(
setOf(
R.id.libraryFragment,
R.id.settingsFragment,
R.id.searchFragment
)
)
}
override fun onViewCreated(view: View, savedInstanceState: Bundle?) { override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState) super.onViewCreated(view, savedInstanceState)
setHasOptionsMenu(true) setHasOptionsMenu(true)
@ -50,18 +27,6 @@ class LibraryFragment : MainActivityFragment(R.layout.fragment_library) {
private fun setupNavigationController() { private fun setupNavigationController() {
val navController = findNavController(R.id.fragment_container) val navController = findNavController(R.id.fragment_container)
val navOptions = navOptions {
launchSingleTop = true
anim {
enter = R.anim.retro_fragment_open_enter
exit = R.anim.retro_fragment_open_exit
popEnter = R.anim.retro_fragment_close_enter
popExit = R.anim.retro_fragment_close_exit
}
popUpTo(navController.graph.startDestination) {
inclusive = true
}
}
mainActivity.getBottomNavigationView().setOnNavigationItemSelectedListener { mainActivity.getBottomNavigationView().setOnNavigationItemSelectedListener {
var handled = false var handled = false
if (navController.graph.findNode(it.itemId) != null) { if (navController.graph.findNode(it.itemId) != null) {

View file

@ -18,6 +18,7 @@ import kotlinx.android.synthetic.main.fragment_player_album_cover.*
class PlayerAlbumCoverFragment : AbsMusicServiceFragment(R.layout.fragment_player_album_cover), class PlayerAlbumCoverFragment : AbsMusicServiceFragment(R.layout.fragment_player_album_cover),
ViewPager.OnPageChangeListener { ViewPager.OnPageChangeListener {
private var callbacks: Callbacks? = null private var callbacks: Callbacks? = null
private var currentPosition: Int = 0 private var currentPosition: Int = 0
private val colorReceiver = object : AlbumCoverFragment.ColorReceiver { private val colorReceiver = object : AlbumCoverFragment.ColorReceiver {

View file

@ -8,12 +8,13 @@ import android.widget.FrameLayout
import android.widget.TextView import android.widget.TextView
import androidx.appcompat.widget.Toolbar import androidx.appcompat.widget.Toolbar
import androidx.core.os.bundleOf import androidx.core.os.bundleOf
import androidx.navigation.findNavController
import code.name.monkey.appthemehelper.util.ToolbarContentTintHelper import code.name.monkey.appthemehelper.util.ToolbarContentTintHelper
import code.name.monkey.retromusic.EXTRA_ARTIST_ID import code.name.monkey.retromusic.EXTRA_ARTIST_ID
import code.name.monkey.retromusic.R import code.name.monkey.retromusic.R
import code.name.monkey.retromusic.extensions.findActivityNavController
import code.name.monkey.retromusic.extensions.hide import code.name.monkey.retromusic.extensions.hide
import code.name.monkey.retromusic.extensions.show import code.name.monkey.retromusic.extensions.show
import code.name.monkey.retromusic.extensions.whichFragment
import code.name.monkey.retromusic.fragments.base.AbsPlayerFragment import code.name.monkey.retromusic.fragments.base.AbsPlayerFragment
import code.name.monkey.retromusic.fragments.player.PlayerAlbumCoverFragment import code.name.monkey.retromusic.fragments.player.PlayerAlbumCoverFragment
import code.name.monkey.retromusic.glide.ArtistGlideRequest import code.name.monkey.retromusic.glide.ArtistGlideRequest
@ -151,7 +152,8 @@ class FullPlayerFragment : AbsPlayerFragment(R.layout.fragment_full),
private fun setupArtist() { private fun setupArtist() {
artistImage.setOnClickListener { artistImage.setOnClickListener {
requireActivity().findNavController(R.id.fragment_container) mainActivity.collapsePanel()
findActivityNavController(R.id.fragment_container)
.navigate( .navigate(
R.id.artistDetailsFragment, R.id.artistDetailsFragment,
bundleOf(EXTRA_ARTIST_ID to MusicPlayerRemote.currentSong.artistId) bundleOf(EXTRA_ARTIST_ID to MusicPlayerRemote.currentSong.artistId)
@ -160,13 +162,10 @@ class FullPlayerFragment : AbsPlayerFragment(R.layout.fragment_full),
} }
private fun setUpSubFragments() { private fun setUpSubFragments() {
controlsFragment = controlsFragment = whichFragment(R.id.playbackControlsFragment)
childFragmentManager.findFragmentById(R.id.playbackControlsFragment) as FullPlaybackControlsFragment val coverFragment: PlayerAlbumCoverFragment = whichFragment(R.id.playerAlbumCoverFragment)
coverFragment.setCallbacks(this)
val playerAlbumCoverFragment = coverFragment.removeSlideEffect()
childFragmentManager.findFragmentById(R.id.playerAlbumCoverFragment) as PlayerAlbumCoverFragment
playerAlbumCoverFragment.setCallbacks(this)
playerAlbumCoverFragment.removeSlideEffect()
} }
override fun onShow() { override fun onShow() {

View file

@ -13,7 +13,7 @@ import code.name.monkey.retromusic.adapter.song.OrderablePlaylistSongAdapter
import code.name.monkey.retromusic.adapter.song.SongAdapter import code.name.monkey.retromusic.adapter.song.SongAdapter
import code.name.monkey.retromusic.extensions.dipToPix import code.name.monkey.retromusic.extensions.dipToPix
import code.name.monkey.retromusic.extensions.extraNotNull import code.name.monkey.retromusic.extensions.extraNotNull
import code.name.monkey.retromusic.fragments.MainActivityFragment import code.name.monkey.retromusic.fragments.base.AbsMainActivityFragment
import code.name.monkey.retromusic.model.AbsCustomPlaylist import code.name.monkey.retromusic.model.AbsCustomPlaylist
import code.name.monkey.retromusic.model.Playlist import code.name.monkey.retromusic.model.Playlist
import code.name.monkey.retromusic.model.Song import code.name.monkey.retromusic.model.Song
@ -21,11 +21,11 @@ import code.name.monkey.retromusic.util.PlaylistsUtil
import com.h6ah4i.android.widget.advrecyclerview.animator.RefactoredDefaultItemAnimator import com.h6ah4i.android.widget.advrecyclerview.animator.RefactoredDefaultItemAnimator
import com.h6ah4i.android.widget.advrecyclerview.draggable.RecyclerViewDragDropManager import com.h6ah4i.android.widget.advrecyclerview.draggable.RecyclerViewDragDropManager
import com.h6ah4i.android.widget.advrecyclerview.utils.WrapperAdapterUtils import com.h6ah4i.android.widget.advrecyclerview.utils.WrapperAdapterUtils
import kotlinx.android.synthetic.main.activity_playlist_detail.* import kotlinx.android.synthetic.main.fragment_playlist_detail.*
import org.koin.androidx.viewmodel.ext.android.viewModel import org.koin.androidx.viewmodel.ext.android.viewModel
import org.koin.core.parameter.parametersOf import org.koin.core.parameter.parametersOf
class PlaylistDetailsFragment : MainActivityFragment(R.layout.fragment_playlist_detail) { class PlaylistDetailsFragment : AbsMainActivityFragment(R.layout.fragment_playlist_detail) {
private val viewModel: PlaylistDetailsViewModel by viewModel { private val viewModel: PlaylistDetailsViewModel by viewModel {
parametersOf(extraNotNull<Playlist>(EXTRA_PLAYLIST).value) parametersOf(extraNotNull<Playlist>(EXTRA_PLAYLIST).value)
} }

View file

@ -18,15 +18,14 @@ import code.name.monkey.retromusic.R
import code.name.monkey.retromusic.adapter.SearchAdapter import code.name.monkey.retromusic.adapter.SearchAdapter
import code.name.monkey.retromusic.extensions.accentColor import code.name.monkey.retromusic.extensions.accentColor
import code.name.monkey.retromusic.extensions.showToast import code.name.monkey.retromusic.extensions.showToast
import code.name.monkey.retromusic.fragments.MainActivityFragment import code.name.monkey.retromusic.fragments.base.AbsMainActivityFragment
import com.google.android.material.textfield.TextInputEditText import com.google.android.material.textfield.TextInputEditText
import kotlinx.android.synthetic.main.fragment_search.* import kotlinx.android.synthetic.main.fragment_search.*
import kotlinx.android.synthetic.main.fragment_search.view.*
import org.koin.android.ext.android.inject import org.koin.android.ext.android.inject
import java.util.* import java.util.*
import kotlin.collections.ArrayList import kotlin.collections.ArrayList
class SearchFragment : MainActivityFragment(R.layout.fragment_search), TextWatcher { class SearchFragment : AbsMainActivityFragment(R.layout.fragment_search), TextWatcher {
companion object { companion object {
const val QUERY = "query" const val QUERY = "query"
const val REQ_CODE_SPEECH_INPUT = 9001 const val REQ_CODE_SPEECH_INPUT = 9001
@ -41,6 +40,7 @@ class SearchFragment : MainActivityFragment(R.layout.fragment_search), TextWatch
mainActivity.setSupportActionBar(toolbar) mainActivity.setSupportActionBar(toolbar)
mainActivity.hideBottomNavigation() mainActivity.hideBottomNavigation()
mainActivity.setBottomBarVisibility(View.GONE) mainActivity.setBottomBarVisibility(View.GONE)
setupRecyclerView() setupRecyclerView()
setupSearchView() setupSearchView()
voiceSearch.setOnClickListener { startMicSearch() } voiceSearch.setOnClickListener { startMicSearch() }

View file

@ -5,10 +5,10 @@ import android.view.View
import androidx.navigation.NavController import androidx.navigation.NavController
import code.name.monkey.retromusic.R import code.name.monkey.retromusic.R
import code.name.monkey.retromusic.extensions.findNavController import code.name.monkey.retromusic.extensions.findNavController
import code.name.monkey.retromusic.fragments.MainActivityFragment import code.name.monkey.retromusic.fragments.base.AbsMainActivityFragment
import kotlinx.android.synthetic.main.fragment_settings.* import kotlinx.android.synthetic.main.fragment_settings.*
class SettingsFragment : MainActivityFragment(R.layout.fragment_settings) { class SettingsFragment : AbsMainActivityFragment(R.layout.fragment_settings) {
override fun onViewCreated(view: View, savedInstanceState: Bundle?) { override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState) super.onViewCreated(view, savedInstanceState)

View file

@ -0,0 +1,140 @@
<?xml version="1.0" encoding="utf-8"?>
<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:background="?attr/colorSurface"
android:orientation="vertical"
tools:ignore="UnusedAttribute">
<FrameLayout
android:id="@+id/statusBarContainer"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
<include layout="@layout/status_bar" />
</FrameLayout>
<FrameLayout
android:id="@+id/toolbarContainer"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/statusBarContainer">
<com.google.android.material.appbar.MaterialToolbar
android:id="@+id/toolbar"
style="@style/Toolbar"
app:navigationIcon="@drawable/ic_keyboard_backspace_black" />
<ViewStub
android:id="@+id/cab_stub"
android:layout_width="match_parent"
android:layout_height="48dp" />
</FrameLayout>
<com.google.android.material.card.MaterialCardView
android:id="@+id/albumCoverContainer"
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_marginStart="16dp"
android:layout_marginTop="8dp"
android:layout_marginEnd="16dp"
android:transitionName="@string/transition_album_art"
app:cardCornerRadius="24dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toStartOf="@+id/container"
app:layout_constraintHorizontal_bias="0.5"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/toolbarContainer">
<androidx.appcompat.widget.AppCompatImageView
android:id="@+id/image"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scaleType="centerCrop"
tools:srcCompat="@tools:sample/backgrounds/scenic[5]" />
</com.google.android.material.card.MaterialCardView>
<androidx.core.widget.NestedScrollView
android:id="@+id/container"
android:layout_width="0dp"
android:layout_height="0dp"
android:fillViewport="true"
android:overScrollMode="never"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.5"
app:layout_constraintStart_toEndOf="@+id/albumCoverContainer"
app:layout_constraintTop_toBottomOf="@id/toolbarContainer">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:orientation="horizontal">
<code.name.monkey.retromusic.views.RetroShapeableImageView
android:id="@+id/artistImage"
android:layout_width="52dp"
android:layout_height="52dp"
android:layout_marginStart="8dp"
android:scaleType="centerCrop"
app:retroCornerSize="26dp"
tools:srcCompat="@tools:sample/backgrounds/scenic[11]" />
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:layout_weight="1"
android:orientation="vertical"
android:paddingStart="12dp"
android:paddingEnd="12dp"
android:paddingBottom="8dp">
<code.name.monkey.retromusic.views.BaselineGridTextView
android:id="@+id/albumTitle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:maxLines="2"
android:textAppearance="@style/TextViewHeadline5"
android:textStyle="bold"
app:lineHeightHint="28sp"
tools:ignore="MissingPrefix"
tools:text="Album name" />
<code.name.monkey.retromusic.views.BaselineGridTextView
android:id="@+id/albumText"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:ellipsize="end"
android:paddingTop="4dp"
android:singleLine="true"
android:textAppearance="@style/TextViewSubtitle2"
android:textColor="?android:attr/textColorSecondary"
app:lineHeightHint="24sp"
tools:ignore="MissingPrefix"
tools:text="Album details name" />
</LinearLayout>
</LinearLayout>
<include layout="@layout/activity_album_content" />
</LinearLayout>
</androidx.core.widget.NestedScrollView>
</androidx.constraintlayout.widget.ConstraintLayout>

View file

@ -0,0 +1,119 @@
<?xml version="1.0" encoding="utf-8"?>
<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:background="?attr/colorSurface"
android:orientation="vertical"
tools:ignore="UnusedAttribute">
<FrameLayout
android:id="@+id/statusBarContainer"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
<include layout="@layout/status_bar" />
</FrameLayout>
<FrameLayout
android:id="@+id/toolbarContainer"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/statusBarContainer">
<com.google.android.material.appbar.MaterialToolbar
android:id="@+id/toolbar"
style="@style/Toolbar"
app:navigationIcon="@drawable/ic_keyboard_backspace_black" />
<ViewStub
android:id="@+id/cab_stub"
android:layout_width="match_parent"
android:layout_height="48dp" />
</FrameLayout>
<com.google.android.material.card.MaterialCardView
android:id="@+id/artistCoverContainer"
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_marginStart="16dp"
android:layout_marginTop="8dp"
android:layout_marginEnd="16dp"
android:transitionName="@string/transition_artist_image"
app:cardCornerRadius="24dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toStartOf="@+id/container"
app:layout_constraintHorizontal_bias="0.5"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/toolbarContainer">
<androidx.appcompat.widget.AppCompatImageView
android:id="@+id/image"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scaleType="centerCrop"
tools:srcCompat="@tools:sample/backgrounds/scenic[5]" />
</com.google.android.material.card.MaterialCardView>
<androidx.core.widget.NestedScrollView
android:id="@+id/container"
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_weight="1"
android:overScrollMode="never"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.5"
app:layout_constraintStart_toEndOf="@+id/artistCoverContainer"
app:layout_constraintTop_toBottomOf="@id/toolbarContainer">
<LinearLayout
android:id="@+id/background"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:padding="16dp">
<code.name.monkey.retromusic.views.BaselineGridTextView
android:id="@+id/artistTitle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:maxLines="2"
android:textAppearance="@style/TextViewHeadline5"
android:textColor="?android:attr/textColorPrimary"
android:textStyle="bold"
tools:ignore="MissingPrefix"
tools:text="Title" />
<code.name.monkey.retromusic.views.BaselineGridTextView
android:id="@+id/text"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingTop="4dp"
android:textAppearance="@style/TextViewSubtitle2"
android:textColor="?android:attr/textColorSecondary"
app:lineHeightHint="24sp"
tools:ignore="MissingPrefix"
tools:text="Title" />
</LinearLayout>
<include layout="@layout/activity_artist_content" />
</LinearLayout>
</androidx.core.widget.NestedScrollView>
</androidx.constraintlayout.widget.ConstraintLayout>

View file

@ -105,7 +105,7 @@
app:layout_constraintStart_toEndOf="@id/artistImage" app:layout_constraintStart_toEndOf="@id/artistImage"
app:layout_constraintTop_toTopOf="@id/artistImage" app:layout_constraintTop_toTopOf="@id/artistImage"
tools:ignore="MissingPrefix" tools:ignore="MissingPrefix"
tools:text="@tools:sample/lorem/random" /> tools:text="@tools:sample/full_names" />
<code.name.monkey.retromusic.views.BaselineGridTextView <code.name.monkey.retromusic.views.BaselineGridTextView
android:id="@+id/albumText" android:id="@+id/albumText"
@ -123,7 +123,7 @@
app:layout_constraintTop_toBottomOf="@id/albumTitle" app:layout_constraintTop_toBottomOf="@id/albumTitle"
app:lineHeightHint="24sp" app:lineHeightHint="24sp"
tools:ignore="MissingPrefix" tools:ignore="MissingPrefix"
tools:text="@tools:sample/lorem/random" /> tools:text="@tools:sample/full_names" />
<include <include

View file

@ -83,7 +83,7 @@
android:layout_width="52dp" android:layout_width="52dp"
android:layout_height="52dp" android:layout_height="52dp"
android:layout_marginStart="16dp" android:layout_marginStart="16dp"
android:layout_marginTop="28dp" android:layout_marginTop="16dp"
android:scaleType="centerCrop" android:scaleType="centerCrop"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/albumCoverContainer" app:layout_constraintTop_toBottomOf="@id/albumCoverContainer"
@ -97,7 +97,7 @@
android:layout_marginStart="16dp" android:layout_marginStart="16dp"
android:layout_marginEnd="16dp" android:layout_marginEnd="16dp"
android:maxLines="3" android:maxLines="3"
android:textAppearance="@style/TextViewHeadline5" android:textAppearance="@style/TextViewHeadline4"
android:textColor="?android:attr/textColorPrimary" android:textColor="?android:attr/textColorPrimary"
android:textStyle="bold" android:textStyle="bold"
app:layout_constrainedWidth="true" app:layout_constrainedWidth="true"
@ -125,12 +125,11 @@
tools:ignore="MissingPrefix" tools:ignore="MissingPrefix"
tools:text="@tools:sample/lorem/random" /> tools:text="@tools:sample/lorem/random" />
<include <include
layout="@layout/activity_album_content" layout="@layout/activity_album_content"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="8dp" android:layout_marginTop="12dp"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/albumText" /> app:layout_constraintTop_toBottomOf="@+id/albumText" />

View file

@ -77,7 +77,6 @@
</com.google.android.material.card.MaterialCardView> </com.google.android.material.card.MaterialCardView>
<code.name.monkey.retromusic.views.BaselineGridTextView <code.name.monkey.retromusic.views.BaselineGridTextView
android:id="@+id/artistTitle" android:id="@+id/artistTitle"
android:layout_width="0dp" android:layout_width="0dp"
@ -86,7 +85,7 @@
android:layout_marginTop="24dp" android:layout_marginTop="24dp"
android:layout_marginEnd="16dp" android:layout_marginEnd="16dp"
android:maxLines="2" android:maxLines="2"
android:textAppearance="@style/TextViewHeadline5" android:textAppearance="@style/TextViewHeadline4"
android:textColor="?android:attr/textColorPrimary" android:textColor="?android:attr/textColorPrimary"
android:textStyle="bold" android:textStyle="bold"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"

View file

@ -22,7 +22,7 @@
</FrameLayout> </FrameLayout>
<androidx.fragment.app.FragmentContainerView <fragment
android:id="@+id/playerAlbumCoverFragment" android:id="@+id/playerAlbumCoverFragment"
android:name="code.name.monkey.retromusic.fragments.player.PlayerAlbumCoverFragment" android:name="code.name.monkey.retromusic.fragments.player.PlayerAlbumCoverFragment"
android:layout_width="0dp" android:layout_width="0dp"
@ -32,7 +32,7 @@
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/statusBarContainer" /> app:layout_constraintTop_toBottomOf="@id/statusBarContainer" />
<androidx.fragment.app.FragmentContainerView <fragment
android:id="@+id/playbackControlsFragment" android:id="@+id/playbackControlsFragment"
android:name="code.name.monkey.retromusic.fragments.player.material.MaterialControlsFragment" android:name="code.name.monkey.retromusic.fragments.player.material.MaterialControlsFragment"
android:layout_width="0dp" android:layout_width="0dp"

View file

@ -24,7 +24,7 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:background="?attr/colorSurface" android:background="?attr/colorSurface"
app:behavior_hideable="false" app:behavior_hideable="true"
app:behavior_peekHeight="0dp" app:behavior_peekHeight="0dp"
app:layout_behavior="code.name.monkey.retromusic.RetroBottomSheetBehavior"> app:layout_behavior="code.name.monkey.retromusic.RetroBottomSheetBehavior">

View file

@ -8,7 +8,7 @@
<fragment <fragment
android:id="@+id/action_album" android:id="@+id/action_album"
android:name="code.name.monkey.retromusic.fragments.albums.AlbumsFragment" android:name="code.name.monkey.retromusic.fragments.albums.AlbumsFragment"
tools:layout="@layout/fragment_main_activity_recycler_view" /> tools:layout="@layout/fragment_main_activity_recycler_view"/>
<fragment <fragment
android:id="@+id/action_artist" android:id="@+id/action_artist"
@ -44,4 +44,5 @@
android:id="@+id/action_home" android:id="@+id/action_home"
android:name="code.name.monkey.retromusic.fragments.home.HomeFragment" android:name="code.name.monkey.retromusic.fragments.home.HomeFragment"
tools:layout="@layout/fragment_banner_home" /> tools:layout="@layout/fragment_banner_home" />
</navigation> </navigation>

View file

@ -1,3 +1,7 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<changeBounds xmlns:android="http://schemas.android.com/apk/res/android" <transitionSet>
android:interpolator="@android:interpolator/fast_out_slow_in" /> <changeBounds/>
<changeTransform/>
<changeClipBounds/>
<changeImageTransform/>
</transitionSet>