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.Intent;
8 import android.util.Log;
10 import org.xwalk.core.internal.XWalkLaunchScreenManager;
11 import org.xwalk.core.internal.extension.XWalkExtension;
12 import org.xwalk.core.internal.extension.XWalkExtensionContext;
15 * A XWalk extension for LaunchScreen API implementation on Android.
17 public class LaunchScreenExtension extends XWalkExtension {
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 public LaunchScreenExtension(String jsApi, XWalkExtensionContext context) {
29 super(NAME, jsApi, JS_ENTRY_POINTS, context);
33 public void onMessage(int instanceId, String message) {
34 if (message.equals(CMD_HIDE_LAUNCH_SCREEN)) {
39 private void hideLaunchScreen() {
40 // TODO: Considered about the performance of broadcast receiver, it will be a little delayed to hide the
41 // launch screen. Better to have an api directly to XWalkLaunchScreenManager.
42 // Need to be well designed in the future.
43 String filterStr = XWalkLaunchScreenManager.getHideLaunchScreenFilterStr();
44 Intent intent = new Intent(filterStr);
45 mExtensionContext.getActivity().sendBroadcast(intent);