Fix context menu shadow (landscape mode), fix fav edit crash (landscape mode)

This commit is contained in:
Alexey Kulish 2015-11-20 20:46:34 +03:00
parent 8bc73e0410
commit 9d55b74418
4 changed files with 20 additions and 4 deletions

View file

@ -2,9 +2,9 @@
<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="350dp" android:layout_width="366dp"
android:layout_height="match_parent" android:layout_height="match_parent"
android:background="@android:color/transparent"> android:background="?attr/left_menu_view_bg">
<LinearLayout <LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"
@ -30,6 +30,14 @@
android:background="@android:color/transparent" android:background="@android:color/transparent"
android:src="@drawable/ic_action_delete_dark"/> android:src="@drawable/ic_action_delete_dark"/>
<ImageButton
android:id="@+id/ok_button"
android:layout_width="?attr/actionBarSize"
android:layout_height="match_parent"
android:layout_gravity="right"
android:background="@android:color/transparent"
android:src="@drawable/ic_action_done"/>
<Button <Button
android:id="@+id/save_button" android:id="@+id/save_button"
android:layout_width="wrap_content" android:layout_width="wrap_content"

View file

@ -10,7 +10,7 @@ import net.osmand.plus.helpers.AndroidUiHelper;
public abstract class BaseMenuController { public abstract class BaseMenuController {
public final static float LANDSCAPE_WIDTH_DP = 350f; public final static float LANDSCAPE_WIDTH_DP = 366f;
private MapActivity mapActivity; private MapActivity mapActivity;
private boolean portraitMode; private boolean portraitMode;

View file

@ -219,6 +219,9 @@ public class MapContextMenuFragment extends Fragment implements DownloadEvents {
updateButtonsAndProgress(); updateButtonsAndProgress();
if (menu.isLandscapeLayout()) { if (menu.isLandscapeLayout()) {
final TypedValue typedValueAttr = new TypedValue();
getMapActivity().getTheme().resolveAttribute(R.attr.left_menu_view_bg, typedValueAttr, true);
mainView.setBackgroundResource(typedValueAttr.resourceId);
mainView.setLayoutParams(new FrameLayout.LayoutParams(dpToPx(menu.getLandscapeWidthDp()), mainView.setLayoutParams(new FrameLayout.LayoutParams(dpToPx(menu.getLandscapeWidthDp()),
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);
@ -330,6 +333,11 @@ public class MapContextMenuFragment extends Fragment implements DownloadEvents {
// FAB // FAB
fabView = (ImageView)view.findViewById(R.id.context_menu_fab_view); fabView = (ImageView)view.findViewById(R.id.context_menu_fab_view);
if (menu.fabVisible()) { if (menu.fabVisible()) {
if (menu.isLandscapeLayout()) {
FrameLayout.LayoutParams params = (FrameLayout.LayoutParams) fabView.getLayoutParams();
params.setMargins(0, 0, dpToPx(28f), 0);
fabView.setLayoutParams(params);
}
fabView.setOnClickListener(new View.OnClickListener() { fabView.setOnClickListener(new View.OnClickListener() {
@Override @Override
public void onClick(View v) { public void onClick(View v) {

View file

@ -89,9 +89,9 @@ public class AmenityMenuController extends MenuController {
@Override @Override
public void addPlainMenuItems(String typeStr, PointDescription pointDescription, LatLon latLon) { public void addPlainMenuItems(String typeStr, PointDescription pointDescription, LatLon latLon) {
if (!Algorithms.isEmpty(typeStr)) { if (!Algorithms.isEmpty(typeStr)) {
PoiCategory pc = amenity.getType();
int resId = getLeftIconId(); int resId = getLeftIconId();
if (resId == 0) { if (resId == 0) {
PoiCategory pc = amenity.getType();
resId = RenderingIcons.getBigIconResourceId(pc.getIconKeyName()); resId = RenderingIcons.getBigIconResourceId(pc.getIconKeyName());
} }
if (resId == 0) { if (resId == 0) {