forked from jens/Automation
bug manage startOtherActivity
This commit is contained in:
parent
9c76340f24
commit
ce9480d188
@ -192,9 +192,34 @@ public class ActivityManageActionStartActivity extends Activity
|
||||
@Override
|
||||
public void onClick(View v)
|
||||
{
|
||||
if(saveAction())
|
||||
if(checkInput())
|
||||
{
|
||||
ActivityManageActionStartActivity.this.setResult(RESULT_OK);
|
||||
Intent returnData = new Intent();
|
||||
|
||||
returnData.putExtra(ActivityManageRule.intentNameActionParameter1, rbStartAppSelectByAction.isChecked());
|
||||
|
||||
String parameter2 = "";
|
||||
|
||||
if (rbStartAppSelectByActivity.isChecked())
|
||||
parameter2 += etPackageName.getText().toString() + ";" + etActivityOrActionPath.getText().toString();
|
||||
else {
|
||||
if (etPackageName.getText().toString() != null && etPackageName.getText().toString().length() > 0)
|
||||
parameter2 += etPackageName.getText().toString() + ";" + etActivityOrActionPath.getText().toString();
|
||||
else
|
||||
parameter2 += Actions.dummyPackageString + ";" + etActivityOrActionPath.getText().toString();
|
||||
}
|
||||
|
||||
if (rbStartAppByActivity.isChecked())
|
||||
parameter2 += ";" + startByActivityString;
|
||||
else
|
||||
parameter2 += ";" + startByBroadcastString;
|
||||
|
||||
for (String s : intentPairList)
|
||||
parameter2 += ";" + s;
|
||||
|
||||
returnData.putExtra(ActivityManageRule.intentNameActionParameter2, parameter2);
|
||||
|
||||
setResult(RESULT_OK, returnData);
|
||||
finish();
|
||||
}
|
||||
}
|
||||
@ -250,11 +275,8 @@ public class ActivityManageActionStartActivity extends Activity
|
||||
});
|
||||
|
||||
Intent i = getIntent();
|
||||
if(i.getBooleanExtra("edit", false) == true)
|
||||
{
|
||||
edit = true;
|
||||
loadValuesIntoGui();
|
||||
}
|
||||
if(i.hasExtra(ActivityManageRule.intentNameActionParameter1))
|
||||
loadValuesIntoGui(i);
|
||||
}
|
||||
|
||||
private class CustomPackageInfo extends PackageInfo implements Comparable<CustomPackageInfo>
|
||||
@ -281,7 +303,6 @@ public class ActivityManageActionStartActivity extends Activity
|
||||
}
|
||||
|
||||
private static List<PackageInfo> pInfos = null;
|
||||
public static Action resultingAction;
|
||||
|
||||
private static final String[] supportedIntentTypes = { "boolean", "byte", "char", "double", "float", "int", "long", "short", "String", "Uri" };
|
||||
private ArrayList<String> intentPairList = new ArrayList<String>();
|
||||
@ -539,13 +560,13 @@ public class ActivityManageActionStartActivity extends Activity
|
||||
progressDialog = ProgressDialog.show(ActivityManageActionStartActivity.this, "", ActivityManageActionStartActivity.this.getResources().getString(R.string.gettingListOfInstalledApplications));
|
||||
}
|
||||
|
||||
private void loadValuesIntoGui()
|
||||
private void loadValuesIntoGui(Intent input)
|
||||
{
|
||||
boolean selectionByAction = resultingAction.getParameter1();
|
||||
boolean selectionByAction = input.getBooleanExtra(ActivityManageRule.intentNameActionParameter1, true);
|
||||
rbStartAppSelectByActivity.setChecked(!selectionByAction);
|
||||
rbStartAppSelectByAction.setChecked(selectionByAction);
|
||||
|
||||
String[] params = resultingAction.getParameter2().split(";");
|
||||
String[] params = input.getStringExtra(ActivityManageRule.intentNameActionParameter2).split(";");
|
||||
|
||||
rbStartAppByActivity.setChecked(params[2].equals(startByActivityString));
|
||||
rbStartAppByBroadcast.setChecked(params[2].equals(startByBroadcastString));
|
||||
@ -592,7 +613,7 @@ public class ActivityManageActionStartActivity extends Activity
|
||||
intentPairAdapter.notifyDataSetChanged();
|
||||
}
|
||||
|
||||
private boolean saveAction()
|
||||
boolean checkInput()
|
||||
{
|
||||
if(rbStartAppSelectByActivity.isChecked())
|
||||
{
|
||||
@ -616,35 +637,6 @@ public class ActivityManageActionStartActivity extends Activity
|
||||
}
|
||||
}
|
||||
|
||||
if(resultingAction == null)
|
||||
resultingAction = new Action();
|
||||
|
||||
resultingAction.setParameter1(rbStartAppSelectByAction.isChecked());
|
||||
|
||||
resultingAction.setAction(Action_Enum.startOtherActivity);
|
||||
|
||||
String parameter2 = "";
|
||||
|
||||
if(rbStartAppSelectByActivity.isChecked())
|
||||
parameter2 += etPackageName.getText().toString() + ";" + etActivityOrActionPath.getText().toString();
|
||||
else
|
||||
{
|
||||
if(etPackageName.getText().toString() != null && etPackageName.getText().toString().length() > 0)
|
||||
parameter2 += etPackageName.getText().toString() + ";" + etActivityOrActionPath.getText().toString();
|
||||
else
|
||||
parameter2 += Actions.dummyPackageString + ";" + etActivityOrActionPath.getText().toString();
|
||||
}
|
||||
|
||||
if(rbStartAppByActivity.isChecked())
|
||||
parameter2 += ";" + startByActivityString;
|
||||
else
|
||||
parameter2 += ";" + startByBroadcastString;
|
||||
|
||||
for(String s : intentPairList)
|
||||
parameter2 += ";" + s;
|
||||
|
||||
resultingAction.setParameter2(parameter2);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -354,8 +354,8 @@ public class ActivityManageRule extends Activity
|
||||
{
|
||||
case startOtherActivity:
|
||||
Intent intent = new Intent(ActivityManageRule.this, ActivityManageActionStartActivity.class);
|
||||
ActivityManageActionStartActivity.resultingAction = a;
|
||||
intent.putExtra("edit", true);
|
||||
intent.putExtra(intentNameActionParameter1, a.getParameter1());
|
||||
intent.putExtra(intentNameActionParameter2, a.getParameter2());
|
||||
startActivityForResult(intent, requestCodeActionStartActivityEdit);
|
||||
break;
|
||||
case triggerUrl:
|
||||
@ -1357,8 +1357,10 @@ public class ActivityManageRule extends Activity
|
||||
// manage start of other activity
|
||||
if(resultCode == RESULT_OK)
|
||||
{
|
||||
newAction = ActivityManageActionStartActivity.resultingAction;
|
||||
newAction.setParentRule(ruleToEdit);
|
||||
newAction.setAction(Action_Enum.startOtherActivity);
|
||||
newAction.setParameter1(data.getBooleanExtra(intentNameActionParameter1, true));
|
||||
newAction.setParameter2(data.getStringExtra(intentNameActionParameter2));
|
||||
ruleToEdit.getActionSet().add(newAction);
|
||||
this.refreshActionList();
|
||||
}
|
||||
@ -1368,9 +1370,14 @@ public class ActivityManageRule extends Activity
|
||||
// manage start of other activity
|
||||
if(resultCode == RESULT_OK)
|
||||
{
|
||||
newAction = ActivityManageActionStartActivity.resultingAction;
|
||||
newAction.setParentRule(ruleToEdit);
|
||||
// ruleToEdit.getActionSet().add(newAction);
|
||||
ruleToEdit.getActionSet().get(editIndex).setParentRule(ruleToEdit);
|
||||
|
||||
if(data.hasExtra(intentNameActionParameter1))
|
||||
ruleToEdit.getActionSet().get(editIndex).setParameter1(data.getBooleanExtra(intentNameActionParameter1, true));
|
||||
|
||||
if(data.hasExtra(intentNameActionParameter2))
|
||||
ruleToEdit.getActionSet().get(editIndex).setParameter2(data.getStringExtra(intentNameActionParameter2));
|
||||
|
||||
this.refreshActionList();
|
||||
}
|
||||
}
|
||||
@ -1502,11 +1509,11 @@ public class ActivityManageRule extends Activity
|
||||
{
|
||||
if(resultCode == RESULT_OK)
|
||||
{
|
||||
if(data.hasExtra("autoBrightness"))
|
||||
ruleToEdit.getActionSet().get(editIndex).setParameter1(data.getBooleanExtra("autoBrightness", false));
|
||||
if(data.hasExtra(ActivityManageActionBrightnessSetting.intentNameAutoBrightness))
|
||||
ruleToEdit.getActionSet().get(editIndex).setParameter1(data.getBooleanExtra(ActivityManageActionBrightnessSetting.intentNameAutoBrightness, false));
|
||||
|
||||
if(data.hasExtra("brightnessValue"))
|
||||
ruleToEdit.getActionSet().get(editIndex).setParameter2(String.valueOf(data.getIntExtra("brightnessValue", 0)));
|
||||
if(data.hasExtra(ActivityManageActionBrightnessSetting.intentNameBrightnessValue))
|
||||
ruleToEdit.getActionSet().get(editIndex).setParameter2(String.valueOf(data.getIntExtra(ActivityManageActionBrightnessSetting.intentNameBrightnessValue, 0)));
|
||||
|
||||
ruleToEdit.getActionSet().get(editIndex).setParentRule(ruleToEdit);
|
||||
|
||||
|
@ -5,7 +5,7 @@ buildscript {
|
||||
jcenter()
|
||||
}
|
||||
dependencies {
|
||||
classpath 'com.android.tools.build:gradle:7.2.0'
|
||||
classpath 'com.android.tools.build:gradle:7.2.1'
|
||||
|
||||
// NOTE: Do not place your application dependencies here; they belong
|
||||
// in the individual module build.gradle files
|
||||
|
@ -5,3 +5,4 @@
|
||||
* New action: Send broadcasts
|
||||
* Fixed: Crash when editing notification trigger
|
||||
* Fixed: TimeFrame trigger - time may have changed when crossing timezones or daylight saving changes
|
||||
* Fixed: Bug when adding more than one startOtherActivity action
|
Loading…
Reference in New Issue
Block a user