Merge remote-tracking branch 'origin/master'

This commit is contained in:
Weblate 2018-03-30 16:58:29 +02:00
commit 639f8060dd
22 changed files with 106 additions and 48 deletions

View file

@ -0,0 +1,53 @@
body {
display: block;
margin: 5%;
}
h2 {
font-size: 2em;
letter-spacing: 0.05em;
color: #727272;
font-family: serif;
}
h3 {
font-size: 2em;
font-family: sans-serif;
padding-top: 5%;
}
p, li {
font-family: sans-serif;
font-size: 1em;
line-height: 1em;
}
img {
width: 100%;
}
a {
color: #237bff;
text-decoration-color: #a3c8ff;
}
.external-free {
background-color: #f44336;
color: white;
padding: 14px 25px;
text-align: center;
text-decoration: none;
display: inline-block;
}
.thumb-tright, .thumbinner {
width: 100%;
}
.thumbcaption {
width: 100%;
font-size: 1em;
color: #727272;
font-style: italic;
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 KiB

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2 KiB

After

Width:  |  Height:  |  Size: 2.1 KiB

View file

@ -721,6 +721,7 @@ public class OsmandSettings {
public final CommonPreference<Boolean> COORDS_INPUT_USE_RIGHT_SIDE = new BooleanPreference("coords_input_use_right_side", true).makeGlobal();
public final CommonPreference<Integer> COORDS_INPUT_FORMAT = new IntPreference("coords_input_format", CoordinateInputFormats.DD_MM_MMM);
public final CommonPreference<Boolean> COORDS_INPUT_USE_OSMAND_KEYBOARD = new BooleanPreference("coords_input_use_osmand_keyboard", true).makeGlobal();
public final CommonPreference<Boolean> USE_MAPILLARY_FILTER = new BooleanPreference("use_mapillary_filters", false).makeGlobal();
public final CommonPreference<String> MAPILLARY_FILTER_USER_KEY = new StringPreference("mapillary_filter_user_key", "").makeGlobal();

View file

@ -20,39 +20,23 @@ import net.osmand.plus.base.bottomsheetmenu.simpleitems.TitleItem;
import net.osmand.plus.helpers.AndroidUiHelper;
import net.osmand.plus.mapmarkers.CoordinateInputFormats.CoordinateInputFormatDef;
import static net.osmand.plus.mapmarkers.CoordinateInputDialogFragment.USE_OSMAND_KEYBOARD;
public class CoordinateInputBottomSheetDialogFragment extends MenuBottomSheetDialogFragment {
public final static String TAG = "CoordinateInputBottomSheetDialogFragment";
private CoordinateInputFormatChangeListener listener;
private boolean useOsmandKeyboard;
public void setListener(CoordinateInputFormatChangeListener listener) {
this.listener = listener;
}
@Override
public void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
if (savedInstanceState == null) {
Bundle args = getArguments();
if (args != null) {
useOsmandKeyboard = args.getBoolean(USE_OSMAND_KEYBOARD);
}
} else {
useOsmandKeyboard = savedInstanceState.getBoolean(USE_OSMAND_KEYBOARD);
}
}
@Override
public void createMenuItems(Bundle savedInstanceState) {
final Context context = getContext();
final OsmandSettings settings = getMyApplication().getSettings();
items.add(new TitleItem(getString(R.string.shared_string_options)));
boolean useOsmandKeyboard = settings.COORDS_INPUT_USE_OSMAND_KEYBOARD.get();
BaseBottomSheetItem useSystemKeyboardItem = new BottomSheetItemWithCompoundButton.Builder()
.setChecked(!useOsmandKeyboard)
@ -63,7 +47,7 @@ public class CoordinateInputBottomSheetDialogFragment extends MenuBottomSheetDia
@Override
public void onClick(View v) {
if (listener != null) {
listener.onKeyboardChanged(!useOsmandKeyboard);
listener.onKeyboardChanged();
}
dismiss();
}
@ -134,12 +118,6 @@ public class CoordinateInputBottomSheetDialogFragment extends MenuBottomSheetDia
}
}
@Override
public void onSaveInstanceState(Bundle outState) {
outState.putBoolean(USE_OSMAND_KEYBOARD, useOsmandKeyboard);
super.onSaveInstanceState(outState);
}
@Override
protected int getDismissButtonTextId() {
return R.string.shared_string_close;
@ -152,7 +130,7 @@ public class CoordinateInputBottomSheetDialogFragment extends MenuBottomSheetDia
interface CoordinateInputFormatChangeListener {
void onKeyboardChanged(boolean useOsmandKeyboard);
void onKeyboardChanged();
void onHandChanged();

View file

@ -54,6 +54,7 @@ import net.osmand.plus.MapMarkersHelper.MapMarker;
import net.osmand.plus.OsmAndLocationProvider.OsmAndCompassListener;
import net.osmand.plus.OsmAndLocationProvider.OsmAndLocationListener;
import net.osmand.plus.OsmandApplication;
import net.osmand.plus.OsmandSettings;
import net.osmand.plus.R;
import net.osmand.plus.activities.MapActivity;
import net.osmand.plus.base.MapViewTrackingUtilities;
@ -76,8 +77,6 @@ public class CoordinateInputDialogFragment extends DialogFragment implements Osm
public static final String TAG = "CoordinateInputDialogFragment";
public static final String USE_OSMAND_KEYBOARD = "use_osmand_keyboard";
private final List<MapMarker> mapMarkers = new ArrayList<>();
private OnMapMarkersSavedListener listener;
@ -89,7 +88,6 @@ public class CoordinateInputDialogFragment extends DialogFragment implements Osm
private boolean lightTheme;
private boolean orientationPortrait;
private boolean useOsmandKeyboard = true;
private boolean north = true;
private boolean east = true;
@ -170,12 +168,8 @@ public class CoordinateInputDialogFragment extends DialogFragment implements Osm
mainView.findViewById(R.id.options_button).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Bundle args = new Bundle();
args.putBoolean(USE_OSMAND_KEYBOARD, useOsmandKeyboard);
CoordinateInputBottomSheetDialogFragment fragment = new CoordinateInputBottomSheetDialogFragment();
fragment.setUsedOnMap(false);
fragment.setArguments(args);
fragment.setListener(createCoordinateInputFormatChangeListener());
fragment.show(getChildFragmentManager(), CoordinateInputBottomSheetDialogFragment.TAG);
}
@ -253,8 +247,8 @@ public class CoordinateInputDialogFragment extends DialogFragment implements Osm
pointNameKeyboardBtn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
if (useOsmandKeyboard) {
changeKeyboard(false);
if (isOsmandKeyboardOn()) {
changeKeyboard();
}
}
});
@ -294,7 +288,7 @@ public class CoordinateInputDialogFragment extends DialogFragment implements Osm
View.OnClickListener onClickListener = new View.OnClickListener() {
@Override
public void onClick(View v) {
if (useOsmandKeyboard) {
if (isOsmandKeyboardOn()) {
View focusedView = getDialog().getCurrentFocus();
if (focusedView != null && focusedView instanceof EditText) {
EditText focusedEditText = (EditText) focusedView;
@ -340,7 +334,7 @@ public class CoordinateInputDialogFragment extends DialogFragment implements Osm
R.id.keyboard_item_next_field,
R.id.keyboard_item_backspace);
if (!useOsmandKeyboard && isOsmandKeyboardCurrentlyVisible()) {
if (!isOsmandKeyboardOn() && isOsmandKeyboardCurrentlyVisible()) {
changeOsmandKeyboardVisibility(false);
}
@ -349,8 +343,8 @@ public class CoordinateInputDialogFragment extends DialogFragment implements Osm
@Override
public void onClick(View view) {
boolean isCurrentlyVisible = isOsmandKeyboardCurrentlyVisible();
if (!isCurrentlyVisible && !useOsmandKeyboard) {
changeKeyboard(true);
if (!isCurrentlyVisible && !isOsmandKeyboardOn()) {
changeKeyboard();
} else {
changeOsmandKeyboardVisibility(!isCurrentlyVisible);
}
@ -589,7 +583,7 @@ public class CoordinateInputDialogFragment extends DialogFragment implements Osm
View.OnTouchListener inputEditTextOnTouchListener = new View.OnTouchListener() {
@Override
public boolean onTouch(View view, MotionEvent motionEvent) {
if (useOsmandKeyboard) {
if (isOsmandKeyboardOn()) {
if (!isOsmandKeyboardCurrentlyVisible()) {
changeOsmandKeyboardVisibility(true);
}
@ -615,7 +609,7 @@ public class CoordinateInputDialogFragment extends DialogFragment implements Osm
View.OnLongClickListener inputEditTextOnLongClickListener = new View.OnLongClickListener() {
@Override
public boolean onLongClick(final View view) {
if (useOsmandKeyboard) {
if (isOsmandKeyboardOn()) {
final EditText inputEditText = (EditText) view;
PopupMenu popupMenu = new PopupMenu(getContext(), inputEditText);
Menu menu = popupMenu.getMenu();
@ -738,8 +732,18 @@ public class CoordinateInputDialogFragment extends DialogFragment implements Osm
return sb.toString();
}
private void changeKeyboard(boolean useOsmandKeyboard) {
this.useOsmandKeyboard = useOsmandKeyboard;
private boolean isOsmandKeyboardOn() {
return getMyApplication().getSettings().COORDS_INPUT_USE_OSMAND_KEYBOARD.get();
}
private void changeOsmandKeyboardSetting() {
OsmandSettings.OsmandPreference<Boolean> pref = getMyApplication().getSettings().COORDS_INPUT_USE_OSMAND_KEYBOARD;
pref.set(!pref.get());
}
private void changeKeyboard() {
changeOsmandKeyboardSetting();
boolean useOsmandKeyboard = isOsmandKeyboardOn();
changeOsmandKeyboardVisibility(useOsmandKeyboard);
final View focusedView = getDialog().getCurrentFocus();
if (focusedView != null) {
@ -761,8 +765,8 @@ public class CoordinateInputDialogFragment extends DialogFragment implements Osm
return new CoordinateInputFormatChangeListener() {
@Override
public void onKeyboardChanged(boolean useOsmandKeyboard) {
changeKeyboard(useOsmandKeyboard);
public void onKeyboardChanged() {
changeKeyboard();
}
@Override

View file

@ -20,10 +20,13 @@ import android.webkit.WebView;
import android.widget.TextView;
import net.osmand.AndroidUtils;
import net.osmand.IndexConstants;
import net.osmand.plus.R;
import net.osmand.plus.wikivoyage.data.WikivoyageArticle;
import net.osmand.plus.wikivoyage.data.WikivoyageSearchResult;
import java.io.File;
public class WikivoyageArticleDialogFragment extends WikivoyageBaseDialogFragment {
public static final String TAG = "WikivoyageArticleDialogFragment";
@ -31,6 +34,14 @@ public class WikivoyageArticleDialogFragment extends WikivoyageBaseDialogFragmen
private static final String SEARCH_RESULT_KEY = "search_result_key";
private static final String SELECTED_LANG_KEY = "selected_lang_key";
private static final String HEADER_INNER = "<html><head>\n" +
"<meta name=\"viewport\" content=\"width=device-width, initial-scale=1\" />\n" +
"<meta http-equiv=\"cleartype\" content=\"on\" />\n" +
"<link href=\"article_style.css\" type=\"text/css\" rel=\"stylesheet\"/>\n" +
"</head><body>\n" +
"<div class=\"main\">\n";
private static final String FOOTER_INNER = "</div></body></html>";
private WikivoyageSearchResult searchResult;
private String selectedLang;
@ -143,9 +154,20 @@ public class WikivoyageArticleDialogFragment extends WikivoyageBaseDialogFragmen
return;
}
contentWebView.loadData(article.getContent(), "text/html", "UTF-8");
String content = HEADER_INNER + article.getContent() + FOOTER_INNER;
contentWebView.loadDataWithBaseURL(getBaseUrl(), content, "text/html", "UTF-8", null);
}
@NonNull
private String getBaseUrl() {
File wikivoyageDir = getMyApplication().getAppPath(IndexConstants.WIKIVOYAGE_INDEX_DIR);
if (new File(wikivoyageDir, "article_style.css").exists()) {
return "file://" + wikivoyageDir.getAbsolutePath() + "/";
}
return "file:///android_asset/";
}
@NonNull
private Drawable getSelectedLangIcon() {
Drawable normal = getContentIcon(R.drawable.ic_action_map_language);
if (Build.VERSION.SDK_INT >= 21) {

View file

@ -82,21 +82,21 @@ public class WikivoyageDbHelper {
SQLiteConnection conn = openConnection();
if (conn != null) {
try {
String dbQuery = SEARCH_TABLE_SELECT + " WHERE " + SEARCH_COL_SEARCH_TERM + " LIKE ?";
String dbQuery = SEARCH_TABLE_SELECT + " WHERE " + SEARCH_COL_CITY_ID +
" IN (SELECT " + SEARCH_COL_CITY_ID + " FROM " + SEARCH_TABLE_NAME +
" WHERE " + SEARCH_COL_SEARCH_TERM + " LIKE ?)";
SQLiteCursor cursor = conn.rawQuery(dbQuery, new String[]{searchQuery + "%"});
if (cursor.moveToFirst()) {
do {
res.add(readSearchResult(cursor));
} while (cursor.moveToNext());
}
cursor.close();
} finally {
conn.close();
}
}
List<WikivoyageSearchResult> list = new ArrayList<>(groupSearchResultsByCityId(res));
Collections.sort(list, new Comparator<WikivoyageSearchResult>() {
@Override
public int compare(WikivoyageSearchResult o1, WikivoyageSearchResult o2) {