mirror of
https://github.com/Droid-Deck/DroidDeck.git
synced 2026-12-05 12:35:42 +00:00
Merge branch 'main' into fix/xclipse-auto-no-driver
This commit is contained in:
8 files changed
+52
-13
No files matched your search
Binary file not shown.
@@ -15,6 +15,7 @@ object BootMovie {
|
||||
const val DROIDDECK_30 = "dd30"
|
||||
const val DROIDDECK_60 = "dd60"
|
||||
const val CUSTOM = "custom"
|
||||
private const val SKIP = "skip"
|
||||
const val MAX_BYTES = 50L shl 20
|
||||
const val MAX_CONVERT_SECONDS = 60
|
||||
val PICKER_EXTENSIONS = listOf("webm", "mkv", "mp4", "mov", "m4v", "3gp")
|
||||
@@ -22,6 +23,7 @@ object BootMovie {
|
||||
private val ASSETS = mapOf(
|
||||
DROIDDECK_30 to "droiddeck-startup.webm",
|
||||
DROIDDECK_60 to "droiddeck-startup-60.webm",
|
||||
SKIP to "skip-startup.webm",
|
||||
)
|
||||
|
||||
internal val VIDEO_CODECS = setOf(MediaFormat.MIMETYPE_VIDEO_VP8, MediaFormat.MIMETYPE_VIDEO_VP9, MediaFormat.MIMETYPE_VIDEO_AV1)
|
||||
@@ -74,6 +76,7 @@ object BootMovie {
|
||||
|
||||
fun prepare(context: Context): File? {
|
||||
BootMovieLibrary.restore(context)
|
||||
if (SessionPrefs.skipBootMovie(context)) return assetFile(context, SKIP)
|
||||
val source = sourceOf(context, choice(context)) ?: return null
|
||||
return variant(context, source)
|
||||
}
|
||||
|
||||
@@ -67,7 +67,7 @@ object BootMovieReport {
|
||||
line("== DroidDeck state")
|
||||
line("choice=${BootMovie.choice(context)} saved choice=${SessionPrefs.bootMovie(context)} pending pick=${SessionPrefs.bootMovieApplyNext(context)}")
|
||||
line("last Steam path seen=${SessionPrefs.bootMovieSteamSeen(context)}")
|
||||
line("sound=${SessionPrefs.bootMovieSound(context)} volume=${SessionPrefs.bootMovieVolume(context)} seconds=${SessionPrefs.bootMovieSeconds(context)}")
|
||||
line("sound=${SessionPrefs.bootMovieSound(context)} volume=${SessionPrefs.bootMovieVolume(context)} seconds=${SessionPrefs.bootMovieSeconds(context)} skip=${SessionPrefs.skipBootMovie(context)}")
|
||||
line("session running=${SessionState.running}")
|
||||
line()
|
||||
line("== The movie list as shown")
|
||||
|
||||
@@ -1164,6 +1164,11 @@ object SessionPrefs {
|
||||
fun setBootMovieVolume(context: Context, percent: Int) { prefs(context).edit().putInt("bootMovieVolume", percent.coerceIn(0, 100)).apply() }
|
||||
fun bootMovieSeconds(context: Context): Int = prefs(context).getInt("bootMovieSeconds", 0).coerceAtLeast(0)
|
||||
fun setBootMovieSeconds(context: Context, seconds: Int) { prefs(context).edit().putInt("bootMovieSeconds", seconds.coerceAtLeast(0)).apply() }
|
||||
fun skipBootMovie(context: Context): Boolean = prefs(context).getBoolean("skipBootMovie", false)
|
||||
fun setSkipBootMovie(context: Context, on: Boolean) {
|
||||
prefs(context).edit().putBoolean("skipBootMovie", on).apply()
|
||||
setBootMovieApplyNext(context, true)
|
||||
}
|
||||
fun bootMovieApplyNext(context: Context): Boolean = prefs(context).getBoolean("bootMovieApplyNext", false)
|
||||
fun setBootMovieApplyNext(context: Context, on: Boolean) { prefs(context).edit().putBoolean("bootMovieApplyNext", on).apply() }
|
||||
fun bootMovieSteamSeen(context: Context): String? = prefs(context).getString("bootMovieSteamSeen", null)
|
||||
|
||||
@@ -25,7 +25,7 @@ object SettingsReset {
|
||||
"noXalia", "fastSync", "fsyncFirst", "syncFallback", "prootNoSeccomp", "prootFastPath", "nativeUserland", "cursorComposite",
|
||||
"guestHostname", "fexPreset", "forceSsbs", "logs", "gameDebugLogsEnabled", "enhancedDiagnosticsNext", "storageDiagnostics", "buildWatermark",
|
||||
"upscaler", "upscaleSharpness", "screenEffects", "textureAnisotropy", "textureLodBias",
|
||||
"steamDownloadsInBackground", "steam_offline", "bootMovie", "bootMovieSound", "bootMovieVolume", "bootMovieSeconds",
|
||||
"steamDownloadsInBackground", "steam_offline", "bootMovie", "bootMovieSound", "bootMovieVolume", "bootMovieSeconds", "skipBootMovie",
|
||||
"bootMovieApplyNext", "bootMovieSteamSeen",
|
||||
"questDefaultsV1", "telemetryAuto", "telemetryOff", "statsStrip", "statsHud", "bottomHud", "bottomStripMetrics", "bottomStripTabs", "statsDash", "statsSpeedUnit",
|
||||
)
|
||||
|
||||
@@ -110,7 +110,11 @@ internal class PetMotion(private val context: Context) {
|
||||
private val margin = 6 * density
|
||||
private val inset = 24 * density
|
||||
private var settle: ValueAnimator? = null
|
||||
private val spring = FlingSpring { sx, sy -> x = sx; y = sy }
|
||||
// A fling's overshoot may carry the pet past the edge it settles on, but never so far that it leaves the screen.
|
||||
private val spring = FlingSpring { sx, sy ->
|
||||
x = sx.coerceIn(-size / 2, (width - size / 2).coerceAtLeast(-size / 2))
|
||||
y = sy.coerceIn(0f, (height - size).coerceAtLeast(0f))
|
||||
}
|
||||
|
||||
val dockX get() = width - size - margin
|
||||
|
||||
@@ -333,11 +337,24 @@ internal class PetWindows(private val context: Context) {
|
||||
gravity = Gravity.TOP or Gravity.START
|
||||
if (full) softInputMode = WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) layoutInDisplayCutoutMode = WindowManager.LayoutParams.LAYOUT_IN_DISPLAY_CUTOUT_MODE_SHORT_EDGES
|
||||
noMoveAnimation(this)
|
||||
}
|
||||
if (onSize != null) compose.addOnLayoutChangeListener { v, _, _, _, _, _, _, _, _ -> onSize(v.width, v.height) }
|
||||
return Window(frame, params, touchable)
|
||||
}
|
||||
|
||||
/**
|
||||
* The system otherwise eases a moved overlay from where it last placed it, so the pet trails behind
|
||||
* the finger, lags the chat as it opens, or flashes at an old spot. setCanPlayMoveAnimation sets the
|
||||
* same flag but makes some ROMs refuse the window, so the flag is set directly.
|
||||
*/
|
||||
private fun noMoveAnimation(params: WindowManager.LayoutParams) {
|
||||
runCatching {
|
||||
val field = WindowManager.LayoutParams::class.java.getField("privateFlags")
|
||||
field.setInt(params, field.getInt(params) or PRIVATE_FLAG_NO_MOVE_ANIMATION)
|
||||
}
|
||||
}
|
||||
|
||||
/** A hidden overlay window still owns its frame, which the system can stretch over the screen, so it also stops taking touches. */
|
||||
private fun setVisible(window: Window, shown: Boolean) {
|
||||
window.view.visibility = if (shown) View.VISIBLE else View.GONE
|
||||
@@ -467,6 +484,7 @@ internal class PetWindows(private val context: Context) {
|
||||
|
||||
companion object {
|
||||
private const val OFFSCREEN = 10_000
|
||||
private const val PRIVATE_FLAG_NO_MOVE_ANIMATION = 0x40
|
||||
fun allowed(context: Context) = Settings.canDrawOverlays(context)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -142,18 +142,29 @@ private fun TabChip(label: String, selected: Boolean, modifier: Modifier = Modif
|
||||
@Composable
|
||||
internal fun BootMovieGroup(s: ModeSettings, a: ModeSettingsActions, host: MenuHost) {
|
||||
var tab by rememberSaveable { mutableStateOf(MovieTab.INSTALLED) }
|
||||
val app = LocalContext.current.applicationContext
|
||||
var skipBootMovie by remember { mutableStateOf(SessionPrefs.skipBootMovie(app)) }
|
||||
SettingsGroup(stringResource(R.string.boot_movie)) {
|
||||
Row(horizontalArrangement = Arrangement.spacedBy(6.dp), modifier = Modifier.fillMaxWidth().padding(horizontal = 10.dp, vertical = 10.dp)) {
|
||||
TabChip(stringResource(R.string.boot_movie_tab_installed), tab == MovieTab.INSTALLED, Modifier.weight(1f)) { tab = MovieTab.INSTALLED }
|
||||
TabChip(stringResource(R.string.boot_movie_tab_import), tab == MovieTab.IMPORT, Modifier.weight(1f)) { tab = MovieTab.IMPORT }
|
||||
TabChip(stringResource(R.string.boot_movie_tab_repo), tab == MovieTab.REPO, Modifier.weight(1f)) { tab = MovieTab.REPO }
|
||||
TabChip(stringResource(R.string.boot_movie_tab_sound), tab == MovieTab.SOUND, Modifier.weight(1f)) { tab = MovieTab.SOUND }
|
||||
ToggleRow(
|
||||
host, "boot-movie-skip", stringResource(R.string.boot_movie_skip),
|
||||
stringResource(R.string.boot_movie_skip_hint), skipBootMovie,
|
||||
) { enabled ->
|
||||
skipBootMovie = enabled
|
||||
SessionPrefs.setSkipBootMovie(app, enabled)
|
||||
}
|
||||
when (tab) {
|
||||
MovieTab.INSTALLED -> InstalledTab(a)
|
||||
MovieTab.IMPORT -> ImportTab(s, a)
|
||||
MovieTab.REPO -> RepoTab(a)
|
||||
MovieTab.SOUND -> SoundTab(s, a, host)
|
||||
if (!skipBootMovie) {
|
||||
Row(horizontalArrangement = Arrangement.spacedBy(6.dp), modifier = Modifier.fillMaxWidth().padding(horizontal = 10.dp, vertical = 10.dp)) {
|
||||
TabChip(stringResource(R.string.boot_movie_tab_installed), tab == MovieTab.INSTALLED, Modifier.weight(1f)) { tab = MovieTab.INSTALLED }
|
||||
TabChip(stringResource(R.string.boot_movie_tab_import), tab == MovieTab.IMPORT, Modifier.weight(1f)) { tab = MovieTab.IMPORT }
|
||||
TabChip(stringResource(R.string.boot_movie_tab_repo), tab == MovieTab.REPO, Modifier.weight(1f)) { tab = MovieTab.REPO }
|
||||
TabChip(stringResource(R.string.boot_movie_tab_sound), tab == MovieTab.SOUND, Modifier.weight(1f)) { tab = MovieTab.SOUND }
|
||||
}
|
||||
when (tab) {
|
||||
MovieTab.INSTALLED -> InstalledTab(a)
|
||||
MovieTab.IMPORT -> ImportTab(s, a)
|
||||
MovieTab.REPO -> RepoTab(a)
|
||||
MovieTab.SOUND -> SoundTab(s, a, host)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3532,6 +3532,8 @@
|
||||
<string name="boot_movie_droiddeck">DroidDeck · %1$d fps</string>
|
||||
<string name="boot_movie_note">60 fps looks smoother but uses more CPU while Steam starts. A movie picked in Steam\'s own settings shows up here too.</string>
|
||||
<string name="boot_movie_sound">Sound</string>
|
||||
<string name="boot_movie_skip">Skip boot movie</string>
|
||||
<string name="boot_movie_skip_hint">Use a 0.1-second black clip as Steam’s startup movie. Applies next session.</string>
|
||||
<string name="boot_movie_custom">Your own movie</string>
|
||||
<string name="boot_movie_custom_hint">MP4, MOV, MKV or WebM. Other formats and files over %1$d MB are converted to 720p WebM on the device, up to %2$d seconds.</string>
|
||||
<string name="boot_movie_import">Import</string>
|
||||
|
||||
Reference in new issue
Block a user