Merge branch 'r2.8' of ssh://github.com/osmandapp/Osmand into marker_menu_on_map
|
@ -39,10 +39,10 @@ android {
|
|||
defaultConfig {
|
||||
minSdkVersion System.getenv("MIN_SDK_VERSION") ? System.getenv("MIN_SDK_VERSION").toInteger() : 14
|
||||
targetSdkVersion 23
|
||||
versionCode 270
|
||||
versionCode 280
|
||||
versionCode System.getenv("APK_NUMBER_VERSION") ? System.getenv("APK_NUMBER_VERSION").toInteger() : versionCode
|
||||
multiDexEnabled true
|
||||
versionName "2.7.0"
|
||||
versionName "2.8.0"
|
||||
versionName System.getenv("APK_VERSION")? System.getenv("APK_VERSION").toString(): versionName
|
||||
versionName System.getenv("APK_VERSION_SUFFIX")? versionName + System.getenv("APK_VERSION_SUFFIX").toString(): versionName
|
||||
}
|
||||
|
|
Before Width: | Height: | Size: 4.6 KiB After Width: | Height: | Size: 5 KiB |
Before Width: | Height: | Size: 4.8 KiB After Width: | Height: | Size: 5.2 KiB |
Before Width: | Height: | Size: 3.5 KiB After Width: | Height: | Size: 3.8 KiB |
Before Width: | Height: | Size: 3.6 KiB After Width: | Height: | Size: 3.9 KiB |
Before Width: | Height: | Size: 6.1 KiB After Width: | Height: | Size: 6.6 KiB |
Before Width: | Height: | Size: 6.4 KiB After Width: | Height: | Size: 6.8 KiB |
Before Width: | Height: | Size: 8.9 KiB After Width: | Height: | Size: 9.6 KiB |
Before Width: | Height: | Size: 9.3 KiB After Width: | Height: | Size: 10 KiB |
Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 13 KiB |
Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 14 KiB |
|
@ -34,6 +34,7 @@ public class OsmLiveActivity extends AbstractDownloadActivity implements Downloa
|
|||
private LiveUpdatesFragmentPagerAdapter pagerAdapter;
|
||||
private InAppHelper inAppHelper;
|
||||
private boolean openSubscription;
|
||||
private GetLastUpdateDateTask getLastUpdateDateTask;
|
||||
private static final String URL = "https://osmand.net/api/osmlive_status";
|
||||
|
||||
public InAppHelper getInAppHelper() {
|
||||
|
@ -53,42 +54,6 @@ public class OsmLiveActivity extends AbstractDownloadActivity implements Downloa
|
|||
inAppHelper = null;
|
||||
}
|
||||
|
||||
new AsyncTask<Void, Void, String>() {
|
||||
|
||||
@Override
|
||||
protected void onPreExecute() {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String doInBackground(Void... params) {
|
||||
try {
|
||||
return AndroidNetworkUtils.sendRequest(getMyApplication(), URL, null, "Requesting map updates info...", false, false);
|
||||
} catch (Exception e) {
|
||||
LOG.error("Error: " + "Requesting map updates info error", e);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPostExecute(String response) {
|
||||
if (response != null) {
|
||||
ActionBar actionBar = getSupportActionBar();
|
||||
if (actionBar != null) {
|
||||
SimpleDateFormat source = new SimpleDateFormat("yyyy-MM-dd HH:mm", Locale.US);
|
||||
source.setTimeZone(TimeZone.getTimeZone("UTC"));
|
||||
SimpleDateFormat dest = new SimpleDateFormat("yyyy-MM-dd HH:mm", Locale.US);
|
||||
dest.setTimeZone(TimeZone.getDefault());
|
||||
try {
|
||||
Date parsed = source.parse(response);
|
||||
actionBar.setSubtitle(dest.format(parsed));
|
||||
} catch (ParseException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}.execute();
|
||||
|
||||
Intent intent = getIntent();
|
||||
if (intent != null && intent.getExtras() != null) {
|
||||
openSubscription = intent.getExtras().getBoolean(OPEN_SUBSCRIPTION_INTENT_PARAM, false);
|
||||
|
@ -101,6 +66,9 @@ public class OsmLiveActivity extends AbstractDownloadActivity implements Downloa
|
|||
final TabLayout tabLayout = (TabLayout) findViewById(R.id.tab_layout);
|
||||
tabLayout.setTabMode(TabLayout.MODE_SCROLLABLE);
|
||||
tabLayout.setupWithViewPager(viewPager);
|
||||
|
||||
getLastUpdateDateTask = new GetLastUpdateDateTask();
|
||||
getLastUpdateDateTask.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -137,6 +105,9 @@ public class OsmLiveActivity extends AbstractDownloadActivity implements Downloa
|
|||
if (inAppHelper != null) {
|
||||
inAppHelper.stop();
|
||||
}
|
||||
if (getLastUpdateDateTask != null) {
|
||||
getLastUpdateDateTask.cancel(true);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -158,6 +129,38 @@ public class OsmLiveActivity extends AbstractDownloadActivity implements Downloa
|
|||
return openSubscription;
|
||||
}
|
||||
|
||||
private class GetLastUpdateDateTask extends AsyncTask<Void, Void, String> {
|
||||
|
||||
@Override
|
||||
protected String doInBackground(Void... params) {
|
||||
try {
|
||||
return AndroidNetworkUtils.sendRequest(getMyApplication(), URL, null, "Requesting map updates info...", false, false);
|
||||
} catch (Exception e) {
|
||||
LOG.error("Error: " + "Requesting map updates info error", e);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPostExecute(String response) {
|
||||
if (response != null) {
|
||||
ActionBar actionBar = getSupportActionBar();
|
||||
if (actionBar != null) {
|
||||
SimpleDateFormat source = new SimpleDateFormat("yyyy-MM-dd HH:mm", Locale.US);
|
||||
source.setTimeZone(TimeZone.getTimeZone("UTC"));
|
||||
SimpleDateFormat dest = new SimpleDateFormat("yyyy-MM-dd HH:mm", Locale.US);
|
||||
dest.setTimeZone(TimeZone.getDefault());
|
||||
try {
|
||||
Date parsed = source.parse(response);
|
||||
actionBar.setSubtitle(dest.format(parsed));
|
||||
} catch (ParseException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static class LiveUpdatesFragmentPagerAdapter extends FragmentPagerAdapter {
|
||||
private final Fragment[] fragments = new Fragment[] { new LiveUpdatesFragment(), new ReportsFragment() };
|
||||
private static final int[] titleIds = new int[] { LiveUpdatesFragment.TITLE, ReportsFragment.TITLE };
|
||||
|
|
|
@ -787,6 +787,7 @@ public class MapContextMenuFragment extends Fragment implements DownloadEvents {
|
|||
progressTitle.setText(titleProgressController.caption);
|
||||
progressBar.setIndeterminate(titleProgressController.indeterminate);
|
||||
progressBar.setProgress(titleProgressController.progress);
|
||||
progressBar.setVisibility(titleProgressController.progressVisible ? View.VISIBLE : View.GONE);
|
||||
|
||||
final ImageView progressButton = (ImageView) view.findViewById(R.id.progressButton);
|
||||
progressButton.setVisibility(titleProgressController.buttonVisible ? View.VISIBLE : View.GONE);
|
||||
|
|
|
@ -440,7 +440,9 @@ public abstract class MenuController extends BaseMenuController {
|
|||
leftDownloadButtonController.visible = !downloaded;
|
||||
leftDownloadButtonController.leftIconId = R.drawable.ic_action_import;
|
||||
|
||||
boolean downloadIndexes = getMapActivity().getMyApplication().getSettings().isInternetConnectionAvailable()
|
||||
boolean internetConnectionAvailable =
|
||||
getMapActivity().getMyApplication().getSettings().isInternetConnectionAvailable();
|
||||
boolean downloadIndexes = internetConnectionAvailable
|
||||
&& !downloadThread.getIndexes().isDownloadedFromInternet
|
||||
&& !downloadThread.getIndexes().downloadFromInternetFailed;
|
||||
|
||||
|
@ -470,6 +472,9 @@ public abstract class MenuController extends BaseMenuController {
|
|||
} else if (downloadIndexes) {
|
||||
titleProgressController.setIndexesDownloadMode();
|
||||
titleProgressController.visible = true;
|
||||
} else if (!internetConnectionAvailable) {
|
||||
titleProgressController.setNoInternetConnectionMode();
|
||||
titleProgressController.visible = true;
|
||||
} else {
|
||||
titleProgressController.visible = false;
|
||||
}
|
||||
|
@ -507,16 +512,25 @@ public abstract class MenuController extends BaseMenuController {
|
|||
public int progress = 0;
|
||||
public boolean indeterminate;
|
||||
public boolean visible;
|
||||
public boolean progressVisible;
|
||||
public boolean buttonVisible;
|
||||
|
||||
public void setIndexesDownloadMode() {
|
||||
caption = getMapActivity().getString(R.string.downloading_list_indexes);
|
||||
indeterminate = true;
|
||||
progressVisible = true;
|
||||
buttonVisible = false;
|
||||
}
|
||||
|
||||
public void setNoInternetConnectionMode() {
|
||||
caption = getMapActivity().getString(R.string.no_index_file_to_download);
|
||||
progressVisible = false;
|
||||
buttonVisible = false;
|
||||
}
|
||||
|
||||
public void setMapDownloadMode() {
|
||||
indeterminate = false;
|
||||
progressVisible = true;
|
||||
buttonVisible = true;
|
||||
}
|
||||
|
||||
|
|
|
@ -353,7 +353,9 @@ public class MapDataMenuController extends MenuController {
|
|||
topRightTitleButtonController.visible = (otherIndexItems != null && otherIndexItems.size() > 0)
|
||||
|| (otherLocalIndexInfos != null && otherLocalIndexInfos.size() > 0);
|
||||
|
||||
boolean downloadIndexes = getMapActivity().getMyApplication().getSettings().isInternetConnectionAvailable()
|
||||
boolean internetConnectionAvailable =
|
||||
getMapActivity().getMyApplication().getSettings().isInternetConnectionAvailable();
|
||||
boolean downloadIndexes = internetConnectionAvailable
|
||||
&& !downloadThread.getIndexes().isDownloadedFromInternet
|
||||
&& !downloadThread.getIndexes().downloadFromInternetFailed;
|
||||
|
||||
|
@ -383,6 +385,9 @@ public class MapDataMenuController extends MenuController {
|
|||
} else if (downloadIndexes) {
|
||||
titleProgressController.setIndexesDownloadMode();
|
||||
titleProgressController.visible = true;
|
||||
} else if (!internetConnectionAvailable) {
|
||||
titleProgressController.setNoInternetConnectionMode();
|
||||
titleProgressController.visible = true;
|
||||
} else {
|
||||
titleProgressController.visible = false;
|
||||
}
|
||||
|
|
|
@ -72,7 +72,11 @@ public class MapMarkerSelectionFragment extends BaseOsmAndDialogFragment {
|
|||
LatLon myLoc = l == null ? null : new LatLon(l.getLatitude(), l.getLongitude());
|
||||
useCenter = !mapLinked;
|
||||
loc = (useCenter ? mw : myLoc);
|
||||
heading = useCenter ? -mapRotation : head;
|
||||
if (useCenter) {
|
||||
heading = -mapRotation;
|
||||
} else {
|
||||
heading = head;
|
||||
}
|
||||
}
|
||||
}
|
||||
nightMode = !app.getSettings().isLightContent();
|
||||
|
|
|
@ -55,6 +55,9 @@ public class MapMarkersActiveFragment extends Fragment implements OsmAndCompassL
|
|||
@Override
|
||||
public void onItemClick(View view) {
|
||||
int pos = recyclerView.getChildAdapterPosition(view);
|
||||
if (pos == RecyclerView.NO_POSITION) {
|
||||
return;
|
||||
}
|
||||
MapMarker marker = adapter.getItem(pos);
|
||||
mapActivity.getMyApplication().getSettings()
|
||||
.setMapLocationToShow(marker.getLatitude(), marker.getLongitude(), 15, null, false, null);
|
||||
|
|
|
@ -184,6 +184,9 @@ public class MapMarkersHistoryFragment extends Fragment implements MapMarkersHel
|
|||
@Override
|
||||
public void onItemClick(View view) {
|
||||
int pos = recyclerView.getChildAdapterPosition(view);
|
||||
if (pos == RecyclerView.NO_POSITION) {
|
||||
return;
|
||||
}
|
||||
Object item = adapter.getItem(pos);
|
||||
if (item instanceof MapMarker) {
|
||||
MapMarker marker = (MapMarker) item;
|
||||
|
|
|
@ -676,7 +676,8 @@ public class MapControlsLayer extends OsmandMapLayer {
|
|||
public void switchMapControlsVisibility() {
|
||||
if (app.getRoutingHelper().isFollowingMode() || app.getRoutingHelper().isPauseNavigation()
|
||||
|| mapActivity.getMeasurementToolFragment() != null
|
||||
|| mapActivity.getPlanRouteFragment() != null) {
|
||||
|| mapActivity.getPlanRouteFragment() != null
|
||||
|| mapActivity.getMapLayers().getRulerControlLayer().rulerModeOn()) {
|
||||
return;
|
||||
}
|
||||
if (isMapControlsVisible()) {
|
||||
|
|
|
@ -234,7 +234,7 @@ public class RulerControlLayer extends OsmandMapLayer {
|
|||
}
|
||||
}
|
||||
|
||||
private boolean rulerModeOn() {
|
||||
public boolean rulerModeOn() {
|
||||
return mapActivity.getMapLayers().getMapWidgetRegistry().isVisible("ruler") &&
|
||||
rightWidgetsPanel.getVisibility() == View.VISIBLE;
|
||||
}
|
||||
|
|