| 32 | import android.view.WindowManager.LayoutParams; |
| 33 | |
| 34 | public class AppActivity extends AxmolActivity { |
| 35 | static { |
| 36 | // DNT remove, some android simulator require explicit load shared libraries, otherwise will crash |
| 37 | SharedLoader.load(); |
| 38 | } |
| 39 | |
| 40 | @Override |
| 41 | protected void onCreate(Bundle savedInstanceState) { |
| 42 | super.setEnableVirtualButton(false); |
| 43 | super.onCreate(savedInstanceState); |
| 44 | // Workaround in https://stackoverflow.com/questions/16283079/re-launch-of-activity-on-home-button-but-only-the-first-time/16447508 |
| 45 | if (!isTaskRoot()) { |
| 46 | // Android launched another instance of the root activity into an existing task |
| 47 | // so just quietly finish and go away, dropping the user back into the activity |
| 48 | // at the top of the stack (ie: the last state of this task) |
| 49 | // Don't need to finish it again since it's finished in super.onCreate . |
| 50 | return; |
| 51 | } |
| 52 | // Make sure we're running on Pie or higher to change cutout mode |
| 53 | if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) { |
| 54 | // Enable rendering into the cutout area |
| 55 | WindowManager.LayoutParams lp = getWindow().getAttributes(); |
| 56 | lp.layoutInDisplayCutoutMode = WindowManager.LayoutParams.LAYOUT_IN_DISPLAY_CUTOUT_MODE_SHORT_EDGES; |
| 57 | getWindow().setAttributes(lp); |
| 58 | } |
| 59 | // DO OTHER INITIALIZATION BELOW |
| 60 | |
| 61 | } |
| 62 | |
| 63 | } |