Added option to show orginal message

Fixes #64
pull/91/head
M66B 6 years ago
parent fe86f757f0
commit 4bd931c29f

@ -259,7 +259,7 @@ public class FragmentMessage extends FragmentEx {
} else if (prefs.getBoolean("webview", false)) {
Bundle args = new Bundle();
args.putString("link", url);
args.putString("url", url);
FragmentWebView fragment = new FragmentWebView();
fragment.setArguments(args);
@ -584,6 +584,9 @@ public class FragmentMessage extends FragmentEx {
case R.id.menu_reply_all:
onMenuReplyAll();
return true;
case R.id.menu_show_html:
onMenuShowHtml();
return true;
case R.id.menu_answer:
onMenuAnswer();
return true;
@ -625,6 +628,29 @@ public class FragmentMessage extends FragmentEx {
.putExtra("reference", message.id));
}
private void onMenuShowHtml() {
new SimpleTask<String>() {
@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<List<EntityAnswer>>() {
@Override

@ -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;
}

@ -26,6 +26,12 @@
android:title="@string/title_reply_all"
app:showAsAction="never" />
<item
android:id="@+id/menu_show_html"
android:icon="@drawable/baseline_visibility_24"
android:title="@string/title_show_html"
app:showAsAction="never" />
<item
android:id="@+id/menu_answer"
android:icon="@drawable/baseline_reply_24"

@ -118,6 +118,7 @@
<string name="title_unseen">Mark unread</string>
<string name="title_forward">Forward</string>
<string name="title_reply_all">Reply to all</string>
<string name="title_show_html">Show original</string>
<string name="title_trash">Trash</string>
<string name="title_spam">Spam</string>
<string name="title_move">Move</string>

@ -134,6 +134,7 @@
<string name="title_unseen">Mark unread</string>
<string name="title_forward">Forward</string>
<string name="title_reply_all">Reply to all</string>
<string name="title_show_html">Show original</string>
<string name="title_trash">Trash</string>
<string name="title_spam">Spam</string>
<string name="title_move">Move</string>

@ -134,6 +134,7 @@
<string name="title_unseen">Mark unread</string>
<string name="title_forward">Forward</string>
<string name="title_reply_all">Reply to all</string>
<string name="title_show_html">Show original</string>
<string name="title_trash">Trash</string>
<string name="title_spam">Spam</string>
<string name="title_move">Move</string>

@ -134,6 +134,7 @@
<string name="title_unseen">Mark unread</string>
<string name="title_forward">Forward</string>
<string name="title_reply_all">Reply to all</string>
<string name="title_show_html">Show original</string>
<string name="title_trash">Trash</string>
<string name="title_spam">Spam</string>
<string name="title_move">Move</string>

@ -134,6 +134,7 @@
<string name="title_unseen">Mark unread</string>
<string name="title_forward">Forward</string>
<string name="title_reply_all">Reply to all</string>
<string name="title_show_html">Show original</string>
<string name="title_trash">Trash</string>
<string name="title_spam">Spam</string>
<string name="title_move">Move</string>

@ -134,6 +134,7 @@
<string name="title_unseen">Mark unread</string>
<string name="title_forward">Forward</string>
<string name="title_reply_all">Reply to all</string>
<string name="title_show_html">Show original</string>
<string name="title_trash">Trash</string>
<string name="title_spam">Spam</string>
<string name="title_move">Move</string>

@ -118,6 +118,7 @@
<string name="title_unseen">Mark unread</string>
<string name="title_forward">Forward</string>
<string name="title_reply_all">Reply to all</string>
<string name="title_show_html">Show original</string>
<string name="title_trash">Trash</string>
<string name="title_spam">Spam</string>
<string name="title_move">Move</string>

@ -126,6 +126,7 @@
<string name="title_unseen">Mark unread</string>
<string name="title_forward">Forward</string>
<string name="title_reply_all">Reply to all</string>
<string name="title_show_html">Show original</string>
<string name="title_trash">Trash</string>
<string name="title_spam">Spam</string>
<string name="title_move">Move</string>

@ -118,6 +118,7 @@
<string name="title_unseen">Markér som ulæst</string>
<string name="title_forward">Videresend</string>
<string name="title_reply_all">Svar alle</string>
<string name="title_show_html">Show original</string>
<string name="title_trash">Papirkurv</string>
<string name="title_spam">Spam</string>
<string name="title_move">Flyt</string>

@ -118,6 +118,7 @@
<string name="title_unseen">Als ungelesen markieren</string>
<string name="title_forward">Weiterleiten</string>
<string name="title_reply_all">Antworten an alle</string>
<string name="title_show_html">Show original</string>
<string name="title_trash">Papierkorb</string>
<string name="title_spam">Spam</string>
<string name="title_move">Verschieben</string>

@ -118,6 +118,7 @@
<string name="title_unseen">Mark unread</string>
<string name="title_forward">Forward</string>
<string name="title_reply_all">Reply to all</string>
<string name="title_show_html">Show original</string>
<string name="title_trash">Trash</string>
<string name="title_spam">Spam</string>
<string name="title_move">Move</string>

@ -118,6 +118,7 @@
<string name="title_unseen">Mark unread</string>
<string name="title_forward">Forward</string>
<string name="title_reply_all">Reply to all</string>
<string name="title_show_html">Show original</string>
<string name="title_trash">Trash</string>
<string name="title_spam">Spam</string>
<string name="title_move">Move</string>

@ -118,6 +118,7 @@
<string name="title_unseen">Mark unread</string>
<string name="title_forward">Forward</string>
<string name="title_reply_all">Reply to all</string>
<string name="title_show_html">Show original</string>
<string name="title_trash">Trash</string>
<string name="title_spam">Spam</string>
<string name="title_move">Move</string>

@ -118,6 +118,7 @@
<string name="title_unseen">Mark unread</string>
<string name="title_forward">Forward</string>
<string name="title_reply_all">Reply to all</string>
<string name="title_show_html">Show original</string>
<string name="title_trash">Trash</string>
<string name="title_spam">Spam</string>
<string name="title_move">Move</string>

@ -118,6 +118,7 @@
<string name="title_unseen">Marquer comme non lu</string>
<string name="title_forward">Transférer</string>
<string name="title_reply_all">Répondre à tous</string>
<string name="title_show_html">Show original</string>
<string name="title_trash">Corbeille</string>
<string name="title_spam">Spam</string>
<string name="title_move">Déplacer</string>

@ -126,6 +126,7 @@
<string name="title_unseen">Mark unread</string>
<string name="title_forward">Forward</string>
<string name="title_reply_all">Reply to all</string>
<string name="title_show_html">Show original</string>
<string name="title_trash">Trash</string>
<string name="title_spam">Spam</string>
<string name="title_move">Move</string>

@ -118,6 +118,7 @@
<string name="title_unseen">Mark unread</string>
<string name="title_forward">Forward</string>
<string name="title_reply_all">Reply to all</string>
<string name="title_show_html">Show original</string>
<string name="title_trash">Trash</string>
<string name="title_spam">Spam</string>
<string name="title_move">Move</string>

@ -118,6 +118,7 @@
<string name="title_unseen">Segna come non letto</string>
<string name="title_forward">Inoltra</string>
<string name="title_reply_all">Rispondi a tutti</string>
<string name="title_show_html">Show original</string>
<string name="title_trash">Cestino</string>
<string name="title_spam">Posta indesiderata</string>
<string name="title_move">Sposta</string>

@ -126,6 +126,7 @@
<string name="title_unseen">Mark unread</string>
<string name="title_forward">Forward</string>
<string name="title_reply_all">Reply to all</string>
<string name="title_show_html">Show original</string>
<string name="title_trash">Trash</string>
<string name="title_spam">Spam</string>
<string name="title_move">Move</string>

@ -114,6 +114,7 @@
<string name="title_unseen">Mark unread</string>
<string name="title_forward">Forward</string>
<string name="title_reply_all">Reply to all</string>
<string name="title_show_html">Show original</string>
<string name="title_trash">Trash</string>
<string name="title_spam">Spam</string>
<string name="title_move">Move</string>

@ -114,6 +114,7 @@
<string name="title_unseen">Mark unread</string>
<string name="title_forward">Forward</string>
<string name="title_reply_all">Reply to all</string>
<string name="title_show_html">Show original</string>
<string name="title_trash">Trash</string>
<string name="title_spam">Spam</string>
<string name="title_move">Move</string>

@ -118,6 +118,7 @@
<string name="title_unseen">Mark unread</string>
<string name="title_forward">Forward</string>
<string name="title_reply_all">Reply to all</string>
<string name="title_show_html">Show original</string>
<string name="title_trash">Trash</string>
<string name="title_spam">Spam</string>
<string name="title_move">Move</string>

@ -118,6 +118,7 @@
<string name="title_unseen">Mark unread</string>
<string name="title_forward">Forward</string>
<string name="title_reply_all">Reply to all</string>
<string name="title_show_html">Show original</string>
<string name="title_trash">Trash</string>
<string name="title_spam">Spam</string>
<string name="title_move">Move</string>

@ -118,6 +118,7 @@
<string name="title_unseen">Mark unread</string>
<string name="title_forward">Forward</string>
<string name="title_reply_all">Reply to all</string>
<string name="title_show_html">Show original</string>
<string name="title_trash">Trash</string>
<string name="title_spam">Spam</string>
<string name="title_move">Move</string>

@ -126,6 +126,7 @@
<string name="title_unseen">Oznacz jako nieprzeczytane</string>
<string name="title_forward">Prześlij dalej</string>
<string name="title_reply_all">Odpowiedz wszystkim</string>
<string name="title_show_html">Show original</string>
<string name="title_trash">Kosz</string>
<string name="title_spam">Spam</string>
<string name="title_move">Przenieś</string>

@ -118,6 +118,7 @@
<string name="title_unseen">Mark unread</string>
<string name="title_forward">Encaminhar</string>
<string name="title_reply_all">Responder a todos</string>
<string name="title_show_html">Show original</string>
<string name="title_trash">Lixeira</string>
<string name="title_spam">Spam</string>
<string name="title_move">Mover</string>

@ -118,6 +118,7 @@
<string name="title_unseen">Mark unread</string>
<string name="title_forward">Forward</string>
<string name="title_reply_all">Reply to all</string>
<string name="title_show_html">Show original</string>
<string name="title_trash">Trash</string>
<string name="title_spam">Spam</string>
<string name="title_move">Move</string>

@ -122,6 +122,7 @@
<string name="title_unseen">Marcare ca necitit</string>
<string name="title_forward">Redirecționează</string>
<string name="title_reply_all">Răspunde tuturor</string>
<string name="title_show_html">Show original</string>
<string name="title_trash">Gunoi</string>
<string name="title_spam">Spam</string>
<string name="title_move">Mută</string>

@ -126,6 +126,7 @@
<string name="title_unseen">Mark unread</string>
<string name="title_forward">Forward</string>
<string name="title_reply_all">Reply to all</string>
<string name="title_show_html">Show original</string>
<string name="title_trash">Trash</string>
<string name="title_spam">Spam</string>
<string name="title_move">Move</string>

@ -122,6 +122,7 @@
<string name="title_unseen">Mark unread</string>
<string name="title_forward">Forward</string>
<string name="title_reply_all">Reply to all</string>
<string name="title_show_html">Show original</string>
<string name="title_trash">Trash</string>
<string name="title_spam">Spam</string>
<string name="title_move">Move</string>

@ -118,6 +118,7 @@
<string name="title_unseen">Mark unread</string>
<string name="title_forward">Forward</string>
<string name="title_reply_all">Reply to all</string>
<string name="title_show_html">Show original</string>
<string name="title_trash">Trash</string>
<string name="title_spam">Spam</string>
<string name="title_move">Move</string>

@ -118,6 +118,7 @@
<string name="title_unseen">Okunmadı olarak işaretle</string>
<string name="title_forward">İlet</string>
<string name="title_reply_all">Tümünü yanıtla</string>
<string name="title_show_html">Show original</string>
<string name="title_trash">Çöp Kutusu</string>
<string name="title_spam">Spam</string>
<string name="title_move">Taşı</string>

@ -126,6 +126,7 @@
<string name="title_unseen">Mark unread</string>
<string name="title_forward">Forward</string>
<string name="title_reply_all">Reply to all</string>
<string name="title_show_html">Show original</string>
<string name="title_trash">Trash</string>
<string name="title_spam">Spam</string>
<string name="title_move">Move</string>

@ -114,6 +114,7 @@
<string name="title_unseen">Mark unread</string>
<string name="title_forward">Forward</string>
<string name="title_reply_all">Reply to all</string>
<string name="title_show_html">Show original</string>
<string name="title_trash">Trash</string>
<string name="title_spam">Spam</string>
<string name="title_move">Move</string>

@ -114,6 +114,7 @@
<string name="title_unseen">标记为未读</string>
<string name="title_forward">转发</string>
<string name="title_reply_all">回复全部</string>
<string name="title_show_html">Show original</string>
<string name="title_trash">回收站</string>
<string name="title_spam">垃圾邮件</string>
<string name="title_move">移动</string>

@ -114,6 +114,7 @@
<string name="title_unseen">Mark unread</string>
<string name="title_forward">Forward</string>
<string name="title_reply_all">Reply to all</string>
<string name="title_show_html">Show original</string>
<string name="title_trash">Trash</string>
<string name="title_spam">Spam</string>
<string name="title_move">Move</string>

@ -139,6 +139,7 @@
<string name="title_unseen">Mark unread</string>
<string name="title_forward">Forward</string>
<string name="title_reply_all">Reply to all</string>
<string name="title_show_html">Show original</string>
<string name="title_trash">Trash</string>
<string name="title_spam">Spam</string>

Loading…
Cancel
Save