Update dialog partilly implemnented
This commit is contained in:
parent
f61b37fbcf
commit
13b4ad78b4
4 changed files with 57 additions and 32 deletions
|
@ -1,5 +1,5 @@
|
|||
<?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_version">2.2.0</string>
|
||||
<!--
|
||||
|
@ -12,10 +12,10 @@
|
|||
|
||||
<!-- Not translatable -->
|
||||
<string name="last_release">
|
||||
- New road indexes (including map data, poi, address)
|
||||
- New speed system (knots and minutes per km)
|
||||
- New context menu
|
||||
- Drawer and start with the map
|
||||
\u2022 New Wikipedia data is structured by country and contains many more points than before\n\n
|
||||
\u2022 Better route recalculation (after several attempts engine suggests a different route)\n\n
|
||||
\u2022 POI Search now supports more specific queries (like fuel type and religion specific queries)\n\n
|
||||
and more...
|
||||
</string>
|
||||
<string name="ga_api_key">UA-28342846-2</string>
|
||||
<string name="ga_dispatchPeriod">10</string>
|
||||
|
|
|
@ -18,7 +18,6 @@ import net.osmand.map.WorldRegion;
|
|||
import net.osmand.osm.AbstractPoiType;
|
||||
import net.osmand.osm.MapPoiTypes;
|
||||
import net.osmand.plus.activities.DayNightHelper;
|
||||
import net.osmand.plus.activities.HelpActivity;
|
||||
import net.osmand.plus.activities.SavingTrackHelper;
|
||||
import net.osmand.plus.download.DownloadActivity;
|
||||
import net.osmand.plus.helpers.AvoidSpecificRoads;
|
||||
|
@ -79,23 +78,23 @@ public class AppInitializer implements IProgress {
|
|||
private long startTime;
|
||||
private long startBgTime;
|
||||
private boolean appInitializing = true;
|
||||
private List<String> warnings = new ArrayList<String>();
|
||||
private List<String> warnings = new ArrayList<>();
|
||||
private String taskName;
|
||||
private List<AppInitializeListener> listeners = new ArrayList<AppInitializer.AppInitializeListener>();
|
||||
private List<AppInitializeListener> listeners = new ArrayList<>();
|
||||
private SharedPreferences startPrefs;
|
||||
|
||||
public enum InitEvents {
|
||||
FAVORITES_INITIALIZED, NATIVE_INITIALIZED,
|
||||
NATIVE_OPEN_GLINITIALIZED,
|
||||
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 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;
|
||||
// showRecentChangesDialog = true;
|
||||
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;
|
||||
return true;
|
||||
}
|
||||
|
@ -369,9 +364,7 @@ public class AppInitializer implements IProgress {
|
|||
if (routingXml.exists() && routingXml.canRead()) {
|
||||
try {
|
||||
return RoutingConfiguration.parseFromInputStream(new FileInputStream(routingXml));
|
||||
} catch (XmlPullParserException e) {
|
||||
throw new IllegalStateException(e);
|
||||
} catch (IOException e) {
|
||||
} catch (XmlPullParserException | IOException e) {
|
||||
throw new IllegalStateException(e);
|
||||
}
|
||||
} else {
|
||||
|
@ -662,8 +655,6 @@ public class AppInitializer implements IProgress {
|
|||
}
|
||||
}
|
||||
}, "Initializing app").start();
|
||||
;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -17,7 +17,6 @@ import android.os.Message;
|
|||
import android.support.v4.app.NotificationCompat.Builder;
|
||||
import android.support.v4.widget.DrawerLayout;
|
||||
import android.support.v7.app.NotificationCompat;
|
||||
import android.util.Log;
|
||||
import android.view.Gravity;
|
||||
import android.view.KeyEvent;
|
||||
import android.view.MotionEvent;
|
||||
|
@ -25,20 +24,18 @@ import android.view.View;
|
|||
import android.view.ViewStub;
|
||||
import android.view.Window;
|
||||
import android.view.WindowManager;
|
||||
import android.widget.AdapterView;
|
||||
import android.widget.ArrayAdapter;
|
||||
import android.widget.ListView;
|
||||
import android.widget.ProgressBar;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import net.osmand.Location;
|
||||
import net.osmand.PlatformUtil;
|
||||
import net.osmand.StateChangedListener;
|
||||
import net.osmand.access.AccessibilityPlugin;
|
||||
import net.osmand.access.AccessibleActivity;
|
||||
import net.osmand.access.AccessibleToast;
|
||||
import net.osmand.access.MapAccessibilityActions;
|
||||
import net.osmand.core.android.AtlasMapRendererView;
|
||||
import net.osmand.data.FavouritePoint;
|
||||
import net.osmand.data.LatLon;
|
||||
import net.osmand.data.PointDescription;
|
||||
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.ApplicationMode;
|
||||
import net.osmand.plus.BusyIndicator;
|
||||
import net.osmand.plus.ContextMenuAdapter;
|
||||
import net.osmand.plus.FirstUsageFragment;
|
||||
import net.osmand.plus.OsmAndConstants;
|
||||
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.MapViewTrackingUtilities;
|
||||
import net.osmand.plus.dashboard.DashboardOnMap;
|
||||
import net.osmand.plus.dialogs.WhatsNewDialogFragment;
|
||||
import net.osmand.plus.helpers.GpxImportHelper;
|
||||
import net.osmand.plus.helpers.WakeLockHelper;
|
||||
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.util.Algorithms;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Random;
|
||||
import java.util.regex.Matcher;
|
||||
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_DELAY = 500;
|
||||
|
||||
private static final Log LOG = PlatformUtil.getLog(MapActivity.class);
|
||||
|
||||
private static MapViewTrackingUtilities mapViewTrackingUtilities;
|
||||
|
||||
/**
|
||||
|
@ -122,7 +122,7 @@ public class MapActivity extends AccessibleActivity {
|
|||
|
||||
private Dialog progressDlg = null;
|
||||
|
||||
private List<DialogProvider> dialogProviders = new ArrayList<DialogProvider>(2);
|
||||
private List<DialogProvider> dialogProviders = new ArrayList<>(2);
|
||||
private StateChangedListener<ApplicationMode> applicationModeListener;
|
||||
private GpxImportHelper gpxImportHelper;
|
||||
private WakeLockHelper wakeLockHelper;
|
||||
|
@ -170,7 +170,9 @@ public class MapActivity extends AccessibleActivity {
|
|||
|
||||
mapView = new OsmandMapTileView(this, getWindow().getDecorView().getWidth(),
|
||||
getWindow().getDecorView().getHeight());
|
||||
app.getAppInitializer().checkAppVersionChanged(this);
|
||||
if(app.getAppInitializer().checkAppVersionChanged(this)) {
|
||||
new WhatsNewDialogFragment().show(getSupportFragmentManager(), null);
|
||||
}
|
||||
mapActions = new MapActivityActions(this);
|
||||
mapLayers = new MapActivityLayers(this);
|
||||
if (mapViewTrackingUtilities == null) {
|
||||
|
@ -350,7 +352,7 @@ public class MapActivity extends AccessibleActivity {
|
|||
|
||||
@Override
|
||||
public Object onRetainCustomNonConfigurationInstance() {
|
||||
LinkedHashMap<String, Object> l = new LinkedHashMap<String, Object>();
|
||||
LinkedHashMap<String, Object> l = new LinkedHashMap<>();
|
||||
for (OsmandMapLayer ml : mapView.getLayers()) {
|
||||
ml.onRetainNonConfigurationInstance(l);
|
||||
}
|
||||
|
@ -769,8 +771,6 @@ public class MapActivity extends AccessibleActivity {
|
|||
|
||||
protected void onPostExecute(Void result) {
|
||||
}
|
||||
|
||||
;
|
||||
}.execute((Void) null);
|
||||
|
||||
}
|
||||
|
@ -916,6 +916,7 @@ public class MapActivity extends AccessibleActivity {
|
|||
settings.setMapLocationToShow(lt, ln, z, new PointDescription(
|
||||
PointDescription.POINT_TYPE_MARKER, getString(R.string.shared_location)));
|
||||
} catch (NumberFormatException e) {
|
||||
LOG.error("error", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue