Allow closing unused inline images hint

pull/168/head
M66B 5 years ago
parent a8cf904f7f
commit bb3efe7608

@ -161,7 +161,7 @@ public class FragmentCompose extends FragmentBase {
private ImageButton ibCcBcc;
private RecyclerView rvAttachment;
private TextView tvNoInternetAttachments;
private TextView tvUnusedInlineImages;
private ImageButton ibCloseUnusedImagesHint;
private EditTextCompose etBody;
private TextView tvNoInternet;
private TextView tvSignature;
@ -178,6 +178,7 @@ public class FragmentCompose extends FragmentBase {
private Group grpExtra;
private Group grpAddresses;
private Group grpAttachments;
private Group grpUnusedImagesHint;
private Group grpBody;
private Group grpSignature;
private Group grpReferenceHint;
@ -259,7 +260,7 @@ public class FragmentCompose extends FragmentBase {
ibCcBcc = view.findViewById(R.id.ivCcBcc);
rvAttachment = view.findViewById(R.id.rvAttachment);
tvNoInternetAttachments = view.findViewById(R.id.tvNoInternetAttachments);
tvUnusedInlineImages = view.findViewById(R.id.tvUnusedInlineImages);
ibCloseUnusedImagesHint = view.findViewById(R.id.ibCloseUnusedImagesHint);
etBody = view.findViewById(R.id.etBody);
tvNoInternet = view.findViewById(R.id.tvNoInternet);
tvSignature = view.findViewById(R.id.tvSignature);
@ -278,6 +279,7 @@ public class FragmentCompose extends FragmentBase {
grpAddresses = view.findViewById(R.id.grpAddresses);
grpAttachments = view.findViewById(R.id.grpAttachments);
grpBody = view.findViewById(R.id.grpBody);
grpUnusedImagesHint = view.findViewById(R.id.grpUnusedImagesHint);
grpSignature = view.findViewById(R.id.grpSignature);
grpReferenceHint = view.findViewById(R.id.grpReferenceHint);
@ -384,6 +386,15 @@ public class FragmentCompose extends FragmentBase {
setZoom();
ibCloseUnusedImagesHint.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getContext());
prefs.edit().putBoolean("inline_image_hint", false).apply();
grpUnusedImagesHint.setVisibility(View.GONE);
}
});
etBody.setInputContentListener(new EditTextCompose.IInputContentListener() {
@Override
public void onInputContent(Uri uri) {
@ -642,7 +653,7 @@ public class FragmentCompose extends FragmentBase {
rvAttachment.setAdapter(adapter);
tvNoInternetAttachments.setVisibility(View.GONE);
tvUnusedInlineImages.setVisibility(View.GONE);
grpUnusedImagesHint.setVisibility(View.GONE);
String pkg = Helper.getOpenKeychainPackage(getContext());
Log.i("Binding to " + pkg);
@ -2705,7 +2716,9 @@ public class FragmentCompose extends FragmentBase {
rvAttachment.setTag(downloading);
checkInternet();
tvUnusedInlineImages.setVisibility(inline_images ? View.VISIBLE : View.GONE);
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getContext());
boolean inline_image_hint = prefs.getBoolean("inline_image_hint", true);
grpUnusedImagesHint.setVisibility(inline_images && inline_image_hint ? View.VISIBLE : View.GONE);
}
});

@ -69,7 +69,8 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc
private final static String[] RESET_QUESTIONS = new String[]{
"welcome", "crash_reports_asked",
"html_always_images", "print_html_confirmed",
"identities_asked", "compose_reference", "send_dialog"
"identities_asked",
"inline_image_hint", "compose_reference", "send_dialog"
};
@Override

@ -224,15 +224,29 @@
app:layout_constraintStart_toStartOf="@id/rvAttachment"
app:layout_constraintTop_toBottomOf="@id/rvAttachment" />
<TextView
android:id="@+id/tvUnusedInlineImages"
<ImageButton
android:id="@+id/ibCloseUnusedImagesHint"
android:layout_width="wrap_content"
android:layout_height="0dp"
android:background="@null"
android:contentDescription="@string/title_no_format"
app:layout_constraintBottom_toBottomOf="@+id/tvUnusedImagesHint"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="@+id/tvUnusedImagesHint"
app:srcCompat="@drawable/baseline_close_24" />
<TextView
android:id="@+id/tvUnusedImagesHint"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="6dp"
android:layout_marginTop="6dp"
android:layout_marginEnd="6dp"
android:text="@string/title_unused_inline"
android:textAppearance="@style/TextAppearance.AppCompat.Small"
app:layout_constraintEnd_toEndOf="@id/rvAttachment"
app:layout_constraintStart_toStartOf="@id/rvAttachment"
android:textStyle="italic"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@id/ibCloseUnusedImagesHint"
app:layout_constraintTop_toBottomOf="@id/tvNoInternetAttachments" />
<View
@ -243,7 +257,7 @@
android:background="?attr/colorSeparator"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/tvUnusedInlineImages" />
app:layout_constraintTop_toBottomOf="@+id/ibCloseUnusedImagesHint" />
<eu.faircode.email.EditTextCompose
android:id="@+id/etBody"
@ -321,7 +335,7 @@
<ImageButton
android:id="@+id/ibCloseRefHint"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_height="0dp"
android:background="@null"
android:contentDescription="@string/title_no_format"
app:layout_constraintBottom_toBottomOf="@+id/tvReferenceHint"
@ -414,6 +428,12 @@
android:layout_height="0dp"
app:constraint_referenced_ids="vSeparatorAttachments,rvAttachment" />
<androidx.constraintlayout.widget.Group
android:id="@+id/grpUnusedImagesHint"
android:layout_width="0dp"
android:layout_height="0dp"
app:constraint_referenced_ids="ibCloseUnusedImagesHint,tvUnusedImagesHint" />
<androidx.constraintlayout.widget.Group
android:id="@+id/grpBody"
android:layout_width="0dp"

Loading…
Cancel
Save