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"
minSdkVersion 15
targetSdkVersion 19
versionCode 11
versionName "1.0.11"
versionCode 12
versionName "1.0.12"
}
buildTypes {
release {

View file

@ -82,7 +82,11 @@ public class UeControlExecutor implements Runnable, UeBehaviour.DataHandledListe
// Wait for the execution to finnish
if(isRunning()){
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 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
protected void execute() throws Exception {
@ -60,8 +50,19 @@ public class UeBehaviourSendSMS extends UeBehaviour{
PendingIntent deliveredPI = PendingIntent.getBroadcast(
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(deliveryBroadcastReceiver, new IntentFilter(INTENT_ACTION_DELIVERED));
Thread.sleep(SLEEP_PERIOD);
// Send message
log.debug("Sending message");
@ -71,10 +72,12 @@ public class UeBehaviourSendSMS extends UeBehaviour{
// Wait for the message sending
log.debug("Waiting for message delivery");
while(status != MessageStatus.MESSAGE_DELIVERED ||
while(status != MessageStatus.MESSAGE_DELIVERED &&
status != MessageStatus.MESSAGE_CANCELED){
if(status == MessageStatus.MESSAGE_SENT)
this.setProgress(2/3f);
if(stopExecution())
break;
Thread.sleep(SLEEP_PERIOD);
}
this.setProgress(1f);

View file

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