Browse Source

Allow HTML in answers/signature

main
M66B 6 years ago
parent
commit
827e94a105
2 changed files with 11 additions and 9 deletions
  1. +3
    -2
      app/src/main/java/eu/faircode/email/FragmentAccount.java
  2. +8
    -7
      app/src/main/java/eu/faircode/email/FragmentAnswer.java

+ 3
- 2
app/src/main/java/eu/faircode/email/FragmentAccount.java View File

@ -34,6 +34,7 @@ import android.os.Bundle;
import android.os.Handler; import android.os.Handler;
import android.preference.PreferenceManager; import android.preference.PreferenceManager;
import android.text.Editable; import android.text.Editable;
import android.text.Html;
import android.text.TextUtils; import android.text.TextUtils;
import android.text.TextWatcher; import android.text.TextWatcher;
import android.util.Log; import android.util.Log;
@ -488,7 +489,7 @@ public class FragmentAccount extends FragmentEx {
args.putInt("auth_type", authorized == null ? Helper.AUTH_TYPE_PASSWORD : provider.getAuthType()); args.putInt("auth_type", authorized == null ? Helper.AUTH_TYPE_PASSWORD : provider.getAuthType());
args.putBoolean("synchronize", cbSynchronize.isChecked()); args.putBoolean("synchronize", cbSynchronize.isChecked());
args.putString("name", etName.getText().toString()); args.putString("name", etName.getText().toString());
args.putString("signature", etSignature.getText().toString());
args.putString("signature", Html.toHtml(etSignature.getText()));
args.putBoolean("primary", cbPrimary.isChecked()); args.putBoolean("primary", cbPrimary.isChecked());
args.putParcelable("drafts", drafts); args.putParcelable("drafts", drafts);
args.putParcelable("sent", sent); args.putParcelable("sent", sent);
@ -773,7 +774,7 @@ public class FragmentAccount extends FragmentEx {
tilPassword.getEditText().setText(account == null ? null : account.password); tilPassword.getEditText().setText(account == null ? null : account.password);
etName.setText(account == null ? null : account.name); etName.setText(account == null ? null : account.name);
etSignature.setText(account == null ? null : account.signature);
etSignature.setText(account == null ? null : Html.fromHtml(account.signature));
cbSynchronize.setChecked(account == null ? true : account.synchronize); cbSynchronize.setChecked(account == null ? true : account.synchronize);
cbPrimary.setChecked(account == null ? true : account.primary); cbPrimary.setChecked(account == null ? true : account.primary);


+ 8
- 7
app/src/main/java/eu/faircode/email/FragmentAnswer.java View File

@ -21,12 +21,13 @@ package eu.faircode.email;
import android.content.Context; import android.content.Context;
import android.os.Bundle; import android.os.Bundle;
import android.text.Html;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.MenuItem; import android.view.MenuItem;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.widget.EditText;
import android.widget.ProgressBar; import android.widget.ProgressBar;
import android.widget.TextView;
import android.widget.Toast; import android.widget.Toast;
import com.google.android.material.bottomnavigation.BottomNavigationView; import com.google.android.material.bottomnavigation.BottomNavigationView;
@ -38,8 +39,8 @@ import androidx.lifecycle.Observer;
public class FragmentAnswer extends FragmentEx { public class FragmentAnswer extends FragmentEx {
private ViewGroup view; private ViewGroup view;
private TextView etName;
private TextView etText;
private EditText etName;
private EditText etText;
private BottomNavigationView bottom_navigation; private BottomNavigationView bottom_navigation;
private ProgressBar pbWait; private ProgressBar pbWait;
private Group grpReady; private Group grpReady;
@ -98,7 +99,7 @@ public class FragmentAnswer extends FragmentEx {
@Override @Override
public void onChanged(EntityAnswer answer) { public void onChanged(EntityAnswer answer) {
etName.setText(answer == null ? null : answer.name); etName.setText(answer == null ? null : answer.name);
etText.setText(answer == null ? null : answer.text);
etText.setText(answer == null ? null : Html.fromHtml(answer.text));
bottom_navigation.findViewById(R.id.action_delete).setVisibility(answer == null ? View.GONE : View.VISIBLE); bottom_navigation.findViewById(R.id.action_delete).setVisibility(answer == null ? View.GONE : View.VISIBLE);
pbWait.setVisibility(View.GONE); pbWait.setVisibility(View.GONE);
@ -115,7 +116,7 @@ public class FragmentAnswer extends FragmentEx {
new SimpleTask<Void>() { new SimpleTask<Void>() {
@Override @Override
protected Void onLoad(Context context, Bundle args) throws Throwable {
protected Void onLoad(Context context, Bundle args) {
long id = args.getLong("id"); long id = args.getLong("id");
DB.getInstance(context).answer().deleteAnswer(id); DB.getInstance(context).answer().deleteAnswer(id);
return null; return null;
@ -140,11 +141,11 @@ public class FragmentAnswer extends FragmentEx {
Bundle args = new Bundle(); Bundle args = new Bundle();
args.putLong("id", id); args.putLong("id", id);
args.putString("name", etName.getText().toString()); args.putString("name", etName.getText().toString());
args.putString("text", etText.getText().toString());
args.putString("text", Html.toHtml(etText.getText()));
new SimpleTask<Void>() { new SimpleTask<Void>() {
@Override @Override
protected Void onLoad(Context context, Bundle args) throws Throwable {
protected Void onLoad(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 text = args.getString("text"); String text = args.getString("text");


Loading…
Cancel
Save