Skip to content
This repository has been archived by the owner on Apr 3, 2020. It is now read-only.

Commit

Permalink
Support shared mode for crosswalk library
Browse files Browse the repository at this point in the history
Shared mode allows multiple xwalk apps to share one xwalk runtime
library. Each xwalk app is bundled with a reflection layer instead
of the whole runtime library, whereas there is a library apk to be
installed on device for xwalk apps to use.
  • Loading branch information
Lin Sun committed Mar 31, 2015
1 parent e50d912 commit 2db7369
Show file tree
Hide file tree
Showing 7 changed files with 41 additions and 3 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ framework/libs
framework/javadoc-public
framework/javadoc-private
framework/xwalk_core_library
framework/xwalk_shared_library
test/libs
example
./test
Expand Down
4 changes: 4 additions & 0 deletions bin/templates/project/Activity.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@ public class __ACTIVITY__ extends CordovaActivity
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
}

@Override
protected void onXWalkReady() {
super.init();
// Set by <content src="index.html" /> in config.xml
loadUrl(launchUrl);
Expand Down
4 changes: 3 additions & 1 deletion bin/templates/project/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,10 @@
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />

<application android:icon="@drawable/icon" android:label="@string/app_name"
<application android:name="org.apache.cordova.CordovaApplication"
android:icon="@drawable/icon" android:label="@string/app_name"
android:hardwareAccelerated="true">
<activity android:name="__ACTIVITY__"
android:label="@string/activity_name"
Expand Down
7 changes: 6 additions & 1 deletion framework/src/org/apache/cordova/CordovaActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ Licensed to the Apache Software Foundation (ASF) under one
import org.apache.cordova.LOG;
import org.json.JSONException;
import org.json.JSONObject;
import org.xwalk.core.XWalkActivity;

import android.annotation.SuppressLint;
import android.app.Activity;
Expand Down Expand Up @@ -78,6 +79,10 @@ Licensed to the Apache Software Foundation (ASF) under one
* &#64;Override
* public void onCreate(Bundle savedInstanceState) {
* super.onCreate(savedInstanceState);
* }
*
* &#64;Override
* public void onXWalkReady() {
* super.init();
* // Load your application
* loadUrl(launchUrl);
Expand All @@ -92,7 +97,7 @@ Licensed to the Apache Software Foundation (ASF) under one
* deprecated in favor of the config.xml file.
*
*/
public class CordovaActivity extends Activity implements CordovaInterface {
public abstract class CordovaActivity extends XWalkActivity implements CordovaInterface {
public static String TAG = "CordovaActivity";

// The webview for our app
Expand Down
24 changes: 24 additions & 0 deletions framework/src/org/apache/cordova/CordovaApplication.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
/*
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
*/
package org.apache.cordova;

import org.xwalk.core.XWalkApplication;

public class CordovaApplication extends XWalkApplication {
}
1 change: 0 additions & 1 deletion framework/src/org/apache/cordova/CordovaWebViewClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ Licensed to the Apache Software Foundation (ASF) under one
import android.webkit.ValueCallback;
//import android.webkit.WebView;
//import android.webkit.WebViewClient;
import org.chromium.net.NetError;
import org.xwalk.core.XWalkResourceClient;
import org.xwalk.core.XWalkView;

Expand Down
3 changes: 3 additions & 0 deletions framework/src/org/apache/cordova/DroidGap.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,5 +30,8 @@ Licensed to the Apache Software Foundation (ASF) under one
*/
@Deprecated
public class DroidGap extends CordovaActivity {
@Override
protected void onXWalkReady() {
}

}

0 comments on commit 2db7369

Please sign in to comment.