kopia lustrzana https://github.com/xdsopl/robot36
renamed mode toggle and added auto mode to force mode menu
rodzic
f80b4d35c8
commit
c5c1c973d9
|
@ -90,25 +90,31 @@ public class MainActivity extends AppCompatActivity {
|
|||
setTitle(str);
|
||||
}
|
||||
|
||||
private void forceMode(int id) {
|
||||
menu.findItem(R.id.action_auto_mode).setIcon(R.drawable.baseline_lock_24);
|
||||
forceMode = getString(id);
|
||||
private void forceMode(String name) {
|
||||
int icon;
|
||||
if (name.equals(getString(R.string.auto_mode)))
|
||||
icon = R.drawable.baseline_auto_mode_24;
|
||||
else
|
||||
icon = R.drawable.baseline_lock_24;
|
||||
menu.findItem(R.id.action_toggle_mode).setIcon(icon);
|
||||
forceMode = name;
|
||||
if (decoder != null)
|
||||
decoder.forceMode(forceMode);
|
||||
}
|
||||
|
||||
private void forceMode(int id) {
|
||||
forceMode(getString(id));
|
||||
}
|
||||
|
||||
private void autoMode() {
|
||||
int icon;
|
||||
if (decoder == null || forceMode != null && !forceMode.equals(getString(R.string.auto_mode))) {
|
||||
icon = R.drawable.baseline_auto_mode_24;
|
||||
forceMode = getString(R.string.auto_mode);
|
||||
} else {
|
||||
icon = R.drawable.baseline_lock_24;
|
||||
forceMode = decoder.currentMode.getName();
|
||||
}
|
||||
menu.findItem(R.id.action_auto_mode).setIcon(icon);
|
||||
if (decoder != null)
|
||||
decoder.forceMode(forceMode);
|
||||
forceMode(R.string.auto_mode);
|
||||
}
|
||||
|
||||
private void toggleMode() {
|
||||
if (decoder == null || forceMode != null && !forceMode.equals(getString(R.string.auto_mode)))
|
||||
autoMode();
|
||||
else
|
||||
forceMode(decoder.currentMode.getName());
|
||||
}
|
||||
|
||||
private final AudioRecord.OnRecordPositionUpdateListener recordListener = new AudioRecord.OnRecordPositionUpdateListener() {
|
||||
|
@ -432,6 +438,10 @@ public class MainActivity extends AppCompatActivity {
|
|||
storeScope();
|
||||
return true;
|
||||
}
|
||||
if (id == R.id.action_toggle_mode) {
|
||||
toggleMode();
|
||||
return true;
|
||||
}
|
||||
if (id == R.id.action_auto_mode) {
|
||||
autoMode();
|
||||
return true;
|
||||
|
|
|
@ -4,9 +4,9 @@
|
|||
xmlns:tools="http://schemas.android.com/tools"
|
||||
tools:context="xdsopl.robot36.MainActivity">
|
||||
<item
|
||||
android:id="@+id/action_auto_mode"
|
||||
android:id="@+id/action_toggle_mode"
|
||||
android:icon="@drawable/baseline_auto_mode_24"
|
||||
android:title="@string/auto_mode"
|
||||
android:title="@string/toggle_mode"
|
||||
app:iconTint="@color/tint"
|
||||
app:showAsAction="always" />
|
||||
<item
|
||||
|
@ -88,6 +88,9 @@
|
|||
<item
|
||||
android:id="@+id/action_force_raw_mode"
|
||||
android:title="@string/raw_mode" />
|
||||
<item
|
||||
android:id="@+id/action_auto_mode"
|
||||
android:title="@string/auto_mode" />
|
||||
</menu>
|
||||
</item>
|
||||
<item android:title="@string/audio_settings">
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
<resources>
|
||||
<string name="share">Teilen</string>
|
||||
<string name="store_scope">Schirm Speichern</string>
|
||||
<string name="toggle_mode">Modus umschalten</string>
|
||||
<string name="auto_mode">Automatikmodus</string>
|
||||
<string name="force_mode">Modus Erzwingen</string>
|
||||
<string name="raw_mode">Rohmodus</string>
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
<resources>
|
||||
<string name="share">Поделиться</string>
|
||||
<string name="store_scope">Сохранить экран</string>
|
||||
<string name="toggle_mode">Переключить режим</string>
|
||||
<string name="auto_mode">Автоматический режим</string>
|
||||
<string name="force_mode">Принудительный режим</string>
|
||||
<string name="raw_mode">Необработанный</string>
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
<resources>
|
||||
<string name="share">分享</string>
|
||||
<string name="store_scope">保存图像</string>
|
||||
<string name="toggle_mode">切换模式</string>
|
||||
<string name="auto_mode">自动解码</string>
|
||||
<string name="force_mode">强制指定解码模式</string>
|
||||
<string name="raw_mode">原始模式</string>
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
<string name="app_name" translatable="false">Robot36</string>
|
||||
<string name="share">Share</string>
|
||||
<string name="store_scope">Store Scope</string>
|
||||
<string name="toggle_mode">Toggle Mode</string>
|
||||
<string name="auto_mode">Auto Mode</string>
|
||||
<string name="force_mode">Force Mode</string>
|
||||
<string name="robot_modes" translatable="false">Robot</string>
|
||||
|
|
Ładowanie…
Reference in New Issue