autodismissing confirm activity.
This commit is contained in:
parent
0fe26fda27
commit
a283586a3c
2 changed files with 32 additions and 10 deletions
|
@ -3,6 +3,8 @@ package info.nightscout.androidaps.interaction.actions;
|
||||||
|
|
||||||
import android.content.res.Resources;
|
import android.content.res.Resources;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
import android.os.SystemClock;
|
||||||
|
import android.support.v4.app.NotificationManagerCompat;
|
||||||
import android.support.wearable.view.DotsPageIndicator;
|
import android.support.wearable.view.DotsPageIndicator;
|
||||||
import android.support.wearable.view.GridPagerAdapter;
|
import android.support.wearable.view.GridPagerAdapter;
|
||||||
import android.support.wearable.view.GridViewPager;
|
import android.support.wearable.view.GridViewPager;
|
||||||
|
@ -26,11 +28,15 @@ public class AcceptActivity extends ViewSelectorActivity {
|
||||||
String title = "";
|
String title = "";
|
||||||
String message = "";
|
String message = "";
|
||||||
String actionstring = "";
|
String actionstring = "";
|
||||||
|
private DismissThread dismissThread;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
|
|
||||||
|
this.dismissThread = new DismissThread();
|
||||||
|
dismissThread.start();
|
||||||
|
|
||||||
Bundle extras = getIntent().getExtras();
|
Bundle extras = getIntent().getExtras();
|
||||||
title = extras.getString("title", "");
|
title = extras.getString("title", "");
|
||||||
message = extras.getString("message", "");
|
message = extras.getString("message", "");
|
||||||
|
@ -106,6 +112,32 @@ public class AcceptActivity extends ViewSelectorActivity {
|
||||||
return view==object;
|
return view==object;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public synchronized void onDestroy(){
|
||||||
|
super.onDestroy();
|
||||||
|
if(dismissThread != null){
|
||||||
|
dismissThread.invalidate();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private class DismissThread extends Thread{
|
||||||
|
private boolean valid = true;
|
||||||
|
|
||||||
|
public synchronized void invalidate(){
|
||||||
|
valid = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
SystemClock.sleep(60 * 1000);
|
||||||
|
synchronized (this) {
|
||||||
|
if(valid) {
|
||||||
|
AcceptActivity.this.finish();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -88,16 +88,6 @@ public class MainMenuActivity extends MenuListActivity {
|
||||||
intent = new Intent(this, FillMenuActivity.class);
|
intent = new Intent(this, FillMenuActivity.class);
|
||||||
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||||
this.startActivity(intent);
|
this.startActivity(intent);
|
||||||
/*
|
|
||||||
intent = new Intent(this, AcceptActivity.class);
|
|
||||||
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
|
||||||
Bundle params = new Bundle();
|
|
||||||
params.putString("heading", "Confirm");
|
|
||||||
params.putString("text", "dies\nist ein\nhoffentlich\n langer text\n\ndies\nist ein\nhoffentlich\n langer text\n\ndies\nist ein\nhoffentlich\n langer text\n\ndies\nist ein\nhoffentlich\n langer text\n\n");
|
|
||||||
params.putString("actionstring", "blablubb");
|
|
||||||
intent.putExtras(params);
|
|
||||||
startActivity(intent);
|
|
||||||
*/
|
|
||||||
} else if ("eCarb".equals(action)) {
|
} else if ("eCarb".equals(action)) {
|
||||||
intent = new Intent(this, ECarbActivity.class);
|
intent = new Intent(this, ECarbActivity.class);
|
||||||
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||||
|
|
Loading…
Reference in a new issue