diff options
| author | Lena <lena@omega> | 2026-08-01 00:00:00 +0000 |
|---|---|---|
| committer | Lena <lena@omega> | 2026-08-01 00:00:00 +0000 |
| commit | 3037f9f8fdcc6cdadfe94ba248d10e647578cf53 (patch) | |
| tree | e07e981d8d6b05c1a3dc836434d88bff7d76c703 /app/src/main/java/invalid/lena/scrcpy/SettingsActivity.java | |
| parent | 70290eb3d79a5347cdc114daf6ce0b1b2e86528a (diff) | |
| download | scrcpy-android-3037f9f8fdcc6cdadfe94ba248d10e647578cf53.tar.gz | |
app: refine physical-device interface
Use target-safe capture defaults and remove redundant navigation and
frame-rate controls.
Diffstat (limited to 'app/src/main/java/invalid/lena/scrcpy/SettingsActivity.java')
| -rw-r--r-- | app/src/main/java/invalid/lena/scrcpy/SettingsActivity.java | 40 |
1 files changed, 15 insertions, 25 deletions
diff --git a/app/src/main/java/invalid/lena/scrcpy/SettingsActivity.java b/app/src/main/java/invalid/lena/scrcpy/SettingsActivity.java index b650bc4..fce776b 100644 --- a/app/src/main/java/invalid/lena/scrcpy/SettingsActivity.java +++ b/app/src/main/java/invalid/lena/scrcpy/SettingsActivity.java @@ -1,11 +1,14 @@ package invalid.lena.scrcpy; import android.app.Activity; +import android.content.pm.PackageInfo; +import android.content.pm.PackageManager; import android.os.Bundle; import android.view.WindowInsets; import android.widget.CheckBox; import android.widget.RadioButton; import android.widget.RadioGroup; +import android.widget.TextView; // Codec choice + streaming knobs. All persisted to SharedPreferences // via Settings on click; the next session bringup reads them and @@ -17,13 +20,12 @@ public final class SettingsActivity extends Activity { super.onCreate(saved); setContentView(R.layout.settings); Ui.padForInsets(findViewById(R.id.root), WindowInsets.Type.systemBars()); + showVersion(); RadioGroup videoGroup = findViewById(R.id.video_codec); RadioGroup audioGroup = findViewById(R.id.audio_codec); RadioGroup maxSizeGroup = findViewById(R.id.max_size); RadioGroup bitRateGroup = findViewById(R.id.video_bit_rate); - RadioGroup maxFpsGroup = findViewById(R.id.max_fps); - CheckBox statusBarBox = findViewById(R.id.show_status_bar); switch (Settings.videoCodec(this)) { case "h265": ((RadioButton) findViewById(R.id.video_h265)).setChecked(true); break; @@ -49,14 +51,6 @@ public final class SettingsActivity extends Activity { case 16_000_000: ((RadioButton) findViewById(R.id.bit_rate_16m)).setChecked(true); break; default: ((RadioButton) findViewById(R.id.bit_rate_4m)).setChecked(true); } - switch (Settings.maxFps(this)) { - case 30: ((RadioButton) findViewById(R.id.max_fps_30)).setChecked(true); break; - case 60: ((RadioButton) findViewById(R.id.max_fps_60)).setChecked(true); break; - case 90: ((RadioButton) findViewById(R.id.max_fps_90)).setChecked(true); break; - case 120: ((RadioButton) findViewById(R.id.max_fps_120)).setChecked(true); break; - default: ((RadioButton) findViewById(R.id.max_fps_0)).setChecked(true); - } - videoGroup.setOnCheckedChangeListener((g, id) -> { String v = "h264"; if (id == R.id.video_h265) v = "h265"; @@ -98,16 +92,6 @@ public final class SettingsActivity extends Activity { Log.i("settings: video_bit_rate=%d", v); }); - maxFpsGroup.setOnCheckedChangeListener((g, id) -> { - int v = 0; - if (id == R.id.max_fps_30) v = 30; - else if (id == R.id.max_fps_60) v = 60; - else if (id == R.id.max_fps_90) v = 90; - else if (id == R.id.max_fps_120) v = 120; - Settings.setMaxFps(this, v); - Log.i("settings: max_fps=%d", v); - }); - findViewById(R.id.licenses).setOnClickListener(v -> startActivity(new android.content.Intent(this, Licenses.class))); @@ -118,10 +102,16 @@ public final class SettingsActivity extends Activity { Log.i("settings: clipboard=%b", checked); }); - statusBarBox.setChecked(Settings.showStatusBar(this)); - statusBarBox.setOnCheckedChangeListener((b, checked) -> { - Settings.setShowStatusBar(this, checked); - Log.i("settings: status_bar=%b", checked); - }); + } + + @SuppressWarnings("deprecation") + private void showVersion() { + try { + PackageInfo info = getPackageManager().getPackageInfo(getPackageName(), 0); + ((TextView) findViewById(R.id.version)).setText(getString( + R.string.version_format, info.versionName, info.getLongVersionCode())); + } catch (PackageManager.NameNotFoundException e) { + throw new IllegalStateException("installed package is missing", e); + } } } |