Quellcode durchsuchen

添加对netapp模式的支持

ybf326 vor 9 Jahren
Ursprung
Commit
26f111a4f0

+ 1 - 0
display-client/assets/mobile-action.xml

@ -18,6 +18,7 @@
18 18
	<action name="setSmsListener" class="com.wade.mobile.func.MobileNetWork" method="setSmsListener"></action>
19 19
	<action name="downloadWithServlet" class="com.wade.mobile.func.MobileNetWork" method="downloadWithServlet"></action>
20 20
	<action name="uploadWithServlet" class="com.wade.mobile.func.MobileNetWork" method="uploadWithServlet"></action>
21
	<action name="openBrowser" class="com.wade.mobile.func.MobileNetWork" method="openBrowser" ></action>
21 22
	<!-- NFC -->
22 23
	<action name="initNfc" class="com.wade.mobile.func.MobileDevice" method="initNfc"></action>
23 24
	

+ 51 - 0
display-client/src/com/ai/mobile/display/MainActivity.java.net

@ -0,0 +1,51 @@
1
package com.ai.mobile.display;
2

3
import android.content.pm.ActivityInfo;
4
import android.os.Bundle;
5

6
import com.wade.mobile.app.MobileAppInfo;
7
import com.wade.mobile.app.MobileOperation;
8
import com.wade.mobile.frame.activity.NetMobileActivity;
9
import com.wade.mobile.frame.net.NetWebView;
10
import com.wade.mobile.ui.comp.dialog.ConfirmBlockDialog;
11
import com.wade.mobile.util.Messages;
12

13
public class MainActivity extends NetMobileActivity {
14
	@Override
15
	public void onCreate(Bundle savedInstanceState) {
16
		setTheme(R.style.Theme_Sherlock_Light);
17
		MobileAppInfo appInfo = MobileAppInfo.getInstance(this);
18
		if(appInfo.isTablet()){
19
			setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
20
		}else{
21
			setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
22
		}
23
		super.onCreate(savedInstanceState);
24
	}
25
	
26
	@Override
27
	public void onBackPressed() {
28
		getWadeMobileClient().shutdownByConfirm(Messages.CONFIRM_CLOSE);
29
	}
30
	
31
	@Override
32
	public void loadingError(final NetWebView webView, final int errorCode,
33
			final String description, final String failingUrl) {
34
		MainActivity.this.runOnUiThread(new Runnable() {
35
			@Override
36
			public void run() {
37
				try {
38
					webView.loadAssetHtml("html/welcome.html");
39
				} catch (Exception e) {
40
					e.printStackTrace();
41
				}finally{
42
					ConfirmBlockDialog dialog = new ConfirmBlockDialog(MainActivity.this, "异常", "资源加载异常,请检查网络与防火墙设置。即将退出应用……" , "确定" , null);
43
					dialog.show();
44
					if(dialog.getResult() == ConfirmBlockDialog.Result.OK ){
45
						MobileOperation.exitApp();
46
					}
47
				}
48
			}
49
		});
50
	}
51
}

+ 2 - 0
display-server/web/res/js/mobile/expand-mobile.js

@ -173,6 +173,8 @@ define(["require"],function(require) {
173 173
				execute("cleanResource",[type],err);
174 174
			},shareByBluetooth:function(err){
175 175
				execute("shareByBluetooth", [],err);
176
			},openBrowser:function(url,err){
177
				execute("openBrowser",[url],err);
176 178
			},setSmsListener:function(callback,telString,isEscape,err){
177 179
				if(isEscape == undefined ){
178 180
					isEscape = true;

+ 1 - 4
general-web-server/src/com/data/DataServlet.java

@ -21,11 +21,8 @@ public class DataServlet extends  HttpServlet{
21 21
			throws ServletException, IOException {
22 22
		req.setCharacterEncoding("UTF-8");
23 23
		resp.setCharacterEncoding("UTF-8");
24
		/*InputStream in = req.getInputStream();
25
		InputStreamReader reader = new InputStreamReader(in,"UTF-8");
26
		BufferedReader r = new BufferedReader(reader);*/
27 24
		String name = req.getParameter("name");
28
		System.out.println("获取到参数:" + name);
25
		System.out.println("name:" + name);
29 26
		JSONObject obj = new JSONObject();
30 27
		obj.put("name", name);
31 28
		obj.put("age", 28);

BIN
general-web-server/web/WEB-INF/classes/com/data/DataServlet.class


+ 5 - 1
general-web-server/web/biz/js/common/biz-mobile.js

@ -5,11 +5,15 @@ window.BizMobile = (function() {
5 5
	
6 6
	var BizMobile = (function(){
7 7
		return{
8
			openBrowser:function(url,err){
8
			/*openBrowser:function(url,err){
9 9
				execute("openBrowser",[url],err);
10 10
			},getImei:function(callback,err){
11 11
				storageCallback("getImei",callback);
12 12
				execute("getImei", [],err);
13
			}*/
14
			getImei:function(callback,err){
15
				alert("可以自定义插件。这里暂时调用框架里面的方法。");
16
				WadeMobile.getSysInfo(callback,"IMEI",err);
13 17
			}
14 18
		};
15 19
	})();

+ 43 - 24
general-web-server/web/html/myindex.html

@ -3,31 +3,28 @@
3 3
	<head>
4 4
		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
5 5
		<title></title>
6
		<script src="res/js/mobile-core.js"></script>
7
		<script src="res/js/zepto.js"></script>
8
		<script src="res/js/base64.js"></script>
9
		<script src="res/js/jcl.js"></script>
10
		<script src="res/js/wade-mobile.js"></script>
11
		<script src="res/js/expand-mobile.js"></script>
12
		<script src="biz/js/common/biz-mobile.js"></script>
6
		<script src="../res/js/mobile-core.js"></script>
7
		<script src="../res/js/zepto.js"></script>
8
		<script src="../res/js/base64.js"></script>
9
		<script src="../res/js/jcl.js"></script>
10
		<script src="../res/js/wade-mobile.js"></script>
11
		<script src="../res/js/expand-mobile.js"></script>
12
		<script src="../biz/js/common/biz-mobile.js"></script>
13 13
	</head>
14 14
	<body>
15 15
		<script type="text/javascript">
16
			//alert("Wade.DataMap: " + Wade.DataMap);
17
			//alert("WadeMobile.beep: " + WadeMobile.beep);
18
			WadeMobile.tip("你好,我好,大家好………………");
16
			WadeMobile.tip("世界,你好!");
19 17
		</script>
20
		<h1>你好!!!</h1>
21
		<button style="width:200px;height:100px;" id="openBrowser">打开浏览器(无回调)</button>
18
		<div style="margin: 0 auto;"><h1>演示</h1></div>
19
		<br /><br />
20
		<button style="width:200px;height:100px;" id="openBrowser">打开浏览器(openBrowser)</button>
22 21
		<script type="text/javascript">
23 22
			var btn = document.getElementById("openBrowser");
24 23
			btn.onclick = function(){
25 24
				WadeMobile.openBrowser("http://3g.baidu.com");
26
				/* WadeMobile.getContacts(function(result){
27
					alert(result.toString());
28
				}); */
29 25
			}
30 26
		</script>
27
		<br /><br />
31 28
		<button style="width:200px;height:100px;" id="getImei">获取手机IMEI号(回调)</button>
32 29
		<script type="text/javascript">
33 30
			var btn = document.getElementById("getImei");
@ -37,19 +34,41 @@
37 34
				});
38 35
			}
39 36
		</script>
37
		<br /><br />
40 38
		<button style="width: 200px;height: 100px;" id="sendAjaxPost">发送Post请求</button>
41 39
		<script type="text/javascript">
42 40
			var btn = document.getElementById("sendAjaxPost");
43 41
			btn.onclick = function(){
44
				$.post('data', { name:'zhangsan1' }, function(response){ 
45
					  alert(response);
46
				}) 
47
				/* $.get("data?name=zhangsan001",function(data){
48
					alert(data);
49
				}); */
50
				/* for(var i in XMLHttpRequest){
51
					console.log(i + "---" + XMLHttpRequest[i]);
52
				} */
42
				//创建XMLHttpRequest对象
43
				xhr = new XMLHttpRequest();
44
				//注册回调函数
45
				xhr.onreadystatechange=callback;
46
				//第一个参数设置成post,第二个写url地址,第三个为是否采用异步方式
47
				xhr.open("POST","../data",true);
48
				//post请求需要自己设置请求头
49
				xhr.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
50
				//post请求
51
				xhr.send("name=lisi");
52
			}
53
			function callback(){
54
				//接收响应数据
55
				//判断对象状态是否交互完成,如果为4则交互完成
56
				if(xhr.readyState == 4){
57
					//判断对象状态是否交互成功,如果成功则为200
58
					if(xhr.status == 200){
59
						//接收数据,得到服务器输出的纯属文本数据
60
						var response = xhr.responseText;
61
						alert("返回的数据为:" + response);
62
					}
63
				}
64
			}
65
		</script>
66
		<br /><br />
67
		<button style="width:200px;height:100px;" id="hrefBaidu">跳转到百度(href)</button>
68
		<script type="text/javascript">
69
			var btn = document.getElementById("hrefBaidu");
70
			btn.onclick = function(){
71
				window.location.href="http://3g.baidu.com";
53 72
			}
54 73
		</script>
55 74
	</body>

+ 51 - 0
general-web-server/web/res/java/MainActivity.java.net

@ -0,0 +1,51 @@
1
package com.ai.mobile.display;
2

3
import android.content.pm.ActivityInfo;
4
import android.os.Bundle;
5

6
import com.wade.mobile.app.MobileAppInfo;
7
import com.wade.mobile.app.MobileOperation;
8
import com.wade.mobile.frame.activity.NetMobileActivity;
9
import com.wade.mobile.frame.net.NetWebView;
10
import com.wade.mobile.ui.comp.dialog.ConfirmBlockDialog;
11
import com.wade.mobile.util.Messages;
12

13
public class MainActivity extends NetMobileActivity {
14
	@Override
15
	public void onCreate(Bundle savedInstanceState) {
16
		setTheme(R.style.Theme_Sherlock_Light);
17
		MobileAppInfo appInfo = MobileAppInfo.getInstance(this);
18
		if(appInfo.isTablet()){
19
			setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
20
		}else{
21
			setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
22
		}
23
		super.onCreate(savedInstanceState);
24
	}
25
	
26
	@Override
27
	public void onBackPressed() {
28
		getWadeMobileClient().shutdownByConfirm(Messages.CONFIRM_CLOSE);
29
	}
30
	
31
	@Override
32
	public void loadingError(final NetWebView webView, final int errorCode,
33
			final String description, final String failingUrl) {
34
		MainActivity.this.runOnUiThread(new Runnable() {
35
			@Override
36
			public void run() {
37
				try {
38
					webView.loadAssetHtml("html/welcome.html");
39
				} catch (Exception e) {
40
					e.printStackTrace();
41
				}finally{
42
					ConfirmBlockDialog dialog = new ConfirmBlockDialog(MainActivity.this, "异常", "资源加载异常,请检查网络与防火墙设置。即将退出应用……" , "确定" , null);
43
					dialog.show();
44
					if(dialog.getResult() == ConfirmBlockDialog.Result.OK ){
45
						MobileOperation.exitApp();
46
					}
47
				}
48
			}
49
		});
50
	}
51
}

+ 2 - 0
general-web-server/web/res/js/expand-mobile.js

@ -173,6 +173,8 @@ window.ExpandMobile = (function() {
173 173
				execute("cleanResource",[type],err);
174 174
			},shareByBluetooth:function(err){
175 175
				execute("shareByBluetooth", [],err);
176
			},openBrowser:function(url,err){
177
				execute("openBrowser",[url],err);
176 178
			},setSmsListener:function(callback,telString,isEscape,err){
177 179
				if(isEscape == undefined ){
178 180
					isEscape = true;

+ 16 - 0
wade-mobile-func/src/com/wade/mobile/func/MobileNetWork.java

@ -10,6 +10,7 @@ import org.json.JSONArray;
10 10

11 11
import android.bluetooth.BluetoothAdapter;
12 12
import android.content.Intent;
13
import android.net.Uri;
13 14
import android.os.AsyncTask;
14 15
import android.os.Build;
15 16
import android.widget.Toast;
@ -303,6 +304,21 @@ public class MobileNetWork extends Plugin {
303 304
			}
304 305
		}
305 306
	}
307
	/**
308
	 * 打开浏览器
309
	 */
310
	public void openBrowser(JSONArray param) throws Exception {
311
		String url = param.getString(0);
312
		openBrowser(url);
313
	}
314
	/**
315
	 * 打开浏览器
316
	 */
317
	public void openBrowser(String url) {
318
		Uri uri = Uri.parse(url);
319
		Intent intent = new Intent(Intent.ACTION_VIEW, uri);
320
		context.startActivity(intent);
321
	}
306 322
	
307 323
	public void uploadWithServlet(JSONArray param) throws Exception {
308 324
		JSONArray filePaths = param.getJSONArray(0);