Add ru [Russian] translations

Add partial translations for Russian, along with some new translations for other languages.
This commit is contained in:
OxygenCobalt
2021-01-27 18:58:35 -07:00
parent 2099453d01
commit d98d41102d
13 changed files with 127 additions and 20 deletions
@@ -38,7 +38,7 @@ class MusicLoader(private val app: Application) {
return Response.FAILED
}
if (songs.size == 0) {
if (songs.isEmpty()) {
return Response.NO_MUSIC
}
@@ -502,7 +502,7 @@ class PlaybackService : Service(), Player.EventListener, PlaybackStateManager.Ca
/**
* A [BroadcastReceiver] for receiving system events from the media notification or the headset.
*/
inner class SystemEventReceiver : BroadcastReceiver() {
private inner class SystemEventReceiver : BroadcastReceiver() {
override fun onReceive(context: Context, intent: Intent) {
val action = intent.action
@@ -7,6 +7,7 @@ import androidx.lifecycle.Transformations
import androidx.lifecycle.ViewModel
import androidx.lifecycle.viewModelScope
import kotlinx.coroutines.launch
import org.oxycblt.auxio.R
import org.oxycblt.auxio.logD
import org.oxycblt.auxio.logE
import org.oxycblt.auxio.music.Album
@@ -21,6 +22,7 @@ import org.oxycblt.auxio.playback.state.PlaybackMode
import org.oxycblt.auxio.playback.state.PlaybackStateManager
import org.oxycblt.auxio.recycler.SortMode
import org.oxycblt.auxio.settings.SettingsManager
import org.oxycblt.auxio.ui.createToast
/**
* The ViewModel that provides a UI frontend for [PlaybackStateManager].
@@ -315,6 +317,8 @@ class PlaybackViewModel : ViewModel(), PlaybackStateManager.Callback {
fun save(context: Context) {
viewModelScope.launch {
playbackManager.saveStateToDatabase(context)
context.getString(R.string.debug_state_saved).createToast(context)
}
}
@@ -21,7 +21,6 @@ import org.oxycblt.auxio.recycler.DisplayMode
import org.oxycblt.auxio.settings.ui.AccentAdapter
import org.oxycblt.auxio.ui.ACCENTS
import org.oxycblt.auxio.ui.Accent
import org.oxycblt.auxio.ui.createToast
/**
* The actual fragment containing the settings menu. Inherits [PreferenceFragmentCompat].
@@ -134,7 +133,6 @@ class SettingsListFragment : PreferenceFragmentCompat() {
SettingsManager.Keys.KEY_DEBUG_SAVE -> {
onPreferenceClickListener = Preference.OnPreferenceClickListener {
playbackModel.save(requireContext())
getString(R.string.debug_state_saved).createToast(requireContext())
true
}
@@ -25,6 +25,8 @@ import com.google.android.material.button.MaterialButton
import org.oxycblt.auxio.R
import org.oxycblt.auxio.logE
// A Variety of shortcut, convenience, hacks, and extension functions used across Auxio.
// --- VIEW CONFIGURATION ---
/**
@@ -48,17 +50,17 @@ fun TextView.setTextColorResource(@ColorRes color: Int) {
}
/**
* Apply accents to a [MaterialButton]
* Apply accents to a [MaterialButton] manually.
* Yes, I could change my theming to Material but that would have so many second-and-third order
* effects that I *really* dont want to deal with it. This hack works.
* @param highlighted Whether the MaterialButton has an "Unimportant" style or not.
* Required because you cant determine a style of a view before API 29
*/
fun MaterialButton.applyAccents(highlighted: Boolean) {
val accent = Accent.get().color.toColor(context)
if (highlighted) {
backgroundTintList = ColorStateList.valueOf(accent)
backgroundTintList = Accent.get().color.toStateList(context)
} else {
setTextColor(accent)
setTextColor(Accent.get().color.toColor(context))
}
}
@@ -84,7 +86,7 @@ fun String.createToast(context: Context) {
/**
* Ensure that a not-null [AppCompatActivity] will be returned.
* @throws IllegalStateException When there is no activity or if the activity is null
* @throws IllegalStateException When there is no [AppCompatActivity] or if the activity is null
*/
fun Fragment.requireCompatActivity(): AppCompatActivity {
val activity = requireActivity()
@@ -127,6 +129,7 @@ fun Int.toColor(context: Context): Int {
* Resolve a color and turn it into a [ColorStateList]
* @param context [Context] required
* @return The resolved color as a [ColorStateList]
* @see toColor
*/
fun Int.toStateList(context: Context): ColorStateList = ColorStateList.valueOf(toColor(context))