Transliterate names settings in progress
This commit is contained in:
parent
a2b5439e64
commit
d6721e9c29
4 changed files with 97 additions and 25 deletions
56
OsmAnd/res/layout/language_dialog_title.xml
Normal file
56
OsmAnd/res/layout/language_dialog_title.xml
Normal file
|
@ -0,0 +1,56 @@
|
||||||
|
<?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="match_parent"
|
||||||
|
xmlns:osmand="http://schemas.android.com/apk/res-auto"
|
||||||
|
android:orientation="vertical">
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:paddingLeft="26dp"
|
||||||
|
android:paddingRight="16dp"
|
||||||
|
android:paddingTop="18dp"
|
||||||
|
android:paddingBottom="16dp"
|
||||||
|
android:orientation="vertical">
|
||||||
|
|
||||||
|
<net.osmand.plus.widgets.TextViewEx
|
||||||
|
android:id="@+id/title"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:textColor="?android:attr/textColorPrimary"
|
||||||
|
android:textSize="@dimen/dialog_header_text_size"
|
||||||
|
osmand:typeface="@string/font_roboto_medium"
|
||||||
|
android:text="@string/map_locale"/>
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="16dp"
|
||||||
|
android:orientation="horizontal">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:textColor="?android:attr/textColorPrimary"
|
||||||
|
android:textSize="@dimen/default_list_text_size"
|
||||||
|
android:text="@string/translit_names"/>
|
||||||
|
|
||||||
|
<android.support.v7.widget.SwitchCompat
|
||||||
|
android:id="@+id/check"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"/>
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<View
|
||||||
|
android:id="@+id/divider"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="1dp"
|
||||||
|
android:background="?attr/dashboard_divider"/>
|
||||||
|
|
||||||
|
</LinearLayout>
|
|
@ -9,6 +9,7 @@
|
||||||
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="translit_names">Transliterate names</string>
|
||||||
<string name="edit_filter">Edit filter</string>
|
<string name="edit_filter">Edit filter</string>
|
||||||
<string name="subcategories">Subcategories</string>
|
<string name="subcategories">Subcategories</string>
|
||||||
<string name="selected_categories">Selected categories</string>
|
<string name="selected_categories">Selected categories</string>
|
||||||
|
|
|
@ -889,6 +889,7 @@ public class OsmandSettings {
|
||||||
public static final String TRANSPORT_STOPS_OVER_MAP = "transportStops";
|
public static final String TRANSPORT_STOPS_OVER_MAP = "transportStops";
|
||||||
|
|
||||||
public final OsmandPreference<String> MAP_PREFERRED_LOCALE = new StringPreference("map_preferred_locale", "").makeGlobal().cache();
|
public final OsmandPreference<String> MAP_PREFERRED_LOCALE = new StringPreference("map_preferred_locale", "").makeGlobal().cache();
|
||||||
|
public final OsmandPreference<Boolean> MAP_TRANSLITERATE_NAMES = new BooleanPreference("map_transliterate_names", false).makeGlobal().cache();
|
||||||
|
|
||||||
public boolean usingEnglishNames() {
|
public boolean usingEnglishNames() {
|
||||||
return MAP_PREFERRED_LOCALE.get().equals("en");
|
return MAP_PREFERRED_LOCALE.get().equals("en");
|
||||||
|
|
|
@ -1,17 +1,19 @@
|
||||||
package net.osmand.plus.dialogs;
|
package net.osmand.plus.dialogs;
|
||||||
|
|
||||||
import gnu.trove.list.array.TIntArrayList;
|
import android.content.Context;
|
||||||
|
import android.content.DialogInterface;
|
||||||
import java.util.ArrayList;
|
import android.content.DialogInterface.OnMultiChoiceClickListener;
|
||||||
import java.util.Arrays;
|
import android.content.Intent;
|
||||||
import java.util.Collection;
|
import android.support.annotation.DrawableRes;
|
||||||
import java.util.Collections;
|
import android.support.annotation.StringRes;
|
||||||
import java.util.Comparator;
|
import android.support.v7.app.AlertDialog;
|
||||||
import java.util.HashMap;
|
import android.support.v7.widget.SwitchCompat;
|
||||||
import java.util.Iterator;
|
import android.view.LayoutInflater;
|
||||||
import java.util.List;
|
import android.view.View;
|
||||||
import java.util.Locale;
|
import android.widget.ArrayAdapter;
|
||||||
import java.util.Map;
|
import android.widget.CompoundButton;
|
||||||
|
import android.widget.TextView;
|
||||||
|
import android.widget.Toast;
|
||||||
|
|
||||||
import net.osmand.PlatformUtil;
|
import net.osmand.PlatformUtil;
|
||||||
import net.osmand.core.android.MapRendererContext;
|
import net.osmand.core.android.MapRendererContext;
|
||||||
|
@ -44,17 +46,18 @@ import net.osmand.util.Algorithms;
|
||||||
|
|
||||||
import org.apache.commons.logging.Log;
|
import org.apache.commons.logging.Log;
|
||||||
|
|
||||||
import android.content.Context;
|
import java.util.ArrayList;
|
||||||
import android.content.DialogInterface;
|
import java.util.Arrays;
|
||||||
import android.content.DialogInterface.OnMultiChoiceClickListener;
|
import java.util.Collection;
|
||||||
import android.content.Intent;
|
import java.util.Collections;
|
||||||
import android.support.annotation.DrawableRes;
|
import java.util.Comparator;
|
||||||
import android.support.annotation.StringRes;
|
import java.util.HashMap;
|
||||||
import android.support.v7.app.AlertDialog;
|
import java.util.Iterator;
|
||||||
import android.view.View;
|
import java.util.List;
|
||||||
import android.widget.ArrayAdapter;
|
import java.util.Locale;
|
||||||
import android.widget.CompoundButton;
|
import java.util.Map;
|
||||||
import android.widget.Toast;
|
|
||||||
|
import gnu.trove.list.array.TIntArrayList;
|
||||||
|
|
||||||
public class ConfigureMapMenu {
|
public class ConfigureMapMenu {
|
||||||
private static final Log LOG = PlatformUtil.getLog(ConfigureMapMenu.class);
|
private static final Log LOG = PlatformUtil.getLog(ConfigureMapMenu.class);
|
||||||
|
@ -473,8 +476,19 @@ public class ConfigureMapMenu {
|
||||||
final int pos, boolean isChecked) {
|
final int pos, boolean isChecked) {
|
||||||
final OsmandMapTileView view = activity.getMapView();
|
final OsmandMapTileView view = activity.getMapView();
|
||||||
AlertDialog.Builder b = new AlertDialog.Builder(view.getContext());
|
AlertDialog.Builder b = new AlertDialog.Builder(view.getContext());
|
||||||
// test old descr as title
|
|
||||||
b.setTitle(R.string.map_preferred_locale);
|
View titleView = LayoutInflater.from(activity)
|
||||||
|
.inflate(R.layout.language_dialog_title, null);
|
||||||
|
SwitchCompat check = (SwitchCompat) titleView.findViewById(R.id.check);
|
||||||
|
check.setChecked(view.getSettings().MAP_TRANSLITERATE_NAMES.get());
|
||||||
|
b.setCustomTitle(titleView);
|
||||||
|
check.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
||||||
|
@Override
|
||||||
|
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
|
||||||
|
view.getSettings().MAP_TRANSLITERATE_NAMES.set(isChecked);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
final String[] txtIds = getSortedMapNamesIds(activity, mapNamesIds,
|
final String[] txtIds = getSortedMapNamesIds(activity, mapNamesIds,
|
||||||
getMapNamesValues(activity, mapNamesIds));
|
getMapNamesValues(activity, mapNamesIds));
|
||||||
final String[] txtValues = getMapNamesValues(activity, txtIds);
|
final String[] txtValues = getMapNamesValues(activity, txtIds);
|
||||||
|
|
Loading…
Reference in a new issue