info: update ARCHITECTURE
Update the ARCHITECTURE document to reflect the architectural changes made in 2.5.0.
This commit is contained in:
@@ -75,12 +75,12 @@ class HomeFragment : ViewBindingFragment<FragmentHomeBinding>(), Toolbar.OnMenuI
|
||||
private val playbackModel: PlaybackViewModel by androidActivityViewModels()
|
||||
private val navModel: NavigationViewModel by activityViewModels()
|
||||
private val homeModel: HomeViewModel by androidActivityViewModels()
|
||||
private val indexerModel: MusicViewModel by activityViewModels()
|
||||
private val musicModel: MusicViewModel by activityViewModels()
|
||||
|
||||
// lifecycleObject builds this in the creation step, so doing this is okay.
|
||||
private val storagePermissionLauncher: ActivityResultLauncher<String> by lifecycleObject {
|
||||
registerForActivityResult(ActivityResultContracts.RequestPermission()) {
|
||||
indexerModel.reindex()
|
||||
musicModel.reindex()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -142,8 +142,8 @@ class HomeFragment : ViewBindingFragment<FragmentHomeBinding>(), Toolbar.OnMenuI
|
||||
|
||||
collect(homeModel.recreateTabs, ::handleRecreateTabs)
|
||||
collectImmediately(homeModel.currentTab, ::updateCurrentTab)
|
||||
collectImmediately(indexerModel.libraryExists, homeModel.isFastScrolling, ::updateFab)
|
||||
collectImmediately(indexerModel.indexerState, ::handleIndexerState)
|
||||
collectImmediately(musicModel.libraryExists, homeModel.isFastScrolling, ::updateFab)
|
||||
collectImmediately(musicModel.indexerState, ::handleIndexerState)
|
||||
collect(navModel.exploreNavigationItem, ::handleNavigation)
|
||||
}
|
||||
|
||||
@@ -283,7 +283,7 @@ class HomeFragment : ViewBindingFragment<FragmentHomeBinding>(), Toolbar.OnMenuI
|
||||
binding.homeIndexingAction.apply {
|
||||
visibility = View.VISIBLE
|
||||
text = getString(R.string.lbl_retry)
|
||||
setOnClickListener { indexerModel.reindex() }
|
||||
setOnClickListener { musicModel.reindex() }
|
||||
}
|
||||
}
|
||||
is Indexer.Response.NoMusic -> {
|
||||
@@ -292,7 +292,7 @@ class HomeFragment : ViewBindingFragment<FragmentHomeBinding>(), Toolbar.OnMenuI
|
||||
binding.homeIndexingAction.apply {
|
||||
visibility = View.VISIBLE
|
||||
text = getString(R.string.lbl_retry)
|
||||
setOnClickListener { indexerModel.reindex() }
|
||||
setOnClickListener { musicModel.reindex() }
|
||||
}
|
||||
}
|
||||
is Indexer.Response.NoPerms -> {
|
||||
|
||||
@@ -46,6 +46,8 @@ import org.oxycblt.auxio.util.logD
|
||||
* You could probably do the same using WorkManager and the GooberQueue library or whatever, but the
|
||||
* boilerplate you skip is not worth the insanity of androidx.
|
||||
*
|
||||
* TODO: Add a wake-lock to the music loading process
|
||||
*
|
||||
* @author OxygenCobalt
|
||||
*/
|
||||
class IndexerService : Service(), Indexer.Controller, Settings.Callback {
|
||||
|
||||
@@ -29,13 +29,12 @@ enum class RepeatMode {
|
||||
TRACK;
|
||||
|
||||
/** Increment the mode, e.g from [NONE] to [ALL] */
|
||||
fun increment(): RepeatMode {
|
||||
return when (this) {
|
||||
fun increment() =
|
||||
when (this) {
|
||||
NONE -> ALL
|
||||
ALL -> TRACK
|
||||
TRACK -> NONE
|
||||
}
|
||||
}
|
||||
|
||||
/** The integer code representing this particular mode. */
|
||||
val intCode: Int
|
||||
@@ -48,13 +47,12 @@ enum class RepeatMode {
|
||||
|
||||
companion object {
|
||||
/** Convert an int [code] into an instance, or null if it isn't valid. */
|
||||
fun fromIntCode(code: Int): RepeatMode? {
|
||||
return when (code) {
|
||||
fun fromIntCode(code: Int) =
|
||||
when (code) {
|
||||
IntegerTable.REPEAT_MODE_NONE -> NONE
|
||||
IntegerTable.REPEAT_MODE_ALL -> ALL
|
||||
IntegerTable.REPEAT_MODE_TRACK -> TRACK
|
||||
else -> null
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -55,7 +55,7 @@ import org.oxycblt.auxio.util.systemBarInsetsCompat
|
||||
@Suppress("UNUSED")
|
||||
class SettingsListFragment : PreferenceFragmentCompat() {
|
||||
private val playbackModel: PlaybackViewModel by androidActivityViewModels()
|
||||
private val indexerModel: MusicViewModel by activityViewModels()
|
||||
private val musicModel: MusicViewModel by activityViewModels()
|
||||
|
||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||
super.onViewCreated(view, savedInstanceState)
|
||||
@@ -129,7 +129,7 @@ class SettingsListFragment : PreferenceFragmentCompat() {
|
||||
}
|
||||
}
|
||||
getString(R.string.set_key_reindex) -> {
|
||||
indexerModel.reindex()
|
||||
musicModel.reindex()
|
||||
}
|
||||
else -> return super.onPreferenceTreeClick(preference)
|
||||
}
|
||||
|
||||
@@ -2,6 +2,25 @@
|
||||
<resources xmlns:tools="http://schemas.android.com/tools">
|
||||
<!-- ANDROID COMPONENT-SPECIFIC STYLES.-->
|
||||
|
||||
<!--
|
||||
Hacks around the incorrectly-sized navigation icon in the Toolbar, changing it from
|
||||
56dp to 48dp.
|
||||
-->
|
||||
<style name="Widget.Auxio.Toolbar.Navigation" parent="Widget.AppCompat.Toolbar.Button.Navigation">
|
||||
<item name="android:minWidth">@dimen/size_btn</item>
|
||||
</style>
|
||||
|
||||
<!--
|
||||
Hacks around the old overflow button that was deliberately downsized to 36dp
|
||||
(presumably for compat with older devices)
|
||||
-->
|
||||
<style name="Widget.Auxio.Button.Overflow" parent="Widget.AppCompat.ActionButton.Overflow">
|
||||
<item name="android:minWidth">@dimen/size_btn</item>
|
||||
<item name="android:minHeight">@dimen/size_btn</item>
|
||||
<item name="android:paddingStart">0dp</item>
|
||||
<item name="android:paddingEnd">0dp</item>
|
||||
</style>
|
||||
|
||||
<style name="Theme.Auxio.Dialog" parent="ThemeOverlay.Material3.MaterialAlertDialog">
|
||||
<item name="android:checkedTextViewStyle">@style/Widget.Auxio.Dialog.CheckedTextView</item>
|
||||
</style>
|
||||
@@ -20,6 +39,7 @@
|
||||
<item name="android:scrollIndicators" tools:ignore="NewApi">top|bottom</item>
|
||||
</style>
|
||||
|
||||
|
||||
<!-- Widget TextView that mimics the main Auxio Primary/Secondary TextViews. -->
|
||||
<style name="Widget.Auxio.TextView.AppWidget" parent="Widget.Auxio.TextView.Base">
|
||||
<item name="android:singleLine">true</item>
|
||||
@@ -57,23 +77,4 @@
|
||||
<item name="android:padding">@dimen/spacing_medium</item>
|
||||
<item name="android:orientation">vertical</item>
|
||||
</style>
|
||||
|
||||
<!--
|
||||
Hacks around the incorrectly-sized navigation icon in the Toolbar, changing it from
|
||||
56dp to 48dp.
|
||||
-->
|
||||
<style name="Widget.Auxio.Toolbar.Navigation" parent="Widget.AppCompat.Toolbar.Button.Navigation">
|
||||
<item name="android:minWidth">@dimen/size_btn</item>
|
||||
</style>
|
||||
|
||||
<!--
|
||||
Hacks around the old overflow button that was deliberately downsized to 36dp
|
||||
(presumably for compat with older devices)
|
||||
-->
|
||||
<style name="Widget.Auxio.Button.Overflow" parent="Widget.AppCompat.ActionButton.Overflow">
|
||||
<item name="android:minWidth">@dimen/size_btn</item>
|
||||
<item name="android:minHeight">@dimen/size_btn</item>
|
||||
<item name="android:paddingStart">0dp</item>
|
||||
<item name="android:paddingEnd">0dp</item>
|
||||
</style>
|
||||
</resources>
|
||||
@@ -58,7 +58,6 @@
|
||||
<item name="textAppearanceBodySmall">@style/TextAppearance.Auxio.BodySmall</item>
|
||||
</style>
|
||||
|
||||
|
||||
<!--
|
||||
Theming widgets is technically possible below Android 12, but I *really* don't care enough
|
||||
to bother with it.
|
||||
|
||||
Reference in New Issue
Block a user