1
0
Fork 0
mirror of https://github.com/M66B/FairEmail.git synced 2024-12-30 19:56:10 +00:00

Added spinner to full message view

This commit is contained in:
M66B 2019-07-01 23:00:22 +02:00
parent 0b012fc774
commit 05f8d03e96
2 changed files with 45 additions and 3 deletions

View file

@ -2109,6 +2109,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
ImageView pv = new ZoomableImageView(context);
pv.setImageDrawable(drawable);
// TODO: dialog fragment
final Dialog dialog = new Dialog(context, android.R.style.Theme_Black_NoTitleBar_Fullscreen);
dialog.setContentView(pv);
@ -3460,6 +3461,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
grpOwner.setVisibility(View.GONE);
if (paranoid) {
// TODO: spinner
Bundle args = new Bundle();
args.putParcelable("uri", uri);
@ -3553,7 +3555,10 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
boolean show_images = getArguments().getBoolean("show_images");
float textSize = getArguments().getFloat("text_size");
final WebView webView = new WebView(getContext());
final View dview = LayoutInflater.from(getContext()).inflate(R.layout.dialog_webview, null);
final WebView webView = dview.findViewById(R.id.webView);
final ContentLoadingProgressBar pbWait = dview.findViewById(R.id.pbWait);
setupWebView(webView);
WebSettings settings = webView.getSettings();
@ -3563,7 +3568,21 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
settings.setBuiltInZoomControls(true);
settings.setDisplayZoomControls(false);
Dialog dialog = new Dialog(getContext(), android.R.style.Theme_Light_NoTitleBar_Fullscreen);
dialog.setContentView(dview);
new SimpleTask<String>() {
@Override
protected void onPreExecute(Bundle args) {
webView.setVisibility(View.GONE);
pbWait.setVisibility(View.VISIBLE);
}
@Override
protected void onPostExecute(Bundle args) {
pbWait.setVisibility(View.GONE);
}
@Override
protected String onExecute(Context context, Bundle args) throws Throwable {
long id = args.getLong("id");
@ -3604,6 +3623,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
@Override
protected void onExecuted(Bundle args, String html) {
webView.loadDataWithBaseURL("", html, "text/html", "UTF-8", null);
webView.setVisibility(View.VISIBLE);
}
@Override
@ -3612,8 +3632,6 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
}
}.execute(getContext(), getActivity(), getArguments(), "message:full");
Dialog dialog = new Dialog(getContext(), android.R.style.Theme_Black_NoTitleBar_Fullscreen);
dialog.setContentView(webView);
return dialog;
}

View file

@ -0,0 +1,24 @@
<?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="match_parent">
<WebView
android:id="@+id/webView"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<eu.faircode.email.ContentLoadingProgressBar
android:id="@+id/pbWait"
style="@style/Base.Widget.AppCompat.ProgressBar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:indeterminate="true"
android:padding="24dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>