From b72049defc370dc75cc11b188da3c5cef580349f Mon Sep 17 00:00:00 2001 From: Jens Date: Wed, 22 Nov 2023 23:20:26 +0100 Subject: [PATCH] Start other service bugfix attempt --- .../ActivityManageActionStartActivity.java | 24 +++++++++++++++++-- .../activity_manage_action_start_activity.xml | 1 + 2 files changed, 23 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/com/jens/automation2/ActivityManageActionStartActivity.java b/app/src/main/java/com/jens/automation2/ActivityManageActionStartActivity.java index 69251cb..0807268 100644 --- a/app/src/main/java/com/jens/automation2/ActivityManageActionStartActivity.java +++ b/app/src/main/java/com/jens/automation2/ActivityManageActionStartActivity.java @@ -29,6 +29,7 @@ import android.widget.CompoundButton; import android.widget.EditText; import android.widget.ListView; import android.widget.RadioButton; +import android.widget.RadioGroup; import android.widget.Spinner; import android.widget.Toast; @@ -51,6 +52,7 @@ public class ActivityManageActionStartActivity extends Activity EditText etParameterName, etParameterValue, etPackageName, etActivityOrActionPath, etClassName; Button bSelectApp, bAddIntentPair, bSaveActionStartOtherActivity, showStartProgramExamples; Spinner spinnerParameterType; + RadioGroup rgAppStartupType; boolean edit = false; ProgressDialog progressDialog = null; RadioButton rbStartAppSelectByActivity, rbStartAppSelectByAction, rbStartAppByActivity, rbStartAppByBroadcast, rbStartAppByService, rbStartAppByForegroundService; @@ -87,11 +89,14 @@ public class ActivityManageActionStartActivity extends Activity rbStartAppByBroadcast = (RadioButton)findViewById(R.id.rbStartAppByBroadcast); rbStartAppByService = (RadioButton)findViewById(R.id.rbStartAppByService); rbStartAppByForegroundService = (RadioButton)findViewById(R.id.rbStartAppByForegroundService); + rgAppStartupType = (RadioGroup)findViewById(R.id.rgAppStartupType); intentTypeSpinnerAdapter = new ArrayAdapter(this, R.layout.text_view_for_poi_listview_mediumtextsize, ActivityManageActionStartActivity.supportedIntentTypes); spinnerParameterType.setAdapter(intentTypeSpinnerAdapter); intentTypeSpinnerAdapter.notifyDataSetChanged(); + etClassName.setEnabled(false); + intentPairAdapter = new ArrayAdapter(this, R.layout.text_view_for_poi_listview_mediumtextsize, intentPairList); bSelectApp.setOnClickListener(new OnClickListener() { @@ -301,8 +306,6 @@ public class ActivityManageActionStartActivity extends Activity { bSelectApp.setEnabled(isChecked); } -bug - etClassName.setEnabled(!isChecked); } }); @@ -316,6 +319,23 @@ bug } }); + rgAppStartupType.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() + { + @Override + public void onCheckedChanged(RadioGroup radioGroup, int i) + { + if(rbStartAppByActivity.isChecked()) + etClassName.setEnabled(false); + else if (rbStartAppByBroadcast.isChecked()) + etClassName.setEnabled(false); + else if(rbStartAppByService.isChecked()) + etClassName.setEnabled(true); + else if(rbStartAppByForegroundService.isChecked()) + etClassName.setEnabled(true); + } + }); + + Intent i = getIntent(); if(i.hasExtra(ActivityManageRule.intentNameActionParameter1)) loadValuesIntoGui(i); diff --git a/app/src/main/res/layout/activity_manage_action_start_activity.xml b/app/src/main/res/layout/activity_manage_action_start_activity.xml index e1cff03..dbae9ed 100644 --- a/app/src/main/res/layout/activity_manage_action_start_activity.xml +++ b/app/src/main/res/layout/activity_manage_action_start_activity.xml @@ -113,6 +113,7 @@ android:text="@string/startAppStartType" />