From 4bd931c29f60cb1cab8cb702e564a0a047bf5e16 Mon Sep 17 00:00:00 2001 From: M66B Date: Tue, 4 Sep 2018 11:26:18 +0000 Subject: [PATCH] Added option to show orginal message Fixes #64 --- .idea/caches/build_file_checksums.ser | Bin 535 -> 535 bytes .../eu/faircode/email/FragmentMessage.java | 28 ++++++++++++++- .../eu/faircode/email/FragmentWebView.java | 34 +++++++++++++----- app/src/main/res/menu/menu_view.xml | 6 ++++ app/src/main/res/values-af/strings.xml | 1 + app/src/main/res/values-ar-rBH/strings.xml | 1 + app/src/main/res/values-ar-rEG/strings.xml | 1 + app/src/main/res/values-ar-rSA/strings.xml | 1 + app/src/main/res/values-ar-rYE/strings.xml | 1 + app/src/main/res/values-ar/strings.xml | 1 + app/src/main/res/values-ca/strings.xml | 1 + app/src/main/res/values-cs/strings.xml | 1 + app/src/main/res/values-da/strings.xml | 1 + app/src/main/res/values-de/strings.xml | 1 + app/src/main/res/values-el/strings.xml | 1 + app/src/main/res/values-en/strings.xml | 1 + app/src/main/res/values-es-rES/strings.xml | 1 + app/src/main/res/values-fi/strings.xml | 1 + app/src/main/res/values-fr/strings.xml | 1 + app/src/main/res/values-he/strings.xml | 1 + app/src/main/res/values-hu/strings.xml | 1 + app/src/main/res/values-it/strings.xml | 1 + app/src/main/res/values-iw/strings.xml | 1 + app/src/main/res/values-ja/strings.xml | 1 + app/src/main/res/values-ko/strings.xml | 1 + app/src/main/res/values-nb/strings.xml | 1 + app/src/main/res/values-nl/strings.xml | 1 + app/src/main/res/values-no/strings.xml | 1 + app/src/main/res/values-pl/strings.xml | 1 + app/src/main/res/values-pt-rBR/strings.xml | 1 + app/src/main/res/values-pt-rPT/strings.xml | 1 + app/src/main/res/values-ro/strings.xml | 1 + app/src/main/res/values-ru/strings.xml | 1 + app/src/main/res/values-sr/strings.xml | 1 + app/src/main/res/values-sv-rSE/strings.xml | 1 + app/src/main/res/values-tr/strings.xml | 1 + app/src/main/res/values-uk/strings.xml | 1 + app/src/main/res/values-vi/strings.xml | 1 + app/src/main/res/values-zh-rCN/strings.xml | 1 + app/src/main/res/values-zh-rTW/strings.xml | 1 + app/src/main/res/values/strings.xml | 1 + 41 files changed, 96 insertions(+), 9 deletions(-) diff --git a/.idea/caches/build_file_checksums.ser b/.idea/caches/build_file_checksums.ser index a8234224975fdee80a1ad34acae19e4ee0fb4ea8..983ae46dd6ca7643806a957379bc8cc9fe7dfed1 100644 GIT binary patch delta 33 pcmbQvGM#0@43;I() { + @Override + protected String onLoad(Context context, Bundle args) throws Throwable { + return message.read(context); + } + + @Override + protected void onLoaded(Bundle a, String html) { + Bundle args = new Bundle(); + args.putString("html", html); + args.putString("from", MessageHelper.getFormattedAddresses(message.from, true)); + + FragmentWebView fragment = new FragmentWebView(); + fragment.setArguments(args); + + FragmentTransaction fragmentTransaction = getFragmentManager().beginTransaction(); + fragmentTransaction.replace(R.id.content_frame, fragment).addToBackStack("webview"); + fragmentTransaction.commit(); + } + }.load(this, new Bundle()); + } + private void onMenuAnswer() { DB.getInstance(getContext()).answer().liveAnswers().observe(getViewLifecycleOwner(), new Observer>() { @Override diff --git a/app/src/main/java/eu/faircode/email/FragmentWebView.java b/app/src/main/java/eu/faircode/email/FragmentWebView.java index 73dd836c..4ac69fd8 100644 --- a/app/src/main/java/eu/faircode/email/FragmentWebView.java +++ b/app/src/main/java/eu/faircode/email/FragmentWebView.java @@ -35,23 +35,19 @@ import androidx.annotation.Nullable; // https://developer.android.com/reference/android/webkit/WebView public class FragmentWebView extends FragmentEx { - private String url = null; - @Override @Nullable public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { View view = inflater.inflate(R.layout.fragment_webview, container, false); final ProgressBar progressBar = view.findViewById(R.id.progressbar); - WebView webview = view.findViewById(R.id.webview); + final WebView webview = view.findViewById(R.id.webview); progressBar.setProgress(0); progressBar.setVisibility(View.VISIBLE); WebSettings settings = webview.getSettings(); settings.setJavaScriptEnabled(true); - settings.setLoadWithOverviewMode(true); - settings.setUseWideViewPort(true); settings.setMixedContentMode(WebSettings.MIXED_CONTENT_ALWAYS_ALLOW); webview.setWebViewClient(new WebViewClient() { @@ -71,9 +67,31 @@ public class FragmentWebView extends FragmentEx { }); Bundle args = getArguments(); - url = (args == null ? null : args.getString("link")); - webview.loadUrl(url); - setSubtitle(url); + if (args.containsKey("url")) { + String url = args.getString("url"); + webview.loadUrl(url); + setSubtitle(url); + } else if (args.containsKey("html")) { + String html = args.getString("html"); + String from = args.getString("from"); + webview.loadDataWithBaseURL("email://", html, "text/html", "UTF-8", null); + setSubtitle(from); + } + + ((ActivityBase) getActivity()).addBackPressedListener(new ActivityBase.IBackPressedListener() { + @Override + public boolean onBackPressed() { + boolean can = webview.canGoBack(); + if (can) + webview.goBack(); + + Bundle args = getArguments(); + if (args.containsKey("from") && !webview.canGoBack()) + setSubtitle(args.getString("from")); + + return can; + } + }); return view; } diff --git a/app/src/main/res/menu/menu_view.xml b/app/src/main/res/menu/menu_view.xml index d002ff60..df5b3681 100644 --- a/app/src/main/res/menu/menu_view.xml +++ b/app/src/main/res/menu/menu_view.xml @@ -26,6 +26,12 @@ android:title="@string/title_reply_all" app:showAsAction="never" /> + + Mark unread Forward Reply to all + Show original Trash Spam Move diff --git a/app/src/main/res/values-ar-rBH/strings.xml b/app/src/main/res/values-ar-rBH/strings.xml index a6efddd3..c62a4039 100644 --- a/app/src/main/res/values-ar-rBH/strings.xml +++ b/app/src/main/res/values-ar-rBH/strings.xml @@ -134,6 +134,7 @@ Mark unread Forward Reply to all + Show original Trash Spam Move diff --git a/app/src/main/res/values-ar-rEG/strings.xml b/app/src/main/res/values-ar-rEG/strings.xml index a6efddd3..c62a4039 100644 --- a/app/src/main/res/values-ar-rEG/strings.xml +++ b/app/src/main/res/values-ar-rEG/strings.xml @@ -134,6 +134,7 @@ Mark unread Forward Reply to all + Show original Trash Spam Move diff --git a/app/src/main/res/values-ar-rSA/strings.xml b/app/src/main/res/values-ar-rSA/strings.xml index a6efddd3..c62a4039 100644 --- a/app/src/main/res/values-ar-rSA/strings.xml +++ b/app/src/main/res/values-ar-rSA/strings.xml @@ -134,6 +134,7 @@ Mark unread Forward Reply to all + Show original Trash Spam Move diff --git a/app/src/main/res/values-ar-rYE/strings.xml b/app/src/main/res/values-ar-rYE/strings.xml index a6efddd3..c62a4039 100644 --- a/app/src/main/res/values-ar-rYE/strings.xml +++ b/app/src/main/res/values-ar-rYE/strings.xml @@ -134,6 +134,7 @@ Mark unread Forward Reply to all + Show original Trash Spam Move diff --git a/app/src/main/res/values-ar/strings.xml b/app/src/main/res/values-ar/strings.xml index a6efddd3..c62a4039 100644 --- a/app/src/main/res/values-ar/strings.xml +++ b/app/src/main/res/values-ar/strings.xml @@ -134,6 +134,7 @@ Mark unread Forward Reply to all + Show original Trash Spam Move diff --git a/app/src/main/res/values-ca/strings.xml b/app/src/main/res/values-ca/strings.xml index 5b63fc95..a92f7a9f 100644 --- a/app/src/main/res/values-ca/strings.xml +++ b/app/src/main/res/values-ca/strings.xml @@ -118,6 +118,7 @@ Mark unread Forward Reply to all + Show original Trash Spam Move diff --git a/app/src/main/res/values-cs/strings.xml b/app/src/main/res/values-cs/strings.xml index e924d4a2..9d6a0c58 100644 --- a/app/src/main/res/values-cs/strings.xml +++ b/app/src/main/res/values-cs/strings.xml @@ -126,6 +126,7 @@ Mark unread Forward Reply to all + Show original Trash Spam Move diff --git a/app/src/main/res/values-da/strings.xml b/app/src/main/res/values-da/strings.xml index 30e1a98c..4b217c60 100644 --- a/app/src/main/res/values-da/strings.xml +++ b/app/src/main/res/values-da/strings.xml @@ -118,6 +118,7 @@ Markér som ulæst Videresend Svar alle + Show original Papirkurv Spam Flyt diff --git a/app/src/main/res/values-de/strings.xml b/app/src/main/res/values-de/strings.xml index 16e8743d..779ffe0e 100644 --- a/app/src/main/res/values-de/strings.xml +++ b/app/src/main/res/values-de/strings.xml @@ -118,6 +118,7 @@ Als ungelesen markieren Weiterleiten Antworten an alle + Show original Papierkorb Spam Verschieben diff --git a/app/src/main/res/values-el/strings.xml b/app/src/main/res/values-el/strings.xml index 5b63fc95..a92f7a9f 100644 --- a/app/src/main/res/values-el/strings.xml +++ b/app/src/main/res/values-el/strings.xml @@ -118,6 +118,7 @@ Mark unread Forward Reply to all + Show original Trash Spam Move diff --git a/app/src/main/res/values-en/strings.xml b/app/src/main/res/values-en/strings.xml index 5b63fc95..a92f7a9f 100644 --- a/app/src/main/res/values-en/strings.xml +++ b/app/src/main/res/values-en/strings.xml @@ -118,6 +118,7 @@ Mark unread Forward Reply to all + Show original Trash Spam Move diff --git a/app/src/main/res/values-es-rES/strings.xml b/app/src/main/res/values-es-rES/strings.xml index 5b63fc95..a92f7a9f 100644 --- a/app/src/main/res/values-es-rES/strings.xml +++ b/app/src/main/res/values-es-rES/strings.xml @@ -118,6 +118,7 @@ Mark unread Forward Reply to all + Show original Trash Spam Move diff --git a/app/src/main/res/values-fi/strings.xml b/app/src/main/res/values-fi/strings.xml index 5b63fc95..a92f7a9f 100644 --- a/app/src/main/res/values-fi/strings.xml +++ b/app/src/main/res/values-fi/strings.xml @@ -118,6 +118,7 @@ Mark unread Forward Reply to all + Show original Trash Spam Move diff --git a/app/src/main/res/values-fr/strings.xml b/app/src/main/res/values-fr/strings.xml index 7ac25a95..8285ec36 100644 --- a/app/src/main/res/values-fr/strings.xml +++ b/app/src/main/res/values-fr/strings.xml @@ -118,6 +118,7 @@ Marquer comme non lu Transférer Répondre à tous + Show original Corbeille Spam Déplacer diff --git a/app/src/main/res/values-he/strings.xml b/app/src/main/res/values-he/strings.xml index aa72ad14..bd745818 100644 --- a/app/src/main/res/values-he/strings.xml +++ b/app/src/main/res/values-he/strings.xml @@ -126,6 +126,7 @@ Mark unread Forward Reply to all + Show original Trash Spam Move diff --git a/app/src/main/res/values-hu/strings.xml b/app/src/main/res/values-hu/strings.xml index 5b63fc95..a92f7a9f 100644 --- a/app/src/main/res/values-hu/strings.xml +++ b/app/src/main/res/values-hu/strings.xml @@ -118,6 +118,7 @@ Mark unread Forward Reply to all + Show original Trash Spam Move diff --git a/app/src/main/res/values-it/strings.xml b/app/src/main/res/values-it/strings.xml index 7457a3bd..403ed048 100644 --- a/app/src/main/res/values-it/strings.xml +++ b/app/src/main/res/values-it/strings.xml @@ -118,6 +118,7 @@ Segna come non letto Inoltra Rispondi a tutti + Show original Cestino Posta indesiderata Sposta diff --git a/app/src/main/res/values-iw/strings.xml b/app/src/main/res/values-iw/strings.xml index aa72ad14..bd745818 100644 --- a/app/src/main/res/values-iw/strings.xml +++ b/app/src/main/res/values-iw/strings.xml @@ -126,6 +126,7 @@ Mark unread Forward Reply to all + Show original Trash Spam Move diff --git a/app/src/main/res/values-ja/strings.xml b/app/src/main/res/values-ja/strings.xml index d94ccd08..91ed3062 100644 --- a/app/src/main/res/values-ja/strings.xml +++ b/app/src/main/res/values-ja/strings.xml @@ -114,6 +114,7 @@ Mark unread Forward Reply to all + Show original Trash Spam Move diff --git a/app/src/main/res/values-ko/strings.xml b/app/src/main/res/values-ko/strings.xml index d94ccd08..91ed3062 100644 --- a/app/src/main/res/values-ko/strings.xml +++ b/app/src/main/res/values-ko/strings.xml @@ -114,6 +114,7 @@ Mark unread Forward Reply to all + Show original Trash Spam Move diff --git a/app/src/main/res/values-nb/strings.xml b/app/src/main/res/values-nb/strings.xml index 5b63fc95..a92f7a9f 100644 --- a/app/src/main/res/values-nb/strings.xml +++ b/app/src/main/res/values-nb/strings.xml @@ -118,6 +118,7 @@ Mark unread Forward Reply to all + Show original Trash Spam Move diff --git a/app/src/main/res/values-nl/strings.xml b/app/src/main/res/values-nl/strings.xml index 5b63fc95..a92f7a9f 100644 --- a/app/src/main/res/values-nl/strings.xml +++ b/app/src/main/res/values-nl/strings.xml @@ -118,6 +118,7 @@ Mark unread Forward Reply to all + Show original Trash Spam Move diff --git a/app/src/main/res/values-no/strings.xml b/app/src/main/res/values-no/strings.xml index 5b63fc95..a92f7a9f 100644 --- a/app/src/main/res/values-no/strings.xml +++ b/app/src/main/res/values-no/strings.xml @@ -118,6 +118,7 @@ Mark unread Forward Reply to all + Show original Trash Spam Move diff --git a/app/src/main/res/values-pl/strings.xml b/app/src/main/res/values-pl/strings.xml index 7429464f..315e5e78 100644 --- a/app/src/main/res/values-pl/strings.xml +++ b/app/src/main/res/values-pl/strings.xml @@ -126,6 +126,7 @@ Oznacz jako nieprzeczytane Prześlij dalej Odpowiedz wszystkim + Show original Kosz Spam Przenieś diff --git a/app/src/main/res/values-pt-rBR/strings.xml b/app/src/main/res/values-pt-rBR/strings.xml index 71c2aab4..9a43fc52 100644 --- a/app/src/main/res/values-pt-rBR/strings.xml +++ b/app/src/main/res/values-pt-rBR/strings.xml @@ -118,6 +118,7 @@ Mark unread Encaminhar Responder a todos + Show original Lixeira Spam Mover diff --git a/app/src/main/res/values-pt-rPT/strings.xml b/app/src/main/res/values-pt-rPT/strings.xml index 5b63fc95..a92f7a9f 100644 --- a/app/src/main/res/values-pt-rPT/strings.xml +++ b/app/src/main/res/values-pt-rPT/strings.xml @@ -118,6 +118,7 @@ Mark unread Forward Reply to all + Show original Trash Spam Move diff --git a/app/src/main/res/values-ro/strings.xml b/app/src/main/res/values-ro/strings.xml index 92472bb7..982c4afa 100644 --- a/app/src/main/res/values-ro/strings.xml +++ b/app/src/main/res/values-ro/strings.xml @@ -122,6 +122,7 @@ Marcare ca necitit Redirecționează Răspunde tuturor + Show original Gunoi Spam Mută diff --git a/app/src/main/res/values-ru/strings.xml b/app/src/main/res/values-ru/strings.xml index e924d4a2..9d6a0c58 100644 --- a/app/src/main/res/values-ru/strings.xml +++ b/app/src/main/res/values-ru/strings.xml @@ -126,6 +126,7 @@ Mark unread Forward Reply to all + Show original Trash Spam Move diff --git a/app/src/main/res/values-sr/strings.xml b/app/src/main/res/values-sr/strings.xml index 4a26319f..36023cae 100644 --- a/app/src/main/res/values-sr/strings.xml +++ b/app/src/main/res/values-sr/strings.xml @@ -122,6 +122,7 @@ Mark unread Forward Reply to all + Show original Trash Spam Move diff --git a/app/src/main/res/values-sv-rSE/strings.xml b/app/src/main/res/values-sv-rSE/strings.xml index 5b63fc95..a92f7a9f 100644 --- a/app/src/main/res/values-sv-rSE/strings.xml +++ b/app/src/main/res/values-sv-rSE/strings.xml @@ -118,6 +118,7 @@ Mark unread Forward Reply to all + Show original Trash Spam Move diff --git a/app/src/main/res/values-tr/strings.xml b/app/src/main/res/values-tr/strings.xml index 060be353..9c6753d7 100644 --- a/app/src/main/res/values-tr/strings.xml +++ b/app/src/main/res/values-tr/strings.xml @@ -118,6 +118,7 @@ Okunmadı olarak işaretle İlet Tümünü yanıtla + Show original Çöp Kutusu Spam Taşı diff --git a/app/src/main/res/values-uk/strings.xml b/app/src/main/res/values-uk/strings.xml index e924d4a2..9d6a0c58 100644 --- a/app/src/main/res/values-uk/strings.xml +++ b/app/src/main/res/values-uk/strings.xml @@ -126,6 +126,7 @@ Mark unread Forward Reply to all + Show original Trash Spam Move diff --git a/app/src/main/res/values-vi/strings.xml b/app/src/main/res/values-vi/strings.xml index d94ccd08..91ed3062 100644 --- a/app/src/main/res/values-vi/strings.xml +++ b/app/src/main/res/values-vi/strings.xml @@ -114,6 +114,7 @@ Mark unread Forward Reply to all + Show original Trash Spam Move diff --git a/app/src/main/res/values-zh-rCN/strings.xml b/app/src/main/res/values-zh-rCN/strings.xml index 4d836a0b..f383a7b7 100644 --- a/app/src/main/res/values-zh-rCN/strings.xml +++ b/app/src/main/res/values-zh-rCN/strings.xml @@ -114,6 +114,7 @@ 标记为未读 转发 回复全部 + Show original 回收站 垃圾邮件 移动 diff --git a/app/src/main/res/values-zh-rTW/strings.xml b/app/src/main/res/values-zh-rTW/strings.xml index d94ccd08..91ed3062 100644 --- a/app/src/main/res/values-zh-rTW/strings.xml +++ b/app/src/main/res/values-zh-rTW/strings.xml @@ -114,6 +114,7 @@ Mark unread Forward Reply to all + Show original Trash Spam Move diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 1c8f2f1d..f7698f91 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -139,6 +139,7 @@ Mark unread Forward Reply to all + Show original Trash Spam