From 5bfda689d94e445f62c9a0e4b47e69f695e20140 Mon Sep 17 00:00:00 2001 From: M66B Date: Sun, 19 Sep 2021 08:39:34 +0200 Subject: [PATCH] Added markwon close button --- .../email/FragmentDialogMarkdown.java | 15 ++++++++++++-- app/src/main/res/layout/dialog_markdown.xml | 20 +++++++++++++++++++ 2 files changed, 33 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/eu/faircode/email/FragmentDialogMarkdown.java b/app/src/main/java/eu/faircode/email/FragmentDialogMarkdown.java index 50f4a59428..a613b259da 100644 --- a/app/src/main/java/eu/faircode/email/FragmentDialogMarkdown.java +++ b/app/src/main/java/eu/faircode/email/FragmentDialogMarkdown.java @@ -27,10 +27,12 @@ import android.text.method.LinkMovementMethod; import android.view.LayoutInflater; import android.view.View; import android.view.WindowManager; +import android.widget.ImageButton; import android.widget.TextView; import androidx.annotation.NonNull; import androidx.annotation.Nullable; +import androidx.constraintlayout.widget.Group; import java.io.InputStream; @@ -43,10 +45,19 @@ public class FragmentDialogMarkdown extends FragmentDialogBase { public Dialog onCreateDialog(@Nullable Bundle savedInstanceState) { final View dview = LayoutInflater.from(getContext()).inflate(R.layout.dialog_markdown, null); final TextView tvMarkdown = dview.findViewById(R.id.tvMarkdown); + final ImageButton ibCancel = dview.findViewById(R.id.ibCancel); final ContentLoadingProgressBar pbWait = dview.findViewById(R.id.pbWait); + final Group grpReady = dview.findViewById(R.id.grpReady); tvMarkdown.setText(null); + ibCancel.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View view) { + dismiss(); + } + }); + Dialog dialog = new Dialog(getContext()); //dialog.requestWindowFeature(Window.FEATURE_NO_TITLE); dialog.setContentView(dview); @@ -57,13 +68,13 @@ public class FragmentDialogMarkdown extends FragmentDialogBase { new SimpleTask() { @Override protected void onPreExecute(Bundle args) { - tvMarkdown.setVisibility(View.GONE); + grpReady.setVisibility(View.GONE); pbWait.setVisibility(View.VISIBLE); } @Override protected void onPostExecute(Bundle args) { - tvMarkdown.setVisibility(View.VISIBLE); + grpReady.setVisibility(View.VISIBLE); pbWait.setVisibility(View.GONE); } diff --git a/app/src/main/res/layout/dialog_markdown.xml b/app/src/main/res/layout/dialog_markdown.xml index 6eabf36d5a..d2d5a7e340 100644 --- a/app/src/main/res/layout/dialog_markdown.xml +++ b/app/src/main/res/layout/dialog_markdown.xml @@ -7,8 +7,10 @@ tools:context="eu.faircode.email.ActivityView"> + + + + \ No newline at end of file