change names and saved articles images

This commit is contained in:
Chumva 2018-04-13 11:29:17 +03:00
parent c284287b8d
commit fc6aa1a404
7 changed files with 35 additions and 34 deletions

View file

@ -9,12 +9,12 @@
3. All your modified/created strings are in the top of the file (to make easier find what\'s translated). 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 PLEASE: Have a look at http://code.google.com/p/osmand/wiki/UIConsistency, it may really improve your and our work :-) Thx - Hardy
--> -->
<string name="images_cache">Images cache:</string>
<string name="delete_search_history">Delete search history</string>
<string name="show_images">Show images</string>
<string name="download_maps_travel">Travel maps</string> <string name="download_maps_travel">Travel maps</string>
<string name="shared_string_wikivoyage">Wikivoyage</string> <string name="shared_string_wikivoyage">Wikivoyage</string>
<string name="article_removed">Article removed</string> <string name="article_removed">Article removed</string>
<string name="wikivoyage_images_cache">Images cache</string>
<string name="shared_string_delete_search_history">Delete search history</string>
<string name="wikivoyage_show_images">Show images</string>
<string name="wikivoyage_search_hint">Search: Country, City, Province</string> <string name="wikivoyage_search_hint">Search: Country, City, Province</string>
<string name="shared_string_read">Read</string> <string name="shared_string_read">Read</string>
<string name="saved_articles">Saved articles</string> <string name="saved_articles">Saved articles</string>

View file

@ -717,7 +717,7 @@ public class OsmandSettings {
public final CommonPreference<Boolean> SHOW_LINES_TO_FIRST_MARKERS = new BooleanPreference("show_lines_to_first_markers", false).makeProfile(); public final CommonPreference<Boolean> SHOW_LINES_TO_FIRST_MARKERS = new BooleanPreference("show_lines_to_first_markers", false).makeProfile();
public final CommonPreference<Boolean> SHOW_ARROWS_TO_FIRST_MARKERS = new BooleanPreference("show_arrows_to_first_markers", false).makeProfile(); public final CommonPreference<Boolean> SHOW_ARROWS_TO_FIRST_MARKERS = new BooleanPreference("show_arrows_to_first_markers", false).makeProfile();
public final CommonPreference<Boolean> SHOW_WEBVIEW_IMAGES = new BooleanPreference("show_webview_images", false); public final CommonPreference<Boolean> SHOW_IMAGES = new BooleanPreference("show_images", false);
public final CommonPreference<Boolean> SELECT_MARKER_ON_SINGLE_TAP = new BooleanPreference("select_marker_on_single_tap", false).makeProfile(); public final CommonPreference<Boolean> SELECT_MARKER_ON_SINGLE_TAP = new BooleanPreference("select_marker_on_single_tap", false).makeProfile();

View file

@ -119,7 +119,7 @@ public class WikivoyageArticleDialogFragment extends WikivoyageBaseDialogFragmen
contentWebView = (WebView) mainView.findViewById(R.id.content_web_view); contentWebView = (WebView) mainView.findViewById(R.id.content_web_view);
contentWebView.getSettings().setJavaScriptEnabled(true); contentWebView.getSettings().setJavaScriptEnabled(true);
contentWebView.getSettings().setLoadsImagesAutomatically(getSettings().SHOW_WEBVIEW_IMAGES.get()); contentWebView.getSettings().setLoadsImagesAutomatically(getSettings().SHOW_IMAGES.get());
return mainView; return mainView;
} }
@ -230,9 +230,9 @@ public class WikivoyageArticleDialogFragment extends WikivoyageBaseDialogFragmen
private String createHtmlContent(@NonNull WikivoyageArticle article) { private String createHtmlContent(@NonNull WikivoyageArticle article) {
StringBuilder sb = new StringBuilder(HEADER_INNER); StringBuilder sb = new StringBuilder(HEADER_INNER);
String articleTitle = article.getImageTitle(); String articleImageTitle = article.getImageTitle();
if (!TextUtils.isEmpty(articleTitle)&&!getSettings().SHOW_WEBVIEW_IMAGES.get()) { if (!TextUtils.isEmpty(articleImageTitle)&&!getSettings().SHOW_IMAGES.get()) {
String url = WikivoyageArticle.getImageUrl(articleTitle, false); String url = WikivoyageArticle.getImageUrl(articleImageTitle, false);
sb.append("<div class=\"title-image\" style=\"background-image: url(").append(url).append(")\"></div>"); sb.append("<div class=\"title-image\" style=\"background-image: url(").append(url).append(")\"></div>");
} }
sb.append("<div class=\"main\">\n"); sb.append("<div class=\"main\">\n");

View file

@ -15,7 +15,7 @@ import net.osmand.plus.base.bottomsheetmenu.simpleitems.DividerHalfItem;
import net.osmand.plus.base.bottomsheetmenu.simpleitems.TitleItem; import net.osmand.plus.base.bottomsheetmenu.simpleitems.TitleItem;
import net.osmand.plus.wikivoyage.data.WikivoyageLocalDataHelper; import net.osmand.plus.wikivoyage.data.WikivoyageLocalDataHelper;
public class OptionsImagesCasheBottomSheetDialogFragment extends MenuBottomSheetDialogFragment { public class OptionsImagesCacheHistoryBottomSheetDialogFragment extends MenuBottomSheetDialogFragment {
public final static String TAG = "OptionsImagesCasheBottomSheetDialogFragment"; public final static String TAG = "OptionsImagesCasheBottomSheetDialogFragment";
@ -24,18 +24,18 @@ public class OptionsImagesCasheBottomSheetDialogFragment extends MenuBottomSheet
items.add(new TitleItem(getString(R.string.shared_string_options))); items.add(new TitleItem(getString(R.string.shared_string_options)));
boolean showWebviewImages = getMyApplication().getSettings().SHOW_WEBVIEW_IMAGES.get(); boolean showImages = getMyApplication().getSettings().SHOW_IMAGES.get();
BaseBottomSheetItem showWebviewImagesItem = new BottomSheetItemWithCompoundButton.Builder() BaseBottomSheetItem showWebviewImagesItem = new BottomSheetItemWithCompoundButton.Builder()
.setChecked(showWebviewImages) .setChecked(showImages)
.setIcon(getContentIcon(R.drawable.ic_type_img)) .setIcon(getContentIcon(R.drawable.ic_type_img))
.setTitle(getString(R.string.wikivoyage_show_images)) .setTitle(getString(R.string.show_images))
.setLayoutId(R.layout.bottom_sheet_item_with_switch) .setLayoutId(R.layout.bottom_sheet_item_with_switch)
.setOnClickListener(new View.OnClickListener() { .setOnClickListener(new View.OnClickListener() {
@Override @Override
public void onClick(View v) { public void onClick(View v) {
OsmandSettings settings = getMyApplication().getSettings(); OsmandSettings settings = getMyApplication().getSettings();
settings.SHOW_WEBVIEW_IMAGES.set(!settings.SHOW_WEBVIEW_IMAGES.get()); settings.SHOW_IMAGES.set(!settings.SHOW_IMAGES.get());
dismiss(); dismiss();
} }
}) })
@ -44,7 +44,7 @@ public class OptionsImagesCasheBottomSheetDialogFragment extends MenuBottomSheet
BaseBottomSheetItem clearCacheItem = new BottomSheetItemWithDescription.Builder() BaseBottomSheetItem clearCacheItem = new BottomSheetItemWithDescription.Builder()
.setDescription(getString(R.string.shared_string_clear)) .setDescription(getString(R.string.shared_string_clear))
.setTitle(getString(R.string.wikivoyage_images_cache)) .setTitle(getString(R.string.images_cache))
.setLayoutId(R.layout.bottom_sheet_item_with_right_descr) .setLayoutId(R.layout.bottom_sheet_item_with_right_descr)
.setOnClickListener(new View.OnClickListener() { .setOnClickListener(new View.OnClickListener() {
@Override @Override
@ -60,7 +60,7 @@ public class OptionsImagesCasheBottomSheetDialogFragment extends MenuBottomSheet
BaseBottomSheetItem clearHistoryItem = new SimpleBottomSheetItem.Builder() BaseBottomSheetItem clearHistoryItem = new SimpleBottomSheetItem.Builder()
.setIcon(getContentIcon(R.drawable.ic_action_history)) .setIcon(getContentIcon(R.drawable.ic_action_history))
.setTitle(getString(R.string.shared_string_delete_search_history)) .setTitle(getString(R.string.delete_search_history))
.setLayoutId(R.layout.bottom_sheet_item_simple) .setLayoutId(R.layout.bottom_sheet_item_simple)
.setOnClickListener(new View.OnClickListener() { .setOnClickListener(new View.OnClickListener() {
@Override @Override

View file

@ -76,22 +76,24 @@ public class SavedArticlesRvAdapter extends RecyclerView.Adapter<RecyclerView.Vi
final ItemVH holder = (ItemVH) viewHolder; final ItemVH holder = (ItemVH) viewHolder;
WikivoyageArticle article = (WikivoyageArticle) getItem(position); WikivoyageArticle article = (WikivoyageArticle) getItem(position);
boolean lastItem = position == getItemCount() - 1; boolean lastItem = position == getItemCount() - 1;
if (app.getSettings().SHOW_IMAGES.get()) {
Picasso.get()
.load(WikivoyageArticle.getImageUrl(article.getImageTitle(), false))
.transform(USE_ALTERNATIVE_CARD ? new CropRectTransformation() : new CropCircleTransformation())
.into(holder.icon, new Callback() {
@Override
public void onSuccess() {
holder.icon.setVisibility(View.VISIBLE);
}
Picasso.get() @Override
.load(app.getSettings().SHOW_WEBVIEW_IMAGES.get() ? public void onError(Exception e) {
WikivoyageArticle.getImageUrl(article.getImageTitle(), false) : null) holder.icon.setVisibility(View.GONE);
.transform(USE_ALTERNATIVE_CARD ? new CropRectTransformation() : new CropCircleTransformation()) }
.into(holder.icon, new Callback() { });
@Override } else {
public void onSuccess() { holder.icon.setVisibility(View.GONE);
holder.icon.setVisibility(View.VISIBLE); }
}
@Override
public void onError(Exception e) {
holder.icon.setVisibility(View.GONE);
}
});
holder.title.setText(article.getTitle()); holder.title.setText(article.getTitle());
holder.content.setText(article.getContent()); holder.content.setText(article.getContent());
holder.partOf.setText(article.getGeoDescription()); holder.partOf.setText(article.getGeoDescription());

View file

@ -20,7 +20,6 @@ import android.widget.TextView;
import net.osmand.AndroidUtils; import net.osmand.AndroidUtils;
import net.osmand.plus.LockableViewPager; import net.osmand.plus.LockableViewPager;
import net.osmand.plus.R; import net.osmand.plus.R;
import net.osmand.plus.mapmarkers.OrderByBottomSheetDialogFragment;
import net.osmand.plus.wikivoyage.WikivoyageBaseDialogFragment; import net.osmand.plus.wikivoyage.WikivoyageBaseDialogFragment;
import net.osmand.plus.wikivoyage.search.WikivoyageSearchDialogFragment; import net.osmand.plus.wikivoyage.search.WikivoyageSearchDialogFragment;
@ -57,9 +56,9 @@ public class WikivoyageExploreDialogFragment extends WikivoyageBaseDialogFragmen
mainView.findViewById(R.id.options_button).setOnClickListener(new View.OnClickListener() { mainView.findViewById(R.id.options_button).setOnClickListener(new View.OnClickListener() {
@Override @Override
public void onClick(View v) { public void onClick(View v) {
OptionsImagesCasheBottomSheetDialogFragment fragment = new OptionsImagesCasheBottomSheetDialogFragment(); OptionsImagesCacheHistoryBottomSheetDialogFragment fragment = new OptionsImagesCacheHistoryBottomSheetDialogFragment();
fragment.setUsedOnMap(false); fragment.setUsedOnMap(false);
fragment.show(getChildFragmentManager(), OptionsImagesCasheBottomSheetDialogFragment.TAG); fragment.show(getChildFragmentManager(), OptionsImagesCacheHistoryBottomSheetDialogFragment.TAG);
} }
}); });

View file

@ -74,7 +74,7 @@ public class SearchRecyclerViewAdapter extends RecyclerView.Adapter<RecyclerView
if (item instanceof WikivoyageSearchResult) { if (item instanceof WikivoyageSearchResult) {
WikivoyageSearchResult searchRes = (WikivoyageSearchResult) item; WikivoyageSearchResult searchRes = (WikivoyageSearchResult) item;
Picasso.get() Picasso.get()
.load(app.getSettings().SHOW_WEBVIEW_IMAGES.get() ? .load(app.getSettings().SHOW_IMAGES.get() ?
WikivoyageArticle.getImageUrl(searchRes.getImageTitle(), true) : null) WikivoyageArticle.getImageUrl(searchRes.getImageTitle(), true) : null)
.transform(new CropCircleTransformation()) .transform(new CropCircleTransformation())
.placeholder(placeholder) .placeholder(placeholder)