Introduce Stocks.apk

This CL renames SkyShell.apk to SkyDemo.apk and adds a Stocks.apk which
defaults to the stocks demo app. Sky Shell is now a library that can be
packaged by different APKs.

R=eseidel@chromium.org

Review URL: https://codereview.chromium.org/965493002
This commit is contained in:
Adam Barth 2015-02-26 12:05:17 -08:00
parent 72d111c8c6
commit 148ce10dc6
10 changed files with 44 additions and 113 deletions

View File

@ -20,7 +20,10 @@ group("sky") {
]
if (is_android) {
deps += [ "//sky/shell" ]
deps += [
"//sky/apk/demo",
"//sky/apk/stocks",
]
}
if (!is_android) {

View File

@ -7,17 +7,11 @@ assert(is_android)
import("//build/config/android/config.gni")
import("//build/config/android/rules.gni")
group("shell") {
deps = [
":sky_shell_apk",
]
}
generate_jni("jni_headers") {
sources = [
"apk/src/org/domokit/sky/shell/JavaServiceProvider.java",
"apk/src/org/domokit/sky/shell/SkyMain.java",
"apk/src/org/domokit/sky/shell/PlatformView.java",
"org/domokit/sky/shell/JavaServiceProvider.java",
"org/domokit/sky/shell/SkyMain.java",
"org/domokit/sky/shell/PlatformView.java",
]
jni_package = "sky/shell"
}
@ -74,11 +68,11 @@ shared_library("sky_shell") {
android_library("java") {
java_files = [
"apk/src/org/domokit/sky/shell/JavaServiceProvider.java",
"apk/src/org/domokit/sky/shell/PlatformView.java",
"apk/src/org/domokit/sky/shell/SkyMain.java",
"apk/src/org/domokit/sky/shell/SkyShellActivity.java",
"apk/src/org/domokit/sky/shell/SkyShellApplication.java",
"org/domokit/sky/shell/JavaServiceProvider.java",
"org/domokit/sky/shell/PlatformView.java",
"org/domokit/sky/shell/SkyMain.java",
"org/domokit/sky/shell/SkyActivity.java",
"org/domokit/sky/shell/SkyApplication.java",
]
deps = [
@ -93,16 +87,9 @@ android_library("java") {
]
}
sky_shell_assets_dir = "$root_build_dir/sky_shell/assets"
android_resources("resources") {
resource_dirs = [ "apk/res" ]
custom_package = "org.domokit.sky.shell"
}
copy_ex("assets") {
clear_dir = true
dest = sky_shell_assets_dir
dest = "$root_build_dir/sky_shell/assets"
sources = [
"$root_build_dir/icudtl.dat",
]
@ -110,20 +97,3 @@ copy_ex("assets") {
"//third_party/icu",
]
}
android_apk("sky_shell_apk") {
apk_name = "SkyShell"
android_manifest = "apk/AndroidManifest.xml"
native_libs = [ "libsky_shell.so" ]
asset_location = sky_shell_assets_dir
deps = [
"//base:base_java",
":assets",
":java",
":resources",
":sky_shell",
]
}

View File

@ -1,29 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright 2015 The Chromium Authors. All rights reserved.
Use of this source code is governed by a BSD-style license that can be
found in the LICENSE file.
-->
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="org.domokit.sky.shell">
<uses-sdk android:minSdkVersion="14" android:targetSdkVersion="21" />
<uses-permission android:name="android.permission.INTERNET"/>
<application android:name="SkyShellApplication" android:label="Sky">
<activity android:name="SkyShellActivity"
android:launchMode="singleTask"
android:theme="@android:style/Theme.Holo.Light.NoActionBar"
android:configChanges="orientation|keyboardHidden|keyboard|screenSize"
android:hardwareAccelerated="true">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.VIEW"/>
<category android:name="android.intent.category.DEFAULT" />
<data android:scheme="sky" />
</intent-filter>
</activity>
</application>
</manifest>

View File

@ -1,7 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright 2015 The Chromium Authors. All rights reserved.
Use of this source code is governed by a BSD-style license that can be
found in the LICENSE file.
-->
<resources>
</resources>

View File

@ -1,36 +0,0 @@
// Copyright 2015 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
package org.domokit.sky.shell;
import android.app.Activity;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
/**
* Main activity for SkyShell.
*/
public class SkyShellActivity extends Activity {
/**
* @see android.app.Activity#onCreate(android.os.Bundle)
*/
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
String url = "https://domokit.github.io/home";
Intent intent = getIntent();
if (Intent.ACTION_VIEW.equals(intent.getAction())) {
Uri skyUri = intent.getData();
Uri httpsUri = skyUri.buildUpon().scheme("https").build();
url = httpsUri.toString();
}
SkyMain.ensureInitialized(getApplicationContext());
PlatformView view = new PlatformView(this);
setContentView(view);
view.loadUrl(url);
}
}

View File

@ -0,0 +1,30 @@
// Copyright 2015 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
package org.domokit.sky.shell;
import android.app.Activity;
import android.os.Bundle;
/**
* Base class for activities that use Sky.
*/
public class SkyActivity extends Activity {
private PlatformView mView;
/**
* @see android.app.Activity#onCreate(android.os.Bundle)
*/
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
SkyMain.ensureInitialized(getApplicationContext());
mView = new PlatformView(this);
setContentView(mView);
}
public void loadUrl(String url) {
mView.loadUrl(url);
}
}

View File

@ -17,7 +17,7 @@ import org.chromium.base.library_loader.ProcessInitException;
* MojoShell implementation of {@link android.app.Application}, managing application-level global
* state and initializations.
*/
public class SkyShellApplication extends BaseChromiumApplication {
public class SkyApplication extends BaseChromiumApplication {
private static final String TAG = "SkyShellApplication";
private static final String PRIVATE_DATA_DIRECTORY_SUFFIX = "sky_shell";
private static final String[] SKY_MANDATORY_PAKS = {