mirror of
https://github.com/M66B/FairEmail.git
synced 2025-02-28 08:46:01 +00:00
Edit signature as HTML
This commit is contained in:
parent
57a31ab614
commit
ea79c0d23c
4 changed files with 59 additions and 2 deletions
app/src/main
java/eu/faircode/email
res
|
@ -33,6 +33,7 @@ import android.os.Handler;
|
|||
import android.provider.ContactsContract;
|
||||
import android.text.Editable;
|
||||
import android.text.Html;
|
||||
import android.text.Spanned;
|
||||
import android.text.TextUtils;
|
||||
import android.text.TextWatcher;
|
||||
import android.util.Patterns;
|
||||
|
@ -88,6 +89,7 @@ public class FragmentIdentity extends FragmentEx {
|
|||
private ImageView ibColorDefault;
|
||||
private EditText etSignature;
|
||||
private ImageButton ibPro;
|
||||
private Button btnHtml;
|
||||
|
||||
private Button btnAdvanced;
|
||||
private Spinner spProvider;
|
||||
|
@ -149,6 +151,7 @@ public class FragmentIdentity extends FragmentEx {
|
|||
ibColorDefault = view.findViewById(R.id.ibColorDefault);
|
||||
etSignature = view.findViewById(R.id.etSignature);
|
||||
ibPro = view.findViewById(R.id.ibPro);
|
||||
btnHtml = view.findViewById(R.id.btnHtml);
|
||||
|
||||
btnAdvanced = view.findViewById(R.id.btnAdvanced);
|
||||
spProvider = view.findViewById(R.id.spProvider);
|
||||
|
@ -304,6 +307,26 @@ public class FragmentIdentity extends FragmentEx {
|
|||
}
|
||||
});
|
||||
|
||||
btnHtml.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
View dview = LayoutInflater.from(getContext()).inflate(R.layout.dialog_html, null);
|
||||
final EditText etHtml = dview.findViewById(R.id.etHtml);
|
||||
etHtml.setText(Html.toHtml(etSignature.getText()));
|
||||
|
||||
new DialogBuilderLifecycle(getContext(), getViewLifecycleOwner())
|
||||
.setView(dview)
|
||||
.setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
Spanned html = Html.fromHtml(etHtml.getText().toString());
|
||||
etSignature.setText(html);
|
||||
}
|
||||
})
|
||||
.show();
|
||||
}
|
||||
});
|
||||
|
||||
btnAdvanced.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
|
@ -736,6 +759,7 @@ public class FragmentIdentity extends FragmentEx {
|
|||
lp.width = 0;
|
||||
ibPro.setLayoutParams(lp);
|
||||
}
|
||||
btnHtml.setEnabled(pro);
|
||||
|
||||
cbPrimary.setEnabled(cbSynchronize.isChecked());
|
||||
|
||||
|
|
21
app/src/main/res/layout/dialog_html.xml
Normal file
21
app/src/main/res/layout/dialog_html.xml
Normal file
|
@ -0,0 +1,21 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="12dp">
|
||||
|
||||
<EditText
|
||||
android:id="@+id/etHtml"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@null"
|
||||
android:fontFamily="monospace"
|
||||
android:gravity="top"
|
||||
android:hint="@string/title_edit_html"
|
||||
android:inputType="text|textMultiLine"
|
||||
android:minHeight="120dp"
|
||||
android:textAppearance="@style/TextAppearance.AppCompat.Medium"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
|
@ -161,6 +161,17 @@
|
|||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="@id/etSignature" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/btnHtml"
|
||||
style="@style/buttonStyleSmall"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:minWidth="0dp"
|
||||
android:minHeight="0dp"
|
||||
android:text="@string/title_edit_html"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/etSignature" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/btnAdvanced"
|
||||
style="@style/buttonStyleSmall"
|
||||
|
@ -171,7 +182,7 @@
|
|||
android:minHeight="0dp"
|
||||
android:text="@string/title_setup_advanced"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/etSignature" />
|
||||
app:layout_constraintTop_toBottomOf="@id/btnHtml" />
|
||||
|
||||
<!--- provider -->
|
||||
|
||||
|
@ -529,7 +540,7 @@
|
|||
android:id="@+id/grpAuthorize"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
app:constraint_referenced_ids="tvName,etName,tvEmail,etEmail,tvDisplay,etDisplay,btnColor,vwColor,ibColorDefault,tvSignature,etSignature,ibPro,btnAdvanced,btnSave" />
|
||||
app:constraint_referenced_ids="tvName,etName,tvEmail,etEmail,tvDisplay,etDisplay,btnColor,vwColor,ibColorDefault,tvSignature,etSignature,ibPro,btnHtml,btnAdvanced,btnSave" />
|
||||
|
||||
<androidx.constraintlayout.widget.Group
|
||||
android:id="@+id/grpAdvanced"
|
||||
|
|
|
@ -206,6 +206,7 @@
|
|||
<string name="title_identity_delete">Delete this identity permanently?</string>
|
||||
<string name="title_pop">POP is not supported</string>
|
||||
<string name="title_identity_sent_hint">Sent messages will automatically be stored in the sent folder already in most cases</string>
|
||||
<string name="title_edit_html">Edit as HTML</string>
|
||||
|
||||
<string name="title_unseen_count" translatable="false">%1$s (%2$d)</string>
|
||||
|
||||
|
|
Loading…
Reference in a new issue