Merge remote-tracking branch 'origin/master'

This commit is contained in:
Weblate 2015-10-28 15:09:40 +01:00
commit a9c535bbc2
4 changed files with 57 additions and 32 deletions

View file

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8" standalone="no"?> <?xml version="1.0" encoding="utf-8" standalone="no"?>
<resources xmlns:tools="http://schemas.android.com/tools"> <resources>
<string name="app_name">OsmAnd~</string> <string name="app_name">OsmAnd~</string>
<string name="app_version">2.2.0</string> <string name="app_version">2.2.0</string>
<!-- <!--
@ -12,10 +12,10 @@
<!-- Not translatable --> <!-- Not translatable -->
<string name="last_release"> <string name="last_release">
- New road indexes (including map data, poi, address) \u2022 New Wikipedia data is structured by country and contains many more points than before\n\n
- New speed system (knots and minutes per km) \u2022 Better route recalculation (after several attempts engine suggests a different route)\n\n
- New context menu \u2022 POI Search now supports more specific queries (like fuel type and religion specific queries)\n\n
- Drawer and start with the map and more...
</string> </string>
<string name="ga_api_key">UA-28342846-2</string> <string name="ga_api_key">UA-28342846-2</string>
<string name="ga_dispatchPeriod">10</string> <string name="ga_dispatchPeriod">10</string>

View file

@ -18,7 +18,6 @@ import net.osmand.map.WorldRegion;
import net.osmand.osm.AbstractPoiType; import net.osmand.osm.AbstractPoiType;
import net.osmand.osm.MapPoiTypes; import net.osmand.osm.MapPoiTypes;
import net.osmand.plus.activities.DayNightHelper; import net.osmand.plus.activities.DayNightHelper;
import net.osmand.plus.activities.HelpActivity;
import net.osmand.plus.activities.SavingTrackHelper; import net.osmand.plus.activities.SavingTrackHelper;
import net.osmand.plus.download.DownloadActivity; import net.osmand.plus.download.DownloadActivity;
import net.osmand.plus.helpers.AvoidSpecificRoads; import net.osmand.plus.helpers.AvoidSpecificRoads;
@ -79,23 +78,23 @@ public class AppInitializer implements IProgress {
private long startTime; private long startTime;
private long startBgTime; private long startBgTime;
private boolean appInitializing = true; private boolean appInitializing = true;
private List<String> warnings = new ArrayList<String>(); private List<String> warnings = new ArrayList<>();
private String taskName; private String taskName;
private List<AppInitializeListener> listeners = new ArrayList<AppInitializer.AppInitializeListener>(); private List<AppInitializeListener> listeners = new ArrayList<>();
private SharedPreferences startPrefs; private SharedPreferences startPrefs;
public enum InitEvents { public enum InitEvents {
FAVORITES_INITIALIZED, NATIVE_INITIALIZED, FAVORITES_INITIALIZED, NATIVE_INITIALIZED,
NATIVE_OPEN_GLINITIALIZED, NATIVE_OPEN_GLINITIALIZED,
TASK_CHANGED, MAPS_INITIALIZED, POI_TYPES_INITIALIZED, ASSETS_COPIED, INIT_RENDERERS, TASK_CHANGED, MAPS_INITIALIZED, POI_TYPES_INITIALIZED, ASSETS_COPIED, INIT_RENDERERS,
RESTORE_BACKUPS, INDEX_REGION_BOUNDARIES, SAVE_GPX_TRACKS, LOAD_GPX_TRACKS; RESTORE_BACKUPS, INDEX_REGION_BOUNDARIES, SAVE_GPX_TRACKS, LOAD_GPX_TRACKS
} }
public interface AppInitializeListener { public interface AppInitializeListener {
public void onProgress(AppInitializer init, InitEvents event); void onProgress(AppInitializer init, InitEvents event);
public void onFinish(AppInitializer init); void onFinish(AppInitializer init);
} }
@ -167,10 +166,6 @@ public class AppInitializer implements IProgress {
boolean showRecentChangesDialog = !firstTime && appVersionChanged; boolean showRecentChangesDialog = !firstTime && appVersionChanged;
// showRecentChangesDialog = true; // showRecentChangesDialog = true;
if (showRecentChangesDialog && !activityChangesShowed) { if (showRecentChangesDialog && !activityChangesShowed) {
final Intent helpIntent = new Intent(activity, HelpActivity.class);
helpIntent.putExtra(HelpActivity.TITLE, Version.getAppVersion(app));
helpIntent.putExtra(HelpActivity.URL, LATEST_CHANGES_URL);
activity.startActivity(helpIntent);
activityChangesShowed = true; activityChangesShowed = true;
return true; return true;
} }
@ -369,9 +364,7 @@ public class AppInitializer implements IProgress {
if (routingXml.exists() && routingXml.canRead()) { if (routingXml.exists() && routingXml.canRead()) {
try { try {
return RoutingConfiguration.parseFromInputStream(new FileInputStream(routingXml)); return RoutingConfiguration.parseFromInputStream(new FileInputStream(routingXml));
} catch (XmlPullParserException e) { } catch (XmlPullParserException | IOException e) {
throw new IllegalStateException(e);
} catch (IOException e) {
throw new IllegalStateException(e); throw new IllegalStateException(e);
} }
} else { } else {
@ -662,8 +655,6 @@ public class AppInitializer implements IProgress {
} }
} }
}, "Initializing app").start(); }, "Initializing app").start();
;
} }

View file

@ -17,7 +17,6 @@ import android.os.Message;
import android.support.v4.app.NotificationCompat.Builder; import android.support.v4.app.NotificationCompat.Builder;
import android.support.v4.widget.DrawerLayout; import android.support.v4.widget.DrawerLayout;
import android.support.v7.app.NotificationCompat; import android.support.v7.app.NotificationCompat;
import android.util.Log;
import android.view.Gravity; import android.view.Gravity;
import android.view.KeyEvent; import android.view.KeyEvent;
import android.view.MotionEvent; import android.view.MotionEvent;
@ -25,20 +24,18 @@ import android.view.View;
import android.view.ViewStub; import android.view.ViewStub;
import android.view.Window; import android.view.Window;
import android.view.WindowManager; import android.view.WindowManager;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.ListView;
import android.widget.ProgressBar; import android.widget.ProgressBar;
import android.widget.TextView; import android.widget.TextView;
import android.widget.Toast; import android.widget.Toast;
import net.osmand.Location; import net.osmand.Location;
import net.osmand.PlatformUtil;
import net.osmand.StateChangedListener; import net.osmand.StateChangedListener;
import net.osmand.access.AccessibilityPlugin; import net.osmand.access.AccessibilityPlugin;
import net.osmand.access.AccessibleActivity; import net.osmand.access.AccessibleActivity;
import net.osmand.access.AccessibleToast; import net.osmand.access.AccessibleToast;
import net.osmand.access.MapAccessibilityActions; import net.osmand.access.MapAccessibilityActions;
import net.osmand.core.android.AtlasMapRendererView; import net.osmand.core.android.AtlasMapRendererView;
import net.osmand.data.FavouritePoint;
import net.osmand.data.LatLon; import net.osmand.data.LatLon;
import net.osmand.data.PointDescription; import net.osmand.data.PointDescription;
import net.osmand.data.QuadPoint; import net.osmand.data.QuadPoint;
@ -50,7 +47,6 @@ import net.osmand.plus.AppInitializer.AppInitializeListener;
import net.osmand.plus.AppInitializer.InitEvents; import net.osmand.plus.AppInitializer.InitEvents;
import net.osmand.plus.ApplicationMode; import net.osmand.plus.ApplicationMode;
import net.osmand.plus.BusyIndicator; import net.osmand.plus.BusyIndicator;
import net.osmand.plus.ContextMenuAdapter;
import net.osmand.plus.FirstUsageFragment; import net.osmand.plus.FirstUsageFragment;
import net.osmand.plus.OsmAndConstants; import net.osmand.plus.OsmAndConstants;
import net.osmand.plus.OsmandApplication; import net.osmand.plus.OsmandApplication;
@ -64,6 +60,7 @@ import net.osmand.plus.activities.search.SearchActivity;
import net.osmand.plus.base.FailSafeFuntions; import net.osmand.plus.base.FailSafeFuntions;
import net.osmand.plus.base.MapViewTrackingUtilities; import net.osmand.plus.base.MapViewTrackingUtilities;
import net.osmand.plus.dashboard.DashboardOnMap; import net.osmand.plus.dashboard.DashboardOnMap;
import net.osmand.plus.dialogs.WhatsNewDialogFragment;
import net.osmand.plus.helpers.GpxImportHelper; import net.osmand.plus.helpers.GpxImportHelper;
import net.osmand.plus.helpers.WakeLockHelper; import net.osmand.plus.helpers.WakeLockHelper;
import net.osmand.plus.mapcontextmenu.MapContextMenu; import net.osmand.plus.mapcontextmenu.MapContextMenu;
@ -83,12 +80,13 @@ import net.osmand.plus.views.corenative.NativeCoreContext;
import net.osmand.render.RenderingRulesStorage; import net.osmand.render.RenderingRulesStorage;
import net.osmand.util.Algorithms; import net.osmand.util.Algorithms;
import org.apache.commons.logging.Log;
import java.io.File; import java.io.File;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.LinkedHashMap; import java.util.LinkedHashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Random;
import java.util.regex.Matcher; import java.util.regex.Matcher;
import java.util.regex.Pattern; import java.util.regex.Pattern;
@ -97,6 +95,8 @@ public class MapActivity extends AccessibleActivity {
private static final int LONG_KEYPRESS_MSG_ID = OsmAndConstants.UI_HANDLER_MAP_VIEW + 2; private static final int LONG_KEYPRESS_MSG_ID = OsmAndConstants.UI_HANDLER_MAP_VIEW + 2;
private static final int LONG_KEYPRESS_DELAY = 500; private static final int LONG_KEYPRESS_DELAY = 500;
private static final Log LOG = PlatformUtil.getLog(MapActivity.class);
private static MapViewTrackingUtilities mapViewTrackingUtilities; private static MapViewTrackingUtilities mapViewTrackingUtilities;
/** /**
@ -122,7 +122,7 @@ public class MapActivity extends AccessibleActivity {
private Dialog progressDlg = null; private Dialog progressDlg = null;
private List<DialogProvider> dialogProviders = new ArrayList<DialogProvider>(2); private List<DialogProvider> dialogProviders = new ArrayList<>(2);
private StateChangedListener<ApplicationMode> applicationModeListener; private StateChangedListener<ApplicationMode> applicationModeListener;
private GpxImportHelper gpxImportHelper; private GpxImportHelper gpxImportHelper;
private WakeLockHelper wakeLockHelper; private WakeLockHelper wakeLockHelper;
@ -170,7 +170,9 @@ public class MapActivity extends AccessibleActivity {
mapView = new OsmandMapTileView(this, getWindow().getDecorView().getWidth(), mapView = new OsmandMapTileView(this, getWindow().getDecorView().getWidth(),
getWindow().getDecorView().getHeight()); getWindow().getDecorView().getHeight());
app.getAppInitializer().checkAppVersionChanged(this); if(app.getAppInitializer().checkAppVersionChanged(this)) {
new WhatsNewDialogFragment().show(getSupportFragmentManager(), null);
}
mapActions = new MapActivityActions(this); mapActions = new MapActivityActions(this);
mapLayers = new MapActivityLayers(this); mapLayers = new MapActivityLayers(this);
if (mapViewTrackingUtilities == null) { if (mapViewTrackingUtilities == null) {
@ -350,7 +352,7 @@ public class MapActivity extends AccessibleActivity {
@Override @Override
public Object onRetainCustomNonConfigurationInstance() { public Object onRetainCustomNonConfigurationInstance() {
LinkedHashMap<String, Object> l = new LinkedHashMap<String, Object>(); LinkedHashMap<String, Object> l = new LinkedHashMap<>();
for (OsmandMapLayer ml : mapView.getLayers()) { for (OsmandMapLayer ml : mapView.getLayers()) {
ml.onRetainNonConfigurationInstance(l); ml.onRetainNonConfigurationInstance(l);
} }
@ -769,8 +771,6 @@ public class MapActivity extends AccessibleActivity {
protected void onPostExecute(Void result) { protected void onPostExecute(Void result) {
} }
;
}.execute((Void) null); }.execute((Void) null);
} }
@ -916,6 +916,7 @@ public class MapActivity extends AccessibleActivity {
settings.setMapLocationToShow(lt, ln, z, new PointDescription( settings.setMapLocationToShow(lt, ln, z, new PointDescription(
PointDescription.POINT_TYPE_MARKER, getString(R.string.shared_location))); PointDescription.POINT_TYPE_MARKER, getString(R.string.shared_location)));
} catch (NumberFormatException e) { } catch (NumberFormatException e) {
LOG.error("error", e);
} }
} }
} }

View file

@ -0,0 +1,33 @@
package net.osmand.plus.dialogs;
import android.app.Dialog;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.v4.app.DialogFragment;
import android.support.v7.app.AlertDialog;
import net.osmand.PlatformUtil;
import net.osmand.plus.OsmandApplication;
import net.osmand.plus.R;
import net.osmand.plus.Version;
import org.apache.commons.logging.Log;
public class WhatsNewDialogFragment extends DialogFragment {
private static final Log LOG = PlatformUtil.getLog(WhatsNewDialogFragment.class);
private static final String FILE_ANDROID_ASSET_HELP = "file:///android_asset/help/";
@NonNull
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
final OsmandApplication osmandApplication = (OsmandApplication) getActivity().getApplication();
final String appVersion = Version.getAppVersion(osmandApplication);
builder.setTitle("What's new in " + appVersion)
.setMessage(getString(R.string.last_release))
.setNegativeButton(R.string.shared_string_close, null);
// TODO: 10/28/15 Implement
builder.setPositiveButton("Read more", null);
return builder.create();
}
}