yuanhang лет назад: 9
Родитель
Сommit
ee73b12752

+ 3 - 0
multiple-client/clean-res.cmd

@ -0,0 +1,3 @@
1
adb shell rm -r /mnt/sdcard/multiple-client
2
adb shell ls /mnt/sdcard/
3
pause

+ 40 - 7
multiple-client/src/com/ai/mobile/multiple/SubAppActivity.java

@ -1,19 +1,29 @@
1 1
package com.ai.mobile.multiple;
2 2

3
import java.util.HashMap;
4
import java.util.Map;
5

3 6
import android.content.pm.PackageManager.NameNotFoundException;
4 7
import android.os.Bundle;
5 8
import android.view.View;
6 9

10
import com.ailk.common.data.IData;
11
import com.ailk.common.data.impl.DataMap;
7 12
import com.wade.mobile.app.AppRecord;
8 13
import com.wade.mobile.app.MobileOperation;
9 14
import com.wade.mobile.app.MobileUtil;
10 15
import com.wade.mobile.frame.activity.TemplateMainActivity;
11
import com.wade.mobile.frame.config.MobileConfig;
16
import com.wade.mobile.frame.config.ServerConfig;
17
import com.wade.mobile.frame.multiple.MultipleManager;
12 18
import com.wade.mobile.frame.template.TemplateWebView;
19
import com.wade.mobile.func.MobileStorage;
20
import com.wade.mobile.func.MobileUI;
13 21
import com.wade.mobile.ui.comp.dialog.ConfirmBlockDialog;
14 22
import com.wade.mobile.ui.view.FlipperLayout;
15 23

16 24
public class SubAppActivity extends TemplateMainActivity{
25
	private static Map<String,Boolean> firstStatus = new HashMap<String,Boolean>();//判断子应用第一次开启状态
26
	
17 27
	@Override
18 28
	public void onCreate(Bundle savedInstanceState) {
19 29
		setTheme(R.style.Theme_Sherlock_Light);
@ -49,25 +59,48 @@ public class SubAppActivity extends TemplateMainActivity{
49 59
		finish();
50 60
	}
51 61
	
62
	@Override
63
	protected void initActivity() throws Exception {
64
		// TODO Auto-generated method stub
65
		firstStatus.put(MultipleManager.getCurrAppId(), false);
66
		IData param = new DataMap();
67
		MobileStorage mobileStorage = getPluginManager().getPlugin(MobileStorage.class);
68
		param.put("SESSION_ID", mobileStorage.getMemoryCache("SESSION_ID", ""));
69
		param.put("ACCOUNT", mobileStorage.getMemoryCache("ACCOUNT", ""));
70
		
71
		String indexPage = getIntent().getStringExtra("INDEX_PAGE");
72
		indexPage = indexPage == null ? ServerConfig.getInstance().getValue("indexPage") : indexPage;
73
		MobileUI mobileUI = getPluginManager().getPlugin(MobileUI.class);
74
		mobileUI.openPage(indexPage, param);
75
	}
76
	
52 77
	/**
53
	 * 不再更新客户端
78
	 * 第二次进入则不做资源更新客户端更新
54 79
	 */
55
	@Override
56
	protected boolean isUpdateClient(String clientVersion) throws NameNotFoundException {
80
	protected boolean isUpdate() {
57 81
		// TODO Auto-generated method stub
58
		return false;
82
		return firstStatus.get(MultipleManager.getCurrAppId()) == null;
59 83
	}
60 84
	
61 85
	/**
62
	 * 不使用欢迎页
86
	 * 不做客户端更新
63 87
	 */
64 88
	@Override
65
	protected boolean isLoadingPage() {
89
	protected boolean isUpdateClient(String clientVersion) throws NameNotFoundException {
66 90
		// TODO Auto-generated method stub
67 91
		return false;
68 92
	}
69 93
	
70 94
	/**
95
	 * 第二次进入则不使用欢迎页的延时配置
96
	 *//*
97
	@Override
98
	protected boolean isUseLoadingTime() {
99
		// TODO Auto-generated method stub
100
		return firstStatus.get(MultipleManager.getCurrAppId()) == null;
101
	}*/
102
	
103
	/**
71 104
	 * 重写指定欢迎页,不同应用使用不同的欢迎页
72 105
	 */
73 106
	@Override

+ 6 - 2
multiple-client/src/com/ai/mobile/multiple/func/AppManagePlugin.java

@ -16,7 +16,6 @@ import com.ailk.common.data.impl.DatasetList;
16 16
import com.wade.mobile.app.MobileUtil;
17 17
import com.wade.mobile.app.SimpleUpdate;
18 18
import com.wade.mobile.frame.IWadeMobile;
19
import com.wade.mobile.frame.config.ServerPageConfig;
20 19
import com.wade.mobile.frame.multiple.MultipleAppConfig;
21 20
import com.wade.mobile.frame.multiple.MultipleManager;
22 21
import com.wade.mobile.frame.plugin.Plugin;
@ -52,6 +51,7 @@ public class AppManagePlugin extends Plugin {
52 51
						appData.getString("requestServlet"), 
53 52
						appData.getString("appPath"));
54 53
				appConfig.putDefine("appWelcomePage", appData.getString("appWelcomePage"));
54
				appConfig.putDefine("appIndexPage", appData.getString("appIndexPage"));
55 55
				MultipleManager.putAppConfig(appData.getString("appId"), appConfig);
56 56
			}else if("N".equals(appData.getString("appType"))){
57 57
				nativeAppConfigs.put(appData.getString("appId"), 
@ -66,15 +66,19 @@ public class AppManagePlugin extends Plugin {
66 66
	 * 打开IPU应用
67 67
	 */
68 68
	public void openIpuApp(JSONArray params) throws Exception {
69
		String basePath = TemplateManager.getBasePath();//欢迎页存储在multiple的应用中,所以需要放在setCurrAppId之前
69 70
		String appId = params.getString(0);
70 71
		MultipleManager.setCurrAppId(appId);
71 72
		MultipleManager.setMultiple(true);
72 73
		Intent intent = new Intent(wademobile.getActivity(), SubAppActivity.class);
73 74
		
74 75
		MultipleAppConfig appConfig = MultipleManager.getAppConfig(appId);
76
		
77
		String indexPage = appConfig.getDefine("appIndexPage");
75 78
		String appWelcomePage = appConfig.getDefine("appWelcomePage");
76
		String welcomePage = Constant.START_FILE + FileUtil.connectFilePath(TemplateManager.getBasePath(),appWelcomePage);
79
		String welcomePage = Constant.START_FILE + FileUtil.connectFilePath(basePath, appWelcomePage);
77 80
		
81
		intent.putExtra("INDEX_PAGE", indexPage);//IPU的初始页
78 82
		intent.putExtra("WELCOME_PAGE", welcomePage);//IPU的欢迎页
79 83
		startActivityForResult(intent, OPEN_IPU_APP);
80 84
	}

+ 4 - 4
multiple-server/etc/app-config.xml

@ -1,14 +1,14 @@
1 1
<?xml version="1.0" encoding="UTF-8"?>
2 2
<apps>
3 3
	<app appId="display" appName="IPU展示" appType="I" appIcon="e_ico-qr"
4
		appWelcomePage="welcome/WelcomeDisplay.htm" requestHost="http://114.215.100.48:8080"
4
		appWelcomePage="welcome/WelcomeDisplay.htm" requestHost="http://10.0.2.2:8080"
5 5
		requestPath="/display" requestServlet="/mobiledata" appPath="display-client" />
6 6

7
	<app appId="ioo" appName="广东统一平台" appType="I" appIcon="e_ico-audio"
8
		appWelcomePage="welcome/WebcomeIoo.htm" requestHost="http://114.215.100.48:8080"
7
	<app appId="ioo" appName="广东统一平台" appType="I" appIcon="e_ico-audio" appIndexPage="Home"
8
		appWelcomePage="welcome/WelcomeIoo.htm" requestHost="http://114.215.100.48:8080"
9 9
		requestPath="/ioo" requestServlet="/mobiledata" appPath="ioo-client" />
10 10
	
11
	<app appId="mutl" appName="1vsN平台" appType="I" appIcon="e_ico-file"
11
	<app appId="mutl" appName="1vsN平台" appType="I" appIcon="e_ico-file" appIndexPage="Index"
12 12
		appWelcomePage="welcome/WelcomeDisplay.htm" requestHost="http://10.0.2.2:8080"
13 13
		requestPath="/mutl" requestServlet="/mobiledata" appPath="mutl-client" />
14 14


+ 3 - 0
multiple-server/src/com/ai/server/multiple/core/config/AppConfig.java

@ -67,6 +67,9 @@ public class AppConfig extends AbstractConfig {
67 67
			if(((Element) node).attributeValue(Constant.AppConfig.DOWNLOAD_URL)!=null)
68 68
				appMap.put(Constant.AppConfig.DOWNLOAD_URL, 
69 69
						((Element) node).attributeValue(Constant.AppConfig.DOWNLOAD_URL));
70
			if(((Element) node).attributeValue(Constant.AppConfig.APP_INDEX_PAGE)!=null)
71
				appMap.put(Constant.AppConfig.APP_INDEX_PAGE, 
72
						((Element) node).attributeValue(Constant.AppConfig.APP_INDEX_PAGE));
70 73
			
71 74
			results.add(appMap);
72 75
		}

+ 2 - 0
multiple-server/src/com/ai/server/multiple/util/Constant.java

@ -36,6 +36,8 @@ public class Constant {
36 36
		public static final String APP_TYPE = "appType";
37 37
		public static final String APP_ICON = "appIcon";
38 38
		public static final String APP_WELCOME_PAGE = "appWelcomePage";
39
		public static final String APP_INDEX_PAGE = "appIndexPage";
40
		
39 41
		public static final String REQUEST_HOST = "requestHost";
40 42
		public static final String REQUEST_PATH = "requestPath";
41 43
		public static final String REQUEST_SERVLET = "requestServlet";