Fixed SMS behaviour.

Fixed reset button not updating status.
This commit is contained in:
Ziver Koc 2014-08-06 17:41:28 +02:00
parent 331b244a0e
commit 2efed01291
5 changed files with 22 additions and 15 deletions

Binary file not shown.

View file

@ -8,8 +8,8 @@ android {
applicationId "com.ericsson.uecontrol" applicationId "com.ericsson.uecontrol"
minSdkVersion 15 minSdkVersion 15
targetSdkVersion 19 targetSdkVersion 19
versionCode 11 versionCode 12
versionName "1.0.11" versionName "1.0.12"
} }
buildTypes { buildTypes {
release { release {

View file

@ -82,7 +82,11 @@ public class UeControlExecutor implements Runnable, UeBehaviour.DataHandledListe
// Wait for the execution to finnish // Wait for the execution to finnish
if(isRunning()){ if(isRunning()){
synchronized (thread){ synchronized (thread){
try { thread.wait(); }catch(InterruptedException e) {log.error(null,e);} try {
thread.wait();
while(isRunning()) // Just to make sure it has stopped
Thread.sleep(10);
}catch(InterruptedException e) {log.error(null,e);}
} }
} }
} }

View file

@ -36,16 +36,6 @@ public class UeBehaviourSendSMS extends UeBehaviour{
private transient MessageStatus status; private transient MessageStatus status;
private transient Exception exception; private transient Exception exception;
private transient BroadcastReceiver sentBroadcastReceiver = new BroadcastReceiver() {
public void onReceive(Context arg0, Intent arg1) {
setSendingStatus(getResultCode());
}
};
private transient BroadcastReceiver deliveryBroadcastReceiver = new BroadcastReceiver() {
public void onReceive(Context arg0, Intent arg1) {
setDeliveryStatus(getResultCode());
}
};
@Override @Override
protected void execute() throws Exception { protected void execute() throws Exception {
@ -60,8 +50,19 @@ public class UeBehaviourSendSMS extends UeBehaviour{
PendingIntent deliveredPI = PendingIntent.getBroadcast( PendingIntent deliveredPI = PendingIntent.getBroadcast(
context, 0, new Intent(INTENT_ACTION_DELIVERED), 0); context, 0, new Intent(INTENT_ACTION_DELIVERED), 0);
BroadcastReceiver sentBroadcastReceiver = new BroadcastReceiver() {
public void onReceive(Context arg0, Intent arg1) {
setSendingStatus(getResultCode());
}
};
BroadcastReceiver deliveryBroadcastReceiver = new BroadcastReceiver() {
public void onReceive(Context arg0, Intent arg1) {
setDeliveryStatus(getResultCode());
}
};
context.registerReceiver(sentBroadcastReceiver, new IntentFilter(INTENT_ACTION_SENT)); context.registerReceiver(sentBroadcastReceiver, new IntentFilter(INTENT_ACTION_SENT));
context.registerReceiver(deliveryBroadcastReceiver, new IntentFilter(INTENT_ACTION_DELIVERED)); context.registerReceiver(deliveryBroadcastReceiver, new IntentFilter(INTENT_ACTION_DELIVERED));
Thread.sleep(SLEEP_PERIOD);
// Send message // Send message
log.debug("Sending message"); log.debug("Sending message");
@ -71,10 +72,12 @@ public class UeBehaviourSendSMS extends UeBehaviour{
// Wait for the message sending // Wait for the message sending
log.debug("Waiting for message delivery"); log.debug("Waiting for message delivery");
while(status != MessageStatus.MESSAGE_DELIVERED || while(status != MessageStatus.MESSAGE_DELIVERED &&
status != MessageStatus.MESSAGE_CANCELED){ status != MessageStatus.MESSAGE_CANCELED){
if(status == MessageStatus.MESSAGE_SENT) if(status == MessageStatus.MESSAGE_SENT)
this.setProgress(2/3f); this.setProgress(2/3f);
if(stopExecution())
break;
Thread.sleep(SLEEP_PERIOD); Thread.sleep(SLEEP_PERIOD);
} }
this.setProgress(1f); this.setProgress(1f);

View file

@ -267,7 +267,7 @@ public class DynamicListView extends ListView {
int deltaY = mLastEventY - mDownY; int deltaY = mLastEventY - mDownY;
if (mMode == TouchMode.UNKNOWN) { if (mMode == TouchMode.UNKNOWN) {
if (Math.abs(deltaX) > 50 || Math.abs(deltaY) > 50) { if (Math.abs(deltaX) > 70 || Math.abs(deltaY) > 50) {
if (Math.abs(deltaX) >= Math.abs(deltaY)) if (Math.abs(deltaX) >= Math.abs(deltaY))
mMode = TouchMode.REMOVE; mMode = TouchMode.REMOVE;
if (Math.abs(deltaX) < Math.abs(deltaY) && mDownX < SWAP_OFFSET) if (Math.abs(deltaX) < Math.abs(deltaY) && mDownX < SWAP_OFFSET)