info: update

Update information in preparation for 2.6.1.
This commit is contained in:
OxygenCobalt
2022-08-10 14:31:16 -06:00
parent 6e60399d45
commit fc5274ebeb
34 changed files with 216 additions and 202 deletions
@@ -344,7 +344,7 @@ class HomeFragment : ViewBindingFragment<FragmentHomeBinding>(), Toolbar.OnMenuI
when (indexing) {
is Indexer.Indexing.Indeterminate -> {
binding.homeIndexingStatus.text = context.getString(R.string.lng_indexing_desc)
binding.homeIndexingStatus.text = context.getString(R.string.lng_indexing)
binding.homeIndexingProgress.isIndeterminate = true
}
is Indexer.Indexing.Songs -> {
@@ -36,13 +36,13 @@ fun ContentResolver.queryCursor(
) = query(uri, projection, selector, args, null)
/** Shortcut for making a [ContentResolver] query and using the particular cursor with [use]. */
fun <R> ContentResolver.useQuery(
inline fun <reified R> ContentResolver.useQuery(
uri: Uri,
projection: Array<out String>,
selector: String? = null,
args: Array<String>? = null,
block: (Cursor) -> R
): R? = queryCursor(uri, projection, selector, args)?.use(block)
) = queryCursor(uri, projection, selector, args)?.use(block)
/**
* For some reason the album cover URI namespace does not have a member in [MediaStore], but it
@@ -19,7 +19,6 @@ package org.oxycblt.auxio.music.system
import android.content.Context
import androidx.core.app.NotificationCompat
import androidx.core.app.NotificationManagerCompat
import org.oxycblt.auxio.BuildConfig
import org.oxycblt.auxio.IntegerTable
import org.oxycblt.auxio.R
@@ -37,8 +36,8 @@ class IndexingNotification(private val context: Context) :
setSilent(true)
setContentIntent(context.newMainPendingIntent())
setVisibility(NotificationCompat.VISIBILITY_PUBLIC)
setContentTitle(context.getString(R.string.lng_indexing))
setContentText(context.getString(R.string.lng_indexing_desc))
setContentTitle(context.getString(R.string.lbl_indexing))
setContentText(context.getString(R.string.lng_indexing))
setProgress(0, 0, true)
}
@@ -49,7 +48,7 @@ class IndexingNotification(private val context: Context) :
when (indexing) {
is Indexer.Indexing.Indeterminate -> {
logD("Updating state to $indexing")
setContentText(context.getString(R.string.lng_indexing_desc))
setContentText(context.getString(R.string.lng_indexing))
setProgress(0, 0, true)
return true
}
@@ -78,8 +77,8 @@ class ObservingNotification(context: Context) : ServiceNotification(context, IND
setSilent(true)
setContentIntent(context.newMainPendingIntent())
setVisibility(NotificationCompat.VISIBILITY_PUBLIC)
setContentTitle(context.getString(R.string.lng_observing))
setContentText(context.getString(R.string.lng_observing_desc))
setContentTitle(context.getString(R.string.lbl_observing))
setContentText(context.getString(R.string.lng_observing))
}
override val code: Int
@@ -88,6 +87,4 @@ class ObservingNotification(context: Context) : ServiceNotification(context, IND
private val INDEXER_CHANNEL =
ServiceNotification.ChannelInfo(
id = BuildConfig.APPLICATION_ID + ".channel.INDEXER",
R.string.info_indexer_channel_name,
NotificationManagerCompat.IMPORTANCE_LOW)
id = BuildConfig.APPLICATION_ID + ".channel.INDEXER", nameRes = R.string.lbl_indexer)
@@ -43,3 +43,11 @@ enum class ReplayGainMode {
}
}
}
/** Represents the ReplayGain pre-amp values. */
data class ReplayGainPreAmp(
/** The value to use when ReplayGain tags are present. */
val with: Float,
/** The value to use when ReplayGain tags are not present. */
val without: Float,
)
@@ -1,26 +0,0 @@
/*
* Copyright (c) 2022 Auxio Project
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package org.oxycblt.auxio.playback.replaygain
/** Represents the ReplayGain pre-amp values. */
data class ReplayGainPreAmp(
/** The value to use when ReplayGain tags are present. */
val with: Float,
/** The value to use when ReplayGain tags are not present. */
val without: Float,
)
@@ -24,7 +24,6 @@ import android.support.v4.media.MediaMetadataCompat
import android.support.v4.media.session.MediaSessionCompat
import androidx.annotation.DrawableRes
import androidx.core.app.NotificationCompat
import androidx.core.app.NotificationManagerCompat
import androidx.media.app.NotificationCompat.MediaStyle
import org.oxycblt.auxio.BuildConfig
import org.oxycblt.auxio.IntegerTable
@@ -146,7 +145,6 @@ class NotificationComponent(private val context: Context, sessionToken: MediaSes
val CHANNEL_INFO =
ChannelInfo(
id = BuildConfig.APPLICATION_ID + ".channel.PLAYBACK",
nameRes = R.string.info_playback_channel_name,
importance = NotificationManagerCompat.IMPORTANCE_LOW)
nameRes = R.string.lbl_playback)
}
}
@@ -120,7 +120,8 @@ class Settings(private val context: Context, private val callback: Callback? = n
/** Which action to display on the playback bar. */
val barAction: BarAction
get() =
BarAction.fromIntCode(inner.getInt(context.getString(R.string.set_key_bar_action), -1))
BarAction.fromIntCode(
inner.getInt(context.getString(R.string.set_key_bar_action), Int.MIN_VALUE))
?: BarAction.NEXT
/**
@@ -138,7 +139,7 @@ class Settings(private val context: Context, private val callback: Callback? = n
val replayGainMode: ReplayGainMode
get() =
ReplayGainMode.fromIntCode(
inner.getInt(context.getString(R.string.set_key_replay_gain), -1))
inner.getInt(context.getString(R.string.set_key_replay_gain), Int.MIN_VALUE))
?: ReplayGainMode.OFF
/** The current ReplayGain pre-amp configuration */
@@ -159,7 +160,8 @@ class Settings(private val context: Context, private val callback: Callback? = n
val libPlaybackMode: PlaybackMode
get() =
PlaybackMode.fromInt(
inner.getInt(context.getString(R.string.set_key_library_song_playback_mode), -1))
inner.getInt(
context.getString(R.string.set_key_library_song_playback_mode), Int.MIN_VALUE))
?: PlaybackMode.ALL_SONGS
/**
@@ -169,7 +171,8 @@ class Settings(private val context: Context, private val callback: Callback? = n
val detailPlaybackMode: PlaybackMode?
get() =
PlaybackMode.fromInt(
inner.getInt(context.getString(R.string.set_key_detail_song_playback_mode), -1))
inner.getInt(
context.getString(R.string.set_key_detail_song_playback_mode), Int.MIN_VALUE))
/** Whether shuffle should stay on when a new song is selected. */
val keepShuffle: Boolean
@@ -219,11 +222,14 @@ class Settings(private val context: Context, private val callback: Callback? = n
/** The current filter mode of the search tab */
var searchFilterMode: DisplayMode?
get() =
DisplayMode.fromInt(inner.getInt(context.getString(R.string.set_key_search_filter), -1))
DisplayMode.fromInt(
inner.getInt(context.getString(R.string.set_key_search_filter), Int.MIN_VALUE))
set(value) {
logD(value)
inner.edit {
putInt(context.getString(R.string.set_key_search_filter), value?.intCode ?: -1)
putInt(
context.getString(R.string.set_key_search_filter),
value?.intCode ?: Int.MIN_VALUE)
apply()
}
}
@@ -231,7 +237,8 @@ class Settings(private val context: Context, private val callback: Callback? = n
/** The song sort mode on HomeFragment */
var libSongSort: Sort
get() =
Sort.fromIntCode(inner.getInt(context.getString(R.string.set_key_lib_songs_sort), -1))
Sort.fromIntCode(
inner.getInt(context.getString(R.string.set_key_lib_songs_sort), Int.MIN_VALUE))
?: Sort(Sort.Mode.ByName, true)
set(value) {
inner.edit {
@@ -243,7 +250,8 @@ class Settings(private val context: Context, private val callback: Callback? = n
/** The album sort mode on HomeFragment */
var libAlbumSort: Sort
get() =
Sort.fromIntCode(inner.getInt(context.getString(R.string.set_key_lib_albums_sort), -1))
Sort.fromIntCode(
inner.getInt(context.getString(R.string.set_key_lib_albums_sort), Int.MIN_VALUE))
?: Sort(Sort.Mode.ByName, true)
set(value) {
inner.edit {
@@ -255,7 +263,8 @@ class Settings(private val context: Context, private val callback: Callback? = n
/** The artist sort mode on HomeFragment */
var libArtistSort: Sort
get() =
Sort.fromIntCode(inner.getInt(context.getString(R.string.set_key_lib_artists_sort), -1))
Sort.fromIntCode(
inner.getInt(context.getString(R.string.set_key_lib_artists_sort), Int.MIN_VALUE))
?: Sort(Sort.Mode.ByName, true)
set(value) {
inner.edit {
@@ -267,7 +276,8 @@ class Settings(private val context: Context, private val callback: Callback? = n
/** The genre sort mode on HomeFragment */
var libGenreSort: Sort
get() =
Sort.fromIntCode(inner.getInt(context.getString(R.string.set_key_lib_genres_sort), -1))
Sort.fromIntCode(
inner.getInt(context.getString(R.string.set_key_lib_genres_sort), Int.MIN_VALUE))
?: Sort(Sort.Mode.ByName, true)
set(value) {
inner.edit {
@@ -281,7 +291,8 @@ class Settings(private val context: Context, private val callback: Callback? = n
get() {
var sort =
Sort.fromIntCode(
inner.getInt(context.getString(R.string.set_key_detail_album_sort), -1))
inner.getInt(
context.getString(R.string.set_key_detail_album_sort), Int.MIN_VALUE))
?: Sort(Sort.Mode.ByDisc, true)
// Correct legacy album sort modes to Disc
@@ -302,7 +313,7 @@ class Settings(private val context: Context, private val callback: Callback? = n
var detailArtistSort: Sort
get() =
Sort.fromIntCode(
inner.getInt(context.getString(R.string.set_key_detail_artist_sort), -1))
inner.getInt(context.getString(R.string.set_key_detail_artist_sort), Int.MIN_VALUE))
?: Sort(Sort.Mode.ByYear, false)
set(value) {
inner.edit {
@@ -315,7 +326,7 @@ class Settings(private val context: Context, private val callback: Callback? = n
var detailGenreSort: Sort
get() =
Sort.fromIntCode(
inner.getInt(context.getString(R.string.set_key_detail_genre_sort), -1))
inner.getInt(context.getString(R.string.set_key_detail_genre_sort), Int.MIN_VALUE))
?: Sort(Sort.Mode.ByName, true)
set(value) {
inner.edit {
@@ -121,18 +121,18 @@ class SettingsListFragment : PreferenceFragmentCompat() {
when (preference.key) {
context.getString(R.string.set_key_save_state) -> {
playbackModel.savePlaybackState {
this.context?.showToast(R.string.lng_state_saved)
this.context?.showToast(R.string.lbl_state_saved)
}
}
context.getString(R.string.set_key_wipe_state) -> {
playbackModel.wipePlaybackState {
this.context?.showToast(R.string.lng_state_wiped)
this.context?.showToast(R.string.lbl_state_wiped)
}
}
context.getString(R.string.set_key_restore_state) ->
playbackModel.tryRestorePlaybackState { restored ->
if (restored) {
this.context?.showToast(R.string.lng_state_restored)
this.context?.showToast(R.string.lbl_state_restored)
} else {
this.context?.showToast(R.string.err_did_not_restore)
}
@@ -17,13 +17,11 @@
package org.oxycblt.auxio.ui.system
import android.app.NotificationChannel
import android.app.NotificationManager
import android.content.Context
import android.os.Build
import androidx.annotation.StringRes
import androidx.core.app.NotificationChannelCompat
import androidx.core.app.NotificationCompat
import org.oxycblt.auxio.util.getSystemServiceCompat
import androidx.core.app.NotificationManagerCompat
/**
* Wrapper around [NotificationCompat.Builder] that automates parts of the notification setup, under
@@ -32,15 +30,18 @@ import org.oxycblt.auxio.util.getSystemServiceCompat
*/
abstract class ServiceNotification(context: Context, info: ChannelInfo) :
NotificationCompat.Builder(context, info.id) {
private val notificationManager = context.getSystemServiceCompat(NotificationManager::class)
private val notificationManager = NotificationManagerCompat.from(context)
init {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
val channel =
NotificationChannel(info.id, context.getString(info.nameRes), info.importance)
val channel =
NotificationChannelCompat.Builder(info.id, NotificationManagerCompat.IMPORTANCE_LOW)
.setName(context.getString(info.nameRes))
.setLightsEnabled(false)
.setVibrationEnabled(false)
.setShowBadge(false)
.build()
notificationManager.createNotificationChannel(channel)
}
notificationManager.createNotificationChannel(channel)
}
abstract val code: Int
@@ -49,5 +50,5 @@ abstract class ServiceNotification(context: Context, info: ChannelInfo) :
notificationManager.notify(code, build())
}
data class ChannelInfo(val id: String, @StringRes val nameRes: Int, val importance: Int)
data class ChannelInfo(val id: String, @StringRes val nameRes: Int)
}