胡斌

add the basic modifications for embeding crosswalk

... ... @@ -25,4 +25,5 @@ dependencies {
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
implementation 'org.xwalk:xwalk_core_library:23.53.589.4'
}
... ...
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="com.xuedianyun.embedcrosswalk">
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
<uses-sdk tools:overrideLibrary="org.xwalk.core" />
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
... ...
... ... @@ -3,11 +3,44 @@ package com.xuedianyun.embedcrosswalk;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import org.xwalk.core.XWalkPreferences;
import org.xwalk.core.XWalkView;
public class MainActivity extends AppCompatActivity {
private XWalkView xWalkWebView;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
xWalkWebView = findViewById(R.id.webView);
XWalkPreferences.setValue(XWalkPreferences.REMOTE_DEBUGGING, true);
xWalkWebView.load("http://www.xuedianyun.com", null);
}
@Override
protected void onPause() {
super.onPause();
if (xWalkWebView != null) {
xWalkWebView.pauseTimers();
xWalkWebView.onHide();
}
}
@Override
protected void onResume() {
super.onResume();
if (xWalkWebView != null) {
xWalkWebView.resumeTimers();
xWalkWebView.onShow();
}
}
@Override
protected void onDestroy() {
super.onDestroy();
if (xWalkWebView != null) {
xWalkWebView.onDestroy();
}
}
}
... ...
... ... @@ -5,14 +5,10 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Hello World!"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<org.xwalk.core.XWalkView
android:id="@+id/webView"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" />
</android.support.constraint.ConstraintLayout>
\ No newline at end of file
... ...
... ... @@ -19,6 +19,9 @@ allprojects {
repositories {
google()
jcenter()
maven {
url 'https://download.01.org/crosswalk/releases/crosswalk/android/maven2'
}
}
}
... ...