mirror of
https://github.com/M66B/FairEmail.git
synced 2026-03-31 22:26:06 +02:00
Added template groups
This commit is contained in:
@@ -56,6 +56,7 @@ import static android.app.Activity.RESULT_OK;
|
||||
public class FragmentAnswer extends FragmentBase {
|
||||
private ViewGroup view;
|
||||
private EditText etName;
|
||||
private EditText etGroup;
|
||||
private CheckBox cbFavorite;
|
||||
private CheckBox cbHide;
|
||||
private EditTextCompose etText;
|
||||
@@ -94,6 +95,7 @@ public class FragmentAnswer extends FragmentBase {
|
||||
|
||||
// Get controls
|
||||
etName = view.findViewById(R.id.etName);
|
||||
etGroup = view.findViewById(R.id.etGroup);
|
||||
cbFavorite = view.findViewById(R.id.cbFavorite);
|
||||
cbHide = view.findViewById(R.id.cbHide);
|
||||
etText = view.findViewById(R.id.etText);
|
||||
@@ -174,6 +176,7 @@ public class FragmentAnswer extends FragmentBase {
|
||||
protected void onExecuted(Bundle args, EntityAnswer answer) {
|
||||
if (savedInstanceState == null) {
|
||||
etName.setText(answer == null ? null : answer.name);
|
||||
etGroup.setText(answer == null ? null : answer.group);
|
||||
cbFavorite.setChecked(answer == null ? false : answer.favorite);
|
||||
cbHide.setChecked(answer == null ? false : answer.hide);
|
||||
if (answer == null)
|
||||
@@ -246,6 +249,7 @@ public class FragmentAnswer extends FragmentBase {
|
||||
Bundle args = new Bundle();
|
||||
args.putLong("id", id);
|
||||
args.putString("name", etName.getText().toString().trim());
|
||||
args.putString("group", etGroup.getText().toString().trim());
|
||||
args.putBoolean("favorite", cbFavorite.isChecked());
|
||||
args.putBoolean("hide", cbHide.isChecked());
|
||||
args.putString("html", HtmlHelper.toHtml(etText.getText(), getContext()));
|
||||
@@ -265,12 +269,15 @@ public class FragmentAnswer extends FragmentBase {
|
||||
protected Void onExecute(Context context, Bundle args) {
|
||||
long id = args.getLong("id");
|
||||
String name = args.getString("name");
|
||||
String group = args.getString("group");
|
||||
boolean favorite = args.getBoolean("favorite");
|
||||
boolean hide = args.getBoolean("hide");
|
||||
String html = args.getString("html");
|
||||
|
||||
if (TextUtils.isEmpty(name))
|
||||
throw new IllegalArgumentException(context.getString(R.string.title_no_name));
|
||||
if (TextUtils.isEmpty(group))
|
||||
group = null;
|
||||
|
||||
Document document = JsoupEx.parse(html);
|
||||
|
||||
@@ -278,6 +285,7 @@ public class FragmentAnswer extends FragmentBase {
|
||||
if (id < 0) {
|
||||
EntityAnswer answer = new EntityAnswer();
|
||||
answer.name = name;
|
||||
answer.group = group;
|
||||
answer.favorite = favorite;
|
||||
answer.hide = hide;
|
||||
answer.text = document.body().html();
|
||||
@@ -285,6 +293,7 @@ public class FragmentAnswer extends FragmentBase {
|
||||
} else {
|
||||
EntityAnswer answer = db.answer().getAnswer(id);
|
||||
answer.name = name;
|
||||
answer.group = group;
|
||||
answer.favorite = favorite;
|
||||
answer.hide = hide;
|
||||
answer.text = document.body().html();
|
||||
|
||||
Reference in New Issue
Block a user