1 // Copyright (c) 2014 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.core.internal.extension.api.launchscreen;
7 import android.content.Context;
8 import android.content.Intent;
9 import android.util.Log;
11 import org.xwalk.core.internal.XWalkExtensionInternal;
12 import org.xwalk.core.internal.XWalkLaunchScreenManager;
15 * A XWalk extension for LaunchScreen API implementation on Android.
17 public class LaunchScreenExtension extends XWalkExtensionInternal {
18 public final static String JS_API_PATH = "jsapi/launch_screen_api.js";
20 private final static String NAME = "xwalk.launchscreen";
21 private final static String[] JS_ENTRY_POINTS = {
26 private final static String CMD_HIDE_LAUNCH_SCREEN = "hideLaunchScreen";
28 private Context mContext;
30 public LaunchScreenExtension(String jsApi, Context context) {
31 super(NAME, jsApi, JS_ENTRY_POINTS);
36 public void onMessage(int instanceId, String message) {
37 if (message.equals(CMD_HIDE_LAUNCH_SCREEN)) {
42 private void hideLaunchScreen() {
43 // TODO: Considered about the performance of broadcast receiver, it will be a little delayed to hide the
44 // launch screen. Better to have an api directly to XWalkLaunchScreenManager.
45 // Need to be well designed in the future.
46 String filterStr = XWalkLaunchScreenManager.getHideLaunchScreenFilterStr();
47 Intent intent = new Intent(filterStr);
48 mContext.sendBroadcast(intent);
52 public String onSyncMessage(int instanceID, String message) {