Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
a2eafddcb0
28 changed files with 228 additions and 80 deletions
|
@ -116,8 +116,8 @@ public class NativeLibrary {
|
|||
return getRouteDataObjects(rs.region.routeReg, rs.nativeHandler, x31, y31);
|
||||
}
|
||||
|
||||
public boolean initMapFile(String filePath) {
|
||||
return initBinaryMapFile(filePath);
|
||||
public boolean initMapFile(String filePath, boolean useLive) {
|
||||
return initBinaryMapFile(filePath, useLive);
|
||||
}
|
||||
|
||||
public boolean initCacheMapFile(String filePath) {
|
||||
|
@ -160,7 +160,7 @@ public class NativeLibrary {
|
|||
|
||||
protected static native void deleteSearchResult(long searchResultHandle);
|
||||
|
||||
protected static native boolean initBinaryMapFile(String filePath);
|
||||
protected static native boolean initBinaryMapFile(String filePath, boolean useLive);
|
||||
|
||||
protected static native boolean initCacheMapFiles(String filePath);
|
||||
|
||||
|
|
|
@ -171,6 +171,14 @@ public class GeoPointParserUtil {
|
|||
assertGeoPoint(actual, new GeoParsedPoint(qstr));
|
||||
assertUrlEquals(url, actual.getGeoUriString());
|
||||
|
||||
// geo:?q=Paris
|
||||
qstr = "Paris";
|
||||
url = "geo:?q=" + URLEncoder.encode(qstr);
|
||||
System.out.println("url: " + url);
|
||||
actual = GeoPointParserUtil.parse(url);
|
||||
assertGeoPoint(actual, new GeoParsedPoint(qstr));
|
||||
assertUrlEquals("geo:0,0?q=" + URLEncoder.encode(qstr), actual.getGeoUriString());
|
||||
|
||||
// geo:0,0?q=760 West Genesee Street Syracuse NY 13204
|
||||
qstr = "760 West Genesee Street Syracuse NY 13204";
|
||||
url = "geo:0,0?q=" + qstr;
|
||||
|
@ -1247,11 +1255,12 @@ public class GeoPointParserUtil {
|
|||
final Pattern positionPattern = Pattern.compile(
|
||||
"([+-]?\\d+(?:\\.\\d+)?),\\s?([+-]?\\d+(?:\\.\\d+)?)");
|
||||
final Matcher positionMatcher = positionPattern.matcher(positionPart);
|
||||
if (!positionMatcher.find()) {
|
||||
return null;
|
||||
double lat = 0.0;
|
||||
double lon = 0.0;
|
||||
if (positionMatcher.find()) {
|
||||
lat = Double.valueOf(positionMatcher.group(1));
|
||||
lon = Double.valueOf(positionMatcher.group(2));
|
||||
}
|
||||
double lat = Double.valueOf(positionMatcher.group(1));
|
||||
double lon = Double.valueOf(positionMatcher.group(2));
|
||||
|
||||
int zoom = GeoParsedPoint.NO_ZOOM;
|
||||
String searchRequest = null;
|
||||
|
|
|
@ -46,11 +46,14 @@
|
|||
android:layout_height="match_parent"
|
||||
android:fitsSystemWindows="true">
|
||||
|
||||
<include layout="@layout/map_hud_top"/>
|
||||
<include layout="@layout/map_hud_top"
|
||||
android:id="@+id/MapHudButtonsOverlayTop"/>
|
||||
|
||||
<include layout="@layout/map_hud_bottom"/>
|
||||
<include layout="@layout/map_hud_bottom"
|
||||
android:id="@+id/MapHudButtonsOverlayBottom"/>
|
||||
|
||||
<include layout="@layout/map_hud_quick_actions"/>
|
||||
<include layout="@layout/map_hud_quick_actions"
|
||||
android:id="@+id/MapHudButtonsOverlayQuickActions"/>
|
||||
</FrameLayout>
|
||||
|
||||
<FrameLayout
|
||||
|
|
|
@ -3662,4 +3662,7 @@
|
|||
<string name="poi_enforcement_check">Требование: контроль</string>
|
||||
<string name="poi_payment_account_cards_no">Карточки не принимаются</string>
|
||||
<string name="poi_payment_prepaid_ticket_yes">Предоплаченные билеты</string>
|
||||
|
||||
<string name="poi_depot">Депо</string>
|
||||
|
||||
</resources>
|
||||
|
|
|
@ -938,7 +938,7 @@
|
|||
<string name="osb_comment_dialog_author">Автор</string>
|
||||
<string name="poi_edit_title">Редактирование POI</string>
|
||||
<string name="poi_create_title">Добавление POI</string>
|
||||
<string name="poi_error_poi_not_found">Узел не найден или удобство (amenity) состоит из нескольких узлов, что не поддерживается.</string>
|
||||
<string name="poi_error_poi_not_found">Узел не найден или объект состоит из нескольких узлов, что не поддерживается.</string>
|
||||
<string name="poi_remove_confirm_template">Вы действительно хотите удалить {0}?</string>
|
||||
<string name="poi_remove_title">Удаление POI</string>
|
||||
<string name="poi_remove_success">POI успешно удалена</string>
|
||||
|
|
|
@ -3634,4 +3634,6 @@
|
|||
|
||||
<string name="poi_charging_station_filter">Charging station</string>
|
||||
|
||||
<string name="poi_depot">Depot</string>
|
||||
|
||||
</resources>
|
||||
|
|
|
@ -284,9 +284,11 @@ public class AndroidUtils {
|
|||
decorView.setSystemUiVisibility(uiOptions);
|
||||
}
|
||||
|
||||
public static int[] getViewLocation(View view) {
|
||||
public static int[] getCenterViewCoordinates(View view) {
|
||||
int[] coordinates = new int[2];
|
||||
view.getLocationOnScreen(coordinates);
|
||||
coordinates[0] += view.getWidth() / 2;
|
||||
coordinates[1] += view.getHeight() / 2;
|
||||
return coordinates;
|
||||
}
|
||||
|
||||
|
|
|
@ -57,6 +57,8 @@ public class GPXUtilities {
|
|||
|
||||
private final static NumberFormat latLonFormat = new DecimalFormat("0.00#####", new DecimalFormatSymbols(
|
||||
new Locale("EN", "US")));
|
||||
private final static NumberFormat decimalFormat = new DecimalFormat("#.###", new DecimalFormatSymbols(
|
||||
new Locale("EN", "US")));
|
||||
|
||||
public static class GPXExtensions {
|
||||
Map<String, String> extensions = null;
|
||||
|
@ -1299,7 +1301,7 @@ public class GPXUtilities {
|
|||
serializer.attribute(null, "lon", latLonFormat.format(p.lon)); //$NON-NLS-1$ //$NON-NLS-2$
|
||||
|
||||
if (!Double.isNaN(p.ele)) {
|
||||
writeNotNullText(serializer, "ele", (float) p.ele + "");
|
||||
writeNotNullText(serializer, "ele", decimalFormat.format(p.ele));
|
||||
}
|
||||
if (p.time != 0) {
|
||||
writeNotNullText(serializer, "time", format.format(new Date(p.time)));
|
||||
|
@ -1316,10 +1318,10 @@ public class GPXUtilities {
|
|||
writeNotNullText(serializer, "cmt", p.comment);
|
||||
}
|
||||
if (!Double.isNaN(p.hdop)) {
|
||||
writeNotNullText(serializer, "hdop", p.hdop + "");
|
||||
writeNotNullText(serializer, "hdop", decimalFormat.format(p.hdop));
|
||||
}
|
||||
if (p.speed > 0) {
|
||||
p.getExtensionsToWrite().put("speed", p.speed + "");
|
||||
p.getExtensionsToWrite().put("speed", decimalFormat.format(p.speed));
|
||||
}
|
||||
writeExtensions(serializer, p);
|
||||
}
|
||||
|
|
|
@ -167,12 +167,16 @@ public class FavoritesTreeFragment extends OsmandExpandableListFragment {
|
|||
ImageView emptyImageView = (ImageView) emptyView.findViewById(R.id.empty_state_image_view);
|
||||
emptyImageView.setImageResource(app.getSettings().isLightContent() ? R.drawable.ic_empty_state_favorites_day : R.drawable.ic_empty_state_favorites_night);
|
||||
Button importButton = (Button) emptyView.findViewById(R.id.import_button);
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
|
||||
importButton.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
importFavourites();
|
||||
}
|
||||
});
|
||||
} else {
|
||||
importButton.setVisibility(View.GONE);
|
||||
}
|
||||
listView.setEmptyView(emptyView);
|
||||
listView.setAdapter(favouritesAdapter);
|
||||
setListView(listView);
|
||||
|
@ -321,8 +325,10 @@ public class FavoritesTreeFragment extends OsmandExpandableListFragment {
|
|||
|
||||
|
||||
if (!MenuItemCompat.isActionViewExpanded(mi)) {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
|
||||
createMenuItem(menu, IMPORT_FAVOURITES_ID, R.string.shared_string_add_to_favorites, R.drawable.ic_action_plus,
|
||||
R.drawable.ic_action_plus, MenuItemCompat.SHOW_AS_ACTION_ALWAYS);
|
||||
}
|
||||
createMenuItem(menu, SHARE_ID, R.string.shared_string_share, R.drawable.ic_action_gshare_dark,
|
||||
R.drawable.ic_action_gshare_dark, MenuItemCompat.SHOW_AS_ACTION_ALWAYS);
|
||||
if (getSettings().USE_MAP_MARKERS.get()) {
|
||||
|
|
|
@ -1000,7 +1000,7 @@ public class MapActivity extends OsmandActionBarActivity implements DownloadEven
|
|||
}
|
||||
|
||||
public void readLocationToShow() {
|
||||
mapLayers.getMapControlsLayer().showMapControls();
|
||||
mapLayers.getMapControlsLayer().showMapControlsIfHidden();
|
||||
|
||||
LatLon cur = new LatLon(mapView.getLatitude(), mapView.getLongitude());
|
||||
LatLon latLonToShow = settings.getAndClearMapLocationToShow();
|
||||
|
|
|
@ -947,7 +947,7 @@ public class MapActivityActions implements DialogProvider {
|
|||
ContextMenuItem item = contextMenuAdapter.getItem(position);
|
||||
ContextMenuAdapter.ItemClickListener click = item.getItemClickListener();
|
||||
if (click != null && click.onContextMenuClick(simpleListAdapter, item.getTitleId(),
|
||||
position, false, AndroidUtils.getViewLocation(view))) {
|
||||
position, false, AndroidUtils.getCenterViewCoordinates(view))) {
|
||||
mapActivity.closeDrawer();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1581,12 +1581,6 @@ public class AudioVideoNotesPlugin extends OsmandPlugin {
|
|||
private void updateRecordControl(final MapActivity mapActivity, final File f) {
|
||||
recordControl.setText(app.getString(R.string.shared_string_control_stop), "");
|
||||
recordControl.setIcons(R.drawable.widget_icon_av_active, R.drawable.widget_icon_av_active);
|
||||
final MapInfoLayer mil = mapActivity.getMapLayers().getMapInfoLayer();
|
||||
if (!recordControl.isVisible()) {
|
||||
recordControl.setExplicitlyVisible(true);
|
||||
mil.recreateControls();
|
||||
mapActivity.getMapView().refreshMap(true);
|
||||
}
|
||||
recordControl.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
|
@ -1599,10 +1593,6 @@ public class AudioVideoNotesPlugin extends OsmandPlugin {
|
|||
if (!recordingDone) {
|
||||
if (!restart || !stopMediaRecording(true)) {
|
||||
recordingDone = true;
|
||||
if (!recordControl.isVisible()) {
|
||||
recordControl.setExplicitlyVisible(false);
|
||||
mapActivity.getMapLayers().getMapInfoLayer().recreateControls();
|
||||
}
|
||||
stopMediaRecording(false);
|
||||
if (recordControl != null) {
|
||||
setRecordListener(recordControl, mapActivity);
|
||||
|
|
|
@ -196,7 +196,7 @@ public class NotesFragment extends OsmAndListFragment {
|
|||
NotesSortByMode sortByMode = getMyApplication().getSettings().NOTES_SORT_BY_MODE.get();
|
||||
if (sortByMode.isByDate()) {
|
||||
res.add(NotesAdapter.TYPE_DATE_HEADER);
|
||||
res.addAll(sortItemsByDateDescending(recs));
|
||||
res.addAll(sortRecsByDateDescending(recs));
|
||||
} else if (sortByMode.isByType()) {
|
||||
List<Recording> audios = new LinkedList<>();
|
||||
List<Recording> photos = new LinkedList<>();
|
||||
|
@ -221,7 +221,7 @@ public class NotesFragment extends OsmAndListFragment {
|
|||
private void addToResIfNotEmpty(List<Object> res, List<Recording> recs, int header) {
|
||||
if (!recs.isEmpty()) {
|
||||
res.add(header);
|
||||
res.addAll(recs);
|
||||
res.addAll(sortRecsByDateDescending(recs));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -317,7 +317,7 @@ public class NotesFragment extends OsmAndListFragment {
|
|||
listAdapter.notifyDataSetChanged();
|
||||
}
|
||||
|
||||
private List<Recording> sortItemsByDateDescending(List<Recording> recs) {
|
||||
private List<Recording> sortRecsByDateDescending(List<Recording> recs) {
|
||||
Collections.sort(recs, new Comparator<Recording>() {
|
||||
@Override
|
||||
public int compare(Recording first, Recording second) {
|
||||
|
|
|
@ -86,7 +86,7 @@ public class DashWaypointsFragment extends DashLocationFragment {
|
|||
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
dashboard.setDashboardVisibility(true, DashboardType.WAYPOINTS, AndroidUtils.getViewLocation(v));
|
||||
dashboard.setDashboardVisibility(true, DashboardType.WAYPOINTS, AndroidUtils.getCenterViewCoordinates(v));
|
||||
}
|
||||
});
|
||||
LinearLayout favorites = (LinearLayout) mainView.findViewById(R.id.items);
|
||||
|
|
|
@ -513,7 +513,7 @@ public class DashboardOnMap implements ObservableScrollViewCallbacks, DynamicLis
|
|||
@Override
|
||||
public void onClick(View v) {
|
||||
setDashboardVisibility(true, flatNow ? DashboardType.WAYPOINTS : DashboardType.WAYPOINTS_FLAT,
|
||||
previousVisibleType, false, AndroidUtils.getViewLocation(v));
|
||||
previousVisibleType, false, AndroidUtils.getCenterViewCoordinates(v));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -664,7 +664,7 @@ public class DashboardOnMap implements ObservableScrollViewCallbacks, DynamicLis
|
|||
markersSelectionButton.onClickListener = new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
setDashboardVisibility(true, DashboardType.MAP_MARKERS_SELECTION, AndroidUtils.getViewLocation(v));
|
||||
setDashboardVisibility(true, DashboardType.MAP_MARKERS_SELECTION, AndroidUtils.getCenterViewCoordinates(v));
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -893,7 +893,7 @@ public class DashboardOnMap implements ObservableScrollViewCallbacks, DynamicLis
|
|||
mapActivity.getMapView().refreshMap();
|
||||
}
|
||||
|
||||
mapActivity.getMapLayers().getMapControlsLayer().showMapControls();
|
||||
mapActivity.getMapLayers().getMapControlsLayer().showMapControlsIfHidden();
|
||||
hideActionButton();
|
||||
for (WeakReference<DashBaseFragment> df : fragList) {
|
||||
if (df.get() != null) {
|
||||
|
@ -1212,7 +1212,7 @@ public class DashboardOnMap implements ObservableScrollViewCallbacks, DynamicLis
|
|||
}
|
||||
|
||||
|
||||
// To animate view slide out from right to left
|
||||
// To bounce animate view
|
||||
private void open(boolean animation, int[] animationCoordinates) {
|
||||
if (animation) {
|
||||
this.animationCoordinates = animationCoordinates;
|
||||
|
@ -1221,7 +1221,6 @@ public class DashboardOnMap implements ObservableScrollViewCallbacks, DynamicLis
|
|||
dashboardView.findViewById(R.id.animateContent).setVisibility(View.VISIBLE);
|
||||
dashboardView.findViewById(R.id.toolbar).setVisibility(View.VISIBLE);
|
||||
}
|
||||
this.animationCoordinates = animationCoordinates;
|
||||
}
|
||||
|
||||
private void animateDashboard(final boolean show) {
|
||||
|
@ -1259,6 +1258,7 @@ public class DashboardOnMap implements ObservableScrollViewCallbacks, DynamicLis
|
|||
@Override
|
||||
public void onAnimationStart(Animator animation) {
|
||||
super.onAnimationStart(animation);
|
||||
listView.setVerticalScrollBarEnabled(false);
|
||||
if (show) {
|
||||
content.setVisibility(View.VISIBLE);
|
||||
toolbar.setVisibility(View.VISIBLE);
|
||||
|
@ -1268,10 +1268,14 @@ public class DashboardOnMap implements ObservableScrollViewCallbacks, DynamicLis
|
|||
@Override
|
||||
public void onAnimationEnd(Animator animation) {
|
||||
super.onAnimationEnd(animation);
|
||||
listView.setVerticalScrollBarEnabled(true);
|
||||
if (!show) {
|
||||
dashboardView.setVisibility(View.GONE);
|
||||
content.setVisibility(View.GONE);
|
||||
toolbar.setVisibility(View.GONE);
|
||||
content.setTranslationX(0);
|
||||
content.setTranslationY(0);
|
||||
toolbar.setTranslationY(0);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
@ -1421,7 +1425,7 @@ public class DashboardOnMap implements ObservableScrollViewCallbacks, DynamicLis
|
|||
setTranslationY(listBackgroundView, Math.max(0, -scrollY + mFlexibleSpaceImageHeight));
|
||||
}
|
||||
}
|
||||
if (portrait) {
|
||||
if (portrait && toolbar.getVisibility() == View.VISIBLE) {
|
||||
setTranslationY(toolbar, Math.min(0, -scrollY + mFlexibleSpaceImageHeight - mFlexibleBlurSpaceHeight));
|
||||
}
|
||||
updateColorOfToolbar(scrollY);
|
||||
|
|
|
@ -913,7 +913,7 @@ public class MapContextMenuFragment extends BaseOsmAndFragment implements Downlo
|
|||
((View) parent).addOnLayoutChangeListener(containerLayoutListener);
|
||||
}
|
||||
menu.updateControlsVisibility(true);
|
||||
getMapActivity().getMapLayers().getMapControlsLayer().showMapControls();
|
||||
getMapActivity().getMapLayers().getMapControlsLayer().showMapControlsIfHidden();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -60,7 +60,7 @@ public class MapRouteInfoMenuFragment extends BaseOsmAndFragment {
|
|||
if (menu == null) {
|
||||
dismiss();
|
||||
}
|
||||
getMapActivity().getMapLayers().getMapControlsLayer().showMapControls();
|
||||
getMapActivity().getMapLayers().getMapControlsLayer().showMapControlsIfHidden();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -151,7 +151,7 @@ public class MapillaryPlugin extends OsmandPlugin {
|
|||
@Override
|
||||
public boolean onRowItemClick(ArrayAdapter<ContextMenuItem> adapter, View view, int itemId, int position) {
|
||||
if (itemId == R.string.mapillary) {
|
||||
mapActivity.getDashboard().setDashboardVisibility(true, DashboardOnMap.DashboardType.MAPILLARY, AndroidUtils.getViewLocation(view));
|
||||
mapActivity.getDashboard().setDashboardVisibility(true, DashboardOnMap.DashboardType.MAPILLARY, AndroidUtils.getCenterViewCoordinates(view));
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
|
|
|
@ -362,7 +362,7 @@ public class PlanRouteFragment extends BaseOsmAndFragment implements OsmAndLocat
|
|||
super.onResume();
|
||||
MapActivity mapActivity = getMapActivity();
|
||||
mapActivity.getMyApplication().getLocationProvider().addLocationListener(this);
|
||||
mapActivity.getMapLayers().getMapControlsLayer().showMapControls();
|
||||
mapActivity.getMapLayers().getMapControlsLayer().showMapControlsIfHidden();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -460,7 +460,7 @@ public class MeasurementToolFragment extends BaseOsmAndFragment {
|
|||
@Override
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
getMapActivity().getMapLayers().getMapControlsLayer().showMapControls();
|
||||
getMapActivity().getMapLayers().getMapControlsLayer().showMapControlsIfHidden();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -332,12 +332,16 @@ public class AvailableGPXFragment extends OsmandExpandableListFragment {
|
|||
ImageView emptyImageView = (ImageView) emptyView.findViewById(R.id.empty_state_image_view);
|
||||
emptyImageView.setImageResource(app.getSettings().isLightContent() ? R.drawable.ic_empty_state_trip_day : R.drawable.ic_empty_state_trip_night);
|
||||
Button importButton = (Button) emptyView.findViewById(R.id.import_button);
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
|
||||
importButton.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
addTrack();
|
||||
}
|
||||
});
|
||||
} else {
|
||||
importButton.setVisibility(View.GONE);
|
||||
}
|
||||
if (this.adapter != null) {
|
||||
listView.setAdapter(this.adapter);
|
||||
}
|
||||
|
|
|
@ -3,7 +3,7 @@ package net.osmand.plus.osmedit;
|
|||
import android.graphics.Typeface;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.system.Os;
|
||||
import android.support.v4.content.ContextCompat;
|
||||
import android.text.SpannableString;
|
||||
import android.text.TextUtils;
|
||||
import android.text.style.StyleSpan;
|
||||
|
@ -157,6 +157,7 @@ public class OsmEditsAdapter extends ArrayAdapter<Object> {
|
|||
}
|
||||
|
||||
private void bindHeaderViewHolder(final HeaderViewHolder holder) {
|
||||
setupBackground(holder.backgroundView);
|
||||
holder.topDivider.setVisibility(portrait ? View.VISIBLE : View.GONE);
|
||||
holder.title.setText(R.string.your_edits);
|
||||
holder.checkBox.setChecked(isAllSelected());
|
||||
|
@ -176,6 +177,7 @@ public class OsmEditsAdapter extends ArrayAdapter<Object> {
|
|||
}
|
||||
|
||||
private void bindOsmEditViewHolder(final OsmEditViewHolder holder, final OsmPoint osmEdit, int position) {
|
||||
setupBackground(holder.mainView);
|
||||
holder.titleTextView.setText(getTitle(osmEdit));
|
||||
holder.descriptionTextView.setText(getDescription(osmEdit));
|
||||
Drawable icon = getIcon(osmEdit);
|
||||
|
@ -227,6 +229,12 @@ public class OsmEditsAdapter extends ArrayAdapter<Object> {
|
|||
holder.bottomDivider.setVisibility(showDivider ? View.VISIBLE : View.GONE);
|
||||
}
|
||||
|
||||
private void setupBackground(View view) {
|
||||
if (!portrait) {
|
||||
view.setBackgroundColor(ContextCompat.getColor(getContext(), R.color.color_transparent));
|
||||
}
|
||||
}
|
||||
|
||||
private int getItemsCount() {
|
||||
return items.size();
|
||||
}
|
||||
|
@ -339,12 +347,14 @@ public class OsmEditsAdapter extends ArrayAdapter<Object> {
|
|||
private class HeaderViewHolder {
|
||||
View mainView;
|
||||
View topDivider;
|
||||
View backgroundView;
|
||||
CheckBox checkBox;
|
||||
TextView title;
|
||||
|
||||
HeaderViewHolder(View view) {
|
||||
mainView = view;
|
||||
topDivider = view.findViewById(R.id.top_divider);
|
||||
backgroundView = view.findViewById(R.id.background_view);
|
||||
checkBox = (CheckBox) view.findViewById(R.id.check_box);
|
||||
title = (TextView) view.findViewById(R.id.title_text_view);
|
||||
}
|
||||
|
|
|
@ -242,7 +242,7 @@ public class OsmandRasterMapsPlugin extends OsmandPlugin {
|
|||
ContextMenuAdapter.ItemClickListener listener = new ContextMenuAdapter.OnRowItemClick() {
|
||||
@Override
|
||||
public boolean onRowItemClick(ArrayAdapter<ContextMenuItem> adapter, View view, int itemId, int position) {
|
||||
int[] viewCoordinates = AndroidUtils.getViewLocation(view);
|
||||
int[] viewCoordinates = AndroidUtils.getCenterViewCoordinates(view);
|
||||
if (itemId == R.string.layer_overlay) {
|
||||
mapActivity.getDashboard().setDashboardVisibility(true, DashboardType.OVERLAY_MAP, viewCoordinates);
|
||||
return false;
|
||||
|
|
|
@ -294,6 +294,7 @@ public class MapRenderRepositories {
|
|||
if(library == null) {
|
||||
return;
|
||||
}
|
||||
boolean useLive = context.getSettings().USE_OSM_LIVE_FOR_ROUTING.get();
|
||||
for (String mapName : files.keySet()) {
|
||||
BinaryMapIndexReader fr = files.get(mapName);
|
||||
if (fr != null && (fr.containsMapData(leftX, topY, rightX, bottomY, zoom) ||
|
||||
|
@ -301,7 +302,7 @@ public class MapRenderRepositories {
|
|||
if (!nativeFiles.contains(mapName)) {
|
||||
long time = System.currentTimeMillis();
|
||||
nativeFiles.add(mapName);
|
||||
if (!library.initMapFile(fr.getFile().getAbsolutePath())) {
|
||||
if (!library.initMapFile(fr.getFile().getAbsolutePath(), useLive)) {
|
||||
continue;
|
||||
}
|
||||
log.debug("Native resource " + mapName + " initialized " + (System.currentTimeMillis() - time) + " ms"); //$NON-NLS-1$ //$NON-NLS-2$
|
||||
|
|
|
@ -19,9 +19,7 @@ import net.osmand.plus.R;
|
|||
import net.osmand.plus.activities.MapActivity;
|
||||
import net.osmand.plus.activities.SettingsActivity;
|
||||
import net.osmand.plus.dashboard.DashboardOnMap;
|
||||
import net.osmand.plus.views.GPXLayer;
|
||||
import net.osmand.plus.views.OsmandMapTileView;
|
||||
import net.osmand.plus.views.RouteLayer;
|
||||
import net.osmand.render.RenderingRuleProperty;
|
||||
import net.osmand.util.Algorithms;
|
||||
|
||||
|
@ -130,7 +128,7 @@ public class SRTMPlugin extends OsmandPlugin {
|
|||
|
||||
@Override
|
||||
public boolean onRowItemClick(ArrayAdapter<ContextMenuItem> adapter, View view, int itemId, int position) {
|
||||
int[] viewCoordinates = AndroidUtils.getViewLocation(view);
|
||||
int[] viewCoordinates = AndroidUtils.getCenterViewCoordinates(view);
|
||||
if (itemId == R.string.srtm_plugin_name) {
|
||||
mapActivity.getDashboard().setDashboardVisibility(true, DashboardOnMap.DashboardType.CONTOUR_LINES, viewCoordinates);
|
||||
return false;
|
||||
|
|
|
@ -1,6 +1,10 @@
|
|||
package net.osmand.plus.views;
|
||||
|
||||
import android.Manifest;
|
||||
import android.animation.Animator;
|
||||
import android.animation.AnimatorListenerAdapter;
|
||||
import android.animation.AnimatorSet;
|
||||
import android.animation.ObjectAnimator;
|
||||
import android.annotation.SuppressLint;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.pm.PackageManager;
|
||||
|
@ -249,7 +253,7 @@ public class MapControlsLayer extends OsmandMapLayer {
|
|||
@Override
|
||||
public void onClick(View v) {
|
||||
MapActivity.clearPrevActivityIntent();
|
||||
mapActivity.getDashboard().setDashboardVisibility(true, DashboardType.CONFIGURE_MAP, AndroidUtils.getViewLocation(v));
|
||||
mapActivity.getDashboard().setDashboardVisibility(true, DashboardType.CONFIGURE_MAP, AndroidUtils.getCenterViewCoordinates(v));
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -410,7 +414,7 @@ public class MapControlsLayer extends OsmandMapLayer {
|
|||
public void onClick(View v) {
|
||||
MapActivity.clearPrevActivityIntent();
|
||||
if (dash) {
|
||||
mapActivity.getDashboard().setDashboardVisibility(true, DashboardType.DASHBOARD, AndroidUtils.getViewLocation(v));
|
||||
mapActivity.getDashboard().setDashboardVisibility(true, DashboardType.DASHBOARD, AndroidUtils.getCenterViewCoordinates(v));
|
||||
} else {
|
||||
mapActivity.openDrawer();
|
||||
}
|
||||
|
@ -656,13 +660,64 @@ public class MapControlsLayer extends OsmandMapLayer {
|
|||
zoomOutButton.setOnLongClickListener(listener);
|
||||
}
|
||||
|
||||
public void showMapControls() {
|
||||
public void showMapControlsIfHidden() {
|
||||
if (!isMapControlsVisible()) {
|
||||
showMapControls();
|
||||
}
|
||||
}
|
||||
|
||||
private void showMapControls() {
|
||||
if (settings.DO_NOT_USE_ANIMATIONS.get()) {
|
||||
mapActivity.findViewById(R.id.MapHudButtonsOverlay).setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
animateMapControls(true);
|
||||
}
|
||||
AndroidUtils.showNavBar(mapActivity);
|
||||
}
|
||||
|
||||
public void hideMapControls() {
|
||||
if (settings.DO_NOT_USE_ANIMATIONS.get()) {
|
||||
mapActivity.findViewById(R.id.MapHudButtonsOverlay).setVisibility(View.INVISIBLE);
|
||||
} else {
|
||||
animateMapControls(false);
|
||||
}
|
||||
}
|
||||
|
||||
private void animateMapControls(final boolean show) {
|
||||
final View mapHudButtonsOverlay = mapActivity.findViewById(R.id.MapHudButtonsOverlay);
|
||||
View mapHudButtonsTop = mapActivity.findViewById(R.id.MapHudButtonsOverlayTop);
|
||||
View mapHudButtonsBottom = mapActivity.findViewById(R.id.MapHudButtonsOverlayBottom);
|
||||
View mapHudButtonsQuickActions = mapActivity.findViewById(R.id.MapHudButtonsOverlayQuickActions);
|
||||
AnimatorSet set = new AnimatorSet();
|
||||
float transTopInitial = show ? -mapHudButtonsTop.getHeight() : 0;
|
||||
float transTopFinal = show ? 0 : -mapHudButtonsTop.getHeight();
|
||||
float transBottomInitial = show ? mapHudButtonsBottom.getHeight() : 0;
|
||||
float transBottomFinal = show ? 0 : mapHudButtonsBottom.getHeight();
|
||||
float alphaInitial = show ? 0f : 1f;
|
||||
float alphaFinal = show ? 1f : 0f;
|
||||
set.setDuration(300).playTogether(
|
||||
ObjectAnimator.ofFloat(mapHudButtonsTop, View.TRANSLATION_Y, transTopInitial, transTopFinal),
|
||||
ObjectAnimator.ofFloat(mapHudButtonsBottom, View.TRANSLATION_Y, transBottomInitial, transBottomFinal),
|
||||
ObjectAnimator.ofFloat(mapHudButtonsQuickActions, View.ALPHA, alphaInitial, alphaFinal)
|
||||
);
|
||||
set.addListener(new AnimatorListenerAdapter() {
|
||||
@Override
|
||||
public void onAnimationStart(Animator animation) {
|
||||
super.onAnimationStart(animation);
|
||||
if (show) {
|
||||
mapHudButtonsOverlay.setVisibility(View.VISIBLE);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAnimationEnd(Animator animation) {
|
||||
super.onAnimationEnd(animation);
|
||||
if (!show) {
|
||||
mapHudButtonsOverlay.setVisibility(View.INVISIBLE);
|
||||
}
|
||||
}
|
||||
});
|
||||
set.start();
|
||||
}
|
||||
|
||||
public void setMapControlsVisibility(boolean visible) {
|
||||
|
|
|
@ -1,14 +1,20 @@
|
|||
package net.osmand.plus.views;
|
||||
|
||||
import android.animation.Animator;
|
||||
import android.animation.AnimatorListenerAdapter;
|
||||
import android.animation.AnimatorSet;
|
||||
import android.animation.ObjectAnimator;
|
||||
import android.content.Context;
|
||||
import android.graphics.Canvas;
|
||||
import android.graphics.PointF;
|
||||
import android.os.Build;
|
||||
import android.os.Vibrator;
|
||||
import android.support.annotation.DimenRes;
|
||||
import android.support.v4.content.ContextCompat;
|
||||
import android.support.v4.util.Pair;
|
||||
import android.view.MotionEvent;
|
||||
import android.view.View;
|
||||
import android.view.ViewAnimationUtils;
|
||||
import android.widget.FrameLayout;
|
||||
import android.widget.ImageButton;
|
||||
import android.widget.ImageView;
|
||||
|
@ -16,6 +22,7 @@ import android.widget.ImageView;
|
|||
import com.getkeepsafe.taptargetview.TapTarget;
|
||||
import com.getkeepsafe.taptargetview.TapTargetView;
|
||||
|
||||
import net.osmand.AndroidUtils;
|
||||
import net.osmand.data.LatLon;
|
||||
import net.osmand.data.RotatedTileBox;
|
||||
import net.osmand.plus.OsmAndLocationProvider;
|
||||
|
@ -31,6 +38,9 @@ import net.osmand.plus.quickaction.QuickActionFactory;
|
|||
import net.osmand.plus.quickaction.QuickActionRegistry;
|
||||
import net.osmand.plus.quickaction.QuickActionsWidget;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import static net.osmand.plus.views.ContextMenuLayer.VIBRATE_SHORT;
|
||||
|
||||
/**
|
||||
|
@ -194,7 +204,11 @@ public class MapQuickActionLayer extends OsmandMapLayer implements QuickActionRe
|
|||
return false;
|
||||
|
||||
updateQuickActionButton(showWidget);
|
||||
if (settings.DO_NOT_USE_ANIMATIONS.get()) {
|
||||
quickActionsWidget.setVisibility(!showWidget ? View.GONE : View.VISIBLE);
|
||||
} else {
|
||||
animateWidget(showWidget);
|
||||
}
|
||||
mapActivity.updateStatusBarColor();
|
||||
|
||||
if (!showWidget) {
|
||||
|
@ -211,6 +225,51 @@ public class MapQuickActionLayer extends OsmandMapLayer implements QuickActionRe
|
|||
return true;
|
||||
}
|
||||
|
||||
private void animateWidget(final boolean show) {
|
||||
AnimatorSet set = new AnimatorSet();
|
||||
List<Animator> animators = new ArrayList<>();
|
||||
int[] animationCoordinates = AndroidUtils.getCenterViewCoordinates(quickActionButton);
|
||||
int centerX = quickActionsWidget.getWidth() / 2;
|
||||
int centerY = quickActionsWidget.getHeight() / 2;
|
||||
float initialValueX = show ? animationCoordinates[0] - centerX : 0;
|
||||
float finalValueX = show ? 0 : animationCoordinates[0] - centerX;
|
||||
float initialValueY = show ? animationCoordinates[1] - centerY : 0;
|
||||
float finalValueY = show ? 0 : animationCoordinates[1] - centerY;
|
||||
animators.add(ObjectAnimator.ofFloat(quickActionsWidget, View.TRANSLATION_X, initialValueX, finalValueX));
|
||||
animators.add(ObjectAnimator.ofFloat(quickActionsWidget, View.TRANSLATION_Y, initialValueY, finalValueY));
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
|
||||
float initialRadius = show ? 0 : (float) Math.sqrt(Math.pow(quickActionsWidget.getWidth() / 2, 2) + Math.pow(quickActionsWidget.getHeight() / 2, 2));
|
||||
float finalRadius = show ? (float) Math.sqrt(Math.pow(quickActionsWidget.getWidth() / 2, 2) + Math.pow(quickActionsWidget.getHeight() / 2, 2)) : 0;
|
||||
Animator circleAnimator = ViewAnimationUtils.createCircularReveal(quickActionsWidget, centerX, centerY, initialRadius, finalRadius);
|
||||
animators.add(circleAnimator);
|
||||
}
|
||||
float initialValueScale = show ? 0f : 1f;
|
||||
float finalValueScale = show ? 1f : 0f;
|
||||
animators.add(ObjectAnimator.ofFloat(quickActionsWidget, View.SCALE_X, initialValueScale, finalValueScale));
|
||||
animators.add(ObjectAnimator.ofFloat(quickActionsWidget, View.SCALE_Y, initialValueScale, finalValueScale));
|
||||
set.setDuration(300).playTogether(animators);
|
||||
set.addListener(new AnimatorListenerAdapter() {
|
||||
@Override
|
||||
public void onAnimationStart(Animator animation) {
|
||||
super.onAnimationStart(animation);
|
||||
if (show) {
|
||||
quickActionsWidget.setVisibility(View.VISIBLE);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAnimationEnd(Animator animation) {
|
||||
super.onAnimationEnd(animation);
|
||||
if (!show) {
|
||||
quickActionsWidget.setVisibility(View.GONE);
|
||||
quickActionsWidget.setTranslationX(0);
|
||||
quickActionsWidget.setTranslationY(0);
|
||||
}
|
||||
}
|
||||
});
|
||||
set.start();
|
||||
}
|
||||
|
||||
private void updateQuickActionButton(boolean widgetVisible) {
|
||||
quickActionButton.setImageDrawable(app.getIconsCache().getIcon(
|
||||
!widgetVisible ? R.drawable.map_quick_action : R.drawable.map_action_cancel, !nightMode));
|
||||
|
|
|
@ -882,7 +882,7 @@ public class MapInfoWidgetsFactory {
|
|||
all.setOnClickListener(new OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
map.getDashboard().setDashboardVisibility(true, DashboardType.WAYPOINTS, AndroidUtils.getViewLocation(view));
|
||||
map.getDashboard().setDashboardVisibility(true, DashboardType.WAYPOINTS, AndroidUtils.getCenterViewCoordinates(view));
|
||||
}
|
||||
});
|
||||
remove.setOnClickListener(new OnClickListener() {
|
||||
|
|
Loading…
Reference in a new issue