diff --git a/OsmAnd/src/net/osmand/plus/wikivoyage/article/WikivoyageArticleDialogFragment.java b/OsmAnd/src/net/osmand/plus/wikivoyage/article/WikivoyageArticleDialogFragment.java index 7a308fb93e..fd5b3c0a00 100644 --- a/OsmAnd/src/net/osmand/plus/wikivoyage/article/WikivoyageArticleDialogFragment.java +++ b/OsmAnd/src/net/osmand/plus/wikivoyage/article/WikivoyageArticleDialogFragment.java @@ -230,9 +230,9 @@ public class WikivoyageArticleDialogFragment extends WikivoyageBaseDialogFragmen private String createHtmlContent(@NonNull WikivoyageArticle article) { StringBuilder sb = new StringBuilder(HEADER_INNER); - String articleImageTitle = article.getImageTitle(); - if (!TextUtils.isEmpty(articleImageTitle)&&getSettings().WIKIVOYAGE_SHOW_IMAGES.get()) { - String url = WikivoyageArticle.getImageUrl(articleImageTitle, 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/WikivoyageExploreDialogFragment.java b/OsmAnd/src/net/osmand/plus/wikivoyage/explore/WikivoyageExploreDialogFragment.java index e6dfb46033..04d7be9e4b 100644 --- a/OsmAnd/src/net/osmand/plus/wikivoyage/explore/WikivoyageExploreDialogFragment.java +++ b/OsmAnd/src/net/osmand/plus/wikivoyage/explore/WikivoyageExploreDialogFragment.java @@ -41,6 +41,15 @@ public class WikivoyageExploreDialogFragment extends WikivoyageBaseDialogFragmen setupToolbar((Toolbar) mainView.findViewById(R.id.toolbar)); + mainView.findViewById(R.id.options_button).setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + WikivoyageOptionsBottomSheetDialogFragment fragment = new WikivoyageOptionsBottomSheetDialogFragment(); + fragment.setUsedOnMap(false); + fragment.show(getChildFragmentManager(), WikivoyageOptionsBottomSheetDialogFragment.TAG); + } + }); + int searchColorId = nightMode ? R.color.icon_color : R.color.ctx_menu_title_color_dark; ((TextView) mainView.findViewById(R.id.search_hint)).setTextColor(getResolvedColor(searchColorId)); ((ImageView) mainView.findViewById(R.id.search_icon)) @@ -53,15 +62,6 @@ public class WikivoyageExploreDialogFragment extends WikivoyageBaseDialogFragmen } }); - mainView.findViewById(R.id.options_button).setOnClickListener(new View.OnClickListener() { - @Override - public void onClick(View v) { - OptionsImagesCacheHistoryBottomSheetDialogFragment fragment = new OptionsImagesCacheHistoryBottomSheetDialogFragment(); - fragment.setUsedOnMap(false); - fragment.show(getChildFragmentManager(), OptionsImagesCacheHistoryBottomSheetDialogFragment.TAG); - } - }); - final LockableViewPager viewPager = (LockableViewPager) mainView.findViewById(R.id.view_pager); viewPager.setOffscreenPageLimit(2); viewPager.setSwipeLocked(true); diff --git a/OsmAnd/src/net/osmand/plus/wikivoyage/explore/OptionsImagesCacheHistoryBottomSheetDialogFragment.java b/OsmAnd/src/net/osmand/plus/wikivoyage/explore/WikivoyageOptionsBottomSheetDialogFragment.java similarity index 74% rename from OsmAnd/src/net/osmand/plus/wikivoyage/explore/OptionsImagesCacheHistoryBottomSheetDialogFragment.java rename to OsmAnd/src/net/osmand/plus/wikivoyage/explore/WikivoyageOptionsBottomSheetDialogFragment.java index 2e803c1e8b..e2d8c382da 100644 --- a/OsmAnd/src/net/osmand/plus/wikivoyage/explore/OptionsImagesCacheHistoryBottomSheetDialogFragment.java +++ b/OsmAnd/src/net/osmand/plus/wikivoyage/explore/WikivoyageOptionsBottomSheetDialogFragment.java @@ -4,6 +4,7 @@ import android.os.Bundle; import android.view.View; import android.webkit.WebView; +import net.osmand.plus.OsmandApplication; import net.osmand.plus.OsmandSettings; import net.osmand.plus.R; import net.osmand.plus.base.MenuBottomSheetDialogFragment; @@ -15,36 +16,35 @@ import net.osmand.plus.base.bottomsheetmenu.simpleitems.DividerHalfItem; import net.osmand.plus.base.bottomsheetmenu.simpleitems.TitleItem; import net.osmand.plus.wikivoyage.data.WikivoyageLocalDataHelper; -public class OptionsImagesCacheHistoryBottomSheetDialogFragment extends MenuBottomSheetDialogFragment { +public class WikivoyageOptionsBottomSheetDialogFragment extends MenuBottomSheetDialogFragment { - public final static String TAG = "OptionsImagesCasheBottomSheetDialogFragment"; + public final static String TAG = "WikivoyageOptionsBottomSheetDialogFragment"; @Override public void createMenuItems(Bundle savedInstanceState) { + final OsmandApplication app = getMyApplication(); + final OsmandSettings.CommonPreference showImagesPref = app.getSettings().WIKIVOYAGE_SHOW_IMAGES; items.add(new TitleItem(getString(R.string.shared_string_options))); - boolean showImages = getMyApplication().getSettings().WIKIVOYAGE_SHOW_IMAGES.get(); - - BaseBottomSheetItem showWebviewImagesItem = new BottomSheetItemWithCompoundButton.Builder() - .setChecked(showImages) + 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) { - OsmandSettings settings = getMyApplication().getSettings(); - settings.WIKIVOYAGE_SHOW_IMAGES.set(!settings.WIKIVOYAGE_SHOW_IMAGES.get()); + showImagesPref.set(!showImagesPref.get()); dismiss(); } }) .create(); - items.add(showWebviewImagesItem); + items.add(showImagesItem); BaseBottomSheetItem clearCacheItem = new BottomSheetItemWithDescription.Builder() .setDescription(getString(R.string.shared_string_clear)) - .setTitle(getString(R.string.images_cache)+":") + .setTitle(getString(R.string.images_cache) + ":") .setLayoutId(R.layout.bottom_sheet_item_with_right_descr) .setOnClickListener(new View.OnClickListener() { @Override @@ -65,7 +65,7 @@ public class OptionsImagesCacheHistoryBottomSheetDialogFragment extends MenuBott .setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { - WikivoyageLocalDataHelper.getInstance(getMyApplication()).clearHistory(); + WikivoyageLocalDataHelper.getInstance(app).clearHistory(); dismiss(); } }) diff --git a/OsmAnd/src/net/osmand/plus/wikivoyage/search/SearchRecyclerViewAdapter.java b/OsmAnd/src/net/osmand/plus/wikivoyage/search/SearchRecyclerViewAdapter.java index 0dbcfef1f4..f182249b16 100644 --- a/OsmAnd/src/net/osmand/plus/wikivoyage/search/SearchRecyclerViewAdapter.java +++ b/OsmAnd/src/net/osmand/plus/wikivoyage/search/SearchRecyclerViewAdapter.java @@ -74,8 +74,8 @@ public class SearchRecyclerViewAdapter extends RecyclerView.Adapter