1
0
Fork 0
mirror of https://github.com/M66B/FairEmail.git synced 2024-12-24 16:53:37 +00:00

Allow HTML in answers/signature

This commit is contained in:
M66B 2018-09-08 06:09:47 +00:00
parent e17c4a350c
commit 827e94a105
2 changed files with 11 additions and 9 deletions

View file

@ -34,6 +34,7 @@ import android.os.Bundle;
import android.os.Handler;
import android.preference.PreferenceManager;
import android.text.Editable;
import android.text.Html;
import android.text.TextUtils;
import android.text.TextWatcher;
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.putBoolean("synchronize", cbSynchronize.isChecked());
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.putParcelable("drafts", drafts);
args.putParcelable("sent", sent);
@ -773,7 +774,7 @@ public class FragmentAccount extends FragmentEx {
tilPassword.getEditText().setText(account == null ? null : account.password);
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);
cbPrimary.setChecked(account == null ? true : account.primary);

View file

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