From 3ad7d200965a929f3a43442d6c37ff6360bc307e Mon Sep 17 00:00:00 2001 From: Alex Sytnyk Date: Fri, 13 Apr 2018 19:00:34 +0300 Subject: [PATCH] Show cached images even if option "Show images" disabled --- .../article/WikivoyageArticleDialogFragment.java | 6 ++++-- .../wikivoyage/search/SearchRecyclerViewAdapter.java | 12 ++++++++---- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/wikivoyage/article/WikivoyageArticleDialogFragment.java b/OsmAnd/src/net/osmand/plus/wikivoyage/article/WikivoyageArticleDialogFragment.java index fd5b3c0a00..f358e3d0c0 100644 --- a/OsmAnd/src/net/osmand/plus/wikivoyage/article/WikivoyageArticleDialogFragment.java +++ b/OsmAnd/src/net/osmand/plus/wikivoyage/article/WikivoyageArticleDialogFragment.java @@ -17,6 +17,7 @@ import android.view.LayoutInflater; import android.view.MenuItem; import android.view.View; import android.view.ViewGroup; +import android.webkit.WebSettings; import android.webkit.WebView; import android.widget.TextView; @@ -117,9 +118,10 @@ public class WikivoyageArticleDialogFragment extends WikivoyageBaseDialogFragmen saveBtn = (TextView) mainView.findViewById(R.id.save_button); + boolean showImages = getSettings().WIKIVOYAGE_SHOW_IMAGES.get(); contentWebView = (WebView) mainView.findViewById(R.id.content_web_view); contentWebView.getSettings().setJavaScriptEnabled(true); - contentWebView.getSettings().setLoadsImagesAutomatically(getSettings().WIKIVOYAGE_SHOW_IMAGES.get()); + contentWebView.getSettings().setCacheMode(showImages ? WebSettings.LOAD_DEFAULT : WebSettings.LOAD_CACHE_ONLY); return mainView; } @@ -231,7 +233,7 @@ public class WikivoyageArticleDialogFragment extends WikivoyageBaseDialogFragmen StringBuilder sb = new StringBuilder(HEADER_INNER); String imageTitle = article.getImageTitle(); - if (!TextUtils.isEmpty(imageTitle) && getSettings().WIKIVOYAGE_SHOW_IMAGES.get()) { + if (!TextUtils.isEmpty(imageTitle)) { String url = WikivoyageArticle.getImageUrl(imageTitle, false); sb.append("
"); } diff --git a/OsmAnd/src/net/osmand/plus/wikivoyage/search/SearchRecyclerViewAdapter.java b/OsmAnd/src/net/osmand/plus/wikivoyage/search/SearchRecyclerViewAdapter.java index f182249b16..300af389b0 100644 --- a/OsmAnd/src/net/osmand/plus/wikivoyage/search/SearchRecyclerViewAdapter.java +++ b/OsmAnd/src/net/osmand/plus/wikivoyage/search/SearchRecyclerViewAdapter.java @@ -12,7 +12,9 @@ import android.view.ViewGroup; import android.widget.ImageView; import android.widget.TextView; +import com.squareup.picasso.NetworkPolicy; import com.squareup.picasso.Picasso; +import com.squareup.picasso.RequestCreator; import net.osmand.plus.OsmandApplication; import net.osmand.plus.R; @@ -73,10 +75,12 @@ public class SearchRecyclerViewAdapter extends RecyclerView.Adapter