Merge remote-tracking branch 'origin/master'

This commit is contained in:
Weblate 2018-02-02 11:40:03 +01:00
commit af7035de87
6 changed files with 60 additions and 13 deletions

View file

@ -602,11 +602,11 @@
<FrameLayout
android:id="@+id/context_menu_top_button_container"
android:layout_width="match_parent"
android:layout_width="wrap_content"
android:layout_height="@dimen/dashboard_map_toolbar"
android:layout_marginLeft="4dp"
android:layout_marginStart="4dp"
android:alpha="0">
android:alpha="1">
<LinearLayout
android:layout_width="@dimen/list_item_height"
@ -669,6 +669,10 @@
android:scaleType="center"
android:textColor="@color/abc_primary_text_material_dark"
android:textSize="@dimen/abc_text_size_large_material"
android:ellipsize="end"
android:lines="1"
android:maxLines="1"
android:singleLine="true"
tools:text="Toolbar"
tools:visibility="visible"/>

View file

@ -1161,6 +1161,8 @@ public class OsmandSettings {
// this value string is synchronized with settings_pref.xml preference name
public final OsmandPreference<Boolean> SHOW_OSM_BUGS = new BooleanPreference("show_osm_bugs", false).makeGlobal();
public final CommonPreference<Boolean> SHOW_CLOSED_OSM_BUGS = new BooleanPreference("show_closed_osm_bugs", false).makeGlobal();
public final CommonPreference<Integer> SHOW_OSM_BUGS_MIN_ZOOM = new IntPreference("show_osm_bugs_min_zoom", 8).makeGlobal();

View file

@ -665,6 +665,11 @@ public class MapContextMenu extends MenuTitleController implements StateChangedL
}
}
public boolean hasActiveToolbar() {
TopToolbarController toolbarController = mapActivity.getTopToolbarController(TopToolbarControllerType.CONTEXT_MENU);
return toolbarController != null && toolbarController instanceof ContextMenuToolbarController;
}
public void closeActiveToolbar() {
TopToolbarController toolbarController = mapActivity.getTopToolbarController(TopToolbarControllerType.CONTEXT_MENU);
if (toolbarController != null && toolbarController instanceof ContextMenuToolbarController) {

View file

@ -159,14 +159,13 @@ public class MapContextMenuFragment extends BaseOsmAndFragment implements Downlo
toolbarView = view.findViewById(R.id.context_menu_toolbar);
toolbarBackButton = view.findViewById(R.id.context_menu_toolbar_back);
toolbarTextView = (TextView) view.findViewById(R.id.context_menu_toolbar_text);
toolbarContainer.setAlpha(0);
updateVisibility(toolbarContainer, 0);
toolbarBackButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
openMenuHeaderOnly();
}
});
toolbarTextView.setText(menu.getTitleStr());
topButtonContainer = view.findViewById(R.id.context_menu_top_button_container);
view.findViewById(R.id.context_menu_top_back).setOnClickListener(new View.OnClickListener() {
@ -175,7 +174,7 @@ public class MapContextMenuFragment extends BaseOsmAndFragment implements Downlo
openMenuHeaderOnly();
}
});
topButtonContainer.setAlpha(0);
updateVisibility(topButtonContainer, 0);
map = getMapActivity().getMapView();
RotatedTileBox box = map.getCurrentRotatedTileBox().copy();
@ -621,12 +620,12 @@ public class MapContextMenuFragment extends BaseOsmAndFragment implements Downlo
private void updateToolbar() {
float a = getToolbarAlpha(getViewY());
toolbarContainer.setAlpha(a);
updateVisibility(toolbarContainer, a);
}
private float getTopButtonAlpha(int y) {
float a = 0;
if (menu != null && !menu.isLandscapeLayout()) {
if (menu != null && !menu.isLandscapeLayout() && !menu.hasActiveToolbar()) {
int headerTopY = getHeaderOnlyTopY();
if (y < headerTopY) {
a = 1f - (y - minHalfY) * (1f / (headerTopY - minHalfY));
@ -642,7 +641,25 @@ public class MapContextMenuFragment extends BaseOsmAndFragment implements Downlo
private void updateTopButton() {
float a = getTopButtonAlpha(getViewY());
topButtonContainer.setAlpha(a);
updateVisibility(topButtonContainer, a);
}
private void updateVisibility(View v, float alpha) {
boolean visible = alpha > 0;
v.setAlpha(alpha);
if (visible && v.getVisibility() != View.VISIBLE) {
v.setVisibility(View.VISIBLE);
} else if (!visible && v.getVisibility() == View.VISIBLE) {
v.setVisibility(View.INVISIBLE);
}
}
private void updateVisibility(View v, boolean visible) {
if (visible && v.getVisibility() != View.VISIBLE) {
v.setVisibility(View.VISIBLE);
} else if (!visible && v.getVisibility() == View.VISIBLE) {
v.setVisibility(View.INVISIBLE);
}
}
private void toggleDetailsHideButton() {
@ -788,15 +805,33 @@ public class MapContextMenuFragment extends BaseOsmAndFragment implements Downlo
}
final float topButtonAlpha = getTopButtonAlpha(posY);
if (topButtonAlpha > 0) {
updateVisibility(topButtonContainer, true);
}
topButtonContainer.animate().alpha(topButtonAlpha)
.setDuration(200)
.setInterpolator(new DecelerateInterpolator())
.setListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
updateVisibility(topButtonContainer, topButtonAlpha);
}
})
.start();
final float toolbarAlpha = getToolbarAlpha(posY);
if (toolbarAlpha > 0) {
updateVisibility(toolbarContainer, true);
}
toolbarContainer.animate().alpha(toolbarAlpha)
.setDuration(200)
.setInterpolator(new DecelerateInterpolator())
.setListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
updateVisibility(toolbarContainer, toolbarAlpha);
}
})
.start();
mainView.animate().y(posY)
@ -1281,6 +1316,7 @@ public class MapContextMenuFragment extends BaseOsmAndFragment implements Downlo
// Text line 1
TextView line1 = (TextView) view.findViewById(R.id.context_menu_line1);
line1.setText(menu.getTitleStr());
toolbarTextView.setText(menu.getTitleStr());
// Text line 2
LinearLayout line2layout = (LinearLayout) view.findViewById(R.id.context_menu_line2_layout);

View file

@ -306,7 +306,7 @@ public class MapRouteInfoMenu implements IRouteInformationListener {
}
}
if (startPoint != null) {
if (startPoint != null && endPoint != null) {
targetPointsHelper.navigateToPoint(startPoint.point, false, -1, startPoint.getPointDescription(mapActivity));
targetPointsHelper.setStartPoint(endPoint.point, false, endPoint.getPointDescription(mapActivity));
targetPointsHelper.updateRouteAndRefresh(true);

View file

@ -716,18 +716,18 @@ public class ResourceManager {
int left31 = MapUtils.get31TileNumberX(leftLongitude);
int bottom31 = MapUtils.get31TileNumberY(bottomLatitude);
int right31 = MapUtils.get31TileNumberX(rightLongitude);
List<String> fileNames = new ArrayList<String>(amenityRepositories.keySet());
List<String> fileNames = new ArrayList<>(amenityRepositories.keySet());
Collections.sort(fileNames, Algorithms.getStringVersionComparator());
for (String name : fileNames) {
AmenityIndexRepository index = amenityRepositories.get(name);
if (matcher != null && matcher.isCancelled()) {
searchAmenitiesInProgress = false;
break;
}
if (index.checkContainsInt(top31, left31, bottom31, right31)) {
AmenityIndexRepository index = amenityRepositories.get(name);
if (index != null && index.checkContainsInt(top31, left31, bottom31, right31)) {
List<Amenity> r = index.searchAmenities(top31,
left31, bottom31, right31, zoom, filter, matcher);
if(r != null) {
if (r != null) {
amenities.addAll(r);
}
}