Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
84307f52ca
13 changed files with 350 additions and 62 deletions
|
@ -0,0 +1,52 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:osmand="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/description"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:ellipsize="end"
|
||||
android:maxLines="3"
|
||||
android:paddingLeft="@dimen/content_padding"
|
||||
android:paddingRight="@dimen/content_padding"
|
||||
android:textColor="?android:textColorSecondary"
|
||||
android:textSize="@dimen/default_desc_text_size"
|
||||
tools:text="@string/default_render_descr"/>
|
||||
|
||||
<FrameLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="@dimen/context_menu_buttons_padding_bottom"
|
||||
android:layout_marginLeft="@dimen/bottom_sheet_content_padding_small"
|
||||
android:layout_marginStart="@dimen/bottom_sheet_content_padding_small"
|
||||
android:layout_marginTop="@dimen/bottom_sheet_content_padding_small"
|
||||
android:background="@drawable/rounded_background_3dp">
|
||||
|
||||
<net.osmand.plus.widgets.TextViewEx
|
||||
android:id="@+id/text_button"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?android:attr/selectableItemBackgroundBorderless"
|
||||
android:ellipsize="end"
|
||||
android:gravity="center_vertical"
|
||||
android:letterSpacing="@dimen/text_button_letter_spacing"
|
||||
android:maxLines="1"
|
||||
android:paddingBottom="@dimen/context_menu_padding_margin_tiny"
|
||||
android:paddingLeft="@dimen/bottom_sheet_content_padding_small"
|
||||
android:paddingRight="@dimen/bottom_sheet_content_padding_small"
|
||||
android:paddingTop="@dimen/context_menu_padding_margin_tiny"
|
||||
android:textColor="?attr/color_dialog_buttons"
|
||||
android:textSize="@dimen/text_button_text_size"
|
||||
osmand:typeface="@string/font_roboto_medium"
|
||||
tools:ignore="NewApi,UnusedAttribute"
|
||||
tools:text="Show full description"/>
|
||||
|
||||
</FrameLayout>
|
||||
|
||||
</LinearLayout>
|
36
OsmAnd/res/layout/bottom_sheet_item_with_radio_btn_left.xml
Normal file
36
OsmAnd/res/layout/bottom_sheet_item_with_radio_btn_left.xml
Normal file
|
@ -0,0 +1,36 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/bottom_sheet_list_item_height"
|
||||
android:background="?android:attr/selectableItemBackground"
|
||||
android:gravity="center_vertical"
|
||||
android:minHeight="@dimen/bottom_sheet_list_item_height"
|
||||
android:paddingLeft="@dimen/content_padding"
|
||||
android:paddingRight="@dimen/content_padding">
|
||||
|
||||
<RadioButton
|
||||
android:id="@+id/compound_button"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="@dimen/bottom_sheet_icon_margin"
|
||||
android:layout_marginRight="@dimen/bottom_sheet_icon_margin"
|
||||
android:background="@null"
|
||||
android:clickable="false"
|
||||
android:focusable="false"
|
||||
android:saveEnabled="false"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/title"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="@dimen/content_padding"
|
||||
android:layout_marginRight="@dimen/content_padding"
|
||||
android:layout_weight="1"
|
||||
android:ellipsize="end"
|
||||
android:maxLines="1"
|
||||
android:textAppearance="@style/TextAppearance.ListItemTitle"
|
||||
tools:text="OsmAnd"/>
|
||||
|
||||
</LinearLayout>
|
|
@ -9,6 +9,14 @@
|
|||
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
|
||||
-->
|
||||
<string name="hide_full_description">Hide full description</string>
|
||||
<string name="show_full_description">Show full description</string>
|
||||
<string name="nautical_render_descr">Style for marine and river navigation. Key features: buoys, lighthouses, water navigation lines and marks, harbours, seamark services, depth contours.</string>
|
||||
<string name="ski_map_render_descr">Style for skiing. Key features: renders pistes, aerial ways and other ski features in a convenient way. Less distracting secondary map objects.</string>
|
||||
<string name="light_rs_render_descr">Simple and contrast style for car navigation. Gentle for the eyes in the night mode. Key features: contour lines, contrast orange styled roads, less distracting secondary map objects.</string>
|
||||
<string name="topo_render_descr">Contrast style designed primarily for nature hiking, trekking and cycling. Good readability in complex external lighting. Key features: contrast roads and natural objects, different types of routes, contour lines with advanced settings, more details at corresponding zoom levels than "default" style. "Surface integrity" option allows you distinguish between roads with different surface quality. No night mode.</string>
|
||||
<string name="mapnik_render_descr">Old mapnik-style default rendering style. Key features: colours are similar to Mapnik style.</string>
|
||||
<string name="default_render_descr">General purpose style. Simplified rendering to have cleaner maps in the populated cities. Key features: contour lines, routes, surface quality, access restrictions, road shields, paths rendering according to SAC scale, whitewater sports features.</string>
|
||||
<string name="open_wikipedia_link_online">Open wikipedia link online</string>
|
||||
<string name="open_wikipedia_link_online_description">OsmAnd will redirect you to the browser and open the link online.</string>
|
||||
<string name="read_wikipedia_offline_description">Get OsmAnd Live subscription to read Wikipedia and Wikivoyage articles offline.</string>
|
||||
|
|
|
@ -163,6 +163,10 @@ public class AndroidUtils {
|
|||
return null;
|
||||
}
|
||||
|
||||
public static ColorStateList createCheckedColorStateList(Context ctx, @ColorRes int normal, @ColorRes int checked) {
|
||||
return createCheckedColorStateList(ctx, false, normal, checked, 0, 0);
|
||||
}
|
||||
|
||||
public static ColorStateList createCheckedColorStateList(Context ctx, boolean night,
|
||||
@ColorRes int lightNormal, @ColorRes int lightChecked,
|
||||
@ColorRes int darkNormal, @ColorRes int darkChecked) {
|
||||
|
|
|
@ -39,6 +39,8 @@ public abstract class MenuBottomSheetDialogFragment extends BottomSheetDialogFra
|
|||
protected boolean usedOnMap = true;
|
||||
protected boolean nightMode;
|
||||
|
||||
protected int themeRes;
|
||||
|
||||
private LinearLayout itemsContainer;
|
||||
|
||||
public void setUsedOnMap(boolean usedOnMap) {
|
||||
|
@ -52,6 +54,7 @@ public abstract class MenuBottomSheetDialogFragment extends BottomSheetDialogFra
|
|||
usedOnMap = savedInstanceState.getBoolean(USED_ON_MAP_KEY);
|
||||
}
|
||||
nightMode = isNightMode();
|
||||
themeRes = nightMode ? R.style.OsmandDarkTheme : R.style.OsmandLightTheme;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
|
@ -60,7 +63,6 @@ public abstract class MenuBottomSheetDialogFragment extends BottomSheetDialogFra
|
|||
createMenuItems(savedInstanceState);
|
||||
|
||||
OsmandApplication app = getMyApplication();
|
||||
final int themeRes = nightMode ? R.style.OsmandDarkTheme : R.style.OsmandLightTheme;
|
||||
|
||||
View mainView = View.inflate(new ContextThemeWrapper(app, themeRes), R.layout.bottom_sheet_menu_base, null);
|
||||
if (useScrollableItemsContainer()) {
|
||||
|
@ -146,7 +148,12 @@ public abstract class MenuBottomSheetDialogFragment extends BottomSheetDialogFra
|
|||
}
|
||||
|
||||
protected Drawable getActiveIcon(@DrawableRes int id) {
|
||||
return getIcon(id, nightMode ? R.color.osmand_orange : R.color.color_myloc_distance);
|
||||
return getIcon(id, getActiveColorId());
|
||||
}
|
||||
|
||||
@ColorRes
|
||||
protected int getActiveColorId() {
|
||||
return nightMode ? R.color.osmand_orange : R.color.color_myloc_distance;
|
||||
}
|
||||
|
||||
@ColorInt
|
||||
|
|
|
@ -97,7 +97,7 @@ public class BottomSheetItemTitleWithDescrAndButton extends BottomSheetItemWithD
|
|||
return this;
|
||||
}
|
||||
|
||||
public BottomSheetItemTitleWithDescrAndButton.Builder setonButtonClickListener(View.OnClickListener onButtonClickListener) {
|
||||
public BottomSheetItemTitleWithDescrAndButton.Builder setOnButtonClickListener(View.OnClickListener onButtonClickListener) {
|
||||
this.onButtonClickListener = onButtonClickListener;
|
||||
return this;
|
||||
}
|
||||
|
|
|
@ -22,7 +22,6 @@ import android.widget.ImageView;
|
|||
import android.widget.ListView;
|
||||
import android.widget.Spinner;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import net.osmand.AndroidUtils;
|
||||
import net.osmand.PlatformUtil;
|
||||
|
@ -43,7 +42,6 @@ import net.osmand.plus.activities.MapActivityLayers;
|
|||
import net.osmand.plus.activities.PluginActivity;
|
||||
import net.osmand.plus.activities.SettingsActivity;
|
||||
import net.osmand.plus.inapp.InAppPurchaseHelper;
|
||||
import net.osmand.plus.openseamapsplugin.NauticalMapsPlugin;
|
||||
import net.osmand.plus.poi.PoiFiltersHelper;
|
||||
import net.osmand.plus.rastermaps.OsmandRasterMapsPlugin;
|
||||
import net.osmand.plus.render.RendererRegistry;
|
||||
|
@ -500,53 +498,8 @@ public class ConfigureMapMenu {
|
|||
@Override
|
||||
public boolean onContextMenuClick(final ArrayAdapter<ContextMenuItem> ad, int itemId,
|
||||
final int pos, boolean isChecked, int[] viewCoordinates) {
|
||||
AlertDialog.Builder bld = new AlertDialog.Builder(activity);
|
||||
bld.setTitle(R.string.renderers);
|
||||
final OsmandApplication app = activity.getMyApplication();
|
||||
final ArrayList<String> items = new ArrayList<>(app.getRendererRegistry().getRendererNames());
|
||||
boolean nauticalPluginDisabled = OsmandPlugin.getEnabledPlugin(NauticalMapsPlugin.class) == null;
|
||||
final List<String> visibleNamesList = new ArrayList<>();
|
||||
int selected = -1;
|
||||
final String selectedName = app.getRendererRegistry().getCurrentSelectedRenderer().getName();
|
||||
int i = 0;
|
||||
Iterator<String> iterator = items.iterator();
|
||||
while (iterator.hasNext()) {
|
||||
String item = iterator.next();
|
||||
if (nauticalPluginDisabled && item.equals(RendererRegistry.NAUTICAL_RENDER)) {
|
||||
iterator.remove();
|
||||
} else {
|
||||
if (item.equals(selectedName)) {
|
||||
selected = i;
|
||||
}
|
||||
String translation = RendererRegistry.getTranslatedRendererName(activity, item);
|
||||
visibleNamesList.add(translation != null ? translation
|
||||
: item.replace('_', ' ').replace('-', ' '));
|
||||
i++;
|
||||
}
|
||||
}
|
||||
|
||||
bld.setSingleChoiceItems(visibleNamesList.toArray(new String[visibleNamesList.size()]), selected, new DialogInterface.OnClickListener() {
|
||||
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
String renderer = items.get(which);
|
||||
RenderingRulesStorage loaded = app.getRendererRegistry().getRenderer(renderer);
|
||||
if (loaded != null) {
|
||||
OsmandMapTileView view = activity.getMapView();
|
||||
view.getSettings().RENDERER.set(renderer);
|
||||
app.getRendererRegistry().setCurrentSelectedRender(loaded);
|
||||
refreshMapComplete(activity);
|
||||
} else {
|
||||
Toast.makeText(app, R.string.renderer_load_exception, Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
adapter.getItem(pos).setDescription(getRenderDescr(activity));
|
||||
activity.getDashboard().refreshContent(true);
|
||||
dialog.dismiss();
|
||||
}
|
||||
|
||||
});
|
||||
bld.setNegativeButton(R.string.shared_string_dismiss, null);
|
||||
bld.show();
|
||||
new SelectMapStyleBottomSheetDialogFragment().show(activity.getSupportFragmentManager(),
|
||||
SelectMapStyleBottomSheetDialogFragment.TAG);
|
||||
return false;
|
||||
}
|
||||
}).createItem());
|
||||
|
|
|
@ -0,0 +1,210 @@
|
|||
package net.osmand.plus.dialogs;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.content.res.ColorStateList;
|
||||
import android.os.Bundle;
|
||||
import android.support.annotation.ColorInt;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.support.v4.widget.CompoundButtonCompat;
|
||||
import android.support.v4.widget.NestedScrollView;
|
||||
import android.view.ContextThemeWrapper;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.LinearLayout.LayoutParams;
|
||||
import android.widget.RadioButton;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import net.osmand.AndroidUtils;
|
||||
import net.osmand.plus.OsmandApplication;
|
||||
import net.osmand.plus.OsmandPlugin;
|
||||
import net.osmand.plus.R;
|
||||
import net.osmand.plus.activities.MapActivity;
|
||||
import net.osmand.plus.base.MenuBottomSheetDialogFragment;
|
||||
import net.osmand.plus.base.bottomsheetmenu.BaseBottomSheetItem;
|
||||
import net.osmand.plus.base.bottomsheetmenu.BottomSheetItemTitleWithDescrAndButton;
|
||||
import net.osmand.plus.base.bottomsheetmenu.simpleitems.SubtitleDividerItem;
|
||||
import net.osmand.plus.base.bottomsheetmenu.simpleitems.TitleItem;
|
||||
import net.osmand.plus.openseamapsplugin.NauticalMapsPlugin;
|
||||
import net.osmand.plus.render.RendererRegistry;
|
||||
import net.osmand.plus.views.OsmandMapTileView;
|
||||
import net.osmand.render.RenderingRulesStorage;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class SelectMapStyleBottomSheetDialogFragment extends MenuBottomSheetDialogFragment {
|
||||
|
||||
public static final String TAG = SelectMapStyleBottomSheetDialogFragment.class.getSimpleName();
|
||||
|
||||
private static final String SELECTED_STYLE_KEY = "selected_style";
|
||||
private static final int COLLAPSED_DESCRIPTION_LINES = 3;
|
||||
|
||||
private boolean descriptionExpanded;
|
||||
|
||||
private LinearLayout stylesContainer;
|
||||
private BottomSheetItemTitleWithDescrAndButton descrItem;
|
||||
private View.OnClickListener onStyleClickListener;
|
||||
private ColorStateList rbColorList;
|
||||
|
||||
private List<String> styles;
|
||||
private String selectedStyle;
|
||||
|
||||
@Override
|
||||
public void createMenuItems(Bundle savedInstanceState) {
|
||||
final Context context = getContext();
|
||||
if (context == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
RendererRegistry rendererRegistry = getMyApplication().getRendererRegistry();
|
||||
styles = new ArrayList<>(rendererRegistry.getRendererNames());
|
||||
if (OsmandPlugin.getEnabledPlugin(NauticalMapsPlugin.class) == null) {
|
||||
styles.remove(RendererRegistry.NAUTICAL_RENDER);
|
||||
}
|
||||
if (savedInstanceState == null) {
|
||||
selectedStyle = rendererRegistry.getCurrentSelectedRenderer().getName();
|
||||
} else {
|
||||
selectedStyle = savedInstanceState.getString(SELECTED_STYLE_KEY);
|
||||
}
|
||||
|
||||
rbColorList = AndroidUtils.createCheckedColorStateList(context, R.color.icon_color, getActiveColorId());
|
||||
|
||||
items.add(new TitleItem(getString(R.string.map_widget_renderer)));
|
||||
|
||||
descrItem = (BottomSheetItemTitleWithDescrAndButton) new BottomSheetItemTitleWithDescrAndButton.Builder()
|
||||
.setButtonTitle(getString(R.string.show_full_description))
|
||||
.setOnButtonClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
descriptionExpanded = !descriptionExpanded;
|
||||
descrItem.setButtonText(getString(descriptionExpanded
|
||||
? R.string.hide_full_description : R.string.show_full_description));
|
||||
descrItem.setDescriptionMaxLines(descriptionExpanded
|
||||
? Integer.MAX_VALUE : COLLAPSED_DESCRIPTION_LINES);
|
||||
}
|
||||
})
|
||||
.setDescription(RendererRegistry.getRendererDescription(context, selectedStyle))
|
||||
.setDescriptionMaxLines(COLLAPSED_DESCRIPTION_LINES)
|
||||
.setLayoutId(R.layout.bottom_sheet_item_with_expandable_descr)
|
||||
.create();
|
||||
items.add(descrItem);
|
||||
|
||||
items.add(new SubtitleDividerItem(context));
|
||||
|
||||
NestedScrollView nestedScrollView = new NestedScrollView(context);
|
||||
stylesContainer = new LinearLayout(context);
|
||||
stylesContainer.setLayoutParams((new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT)));
|
||||
stylesContainer.setOrientation(LinearLayout.VERTICAL);
|
||||
stylesContainer.setPadding(0, getResources().getDimensionPixelSize(R.dimen.bottom_sheet_content_padding_small), 0, 0);
|
||||
for (int i = 0; i < styles.size(); i++) {
|
||||
LayoutInflater.from(new ContextThemeWrapper(context, themeRes))
|
||||
.inflate(R.layout.bottom_sheet_item_with_radio_btn_left, stylesContainer, true);
|
||||
}
|
||||
nestedScrollView.addView(stylesContainer);
|
||||
items.add(new BaseBottomSheetItem.Builder().setCustomView(nestedScrollView).create());
|
||||
|
||||
populateStylesList();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSaveInstanceState(Bundle outState) {
|
||||
super.onSaveInstanceState(outState);
|
||||
outState.putString(SELECTED_STYLE_KEY, selectedStyle);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getRightBottomButtonTextId() {
|
||||
return R.string.shared_string_apply;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onRightBottomButtonClick() {
|
||||
MapActivity mapActivity = getMapActivity();
|
||||
if (mapActivity == null) {
|
||||
return;
|
||||
}
|
||||
OsmandApplication app = getMyApplication();
|
||||
RenderingRulesStorage loaded = app.getRendererRegistry().getRenderer(selectedStyle);
|
||||
if (loaded != null) {
|
||||
OsmandMapTileView view = mapActivity.getMapView();
|
||||
view.getSettings().RENDERER.set(selectedStyle);
|
||||
app.getRendererRegistry().setCurrentSelectedRender(loaded);
|
||||
ConfigureMapMenu.refreshMapComplete(mapActivity);
|
||||
mapActivity.getDashboard().refreshContent(true);
|
||||
} else {
|
||||
Toast.makeText(mapActivity, R.string.renderer_load_exception, Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
dismiss();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean useScrollableItemsContainer() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
private MapActivity getMapActivity() {
|
||||
Activity activity = getActivity();
|
||||
if (activity != null && activity instanceof MapActivity) {
|
||||
return (MapActivity) activity;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@SuppressWarnings("RedundantCast")
|
||||
private void populateStylesList() {
|
||||
Context context = getContext();
|
||||
if (context == null) {
|
||||
return;
|
||||
}
|
||||
for (int i = 0; i < styles.size(); i++) {
|
||||
String style = styles.get(i);
|
||||
boolean selected = style.equals(selectedStyle);
|
||||
String title = RendererRegistry.getTranslatedRendererName(context, style);
|
||||
if (title == null) {
|
||||
title = style.replace('_', ' ').replace('-', ' ');
|
||||
}
|
||||
|
||||
View view = stylesContainer.getChildAt(i);
|
||||
view.setTag(style);
|
||||
view.setOnClickListener(getOnStyleClickListener());
|
||||
|
||||
TextView titleTv = (TextView) view.findViewById(R.id.title);
|
||||
titleTv.setText(title);
|
||||
titleTv.setTextColor(getStyleTitleColor(selected));
|
||||
|
||||
RadioButton rb = (RadioButton) view.findViewById(R.id.compound_button);
|
||||
rb.setChecked(selected);
|
||||
CompoundButtonCompat.setButtonTintList(rb, rbColorList);
|
||||
}
|
||||
}
|
||||
|
||||
@ColorInt
|
||||
private int getStyleTitleColor(boolean selected) {
|
||||
int colorId = selected
|
||||
? getActiveColorId()
|
||||
: nightMode ? R.color.primary_text_dark : R.color.primary_text_light;
|
||||
return getResolvedColor(colorId);
|
||||
}
|
||||
|
||||
private View.OnClickListener getOnStyleClickListener() {
|
||||
if (onStyleClickListener == null) {
|
||||
onStyleClickListener = new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
Context context = getContext();
|
||||
if (context == null) {
|
||||
return;
|
||||
}
|
||||
selectedStyle = (String) v.getTag();
|
||||
descrItem.setDescription(RendererRegistry.getRendererDescription(context, selectedStyle));
|
||||
populateStylesList();
|
||||
}
|
||||
};
|
||||
}
|
||||
return onStyleClickListener;
|
||||
}
|
||||
}
|
|
@ -76,7 +76,7 @@ public class FavouritesBottomSheetMenuFragment extends MenuBottomSheetDialogFrag
|
|||
title[0] = (BottomSheetItemTitleWithDescrAndButton) new BottomSheetItemTitleWithDescrAndButton.Builder()
|
||||
.setButtonIcons(null, getIconForButton())
|
||||
.setButtonTitle(getTextForButton(sortByDist))
|
||||
.setonButtonClickListener(new View.OnClickListener() {
|
||||
.setOnButtonClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
sortFavourites();
|
||||
|
|
|
@ -4,7 +4,6 @@ import android.content.Context;
|
|||
import android.content.res.ColorStateList;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.os.Bundle;
|
||||
import android.support.annotation.ColorRes;
|
||||
import android.view.View;
|
||||
|
||||
import net.osmand.plus.OsmandSettings;
|
||||
|
@ -142,11 +141,6 @@ public class CoordinateInputBottomSheetDialogFragment extends MenuBottomSheetDia
|
|||
return R.string.shared_string_close;
|
||||
}
|
||||
|
||||
@ColorRes
|
||||
private int getActiveColorId() {
|
||||
return nightMode ? R.color.osmand_orange : R.color.color_myloc_distance;
|
||||
}
|
||||
|
||||
interface CoordinateInputFormatChangeListener {
|
||||
|
||||
void onKeyboardChanged();
|
||||
|
|
|
@ -284,6 +284,25 @@ public class RendererRegistry {
|
|||
return null;
|
||||
}
|
||||
|
||||
@NonNull
|
||||
public static String getRendererDescription(@NonNull Context ctx, @NonNull String key) {
|
||||
switch (key) {
|
||||
case DEFAULT_RENDER:
|
||||
return ctx.getString(R.string.default_render_descr);
|
||||
case MAPNIK_RENDER:
|
||||
return ctx.getString(R.string.mapnik_render_descr);
|
||||
case TOPO_RENDER:
|
||||
return ctx.getString(R.string.topo_render_descr);
|
||||
case LIGHTRS_RENDER:
|
||||
return ctx.getString(R.string.light_rs_render_descr);
|
||||
case WINTER_SKI_RENDER:
|
||||
return ctx.getString(R.string.ski_map_render_descr);
|
||||
case NAUTICAL_RENDER:
|
||||
return ctx.getString(R.string.nautical_render_descr);
|
||||
}
|
||||
return "No description provided"; // FIXME
|
||||
}
|
||||
|
||||
public RenderingRulesStorage getCurrentSelectedRenderer() {
|
||||
if(currentSelectedRender == null){
|
||||
return defaultRender();
|
||||
|
|
|
@ -133,7 +133,7 @@ public class ExploreTabFragment extends BaseOsmAndFragment implements DownloadIn
|
|||
}
|
||||
}
|
||||
}
|
||||
items.add(new StartEditingTravelCard(app, nightMode));
|
||||
items.add(new StartEditingTravelCard(app, getMyActivity(), nightMode));
|
||||
adapter.setItems(items);
|
||||
|
||||
final DownloadIndexesThread downloadThread = app.getDownloadThread();
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
package net.osmand.plus.wikivoyage.explore.travelcards;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.net.Uri;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.customtabs.CustomTabsIntent;
|
||||
|
@ -16,8 +18,11 @@ public class StartEditingTravelCard extends BaseTravelCard {
|
|||
|
||||
public static final int TYPE = 1;
|
||||
|
||||
public StartEditingTravelCard(OsmandApplication app, boolean nightMode) {
|
||||
private Context context;
|
||||
|
||||
public StartEditingTravelCard(OsmandApplication app, Activity context, boolean nightMode) {
|
||||
super(app, nightMode);
|
||||
this.context = context;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -35,7 +40,7 @@ public class StartEditingTravelCard extends BaseTravelCard {
|
|||
.setToolbarColor(ContextCompat.getColor(app, nightMode ? R.color.actionbar_dark_color : R.color.actionbar_light_color))
|
||||
.build();
|
||||
String text = "https://" + app.getLanguage().toLowerCase() + ".m.wikivoyage.org";
|
||||
customTabsIntent.launchUrl(app, Uri.parse(text));
|
||||
customTabsIntent.launchUrl(context, Uri.parse(text));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue