|
|
@ -499,7 +499,7 @@ public class FragmentRule extends FragmentBase {
|
|
|
|
getString(R.string.title_rule_action_remark, data.folder.getDisplayName(getContext())));
|
|
|
|
getString(R.string.title_rule_action_remark, data.folder.getDisplayName(getContext())));
|
|
|
|
tvActionRemark.setVisibility(View.VISIBLE);
|
|
|
|
tvActionRemark.setVisibility(View.VISIBLE);
|
|
|
|
|
|
|
|
|
|
|
|
loadRule();
|
|
|
|
loadRule(savedInstanceState);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
@ -509,6 +509,19 @@ public class FragmentRule extends FragmentBase {
|
|
|
|
}.execute(this, args, "rule:accounts");
|
|
|
|
}.execute(this, args, "rule:accounts");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
|
|
public void onSaveInstanceState(Bundle outState) {
|
|
|
|
|
|
|
|
outState.putInt("fair:start", spScheduleDayStart.getSelectedItemPosition());
|
|
|
|
|
|
|
|
outState.putInt("fair:end", spScheduleDayEnd.getSelectedItemPosition());
|
|
|
|
|
|
|
|
outState.putInt("fair:action", spAction.getSelectedItemPosition());
|
|
|
|
|
|
|
|
outState.putInt("fair:importance", spImportance.getSelectedItemPosition());
|
|
|
|
|
|
|
|
outState.putInt("fair:target", spTarget.getSelectedItemPosition());
|
|
|
|
|
|
|
|
outState.putInt("fair:identity", spIdent.getSelectedItemPosition());
|
|
|
|
|
|
|
|
outState.putInt("fair:answer", spAnswer.getSelectedItemPosition());
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
super.onSaveInstanceState(outState);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public void onActivityResult(int requestCode, int resultCode, Intent data) {
|
|
|
|
public void onActivityResult(int requestCode, int resultCode, Intent data) {
|
|
|
|
super.onActivityResult(requestCode, resultCode, data);
|
|
|
|
super.onActivityResult(requestCode, resultCode, data);
|
|
|
@ -619,7 +632,7 @@ public class FragmentRule extends FragmentBase {
|
|
|
|
cbScheduleEnd.setChecked(true);
|
|
|
|
cbScheduleEnd.setChecked(true);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private void loadRule() {
|
|
|
|
private void loadRule(final Bundle savedInstanceState) {
|
|
|
|
Bundle rargs = new Bundle();
|
|
|
|
Bundle rargs = new Bundle();
|
|
|
|
rargs.putLong("id", copy < 0 ? id : copy);
|
|
|
|
rargs.putLong("id", copy < 0 ? id : copy);
|
|
|
|
rargs.putString("sender", getArguments().getString("sender"));
|
|
|
|
rargs.putString("sender", getArguments().getString("sender"));
|
|
|
@ -636,6 +649,7 @@ public class FragmentRule extends FragmentBase {
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
protected void onExecuted(Bundle args, TupleRuleEx rule) {
|
|
|
|
protected void onExecuted(Bundle args, TupleRuleEx rule) {
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
|
|
|
|
if (savedInstanceState == null) {
|
|
|
|
JSONObject jcondition = (rule == null ? new JSONObject() : new JSONObject(rule.condition));
|
|
|
|
JSONObject jcondition = (rule == null ? new JSONObject() : new JSONObject(rule.condition));
|
|
|
|
JSONObject jaction = (rule == null ? new JSONObject() : new JSONObject(rule.action));
|
|
|
|
JSONObject jaction = (rule == null ? new JSONObject() : new JSONObject(rule.action));
|
|
|
|
|
|
|
|
|
|
|
@ -751,6 +765,20 @@ public class FragmentRule extends FragmentBase {
|
|
|
|
|
|
|
|
|
|
|
|
showActionParameters(type);
|
|
|
|
showActionParameters(type);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
spScheduleDayStart.setSelection(savedInstanceState.getInt("fair:start"));
|
|
|
|
|
|
|
|
spScheduleDayEnd.setSelection(savedInstanceState.getInt("fair:end"));
|
|
|
|
|
|
|
|
spAction.setSelection(savedInstanceState.getInt("fair:action"));
|
|
|
|
|
|
|
|
spImportance.setSelection(savedInstanceState.getInt("fair:importance"));
|
|
|
|
|
|
|
|
spTarget.setSelection(savedInstanceState.getInt("fair:target"));
|
|
|
|
|
|
|
|
spIdent.setSelection(savedInstanceState.getInt("fair:identity"));
|
|
|
|
|
|
|
|
spAnswer.setSelection(savedInstanceState.getInt("fair:answer"));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Action action = adapterAction.getItem(spAction.getSelectedItemPosition());
|
|
|
|
|
|
|
|
if (action != null)
|
|
|
|
|
|
|
|
showActionParameters(action.type);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
} catch (Throwable ex) {
|
|
|
|
} catch (Throwable ex) {
|
|
|
|
Log.e(ex);
|
|
|
|
Log.e(ex);
|
|
|
|
} finally {
|
|
|
|
} finally {
|
|
|
|