mirror of
https://github.com/moonlight-stream/moonlight-android.git
synced 2025-07-20 11:33:06 +00:00
Add option to disable toasts
This commit is contained in:
parent
e8dd3511db
commit
2365cd2978
@ -49,13 +49,14 @@ or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>na
|
||||
public static final int config720p30Selected=0x7f08000f;
|
||||
public static final int config720p60Selected=0x7f080010;
|
||||
public static final int decoderConfigGroup=0x7f080002;
|
||||
public static final int disableToasts=0x7f080014;
|
||||
public static final int discoveryText=0x7f08000b;
|
||||
public static final int enableSops=0x7f080014;
|
||||
public static final int enableSops=0x7f080016;
|
||||
public static final int hardwareDec=0x7f080005;
|
||||
public static final int hostTextView=0x7f080000;
|
||||
public static final int manuallyAddPc=0x7f08000c;
|
||||
public static final int pcListView=0x7f080008;
|
||||
public static final int rowTextView=0x7f080016;
|
||||
public static final int rowTextView=0x7f080017;
|
||||
public static final int settingsButton=0x7f08000d;
|
||||
public static final int softwareDec=0x7f080003;
|
||||
public static final int streamConfigGroup=0x7f08000e;
|
||||
|
@ -54,7 +54,7 @@
|
||||
android:id="@+id/advancedSettingsButton"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@+id/enableSops"
|
||||
android:layout_below="@+id/disableToasts"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_marginTop="15dp"
|
||||
android:text="Advanced Settings" />
|
||||
@ -75,6 +75,14 @@
|
||||
android:layout_marginTop="15dp"
|
||||
android:text="Allow GFE to modify game settings for optimal streaming" />
|
||||
|
||||
<CheckBox
|
||||
android:id="@+id/disableToasts"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@+id/enableSops"
|
||||
android:layout_marginTop="15dp"
|
||||
android:text="Disable on-screen connection warning messages" />
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
</ScrollView>
|
||||
|
@ -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();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user