Merge pull request #1080 from substars/confirm-dialogs-fix

Fix dialogs and remove extra CONFIRM. Fixes #1078
This commit is contained in:
Milos Kozak 2021-12-16 14:55:31 +01:00 committed by GitHub
commit 176d898d0a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 8 additions and 29 deletions

View file

@ -522,7 +522,7 @@ public class ListenerService extends WearableListenerService implements GoogleAp
intent.putExtras(params); intent.putExtras(params);
startActivity(intent); startActivity(intent);
} else { } else {
showConfirmationDialog(title, message, actionstring); showConfirmationDialog(message, actionstring);
} }
} else if (path.equals(NEW_STATUS_PATH)) { } else if (path.equals(NEW_STATUS_PATH)) {
@ -680,12 +680,10 @@ public class ListenerService extends WearableListenerService implements GoogleAp
notificationManager.createNotificationChannel(channel); notificationManager.createNotificationChannel(channel);
} }
private void showConfirmationDialog(String title, String message, String actionstring) { private void showConfirmationDialog(String message, String actionstring) {
Intent intent = new Intent(this, AcceptActivity.class); Intent 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("title", title);
params.putString("message", message); params.putString("message", message);
params.putString("actionstring", actionstring); params.putString("actionstring", actionstring);
intent.putExtras(params); intent.putExtras(params);

View file

@ -21,7 +21,6 @@ import info.nightscout.androidaps.data.ListenerService;
public class AcceptActivity extends ViewSelectorActivity { public class AcceptActivity extends ViewSelectorActivity {
String title = "";
String message = ""; String message = "";
String actionstring = ""; String actionstring = "";
private DismissThread dismissThread; private DismissThread dismissThread;
@ -34,7 +33,6 @@ public class AcceptActivity extends ViewSelectorActivity {
dismissThread.start(); dismissThread.start();
Bundle extras = getIntent().getExtras(); Bundle extras = getIntent().getExtras();
title = extras.getString("title", "");
message = extras.getString("message", ""); message = extras.getString("message", "");
actionstring = extras.getString("actionstring", ""); actionstring = extras.getString("actionstring", "");
@ -43,7 +41,6 @@ public class AcceptActivity extends ViewSelectorActivity {
return; return;
} }
setContentView(R.layout.grid_layout);
setAdapter(new MyGridViewPagerAdapter()); setAdapter(new MyGridViewPagerAdapter());
Vibrator v = (Vibrator) getSystemService(Context.VIBRATOR_SERVICE); Vibrator v = (Vibrator) getSystemService(Context.VIBRATOR_SERVICE);
@ -73,8 +70,6 @@ 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 headingView = view.findViewById(R.id.title);
headingView.setText(title);
final TextView textView = view.findViewById(R.id.message); final TextView textView = view.findViewById(R.id.message);
textView.setText(message); textView.setText(message);
container.addView(view); container.addView(view);

View file

@ -86,7 +86,7 @@ public class WizardActivity extends ViewSelectorActivity {
@Override @Override
public void onClick(View v) { public void onClick(View v) {
//check if it can happen that the fagment is never created that hold data? // check if it can happen that the fragment is never created that hold data?
// (you have to swipe past them anyways - but still) // (you have to swipe past them anyways - but still)
int percentage = 100; int percentage = 100;

View file

@ -13,18 +13,6 @@
<androidx.core.widget.NestedScrollView <androidx.core.widget.NestedScrollView
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent"> android:layout_height="match_parent">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
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.Medium"
android:textColor="@color/white" />
<TextView <TextView
android:id="@+id/message" android:id="@+id/message"
android:layout_width="match_parent" android:layout_width="match_parent"
@ -32,8 +20,6 @@
android:text="message" android:text="message"
android:textAppearance="@style/TextAppearance.Wearable.Small" android:textAppearance="@style/TextAppearance.Wearable.Small"
android:textColor="@color/white" /> android:textColor="@color/white" />
</LinearLayout>
</androidx.core.widget.NestedScrollView> </androidx.core.widget.NestedScrollView>
</FrameLayout> </FrameLayout>