diff --git a/app/src/main/java/com/limelight/Game.java b/app/src/main/java/com/limelight/Game.java index bc1e06ec..78913b4b 100644 --- a/app/src/main/java/com/limelight/Game.java +++ b/app/src/main/java/com/limelight/Game.java @@ -66,6 +66,7 @@ import android.view.Window; import android.view.WindowManager; import android.widget.FrameLayout; import android.view.inputmethod.InputMethodManager; +import android.widget.TextView; import android.widget.Toast; import java.io.ByteArrayInputStream; @@ -111,6 +112,7 @@ public class Game extends Activity implements SurfaceHolder.Callback, private boolean grabbedInput = true; private boolean grabComboDown = false; private StreamView streamView; + private TextView notificationOverlayView; private ShortcutHelper shortcutHelper; @@ -202,6 +204,8 @@ public class Game extends Activity implements SurfaceHolder.Callback, streamView.setOnTouchListener(this); streamView.setInputCallbacks(this); + notificationOverlayView = findViewById(R.id.notificationOverlay); + inputCaptureProvider = InputCaptureManager.getInputCaptureProvider(this, this); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { @@ -1340,8 +1344,29 @@ public class Game extends Activity implements SurfaceHolder.Callback, } @Override - public void connectionStatusUpdate(int connectionStatus) { - // TODO + public void connectionStatusUpdate(final int connectionStatus) { + 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 diff --git a/app/src/main/res/layout/activity_game.xml b/app/src/main/res/layout/activity_game.xml index 5fbf87c4..5b6bd127 100644 --- a/app/src/main/res/layout/activity_game.xml +++ b/app/src/main/res/layout/activity_game.xml @@ -10,4 +10,16 @@ android:layout_height="match_parent" android:layout_gravity="center" /> + + diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 8deb2816..677b025a 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -84,6 +84,8 @@ Details Help Are you sure you want to delete this PC? + Slow connection to PC\nReduce your bitrate + Poor connection to PC Connecting to PC… diff --git a/app/src/main/res/xml/preferences.xml b/app/src/main/res/xml/preferences.xml index 2514610e..db39edbf 100644 --- a/app/src/main/res/xml/preferences.xml +++ b/app/src/main/res/xml/preferences.xml @@ -149,6 +149,11 @@ +