提交 4c771530 编写于 作者: A Adam Barth

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
上级 ba092f1c
......@@ -20,7 +20,10 @@ group("sky") {
]
if (is_android) {
deps += [ "//sky/shell" ]
deps += [
"//sky/apk/demo",
"//sky/apk/stocks",
]
}
if (!is_android) {
......
......@@ -4,13 +4,13 @@
found in the LICENSE file.
-->
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="org.domokit.sky.shell">
package="org.domokit.sky.demo">
<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"
<application android:name="org.domokit.sky.shell.SkyApplication" android:label="Sky">
<activity android:name="SkyDemoActivity"
android:launchMode="singleTask"
android:theme="@android:style/Theme.Holo.Light.NoActionBar"
android:configChanges="orientation|keyboardHidden|keyboard|screenSize"
......
# 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.
assert(is_android)
import("//build/config/android/config.gni")
import("//build/config/android/rules.gni")
import("//sky/apk/rules.gni")
android_library("java") {
java_files = [ "org/domokit/sky/demo/SkyDemoActivity.java" ]
deps = [
"//sky/shell:java",
]
}
sky_apk("demo") {
apk_name = "SkyDemo"
android_manifest = "AndroidManifest.xml"
deps = [
":java",
]
}
......@@ -2,17 +2,18 @@
// 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;
package org.domokit.sky.demo;
import android.app.Activity;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import org.domokit.sky.shell.SkyActivity;
/**
* Main activity for SkyShell.
* Main activity for SkyDemo.
*/
public class SkyShellActivity extends Activity {
public class SkyDemoActivity extends SkyActivity {
/**
* @see android.app.Activity#onCreate(android.os.Bundle)
*/
......@@ -28,9 +29,6 @@ public class SkyShellActivity extends Activity {
url = httpsUri.toString();
}
SkyMain.ensureInitialized(getApplicationContext());
PlatformView view = new PlatformView(this);
setContentView(view);
view.loadUrl(url);
loadUrl(url);
}
}
# 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.
import("//build/config/android/config.gni")
import("//build/config/android/rules.gni")
template("sky_apk") {
android_apk(target_name) {
apk_name = invoker.apk_name
android_manifest = invoker.android_manifest
native_libs = [ "libsky_shell.so" ]
asset_location = "$root_build_dir/sky_shell/assets"
deps = [
"//base:base_java",
"//sky/shell:assets",
"//sky/shell:java",
"//sky/shell:sky_shell",
] + invoker.deps
}
}
<?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.stocks">
<uses-sdk android:minSdkVersion="14" android:targetSdkVersion="21" />
<uses-permission android:name="android.permission.INTERNET"/>
<application android:name="org.domokit.sky.shell.SkyApplication" android:label="Stocks">
<activity android:name="StocksActivity"
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>
</activity>
</application>
</manifest>
# 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.
assert(is_android)
import("//build/config/android/config.gni")
import("//build/config/android/rules.gni")
import("//sky/apk/rules.gni")
android_library("java") {
java_files = [ "org/domokit/stocks/StocksActivity.java" ]
deps = [
"//sky/shell:java",
]
}
sky_apk("stocks") {
apk_name = "Stocks"
android_manifest = "AndroidManifest.xml"
deps = [
":java",
]
}
// 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.stocks;
import android.os.Bundle;
import org.domokit.sky.shell.SkyActivity;
/**
* Main activity for Stocks.
*/
public class StocksActivity extends SkyActivity {
/**
* @see android.app.Activity#onCreate(android.os.Bundle)
*/
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
loadUrl("https://domokit.github.io/sky/examples/stocks/index.sky");
}
}
......@@ -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",
]
}
<?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>
// 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);
}
}
......@@ -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 = {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册