Added markwon close button

pull/206/head
M66B 3 years ago
parent c5885d36d5
commit 5bfda689d9

@ -27,10 +27,12 @@ import android.text.method.LinkMovementMethod;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.view.WindowManager; import android.view.WindowManager;
import android.widget.ImageButton;
import android.widget.TextView; import android.widget.TextView;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import androidx.annotation.Nullable; import androidx.annotation.Nullable;
import androidx.constraintlayout.widget.Group;
import java.io.InputStream; import java.io.InputStream;
@ -43,10 +45,19 @@ public class FragmentDialogMarkdown extends FragmentDialogBase {
public Dialog onCreateDialog(@Nullable Bundle savedInstanceState) { public Dialog onCreateDialog(@Nullable Bundle savedInstanceState) {
final View dview = LayoutInflater.from(getContext()).inflate(R.layout.dialog_markdown, null); final View dview = LayoutInflater.from(getContext()).inflate(R.layout.dialog_markdown, null);
final TextView tvMarkdown = dview.findViewById(R.id.tvMarkdown); 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 ContentLoadingProgressBar pbWait = dview.findViewById(R.id.pbWait);
final Group grpReady = dview.findViewById(R.id.grpReady);
tvMarkdown.setText(null); tvMarkdown.setText(null);
ibCancel.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
dismiss();
}
});
Dialog dialog = new Dialog(getContext()); Dialog dialog = new Dialog(getContext());
//dialog.requestWindowFeature(Window.FEATURE_NO_TITLE); //dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
dialog.setContentView(dview); dialog.setContentView(dview);
@ -57,13 +68,13 @@ public class FragmentDialogMarkdown extends FragmentDialogBase {
new SimpleTask<Spanned>() { new SimpleTask<Spanned>() {
@Override @Override
protected void onPreExecute(Bundle args) { protected void onPreExecute(Bundle args) {
tvMarkdown.setVisibility(View.GONE); grpReady.setVisibility(View.GONE);
pbWait.setVisibility(View.VISIBLE); pbWait.setVisibility(View.VISIBLE);
} }
@Override @Override
protected void onPostExecute(Bundle args) { protected void onPostExecute(Bundle args) {
tvMarkdown.setVisibility(View.VISIBLE); grpReady.setVisibility(View.VISIBLE);
pbWait.setVisibility(View.GONE); pbWait.setVisibility(View.GONE);
} }

@ -7,8 +7,10 @@
tools:context="eu.faircode.email.ActivityView"> tools:context="eu.faircode.email.ActivityView">
<eu.faircode.email.ScrollViewEx <eu.faircode.email.ScrollViewEx
android:id="@+id/scroll"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:minHeight="120dp"
android:orientation="vertical" android:orientation="vertical"
android:padding="24dp" android:padding="24dp"
android:scrollbarStyle="outsideOverlay" android:scrollbarStyle="outsideOverlay"
@ -32,6 +34,18 @@
</androidx.constraintlayout.widget.ConstraintLayout> </androidx.constraintlayout.widget.ConstraintLayout>
</eu.faircode.email.ScrollViewEx> </eu.faircode.email.ScrollViewEx>
<ImageButton
android:id="@+id/ibCancel"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="?android:attr/selectableItemBackgroundBorderless"
android:contentDescription="@android:string/no"
android:padding="12dp"
android:tooltipText="@android:string/no"
app:layout_constraintEnd_toEndOf="@+id/scroll"
app:layout_constraintTop_toTopOf="@+id/scroll"
app:srcCompat="@drawable/twotone_close_24" />
<eu.faircode.email.ContentLoadingProgressBar <eu.faircode.email.ContentLoadingProgressBar
android:id="@+id/pbWait" android:id="@+id/pbWait"
style="@style/Base.Widget.AppCompat.ProgressBar" style="@style/Base.Widget.AppCompat.ProgressBar"
@ -43,4 +57,10 @@
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" /> app:layout_constraintTop_toTopOf="parent" />
<androidx.constraintlayout.widget.Group
android:id="@+id/grpReady"
android:layout_width="0dp"
android:layout_height="0dp"
app:constraint_referenced_ids="scroll,ibCancel" />
</androidx.constraintlayout.widget.ConstraintLayout> </androidx.constraintlayout.widget.ConstraintLayout>
Loading…
Cancel
Save