confirm activity working

This commit is contained in:
AdrianLxM 2018-06-27 16:55:37 +02:00
parent aad2b94c8e
commit 0fe26fda27
4 changed files with 42 additions and 16 deletions

View file

@ -28,6 +28,7 @@ import java.util.concurrent.TimeUnit;
import info.nightscout.androidaps.interaction.AAPSPreferences;
import info.nightscout.androidaps.R;
import info.nightscout.androidaps.interaction.actions.AcceptActivity;
import info.nightscout.androidaps.interaction.actions.CPPActivity;
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) {
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){
confirmThread.invalidate();
}
@ -375,7 +386,7 @@ public class ListenerService extends WearableListenerService implements GoogleAp
// keep the confirmation dialog open for one minute.
scheduleDismissConfirm(60);
*/
}
private void scheduleDismissConfirm(final int seconds) {

View file

@ -12,12 +12,8 @@ import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;
import java.text.DecimalFormat;
import info.nightscout.androidaps.R;
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.
@ -27,7 +23,8 @@ import info.nightscout.androidaps.interaction.utils.SafeParse;
public class AcceptActivity extends ViewSelectorActivity {
String text = "";
String title = "";
String message = "";
String actionstring = "";
@Override
@ -35,10 +32,11 @@ public class AcceptActivity extends ViewSelectorActivity {
super.onCreate(savedInstanceState);
Bundle extras = getIntent().getExtras();
text = extras.getString("text", "");
title = extras.getString("title", "");
message = extras.getString("message", "");
actionstring = extras.getString("actionstring", "");
if ("".equals(text) || "".equals(actionstring) ){
if ("".equals(message) || "".equals(actionstring) ){
finish(); return;
}
@ -75,8 +73,10 @@ public class AcceptActivity extends ViewSelectorActivity {
if(col == 0){
final View view = LayoutInflater.from(getApplicationContext()).inflate(R.layout.action_confirm_text, container, false);
final TextView textView = (TextView) view.findViewById(R.id.confirmtext);
textView.setText(text);
final TextView headingView = (TextView) view.findViewById(R.id.title);
headingView.setText(title);
final TextView textView = (TextView) view.findViewById(R.id.message);
textView.setText(message);
container.addView(view);
return view;
} else {

View file

@ -85,17 +85,19 @@ public class MainMenuActivity extends MenuListActivity {
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
this.startActivity(intent);
} 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);
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)) {
intent = new Intent(this, ECarbActivity.class);
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);

View file

@ -14,12 +14,25 @@
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:id="@+id/confirmtext"
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:text="asdfas"
android:textColor="@color/white" />
android:orientation="vertical">
<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>