Merge branch 'master' of https://github.com/osmandapp/Osmand
This commit is contained in:
commit
9b41eec0b0
15 changed files with 132 additions and 199 deletions
|
@ -39,8 +39,7 @@ android {
|
|||
|
||||
defaultConfig {
|
||||
minSdkVersion System.getenv("MIN_SDK_VERSION") ? System.getenv("MIN_SDK_VERSION").toInteger() : 14
|
||||
targetSdkVersion 21
|
||||
|
||||
targetSdkVersion 23
|
||||
versionCode System.getenv("APK_NUMBER_VERSION") ? System.getenv("APK_NUMBER_VERSION").toInteger() : versionCode
|
||||
//versionName already assigned in code
|
||||
//versionName System.getenv("APK_VERSION")? System.getenv("APK_VERSION").toString(): versionName
|
||||
|
@ -184,6 +183,24 @@ task updateNoTranslate(type: Copy) {
|
|||
into 'res/values/'
|
||||
}
|
||||
|
||||
task validateTranslate {
|
||||
println "Validating translations"
|
||||
|
||||
new java.io.File("res").eachFileRecurse groovy.io.FileType.FILES, {
|
||||
if(it.name == "strings.xml" || it.name == "phrases.xml") {
|
||||
it.eachLine { line ->
|
||||
if( line.contains("\$ s") || line.contains("\$ d") || line.contains("\$ f") ||
|
||||
line.contains(" \$s") || line.contains(" \$d") || line.contains(" \$f") ||
|
||||
line.contains("1\$ ") || line.contains("2\$ ") || line.contains("3\$ ") ||
|
||||
(line.contains("% \$") || line.contains("% 1") ||
|
||||
line.contains("% 2") || line.contains("% 3") )) {
|
||||
throw new GradleException("Incorrect translation " + it.getAbsolutePath() + " " + line);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
task collectVoiceAssets(type: Sync) {
|
||||
from "../../resources/voice"
|
||||
into "assets/voice"
|
||||
|
@ -265,7 +282,8 @@ collectExternalResources.dependsOn collectVoiceAssets,
|
|||
collectRegionsInfoResources,
|
||||
collectMiscResources,
|
||||
copyStyleIcons,
|
||||
updateNoTranslate
|
||||
updateNoTranslate,
|
||||
validateTranslate
|
||||
// tasks.whenTaskAdded { task ->
|
||||
// if (task.name.startsWith("generate") && task.name.endsWith("Resources")) {
|
||||
// task.dependsOn collectExternalResources
|
||||
|
@ -321,10 +339,10 @@ repositories {
|
|||
}
|
||||
|
||||
dependencies {
|
||||
compile project(path: ":OsmAnd-java", configuration: "android")
|
||||
compile project(":eclipse-compile:design")
|
||||
compile project(":eclipse-compile:cardview")
|
||||
// compile project(":eclipse-compile:recyclerview")
|
||||
compile project(path: ':OsmAnd-java', configuration: 'android')
|
||||
compile project(':eclipse-compile:design')
|
||||
compile project(':eclipse-compile:cardview')
|
||||
// compile project(":eclipse-compile:recyclerview")
|
||||
compile fileTree(
|
||||
dir: "libs",
|
||||
include: ["*.jar"],
|
||||
|
@ -342,5 +360,5 @@ dependencies {
|
|||
qtcoredebugCompile "net.osmand:OsmAndCore_android:0.1-SNAPSHOT@aar"
|
||||
qtcoreCompile "net.osmand:OsmAndCore_androidNativeRelease:0.1-SNAPSHOT@aar"
|
||||
qtcoreCompile "net.osmand:OsmAndCore_android:0.1-SNAPSHOT@aar"
|
||||
|
||||
compile files('libs/android-support-multidex.jar')
|
||||
}
|
||||
|
|
BIN
OsmAnd/libs/android-support-multidex.jar
Normal file
BIN
OsmAnd/libs/android-support-multidex.jar
Normal file
Binary file not shown.
|
@ -1,7 +1,7 @@
|
|||
<?xml version="1.0" encoding="utf-8" standalone="no"?>
|
||||
<resources>
|
||||
<string name="app_name">OsmAnd~</string>
|
||||
<string name="app_version">2.2.0</string>
|
||||
<string name="app_version">2.3.0</string>
|
||||
<!--
|
||||
Note: For our dev build apk's, the above "app_version" is provided (via osmand/build.xml) as the base version prefix to our build number in the format:
|
||||
X.X.X#YYYYZ , where
|
||||
|
@ -15,25 +15,7 @@
|
|||
<string name="ga_dispatchPeriod">10</string>
|
||||
<string name="ga_debug">true</string>
|
||||
<string name="versionFeatures">+play_market -amazon -blackberry</string>
|
||||
<string name="next_tips_and_tricks_not_translate"></string>
|
||||
<string name="openstreetmap_copyright"><a href="http://www.openstreetmap.org/copyright">© OpenStreetMap</a></string>
|
||||
<string name="about_content">Data is powered by OpenStreetMap ODbL, © <a href="http://www.openstreetmap.org/copyright">http://www.openstreetmap.org/copyright</a>.
|
||||
|
||||
\n\nAll rights belong to OsmAnd app, Copyright © 2010-2015 OsmAnd.
|
||||
|
||||
\n\nCredits to all Developers and major Contributors :
|
||||
\n\tVictor Shcherb - project lead.
|
||||
\n\tDr. Hardy Mueller - map appearance concept and base renderers, international consistency and testing, usability, app scoping, concepts, documentation, wiki, market research.
|
||||
\n\tAlexey Pelykh - C++ developer, created native library and made application much snappier.
|
||||
\n\tDenis Bars - Java developer, worked mostly on new UI and usability from 1.8 version.
|
||||
\n\tLeonid (xmd5a) - co-author of main OsmAnd rendering, author of UniRS, LightRS styles.
|
||||
\n\tDusan Kazik - one of the first contributors
|
||||
\n\tAndre Van Atten - project supporter, active forum participant, one of the first users.
|
||||
\n\tYvecai - main contributor to Contour Lines and Hillshade maps
|
||||
\n\tMax (Zahnstocher) - Java contributor, active forum participant.
|
||||
\n\tPavol Zibrita - first contributor and developer of some utilities
|
||||
\n\tHarry van der Wolf - contributor (contribute to country boundaries + configuration file + address files and else), active forum participant.
|
||||
</string>
|
||||
<string name="app_edition"></string>
|
||||
<string name="support_email">support@osmand.net</string>
|
||||
<string name="preferred_locale_no_translate">Display language</string>
|
||||
|
|
|
@ -1825,7 +1825,7 @@
|
|||
<string name="rendering_attr_transportStops_name">대중교통 정류소</string>
|
||||
<string name="voices">음성 안내</string>
|
||||
<string name="dash_download_msg_none">오프라인 지도를 다운로드 하시겠습니까?</string>
|
||||
<string name="dash_download_msg">%1 $s 지도 다운로드됨</string>
|
||||
<string name="dash_download_msg">%1$s 지도 다운로드됨</string>
|
||||
<string name="dash_download_new_one">새로운 지도 다운로드</string>
|
||||
<string name="dash_download_manage">관리</string>
|
||||
<string name="rendering_attr_roadStyle_name">도로 스타일</string>
|
||||
|
@ -2200,7 +2200,7 @@
|
|||
<string name="favourites_context_menu_add">즐겨찾기 추가</string>
|
||||
<string name="are_you_sure">확실한가요?</string>
|
||||
<string name="unsaved_changes_will_be_lost">저장되지 않은 변경 내용이 손실 됩니다. 계속 하시겠습니까?</string>
|
||||
<string name="downloads_left_template">%1$ 다운로드 남았습니다</string>
|
||||
<string name="downloads_left_template">%1$s 다운로드 남았습니다</string>
|
||||
<string name="roads">경로</string>
|
||||
<string name="downloading_number_of_files">다운로드중-%1$d 파일</string>
|
||||
<string name="show_free_version_banner">무료 버전 배너를 표시</string>
|
||||
|
|
|
@ -2011,4 +2011,7 @@
|
|||
<string name="please_specify_poi_type_only_from_list">"Ange rätt POI-typ eller hoppa över det. "</string>
|
||||
<string name="rendering_attr_roadStyle_description">Vägtyp</string>
|
||||
<string name="osm_edit_reopened_note">Öppnat OSM-anteckning igen</string>
|
||||
</resources>
|
||||
<string name="routing_attr_avoid_stairs_name">Undvik trappor</string>
|
||||
<string name="routing_attr_avoid_stairs_description">Undvik trappor</string>
|
||||
<string name="routing_attr_avoid_borders_name">Undvik gränsövergång</string>
|
||||
</resources>
|
||||
|
|
|
@ -14,6 +14,7 @@ import android.os.AsyncTask;
|
|||
import android.os.Build;
|
||||
import android.os.Handler;
|
||||
import android.os.Message;
|
||||
import android.support.multidex.MultiDexApplication;
|
||||
import android.support.v7.app.AlertDialog;
|
||||
import android.text.format.DateFormat;
|
||||
import android.util.TypedValue;
|
||||
|
@ -24,7 +25,6 @@ import android.widget.LinearLayout;
|
|||
import android.widget.LinearLayout.LayoutParams;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import net.osmand.PlatformUtil;
|
||||
import net.osmand.access.AccessibilityPlugin;
|
||||
import net.osmand.access.AccessibleAlertBuilder;
|
||||
|
@ -64,8 +64,7 @@ import btools.routingapp.BRouterServiceConnection;
|
|||
import btools.routingapp.IBRouterService;
|
||||
|
||||
|
||||
|
||||
public class OsmandApplication extends Application {
|
||||
public class OsmandApplication extends MultiDexApplication {
|
||||
public static final String EXCEPTION_PATH = "exception.log"; //$NON-NLS-1$
|
||||
private static final org.apache.commons.logging.Log LOG = PlatformUtil.getLog(OsmandApplication.class);
|
||||
|
||||
|
|
|
@ -277,6 +277,11 @@ public class MapActivityActions implements DialogProvider {
|
|||
adapter.item(R.string.context_menu_item_directions_from).iconColor(
|
||||
R.drawable.ic_action_gdirections_dark).reg();
|
||||
}
|
||||
if (getMyApplication().getTargetPointsHelper().getPointToNavigate() != null &&
|
||||
(mapActivity.getRoutingHelper().isFollowingMode() || mapActivity.getRoutingHelper().isRoutePlanningMode())) {
|
||||
adapter.item(R.string.context_menu_item_last_intermediate_point).iconColor(
|
||||
R.drawable.ic_action_flage_dark).reg();
|
||||
}
|
||||
OsmandPlugin.registerMapContextMenu(mapActivity, latitude, longitude, adapter, selectedObj);
|
||||
|
||||
final AlertDialog.Builder builder = new AlertDialog.Builder(mapActivity);
|
||||
|
@ -290,6 +295,10 @@ public class MapActivityActions implements DialogProvider {
|
|||
OnContextMenuClick click = adapter.getClickAdapter(which);
|
||||
if (click != null) {
|
||||
click.onContextMenuClick(listAdapter, standardId, which, false);
|
||||
} else if (standardId == R.string.context_menu_item_last_intermediate_point) {
|
||||
getMyApplication().getTargetPointsHelper().navigateToPoint(new LatLon(latitude, longitude),
|
||||
true, getMyApplication().getTargetPointsHelper().getIntermediatePoints().size(),
|
||||
mapActivity.getContextMenu().getPointDescription());
|
||||
} else if (standardId == R.string.context_menu_item_search) {
|
||||
Intent intent = new Intent(mapActivity, mapActivity.getMyApplication().getAppCustomization().getSearchActivity());
|
||||
intent.putExtra(SearchActivity.SEARCH_LAT, latitude);
|
||||
|
@ -442,17 +451,18 @@ public class MapActivityActions implements DialogProvider {
|
|||
settings.LAST_ROUTING_APPLICATION_MODE != ApplicationMode.DEFAULT) {
|
||||
mode = settings.LAST_ROUTING_APPLICATION_MODE;
|
||||
}
|
||||
if (from != null && targets.getPointToNavigate() != null) {
|
||||
double dist = MapUtils.getDistance(from, targets.getPointToNavigate().getLatitude(),
|
||||
targets.getPointToNavigate().getLongitude());
|
||||
if (dist >= 50000 && mode.isDerivedRoutingFrom(ApplicationMode.PEDESTRIAN)) {
|
||||
mode = ApplicationMode.CAR;
|
||||
} else if (dist >= 300000 && mode.isDerivedRoutingFrom(ApplicationMode.BICYCLE)) {
|
||||
mode = ApplicationMode.CAR;
|
||||
} else if (dist < 2000 && mode.isDerivedRoutingFrom(ApplicationMode.CAR)) {
|
||||
mode = ApplicationMode.PEDESTRIAN;
|
||||
}
|
||||
}
|
||||
// didn't provide good results
|
||||
// if (from != null && targets.getPointToNavigate() != null) {
|
||||
// double dist = MapUtils.getDistance(from, targets.getPointToNavigate().getLatitude(),
|
||||
// targets.getPointToNavigate().getLongitude());
|
||||
// if (dist >= 50000 && mode.isDerivedRoutingFrom(ApplicationMode.PEDESTRIAN)) {
|
||||
// mode = ApplicationMode.CAR;
|
||||
// } else if (dist >= 300000 && mode.isDerivedRoutingFrom(ApplicationMode.BICYCLE)) {
|
||||
// mode = ApplicationMode.CAR;
|
||||
// } else if (dist < 2000 && mode.isDerivedRoutingFrom(ApplicationMode.CAR)) {
|
||||
// mode = ApplicationMode.PEDESTRIAN;
|
||||
// }
|
||||
// }
|
||||
}
|
||||
return mode;
|
||||
}
|
||||
|
|
|
@ -48,10 +48,7 @@ public class NavigatePointFragment extends Fragment implements SearchActivityChi
|
|||
private static final String SELECTION = "SELECTION";
|
||||
|
||||
|
||||
private static final int NAVIGATE_TO = 1;
|
||||
private static final int ADD_WAYPOINT = 2;
|
||||
private static final int SHOW_ON_MAP = 3;
|
||||
private static final int ADD_TO_FAVORITE = 4;
|
||||
|
||||
private View view;
|
||||
private LatLon location;
|
||||
|
@ -114,43 +111,10 @@ public class NavigatePointFragment extends Fragment implements SearchActivityChi
|
|||
boolean light = app.getSettings().isLightActionBar();
|
||||
Menu menu = onCreate;
|
||||
if(getActivity() instanceof SearchActivity) {
|
||||
if (portrait) {
|
||||
menu = ((SearchActivity) getActivity()).getClearToolbar(true).getMenu();
|
||||
} else {
|
||||
((SearchActivity) getActivity()).getClearToolbar(false);
|
||||
}
|
||||
((SearchActivity) getActivity()).getClearToolbar(false);
|
||||
light = false;
|
||||
}
|
||||
MenuItem menuItem = menu.add(0, NAVIGATE_TO, 0, R.string.context_menu_item_directions_to);
|
||||
MenuItemCompat.setShowAsAction(menuItem, MenuItemCompat.SHOW_AS_ACTION_ALWAYS);
|
||||
menuItem = menuItem.setIcon(app.getIconsCache().getIcon(R.drawable.ic_action_gdirections_dark, light));
|
||||
menuItem.setOnMenuItemClickListener(new OnMenuItemClickListener() {
|
||||
|
||||
@Override
|
||||
public boolean onMenuItemClick(MenuItem item) {
|
||||
select(NAVIGATE_TO);
|
||||
return true;
|
||||
}
|
||||
});
|
||||
TargetPointsHelper targets = app.getTargetPointsHelper();
|
||||
if (targets.getPointToNavigate() != null) {
|
||||
menuItem = menu.add(0, ADD_WAYPOINT, 0, R.string.context_menu_item_intermediate_point);
|
||||
MenuItemCompat.setShowAsAction(menuItem, MenuItemCompat.SHOW_AS_ACTION_ALWAYS);
|
||||
menuItem = menuItem.setIcon(app.getIconsCache().getIcon(R.drawable.ic_action_flage_dark, light));
|
||||
} else {
|
||||
menuItem = menu.add(0, ADD_WAYPOINT, 0, R.string.context_menu_item_destination_point);
|
||||
MenuItemCompat.setShowAsAction(menuItem, MenuItemCompat.SHOW_AS_ACTION_ALWAYS);
|
||||
menuItem = menuItem.setIcon(app.getIconsCache().getIcon(R.drawable.ic_action_flag_dark, light));
|
||||
}
|
||||
menuItem.setOnMenuItemClickListener(new OnMenuItemClickListener() {
|
||||
@Override
|
||||
public boolean onMenuItemClick(MenuItem item) {
|
||||
select(ADD_WAYPOINT);
|
||||
return true;
|
||||
}
|
||||
});
|
||||
//}
|
||||
menuItem = menu.add(0, SHOW_ON_MAP, 0, R.string.shared_string_show_on_map);
|
||||
MenuItem menuItem = menu.add(0, SHOW_ON_MAP, 0, R.string.shared_string_show_on_map);
|
||||
MenuItemCompat.setShowAsAction(menuItem, MenuItemCompat.SHOW_AS_ACTION_ALWAYS);
|
||||
menuItem = menuItem.setIcon(app.getIconsCache().getIcon(R.drawable.ic_action_marker_dark, light));
|
||||
|
||||
|
@ -162,17 +126,6 @@ public class NavigatePointFragment extends Fragment implements SearchActivityChi
|
|||
}
|
||||
});
|
||||
|
||||
menuItem = menu.add(0, ADD_TO_FAVORITE, 0, R.string.shared_string_add_to_favorites);
|
||||
MenuItemCompat.setShowAsAction(menuItem, MenuItemCompat.SHOW_AS_ACTION_ALWAYS);
|
||||
menuItem = menuItem.setIcon(app.getIconsCache().getIcon(R.drawable.ic_action_fav_dark, light));
|
||||
|
||||
menuItem.setOnMenuItemClickListener(new OnMenuItemClickListener() {
|
||||
@Override
|
||||
public boolean onMenuItemClick(MenuItem item) {
|
||||
select(ADD_TO_FAVORITE);
|
||||
return true;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -380,16 +333,7 @@ public class NavigatePointFragment extends Fragment implements SearchActivityChi
|
|||
double lat = loc.getLatitude();
|
||||
double lon = loc.getLongitude();
|
||||
PointDescription pd = new PointDescription(lat, lon);
|
||||
if(mode == ADD_TO_FAVORITE) {
|
||||
Bundle b = new Bundle();
|
||||
Dialog dlg = FavoriteDialogs.createAddFavouriteDialog(getActivity(), b);
|
||||
dlg.show();
|
||||
FavoriteDialogs.prepareAddFavouriteDialog(getActivity(), dlg, b, lat, lon, pd);
|
||||
} else if (mode == NAVIGATE_TO) {
|
||||
DirectionsDialogs.directionsToDialogAndLaunchMap(getActivity(), lat, lon, pd);
|
||||
} else if (mode == ADD_WAYPOINT) {
|
||||
DirectionsDialogs.addWaypointDialogAndLaunchMap(getActivity(), lat, lon, pd);
|
||||
} else if (mode == SHOW_ON_MAP){
|
||||
if (mode == SHOW_ON_MAP){
|
||||
OsmandApplication app = (OsmandApplication) getActivity().getApplication();
|
||||
app.getSettings().setMapLocationToShow(lat, lon, Math.max(12, app.getSettings().getLastKnownMapZoom()),
|
||||
pd);
|
||||
|
|
|
@ -1,17 +1,15 @@
|
|||
package net.osmand.plus.activities;
|
||||
|
||||
|
||||
import net.osmand.plus.OsmandApplication;
|
||||
import net.osmand.plus.R;
|
||||
import android.graphics.PorterDuff;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.support.v7.app.ActionBar;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
/**
|
||||
* Created by Denis
|
||||
* on 28.01.15.
|
||||
*/
|
||||
public class OsmandActionBarActivity extends AppCompatActivity {
|
||||
|
||||
protected boolean haveHomeButton = true;
|
||||
|
@ -20,9 +18,12 @@ public class OsmandActionBarActivity extends AppCompatActivity {
|
|||
protected void setupHomeButton(){
|
||||
Drawable back = ((OsmandApplication)getApplication()).getIconsCache().getIcon(R.drawable.abc_ic_ab_back_mtrl_am_alpha);
|
||||
back.setColorFilter(getResources().getColor(R.color.color_white), PorterDuff.Mode.MULTIPLY);
|
||||
getSupportActionBar().setHomeButtonEnabled(true);
|
||||
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
||||
getSupportActionBar().setHomeAsUpIndicator(back);
|
||||
final ActionBar supportActionBar = getSupportActionBar();
|
||||
if (supportActionBar != null) {
|
||||
supportActionBar.setHomeButtonEnabled(true);
|
||||
supportActionBar.setDisplayHomeAsUpEnabled(true);
|
||||
supportActionBar.setHomeAsUpIndicator(back);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -23,7 +23,6 @@ import android.support.v7.app.AlertDialog;
|
|||
import android.widget.EditText;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.Toast;
|
||||
|
||||
import net.osmand.IProgress;
|
||||
import net.osmand.IndexConstants;
|
||||
import net.osmand.access.AccessibleToast;
|
||||
|
@ -255,7 +254,8 @@ public class SettingsGeneralActivity extends SettingsBaseActivity {
|
|||
((ListPreference) screen.findPreference(settings.PREFERRED_LOCALE.getId())).setTitle(getString(R.string.preferred_locale) + " (" + getString(R.string.preferred_locale_no_translate) + ")");
|
||||
}
|
||||
|
||||
registerListPreference(settings.MAP_PREFERRED_LOCALE, screen, ConfigureMapMenu.getMapNamesValues(this), ConfigureMapMenu.mapNamesIds);
|
||||
String[] ids = ConfigureMapMenu.getSortedMapNamesIds(this);
|
||||
registerListPreference(settings.MAP_PREFERRED_LOCALE, screen, ConfigureMapMenu.getMapNamesValues(this, ids), ids);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -6,15 +6,10 @@ import net.osmand.data.PointDescription;
|
|||
import net.osmand.plus.OsmandApplication;
|
||||
import net.osmand.plus.OsmandSettings;
|
||||
import net.osmand.plus.R;
|
||||
import net.osmand.plus.TargetPointsHelper;
|
||||
import net.osmand.plus.activities.MapActivity;
|
||||
import net.osmand.plus.dialogs.DirectionsDialogs;
|
||||
import net.osmand.plus.dialogs.FavoriteDialogs;
|
||||
import net.osmand.plus.helpers.FileNameTranslationHelper;
|
||||
import net.osmand.plus.helpers.AndroidUiHelper;
|
||||
import net.osmand.plus.resources.RegionAddressRepository;
|
||||
import net.osmand.util.Algorithms;
|
||||
import android.app.Dialog;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.graphics.drawable.Drawable;
|
||||
|
@ -40,12 +35,9 @@ public class SearchAddressFragment extends Fragment {
|
|||
private static final boolean ENABLE_ONLINE_ADDRESS = false; // disabled moved to poi search
|
||||
public static final String SELECT_ADDRESS_POINT_LAT = "SELECT_ADDRESS_POINT_LAT";
|
||||
public static final String SELECT_ADDRESS_POINT_LON = "SELECT_ADDRESS_POINT_LON";
|
||||
private static final int NAVIGATE_TO = 0;
|
||||
private static final int ADD_WAYPOINT = 1;
|
||||
private static final int SHOW_ON_MAP = 2;
|
||||
private static final int ONLINE_SEARCH = 3;
|
||||
private static final int SELECT_POINT = 4;
|
||||
private static final int ADD_TO_FAVORITE = 5;
|
||||
|
||||
private Button streetButton;
|
||||
private Button cityButton;
|
||||
|
@ -84,13 +76,8 @@ public class SearchAddressFragment extends Fragment {
|
|||
@Override
|
||||
public void onCreateOptionsMenu(Menu onCreate, MenuInflater inflater) {
|
||||
Menu menu = onCreate;
|
||||
boolean portrait = AndroidUiHelper.isOrientationPortrait(getActivity());
|
||||
if(getActivity() instanceof SearchActivity) {
|
||||
if (portrait) {
|
||||
menu = ((SearchActivity) getActivity()).getClearToolbar(true).getMenu();
|
||||
} else {
|
||||
((SearchActivity) getActivity()).getClearToolbar(false);
|
||||
}
|
||||
((SearchActivity) getActivity()).getClearToolbar(false);
|
||||
}
|
||||
if(getActivity() instanceof SearchAddressActivity) {
|
||||
MenuItem menuItem = menu.add(0, SELECT_POINT, 0, "");
|
||||
|
@ -104,34 +91,7 @@ public class SearchAddressFragment extends Fragment {
|
|||
}
|
||||
});
|
||||
} else {
|
||||
MenuItem menuItem = menu.add(0, NAVIGATE_TO, 0, R.string.context_menu_item_directions_to);
|
||||
MenuItemCompat.setShowAsAction(menuItem, MenuItemCompat.SHOW_AS_ACTION_ALWAYS);
|
||||
menuItem = menuItem.setIcon(R.drawable.ic_action_gdirections_dark);
|
||||
menuItem.setOnMenuItemClickListener(new OnMenuItemClickListener() {
|
||||
@Override
|
||||
public boolean onMenuItemClick(MenuItem item) {
|
||||
select(NAVIGATE_TO);
|
||||
return true;
|
||||
}
|
||||
});
|
||||
TargetPointsHelper targets = getApplication().getTargetPointsHelper();
|
||||
if (targets.getPointToNavigate() != null) {
|
||||
menuItem = menu.add(0, ADD_WAYPOINT, 0, R.string.context_menu_item_intermediate_point);
|
||||
MenuItemCompat.setShowAsAction(menuItem, MenuItemCompat.SHOW_AS_ACTION_ALWAYS);
|
||||
menuItem = menuItem.setIcon(R.drawable.ic_action_flage_dark);
|
||||
} else {
|
||||
menuItem = menu.add(0, ADD_WAYPOINT, 0, R.string.context_menu_item_destination_point);
|
||||
MenuItemCompat.setShowAsAction(menuItem, MenuItemCompat.SHOW_AS_ACTION_ALWAYS);
|
||||
menuItem = menuItem.setIcon(R.drawable.ic_action_flag_dark);
|
||||
}
|
||||
menuItem.setOnMenuItemClickListener(new OnMenuItemClickListener() {
|
||||
@Override
|
||||
public boolean onMenuItemClick(MenuItem item) {
|
||||
select(ADD_WAYPOINT);
|
||||
return true;
|
||||
}
|
||||
});
|
||||
menuItem = menu.add(0, SHOW_ON_MAP, 0, R.string.shared_string_show_on_map);
|
||||
MenuItem menuItem = menu.add(0, SHOW_ON_MAP, 0, R.string.shared_string_show_on_map);
|
||||
MenuItemCompat.setShowAsAction(menuItem, MenuItemCompat.SHOW_AS_ACTION_ALWAYS);
|
||||
menuItem = menuItem.setIcon(R.drawable.ic_action_marker_dark);
|
||||
|
||||
|
@ -142,18 +102,6 @@ public class SearchAddressFragment extends Fragment {
|
|||
return true;
|
||||
}
|
||||
});
|
||||
|
||||
menuItem = menu.add(0, ADD_TO_FAVORITE, 0, R.string.shared_string_add_to_favorites);
|
||||
MenuItemCompat.setShowAsAction(menuItem, MenuItemCompat.SHOW_AS_ACTION_ALWAYS);
|
||||
menuItem = menuItem.setIcon(R.drawable.ic_action_fav_dark);
|
||||
|
||||
menuItem.setOnMenuItemClickListener(new OnMenuItemClickListener() {
|
||||
@Override
|
||||
public boolean onMenuItemClick(MenuItem item) {
|
||||
select(ADD_TO_FAVORITE);
|
||||
return true;
|
||||
}
|
||||
});
|
||||
if (ENABLE_ONLINE_ADDRESS) {
|
||||
menuItem = menu.add(0, ONLINE_SEARCH, 0, R.string.search_online_address);
|
||||
MenuItemCompat.setShowAsAction(menuItem, MenuItemCompat.SHOW_AS_ACTION_ALWAYS);
|
||||
|
@ -393,13 +341,7 @@ public class SearchAddressFragment extends Fragment {
|
|||
pointDescription.setTypeName(getRegionName());
|
||||
}
|
||||
|
||||
if(mode == ADD_TO_FAVORITE) {
|
||||
Bundle b = new Bundle();
|
||||
Dialog dlg = FavoriteDialogs.createAddFavouriteDialog(getActivity(), b);
|
||||
dlg.show();
|
||||
FavoriteDialogs.prepareAddFavouriteDialog(getActivity(), dlg, b, searchPoint.getLatitude(), searchPoint.getLongitude(),
|
||||
pointDescription);
|
||||
} else if(mode == SELECT_POINT ){
|
||||
if(mode == SELECT_POINT ){
|
||||
Intent intent = getActivity().getIntent();
|
||||
intent.putExtra(SELECT_ADDRESS_POINT_INTENT_KEY, ai.objectName);
|
||||
intent.putExtra(SELECT_ADDRESS_POINT_LAT, searchPoint.getLatitude());
|
||||
|
@ -407,11 +349,7 @@ public class SearchAddressFragment extends Fragment {
|
|||
getActivity().setResult(SELECT_ADDRESS_POINT_RESULT_OK, intent);
|
||||
getActivity().finish();
|
||||
} else {
|
||||
if (mode == NAVIGATE_TO) {
|
||||
DirectionsDialogs.directionsToDialogAndLaunchMap(getActivity(), searchPoint.getLatitude(), searchPoint.getLongitude(), pointDescription);
|
||||
} else if (mode == ADD_WAYPOINT) {
|
||||
DirectionsDialogs.addWaypointDialogAndLaunchMap(getActivity(), searchPoint.getLatitude(), searchPoint.getLongitude(), pointDescription);
|
||||
} else if (mode == SHOW_ON_MAP) {
|
||||
if (mode == SHOW_ON_MAP) {
|
||||
osmandSettings.setMapLocationToShow(searchPoint.getLatitude(), searchPoint.getLongitude(), ai.zoom, pointDescription);
|
||||
MapActivity.launchMapActivityMoveToTop(getActivity());
|
||||
}
|
||||
|
|
|
@ -8,7 +8,6 @@ import android.support.v7.app.AlertDialog;
|
|||
import android.view.View;
|
||||
import android.widget.ArrayAdapter;
|
||||
import android.widget.Toast;
|
||||
|
||||
import net.osmand.PlatformUtil;
|
||||
import net.osmand.access.AccessibleToast;
|
||||
import net.osmand.core.android.MapRendererContext;
|
||||
|
@ -39,11 +38,16 @@ import net.osmand.util.Algorithms;
|
|||
|
||||
import org.apache.commons.logging.Log;
|
||||
|
||||
import java.text.Collator;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import gnu.trove.list.array.TIntArrayList;
|
||||
|
||||
|
@ -369,21 +373,21 @@ public class ConfigureMapMenu {
|
|||
AlertDialog.Builder b = new AlertDialog.Builder(view.getContext());
|
||||
// test old descr as title
|
||||
b.setTitle(R.string.map_preferred_locale);
|
||||
final String[] txtValues = mapNamesIds;
|
||||
final String[] txtNames = getMapNamesValues(activity);
|
||||
final String[] txtIds = getSortedMapNamesIds(activity);
|
||||
final String[] txtValues = getMapNamesValues(activity, txtIds);
|
||||
int selected = -1;
|
||||
for (int i = 0; i < txtValues.length; i++) {
|
||||
if(view.getSettings().MAP_PREFERRED_LOCALE.get().equals(txtValues[i])) {
|
||||
for (int i = 0; i < txtIds.length; i++) {
|
||||
if(view.getSettings().MAP_PREFERRED_LOCALE.get().equals(txtIds[i])) {
|
||||
selected = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
b.setSingleChoiceItems(txtNames, selected, new DialogInterface.OnClickListener() {
|
||||
b.setSingleChoiceItems(txtValues, selected, new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
view.getSettings().MAP_PREFERRED_LOCALE.set(txtValues[which]);
|
||||
view.getSettings().MAP_PREFERRED_LOCALE.set(txtIds[which]);
|
||||
refreshMapComplete(activity);
|
||||
adapter.setItemDescription(pos, txtValues[which]);
|
||||
adapter.setItemDescription(pos, txtIds[which]);
|
||||
ad.notifyDataSetInvalidated();
|
||||
dialog.dismiss();
|
||||
}
|
||||
|
@ -415,11 +419,36 @@ public class ConfigureMapMenu {
|
|||
|
||||
public static String[] mapNamesIds = new String[] { "", "en", "als", "af", "ar", "az", "be", "bg", "bn", "bpy", "br", "bs", "ca", "ceb", "cs", "cy", "da", "de", "el", "et", "es", "eu", "fa", "fi", "fr", "fy", "ga", "gl", "he", "hi", "hr", "ht", "hu", "hy", "id", "is", "it", "ja", "ka", "ko", "ku", "la", "lb", "lt", "lv", "mk", "ml", "mr", "ms", "nds", "new", "nl", "nn", "no", "nv", "os", "pl", "pms", "pt", "ro", "ru", "sh", "sc", "sk", "sl", "sq", "sr", "sv", "sw", "ta", "te", "th", "tl", "tr", "uk", "vi", "vo", "zh" };
|
||||
|
||||
public static String[] getMapNamesValues(Context ctx) {
|
||||
String[] translates = new String[mapNamesIds.length];
|
||||
translates[0] = ctx.getString(R.string.local_map_names);
|
||||
for(int i = 1; i < translates.length; i++) {
|
||||
translates[i] = ((OsmandApplication)ctx.getApplicationContext()).getLangTranslation(mapNamesIds[i]);
|
||||
|
||||
public static String[] getSortedMapNamesIds(Context ctx) {
|
||||
String[] vls = getMapNamesValues(ctx, mapNamesIds);
|
||||
final Map<String, String> mp = new HashMap<String, String>();
|
||||
for(int i = 0; i < mapNamesIds.length; i++) {
|
||||
mp.put(mapNamesIds[i], vls[i]);
|
||||
}
|
||||
ArrayList<String> lst = new ArrayList<String>(mp.keySet());
|
||||
Collections.sort(lst, new Comparator<String>() {
|
||||
@Override
|
||||
public int compare(String lhs, String rhs) {
|
||||
int i1 = Algorithms.isEmpty(lhs)? 0 : (lhs.equals("en") ? 1 : 2);
|
||||
int i2 = Algorithms.isEmpty(rhs)? 0 : (rhs.equals("en") ? 1 : 2);
|
||||
if(i1 != i2) {
|
||||
return i1 < i2 ? -1 : 1;
|
||||
}
|
||||
return mp.get(lhs).compareTo(mp.get(rhs));
|
||||
}
|
||||
});
|
||||
return lst.toArray(new String[lst.size()]);
|
||||
}
|
||||
|
||||
public static String[] getMapNamesValues(Context ctx, String[] ids) {
|
||||
String[] translates = new String[ids.length];
|
||||
for(int i = 0; i < translates.length; i++) {
|
||||
if(Algorithms.isEmpty(ids[i])) {
|
||||
translates[i] = ctx.getString(R.string.local_map_names);
|
||||
} else {
|
||||
translates[i] = ((OsmandApplication)ctx.getApplicationContext()).getLangTranslation(ids[i]);
|
||||
}
|
||||
}
|
||||
|
||||
return translates;
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
package net.osmand.plus.mapcontextmenu;
|
||||
|
||||
import android.graphics.drawable.Drawable;
|
||||
|
||||
import net.osmand.Location;
|
||||
import net.osmand.ResultMatcher;
|
||||
import net.osmand.binary.RouteDataObject;
|
||||
|
@ -141,9 +140,18 @@ public abstract class MenuTitleController {
|
|||
public boolean publish(RouteDataObject object) {
|
||||
if (object != null) {
|
||||
OsmandSettings settings = getMapActivity().getMyApplication().getSettings();
|
||||
streetStr = RoutingHelper.formatStreetName(object.getName(settings.MAP_PREFERRED_LOCALE.get()),
|
||||
object.getRef(), object.getDestinationName(settings.MAP_PREFERRED_LOCALE.get()));
|
||||
|
||||
String streetName = object.getName(settings.MAP_PREFERRED_LOCALE.get());
|
||||
String ref = object.getRef();
|
||||
if(Algorithms.isEmpty(streetName)) {
|
||||
streetName = "";
|
||||
}
|
||||
if(!Algorithms.isEmpty(ref)) {
|
||||
if(!Algorithms.isEmpty(streetName)) {
|
||||
streetName += ", ";
|
||||
}
|
||||
streetName += ref;
|
||||
}
|
||||
streetStr = streetName;
|
||||
if (!Algorithms.isEmpty(streetStr)) {
|
||||
MenuController menuController = getMenuController();
|
||||
if (menuController == null || menuController.displayStreetNameInTitle()) {
|
||||
|
|
|
@ -50,8 +50,8 @@ public class NextTurnInfoWidget extends TextInfoWidget {
|
|||
}
|
||||
|
||||
public void setTurnType(TurnType turnType) {
|
||||
updateVisibility(turnType != null);
|
||||
if (turnDrawable.setTurnType(turnType)) {
|
||||
boolean vis = updateVisibility(turnType != null);
|
||||
if (turnDrawable.setTurnType(turnType) || vis) {
|
||||
if(horisontalMini) {
|
||||
setImageDrawable(turnDrawable, false);
|
||||
} else {
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
apply plugin: 'com.android.application'
|
||||
|
||||
android {
|
||||
compileSdkVersion 21
|
||||
compileSdkVersion 23
|
||||
buildToolsVersion "23.0.1"
|
||||
|
||||
signingConfigs {
|
||||
|
@ -22,7 +22,7 @@ android {
|
|||
|
||||
defaultConfig {
|
||||
minSdkVersion 9
|
||||
targetSdkVersion 21
|
||||
targetSdkVersion 23
|
||||
}
|
||||
|
||||
lintOptions {
|
||||
|
@ -64,4 +64,5 @@ repositories {
|
|||
}
|
||||
|
||||
dependencies {
|
||||
compile project(":eclipse-compile:appcompat")
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue