mirror of
https://github.com/moonlight-stream/moonlight-android.git
synced 2025-07-18 18:42:46 +00:00
Add on-screen connection warnings
This commit is contained in:
parent
e6979d50b5
commit
8d469c5d0a
@ -66,6 +66,7 @@ import android.view.Window;
|
|||||||
import android.view.WindowManager;
|
import android.view.WindowManager;
|
||||||
import android.widget.FrameLayout;
|
import android.widget.FrameLayout;
|
||||||
import android.view.inputmethod.InputMethodManager;
|
import android.view.inputmethod.InputMethodManager;
|
||||||
|
import android.widget.TextView;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
|
|
||||||
import java.io.ByteArrayInputStream;
|
import java.io.ByteArrayInputStream;
|
||||||
@ -111,6 +112,7 @@ public class Game extends Activity implements SurfaceHolder.Callback,
|
|||||||
private boolean grabbedInput = true;
|
private boolean grabbedInput = true;
|
||||||
private boolean grabComboDown = false;
|
private boolean grabComboDown = false;
|
||||||
private StreamView streamView;
|
private StreamView streamView;
|
||||||
|
private TextView notificationOverlayView;
|
||||||
|
|
||||||
private ShortcutHelper shortcutHelper;
|
private ShortcutHelper shortcutHelper;
|
||||||
|
|
||||||
@ -202,6 +204,8 @@ public class Game extends Activity implements SurfaceHolder.Callback,
|
|||||||
streamView.setOnTouchListener(this);
|
streamView.setOnTouchListener(this);
|
||||||
streamView.setInputCallbacks(this);
|
streamView.setInputCallbacks(this);
|
||||||
|
|
||||||
|
notificationOverlayView = findViewById(R.id.notificationOverlay);
|
||||||
|
|
||||||
inputCaptureProvider = InputCaptureManager.getInputCaptureProvider(this, this);
|
inputCaptureProvider = InputCaptureManager.getInputCaptureProvider(this, this);
|
||||||
|
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||||
@ -1340,8 +1344,29 @@ public class Game extends Activity implements SurfaceHolder.Callback,
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void connectionStatusUpdate(int connectionStatus) {
|
public void connectionStatusUpdate(final int connectionStatus) {
|
||||||
// TODO
|
runOnUiThread(new Runnable() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
if (prefConfig.disableWarnings) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (connectionStatus == MoonBridge.CONN_STATUS_POOR) {
|
||||||
|
if (prefConfig.bitrate > 5000) {
|
||||||
|
notificationOverlayView.setText(getResources().getString(R.string.slow_connection_msg));
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
notificationOverlayView.setText(getResources().getString(R.string.poor_connection_msg));
|
||||||
|
}
|
||||||
|
|
||||||
|
notificationOverlayView.setVisibility(View.VISIBLE);
|
||||||
|
}
|
||||||
|
else if (connectionStatus == MoonBridge.CONN_STATUS_OKAY) {
|
||||||
|
notificationOverlayView.setVisibility(View.GONE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -10,4 +10,16 @@
|
|||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:layout_gravity="center" />
|
android:layout_gravity="center" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/notificationOverlay"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginLeft="10dp"
|
||||||
|
android:layout_marginStart="10dp"
|
||||||
|
android:layout_gravity="right"
|
||||||
|
android:textAppearance="?android:attr/textAppearanceLarge"
|
||||||
|
android:gravity="right"
|
||||||
|
android:background="#80000000"
|
||||||
|
android:visibility="gone" />
|
||||||
|
|
||||||
</merge>
|
</merge>
|
||||||
|
@ -84,6 +84,8 @@
|
|||||||
<string name="title_details">Details</string>
|
<string name="title_details">Details</string>
|
||||||
<string name="help">Help</string>
|
<string name="help">Help</string>
|
||||||
<string name="delete_pc_msg">Are you sure you want to delete this PC?</string>
|
<string name="delete_pc_msg">Are you sure you want to delete this PC?</string>
|
||||||
|
<string name="slow_connection_msg">Slow connection to PC\nReduce your bitrate</string>
|
||||||
|
<string name="poor_connection_msg">Poor connection to PC</string>
|
||||||
|
|
||||||
<!-- AppList activity -->
|
<!-- AppList activity -->
|
||||||
<string name="applist_connect_msg">Connecting to PC…</string>
|
<string name="applist_connect_msg">Connecting to PC…</string>
|
||||||
|
@ -149,6 +149,11 @@
|
|||||||
</PreferenceCategory>
|
</PreferenceCategory>
|
||||||
<PreferenceCategory android:title="@string/category_advanced_settings"
|
<PreferenceCategory android:title="@string/category_advanced_settings"
|
||||||
android:key="category_advanced_settings">
|
android:key="category_advanced_settings">
|
||||||
|
<CheckBoxPreference
|
||||||
|
android:key="checkbox_disable_warnings"
|
||||||
|
android:title="@string/title_checkbox_disable_warnings"
|
||||||
|
android:summary="@string/summary_checkbox_disable_warnings"
|
||||||
|
android:defaultValue="false" />
|
||||||
<ListPreference
|
<ListPreference
|
||||||
android:key="video_format"
|
android:key="video_format"
|
||||||
android:title="@string/title_video_format"
|
android:title="@string/title_video_format"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user