code cleanups
This commit is contained in:
parent
53f46c10da
commit
1c8eec735d
@ -283,8 +283,8 @@ public class ActivityManageRule extends Activity
|
|||||||
case wifiConnection:
|
case wifiConnection:
|
||||||
Intent wifiEditor = new Intent(ActivityManageRule.this, ActivityManageTriggerWifi.class);
|
Intent wifiEditor = new Intent(ActivityManageRule.this, ActivityManageTriggerWifi.class);
|
||||||
wifiEditor.putExtra("edit", true);
|
wifiEditor.putExtra("edit", true);
|
||||||
wifiEditor.putExtra("wifiState", selectedTrigger.getTriggerParameter());
|
wifiEditor.putExtra(ActivityManageTriggerWifi.intentNameWifiState, selectedTrigger.getTriggerParameter());
|
||||||
wifiEditor.putExtra("wifiName", selectedTrigger.getTriggerParameter2());
|
wifiEditor.putExtra(ActivityManageTriggerWifi.intentNameWifiName, selectedTrigger.getTriggerParameter2());
|
||||||
startActivityForResult(wifiEditor, requestCodeTriggerWifiEdit);
|
startActivityForResult(wifiEditor, requestCodeTriggerWifiEdit);
|
||||||
break;
|
break;
|
||||||
case deviceOrientation:
|
case deviceOrientation:
|
||||||
@ -1051,7 +1051,6 @@ public class ActivityManageRule extends Activity
|
|||||||
@Override
|
@Override
|
||||||
protected String[] doInBackground(ActivityManageRule... params)
|
protected String[] doInBackground(ActivityManageRule... params)
|
||||||
{
|
{
|
||||||
// Looper.prepare();
|
|
||||||
final String[] applicationArray = ActivityManageActionStartActivity.getApplicationNameListString(params[0]);
|
final String[] applicationArray = ActivityManageActionStartActivity.getApplicationNameListString(params[0]);
|
||||||
return applicationArray;
|
return applicationArray;
|
||||||
}
|
}
|
||||||
@ -1187,8 +1186,8 @@ public class ActivityManageRule extends Activity
|
|||||||
{
|
{
|
||||||
if(resultCode == RESULT_OK)
|
if(resultCode == RESULT_OK)
|
||||||
{
|
{
|
||||||
newTrigger.setTriggerParameter(data.getBooleanExtra("wifiState", false));
|
newTrigger.setTriggerParameter(data.getBooleanExtra(ActivityManageTriggerWifi.intentNameWifiState, false));
|
||||||
newTrigger.setTriggerParameter2(data.getStringExtra("wifiName"));
|
newTrigger.setTriggerParameter2(data.getStringExtra(ActivityManageTriggerWifi.intentNameWifiName));
|
||||||
newTrigger.setParentRule(ruleToEdit);
|
newTrigger.setParentRule(ruleToEdit);
|
||||||
ruleToEdit.getTriggerSet().add(newTrigger);
|
ruleToEdit.getTriggerSet().add(newTrigger);
|
||||||
this.refreshTriggerList();
|
this.refreshTriggerList();
|
||||||
@ -1200,8 +1199,8 @@ public class ActivityManageRule extends Activity
|
|||||||
{
|
{
|
||||||
Trigger editedTrigger = new Trigger();
|
Trigger editedTrigger = new Trigger();
|
||||||
editedTrigger.setTriggerType(Trigger_Enum.wifiConnection);
|
editedTrigger.setTriggerType(Trigger_Enum.wifiConnection);
|
||||||
editedTrigger.setTriggerParameter(data.getBooleanExtra("wifiState", false));
|
editedTrigger.setTriggerParameter(data.getBooleanExtra(ActivityManageTriggerWifi.intentNameWifiState, false));
|
||||||
editedTrigger.setTriggerParameter2(data.getStringExtra("wifiName"));
|
editedTrigger.setTriggerParameter2(data.getStringExtra(ActivityManageTriggerWifi.intentNameWifiName));
|
||||||
editedTrigger.setParentRule(ruleToEdit);
|
editedTrigger.setParentRule(ruleToEdit);
|
||||||
ruleToEdit.getTriggerSet().set(editIndex, editedTrigger);
|
ruleToEdit.getTriggerSet().set(editIndex, editedTrigger);
|
||||||
this.refreshTriggerList();
|
this.refreshTriggerList();
|
||||||
@ -1249,13 +1248,13 @@ public class ActivityManageRule extends Activity
|
|||||||
{
|
{
|
||||||
ruleToEdit.getTriggerSet().add(newTrigger);
|
ruleToEdit.getTriggerSet().add(newTrigger);
|
||||||
|
|
||||||
newTrigger.setTriggerParameter(data.getBooleanExtra("direction", false));
|
newTrigger.setTriggerParameter(data.getBooleanExtra(ActivityManageTriggerNotification.intentNameNotificationDirection, false));
|
||||||
newTrigger.setTriggerParameter2(
|
newTrigger.setTriggerParameter2(
|
||||||
data.getStringExtra("app") + Trigger.triggerParameter2Split +
|
data.getStringExtra(ActivityManageTriggerNotification.intentNameNotificationApp) + Trigger.triggerParameter2Split +
|
||||||
data.getStringExtra("titleDir") + Trigger.triggerParameter2Split +
|
data.getStringExtra(ActivityManageTriggerNotification.intentNameNotificationTitleDir) + Trigger.triggerParameter2Split +
|
||||||
data.getStringExtra("title") + Trigger.triggerParameter2Split +
|
data.getStringExtra(ActivityManageTriggerNotification.intentNameNotificationTitle) + Trigger.triggerParameter2Split +
|
||||||
data.getStringExtra("textDir") + Trigger.triggerParameter2Split +
|
data.getStringExtra(ActivityManageTriggerNotification.intentNameNotificationTextDir) + Trigger.triggerParameter2Split +
|
||||||
data.getStringExtra("text")
|
data.getStringExtra(ActivityManageTriggerNotification.intentNameNotificationText)
|
||||||
);
|
);
|
||||||
newTrigger.setParentRule(ruleToEdit);
|
newTrigger.setParentRule(ruleToEdit);
|
||||||
this.refreshTriggerList();
|
this.refreshTriggerList();
|
||||||
|
@ -31,6 +31,13 @@ import static com.jens.automation2.Trigger.triggerParameter2Split;
|
|||||||
|
|
||||||
public class ActivityManageTriggerNotification extends Activity
|
public class ActivityManageTriggerNotification extends Activity
|
||||||
{
|
{
|
||||||
|
public static final String intentNameNotificationApp = "app";
|
||||||
|
public static final String intentNameNotificationTitleDir = "titleDir";
|
||||||
|
public static final String intentNameNotificationTitle = "title";
|
||||||
|
public static final String intentNameNotificationTextDir = "textDir";
|
||||||
|
public static final String intentNameNotificationText = "text";
|
||||||
|
public static final String intentNameNotificationDirection = "direction";
|
||||||
|
|
||||||
public static Trigger editedNotificationTrigger;
|
public static Trigger editedNotificationTrigger;
|
||||||
boolean edit = false;
|
boolean edit = false;
|
||||||
ProgressDialog progressDialog = null;
|
ProgressDialog progressDialog = null;
|
||||||
@ -323,12 +330,12 @@ public class ActivityManageTriggerNotification extends Activity
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
Intent data = new Intent();
|
Intent data = new Intent();
|
||||||
data.putExtra("direction", chkNotificationDirection.isChecked());
|
data.putExtra(intentNameNotificationDirection, chkNotificationDirection.isChecked());
|
||||||
data.putExtra("app", app);
|
data.putExtra(intentNameNotificationApp, app);
|
||||||
data.putExtra("titleDir", titleDir);
|
data.putExtra(intentNameNotificationTitleDir, titleDir);
|
||||||
data.putExtra("title", title);
|
data.putExtra(intentNameNotificationTitle, title);
|
||||||
data.putExtra("textDir", textDir);
|
data.putExtra(intentNameNotificationTextDir, textDir);
|
||||||
data.putExtra("text", text);
|
data.putExtra(intentNameNotificationText, text);
|
||||||
ActivityManageTriggerNotification.this.setResult(RESULT_OK, data);
|
ActivityManageTriggerNotification.this.setResult(RESULT_OK, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -395,4 +402,4 @@ public class ActivityManageTriggerNotification extends Activity
|
|||||||
getActionStartActivityDialog1().show();
|
getActionStartActivityDialog1().show();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -35,6 +35,9 @@ import java.util.List;
|
|||||||
|
|
||||||
public class ActivityManageTriggerWifi extends Activity
|
public class ActivityManageTriggerWifi extends Activity
|
||||||
{
|
{
|
||||||
|
public final static String intentNameWifiState = "wifiState";
|
||||||
|
public final static String intentNameWifiName = "wifiName";
|
||||||
|
|
||||||
RadioButton rbTriggerWifiConnected, rbTriggerWifiDisconnected;
|
RadioButton rbTriggerWifiConnected, rbTriggerWifiDisconnected;
|
||||||
EditText etTriggerWifiName;
|
EditText etTriggerWifiName;
|
||||||
Spinner spinnerWifiList;
|
Spinner spinnerWifiList;
|
||||||
|
Loading…
Reference in New Issue
Block a user