|
|
@ -63,6 +63,7 @@ import java.util.List;
|
|
|
|
public class FragmentAnswer extends FragmentBase {
|
|
|
|
public class FragmentAnswer extends FragmentBase {
|
|
|
|
private ViewGroup view;
|
|
|
|
private ViewGroup view;
|
|
|
|
private EditText etName;
|
|
|
|
private EditText etName;
|
|
|
|
|
|
|
|
private EditText etLabel;
|
|
|
|
private EditText etGroup;
|
|
|
|
private EditText etGroup;
|
|
|
|
private CheckBox cbStandard;
|
|
|
|
private CheckBox cbStandard;
|
|
|
|
private CheckBox cbReceipt;
|
|
|
|
private CheckBox cbReceipt;
|
|
|
@ -115,6 +116,7 @@ public class FragmentAnswer extends FragmentBase {
|
|
|
|
|
|
|
|
|
|
|
|
// Get controls
|
|
|
|
// Get controls
|
|
|
|
etName = view.findViewById(R.id.etName);
|
|
|
|
etName = view.findViewById(R.id.etName);
|
|
|
|
|
|
|
|
etLabel = view.findViewById(R.id.etLabel);
|
|
|
|
etGroup = view.findViewById(R.id.etGroup);
|
|
|
|
etGroup = view.findViewById(R.id.etGroup);
|
|
|
|
cbStandard = view.findViewById(R.id.cbStandard);
|
|
|
|
cbStandard = view.findViewById(R.id.cbStandard);
|
|
|
|
cbReceipt = view.findViewById(R.id.cbReceipt);
|
|
|
|
cbReceipt = view.findViewById(R.id.cbReceipt);
|
|
|
@ -187,6 +189,7 @@ public class FragmentAnswer extends FragmentBase {
|
|
|
|
// Initialize
|
|
|
|
// Initialize
|
|
|
|
FragmentDialogTheme.setBackground(context, view, true);
|
|
|
|
FragmentDialogTheme.setBackground(context, view, true);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
etLabel.setVisibility(BuildConfig.DEBUG ? View.VISIBLE : View.GONE);
|
|
|
|
cbExternal.setVisibility(View.GONE);
|
|
|
|
cbExternal.setVisibility(View.GONE);
|
|
|
|
cbSnippet.setVisibility(View.GONE);
|
|
|
|
cbSnippet.setVisibility(View.GONE);
|
|
|
|
grpReady.setVisibility(View.GONE);
|
|
|
|
grpReady.setVisibility(View.GONE);
|
|
|
@ -259,6 +262,7 @@ public class FragmentAnswer extends FragmentBase {
|
|
|
|
|
|
|
|
|
|
|
|
if (savedInstanceState == null) {
|
|
|
|
if (savedInstanceState == null) {
|
|
|
|
etName.setText(answer == null ? args.getString("subject") : answer.name);
|
|
|
|
etName.setText(answer == null ? args.getString("subject") : answer.name);
|
|
|
|
|
|
|
|
etLabel.setText(answer == null ? null : answer.label);
|
|
|
|
etGroup.setText(answer == null ? null : answer.group);
|
|
|
|
etGroup.setText(answer == null ? null : answer.group);
|
|
|
|
cbStandard.setChecked(answer == null ? false : answer.standard);
|
|
|
|
cbStandard.setChecked(answer == null ? false : answer.standard);
|
|
|
|
cbReceipt.setChecked(answer == null ? false : answer.receipt);
|
|
|
|
cbReceipt.setChecked(answer == null ? false : answer.receipt);
|
|
|
@ -417,6 +421,7 @@ public class FragmentAnswer extends FragmentBase {
|
|
|
|
Bundle args = new Bundle();
|
|
|
|
Bundle args = new Bundle();
|
|
|
|
args.putLong("id", id);
|
|
|
|
args.putLong("id", id);
|
|
|
|
args.putString("name", etName.getText().toString().trim());
|
|
|
|
args.putString("name", etName.getText().toString().trim());
|
|
|
|
|
|
|
|
args.putString("label", etLabel.getText().toString().trim());
|
|
|
|
args.putString("group", etGroup.getText().toString().trim());
|
|
|
|
args.putString("group", etGroup.getText().toString().trim());
|
|
|
|
args.putBoolean("standard", cbStandard.isChecked());
|
|
|
|
args.putBoolean("standard", cbStandard.isChecked());
|
|
|
|
args.putBoolean("receipt", cbReceipt.isChecked());
|
|
|
|
args.putBoolean("receipt", cbReceipt.isChecked());
|
|
|
@ -442,6 +447,7 @@ public class FragmentAnswer extends FragmentBase {
|
|
|
|
protected Void onExecute(Context context, Bundle args) {
|
|
|
|
protected Void onExecute(Context context, Bundle args) {
|
|
|
|
long id = args.getLong("id");
|
|
|
|
long id = args.getLong("id");
|
|
|
|
String name = args.getString("name");
|
|
|
|
String name = args.getString("name");
|
|
|
|
|
|
|
|
String label = args.getString("label");
|
|
|
|
String group = args.getString("group");
|
|
|
|
String group = args.getString("group");
|
|
|
|
boolean standard = args.getBoolean("standard");
|
|
|
|
boolean standard = args.getBoolean("standard");
|
|
|
|
boolean receipt = args.getBoolean("receipt");
|
|
|
|
boolean receipt = args.getBoolean("receipt");
|
|
|
@ -454,6 +460,8 @@ public class FragmentAnswer extends FragmentBase {
|
|
|
|
|
|
|
|
|
|
|
|
if (TextUtils.isEmpty(name))
|
|
|
|
if (TextUtils.isEmpty(name))
|
|
|
|
throw new IllegalArgumentException(context.getString(R.string.title_no_name));
|
|
|
|
throw new IllegalArgumentException(context.getString(R.string.title_no_name));
|
|
|
|
|
|
|
|
if (TextUtils.isEmpty(label))
|
|
|
|
|
|
|
|
label = null;
|
|
|
|
if (TextUtils.isEmpty(group))
|
|
|
|
if (TextUtils.isEmpty(group))
|
|
|
|
group = null;
|
|
|
|
group = null;
|
|
|
|
if (color == Color.TRANSPARENT)
|
|
|
|
if (color == Color.TRANSPARENT)
|
|
|
@ -477,6 +485,7 @@ public class FragmentAnswer extends FragmentBase {
|
|
|
|
answer = db.answer().getAnswer(id);
|
|
|
|
answer = db.answer().getAnswer(id);
|
|
|
|
|
|
|
|
|
|
|
|
answer.name = name;
|
|
|
|
answer.name = name;
|
|
|
|
|
|
|
|
answer.label = label;
|
|
|
|
answer.group = group;
|
|
|
|
answer.group = group;
|
|
|
|
answer.standard = standard;
|
|
|
|
answer.standard = standard;
|
|
|
|
answer.receipt = receipt;
|
|
|
|
answer.receipt = receipt;
|
|
|
|