forked from organicmaps/organicmaps
Merge pull request #4710 from goblinr/MAPSME-82-ext-express-search-button
[android] Added compass y offset in landscape navigation mode
This commit is contained in:
commit
4c9520acd9
6 changed files with 18 additions and 3 deletions
|
@ -3,4 +3,7 @@
|
|||
<dimen name="menu_line_button_inset_edge">-12dp</dimen>
|
||||
<dimen name="menu_line_button_width_edge">72dp</dimen>
|
||||
<dimen name="menu_line_button_width">80dp</dimen>
|
||||
|
||||
<!-- Compass offset-->
|
||||
<dimen name="compass_navigation_landscape_offset">-72dp</dimen>
|
||||
</resources>
|
||||
|
|
|
@ -157,4 +157,7 @@
|
|||
<!-- Rating-->
|
||||
<dimen name="placepage_margin_rating">20dp</dimen>
|
||||
|
||||
<!-- Compass offset-->
|
||||
<dimen name="compass_navigation_landscape_offset">-54dp</dimen>
|
||||
|
||||
</resources>
|
||||
|
|
|
@ -91,7 +91,7 @@ public class MapFragment extends BaseMwmFragment
|
|||
ANCHOR_LEFT_TOP);
|
||||
}
|
||||
|
||||
setupCompass(0, 0, false);
|
||||
setupCompass(0, UiUtils.getCompassYOffset(getContext()), false);
|
||||
}
|
||||
|
||||
void setupCompass(int offsetX, int offsetY, boolean forceRedraw)
|
||||
|
|
|
@ -1410,6 +1410,7 @@ public class MwmActivity extends BaseMwmFragmentActivity
|
|||
mPlacePage.refreshViews();
|
||||
mNavigationController.show(show);
|
||||
mOnmapDownloader.updateState(false);
|
||||
adjustCompass(0, UiUtils.getCompassYOffset(this));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -95,7 +95,7 @@ class PanelAnimator
|
|||
listener.onTrackStarted(true);
|
||||
mAnimationTrackListeners.finishIterate();
|
||||
|
||||
mActivity.adjustCompass(WIDTH, 0);
|
||||
mActivity.adjustCompass(WIDTH, UiUtils.getCompassYOffset(mActivity));
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -137,7 +137,7 @@ class PanelAnimator
|
|||
listener.onTrackStarted(false);
|
||||
mAnimationTrackListeners.finishIterate();
|
||||
|
||||
mActivity.adjustCompass(0, 0);
|
||||
mActivity.adjustCompass(0, UiUtils.getCompassYOffset(mActivity));
|
||||
|
||||
if (completionListener != null)
|
||||
completionListener.run();
|
||||
|
|
|
@ -37,6 +37,7 @@ import android.widget.TextView;
|
|||
|
||||
import com.mapswithme.maps.MwmApplication;
|
||||
import com.mapswithme.maps.R;
|
||||
import com.mapswithme.maps.routing.RoutingController;
|
||||
|
||||
public final class UiUtils
|
||||
{
|
||||
|
@ -440,6 +441,13 @@ public final class UiUtils
|
|||
decorViewGroup.addView(statusBarTintView);
|
||||
}
|
||||
|
||||
public static int getCompassYOffset(@NonNull Context context)
|
||||
{
|
||||
return isLandscape(context) && RoutingController.get().isNavigating()
|
||||
? (int)context.getResources()
|
||||
.getDimension(R.dimen.compass_navigation_landscape_offset) : 0;
|
||||
}
|
||||
|
||||
// utility class
|
||||
private UiUtils() {}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue