Merge branch 'master' of github.com:osmandapp/Osmand

This commit is contained in:
Victor Shcherb 2015-11-11 17:14:47 +01:00
commit 058cf04225
4 changed files with 39 additions and 19 deletions

View file

@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8" standalone="no"?> <?xml version='1.0' encoding='utf-8'?>
<resources> <resources>
<string name="screen_is_locked">För att låsa upp skärmen tryck på låsikonen</string> <string name="screen_is_locked">För att låsa upp skärmen tryck på låsikonen</string>
<string name="ChooseCountry">Välj land</string> <string name="ChooseCountry">Välj land</string>
@ -1969,4 +1969,8 @@
<string name="read_more">Läs mer</string> <string name="read_more">Läs mer</string>
<string name="whats_new">Nyheter</string> <string name="whats_new">Nyheter</string>
<string name="rendering_attr_hideProposed_name">Dölj föreslagna objekt</string> <string name="rendering_attr_hideProposed_name">Dölj föreslagna objekt</string>
</resources> <string name="lang_nds">Lågtyska</string>
<string name="lang_mk">Makedonska</string>
<string name="lang_fy">Frisiska</string>
<string name="lang_als">Albanska (Toskiska)</string>
</resources>

View file

@ -114,7 +114,7 @@
<item name="appbar_layout_theme">@style/OsmandLightTheme.DarkActionbar</item> <item name="appbar_layout_theme">@style/OsmandLightTheme.DarkActionbar</item>
<item name="toolbar_theme">@style/OsmandLightTheme.Toolbar</item> <item name="toolbar_theme">@style/OsmandLightTheme.Toolbar</item>
<item name="new_app_theme">@style/OsmandLightTheme.NewAppTheme</item> <item name="new_app_theme">@style/OsmandLightTheme.NewAppTheme</item>
<item name="android:textColorSecondary">@color/dashboard_black</item> <item name="android:textColorSecondary">@color/icon_color</item>
<item name="contextMenuButtonColor">@color/map_widget_blue</item> <item name="contextMenuButtonColor">@color/map_widget_blue</item>
</style> </style>
@ -207,7 +207,7 @@
<item name="appbar_layout_theme">@style/OsmandDarkTheme.DarkActionbar</item> <item name="appbar_layout_theme">@style/OsmandDarkTheme.DarkActionbar</item>
<item name="toolbar_theme">@style/OsmandDarkTheme</item> <item name="toolbar_theme">@style/OsmandDarkTheme</item>
<item name="new_app_theme">@style/OsmandDarkTheme</item> <item name="new_app_theme">@style/OsmandDarkTheme</item>
<item name="android:textColorSecondary">@color/map_widget_light</item> <item name="android:textColorSecondary">@color/dash_search_icon_dark</item>
<item name="contextMenuButtonColor">@color/osmand_orange</item> <item name="contextMenuButtonColor">@color/osmand_orange</item>
</style> </style>

View file

@ -7,7 +7,6 @@ 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.plus.ContextMenuAdapter; import net.osmand.plus.ContextMenuAdapter;
import net.osmand.plus.GPXUtilities;
import net.osmand.plus.GPXUtilities.WptPt; import net.osmand.plus.GPXUtilities.WptPt;
import net.osmand.plus.R; import net.osmand.plus.R;
import net.osmand.plus.activities.MapActivity; import net.osmand.plus.activities.MapActivity;
@ -520,21 +519,23 @@ public class MapContextMenu extends MenuTitleController {
} }
public void updateMyLocation(net.osmand.Location location) { public void updateMyLocation(net.osmand.Location location) {
if (location != null) { if (location != null && active && displayDistanceDirection()) {
myLocation = new LatLon(location.getLatitude(), location.getLongitude()); myLocation = new LatLon(location.getLatitude(), location.getLongitude());
updateLocation(false, true, false); updateLocation(false, true, false);
} }
} }
public void updateCompassValue(float value) { public void updateCompassValue(float value) {
// 99 in next line used to one-time initialize arrows (with reference vs. fixed-north direction) if (active && displayDistanceDirection()) {
// on non-compass devices // 99 in next line used to one-time initialize arrows (with reference vs. fixed-north direction)
float lastHeading = heading != null ? heading : 99; // on non-compass devices
heading = value; float lastHeading = heading != null ? heading : 99;
if (Math.abs(MapUtils.degreesDiff(lastHeading, heading)) > 5) { heading = value;
updateLocation(false, false, true); if (Math.abs(MapUtils.degreesDiff(lastHeading, heading)) > 5) {
} else { updateLocation(false, false, true);
heading = lastHeading; } else {
heading = lastHeading;
}
} }
} }

View file

@ -74,6 +74,9 @@ public class MapContextMenuFragment extends Fragment implements DownloadEvents {
private int menuFullHeight; private int menuFullHeight;
private int menuFullHeightMax; private int menuFullHeightMax;
private int screenHeight;
private int viewHeight;
private int fabPaddingTopPx; private int fabPaddingTopPx;
private int markerPaddingPx; private int markerPaddingPx;
private int markerPaddingXPx; private int markerPaddingXPx;
@ -126,6 +129,9 @@ public class MapContextMenuFragment extends Fragment implements DownloadEvents {
public View onCreateView(LayoutInflater inflater, ViewGroup container, public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) { Bundle savedInstanceState) {
screenHeight = getScreenHeight();
viewHeight = screenHeight - getStatusBarHeight();
fabPaddingTopPx = dpToPx(FAB_PADDING_TOP_DP); fabPaddingTopPx = dpToPx(FAB_PADDING_TOP_DP);
markerPaddingPx = dpToPx(MARKER_PADDING_DP); markerPaddingPx = dpToPx(MARKER_PADDING_DP);
markerPaddingXPx = dpToPx(MARKER_PADDING_X_DP); markerPaddingXPx = dpToPx(MARKER_PADDING_X_DP);
@ -704,26 +710,26 @@ public class MapContextMenuFragment extends Fragment implements DownloadEvents {
private int getPosY(boolean needCloseMenu) { private int getPosY(boolean needCloseMenu) {
if (needCloseMenu) { if (needCloseMenu) {
return getScreenHeight(); return screenHeight;
} }
int destinationState; int destinationState;
int minHalfY; int minHalfY;
if (menu.isExtended()) { if (menu.isExtended()) {
destinationState = menu.getCurrentMenuState(); destinationState = menu.getCurrentMenuState();
minHalfY = view.getHeight() - (int)(view.getHeight() * menu.getHalfScreenMaxHeightKoef()); minHalfY = viewHeight - (int)(viewHeight * menu.getHalfScreenMaxHeightKoef());
} else { } else {
destinationState = MenuController.MenuState.HEADER_ONLY; destinationState = MenuController.MenuState.HEADER_ONLY;
minHalfY = view.getHeight(); minHalfY = viewHeight;
} }
int posY = 0; int posY = 0;
switch (destinationState) { switch (destinationState) {
case MenuController.MenuState.HEADER_ONLY: case MenuController.MenuState.HEADER_ONLY:
posY = view.getHeight() - (menuTitleHeight - dpToPx(SHADOW_HEIGHT_BOTTOM_DP)); posY = viewHeight - (menuTitleHeight - dpToPx(SHADOW_HEIGHT_BOTTOM_DP));
break; break;
case MenuController.MenuState.HALF_SCREEN: case MenuController.MenuState.HALF_SCREEN:
posY = view.getHeight() - menuFullHeightMax; posY = viewHeight - menuFullHeightMax;
posY = Math.max(posY, minHalfY); posY = Math.max(posY, minHalfY);
break; break;
case MenuController.MenuState.FULL_SCREEN: case MenuController.MenuState.FULL_SCREEN:
@ -925,6 +931,15 @@ public class MapContextMenuFragment extends Fragment implements DownloadEvents {
return dm.heightPixels; return dm.heightPixels;
} }
public int getStatusBarHeight() {
int result = 0;
int resourceId = getResources().getIdentifier("status_bar_height", "dimen", "android");
if (resourceId > 0) {
result = getResources().getDimensionPixelSize(resourceId);
}
return result;
}
public void updateLocation(boolean centerChanged, boolean locationChanged, boolean compassChanged) { public void updateLocation(boolean centerChanged, boolean locationChanged, boolean compassChanged) {
updateDistanceDirection(); updateDistanceDirection();
} }