浏览代码

PathMenu代码优化,相机部分功能优化

huangbo 8 年之前
父节点
当前提交
6af9355106

+ 33 - 0
display-client/build/build-full.properties

@ -0,0 +1,33 @@
1
#######编译环境相关配置#######
2
#JDK路径
3
jdk_home=/home/jenkins/software/jdk1.8.0_102
4
jdk_version=1.6
5
#Android SDK路径
6
android_sdk_home=/home/jenkins/software/android-sdk-linux
7
android_apk_tools=${android_sdk_home}/tools
8
android_tools=${android_sdk_home}/build-tools/24.0.2
9

10
#######应用信息相关配置#######
11
#工程路径
12
project_home=..
13
#App名字
14
app_name=display-client
15
#编译的target
16
android-target=android-22
17
#Android版本
18
android_version=4.4
19

20
#######签名文件相关配置#######
21
key_store=${project_home}/display.keystore
22
key_store_password=display
23
key_alias=display
24
key_alias_password=display
25

26
#######依赖工程相关配置#######
27
library_1=${project_home}/../wade-mobile-common
28
library_2=${project_home}/../wade-mobile-lib
29
#######其他配置#######
30
#log路径
31
log_file=build.log
32
#输出目录
33
output_path=.

+ 1 - 1
display-client/build/build-full.xml

@ -1,7 +1,7 @@
1 1
<?xml version="1.0" encoding="UTF-8"?>
2 2
<project name="apkTargets" default="apkpackaging"  basedir=".">
3 3
	<!-- 指定配置文件 -->  
4
    <property file="build.properties" /> 
4
    <property file="build-full.properties" /> 
5 5
    <record name="${log_file}" loglevel="info" append="no" action="start" />
6 6
	<!-- 识别编译环境 -->
7 7
	<condition property="exe" value=".exe" else=""><os family="windows" /></condition>

+ 0 - 2
display-client/build/build.properties

@ -24,8 +24,6 @@ key_alias=display
24 24
key_alias_password=display
25 25
26 26
#######依赖工程相关配置#######
27
library_1=${project_home}/../wade-mobile-common
28
library_2=${project_home}/../wade-mobile-lib
29 27
libraries=${project_home}/../wade-mobile-lib,${project_home}/../wade-mobile-common
30 28
#######其他配置#######
31 29
#log路径

+ 18 - 55
display-client/src/com/ai/ipu/display/MainActivity.java

@ -1,13 +1,13 @@
1 1
package com.ai.ipu.display;
2 2
3
import java.net.SocketTimeoutException;
4
3 5
import android.annotation.SuppressLint;
4 6
import android.graphics.Rect;
5 7
import android.os.Bundle;
6 8
import android.util.DisplayMetrics;
7 9
import android.view.View;
8 10
9
import java.net.SocketTimeoutException;
10
11 11
import com.ai.ipu.ipupathmenu.PathMenu;
12 12
import com.ai.ipu.ipupathmenu.PathMenu.OnButtonClickListener;
13 13
import com.ai.ipu.mobile.app.AppInfoUtil;
@ -21,6 +21,7 @@ import com.umeng.analytics.MobclickAgent;
21 21
import com.wade.mobile.app.AppRecord;
22 22
import com.wade.mobile.frame.activity.TemplateMainActivity;
23 23
import com.wade.mobile.frame.config.ServerConfig;
24
import com.wade.mobile.func.MobileUI;
24 25
import com.wade.mobile.ui.comp.dialog.ConfirmBlockDialog;
25 26
import com.wade.mobile.ui.view.FlipperLayout;
26 27
import com.wade.mobile.util.Constant;
@ -123,7 +124,7 @@ public class MainActivity extends TemplateMainActivity {
123 124
	private View createMenu() {
124 125
		pathMenu = new PathMenu(getWindow(), this, drawables, menuDrawable, true);
125 126
        pathMenu.setCircle(0.5f);
126
		pathMenu.setPosition(PathMenu.POSITION_TOP_CENTER);
127
		pathMenu.setPosition(PathMenu.Position.BOTTOM_CENTER);
127 128
		setPathMenuItemOnClickListener();
128 129
		return pathMenu;
129 130
	}
@ -136,75 +137,37 @@ public class MainActivity extends TemplateMainActivity {
136 137
			
137 138
			@Override
138 139
			public void onButtonClick(View v, int id) {
139
					openPageByPath(id);
140
					try {
141
						openPageByPath(id);
142
					} catch (Exception e) {
143
						// TODO Auto-generated catch block
144
						error(e);
145
					}
140 146
			}
141 147
		});
142 148
	}
143 149
	
144
	private void openPageByPath(int id){
150
	private void openPageByPath(int id) throws Exception{
151
		MobileUI mobileUI = getPluginManager().getPlugin(MobileUI.class);
145 152
		switch (id) {
146 153
		case 0://插件:基础界面
147
//			Toast.makeText(MainActivity.this, "第"+ id + "个快捷按钮被点击", 2000).show();
148
			try {
149
				getWadeMobileClient().execute(
150
						"openPage",
151
						new Object[] {"Basic", "null", false});
152
			} catch (Exception e) {
153
				e.printStackTrace();
154
			}
155
			break;
154
			mobileUI.openPage("Basic", null);
156 155
		case 1://插件:相机
157
			try {
158
//				Toast.makeText(MainActivity.this, "第"+ id + "个快捷按钮被点击", 2000).show();
159
				getWadeMobileClient().execute(
160
						"openPage",
161
						new Object[] {"Photo", "null", false});
162
			} catch (Exception e) {
163
				e.printStackTrace();
164
			}
156
			mobileUI.openPage("Basic", null);
165 157
			break;
166 158
		case 2://标签插件:
167
			try {
168
//				Toast.makeText(MainActivity.this, "第"+ id + "个快捷按钮被点击", 2000).show();
169
				getWadeMobileClient().execute(
170
						"openPage",
171
						new Object[] {"Hammer", "null", false});
172
			} catch (Exception e) {
173
				e.printStackTrace();
174
			}
159
			mobileUI.openPage("Basic", null);
175 160
			break;
176 161
		case 3://UI插件
177
			try {
178
//				Toast.makeText(MainActivity.this, "第"+ id + "个快捷按钮被点击", 2000).show();
179
				getWadeMobileClient().execute(
180
						"openPage",
181
						new Object[] {"WmDialog", "null", false});
182
			} catch (Exception e) {
183
				e.printStackTrace();
184
			}
162
			mobileUI.openPage("Basic", null);
185 163
			break;
186 164
		case 4:
187
			try {
188
//				Toast.makeText(MainActivity.this, "第"+ id + "个快捷按钮被点击", 2000).show();
189
				getWadeMobileClient().execute(
190
						"loadPage",
191
						new Object[] {"Gesture", "null", false});
192
			} catch (Exception e) {
193
				e.printStackTrace();
194
			}
165
			mobileUI.openPage("Basic", null);
195 166
			break;
196 167
		case 5:
197
			try {
198
//				Toast.makeText(MainActivity.this, "第"+ id + "个快捷按钮被点击", 2000).show();
199
				getWadeMobileClient().execute(
200
						"loadTemplate",
201
						new Object[] {"UI", "null", false});
202
			} catch (Exception e) {
203
				e.printStackTrace();
204
			}
168
			mobileUI.openPage("Basic", null);
205 169
			break;
206 170
		default:
207
//			Toast.makeText(MainActivity.this, "第"+ id + "个快捷按钮被点击", 2000).show();
208 171
			break;
209 172
		}
210 173
	}

+ 55 - 33
wade-mobile-func/src/com/wade/mobile/func/MobileCamera.java

@ -31,11 +31,25 @@ import com.wade.mobile.frame.plugin.Plugin;
31 31
import com.wade.mobile.util.DirectionUtil;
32 32

33 33
/**
34
 * @author Administrator
34
 * @author huangbo
35
 * @date 2017年1月20日 下午5:12:00
36
 * @desc 图片和照相机功能集合
35 37
 */
36 38
public class MobileCamera extends Plugin {
37
	private final int BASE64_TYPE = 0;// Base64编码的字符串
38
	private final int PATH_TYPE = 1;// 文件路径
39
	public enum TYPE {
40
		BASE64_AND_PATH(0), //Base64编码和文件路径
41
		PATH(1), //文件路径
42
		BASE64(2);	//Base64编码
43
		private int type;
44
		private TYPE(int type) {
45
			this.type = type;
46
		}
47
		public int getType() {
48
			return this.type;
49
		}
50
	}
51
	
52
	
39 53
	private int quality = 80; // 压缩率,如果是0,表示不压缩
40 54

41 55
	private SimpleDateFormat format = new SimpleDateFormat("yyyyMMdd-hhmmss");
@ -64,12 +78,7 @@ public class MobileCamera extends Plugin {
64 78
		Intent intent = new Intent(Intent.ACTION_PICK,
65 79
				android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI);
66 80

67
		int requestType;
68
		if (type == BASE64_TYPE) {
69
			requestType = BASE64_TYPE;
70
		} else {
71
			requestType = PATH_TYPE;
72
		}
81
		int requestType = type;
73 82
		startActivityForResult(intent, requestType);
74 83
	}
75 84

@ -95,12 +104,7 @@ public class MobileCamera extends Plugin {
95 104
		Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
96 105
		intent.putExtra(android.provider.MediaStore.EXTRA_OUTPUT, Uri.fromFile(photoFile));
97 106
		
98
		int requestType;
99
		if (type == BASE64_TYPE) {
100
			requestType = BASE64_TYPE;
101
		} else {
102
			requestType = PATH_TYPE;
103
		}
107
		int requestType = type;
104 108
		startActivityForResult(intent, requestType);
105 109
	}
106 110
	
@ -180,16 +184,24 @@ public class MobileCamera extends Plugin {
180 184
			if (resultCode == Activity.RESULT_OK) {
181 185
				Bitmap bitmap = null; 
182 186
				try {
183
					bitmap = getBitmapByImage(photoFullPath);
187
					bitmap = getBitmapByImage(photoFullPath); //核实照片文件是否已经生成???????
184 188
				} catch (Exception e) {
185 189
					HintUtil.alert(context, e.getMessage());
186 190
					return;
187 191
				}
188 192
				
189
				bitmap = MobileGraphics.compressImage(bitmap, 50, quality);	//压缩到50k
190
				MobileGraphics.savePicToLocal(bitmap, photoFullPath); //保存文件
191

192
				if (requestCode == BASE64_TYPE) {
193
				if (requestCode == TYPE.PATH.getType()) {
194
					//MobileGraphics.savePicToLocal(bitmap, photoFullPath); //保存压缩文件
195
					callback(photoFullPath);
196
				}else if(requestCode == TYPE.BASE64.getType()){
197
					bitmap = MobileGraphics.compressImage(bitmap, 50, quality);	//压缩到50k
198
					Bitmap base64Bitmap = MobileGraphics.compressImage(bitmap, 10, 30);	//quality=30?
199
					String out = MobileGraphics.bitmapToString(base64Bitmap); //base64缩略图
200
					base64Bitmap.recycle();
201
					callback(out);
202
				}else{
203
					//MobileGraphics.savePicToLocal(bitmap, photoFullPath); //保存压缩文件
204
					bitmap = MobileGraphics.compressImage(bitmap, 50, quality);	//压缩到50k
193 205
					Bitmap base64Bitmap = MobileGraphics.compressImage(bitmap, 10, 30);	//quality=30?
194 206
					String out = MobileGraphics.bitmapToString(base64Bitmap); //base64处理
195 207
					base64Bitmap.recycle();
@ -197,8 +209,6 @@ public class MobileCamera extends Plugin {
197 209
					result.put("thumbnail", out); //缩略图
198 210
					result.put("path", photoFullPath); //路径
199 211
					callback(result.toString());
200
				}else{
201
					callback(photoFullPath);
202 212
				}
203 213
				bitmap.recycle();
204 214
				photoFullPath = null;
@ -216,21 +226,33 @@ public class MobileCamera extends Plugin {
216 226
					return;
217 227
				}
218 228

219
				if (requestCode == BASE64_TYPE) {
220
					Bitmap bitmap = null; 
221
					try {
222
						bitmap = getBitmapByImage(picturePath);
223
					} catch (Exception e) {
224
						HintUtil.alert(context, e.getMessage());
225
						return;
226
					}
229
				Bitmap bitmap = null; 
230
				try {
231
					bitmap = getBitmapByImage(picturePath);
232
				} catch (Exception e) {
233
					HintUtil.alert(context, e.getMessage());
234
					return;
235
				}
236
				
237
				if (requestCode == TYPE.PATH.getType()) {
238
					callback(picturePath);
239
				}else if(requestCode == TYPE.BASE64.getType()){
240
					bitmap = MobileGraphics.compressImage(bitmap, 50, quality);	//压缩到50k
227 241
					Bitmap base64Bitmap = MobileGraphics.compressImage(bitmap, 10, 30);
228
					String out = MobileGraphics.bitmapToString(base64Bitmap);// base64处理
242
					String out = MobileGraphics.bitmapToString(base64Bitmap);//base64缩略图
229 243
					base64Bitmap.recycle();
230 244
					callback(out);
231
				} else if (requestCode == PATH_TYPE) {// 返回文件名
232
					callback(picturePath);
245
				}else{
246
					bitmap = MobileGraphics.compressImage(bitmap, 50, quality);	//压缩到50k
247
					Bitmap base64Bitmap = MobileGraphics.compressImage(bitmap, 10, 30);	//quality=30?
248
					String out = MobileGraphics.bitmapToString(base64Bitmap); //base64处理
249
					base64Bitmap.recycle();
250
					IData result = new DataMap();
251
					result.put("thumbnail", out); //缩略图
252
					result.put("path", picturePath); //路径
253
					callback(result.toString());
233 254
				}
255
				bitmap.recycle();
234 256
			}
235 257
		}
236 258
	}

+ 10 - 0
wade-mobile-ui/src/com/wade/mobile/ui/anim/AnimationTool.java

@ -1,5 +1,7 @@
1 1
package com.wade.mobile.ui.anim;
2 2

3
import android.R.anim;
4
import android.content.Context;
3 5
import android.view.animation.AlphaAnimation;
4 6
import android.view.animation.Animation;
5 7
import android.view.animation.AnimationSet;
@ -52,6 +54,7 @@ public class AnimationTool {
52 54
	 * @param float pivotX 			动画相对于物件的X坐标的开始位置
53 55
	 * @param float pivotY			动画相对于物件的Y坐标的开始位置 
54 56
	 * 0.0表示收缩到没有,1.0表示正常无伸缩,值小于1.0表示收缩,值大于1.0表示放大
57
	 * 设置RELATIVE_TO_SELF表明所有参数是相对于对象自己
55 58
	 */
56 59
	public static ScaleAnimation createScale(float toX, float toY, float pivotX, float pivotY, long durationMillis) {
57 60
		ScaleAnimation animation = new ScaleAnimation(1.0f, toX, 1.0f, toY, Animation.RELATIVE_TO_SELF, pivotX, Animation.RELATIVE_TO_SELF, pivotY);
@ -167,4 +170,11 @@ public class AnimationTool {
167 170
		animation.setFillAfter(false);
168 171
		return animation;
169 172
	}
173
	
174
	/**
175
	 * Interpolator指定动画插入器 
176
	 * accelerate_decelerate_interpolator  加速-减速 动画 
177
     * accelerate_interpolator        加速-动画
178
     * decelerate_interpolator        减速- 动画
179
	 */
170 180
}

+ 0 - 2
wade-mobile-ui/src/com/wade/mobile/ui/comp/menu/PathMenu.java

@ -28,8 +28,6 @@ public class PathMenu extends RelativeLayout{
28 28
	private int alpha = 127;									//透明度 0-255
29 29
	private double circle = Math.PI;							//扇形菜单占据一圈的比例,0~1 		
30 30
	/*
31
	private final int maxTimeSpent = 1000; 						//最长动画耗时
32
	private final int minTimeSpent = 400;                       //最短动画耗时
33 31
	private int intervalTimeSpent;                             	//菜单按钮之间的时间间隔
34 32
	*/
35 33
	private Button[] buttons;									//Path菜单按钮引用