From 1ecc61452fb0a9e278836e16b8058ebe2c1d7222 Mon Sep 17 00:00:00 2001 From: jens Date: Tue, 19 Jul 2022 17:57:47 +0200 Subject: [PATCH] notification dismiss with button --- ...ActivityManageActionCloseNotification.java | 18 +++++++++- ...ivity_manage_action_close_notification.xml | 35 +++++++++++++++++++ app/src/main/res/values/strings.xml | 2 ++ 3 files changed, 54 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/com/jens/automation2/ActivityManageActionCloseNotification.java b/app/src/main/java/com/jens/automation2/ActivityManageActionCloseNotification.java index ff441288..6c56d270 100644 --- a/app/src/main/java/com/jens/automation2/ActivityManageActionCloseNotification.java +++ b/app/src/main/java/com/jens/automation2/ActivityManageActionCloseNotification.java @@ -16,7 +16,9 @@ import android.view.View; import android.view.View.OnClickListener; import android.widget.ArrayAdapter; import android.widget.Button; +import android.widget.CompoundButton; import android.widget.EditText; +import android.widget.RadioButton; import android.widget.Spinner; import android.widget.TextView; @@ -39,10 +41,11 @@ public class ActivityManageActionCloseNotification extends Activity boolean edit = false; ProgressDialog progressDialog = null; - EditText etNotificationTitle, etNotificationText; + EditText etNotificationTitle, etNotificationText, etNotificationDismissalButtonText; Button bSelectApp, bSaveActionCloseNotification; Spinner spinnerTitleDirection, spinnerTextDirection; TextView tvSelectedApplication; + RadioButton rbNotificationDismissSimple, rbNotificationDismissButton; private static List pInfos = null; @@ -262,6 +265,10 @@ public class ActivityManageActionCloseNotification extends Activity spinnerTitleDirection = (Spinner)findViewById(R.id.spinnerTitleDirection); spinnerTextDirection = (Spinner)findViewById(R.id.spinnerTextDirection); tvSelectedApplication = (TextView)findViewById(R.id.etActivityOrActionPath); + etNotificationDismissalButtonText = (EditText)findViewById(R.id.etNotificationDismissalButtonText); + rbNotificationDismissSimple = (RadioButton)findViewById(R.id.rbNotificationDismissSimple); + rbNotificationDismissButton = (RadioButton)findViewById(R.id.rbNotificationDismissButton); + directions = new String[] { getResources().getString(R.string.directionStringEquals), @@ -333,6 +340,15 @@ public class ActivityManageActionCloseNotification extends Activity } }); + rbNotificationDismissSimple.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() + { + @Override + public void onCheckedChanged(CompoundButton compoundButton, boolean b) + { + etNotificationDismissalButtonText.setEnabled(!b); + } + }); + Intent i = getIntent(); if(!StringUtils.isBlank(i.getStringExtra(ActivityManageRule.intentNameActionParameter2))) { diff --git a/app/src/main/res/layout/activity_manage_action_close_notification.xml b/app/src/main/res/layout/activity_manage_action_close_notification.xml index 144519a6..0b87f3c0 100644 --- a/app/src/main/res/layout/activity_manage_action_close_notification.xml +++ b/app/src/main/res/layout/activity_manage_action_close_notification.xml @@ -149,6 +149,41 @@ > + + + + + + + + + + + + + + + +