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

Commit

Permalink
Merge pull request #48 from zhuyongyong/demoExpress-embedding/update6…
Browse files Browse the repository at this point in the history
…samples

[demoexpress-embedding] Update sample-embedding in demo-express
  • Loading branch information
jennycao committed Feb 13, 2015
2 parents 462901d + a4db340 commit aa5283c
Show file tree
Hide file tree
Showing 20 changed files with 194 additions and 104 deletions.
2 changes: 1 addition & 1 deletion samples-embedding/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

<uses-sdk
android:minSdkVersion="14"
android:targetSdkVersion="19" />
android:targetSdkVersion="21" />

<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
Expand Down
1 change: 1 addition & 0 deletions samples-embedding/assets/css/page.css
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
body{ font-size:40px;}
12 changes: 9 additions & 3 deletions samples-embedding/assets/echo.html
Original file line number Diff line number Diff line change
@@ -1,26 +1,32 @@
<html>
<head>
<title></title>
<link rel="stylesheet" type="text/css" href="css/page.css">
</head>
<body>
Extension Page: This page shows the feedback message from extension and the execution result.<br/><br/><br/>
<br/><br/>
<script>

try {
var d = new Date().toString();
echo.echo(d, function(msg) {
document.write(msg + "<br>");
document.write("<br/><font size=40>" + msg + "</font><br/>");
var expected = "From java:" + d;
if (msg === expected) {
document.write("Async echo <font color=green>passed</font>.");
document.write("<br/><font size=40>Async echo <font color=green>passed</font></font>");
document.title = "Pass";
} else {
document.write("Async echo <font color=red>failed</font>.");
document.write("<br/><font size=40>Async echo <font color=red>failed</font></font>");
document.title = "Fail";
}
});
} catch(e) {
console.log(e);
document.title = "Fail";
document.write("<br/><font size=40>Async echo <font color=red>failed</font></font>");
}

</script>
</body>
</html>
2 changes: 1 addition & 1 deletion samples-embedding/assets/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "OnlineTest",
"app": {
"launch": {
"local_path": "index.html"
"local_path": "page3.html"
}
},
"description": "Manifest test",
Expand Down
10 changes: 0 additions & 10 deletions samples-embedding/assets/manifest_pause_timers.json

This file was deleted.

18 changes: 18 additions & 0 deletions samples-embedding/assets/navigate.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<html>
<head>
<title>Navigate Page</title>
<style type="text/css">
body{ font-size:30px;}
</style>
</head>
<body>
<br/>
<ul>
<li>Click "Link To Clock Page" to go to a clock page.</li>
<li>Click prev button to navigate to the prev page.</li>
<li>Click next button to navigate to the next page.</li>
</ul>
<br/>
<a id="create_window_a_top" href="timers.html" target="_top">Link To Clock Page</a>
</body>
</html>
9 changes: 9 additions & 0 deletions samples-embedding/assets/page1.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<html>
<head>
<link rel="stylesheet" type="text/css" href="css/page.css">
</head>
<body bgcolor="red">
<p>Page1: This page is loaded from page1.html.</p><br/><br/>
<p><b>Page 1</b></p>
</body>
</html>
9 changes: 9 additions & 0 deletions samples-embedding/assets/page2.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<html>
<head>
<link rel="stylesheet" type="text/css" href="css/page.css">
</head>
<body bgcolor="green">
Page2: This page is loaded from page2.html.<br/><br/><br/>
<p><b>Page 2</b></p>
</body>
</html>
9 changes: 9 additions & 0 deletions samples-embedding/assets/page3.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<html>
<head>
<link rel="stylesheet" type="text/css" href="css/page.css">
</head>
<body bgcolor="blue">
Page3: This page is loaded as app from manifest.<br/><br/><br/>
<p><b>Page 3</b></p>
</body>
</html>
23 changes: 0 additions & 23 deletions samples-embedding/assets/pause_timers.html

This file was deleted.

33 changes: 33 additions & 0 deletions samples-embedding/assets/timers.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<!DOCTYPE html>
<html>
<head>
<title>Clock Page</title>
<style type="text/css">
body{ font-size:30px;}
</style>
</head>
<body>
<br/>
<ul>
<li>Click pause/resume button to pause/resume this clock.</li>
<li>Click "Run Animation" button to scaled down or scaled up the page view.</li>
<li>Click prev button to navigate to the prev page.</li>
<li>Click next button to navigate to the next page.</li>
</ul>
<br/>
<p>A script on this page starts this clock:</p>
<h1><p id="demo"></p></h1>

<script>
var myVar=setInterval(function(){myTimer()},1000);

function myTimer()
{
var d=new Date();
var t=d.toLocaleTimeString();
document.getElementById("demo").innerHTML=t;
}
</script>

</body>
</html>
19 changes: 0 additions & 19 deletions samples-embedding/assets/window_navigate.html

This file was deleted.

38 changes: 38 additions & 0 deletions samples-embedding/res/layout/multi_texture_views.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (c) 2014 Intel Corporation. All rights reserved.
Use of this source code is governed by a BSD-style license that can be
found in the LICENSE file.
-->

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/multi_texture_views"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="2"
android:orientation="vertical" >
<TextView
android:id="@+id/multiViews_des"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
<LinearLayout
android:id="@+id/toolbar2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<Button android:id="@+id/run_resize"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="end"
android:text="Resize"/>
</LinearLayout>
<RelativeLayout
android:id="@+id/root_views"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="2"
android:orientation="vertical" >

</RelativeLayout>
</RelativeLayout>
6 changes: 3 additions & 3 deletions samples-embedding/res/layout/xwview_layout.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,19 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>

<TextView
<TextView
android:id="@+id/text1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="#FDF5E6" />

<TextView
<TextView
android:id="@+id/text2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="#FDF5E6" />

<TextView
<TextView
android:id="@+id/text3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
Expand Down
8 changes: 4 additions & 4 deletions samples-embedding/src/sample/ExtensionActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,7 @@
import org.xwalk.embedded.api.sample.ExtensionEcho;
import org.xwalk.core.XWalkView;

import android.app.AlertDialog;
import android.os.Bundle;
import android.widget.Button;
import android.widget.TextView;

public class ExtensionActivity extends XWalkBaseActivity {
Expand All @@ -27,11 +25,13 @@ protected void onCreate(Bundle savedInstanceState) {
setContentView(R.layout.xwview_extension_layout);

textDes = (TextView) super.findViewById(R.id.extension_des);
textDes.setText("This sample is designed for extension feature. If the extension give a correct feedback, this page will contains 'passed' in green color.");
textDes.setText("This sample is designed for extension feature. " +
"If the extension give a correct feedback, this page will show the" +
" feedback message from extension and contain 'passed' in green color.");

mExtension = new ExtensionEcho();
mXWalkView = (XWalkView) findViewById(R.id.xwalkview_extension);

mExtension.print();
mXWalkView.load("file:///android_asset/echo.html", null);
}
}
4 changes: 4 additions & 0 deletions samples-embedding/src/sample/ExtensionEcho.java
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,8 @@ public void onMessage(int instanceID, String message) {
public String onSyncMessage(int instanceID, String message) {
return "From java sync:" + message;
}

public void print() {
System.out.println("execute");
}
}
10 changes: 6 additions & 4 deletions samples-embedding/src/sample/MultiSurfaceViewsActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import org.xwalk.core.XWalkPreferences;
import org.xwalk.core.XWalkView;

import android.app.AlertDialog;
import android.os.Bundle;
import android.webkit.WebView;
import android.widget.RelativeLayout;
Expand All @@ -19,13 +18,16 @@ public void onCreate(Bundle savedInstanceState) {
RelativeLayout root = new RelativeLayout(this);

textDes = new TextView(this);
textDes.setText("This sample demonstrates Multiple SurfaceViews can be shown in order.");
textDes.setText("This sample demonstrates Multiple SurfaceViews can be shown" +
" in order. A,B,C views are SurfaceViews, D,E,F views are WebViews, " +
"the sort order of A,B,C are the same with D,E,F when rotate or " +
"restore the screen.");
root.addView(textDes);

for (int i = 0; i < 3; i++) {
XWalkView xWalkView = new XWalkView(this, this);
xWalkView.setX(i * 100);
xWalkView.setY((i + 1) * 100);
xWalkView.setY(150 + i * 70);
xWalkView.load(null, String.format("<html><head><meta name='viewport' content='width=device-width'/></head>"
+ "<body style='background-color: %s;'><h1>%s</h1></body></html>", i % 2 == 0 ? "white" : "grey", i == 0 ? "A" : i == 1 ? "B" : "C"));
root.addView(xWalkView, 200, 200);
Expand All @@ -34,7 +36,7 @@ public void onCreate(Bundle savedInstanceState) {
for (int i = 3; i < 6; i++) {
WebView webView = new WebView(this);
webView.setX(i * 100);
webView.setY((i + 1) * 100);
webView.setY(150 + i * 70);
webView.loadData(String.format("<html><body style='background-color: %s'><h1>%s</h1></body></html>",
i % 2 == 0 ? "white" : "grey", i == 3 ? "D" : i == 4 ? "E" : "F"), "text/html", "utf-8");
root.addView(webView, 200, 200);
Expand Down
Loading

0 comments on commit aa5283c

Please sign in to comment.