mirror of
https://github.com/moonlight-stream/moonlight-android.git
synced 2026-04-22 08:20:12 +00:00
Close the app list instead of displaying an error if the app view is resumed and fails to update
This commit is contained in:
@@ -37,6 +37,7 @@ public class AppView extends Activity {
|
|||||||
private InetAddress ipAddress;
|
private InetAddress ipAddress;
|
||||||
private String uniqueId;
|
private String uniqueId;
|
||||||
private boolean remote;
|
private boolean remote;
|
||||||
|
private boolean firstLoad = true;
|
||||||
|
|
||||||
private final static int RESUME_ID = 1;
|
private final static int RESUME_ID = 1;
|
||||||
private final static int QUIT_ID = 2;
|
private final static int QUIT_ID = 2;
|
||||||
@@ -116,8 +117,12 @@ public class AppView extends Activity {
|
|||||||
@Override
|
@Override
|
||||||
protected void onResume() {
|
protected void onResume() {
|
||||||
super.onResume();
|
super.onResume();
|
||||||
|
|
||||||
updateAppList();
|
// Display the error message if it was the
|
||||||
|
// first load, but just kill the activity
|
||||||
|
// on subsequent errors
|
||||||
|
updateAppList(firstLoad);
|
||||||
|
firstLoad = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
private int getRunningAppId() {
|
private int getRunningAppId() {
|
||||||
@@ -185,7 +190,7 @@ public class AppView extends Activity {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateAppList() {
|
private void updateAppList(final boolean displayError) {
|
||||||
final SpinnerDialog spinner = SpinnerDialog.displayDialog(this, getResources().getString(R.string.applist_refresh_title),
|
final SpinnerDialog spinner = SpinnerDialog.displayDialog(this, getResources().getString(R.string.applist_refresh_title),
|
||||||
getResources().getString(R.string.applist_refresh_msg), true);
|
getResources().getString(R.string.applist_refresh_msg), true);
|
||||||
new Thread() {
|
new Thread() {
|
||||||
@@ -216,9 +221,20 @@ public class AppView extends Activity {
|
|||||||
} finally {
|
} finally {
|
||||||
spinner.dismiss();
|
spinner.dismiss();
|
||||||
}
|
}
|
||||||
|
|
||||||
Dialog.displayDialog(AppView.this, getResources().getString(R.string.applist_refresh_error_title),
|
if (displayError) {
|
||||||
getResources().getString(R.string.applist_refresh_error_msg), true);
|
Dialog.displayDialog(AppView.this, getResources().getString(R.string.applist_refresh_error_title),
|
||||||
|
getResources().getString(R.string.applist_refresh_error_msg), true);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
// Just finish the activity immediately
|
||||||
|
AppView.this.runOnUiThread(new Runnable() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
finish();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}.start();
|
}.start();
|
||||||
}
|
}
|
||||||
@@ -247,7 +263,7 @@ public class AppView extends Activity {
|
|||||||
else {
|
else {
|
||||||
message = getResources().getString(R.string.applist_quit_fail)+" "+app.getAppName();
|
message = getResources().getString(R.string.applist_quit_fail)+" "+app.getAppName();
|
||||||
}
|
}
|
||||||
updateAppList();
|
updateAppList(true);
|
||||||
} catch (UnknownHostException e) {
|
} catch (UnknownHostException e) {
|
||||||
message = getResources().getString(R.string.error_unknown_host);
|
message = getResources().getString(R.string.error_unknown_host);
|
||||||
} catch (FileNotFoundException e) {
|
} catch (FileNotFoundException e) {
|
||||||
|
|||||||
Reference in New Issue
Block a user