style: remove android string references
Remove references to android system strings, in favor of in-house translations. Previously Auxio would use the `android.R.string.ok` and `android.R.string.cancel` strings to represent Ok and Cancel respectively, but these system strings are actually untranslated on some devices, so it is better for i18n if we use our own strings for such.
This commit is contained in:
@@ -186,7 +186,7 @@ class MainFragment : ViewBindingFragment<FragmentMainBinding>() {
|
||||
|
||||
/**
|
||||
* A back press callback that handles how to respond to backwards navigation in the detail
|
||||
* fragments and the playback panel.
|
||||
* fragments and the playback panel. TODO: Migrate to new predictive API
|
||||
*/
|
||||
inner class DynamicBackPressedCallback : OnBackPressedCallback(false) {
|
||||
override fun handleOnBackPressed() {
|
||||
|
||||
@@ -32,8 +32,7 @@ import org.oxycblt.auxio.util.logD
|
||||
import org.oxycblt.auxio.util.requireAttached
|
||||
|
||||
/**
|
||||
* The dialog for customizing library tabs. This dialog does not rely on any specific ViewModel and
|
||||
* serializes it's state instead of
|
||||
* The dialog for customizing library tabs.
|
||||
* @author OxygenCobalt
|
||||
*/
|
||||
class TabCustomizeDialog : ViewBindingDialogFragment<DialogTabsBinding>(), TabAdapter.Listener {
|
||||
@@ -46,14 +45,10 @@ class TabCustomizeDialog : ViewBindingDialogFragment<DialogTabsBinding>(), TabAd
|
||||
|
||||
override fun onConfigDialog(builder: AlertDialog.Builder) {
|
||||
builder.setTitle(R.string.set_lib_tabs)
|
||||
|
||||
builder.setPositiveButton(android.R.string.ok) { _, _ ->
|
||||
.setPositiveButton(R.string.lbl_ok) { _, _ ->
|
||||
logD("Committing tab changes")
|
||||
settingsManager.libTabs = tabAdapter.data.tabs
|
||||
}
|
||||
|
||||
// Negative button just dismisses, no need for a listener.
|
||||
builder.setNegativeButton(android.R.string.cancel, null)
|
||||
}.setNegativeButton(R.string.lbl_cancel, null)
|
||||
}
|
||||
|
||||
override fun onBindingCreated(binding: DialogTabsBinding, savedInstanceState: Bundle?) {
|
||||
|
||||
@@ -30,7 +30,9 @@ import org.oxycblt.auxio.util.requireBackgroundThread
|
||||
* Database for storing excluded directories. Note that the paths stored here will not work with
|
||||
* MediaStore unless you append a "%" at the end. Yes. I know Room exists. But that would needlessly
|
||||
* bloat my app and has crippling bugs.
|
||||
* @author OxygenCobalt TODO: Migrate this to SharedPreferences?
|
||||
* @author OxygenCobalt
|
||||
*
|
||||
* TODO: Migrate this to SharedPreferences?
|
||||
*/
|
||||
class ExcludedDatabase(context: Context) : SQLiteOpenHelper(context, DB_NAME, null, DB_VERSION) {
|
||||
override fun onCreate(db: SQLiteDatabase) {
|
||||
|
||||
@@ -53,12 +53,11 @@ class ExcludedDialog :
|
||||
override fun onCreateBinding(inflater: LayoutInflater) = DialogExcludedBinding.inflate(inflater)
|
||||
|
||||
override fun onConfigDialog(builder: AlertDialog.Builder) {
|
||||
builder.setTitle(R.string.set_excluded)
|
||||
|
||||
// Don't set the click listener here, we do some custom black magic in onCreateView instead.
|
||||
builder.setNeutralButton(R.string.lbl_add, null)
|
||||
builder.setPositiveButton(R.string.lbl_save, null)
|
||||
builder.setNegativeButton(android.R.string.cancel, null)
|
||||
builder.setTitle(R.string.set_excluded)
|
||||
.setNeutralButton(R.string.lbl_add, null)
|
||||
.setPositiveButton(R.string.lbl_save, null)
|
||||
.setNegativeButton(R.string.lbl_cancel, null)
|
||||
}
|
||||
|
||||
override fun onBindingCreated(binding: DialogExcludedBinding, savedInstanceState: Bundle?) {
|
||||
|
||||
@@ -34,6 +34,11 @@ import org.oxycblt.auxio.util.getAttrColorSafe
|
||||
import org.oxycblt.auxio.util.systemBarInsetsCompat
|
||||
import org.oxycblt.auxio.util.textSafe
|
||||
|
||||
/**
|
||||
* A fragment showing the current playback state in a compact manner. Placed at the bottom of the
|
||||
* screen. This expands into [PlaybackPanelFragment].
|
||||
* @author OxygenCobalt
|
||||
*/
|
||||
class PlaybackBarFragment : ViewBindingFragment<FragmentPlaybackBarBinding>() {
|
||||
private val playbackModel: PlaybackViewModel by activityViewModels()
|
||||
private val navModel: NavigationViewModel by activityViewModels()
|
||||
|
||||
+3
-3
@@ -33,7 +33,7 @@ import org.oxycblt.auxio.util.textSafe
|
||||
* The dialog for customizing the ReplayGain pre-amp values.
|
||||
* @author OxygenCobalt
|
||||
*/
|
||||
class ReplayGainDialog : ViewBindingDialogFragment<DialogPreAmpBinding>() {
|
||||
class PreAmpCustomizeDialog : ViewBindingDialogFragment<DialogPreAmpBinding>() {
|
||||
private val settingsManager = SettingsManager.getInstance()
|
||||
|
||||
override fun onCreateBinding(inflater: LayoutInflater) = DialogPreAmpBinding.inflate(inflater)
|
||||
@@ -41,12 +41,12 @@ class ReplayGainDialog : ViewBindingDialogFragment<DialogPreAmpBinding>() {
|
||||
override fun onConfigDialog(builder: AlertDialog.Builder) {
|
||||
builder
|
||||
.setTitle(R.string.set_pre_amp)
|
||||
.setPositiveButton(android.R.string.ok) { _, _ ->
|
||||
.setPositiveButton(R.string.lbl_ok) { _, _ ->
|
||||
val binding = requireBinding()
|
||||
settingsManager.replayGainPreAmp =
|
||||
ReplayGainPreAmp(binding.withTagsSlider.value, binding.withoutTagsSlider.value)
|
||||
}
|
||||
.setNegativeButton(android.R.string.cancel, null)
|
||||
.setNegativeButton(R.string.lbl_cancel, null)
|
||||
}
|
||||
|
||||
override fun onBindingCreated(binding: DialogPreAmpBinding, savedInstanceState: Bundle?) {
|
||||
@@ -35,10 +35,12 @@ import org.oxycblt.auxio.util.logW
|
||||
import org.oxycblt.auxio.util.unlikelyToBeNull
|
||||
|
||||
/**
|
||||
* An [AudioProcessor] that automatically handles ReplayGain values and their amplification of the
|
||||
* audio stream. Instead of leveraging the volume attribute like other implementations, this system
|
||||
* manipulates the bitstream itself to modify the volume, which allows the use of positive
|
||||
* ReplayGain values.
|
||||
* An [AudioProcessor] that handles ReplayGain values and their amplification of the audio stream.
|
||||
* Instead of leveraging the volume attribute like other implementations, this system manipulates
|
||||
* the bitstream itself to modify the volume, which allows the use of positive ReplayGain values.
|
||||
*
|
||||
* Note that you must still give it a [Metadata] instance for it to function, which should be done
|
||||
* when the active track changes.
|
||||
*
|
||||
* @author OxygenCobalt
|
||||
*/
|
||||
@@ -59,9 +61,8 @@ class ReplayGainAudioProcessor : BaseAudioProcessor() {
|
||||
// --- REPLAYGAIN PARSING ---
|
||||
|
||||
/**
|
||||
* Updates the rough volume adjustment for [Metadata] with ReplayGain tags. This is
|
||||
* tangentially based off Vanilla Music's implementation, but has diverged to a significant
|
||||
* extent.
|
||||
* Updates the rough volume adjustment for [Metadata] with ReplayGain tags. This is tangentially
|
||||
* based off Vanilla Music's implementation, but has diverged to a significant extent.
|
||||
*/
|
||||
fun applyReplayGain(metadata: Metadata?) {
|
||||
if (settingsManager.replayGainMode == ReplayGainMode.OFF) {
|
||||
|
||||
@@ -33,8 +33,8 @@ import org.oxycblt.auxio.R
|
||||
import org.oxycblt.auxio.home.tabs.TabCustomizeDialog
|
||||
import org.oxycblt.auxio.music.excluded.ExcludedDialog
|
||||
import org.oxycblt.auxio.playback.PlaybackViewModel
|
||||
import org.oxycblt.auxio.playback.replaygain.ReplayGainDialog
|
||||
import org.oxycblt.auxio.playback.replaygain.ReplayGainMode
|
||||
import org.oxycblt.auxio.playback.replaygain.PreAmpCustomizeDialog
|
||||
import org.oxycblt.auxio.settings.pref.IntListPreference
|
||||
import org.oxycblt.auxio.settings.pref.IntListPreferenceDialog
|
||||
import org.oxycblt.auxio.ui.accent.AccentCustomizeDialog
|
||||
@@ -168,7 +168,8 @@ class SettingsListFragment : PreferenceFragmentCompat() {
|
||||
SettingsManager.KEY_PRE_AMP -> {
|
||||
onPreferenceClickListener =
|
||||
Preference.OnPreferenceClickListener {
|
||||
ReplayGainDialog().show(childFragmentManager, ReplayGainDialog.TAG)
|
||||
PreAmpCustomizeDialog()
|
||||
.show(childFragmentManager, PreAmpCustomizeDialog.TAG)
|
||||
true
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,6 +22,7 @@ import android.os.Bundle
|
||||
import androidx.preference.PreferenceDialogFragmentCompat
|
||||
import com.google.android.material.dialog.MaterialAlertDialogBuilder
|
||||
import org.oxycblt.auxio.BuildConfig
|
||||
import org.oxycblt.auxio.R
|
||||
|
||||
class IntListPreferenceDialog : PreferenceDialogFragmentCompat() {
|
||||
private val listPreference: IntListPreference
|
||||
@@ -35,7 +36,7 @@ class IntListPreferenceDialog : PreferenceDialogFragmentCompat() {
|
||||
val builder = MaterialAlertDialogBuilder(requireContext(), theme)
|
||||
builder.setTitle(listPreference.title)
|
||||
builder.setPositiveButton(null, null)
|
||||
builder.setNegativeButton(android.R.string.cancel, null)
|
||||
builder.setNegativeButton(R.string.lbl_cancel, null)
|
||||
builder.setSingleChoiceItems(listPreference.entries, listPreference.getValueIndex()) {
|
||||
_,
|
||||
index ->
|
||||
|
||||
@@ -42,7 +42,7 @@ class AccentCustomizeDialog :
|
||||
override fun onConfigDialog(builder: AlertDialog.Builder) {
|
||||
builder
|
||||
.setTitle(R.string.set_accent)
|
||||
.setPositiveButton(android.R.string.ok) { _, _ ->
|
||||
.setPositiveButton(R.string.lbl_ok) { _, _ ->
|
||||
if (accentAdapter.selectedAccent != settingsManager.accent) {
|
||||
logD("Applying new accent")
|
||||
settingsManager.accent = unlikelyToBeNull(accentAdapter.selectedAccent)
|
||||
@@ -51,9 +51,7 @@ class AccentCustomizeDialog :
|
||||
|
||||
dismiss()
|
||||
}
|
||||
|
||||
// Negative button just dismisses, no need for a listener.
|
||||
.setNegativeButton(android.R.string.cancel, null)
|
||||
.setNegativeButton(R.string.lbl_cancel, null)
|
||||
}
|
||||
|
||||
override fun onBindingCreated(binding: DialogAccentBinding, savedInstanceState: Bundle?) {
|
||||
|
||||
Reference in New Issue
Block a user