Compare commits

...

25 commits
master ... r1.8

Author SHA1 Message Date
Victor Shcherb
3bb57cb560 Show view angle always and make show destination arrow configurable 2014-07-31 02:25:35 +02:00
Victor Shcherb
182834f93b Fix recording only for navigation 2014-07-31 01:50:39 +02:00
Victor Shcherb
5ea11283cd Fix bug 2014-07-31 01:41:22 +02:00
Victor Shcherb
a8b37cd0ac Simplify group management
Conflicts:
	OsmAnd/res/values/strings.xml
2014-07-31 01:32:25 +02:00
Victor Shcherb
64daabc5c7 Fix osmo
Conflicts:
	OsmAnd/res/values/strings.xml
2014-07-31 01:22:03 +02:00
Victor Shcherb
5b51255b38 Fix OsMo
Conflicts:
	OsmAnd/res/values/strings.xml
2014-07-31 00:28:28 +02:00
Victor Shcherb
4ed026d49c Merge branch 'r1.8' of ssh://github.com/osmandapp/Osmand into r1.8 2014-07-30 23:43:50 +02:00
Victor Shcherb
af538b71a3 Synchronize to avoid exception 2014-07-30 23:43:13 +02:00
vshcherb
ba17ccd1ed Merge pull request #782 from Bars107/r1.8
Fixed null pointers bugs and wrong usage of String.isEmpty.
2014-07-25 10:09:43 -04:00
Bars107
4c6ac7c845 Update TransportStopsLayer.java 2014-07-25 12:21:40 +03:00
Denis
d41978d926 cherry-pick merge 2014-07-25 08:31:40 +03:00
Denis
c449b330c9 Cherry-pick merge 2014-07-25 08:30:17 +03:00
Denis
2e45657fce Fixed bug of usage String.isEmpty method which is prohibited for old android devices 2014-07-25 08:29:11 +03:00
vshcherb
4a6935ef13 Merge pull request #779 from Zahnstocher/r1.8
Fix navigation intent regexp (c:geo and others) and restore support for c:geo geo intent
2014-07-23 23:15:45 -04:00
Zahnstocher
d05afc1ba7 Fix navigation intent regexp (c:geo and others) and restore support for c:geo geo intent 2014-07-23 22:02:43 +02:00
vshcherb
f5fb91e4a1 Create style.css 2014-07-23 14:18:23 +02:00
vshcherb
63399f861a Update build.xml 2014-07-23 14:17:35 +02:00
Victor Shcherb
c51b5d5a73 Merge branch 'r1.8' of ssh://github.com/osmandapp/Osmand into r1.8 2014-07-18 10:29:21 +02:00
Victor Shcherb
8a60469a8b Osmo service pass a version 2014-07-18 10:28:28 +02:00
Victor Shcherb
c893eddcf1 Fix osmo login issue 2014-07-18 10:28:05 +02:00
vshcherb
1c86b1d178 Merge pull request #760 from Bars107/r1.8
Fixed '$ ' bug in string resources
2014-07-17 13:30:28 +02:00
Denis
7618520dc3 Fixed '$ ' bug in string resources 2014-07-17 14:28:25 +04:00
Victor Shcherb
d8feefd783 Fix BB release 2014-07-16 23:04:35 +02:00
Victor Shcherb
0b4d9e0ad1 Hotfix issue 2014-07-16 20:46:04 +02:00
Victor Shcherb
5424d9703a Support maps with different names 2014-07-14 23:56:43 +02:00
26 changed files with 203 additions and 76 deletions

View file

@ -86,8 +86,8 @@ public class BinaryMapAddressReaderAdapter {
int tag = WireFormat.getTagFieldNumber(t);
switch (tag) {
case 0:
if(region.enName == null || region.enName.length() == 0){
region.enName = Junidecode.unidecode(region.name);
if (region.enName == null || region.enName.length() == 0) {
region.enName = region.name == null ? "" : Junidecode.unidecode(region.name);
}
return;
case OsmandOdb.OsmAndAddressIndex.NAME_FIELD_NUMBER :

7
OsmAnd/assets/style.css Normal file
View file

@ -0,0 +1,7 @@
h3 { text-align: center}
h4 { text-align: center}
div {border-width: 1px; padding: 10px;
border: groove; margin-left:auto;margin-right:auto; }
li { text-align:justify;"}
img { max-width: 75%; width: auto; height: auto; }
p.img {text-align: center}

View file

@ -18,7 +18,7 @@
<target name="copy_resources">
<copy todir="assets">
<copy todir="assets">
<fileset dir="../../resources/" >
<include name="specialphrases/**"/>
<include name="voice/**/*.p"/>
@ -34,11 +34,16 @@
<include name="*.xml"/>
</fileset>
</copy>
<copy todir="assets/help/">
<sync todir="assets/help/">
<fileset dir="../../help/" >
<include name="*.html"/>
<include name="images/**/*.png"/>
</fileset>
</sync>
<copy todir="assets/help">
<fileset dir="assets/" >
<include name="style.css"/>
</fileset>
</copy>
<copy todir="${src.absolute.dir}/net/osmand/render/">
<fileset dir="../../resources/rendering_styles/" >

View file

@ -1793,7 +1793,7 @@ Si consiglia di aggiungere uno o più punti intermedi per migliorarne le prestaz
<string name="osmo_session_not_available">Sessione non disponibile, per favore controllare che \'Invia posizioni\' sia attivo.</string>
<string name="osmo_share_session">Condividi sessione</string>
<string name="osmo_session_id_share">Url della sessione per tracciare il dispositivo (%1$s)</string>
<string name="osmo_tracker_id_share">Per collegarsi al dispositivo desiderato %2$s, cliccare sul link %3$ o specificarne l\'id di monitoraggio (%1$s)</string>
<string name="osmo_tracker_id_share">Per collegarsi al dispositivo desiderato %2$s, cliccare sul link %3$s o specificarne l\'id di monitoraggio (%1$s)</string>
<string name="osmo_track_interval">Intervallo di registrazione</string>
<string name="osmo_track_interval_descr">Scegli l\'intervallo di tempo per l\'invio della posizione</string>
<string name="int_days">giorni</string>
@ -1911,4 +1911,4 @@ Si consiglia di aggiungere uno o più punti intermedi per migliorarne le prestaz
<string name="rendering_attr_showSurfaces_name">Mostra il tipo di superficie delle strade</string>
<string name="rendering_attr_showCycleRoutes_name">Mostra i percorsi per bicicletta</string>
<string name="osmo_auth_error_short">Autorizzazione fallita</string>
</resources>
</resources>

View file

@ -1198,7 +1198,7 @@
<string name="background_service_is_enabled_question">OsmAnd 休眠模式服務仍在執行。您想要關閉它嗎?</string>
<string name="osmand_play_title_30_chars">OsmAnd 地圖和導航</string>
<string name="osmand_plus_play_title_30_chars">OsmAnd+ 地圖和導航</string>
<string name="native_app_allocated_memory_descr">原生記憶體總計由應用程式 %1$s MB (Dalvik %2$s MB其它 %3$s MB) 。Proportional memory %4$s MB (Android 限制 %5$s MBDalvik %6$ MB)分配佔用。</string>
<string name="native_app_allocated_memory_descr">原生記憶體總計由應用程式 %1$s MB (Dalvik %2$s MB其它 %3$s MB) 。Proportional memory %4$s MB (Android 限制 %5$s MBDalvik %6$s MB)分配佔用。</string>
<string name="context_menu_item_destination_point">設定為目的地</string>
<string name="please_select_address">首先選擇城市或街道</string>
<string name="available_downloads_left">還可下載 %1$d 個檔案</string>
@ -1900,4 +1900,4 @@ OsmAnd 是開放原始碼,而且正在積極的開發。應用程式從報告
<string name="rendering_attr_showSurfaces_name">顯示道路表面</string>
<string name="rendering_attr_showCycleRoutes_name">顯示自行車道</string>
</resources>
</resources>

View file

@ -11,6 +11,20 @@
-->
<string name="map_preferred_locale_descr">Preferred lanaguage for labels on the map (if it is not available will switch to English or to local names)</string>
<string name="map_preferred_locale">Map prefferred language</string>
<string name="osmo_invite">Invite...</string>
<string name="osmo_leave_confirmation_msg">Do you want to leave group %1$s?</string>
<string name="osmo_specify_tracker_id">Please specify id</string>
<string name="continue_navigation">Continue Navigation</string>
<string name="pause_navigation">Pause Navigation</string>
<string name="keep_navigation_service">Keep</string>
<string name="rendering_attr_subwayMode_name">Subway mode</string>
<string name="keep_navigation_service">Keep</string>
<string name="stop_navigation_service">Stop</string>
<string name="enable_sleep_mode">Enable sleep mode</string>
<string name="gps_wake_up_timer">GPS wake up interval</string>
<string name="sleep_mode_stop_dialog">Keep GPS on?</string>
<string name="map_preferred_locale_descr">Preferred language for labels on the map (if it is not available will switch to English or to local names)</string>
<string name="map_preferred_locale">Map preferred language</string>
<string name="local_map_names">Local names</string>
<string name="lang_sw">Swahili</string>
<string name="lang_he">Hebrew</string>

View file

@ -511,7 +511,8 @@ public class OsmandApplication extends Application {
LOG.error("I/O exception", e);
warnings.add("Error while reading the special phrases. Restart OsmAnd if possible");
}
if (!Version.isBlackberry(this)) {
if (!Version.isBlackberry(this) || !"qnx".equals(System.getProperty("os.name"))) {
if (osmandSettings.NATIVE_RENDERING_FAILED.get()) {
osmandSettings.SAFE_MODE.set(true);
osmandSettings.NATIVE_RENDERING_FAILED.set(false);

View file

@ -3,7 +3,6 @@ package net.osmand.plus;
import java.io.File;
import java.io.IOException;
import java.lang.reflect.Field;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Comparator;
@ -316,6 +315,7 @@ public class OsmandSettings {
protected abstract T getValue(Object prefs, T defaultValue);
protected abstract boolean setValue(Object prefs, T val);
@Override
@ -361,6 +361,10 @@ public class OsmandSettings {
}
return false;
}
public boolean isSet() {
return settingsAPI.contains(getPreferences(), getId());
}
}
@ -947,10 +951,7 @@ public class OsmandSettings {
public final CommonPreference<Boolean> MAP_ONLINE_DATA = new BooleanPreference("map_online_data", false).makeGlobal();
// this value string is synchronized with settings_pref.xml preference name
// public final CommonPreference<Boolean> SHOW_DESTINATION_ARROW = new BooleanPreference("show_destination_arrow", true).makeProfile();
// {
// SHOW_DESTINATION_ARROW.setModeDefaultValue(ApplicationMode.CAR, false);
// }
public final CommonPreference<Boolean> SHOW_DESTINATION_ARROW = new BooleanPreference("show_destination_arrow", false).makeProfile();
// this value string is synchronized with settings_pref.xml preference name
public final CommonPreference<String> MAP_OVERLAY = new StringPreference("map_overlay", null).makeGlobal();

View file

@ -225,7 +225,9 @@ public class AvailableGPXFragment extends OsmandExpandableListFragment {
}
public void hideProgressBar() {
getSherlockActivity().setSupportProgressBarIndeterminateVisibility(false);
if (getSherlockActivity() != null){
getSherlockActivity().setSupportProgressBarIndeterminateVisibility(false);
}
}
private void updateSelectionMode(ActionMode m) {
@ -963,7 +965,9 @@ public class AvailableGPXFragment extends OsmandExpandableListFragment {
@Override
protected void onPostExecute(Void result) {
getSherlockActivity().setProgressBarIndeterminateVisibility(false);
if (getSherlockActivity() != null){
getSherlockActivity().setProgressBarIndeterminateVisibility(false);
}
if (info.gpx != null){
getMyApplication().getSelectedGpxHelper().selectGpxFile(info.gpx, selected, true);
listAdapter.notifyDataSetChanged();

View file

@ -343,7 +343,7 @@ public class MapActivity extends AccessibleActivity {
} else if ("google.navigation".equals(scheme) || "osmand.navigation".equals(scheme)) {
final String schemeSpecificPart = data.getSchemeSpecificPart();
final Matcher matcher = Pattern.compile("q=(.+?),(.+?)").matcher(schemeSpecificPart);
final Matcher matcher = Pattern.compile("(?:q|ll)=([\\-0-9.]+),([\\-0-9.]+)(?:.*)").matcher(schemeSpecificPart);
if (matcher.matches()) {
try {
final double lat = Double.valueOf(matcher.group(1));

View file

@ -129,7 +129,7 @@ public class SavingTrackHelper extends SQLiteOpenHelper {
return res;
}
public boolean hasDataToSave() {
public synchronized boolean hasDataToSave() {
try {
SQLiteDatabase db = getWritableDatabase();
if (db != null) {
@ -160,7 +160,7 @@ public class SavingTrackHelper extends SQLiteOpenHelper {
/**
* @return warnings
*/
public List<String> saveDataToGpx() {
public synchronized List<String> saveDataToGpx() {
List<String> warnings = new ArrayList<String>();
File dir = ctx.getAppPath(IndexConstants.GPX_RECORDED_INDEX_DIR);
dir.mkdirs();
@ -319,7 +319,8 @@ public class SavingTrackHelper extends SQLiteOpenHelper {
OsmAndLocationProvider.isNotSimulatedLocation(location) &&
OsmandPlugin.getEnabledPlugin(OsmandMonitoringPlugin.class) != null) {
if (settings.SAVE_TRACK_TO_GPX.get() &&
locationTime - lastTimeUpdated > settings.SAVE_TRACK_INTERVAL.get()) {
locationTime - lastTimeUpdated > settings.SAVE_TRACK_INTERVAL.get() &&
ctx.getRoutingHelper().isFollowingMode()) {
record = true;
} else if (settings.SAVE_GLOBAL_TRACK_TO_GPX.get() &&
locationTime - lastTimeUpdated > settings.SAVE_GLOBAL_TRACK_INTERVAL.get()) {
@ -376,7 +377,7 @@ public class SavingTrackHelper extends SQLiteOpenHelper {
execWithClose(updatePointsScript, new Object[] { lat, lon, time, description });
}
private void execWithClose(String script, Object[] objects) {
private synchronized void execWithClose(String script, Object[] objects) {
SQLiteDatabase db = getWritableDatabase();
try {
if (db != null) {

View file

@ -132,9 +132,9 @@ public class SettingsGeneralActivity extends SettingsBaseActivity {
private void addPrefmapNames(PreferenceGroup screen) {
String[] entries = new String[] { "", "en", "be", "ca", "cs", "da", "de", "el", "es", "fi", "fr", "he", "hi",
String[] entrieValues = new String[] { "", "en", "be", "ca", "cs", "da", "de", "el", "es", "fi", "fr", "he", "hi",
"hr", "hu", "it", "ja", "ko", "lv", "nl", "pl", "ro", "ru", "sk", "sl", "sv", "sw", "zh" };
String[] entrieValues = new String[] { getString(R.string.local_map_names), getString(R.string.lang_en),
String[] entries = new String[] { getString(R.string.local_map_names), getString(R.string.lang_en),
getString(R.string.lang_be), getString(R.string.lang_ca), getString(R.string.lang_cs),
getString(R.string.lang_da), getString(R.string.lang_de), getString(R.string.lang_el),
getString(R.string.lang_es), getString(R.string.lang_fi), getString(R.string.lang_fr),

View file

@ -157,7 +157,7 @@ public class StartGPSStatus extends OsmAndAction {
// if (g.activity.length() == 0) {
PackageManager pm = mapActivity.getPackageManager();
try {
String appName = !g.paidAppName.isEmpty() &&
String appName = !g.paidAppName.equals("") &&
g.installed(mapActivity, g.paidAppName) ? g.paidAppName : g.appName;
intent = pm.getLaunchIntentForPackage(appName);
} catch (RuntimeException e) {

View file

@ -320,6 +320,9 @@ public class GeoIntentActivity extends OsmandListActivity {
} else {
matcher = Pattern.compile(pattern).matcher(schemeSpecific);
}
final String pattern2 = "([\\-0-9.]+),([\\-0-9.]+)(?:.*)"; //c:geo
final Matcher matcher2 = Pattern.compile(pattern2).matcher(schemeSpecific);
if (matcher.matches())
{
@ -333,9 +336,11 @@ public class GeoIntentActivity extends OsmandListActivity {
{
return new GeoPointSearch(lat, lon, Integer.valueOf(matcher.group(4)));
}
}
else
{
} else if (matcher2.matches()) {
final double lat = Double.valueOf(matcher2.group(1));
final double lon = Double.valueOf(matcher2.group(2));
return new GeoPointSearch(lat, lon);
} else {
return null;
}
}

View file

@ -274,7 +274,7 @@ public class SearchAddressFragment extends SherlockFragment {
String city = settings.getLastSearchedCityName();
String cityName = !Algorithms.isEmpty(postcode) ? postcode : city;
ai.objectName = settings.getLastSearchedStreet();
ai.historyName = MessageFormat.format(ctx. getString(R.string.search_history_int_streets), settings.getLastSearchedStreet(),
ai.historyName = MessageFormat.format(ctx != null ? ctx.getString(R.string.search_history_int_streets) : "", settings.getLastSearchedStreet(),
settings.getLastSearchedIntersectedStreet(), cityName);
ai.zoom = 17;
return ai;
@ -287,7 +287,7 @@ public class SearchAddressFragment extends SherlockFragment {
String cityName = !Algorithms.isEmpty(postcode) ? postcode : city;
String street = settings.getLastSearchedStreet();
ai.objectName = street;
ai.historyName = MessageFormat.format(ctx.getString(R.string.search_history_street), street, cityName);
ai.historyName = MessageFormat.format(ctx != null ? ctx.getString(R.string.search_history_street) : "", street, cityName);
ai.zoom = 16;
return ai;
}
@ -301,7 +301,7 @@ public class SearchAddressFragment extends SherlockFragment {
String street = settings.getLastSearchedStreet();
String building = settings.getLastSearchedBuilding();
ai.objectName = street + " " + building;
ai.historyName = MessageFormat.format(ctx.getString(R.string.search_history_building), building, street,
ai.historyName = MessageFormat.format(ctx != null ? ctx.getString(R.string.search_history_building) : "", building, street,
cityName);
ai.zoom = 17;
return ai;
@ -310,7 +310,7 @@ public class SearchAddressFragment extends SherlockFragment {
public static AddressInformation buildCity(Context ctx, OsmandSettings settings){
AddressInformation ai = new AddressInformation();
String city = settings.getLastSearchedCityName();
ai.historyName = MessageFormat.format(ctx.getString(R.string.search_history_city), city);
ai.historyName = MessageFormat.format(ctx != null ? ctx.getString(R.string.search_history_city) : "", city);
ai.objectName = city;
ai.zoom = 14;
return ai;

View file

@ -439,7 +439,7 @@ public class SearchTransportFragment extends SherlockFragment implements SearchA
}
public LatLon getEndStop(int position){
if(position == -1){
if(position < 0){
return lastKnownMapLocation;
}
RouteInfoLocation item = intermediateListAdapater.getItem(position);

View file

@ -85,14 +85,16 @@ public class MapViewTrackingUtilities implements OsmAndLocationListener, IMapLoc
public void updateLocation(Location location) {
showViewAngle = false;
if (mapView != null) {
RotatedTileBox tb = mapView.getCurrentRotatedTileBox();
if (isMapLinkedToLocation() && location != null) {
if (settings.AUTO_ZOOM_MAP.get() != AutoZoomMap.NONE) {
autozoom(location);
}
int currentMapRotation = settings.ROTATE_MAP.get();
boolean smallSpeed = !location.hasSpeed() || location.getSpeed() < 0.5;
boolean smallSpeed = isSmallSpeedForCompass(location);
// boolean virtualBearing = fMode && settings.SNAP_TO_ROAD.get();
showViewAngle = (!location.hasBearing() || smallSpeed);
showViewAngle = (!location.hasBearing() || smallSpeed) && (tb != null &&
tb.containsLatLon(location.getLatitude(), location.getLongitude()));
if (currentMapRotation == OsmandSettings.ROTATE_MAP_BEARING) {
if (location.hasBearing() && !smallSpeed) {
// special case when bearing equals to zero (we don't change anything)
@ -105,6 +107,10 @@ public class MapViewTrackingUtilities implements OsmAndLocationListener, IMapLoc
}
registerUnregisterSensor(location);
mapView.setLatLon(location.getLatitude(), location.getLongitude());
} else if(location != null) {
showViewAngle = (!location.hasBearing() || isSmallSpeedForCompass(location)) && (tb != null &&
tb.containsLatLon(location.getLatitude(), location.getLongitude()));
registerUnregisterSensor(location);
}
RoutingHelper routingHelper = app.getRoutingHelper();
followingMode = routingHelper.isFollowingMode();
@ -115,6 +121,10 @@ public class MapViewTrackingUtilities implements OsmAndLocationListener, IMapLoc
mapView.refreshMap();
}
}
private boolean isSmallSpeedForCompass(Location location) {
return !location.hasSpeed() || location.getSpeed() < 0.5;
}
public boolean isShowViewAngle() {

View file

@ -255,7 +255,7 @@ public class GpxImportHelper {
private String saveImport(final GPXUtilities.GPXFile gpxFile, final String fileName) {
final String warning;
if (gpxFile.isEmpty()) {
if (gpxFile.isEmpty() || fileName == null) {
warning = application.getString(R.string.error_reading_gpx);
} else {
final File importDir = application.getAppPath(IndexConstants.GPX_IMPORT_DIR);

View file

@ -167,17 +167,23 @@ public class OsMoGroupsActivity extends OsmandExpandableListActivity implements
header = getLayoutInflater().inflate(R.layout.osmo_groups_list_header, null);
getExpandableListView().addHeaderView(header);
CompoundButton trackr = (CompoundButton) header.findViewById(R.id.enable_tracker);
trackr.setChecked(osMoPlugin.getTracker().isEnabledTracker());
if(osMoPlugin != null && osMoPlugin.getTracker() != null){
trackr.setChecked(osMoPlugin.getTracker().isEnabledTracker());
}
trackr.setOnCheckedChangeListener(new OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
if(isChecked) {
osMoPlugin.getTracker().enableTracker();
if (osMoPlugin != null && osMoPlugin.getTracker() != null){
osMoPlugin.getTracker().enableTracker();
}
app.startNavigationService(NavigationService.USED_BY_LIVE);
app.getSettings().SERVICE_OFF_INTERVAL.set(0);
} else {
osMoPlugin.getTracker().disableTracker();
if (osMoPlugin != null && osMoPlugin.getTracker() != null){
osMoPlugin.getTracker().disableTracker();
}
if (app.getNavigationService() != null) {
app.getNavigationService().stopIfNeeded(app,NavigationService.USED_BY_LIVE);
}
@ -323,6 +329,7 @@ public class OsMoGroupsActivity extends OsmandExpandableListActivity implements
if(osMoPlugin.getService().isConnected()) {
adapter.synchronizeGroups();
}
osMoPlugin.setGroupsActivity(this);
}
@Override
@ -334,6 +341,7 @@ public class OsMoGroupsActivity extends OsmandExpandableListActivity implements
}
app.getLocationProvider().removeLocationListener(this);
osMoPlugin.getGroups().setUiListener(null);
osMoPlugin.setGroupsActivity(null);
}
private void enterSelectionMode(final Object o) {
@ -425,7 +433,9 @@ public class OsMoGroupsActivity extends OsmandExpandableListActivity implements
Builder bld = new AlertDialog.Builder(OsMoGroupsActivity.this);
String name = (selectedObject instanceof OsMoDevice)? ((OsMoDevice) selectedObject).getVisibleName() :
((OsMoGroup) selectedObject).getVisibleName(OsMoGroupsActivity.this);
bld.setTitle(getString(R.string.delete_confirmation_msg, name));
bld.setTitle(getString(
selectedObject instanceof OsMoDevice? R.string.delete_confirmation_msg :
R.string.osmo_leave_confirmation_msg, name));
bld.setPositiveButton(R.string .default_buttons_yes, new DialogInterface.OnClickListener() {
@Override
@ -449,8 +459,10 @@ public class OsMoGroupsActivity extends OsmandExpandableListActivity implements
if(device != null) {
Location location = device.getLastLocation();
MapActivity.getMapViewTrackingUtilities().setMapLinkedToLocation(false);
app.getSettings().setMapLocationToShow(location.getLatitude(), location.getLongitude(), app.getSettings().getLastKnownMapZoom(),
null, device.getVisibleName(), device);
if (location != null){
app.getSettings().setMapLocationToShow(location.getLatitude(), location.getLongitude(), app.getSettings().getLastKnownMapZoom(),
null, device.getVisibleName(), device);
}
OsMoPositionLayer.setFollowTrackerId(device);
MapActivity.launchMapActivityMoveToTop(OsMoGroupsActivity.this);
}
@ -492,21 +504,23 @@ public class OsMoGroupsActivity extends OsmandExpandableListActivity implements
protected void showGroupInfo(OsMoGroup group) {
protected void showGroupInfo(final OsMoGroup group) {
Builder bld = new AlertDialog.Builder(this);
bld.setTitle(R.string.osmo_group);
StringBuilder sb = new StringBuilder();
setFields(sb, R.string.osmo_group_name, group.name);
if(group.description != null) {
setFields(sb, R.string.osmo_group_description, group.description);
if (group != null){
setFields(sb, R.string.osmo_group_name, group.name);
if(group.description != null) {
setFields(sb, R.string.osmo_group_description, group.description);
}
if(group.expireTime != 0) {
setFields(sb, R.string.osmo_expire_group, new Date(group.expireTime).toString());
}
if(group.policy != null) {
setFields(sb, R.string.osmo_group_policy, group.policy);
}
setFields(sb, R.string.osmo_connect_to_group_id, group.groupId);
}
if(group.expireTime != 0) {
setFields(sb, R.string.osmo_expire_group, new Date(group.expireTime).toString());
}
if(group.policy != null) {
setFields(sb, R.string.osmo_group_policy, group.policy);
}
setFields(sb, R.string.osmo_connect_to_group_id, group.groupId);
ScrollView sv = new ScrollView(this);
TextView tv = new TextView(this);
sv.addView(tv);
@ -516,6 +530,13 @@ public class OsMoGroupsActivity extends OsmandExpandableListActivity implements
tv.setText(sb.toString());
bld.setView(sv);
bld.setPositiveButton(R.string.default_buttons_ok, null);
bld.setNegativeButton(R.string.osmo_invite, new OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
shareOsMoGroup(group.getVisibleName(app), group.getGroupId());
}
});
bld.show();
}
@ -771,6 +792,7 @@ public class OsMoGroupsActivity extends OsmandExpandableListActivity implements
if(!checkOperationIsNotRunning()) {
return ;
}
joinGroup = true;
String op = osMoPlugin.getGroups().createGroup(name.getText().toString(), onlyByInvite.isChecked(),
description.getText().toString(), policy.getText().toString());
startLongRunningOperation(op);
@ -804,11 +826,15 @@ public class OsMoGroupsActivity extends OsmandExpandableListActivity implements
if(isChecked) {
labelTracker.setText(R.string.osmo_connect_to_device_tracker_id);
labelName.setText(R.string.osmo_connect_to_device_name);
name.setVisibility(View.VISIBLE);
labelName.setVisibility(View.VISIBLE);
mgv.setVisibility(View.GONE);
} else {
labelTracker.setText(R.string.osmo_connect_to_group_id);
labelName.setText(R.string.osmo_group_name);
name.setHint(R.string.osmo_use_server_name);
name.setVisibility(View.GONE);
labelName.setVisibility(View.GONE);
mgv.setVisibility(View.VISIBLE);
}
}
@ -823,6 +849,11 @@ public class OsMoGroupsActivity extends OsmandExpandableListActivity implements
final String nameUser = name.getText().toString();
final String id = tracker.getText().toString();
final String nick = nickname.getText().toString();
if(id.length() == 0) {
app.showToastMessage(R.string.osmo_specify_tracker_id);
connectToDevice();
return;
}
if(device.isChecked()) {
OsMoDevice dev = osMoPlugin.getGroups().addConnectedDevice(id, nameUser,
ColorDialogs.getRandomColor());
@ -1120,6 +1151,7 @@ public class OsMoGroupsActivity extends OsmandExpandableListActivity implements
icon.setVisibility(View.INVISIBLE);
label.setTypeface(Typeface.DEFAULT, Typeface.ITALIC);
label.setText(model.getVisibleName());
labelTime.setText("");
} else if (location == null || mapLocation == null) {
label.setTypeface(Typeface.DEFAULT, Typeface.NORMAL);
icon.setVisibility(View.VISIBLE);
@ -1132,6 +1164,7 @@ public class OsMoGroupsActivity extends OsmandExpandableListActivity implements
draw.setColor(model.isEnabled() ? activeColor : color);
icon.setImageDrawable(draw);
label.setText(model.getVisibleName());
labelTime.setText("");
} else {
label.setTypeface(Typeface.DEFAULT, Typeface.NORMAL);
icon.setVisibility(View.VISIBLE);

View file

@ -61,8 +61,10 @@ public class OsMoPlugin extends OsmandPlugin implements MonitoringInfoControlSer
private BaseMapWidget osmoControl;
private OsMoPositionLayer olayer;
protected MapActivity mapActivity;
protected OsMoGroupsActivity groupsActivity;
private final static Log log = PlatformUtil.getLog(OsMoPlugin.class);
public OsMoPlugin(final OsmandApplication app) {
service = new OsMoService(app, this);
@ -82,6 +84,14 @@ public class OsMoPlugin extends OsmandPlugin implements MonitoringInfoControlSer
}
return true;
}
public OsMoGroupsActivity getGroupsActivity() {
return groupsActivity;
}
public void setGroupsActivity(OsMoGroupsActivity groupsActivity) {
this.groupsActivity = groupsActivity;
}
@Override
public void disable(OsmandApplication app) {

View file

@ -27,11 +27,15 @@ import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import android.app.AlertDialog;
import android.app.AlertDialog.Builder;
import android.app.Notification;
import android.app.NotificationManager;
import android.app.PendingIntent;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.DialogInterface;
import android.content.DialogInterface.OnClickListener;
import android.content.Intent;
import android.content.IntentFilter;
import android.os.AsyncTask;
@ -248,6 +252,7 @@ public class OsMoService implements OsMoReactor {
try {
// Add your data
List<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>(2);
nameValuePairs.add(new BasicNameValuePair("app", Version.getFullVersion(app)));
nameValuePairs.add(new BasicNameValuePair("key", deviceKey));
if(app.getSettings().OSMO_USER_PWD.get() != null) {
nameValuePairs.add(new BasicNameValuePair("auth", app.getSettings().OSMO_USER_PWD.get()));
@ -299,8 +304,18 @@ public class OsMoService implements OsMoReactor {
}
}
private void runNotification(String error) {
if (notification == null) {
private void runNotification(final String error) {
final OsMoGroupsActivity ga = plugin.getGroupsActivity();
if(ga != null) {
app.runInUIThread(new Runnable() {
@Override
public void run() {
showRegisterAgain(ga, app.getString(R.string.osmo_auth_error, error));
}
});
} else if (notification == null) {
Intent notificationIntent = new Intent(OSMO_REGISTER_AGAIN);
PendingIntent intent = PendingIntent.getBroadcast(app, 0, notificationIntent,
PendingIntent.FLAG_UPDATE_CURRENT);
@ -318,6 +333,20 @@ public class OsMoService implements OsMoReactor {
}
protected void showRegisterAgain(OsMoGroupsActivity ga, String msg) {
Builder bld = new AlertDialog.Builder(ga);
bld.setMessage(msg);
bld.setPositiveButton(R.string.default_buttons_ok, new OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
registerAsync();
}
});
bld.setNegativeButton(R.string.default_buttons_cancel, null);
}
private void showDialogAskToReregister(String error) {
// Builder bld = new AlertDialog.Builder(this);
// bld.setMessage(app.getString(R.string.osmo_io_error) + error);

View file

@ -439,6 +439,7 @@ public class OsMoThread {
}
public void reconnect() {
sessionInfo = null;
reconnect = true;
}
}

View file

@ -390,7 +390,7 @@ public class OsmandRasterMapsPlugin extends OsmandPlugin {
r.setMinZoom(Integer.parseInt(minZoom.getText().toString()));
r.setMaxZoom(Integer.parseInt(maxZoom.getText().toString()));
r.setEllipticYTile(elliptic.isChecked());
r.setUrlToLoad(urlToLoad.getText().toString().isEmpty() ? null : urlToLoad.getText().toString().replace("{$x}", "{1}")
r.setUrlToLoad(urlToLoad.getText().toString().equals("") ? null : urlToLoad.getText().toString().replace("{$x}", "{1}")
.replace("{$y}", "{2}").replace("{$z}", "{0}"));
if (r != null && r.getName().length() > 0) {
if (settings.installTileSource(r)) {

View file

@ -11,7 +11,6 @@ import net.osmand.plus.R;
import net.osmand.plus.TargetPointsHelper;
import net.osmand.plus.activities.MapActivity;
import net.osmand.plus.views.ContextMenuLayer.IContextMenuProvider;
import android.content.Context;
import android.content.DialogInterface;
import android.content.res.Resources;
import android.graphics.Bitmap;
@ -21,8 +20,6 @@ import android.graphics.Paint;
import android.graphics.Paint.Align;
import android.graphics.Paint.Style;
import android.graphics.PointF;
import android.util.DisplayMetrics;
import android.view.WindowManager;
public class PointNavigationLayer extends OsmandMapLayer implements IContextMenuProvider {
protected final static int DIST_TO_SHOW = 80;
@ -110,15 +107,21 @@ public class PointNavigationLayer extends OsmandMapLayer implements IContextMenu
int locationY = tb.getPixYFromLatNoRot(pointToNavigate.getLatitude());
canvas.rotate(-tb.getRotate(), locationX, locationY);
canvas.drawBitmap(targetPoint, locationX - marginX, locationY - marginY, bitmapPaint);
} else if (pointToNavigate != null && !view.getApplication().getRoutingHelper().isRouteCalculated()) {
net.osmand.Location.distanceBetween(view.getLatitude(), view.getLongitude(), pointToNavigate.getLatitude(),
pointToNavigate.getLongitude(), calculations);
float bearing = calculations[1] - 90;
float radiusBearing = DIST_TO_SHOW * tb.getDensity();
final QuadPoint cp = tb.getCenterPixelPoint();
canvas.rotate(bearing, cp.x, cp.y);
canvas.translate(-24 * tb.getDensity() + radiusBearing, -22 * tb.getDensity());
canvas.drawBitmap(arrowToDestination, cp.x, cp.y, bitmapPaint);
} else if (pointToNavigate != null) {
boolean show = !view.getApplication().getRoutingHelper().isRouteCalculated();
if(view.getSettings().SHOW_DESTINATION_ARROW.isSet()) {
show = view.getSettings().SHOW_DESTINATION_ARROW.get();
}
if (show) {
net.osmand.Location.distanceBetween(view.getLatitude(), view.getLongitude(),
pointToNavigate.getLatitude(), pointToNavigate.getLongitude(), calculations);
float bearing = calculations[1] - 90;
float radiusBearing = DIST_TO_SHOW * tb.getDensity();
final QuadPoint cp = tb.getCenterPixelPoint();
canvas.rotate(bearing, cp.x, cp.y);
canvas.translate(-24 * tb.getDensity() + radiusBearing, -22 * tb.getDensity());
canvas.drawBitmap(arrowToDestination, cp.x, cp.y, bitmapPaint);
}
}
}

View file

@ -54,6 +54,9 @@ public class TransportStopsLayer extends OsmandMapLayer implements ContextMenuLa
try {
for (int i = 0; i < objects.size(); i++) {
TransportStop n = objects.get(i);
if (n.getLocation() == null){
continue;
}
int x = (int) tb.getPixXFromLatLon(n.getLocation().getLatitude(), n.getLocation().getLongitude());
int y = (int) tb.getPixYFromLatLon(n.getLocation().getLatitude(), n.getLocation().getLongitude());
if (Math.abs(x - ex) <= radius && Math.abs(y - ey) <= radius) {

View file

@ -54,15 +54,15 @@ public class AppearanceWidgetsFactory {
}
});
// final MapWidgetRegistry.MapWidgetRegInfo showDestinationArrow = mapInfoControls.registerAppearanceWidget(R.drawable.widget_show_destination_arrow, R.string.map_widget_show_destination_arrow,
// "show_destination_arrow", view.getSettings().SHOW_DESTINATION_ARROW);
// showDestinationArrow.setStateChangeListener(new Runnable() {
// @Override
// public void run() {
// view.getSettings().SHOW_DESTINATION_ARROW.set(!view.getSettings().SHOW_DESTINATION_ARROW.get());
// mapInfoLayer.recreateControls();
// }
// });
final MapWidgetRegistry.MapWidgetRegInfo showDestinationArrow = mapInfoControls.registerAppearanceWidget(R.drawable.widget_show_destination_arrow, R.string.map_widget_show_destination_arrow,
"show_destination_arrow", view.getSettings().SHOW_DESTINATION_ARROW);
showDestinationArrow.setStateChangeListener(new Runnable() {
@Override
public void run() {
view.getSettings().SHOW_DESTINATION_ARROW.set(!view.getSettings().SHOW_DESTINATION_ARROW.get());
mapInfoLayer.recreateControls();
}
});
final MapWidgetRegistry.MapWidgetRegInfo transparent = mapInfoControls.registerAppearanceWidget(R.drawable.widget_transparent_skin, R.string.map_widget_transparent,
"transparent", view.getSettings().TRANSPARENT_MAP_THEME);