Selaa lähdekoodia

Merge branch 'master' of http://10.1.235.20:3000/ipu/android-share.git

huangbo 8 vuotta sitten
vanhempi
commit
d55814f8c5

+ 6 - 6
display-client/assets/mobile-action.xml

@ -1,10 +1,10 @@
1 1
<?xml version="1.0" encoding="UTF-8"?>
2 2
<actions>
3 3
    <!-- MobileBasic -->
4
	<action name="call" class="com.ai.ipu.func.MobileBasic" method="call"/>
5
	<action name="beep" class="com.ai.ipu.func.MobileBasic" method="beep"/>
6
	<action name="sms" class="com.ai.ipu.func.MobileBasic" method = "sms"/>
7
	<action name="shock" class="com.ai.ipu.func.MobileBasic" method="shock"/>
4
	<action name="call" class="com.wade.mobile.func.MobileBasic" method="call"/>
5
	<action name="beep" class="com.wade.mobile.func.MobileBasic" method="beep"/>
6
	<action name="sms" class="com.wade.mobile.func.MobileBasic" method = "sms"/>
7
	<action name="shock" class="com.wade.mobile.func.MobileBasic" method="shock"/>
8 8
	<!-- MobileApp -->
9 9
	<action name="close" class="com.wade.mobile.func.MobileApp" method="close"/>
10 10
	<action name="logCat" class="com.wade.mobile.func.MobileApp" method="logCat"/>
@ -161,9 +161,9 @@
161 161
	<action name="shareFileMore" class="com.ai.ipu.share.func.MobileShareByApp" method="shareFileMore"></action>
162 162
	
163 163
	<!-- Sweet控件 -->
164
	<action name="sweetAlert" class="com.ai.ipu.alertdialog.func.MobileUIWithSAD" method="sweetAlert"/>
164
<!-- 	<action name="sweetAlert" class="com.ai.ipu.alertdialog.func.MobileUIWithSAD" method="sweetAlert"/>
165 165
	<action name="sweetConfirm" class="com.ai.ipu.alertdialog.func.MobileUIWithSAD" method="sweetConfirm"/>
166
	<action name="sweetLoading" class="com.ai.ipu.alertdialog.func.MobileUIWithSAD" method="sweetLoading"/>
166
	<action name="sweetLoading" class="com.ai.ipu.alertdialog.func.MobileUIWithSAD" method="sweetLoading"/> -->
167 167

168 168
	<!-- 邮件 -->
169 169
	<action name="shareImageBymail" class="com.ai.ipu.mail.func.MailSendByApp" method="shareImageBymail"></action>	

BIN
display-client/res/drawable/composer_camera.png


BIN
display-client/res/drawable/composer_music.png


BIN
display-client/res/drawable/composer_place.png


BIN
display-client/res/drawable/composer_sleep.png


BIN
display-client/res/drawable/composer_thought.png


BIN
display-client/res/drawable/composer_with.png


BIN
display-client/res/drawable/friends_delete.png


+ 0 - 2
ipupathmenu-lib/.gitignore

@ -1,2 +0,0 @@
1
/bin/
2
/gen/

+ 152 - 0
wade-mobile-func/src/com/wade/mobile/func/MobileBasic.java

@ -0,0 +1,152 @@
1
package com.wade.mobile.func;
2
3
import java.util.ArrayList;
4
5
import org.json.JSONArray;
6
7
import android.app.PendingIntent;
8
import android.content.Context;
9
import android.content.Intent;
10
import android.media.Ringtone;
11
import android.media.RingtoneManager;
12
import android.net.Uri;
13
import android.os.Vibrator;
14
import android.telephony.SmsManager;
15
import android.widget.Toast;
16
17
import com.wade.mobile.frame.IWadeMobile;
18
import com.wade.mobile.frame.plugin.Plugin;
19
import com.wade.mobile.util.Constant;
20
import com.wade.mobile.util.Messages;
21
22
public class MobileBasic extends Plugin {
23
24
	public MobileBasic(IWadeMobile wademobile) {
25
		super(wademobile);
26
	}
27
28
	public void call(JSONArray param) throws Exception {
29
		if(param.length()<2){
30
			throw new Exception(Messages.EXCEPTION_PARAM);
31
		}
32
		String sn = param.getString(0);
33
		boolean flag  = param.getBoolean(1);
34
		call(sn, flag);
35
	}
36
	
37
	/**
38
	 * 呼出电话
39
	 * @param sn
40
	 */
41
	public void call(String sn,boolean autoCall) {
42
		if(autoCall){
43
			/**权限:android.permission.CALL_PHONE*/
44
			Intent intent = new Intent(Intent.ACTION_CALL,Uri.parse("tel:"+ sn));
45
			this.context.startActivity(intent);
46
		}else{
47
			/**Intent.ACTION_CALL|Intent.ACTION_DIAL*/
48
			Intent intent = new Intent(Intent.ACTION_DIAL,Uri.parse("tel:"+ sn));
49
			this.context.startActivity(intent);
50
		}
51
	}
52
	
53
	public void sms(JSONArray param) throws Exception {
54
		if(param.length()<3){
55
			throw new Exception(Messages.EXCEPTION_PARAM);
56
		}
57
		String sn = param.getString(0);
58
		String message = param.getString(1);
59
		boolean flag  = param.getBoolean(2);
60
		sms(sn,message, flag);
61
	}
62
	
63
	/**
64
	 * 短信
65
	 */
66
	public void sms(String sn,String message,boolean flag) {
67
		if(flag){
68
			/**权限:android.permission.SEND_SMS*/
69
			Intent intent = new Intent(Intent.ACTION_SENDTO);
70
			SmsManager smsManager = SmsManager.getDefault();   
71
	        PendingIntent pi = PendingIntent.getActivity(this.context, 0, intent, 0);   
72
	        //短信内容长度超过70则分多条发送
73
	        if (message.length() > 70){
74
	            ArrayList<String> msgs = smsManager.divideMessage(message);   
75
	            for (String msg : msgs){   
76
	                smsManager.sendTextMessage(sn, null, msg, pi, null);   
77
	            }
78
	        }else{   
79
	            smsManager.sendTextMessage(sn, null, message, pi, null);   
80
	        }
81
	        if(message.length()>30){
82
	        	message = message.substring(0,30)+"……"+Constant.LINE_SEPARATOR+Messages.SMS_SUCCESS;
83
	        }else{
84
	        	message = message+Constant.LINE_SEPARATOR+Messages.SMS_SUCCESS;
85
	        }
86
	        Toast.makeText(this.context, message, Toast.LENGTH_SHORT).show();
87
		}else{
88
			Intent intent = new Intent(Intent.ACTION_VIEW);
89
			intent.setData(Uri.parse("sms:"+ sn));
90
			intent.putExtra("address", sn);
91
			intent.putExtra("sms_body", message); 
92
			intent.setType("vnd.android-dir/mms-sms");
93
			this.context.startActivity(intent);
94
		}
95
	}
96
	
97
	public void beep(JSONArray param) throws Exception {
98
		if(param.length()<1){
99
			throw new Exception(Messages.EXCEPTION_PARAM);
100
		}
101
		long count = param.getLong(0);
102
		beep(count);
103
	}
104
	
105
	/**
106
	 * 响铃
107
	 */
108
	public void beep(long count) {
109
		Uri ringtone = RingtoneManager
110
				.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION);
111
		Ringtone notification = RingtoneManager.getRingtone(this.context,
112
				ringtone);
113
114
		// If phone is not set to silent mode
115
		if (notification != null) {
116
			for (long i = 0; i < count; i++) {
117
				notification.play();
118
				long timeout = 5000;
119
				while (notification.isPlaying() && (timeout > 0)) {
120
					timeout = timeout - 100;
121
					try {
122
						Thread.sleep(100);
123
					} catch (InterruptedException e) {
124
					}
125
				}
126
			}
127
		}
128
	}
129
	
130
	public void shock(JSONArray param) throws Exception {
131
		if(param.length()<1){
132
			throw new Exception(Messages.EXCEPTION_PARAM);
133
		}
134
		long time = param.getLong(0);
135
		shock(time);
136
	}
137
	
138
	/**
139
	 * 震动
140
	 */
141
	public void shock(long time) {
142
		// Start the vibration, 0 defaults to half a second.
143
		if (time < 500) {
144
			time = 500;
145
		} else if (time > 10000) {
146
			time = 10000;
147
		}
148
		Vibrator vibrator = (Vibrator) this.context.getSystemService(Context.VIBRATOR_SERVICE);
149
		vibrator.vibrate(time);
150
	}
151
}
152

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

@ -86,7 +86,7 @@ public class PathMenu extends RelativeLayout{
86 86
				menuBtnY = menuBtn.getBottom();
87 87
				break;
88 88
			case MotionEvent.ACTION_MOVE:
89
				if(500 <= System.currentTimeMillis() - touchStartTime){ //当执行触摸时间大于0.5秒时,才执行移动;避免因屏幕敏感导致点击变成滑动事件
89
				if(300 <= System.currentTimeMillis() - touchStartTime){ //当执行触摸时间大于0.3秒时,才执行移动;避免因屏幕敏感导致点击变成滑动事件
90 90
					if(isCanDrag){
91 91
						int x_move = (int) event.getRawX();
92 92
						int y_move = (int) event.getRawY();