diff --git a/OsmAnd/res/values/strings.xml b/OsmAnd/res/values/strings.xml index 6d00d5cf6c..261e7551e3 100644 --- a/OsmAnd/res/values/strings.xml +++ b/OsmAnd/res/values/strings.xml @@ -9,6 +9,9 @@ 3. All your modified/created strings are in the top of the file (to make easier find what\'s translated). PLEASE: Have a look at http://code.google.com/p/osmand/wiki/UIConsistency, it may really improve your and our work :-) Thx - Hardy --> + Images cache + Delete search history + Show images Travel maps Wikivoyage Article removed @@ -311,7 +314,7 @@ Sea depth contour lines and nautical point maps. Thank you for purchasing nautical depth contours Nautical depth contours - + Worldwide Wikivoyage articles Southern hemisphere nautical depth points Northern hemisphere nautical depth points diff --git a/OsmAnd/src/net/osmand/plus/OsmandSettings.java b/OsmAnd/src/net/osmand/plus/OsmandSettings.java index 4f8f2de103..b686d58f9d 100644 --- a/OsmAnd/src/net/osmand/plus/OsmandSettings.java +++ b/OsmAnd/src/net/osmand/plus/OsmandSettings.java @@ -717,6 +717,8 @@ public class OsmandSettings { public final CommonPreference SHOW_LINES_TO_FIRST_MARKERS = new BooleanPreference("show_lines_to_first_markers", false).makeProfile(); public final CommonPreference SHOW_ARROWS_TO_FIRST_MARKERS = new BooleanPreference("show_arrows_to_first_markers", false).makeProfile(); + public final CommonPreference WIKIVOYAGE_SHOW_IMAGES = new BooleanPreference("wikivoyage_show_images", false); + public final CommonPreference SELECT_MARKER_ON_SINGLE_TAP = new BooleanPreference("select_marker_on_single_tap", false).makeProfile(); public final CommonPreference COORDS_INPUT_USE_RIGHT_SIDE = new BooleanPreference("coords_input_use_right_side", true).makeGlobal(); diff --git a/OsmAnd/src/net/osmand/plus/wikivoyage/article/WikivoyageArticleDialogFragment.java b/OsmAnd/src/net/osmand/plus/wikivoyage/article/WikivoyageArticleDialogFragment.java index 6edf4e53fa..fd5b3c0a00 100644 --- a/OsmAnd/src/net/osmand/plus/wikivoyage/article/WikivoyageArticleDialogFragment.java +++ b/OsmAnd/src/net/osmand/plus/wikivoyage/article/WikivoyageArticleDialogFragment.java @@ -119,6 +119,7 @@ public class WikivoyageArticleDialogFragment extends WikivoyageBaseDialogFragmen contentWebView = (WebView) mainView.findViewById(R.id.content_web_view); contentWebView.getSettings().setJavaScriptEnabled(true); + contentWebView.getSettings().setLoadsImagesAutomatically(getSettings().WIKIVOYAGE_SHOW_IMAGES.get()); return mainView; } @@ -229,9 +230,9 @@ public class WikivoyageArticleDialogFragment extends WikivoyageBaseDialogFragmen private String createHtmlContent(@NonNull WikivoyageArticle article) { StringBuilder sb = new StringBuilder(HEADER_INNER); - String articleTitle = article.getImageTitle(); - if (!TextUtils.isEmpty(articleTitle)) { - String url = WikivoyageArticle.getImageUrl(articleTitle, false); + String imageTitle = article.getImageTitle(); + if (!TextUtils.isEmpty(imageTitle) && getSettings().WIKIVOYAGE_SHOW_IMAGES.get()) { + String url = WikivoyageArticle.getImageUrl(imageTitle, false); sb.append("
"); } sb.append("
\n"); diff --git a/OsmAnd/src/net/osmand/plus/wikivoyage/explore/SavedArticlesRvAdapter.java b/OsmAnd/src/net/osmand/plus/wikivoyage/explore/SavedArticlesRvAdapter.java index b4391c4169..461530c97d 100644 --- a/OsmAnd/src/net/osmand/plus/wikivoyage/explore/SavedArticlesRvAdapter.java +++ b/OsmAnd/src/net/osmand/plus/wikivoyage/explore/SavedArticlesRvAdapter.java @@ -76,21 +76,24 @@ public class SavedArticlesRvAdapter extends RecyclerView.Adapter showImagesPref = app.getSettings().WIKIVOYAGE_SHOW_IMAGES; + + items.add(new TitleItem(getString(R.string.shared_string_options))); + + BaseBottomSheetItem showImagesItem = new BottomSheetItemWithCompoundButton.Builder() + .setChecked(showImagesPref.get()) + .setIcon(getContentIcon(R.drawable.ic_type_img)) + .setTitle(getString(R.string.show_images)) + .setLayoutId(R.layout.bottom_sheet_item_with_switch) + .setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + showImagesPref.set(!showImagesPref.get()); + dismiss(); + } + }) + .create(); + items.add(showImagesItem); + + BaseBottomSheetItem clearCacheItem = new BottomSheetItemWithDescription.Builder() + .setDescription(getString(R.string.shared_string_clear)) + .setTitle(getString(R.string.images_cache) + ": ???") // TODO : show images cache size + .setLayoutId(R.layout.bottom_sheet_item_with_right_descr) + .setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + // TODO : implement clearing of cache + Toast.makeText(getContext(), "Currently in development", Toast.LENGTH_SHORT).show(); + } + }) + .create(); + items.add(clearCacheItem); + + items.add(new DividerHalfItem(getContext())); + + BaseBottomSheetItem clearHistoryItem = new SimpleBottomSheetItem.Builder() + .setIcon(getContentIcon(R.drawable.ic_action_history)) + .setTitle(getString(R.string.delete_search_history)) + .setLayoutId(R.layout.bottom_sheet_item_simple) + .setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + WikivoyageLocalDataHelper.getInstance(app).clearHistory(); + dismiss(); + } + }) + .create(); + items.add(clearHistoryItem); + } +} diff --git a/OsmAnd/src/net/osmand/plus/wikivoyage/search/SearchRecyclerViewAdapter.java b/OsmAnd/src/net/osmand/plus/wikivoyage/search/SearchRecyclerViewAdapter.java index a3f2b5679f..f182249b16 100644 --- a/OsmAnd/src/net/osmand/plus/wikivoyage/search/SearchRecyclerViewAdapter.java +++ b/OsmAnd/src/net/osmand/plus/wikivoyage/search/SearchRecyclerViewAdapter.java @@ -74,7 +74,8 @@ public class SearchRecyclerViewAdapter extends RecyclerView.Adapter