mirror of
https://github.com/moonlight-stream/moonlight-android.git
synced 2026-04-12 10:56:06 +00:00
Add option to disable toasts
This commit is contained in:
@@ -37,6 +37,7 @@ import android.view.View.OnTouchListener;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.Window;
|
||||
import android.view.WindowManager;
|
||||
import android.view.WindowManager.LayoutParams;
|
||||
import android.widget.Toast;
|
||||
|
||||
|
||||
@@ -62,6 +63,7 @@ public class Game extends Activity implements SurfaceHolder.Callback, OnGenericM
|
||||
private boolean connected = false;
|
||||
|
||||
private boolean stretchToFit;
|
||||
private boolean toastsDisabled;
|
||||
|
||||
private ConfigurableDecoderRenderer decoderRenderer;
|
||||
|
||||
@@ -83,6 +85,7 @@ public class Game extends Activity implements SurfaceHolder.Callback, OnGenericM
|
||||
public static final String BITRATE_PREF_STRING = "Bitrate";
|
||||
public static final String STRETCH_PREF_STRING = "Stretch";
|
||||
public static final String SOPS_PREF_STRING = "Sops";
|
||||
public static final String DISABLE_TOASTS_PREF_STRING = "NoToasts";
|
||||
|
||||
public static final int BITRATE_DEFAULT_720_30 = 5;
|
||||
public static final int BITRATE_DEFAULT_720_60 = 10;
|
||||
@@ -96,6 +99,7 @@ public class Game extends Activity implements SurfaceHolder.Callback, OnGenericM
|
||||
public static final int DEFAULT_BITRATE = BITRATE_DEFAULT_720_60;
|
||||
public static final boolean DEFAULT_STRETCH = false;
|
||||
public static final boolean DEFAULT_SOPS = true;
|
||||
public static final boolean DEFAULT_DISABLE_TOASTS = false;
|
||||
|
||||
public static final int FORCE_HARDWARE_DECODER = -1;
|
||||
public static final int AUTOSELECT_DECODER = 0;
|
||||
@@ -158,6 +162,7 @@ public class Game extends Activity implements SurfaceHolder.Callback, OnGenericM
|
||||
refreshRate = prefs.getInt(REFRESH_RATE_PREF_STRING, DEFAULT_REFRESH_RATE);
|
||||
bitrate = prefs.getInt(BITRATE_PREF_STRING, DEFAULT_BITRATE);
|
||||
sops = prefs.getBoolean(SOPS_PREF_STRING, DEFAULT_SOPS);
|
||||
toastsDisabled = prefs.getBoolean(DISABLE_TOASTS_PREF_STRING, DEFAULT_DISABLE_TOASTS);
|
||||
|
||||
Display display = getWindowManager().getDefaultDisplay();
|
||||
display.getSize(screenSize);
|
||||
@@ -590,12 +595,14 @@ public class Game extends Activity implements SurfaceHolder.Callback, OnGenericM
|
||||
|
||||
@Override
|
||||
public void displayTransientMessage(final String message) {
|
||||
runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
Toast.makeText(Game.this, message, Toast.LENGTH_LONG).show();
|
||||
}
|
||||
});
|
||||
if (!toastsDisabled) {
|
||||
runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
Toast.makeText(Game.this, message, Toast.LENGTH_LONG).show();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -19,7 +19,7 @@ public class StreamSettings extends Activity {
|
||||
private Button advancedSettingsButton;
|
||||
private SharedPreferences prefs;
|
||||
private RadioButton rbutton720p30, rbutton720p60, rbutton1080p30, rbutton1080p60;
|
||||
private CheckBox stretchToFill, enableSops;
|
||||
private CheckBox stretchToFill, enableSops, toastsDisabled;
|
||||
|
||||
@Override
|
||||
protected void onStop() {
|
||||
@@ -36,6 +36,7 @@ public class StreamSettings extends Activity {
|
||||
|
||||
this.stretchToFill = (CheckBox) findViewById(R.id.stretchToFill);
|
||||
this.enableSops = (CheckBox) findViewById(R.id.enableSops);
|
||||
this.toastsDisabled = (CheckBox) findViewById(R.id.disableToasts);
|
||||
this.advancedSettingsButton = (Button) findViewById(R.id.advancedSettingsButton);
|
||||
this.rbutton720p30 = (RadioButton) findViewById(R.id.config720p30Selected);
|
||||
this.rbutton720p60 = (RadioButton) findViewById(R.id.config720p60Selected);
|
||||
@@ -49,6 +50,7 @@ public class StreamSettings extends Activity {
|
||||
|
||||
stretchToFill.setChecked(prefs.getBoolean(Game.STRETCH_PREF_STRING, Game.DEFAULT_STRETCH));
|
||||
enableSops.setChecked(prefs.getBoolean(Game.SOPS_PREF_STRING, Game.DEFAULT_SOPS));
|
||||
toastsDisabled.setChecked(prefs.getBoolean(Game.DISABLE_TOASTS_PREF_STRING, Game.DEFAULT_DISABLE_TOASTS));
|
||||
|
||||
rbutton720p30.setChecked(false);
|
||||
rbutton720p60.setChecked(false);
|
||||
@@ -132,5 +134,12 @@ public class StreamSettings extends Activity {
|
||||
prefs.edit().putBoolean(Game.SOPS_PREF_STRING, isChecked).commit();
|
||||
}
|
||||
});
|
||||
toastsDisabled.setOnCheckedChangeListener(new OnCheckedChangeListener() {
|
||||
@Override
|
||||
public void onCheckedChanged(CompoundButton buttonView,
|
||||
boolean isChecked) {
|
||||
prefs.edit().putBoolean(Game.DISABLE_TOASTS_PREF_STRING, isChecked).commit();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user