1 // Copyright (c) 2013 Intel Corporation. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 package org.xwalk.app.template;
7 import android.graphics.Color;
8 import android.os.Build.VERSION;
9 import android.os.Build.VERSION_CODES;
10 import android.os.Bundle;
11 import android.view.WindowManager;
12 import android.view.View;
13 import android.widget.TextView;
15 import org.xwalk.app.XWalkRuntimeActivityBase;
17 public class AppTemplateActivity extends XWalkRuntimeActivityBase {
19 public void onCreate(Bundle savedInstanceState) {
20 super.onCreate(savedInstanceState);
24 protected void didTryLoadRuntimeView(View runtimeView) {
25 if (runtimeView != null) {
26 setContentView(runtimeView);
27 getRuntimeView().loadAppFromUrl("file:///android_asset/www/index.html");
29 TextView msgText = new TextView(this);
30 msgText.setText("Crosswalk failed to initialize.");
31 msgText.setTextSize(36);
32 msgText.setTextColor(Color.BLACK);
33 setContentView(msgText);
37 private void enterFullscreen() {
38 if (VERSION.SDK_INT >= VERSION_CODES.KITKAT &&
39 ((getWindow().getAttributes().flags &
40 WindowManager.LayoutParams.FLAG_FULLSCREEN) != 0)) {
41 View decorView = getWindow().getDecorView();
42 decorView.setSystemUiVisibility(
43 View.SYSTEM_UI_FLAG_LAYOUT_STABLE |
44 View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION |
45 View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN |
46 View.SYSTEM_UI_FLAG_HIDE_NAVIGATION |
47 View.SYSTEM_UI_FLAG_FULLSCREEN |
48 View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY);
52 public void setIsFullscreen(boolean isFullscreen) {