confirm activity working
This commit is contained in:
parent
aad2b94c8e
commit
0fe26fda27
|
@ -28,6 +28,7 @@ import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
import info.nightscout.androidaps.interaction.AAPSPreferences;
|
import info.nightscout.androidaps.interaction.AAPSPreferences;
|
||||||
import info.nightscout.androidaps.R;
|
import info.nightscout.androidaps.R;
|
||||||
|
import info.nightscout.androidaps.interaction.actions.AcceptActivity;
|
||||||
import info.nightscout.androidaps.interaction.actions.CPPActivity;
|
import info.nightscout.androidaps.interaction.actions.CPPActivity;
|
||||||
import info.nightscout.androidaps.interaction.utils.SafeParse;
|
import info.nightscout.androidaps.interaction.utils.SafeParse;
|
||||||
|
|
||||||
|
@ -345,6 +346,16 @@ public class ListenerService extends WearableListenerService implements GoogleAp
|
||||||
|
|
||||||
private void showConfirmationDialog(String title, String message, String actionstring) {
|
private void showConfirmationDialog(String title, String message, String actionstring) {
|
||||||
|
|
||||||
|
Intent intent = new Intent(this, AcceptActivity.class);
|
||||||
|
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||||
|
Bundle params = new Bundle();
|
||||||
|
params.putString("title", title);
|
||||||
|
params.putString("message", message);
|
||||||
|
params.putString("actionstring", actionstring);
|
||||||
|
intent.putExtras(params);
|
||||||
|
startActivity(intent);
|
||||||
|
|
||||||
|
/*
|
||||||
if(confirmThread != null){
|
if(confirmThread != null){
|
||||||
confirmThread.invalidate();
|
confirmThread.invalidate();
|
||||||
}
|
}
|
||||||
|
@ -375,7 +386,7 @@ public class ListenerService extends WearableListenerService implements GoogleAp
|
||||||
|
|
||||||
// keep the confirmation dialog open for one minute.
|
// keep the confirmation dialog open for one minute.
|
||||||
scheduleDismissConfirm(60);
|
scheduleDismissConfirm(60);
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
private void scheduleDismissConfirm(final int seconds) {
|
private void scheduleDismissConfirm(final int seconds) {
|
||||||
|
|
|
@ -12,12 +12,8 @@ import android.view.ViewGroup;
|
||||||
import android.widget.ImageView;
|
import android.widget.ImageView;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
import java.text.DecimalFormat;
|
|
||||||
|
|
||||||
import info.nightscout.androidaps.R;
|
import info.nightscout.androidaps.R;
|
||||||
import info.nightscout.androidaps.data.ListenerService;
|
import info.nightscout.androidaps.data.ListenerService;
|
||||||
import info.nightscout.androidaps.interaction.utils.PlusMinusEditText;
|
|
||||||
import info.nightscout.androidaps.interaction.utils.SafeParse;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by adrian on 09/02/17.
|
* Created by adrian on 09/02/17.
|
||||||
|
@ -27,7 +23,8 @@ import info.nightscout.androidaps.interaction.utils.SafeParse;
|
||||||
public class AcceptActivity extends ViewSelectorActivity {
|
public class AcceptActivity extends ViewSelectorActivity {
|
||||||
|
|
||||||
|
|
||||||
String text = "";
|
String title = "";
|
||||||
|
String message = "";
|
||||||
String actionstring = "";
|
String actionstring = "";
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -35,10 +32,11 @@ public class AcceptActivity extends ViewSelectorActivity {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
|
|
||||||
Bundle extras = getIntent().getExtras();
|
Bundle extras = getIntent().getExtras();
|
||||||
text = extras.getString("text", "");
|
title = extras.getString("title", "");
|
||||||
|
message = extras.getString("message", "");
|
||||||
actionstring = extras.getString("actionstring", "");
|
actionstring = extras.getString("actionstring", "");
|
||||||
|
|
||||||
if ("".equals(text) || "".equals(actionstring) ){
|
if ("".equals(message) || "".equals(actionstring) ){
|
||||||
finish(); return;
|
finish(); return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -75,8 +73,10 @@ public class AcceptActivity extends ViewSelectorActivity {
|
||||||
|
|
||||||
if(col == 0){
|
if(col == 0){
|
||||||
final View view = LayoutInflater.from(getApplicationContext()).inflate(R.layout.action_confirm_text, container, false);
|
final View view = LayoutInflater.from(getApplicationContext()).inflate(R.layout.action_confirm_text, container, false);
|
||||||
final TextView textView = (TextView) view.findViewById(R.id.confirmtext);
|
final TextView headingView = (TextView) view.findViewById(R.id.title);
|
||||||
textView.setText(text);
|
headingView.setText(title);
|
||||||
|
final TextView textView = (TextView) view.findViewById(R.id.message);
|
||||||
|
textView.setText(message);
|
||||||
container.addView(view);
|
container.addView(view);
|
||||||
return view;
|
return view;
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -85,17 +85,19 @@ public class MainMenuActivity extends MenuListActivity {
|
||||||
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||||
this.startActivity(intent);
|
this.startActivity(intent);
|
||||||
} else if ("Prime/Fill".equals(action)) {
|
} else if ("Prime/Fill".equals(action)) {
|
||||||
/*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 = new Intent(this, AcceptActivity.class);
|
||||||
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||||
Bundle params = new Bundle();
|
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("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");
|
params.putString("actionstring", "blablubb");
|
||||||
intent.putExtras(params);
|
intent.putExtras(params);
|
||||||
startActivity(intent);
|
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);
|
||||||
|
|
|
@ -14,12 +14,25 @@
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent">
|
android:layout_height="match_parent">
|
||||||
|
|
||||||
<TextView
|
<LinearLayout
|
||||||
android:id="@+id/confirmtext"
|
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:text="asdfas"
|
android:orientation="vertical">
|
||||||
android:textColor="@color/white" />
|
<TextView
|
||||||
|
android:id="@+id/title"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:text="title"
|
||||||
|
android:textAppearance="@style/TextAppearance.Wearable.Large"
|
||||||
|
android:textColor="@color/white" />
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/message"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:text="message"
|
||||||
|
android:textAppearance="@style/TextAppearance.Wearable.Medium"
|
||||||
|
android:textColor="@color/white" />
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
</android.support.v4.widget.NestedScrollView>
|
</android.support.v4.widget.NestedScrollView>
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue