mirror of
https://github.com/Droid-Deck/DroidDeck.git
synced 2026-11-25 07:46:01 +00:00
About 650 user-facing strings were written in Kotlin and Java, so no translation could reach them and the UI stayed half English in every language. They now live in values/strings.xml. - Dialogs, menus, status lines, toasts and errors shown to the user go through getString/stringResource. - Code that matched on English text now uses IDs: installer and loading stages, Decky stages, storage labels and the Back button's order labels. - Choice lists (upscalers, FPS limits, textures, themes, presets) carry @StringRes labels instead of English. - Robolectric tests read the app's resources (includeAndroidResources). - Six strings nothing used any more are dropped. Existing translations are untouched; the new strings show in English until they are translated.
This commit is contained in:
1 parent
1951d8bfde
commit
0b04678bdc
76 files changed
+2150
-919
No files matched your search
@@ -4,6 +4,7 @@ import android.content.Context
|
||||
import android.os.Build
|
||||
import android.view.Display
|
||||
import android.view.WindowManager
|
||||
import com.droiddeck.launcher.R
|
||||
|
||||
/**
|
||||
* What the panel says about HDR, read from android.view.Display: the gate the compositor's HDR10
|
||||
@@ -21,14 +22,9 @@ class HdrProbe(
|
||||
val ratio: Float,
|
||||
val displayId: Int,
|
||||
val name: String,
|
||||
) {
|
||||
/** Why HDR cannot be offered, or null when it can. */
|
||||
val reason: String? = when {
|
||||
Build.VERSION.SDK_INT < 29 -> "needs Android 10 or newer (display layers with a color space)"
|
||||
!hdr10 -> if (formats.isEmpty()) "this display reports no HDR support" else "this display supports $formats, not HDR10"
|
||||
else -> null
|
||||
}
|
||||
}
|
||||
val reason: String?,
|
||||
)
|
||||
|
||||
object HdrSupport {
|
||||
fun probe(context: Context): HdrProbe {
|
||||
@@ -38,14 +34,15 @@ object HdrSupport {
|
||||
@Suppress("DEPRECATION")
|
||||
(context.getSystemService(Context.WINDOW_SERVICE) as WindowManager).defaultDisplay
|
||||
}
|
||||
if (display == null) return HdrProbe(false, "", 0f, 0f, 0f, false, -1f, -1, "none")
|
||||
if (display == null) return HdrProbe(false, "", 0f, 0f, 0f, false, -1f, -1, "none", reason(context, false, ""))
|
||||
val caps = try { display.hdrCapabilities } catch (e: Exception) { null }
|
||||
val types = caps?.supportedHdrTypes ?: IntArray(0)
|
||||
val formats = types.joinToString(", ") { typeName(it) }
|
||||
val ratioAvailable = Build.VERSION.SDK_INT >= 34 && try { display.isHdrSdrRatioAvailable } catch (e: Exception) { false }
|
||||
val ratio = if (ratioAvailable) try { display.hdrSdrRatio } catch (e: Exception) { -1f } else -1f
|
||||
val hdr10 = types.contains(Display.HdrCapabilities.HDR_TYPE_HDR10)
|
||||
return HdrProbe(
|
||||
hdr10 = types.contains(Display.HdrCapabilities.HDR_TYPE_HDR10),
|
||||
hdr10 = hdr10,
|
||||
formats = formats,
|
||||
maxLuminance = caps?.desiredMaxLuminance ?: 0f,
|
||||
maxAverageLuminance = caps?.desiredMaxAverageLuminance ?: 0f,
|
||||
@@ -54,9 +51,16 @@ object HdrSupport {
|
||||
ratio = ratio,
|
||||
displayId = display.displayId,
|
||||
name = display.name ?: "display",
|
||||
reason = reason(context, hdr10, formats),
|
||||
)
|
||||
}
|
||||
|
||||
private fun reason(context: Context, hdr10: Boolean, formats: String): String? = when {
|
||||
Build.VERSION.SDK_INT < 29 -> context.getString(R.string.hdr_needs_android_10)
|
||||
!hdr10 -> if (formats.isEmpty()) context.getString(R.string.hdr_none) else context.getString(R.string.hdr_not_hdr10, formats)
|
||||
else -> null
|
||||
}
|
||||
|
||||
private fun typeName(t: Int): String = when (t) {
|
||||
Display.HdrCapabilities.HDR_TYPE_DOLBY_VISION -> "Dolby Vision"
|
||||
Display.HdrCapabilities.HDR_TYPE_HDR10 -> "HDR10"
|
||||
|
||||
Reference in new issue
Block a user