Fix landscape tablet layout
This commit is contained in:
parent
7667943c3b
commit
5dcf1faa3a
13 changed files with 33 additions and 41 deletions
|
@ -2,7 +2,7 @@
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:id="@+id/main_view"
|
android:id="@+id/main_view"
|
||||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
android:layout_width="350dp"
|
android:layout_width="@dimen/dashboard_land_width"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:layout_gravity="bottom"
|
android:layout_gravity="bottom"
|
||||||
android:background="?attr/left_menu_view_bg"
|
android:background="?attr/left_menu_view_bg"
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:id="@+id/main_view"
|
android:id="@+id/main_view"
|
||||||
android:layout_width="@dimen/map_route_planning_land_width"
|
android:layout_width="@dimen/dashboard_land_width"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:layout_gravity="bottom"
|
android:layout_gravity="bottom"
|
||||||
android:background="@drawable/bg_left_menu_dark"
|
android:background="@drawable/bg_left_menu_dark"
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
android:id="@+id/point_edit_layout"
|
android:id="@+id/point_edit_layout"
|
||||||
android:layout_width="366dp"
|
android:layout_width="@dimen/dashboard_land_width"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:background="?attr/left_menu_view_bg">
|
android:background="?attr/left_menu_view_bg">
|
||||||
|
|
||||||
|
@ -65,7 +65,7 @@
|
||||||
android:layout_marginTop="2dp"
|
android:layout_marginTop="2dp"
|
||||||
android:layout_marginLeft="12dp"
|
android:layout_marginLeft="12dp"
|
||||||
android:layout_marginStart="12dp"
|
android:layout_marginStart="12dp"
|
||||||
android:scaleType="center"
|
android:scaleType="centerInside"
|
||||||
android:src="@drawable/ic_action_building_number"/>
|
android:src="@drawable/ic_action_building_number"/>
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
@ -122,7 +122,7 @@
|
||||||
android:layout_marginTop="2dp"
|
android:layout_marginTop="2dp"
|
||||||
android:layout_marginLeft="12dp"
|
android:layout_marginLeft="12dp"
|
||||||
android:layout_marginStart="12dp"
|
android:layout_marginStart="12dp"
|
||||||
android:scaleType="center"
|
android:scaleType="centerInside"
|
||||||
android:src="@drawable/ic_action_building_number"/>
|
android:src="@drawable/ic_action_building_number"/>
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
android:id="@+id/toolbar_back"
|
android:id="@+id/toolbar_back"
|
||||||
android:contentDescription="@string/back_to_map"
|
android:contentDescription="@string/back_to_map"
|
||||||
android:layout_width="@dimen/list_item_height"
|
android:layout_width="@dimen/list_item_height"
|
||||||
android:layout_height="@dimen/list_item_height"
|
android:layout_height="match_parent"
|
||||||
android:layout_gravity="left"
|
android:layout_gravity="left"
|
||||||
android:background="@drawable/dashboard_button_light"
|
android:background="@drawable/dashboard_button_light"
|
||||||
android:scaleType="center"
|
android:scaleType="center"
|
||||||
|
@ -25,17 +25,18 @@
|
||||||
android:id="@+id/toolbar_list"
|
android:id="@+id/toolbar_list"
|
||||||
android:contentDescription="@string/backToMenu"
|
android:contentDescription="@string/backToMenu"
|
||||||
android:layout_width="@dimen/list_item_height"
|
android:layout_width="@dimen/list_item_height"
|
||||||
android:layout_height="@dimen/list_item_height"
|
android:layout_height="match_parent"
|
||||||
android:layout_gravity="left"
|
android:layout_gravity="left"
|
||||||
android:background="@drawable/dashboard_button_light"
|
android:background="@drawable/dashboard_button_light"
|
||||||
android:scaleType="center"
|
android:scaleType="center"
|
||||||
android:src="@drawable/ic_navigation_drawer"/>
|
android:src="@drawable/ic_navigation_drawer"
|
||||||
|
tools:visibility="gone"/>
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:id="@+id/toolbar_settings"
|
android:id="@+id/toolbar_settings"
|
||||||
android:contentDescription="@string/shared_string_settings"
|
android:contentDescription="@string/shared_string_settings"
|
||||||
android:layout_width="@dimen/list_item_height"
|
android:layout_width="@dimen/list_item_height"
|
||||||
android:layout_height="@dimen/list_item_height"
|
android:layout_height="match_parent"
|
||||||
android:layout_gravity="right"
|
android:layout_gravity="right"
|
||||||
android:background="@drawable/dashboard_button_light"
|
android:background="@drawable/dashboard_button_light"
|
||||||
android:scaleType="center"
|
android:scaleType="center"
|
||||||
|
@ -48,15 +49,15 @@
|
||||||
android:layout_gravity="left"
|
android:layout_gravity="left"
|
||||||
android:scaleType="center"
|
android:scaleType="center"
|
||||||
android:textColor="@color/abc_primary_text_material_dark"
|
android:textColor="@color/abc_primary_text_material_dark"
|
||||||
android:textSize="@dimen/abc_text_size_headline_material"
|
android:textSize="@dimen/abc_text_size_large_material"
|
||||||
tools:text="Toolbar"
|
tools:text="Toolbar"
|
||||||
tools:visibility="gone"/>
|
tools:visibility="visible"/>
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:id="@+id/toolbar_ok"
|
android:id="@+id/toolbar_ok"
|
||||||
android:contentDescription="@string/shared_string_ok"
|
android:contentDescription="@string/shared_string_ok"
|
||||||
android:layout_width="@dimen/list_item_height"
|
android:layout_width="@dimen/list_item_height"
|
||||||
android:layout_height="@dimen/list_item_height"
|
android:layout_height="match_parent"
|
||||||
android:layout_gravity="right"
|
android:layout_gravity="right"
|
||||||
android:background="@drawable/dashboard_button_light"
|
android:background="@drawable/dashboard_button_light"
|
||||||
android:scaleType="center"
|
android:scaleType="center"
|
||||||
|
@ -66,7 +67,7 @@
|
||||||
android:id="@+id/toolbar_sort"
|
android:id="@+id/toolbar_sort"
|
||||||
android:contentDescription="@string/intermediate_points_change_order"
|
android:contentDescription="@string/intermediate_points_change_order"
|
||||||
android:layout_width="@dimen/list_item_height"
|
android:layout_width="@dimen/list_item_height"
|
||||||
android:layout_height="@dimen/list_item_height"
|
android:layout_height="match_parent"
|
||||||
android:layout_gravity="right"
|
android:layout_gravity="right"
|
||||||
android:background="@drawable/dashboard_button_light"
|
android:background="@drawable/dashboard_button_light"
|
||||||
android:scaleType="center"
|
android:scaleType="center"
|
||||||
|
@ -77,7 +78,7 @@
|
||||||
android:id="@+id/toolbar_flat"
|
android:id="@+id/toolbar_flat"
|
||||||
android:contentDescription="@string/drawer"
|
android:contentDescription="@string/drawer"
|
||||||
android:layout_width="@dimen/list_item_height"
|
android:layout_width="@dimen/list_item_height"
|
||||||
android:layout_height="@dimen/list_item_height"
|
android:layout_height="match_parent"
|
||||||
android:layout_gravity="right"
|
android:layout_gravity="right"
|
||||||
android:background="@drawable/dashboard_button_light"
|
android:background="@drawable/dashboard_button_light"
|
||||||
android:scaleType="center"
|
android:scaleType="center"
|
||||||
|
@ -88,7 +89,7 @@
|
||||||
android:id="@+id/toolbar_edit"
|
android:id="@+id/toolbar_edit"
|
||||||
android:contentDescription="@string/shared_string_edit"
|
android:contentDescription="@string/shared_string_edit"
|
||||||
android:layout_width="@dimen/list_item_height"
|
android:layout_width="@dimen/list_item_height"
|
||||||
android:layout_height="@dimen/list_item_height"
|
android:layout_height="match_parent"
|
||||||
android:layout_gravity="right"
|
android:layout_gravity="right"
|
||||||
android:background="@drawable/dashboard_button_light"
|
android:background="@drawable/dashboard_button_light"
|
||||||
android:scaleType="center"
|
android:scaleType="center"
|
||||||
|
|
|
@ -72,7 +72,7 @@
|
||||||
android:layout_marginLeft="12dp"
|
android:layout_marginLeft="12dp"
|
||||||
android:layout_marginStart="12dp"
|
android:layout_marginStart="12dp"
|
||||||
android:layout_marginTop="2dp"
|
android:layout_marginTop="2dp"
|
||||||
android:scaleType="center"
|
android:scaleType="centerInside"
|
||||||
android:src="@drawable/ic_action_building_number"/>
|
android:src="@drawable/ic_action_building_number"/>
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
@ -130,7 +130,7 @@
|
||||||
android:layout_marginLeft="12dp"
|
android:layout_marginLeft="12dp"
|
||||||
android:layout_marginStart="12dp"
|
android:layout_marginStart="12dp"
|
||||||
android:layout_marginTop="2dp"
|
android:layout_marginTop="2dp"
|
||||||
android:scaleType="center"
|
android:scaleType="centerInside"
|
||||||
android:src="@drawable/ic_action_building_number"/>
|
android:src="@drawable/ic_action_building_number"/>
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
|
@ -30,7 +30,6 @@ public class AudioVideoNoteRecordingMenu {
|
||||||
protected long startTime;
|
protected long startTime;
|
||||||
protected Handler handler;
|
protected Handler handler;
|
||||||
protected boolean portraitMode;
|
protected boolean portraitMode;
|
||||||
protected boolean largeDevice;
|
|
||||||
protected Timer recTimer;
|
protected Timer recTimer;
|
||||||
|
|
||||||
protected double lat;
|
protected double lat;
|
||||||
|
@ -50,7 +49,6 @@ public class AudioVideoNoteRecordingMenu {
|
||||||
|
|
||||||
MapActivity mapActivity = plugin.getMapActivity();
|
MapActivity mapActivity = plugin.getMapActivity();
|
||||||
portraitMode = AndroidUiHelper.isOrientationPortrait(mapActivity);
|
portraitMode = AndroidUiHelper.isOrientationPortrait(mapActivity);
|
||||||
largeDevice = AndroidUiHelper.isXLargeDevice(mapActivity);
|
|
||||||
|
|
||||||
initView(mapActivity);
|
initView(mapActivity);
|
||||||
viewfinder = (LinearLayout) view.findViewById(R.id.viewfinder);
|
viewfinder = (LinearLayout) view.findViewById(R.id.viewfinder);
|
||||||
|
@ -106,7 +104,7 @@ public class AudioVideoNoteRecordingMenu {
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isLandscapeLayout() {
|
public boolean isLandscapeLayout() {
|
||||||
return !portraitMode && !largeDevice;
|
return !portraitMode;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void show() {
|
public void show() {
|
||||||
|
|
|
@ -9,12 +9,10 @@ import net.osmand.plus.helpers.AndroidUiHelper;
|
||||||
|
|
||||||
public abstract class BaseMenuController {
|
public abstract class BaseMenuController {
|
||||||
|
|
||||||
public final static float LANDSCAPE_WIDTH_DP = 366f;
|
|
||||||
|
|
||||||
private MapActivity mapActivity;
|
private MapActivity mapActivity;
|
||||||
private boolean portraitMode;
|
private boolean portraitMode;
|
||||||
private boolean largeDevice;
|
|
||||||
private boolean nightMode;
|
private boolean nightMode;
|
||||||
|
private int landscapeWidthPx;
|
||||||
|
|
||||||
public BaseMenuController(MapActivity mapActivity) {
|
public BaseMenuController(MapActivity mapActivity) {
|
||||||
this.mapActivity = mapActivity;
|
this.mapActivity = mapActivity;
|
||||||
|
@ -23,7 +21,7 @@ public abstract class BaseMenuController {
|
||||||
|
|
||||||
private void init() {
|
private void init() {
|
||||||
portraitMode = AndroidUiHelper.isOrientationPortrait(mapActivity);
|
portraitMode = AndroidUiHelper.isOrientationPortrait(mapActivity);
|
||||||
largeDevice = AndroidUiHelper.isXLargeDevice(mapActivity);
|
landscapeWidthPx = mapActivity.getResources().getDimensionPixelSize(R.dimen.dashboard_land_width);
|
||||||
updateNightMode();
|
updateNightMode();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -48,8 +46,8 @@ public abstract class BaseMenuController {
|
||||||
return !portraitMode;
|
return !portraitMode;
|
||||||
}
|
}
|
||||||
|
|
||||||
public float getLandscapeWidthDp() {
|
public int getLandscapeWidthPx() {
|
||||||
return LANDSCAPE_WIDTH_DP;
|
return landscapeWidthPx;
|
||||||
}
|
}
|
||||||
|
|
||||||
public float getHalfScreenMaxHeightKoef() {
|
public float getHalfScreenMaxHeightKoef() {
|
||||||
|
|
|
@ -714,11 +714,11 @@ public class MapContextMenu extends MenuTitleController implements StateChangedL
|
||||||
return menuController != null && menuController.isLandscapeLayout();
|
return menuController != null && menuController.isLandscapeLayout();
|
||||||
}
|
}
|
||||||
|
|
||||||
public float getLandscapeWidthDp() {
|
public int getLandscapeWidthPx() {
|
||||||
if (menuController != null) {
|
if (menuController != null) {
|
||||||
return menuController.getLandscapeWidthDp();
|
return menuController.getLandscapeWidthPx();
|
||||||
} else {
|
} else {
|
||||||
return 0f;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -228,10 +228,10 @@ public class MapContextMenuFragment extends Fragment implements DownloadEvents {
|
||||||
final TypedValue typedValueAttr = new TypedValue();
|
final TypedValue typedValueAttr = new TypedValue();
|
||||||
getMapActivity().getTheme().resolveAttribute(R.attr.left_menu_view_bg, typedValueAttr, true);
|
getMapActivity().getTheme().resolveAttribute(R.attr.left_menu_view_bg, typedValueAttr, true);
|
||||||
mainView.setBackgroundResource(typedValueAttr.resourceId);
|
mainView.setBackgroundResource(typedValueAttr.resourceId);
|
||||||
mainView.setLayoutParams(new FrameLayout.LayoutParams(dpToPx(menu.getLandscapeWidthDp()),
|
mainView.setLayoutParams(new FrameLayout.LayoutParams(menu.getLandscapeWidthPx(),
|
||||||
ViewGroup.LayoutParams.MATCH_PARENT));
|
ViewGroup.LayoutParams.MATCH_PARENT));
|
||||||
View fabContainer = view.findViewById(R.id.context_menu_fab_container);
|
View fabContainer = view.findViewById(R.id.context_menu_fab_container);
|
||||||
fabContainer.setLayoutParams(new FrameLayout.LayoutParams(dpToPx(menu.getLandscapeWidthDp()),
|
fabContainer.setLayoutParams(new FrameLayout.LayoutParams(menu.getLandscapeWidthPx(),
|
||||||
ViewGroup.LayoutParams.MATCH_PARENT));
|
ViewGroup.LayoutParams.MATCH_PARENT));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1098,7 +1098,7 @@ public class MapContextMenuFragment extends Fragment implements DownloadEvents {
|
||||||
latlon = box.getLatLonFromPixel(markerMapCenterX, markerMapCenterY);
|
latlon = box.getLatLonFromPixel(markerMapCenterX, markerMapCenterY);
|
||||||
}
|
}
|
||||||
if (menu.isLandscapeLayout()) {
|
if (menu.isLandscapeLayout()) {
|
||||||
int x = dpToPx(menu.getLandscapeWidthDp());
|
int x = menu.getLandscapeWidthPx();
|
||||||
if (markerX - markerPaddingXPx < x || markerX > origMarkerX) {
|
if (markerX - markerPaddingXPx < x || markerX > origMarkerX) {
|
||||||
int dx = (x + markerPaddingXPx) - markerX;
|
int dx = (x + markerPaddingXPx) - markerX;
|
||||||
int dy = 0;
|
int dy = 0;
|
||||||
|
|
|
@ -31,7 +31,7 @@ import static android.util.TypedValue.COMPLEX_UNIT_DIP;
|
||||||
|
|
||||||
public class MenuBuilder {
|
public class MenuBuilder {
|
||||||
|
|
||||||
public static final float SHADOW_HEIGHT_TOP_DP = 16f;
|
public static final float SHADOW_HEIGHT_TOP_DP = 17f;
|
||||||
|
|
||||||
protected OsmandApplication app;
|
protected OsmandApplication app;
|
||||||
protected LinkedList<PlainMenuItem> plainMenuItems;
|
protected LinkedList<PlainMenuItem> plainMenuItems;
|
||||||
|
|
|
@ -15,13 +15,11 @@ public abstract class PointEditor {
|
||||||
protected boolean isNew;
|
protected boolean isNew;
|
||||||
|
|
||||||
private boolean portraitMode;
|
private boolean portraitMode;
|
||||||
private boolean largeDevice;
|
|
||||||
private boolean nightMode;
|
private boolean nightMode;
|
||||||
|
|
||||||
public PointEditor(MapActivity mapActivity) {
|
public PointEditor(MapActivity mapActivity) {
|
||||||
this.app = mapActivity.getMyApplication();
|
this.app = mapActivity.getMyApplication();
|
||||||
this.mapActivity = mapActivity;
|
this.mapActivity = mapActivity;
|
||||||
largeDevice = AndroidUiHelper.isXLargeDevice(mapActivity);
|
|
||||||
updateLandscapePortrait();
|
updateLandscapePortrait();
|
||||||
updateNightMode();
|
updateNightMode();
|
||||||
}
|
}
|
||||||
|
@ -35,7 +33,7 @@ public abstract class PointEditor {
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isLandscapeLayout() {
|
public boolean isLandscapeLayout() {
|
||||||
return !portraitMode && !largeDevice;
|
return !portraitMode;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isLight() {
|
public boolean isLight() {
|
||||||
|
|
|
@ -115,8 +115,7 @@ public class MapRouteInfoMenuFragment extends Fragment {
|
||||||
public void applyDayNightMode() {
|
public void applyDayNightMode() {
|
||||||
MapActivity ctx = getMapActivity();
|
MapActivity ctx = getMapActivity();
|
||||||
boolean portraitMode = AndroidUiHelper.isOrientationPortrait(ctx);
|
boolean portraitMode = AndroidUiHelper.isOrientationPortrait(ctx);
|
||||||
boolean largeDevice = AndroidUiHelper.isXLargeDevice(ctx);
|
boolean landscapeLayout = !portraitMode;
|
||||||
boolean landscapeLayout = !portraitMode && !largeDevice;
|
|
||||||
boolean nightMode = ctx.getMyApplication().getDaynightHelper().isNightModeForMapControls();
|
boolean nightMode = ctx.getMyApplication().getDaynightHelper().isNightModeForMapControls();
|
||||||
if (!landscapeLayout) {
|
if (!landscapeLayout) {
|
||||||
AndroidUtils.setBackground(ctx, mainView, nightMode, R.drawable.bg_bottom_menu_light, R.drawable.bg_bottom_menu_dark);
|
AndroidUtils.setBackground(ctx, mainView, nightMode, R.drawable.bg_bottom_menu_light, R.drawable.bg_bottom_menu_dark);
|
||||||
|
|
|
@ -36,7 +36,6 @@ public class MapMarkersWidgetsFactory {
|
||||||
private MapMarkersHelper helper;
|
private MapMarkersHelper helper;
|
||||||
private int screenOrientation;
|
private int screenOrientation;
|
||||||
private boolean portraitMode;
|
private boolean portraitMode;
|
||||||
private boolean largeDevice;
|
|
||||||
|
|
||||||
private View topBar;
|
private View topBar;
|
||||||
private View addressTopBar;
|
private View addressTopBar;
|
||||||
|
@ -62,7 +61,6 @@ public class MapMarkersWidgetsFactory {
|
||||||
helper = map.getMyApplication().getMapMarkersHelper();
|
helper = map.getMyApplication().getMapMarkersHelper();
|
||||||
screenOrientation = DashLocationFragment.getScreenOrientation(map);
|
screenOrientation = DashLocationFragment.getScreenOrientation(map);
|
||||||
portraitMode = AndroidUiHelper.isOrientationPortrait(map);
|
portraitMode = AndroidUiHelper.isOrientationPortrait(map);
|
||||||
largeDevice = AndroidUiHelper.isXLargeDevice(map);
|
|
||||||
|
|
||||||
addressTopBar = map.findViewById(R.id.map_top_bar);
|
addressTopBar = map.findViewById(R.id.map_top_bar);
|
||||||
topBar = map.findViewById(R.id.map_markers_top_bar);
|
topBar = map.findViewById(R.id.map_markers_top_bar);
|
||||||
|
@ -304,7 +302,7 @@ public class MapMarkersWidgetsFactory {
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isLandscapeLayout() {
|
public boolean isLandscapeLayout() {
|
||||||
return !portraitMode && !largeDevice;
|
return !portraitMode;
|
||||||
}
|
}
|
||||||
|
|
||||||
public abstract static class DistanceToMapMarkerControl extends TextInfoWidget {
|
public abstract static class DistanceToMapMarkerControl extends TextInfoWidget {
|
||||||
|
|
Loading…
Reference in a new issue