diff --git a/app/src/main/java/eu/faircode/email/FragmentCompose.java b/app/src/main/java/eu/faircode/email/FragmentCompose.java index cb0bb70678..cde2e7fa37 100644 --- a/app/src/main/java/eu/faircode/email/FragmentCompose.java +++ b/app/src/main/java/eu/faircode/email/FragmentCompose.java @@ -219,6 +219,7 @@ public class FragmentCompose extends FragmentBase { private TextView tvNoInternet; private TextView tvSignature; private CheckBox cbSignature; + private ImageButton ibSignature; private TextView tvReference; private ImageButton ibCloseRefHint; private ImageButton ibReferenceEdit; @@ -318,6 +319,7 @@ public class FragmentCompose extends FragmentBase { tvNoInternet = view.findViewById(R.id.tvNoInternet); tvSignature = view.findViewById(R.id.tvSignature); cbSignature = view.findViewById(R.id.cbSignature); + ibSignature = view.findViewById(R.id.ibSignature); tvReference = view.findViewById(R.id.tvReference); ibCloseRefHint = view.findViewById(R.id.ibCloseRefHint); ibReferenceEdit = view.findViewById(R.id.ibReferenceEdit); @@ -567,6 +569,24 @@ public class FragmentCompose extends FragmentBase { } }); + ibSignature.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + EntityIdentity identity = (EntityIdentity) spIdentity.getSelectedItem(); + if (identity == null && TextUtils.isEmpty(identity.signature)) + return; + + Spanned sig = HtmlHelper.fromHtml(identity.signature, new Html.ImageGetter() { + @Override + public Drawable getDrawable(String source) { + return ImageHelper.decodeImage(getContext(), working, source, true, zoom, etBody); + } + }, null); + + etBody.getText().insert(etBody.getSelectionStart(), sig); + } + }); + ibCloseRefHint.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { diff --git a/app/src/main/res/layout/fragment_compose.xml b/app/src/main/res/layout/fragment_compose.xml index b2ffd6d59b..20fe1702df 100644 --- a/app/src/main/res/layout/fragment_compose.xml +++ b/app/src/main/res/layout/fragment_compose.xml @@ -318,11 +318,11 @@ android:layout_marginTop="6dp" android:layout_marginEnd="6dp" android:fontFamily="monospace" - android:minHeight="24dp" + android:minHeight="72dp" android:text="Signature" android:textAppearance="@style/TextAppearance.AppCompat.Small" android:textIsSelectable="true" - app:layout_constraintEnd_toStartOf="@+id/cbSignature" + app:layout_constraintEnd_toStartOf="@+id/ibSignature" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toBottomOf="@id/vSeparatorBody" /> @@ -330,10 +330,21 @@ android:id="@+id/cbSignature" android:layout_width="wrap_content" android:layout_height="wrap_content" + app:layout_constraintEnd_toEndOf="@id/ibSignature" + app:layout_constraintStart_toStartOf="@id/ibSignature" + app:layout_constraintTop_toTopOf="@+id/tvSignature" /> + + + app:srcCompat="@drawable/baseline_assignment_24" /> + app:constraint_referenced_ids="vSeparatorSignature,tvSignature,cbSignature,ibSignature" />