Refactor restart code so app can support restarting

Add Landscape Mode setting to app
This commit is contained in:
drdev
2015-09-26 17:43:49 +00:00
parent 6fe6df1c50
commit 28316c0fe9
12 changed files with 88 additions and 25 deletions

View File

@@ -91,7 +91,7 @@ public class Main extends AndroidApplication {
private AndroidAdapter(Context context) {
isTablet = (context.getResources().getConfiguration().screenLayout
& Configuration.SCREENLAYOUT_SIZE_MASK)
>= Configuration.SCREENLAYOUT_SIZE_XLARGE;
>= Configuration.SCREENLAYOUT_SIZE_LARGE;
}
@Override
@@ -139,6 +139,15 @@ public class Main extends AndroidApplication {
return false;
}
@Override
public void restart() {
// Replace the current task with a new one for this
final Intent restart = new Intent(Main.this, Main.class)
.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK // CLEAR_TASK requires this
| Intent.FLAG_ACTIVITY_CLEAR_TASK); // finish everything else in the task
startActivity(restart);
}
@Override
public void exit() {
// Replace the current task with one that is excluded from the recent