Update album artist navigation
Make it so that when an album is navigated to from an artist, navigation to the parent artist is disabled.
This commit is contained in:
parent
d5f28cf374
commit
35db7792bb
14 changed files with 80 additions and 48 deletions
27
app/src/debug/res/drawable-v24/ic_launcher_foreground.xml
Normal file
27
app/src/debug/res/drawable-v24/ic_launcher_foreground.xml
Normal file
|
@ -0,0 +1,27 @@
|
|||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:aapt="http://schemas.android.com/aapt"
|
||||
android:width="108dp"
|
||||
android:height="108dp"
|
||||
android:viewportWidth="108"
|
||||
android:viewportHeight="108">
|
||||
<path
|
||||
android:pathData="M54 29.83v28.333c-1.585-0.913-3.41-1.477-5.371-1.477-5.935 0-10.743 4.807-10.743 10.743 0 5.935 4.807 10.742 10.743 10.742 5.935 0 10.743-4.807 10.743-10.742V40.573h10.742V29.831z"
|
||||
android:strokeWidth="0.890156"
|
||||
android:strokeColor="#ffffff">
|
||||
<aapt:attr name="android:fillColor">
|
||||
<gradient
|
||||
android:endX="64.75"
|
||||
android:endY="28.5"
|
||||
android:startX="60"
|
||||
android:startY="61.5"
|
||||
android:type="linear">
|
||||
<item
|
||||
android:color="#2196f3"
|
||||
android:offset="0.0" />
|
||||
<item
|
||||
android:color="#90caf9"
|
||||
android:offset="1.0" />
|
||||
</gradient>
|
||||
</aapt:attr>
|
||||
</path>
|
||||
</vector>
|
|
@ -4,72 +4,71 @@
|
|||
android:width="108dp"
|
||||
android:viewportHeight="108"
|
||||
android:viewportWidth="108"
|
||||
android:alpha="0.5"
|
||||
xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<path android:fillColor="#111111"
|
||||
android:pathData="M0,0h108v108h-108z"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M9,0L9,108"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
android:strokeColor="#15FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M19,0L19,108"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
android:strokeColor="#15FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M29,0L29,108"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
android:strokeColor="#15FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M39,0L39,108"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
android:strokeColor="#15FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M49,0L49,108"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
android:strokeColor="#15FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M59,0L59,108"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
android:strokeColor="#15FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M69,0L69,108"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
android:strokeColor="#15FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M79,0L79,108"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
android:strokeColor="#15FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M89,0L89,108"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
android:strokeColor="#15FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M99,0L99,108"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
android:strokeColor="#15FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M0,9L108,9"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
android:strokeColor="#15FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M0,19L108,19"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
android:strokeColor="#15FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M0,29L108,29"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
android:strokeColor="#15FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M0,39L108,39"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
android:strokeColor="#15FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M0,49L108,49"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
android:strokeColor="#15FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M0,59L108,59"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
android:strokeColor="#15FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M0,69L108,69"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
android:strokeColor="#15FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M0,79L108,79"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
android:strokeColor="#15FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M0,89L108,89"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
android:strokeColor="#15FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M0,99L108,99"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
android:strokeColor="#15FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M19,29L89,29"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
android:strokeColor="#15FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M19,39L89,39"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
android:strokeColor="#15FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M19,49L89,49"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
android:strokeColor="#15FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M19,59L89,59"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
android:strokeColor="#15FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M19,69L89,69"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
android:strokeColor="#15FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M19,79L89,79"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
android:strokeColor="#15FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M29,19L29,89"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
android:strokeColor="#15FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M39,19L39,89"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
android:strokeColor="#15FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M49,19L49,89"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
android:strokeColor="#15FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M59,19L59,89"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
android:strokeColor="#15FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M69,19L69,89"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
android:strokeColor="#15FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M79,19L79,89"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
android:strokeColor="#15FFFFFF" android:strokeWidth="0.8"/>
|
||||
</vector>
|
||||
|
|
5
app/src/debug/res/mipmap-anydpi-v26/ic_launcher.xml
Normal file
5
app/src/debug/res/mipmap-anydpi-v26/ic_launcher.xml
Normal file
|
@ -0,0 +1,5 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<background android:drawable="@drawable/ic_launcher_background"/>
|
||||
<foreground android:drawable="@drawable/ic_launcher_foreground"/>
|
||||
</adaptive-icon>
|
BIN
app/src/debug/res/mipmap-hdpi/ic_launcher.png
Normal file
BIN
app/src/debug/res/mipmap-hdpi/ic_launcher.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 2 KiB |
BIN
app/src/debug/res/mipmap-mdpi/ic_launcher.png
Normal file
BIN
app/src/debug/res/mipmap-mdpi/ic_launcher.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.6 KiB |
BIN
app/src/debug/res/mipmap-xhdpi/ic_launcher.png
Normal file
BIN
app/src/debug/res/mipmap-xhdpi/ic_launcher.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.8 KiB |
BIN
app/src/debug/res/mipmap-xxhdpi/ic_launcher.png
Normal file
BIN
app/src/debug/res/mipmap-xxhdpi/ic_launcher.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 4.3 KiB |
BIN
app/src/debug/res/mipmap-xxxhdpi/ic_launcher.png
Normal file
BIN
app/src/debug/res/mipmap-xxxhdpi/ic_launcher.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 6.1 KiB |
|
@ -86,9 +86,7 @@ class AlbumDetailFragment : DetailFragment() {
|
|||
|
||||
detailModel.navToParent.observe(viewLifecycleOwner) {
|
||||
if (it) {
|
||||
if (args.fromArtist) {
|
||||
findNavController().navigateUp()
|
||||
} else {
|
||||
if (!args.fromArtist) {
|
||||
findNavController().navigate(
|
||||
AlbumDetailFragmentDirections.actionShowParentArtist(
|
||||
detailModel.currentAlbum.value!!.artist.id
|
||||
|
|
|
@ -12,6 +12,7 @@ import org.oxycblt.auxio.recycler.SortMode
|
|||
/**
|
||||
* ViewModel that stores data for the [DetailFragment]s, such as what they're showing & what
|
||||
* [SortMode] they are currently on.
|
||||
* TODO: Preserve previous backstack when doing playing item navigation
|
||||
*/
|
||||
class DetailViewModel : ViewModel() {
|
||||
private var mIsNavigating = false
|
||||
|
|
|
@ -9,7 +9,7 @@ import android.view.ViewGroup
|
|||
import androidx.activity.result.contract.ActivityResultContracts
|
||||
import androidx.core.content.ContextCompat
|
||||
import androidx.fragment.app.Fragment
|
||||
import androidx.fragment.app.activityViewModels
|
||||
import androidx.fragment.app.viewModels
|
||||
import androidx.navigation.fragment.findNavController
|
||||
import org.oxycblt.auxio.R
|
||||
import org.oxycblt.auxio.databinding.FragmentLoadingBinding
|
||||
|
@ -23,7 +23,8 @@ import org.oxycblt.auxio.music.processing.MusicLoader
|
|||
* @author OxygenCobalt
|
||||
*/
|
||||
class LoadingFragment : Fragment(R.layout.fragment_loading) {
|
||||
private val loadingModel: LoadingViewModel by activityViewModels {
|
||||
// LoadingViewModel is scoped to this fragment only
|
||||
private val loadingModel: LoadingViewModel by viewModels {
|
||||
LoadingViewModel.Factory(requireActivity().application)
|
||||
}
|
||||
|
||||
|
|
|
@ -86,7 +86,7 @@ class LoadingViewModel(private val app: Application) : ViewModel() {
|
|||
* Factory for [LoadingViewModel] instances.
|
||||
*/
|
||||
class Factory(private val application: Application) : ViewModelProvider.Factory {
|
||||
@Suppress("unchecked_cast")
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
override fun <T : ViewModel?> create(modelClass: Class<T>): T {
|
||||
if (modelClass.isAssignableFrom(LoadingViewModel::class.java)) {
|
||||
return LoadingViewModel(application) as T
|
||||
|
|
|
@ -17,12 +17,13 @@ import org.oxycblt.auxio.playback.PlaybackViewModel
|
|||
import org.oxycblt.auxio.playback.state.PlaybackMode
|
||||
|
||||
/**
|
||||
* A wrapper around [PopupMenu] that automates a ton of things across all the menus in Auxio
|
||||
* A wrapper around [PopupMenu] that automates the menu creation for nearly every datatype in Auxio.
|
||||
* @param activity [AppCompatActivity] required as both a context and ViewModelStore owner.
|
||||
* @param anchor [View] This should be centered around
|
||||
* @param data [BaseModel] this menu corresponds to
|
||||
* @param flag Any extra flags to accompany the data.
|
||||
* @param flag (Optional, defaults to [FLAG_NONE]) Any extra flags to accompany the data.
|
||||
* See [FLAG_NONE], [FLAG_IN_ALBUM], [FLAG_IN_ARTIST] and [FLAG_IN_GENRE] for more details.
|
||||
* @throws IllegalArgumentException When there is no menu for this specific datatype/flag
|
||||
*/
|
||||
class ActionMenu(
|
||||
activity: AppCompatActivity,
|
||||
|
@ -32,6 +33,7 @@ class ActionMenu(
|
|||
) : PopupMenu(activity, anchor) {
|
||||
private val context = activity.applicationContext
|
||||
|
||||
// Get viewmodels using the activity as the store owner
|
||||
private val detailModel: DetailViewModel by lazy {
|
||||
ViewModelProvider(activity).get(DetailViewModel::class.java)
|
||||
}
|
||||
|
@ -43,7 +45,9 @@ class ActionMenu(
|
|||
init {
|
||||
val menuRes = determineMenu()
|
||||
|
||||
check(menuRes != -1) { "There is no menu associated with this configuration." }
|
||||
check(menuRes != -1) {
|
||||
"There is no menu associated with datatype ${data::class.simpleName} and flag $flag"
|
||||
}
|
||||
|
||||
inflate(menuRes)
|
||||
setOnMenuItemClickListener {
|
||||
|
@ -158,11 +162,11 @@ class ActionMenu(
|
|||
companion object {
|
||||
/** No Flags **/
|
||||
const val FLAG_NONE = -1
|
||||
/** Flag for when an item is accessed from an artist **/
|
||||
/** Flag for when a menu is opened from an artist (See [org.oxycblt.auxio.detail.ArtistDetailFragment]) **/
|
||||
const val FLAG_IN_ARTIST = 0
|
||||
/** Flag for when an item is accessed from an album **/
|
||||
/** Flag for when a menu is opened from an album (See [org.oxycblt.auxio.detail.AlbumDetailFragment]) **/
|
||||
const val FLAG_IN_ALBUM = 1
|
||||
/** Flag or when an item is accessed from a genre **/
|
||||
/** Flag for when a menu is opened from a genre (See [org.oxycblt.auxio.detail.GenreDetailFragment]) **/
|
||||
const val FLAG_IN_GENRE = 2
|
||||
}
|
||||
}
|
||||
|
|
|
@ -55,9 +55,6 @@
|
|||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="@dimen/margin_medium"
|
||||
android:background="@drawable/ui_ripple"
|
||||
android:clickable="true"
|
||||
android:focusable="true"
|
||||
android:onClick="@{() -> detailModel.navToParent()}"
|
||||
android:text="@{album.artist.name}"
|
||||
android:textAppearance="?android:attr/textAppearanceListItem"
|
||||
|
|
Loading…
Reference in a new issue