Resources fix
This commit is contained in:
parent
326de731b3
commit
89186bd2b3
9 changed files with 211 additions and 165 deletions
Binary file not shown.
Before Width: | Height: | Size: 1.8 KiB |
Binary file not shown.
Before Width: | Height: | Size: 1.5 KiB |
Binary file not shown.
Before Width: | Height: | Size: 2.2 KiB |
Binary file not shown.
Before Width: | Height: | Size: 2.8 KiB |
|
@ -1,7 +1,7 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
|
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
<item>
|
<item>
|
||||||
<nine-patch android:src="@drawable/bottom_shadow" />
|
<nine-patch android:src="@drawable/bg_contextmenu_dots_light" />
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<shape>
|
<shape>
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
|
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
<item>
|
<item>
|
||||||
<nine-patch android:src="@drawable/bottom_shadow" />
|
<nine-patch android:src="@drawable/bg_contextmenu_dots_light" />
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<shape>
|
<shape>
|
||||||
|
|
|
@ -1,10 +1,11 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<LinearLayout android:id="@+id/context_menu_layout"
|
<LinearLayout
|
||||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
android:id="@+id/context_menu_layout"
|
||||||
android:layout_width="fill_parent"
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
android:layout_height="fill_parent"
|
android:layout_width="fill_parent"
|
||||||
android:background="@android:color/transparent"
|
android:layout_height="fill_parent"
|
||||||
android:orientation="vertical">
|
android:background="@android:color/transparent"
|
||||||
|
android:orientation="vertical">
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:id="@+id/context_menu_shadow_view"
|
android:id="@+id/context_menu_shadow_view"
|
||||||
|
@ -18,150 +19,165 @@
|
||||||
android:layout_width="fill_parent"
|
android:layout_width="fill_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_gravity="bottom"
|
android:layout_gravity="bottom"
|
||||||
android:background="?attr/bg_map_context_menu"
|
|
||||||
android:orientation="vertical">
|
android:orientation="vertical">
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:id="@+id/context_menu_top_view"
|
android:id="@+id/context_menu_top_shadow"
|
||||||
android:baselineAligned="false"
|
|
||||||
android:layout_width="fill_parent"
|
android:layout_width="fill_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="20dp"
|
||||||
android:orientation="horizontal">
|
android:orientation="horizontal">
|
||||||
|
|
||||||
<LinearLayout
|
|
||||||
android:id="@+id/context_menu_icon_layout"
|
|
||||||
android:orientation="horizontal"
|
|
||||||
android:layout_width="42dp"
|
|
||||||
android:layout_height="match_parent">
|
|
||||||
|
|
||||||
<ImageView
|
|
||||||
android:id="@+id/context_menu_icon_view"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:scaleType="center"
|
|
||||||
android:layout_marginStart="12dp"
|
|
||||||
android:layout_marginLeft="12dp"
|
|
||||||
android:layout_marginTop="18dp"
|
|
||||||
android:src="@drawable/ic_action_building_number"/>
|
|
||||||
|
|
||||||
</LinearLayout>
|
|
||||||
|
|
||||||
<LinearLayout
|
|
||||||
android:layout_width="0dp"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_weight="1"
|
|
||||||
android:layout_marginTop="15dp"
|
|
||||||
android:layout_marginBottom="16dp"
|
|
||||||
android:orientation="vertical">
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/context_menu_line1"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_marginLeft="12dp"
|
|
||||||
android:layout_marginRight="12dp"
|
|
||||||
android:text="@string/search_address_building"
|
|
||||||
android:textSize="@dimen/default_list_text_size_large"
|
|
||||||
android:textColor="?android:textColorPrimary"/>
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/context_menu_line2"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_marginLeft="12dp"
|
|
||||||
android:layout_marginRight="12dp"
|
|
||||||
android:layout_marginTop="4dp"
|
|
||||||
android:text="@string/other_location"
|
|
||||||
android:textColor="?android:textColorSecondary"
|
|
||||||
android:textSize="@dimen/default_desc_text_size"/>
|
|
||||||
|
|
||||||
|
|
||||||
</LinearLayout>
|
|
||||||
|
|
||||||
<LinearLayout
|
|
||||||
android:id="@+id/context_menu_close_btn_layout"
|
|
||||||
android:orientation="horizontal"
|
|
||||||
android:layout_width="32dp"
|
|
||||||
android:layout_height="match_parent">
|
|
||||||
|
|
||||||
<ImageView
|
|
||||||
android:id="@+id/context_menu_close_btn_view"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_gravity="top"
|
|
||||||
android:layout_marginTop="12dp"
|
|
||||||
android:scaleType="center"
|
|
||||||
android:src="@drawable/ic_action_remove_dark"/>
|
|
||||||
|
|
||||||
</LinearLayout>
|
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
<View
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="1dp"
|
|
||||||
android:background="?attr/dashboard_divider"/>
|
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:id="@+id/context_menu_buttons"
|
android:layout_width="fill_parent"
|
||||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
android:layout_height="wrap_content"
|
||||||
android:layout_width="match_parent"
|
android:background="?attr/bg_map_context_menu"
|
||||||
android:layout_height="54dp">
|
android:orientation="vertical">
|
||||||
|
|
||||||
<ImageButton
|
<LinearLayout
|
||||||
android:id="@+id/context_menu_route_button"
|
android:id="@+id/context_menu_top_view"
|
||||||
android:layout_width="fill_parent"
|
android:layout_width="fill_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="wrap_content"
|
||||||
android:layout_gravity="center_vertical"
|
android:baselineAligned="false"
|
||||||
android:layout_weight="1"
|
android:orientation="horizontal">
|
||||||
android:scaleType="center"
|
|
||||||
android:background="?attr/dashboard_button"
|
<LinearLayout
|
||||||
android:src="@drawable/map_directions"/>
|
android:id="@+id/context_menu_icon_layout"
|
||||||
|
android:layout_width="42dp"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:orientation="horizontal">
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/context_menu_icon_view"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginLeft="12dp"
|
||||||
|
android:layout_marginStart="12dp"
|
||||||
|
android:layout_marginTop="18dp"
|
||||||
|
android:scaleType="center"
|
||||||
|
android:src="@drawable/ic_action_building_number"/>
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginBottom="16dp"
|
||||||
|
android:layout_marginTop="15dp"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:orientation="vertical">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/context_menu_line1"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginLeft="12dp"
|
||||||
|
android:layout_marginRight="12dp"
|
||||||
|
android:text="@string/search_address_building"
|
||||||
|
android:textColor="?android:textColorPrimary"
|
||||||
|
android:textSize="@dimen/default_list_text_size_large"/>
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/context_menu_line2"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginLeft="12dp"
|
||||||
|
android:layout_marginRight="12dp"
|
||||||
|
android:layout_marginTop="4dp"
|
||||||
|
android:text="@string/other_location"
|
||||||
|
android:textColor="?android:textColorSecondary"
|
||||||
|
android:textSize="@dimen/default_desc_text_size"/>
|
||||||
|
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:id="@+id/context_menu_close_btn_layout"
|
||||||
|
android:layout_width="32dp"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:orientation="horizontal">
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/context_menu_close_btn_view"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_gravity="top"
|
||||||
|
android:layout_marginTop="12dp"
|
||||||
|
android:scaleType="center"
|
||||||
|
android:src="@drawable/ic_action_remove_dark"/>
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
<View
|
<View
|
||||||
android:layout_height="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_width="1dp"
|
android:layout_height="1dp"
|
||||||
android:background="?attr/dashboard_divider"/>
|
android:background="?attr/dashboard_divider"/>
|
||||||
|
|
||||||
<ImageButton
|
<LinearLayout
|
||||||
android:id="@+id/context_menu_fav_button"
|
android:id="@+id/context_menu_buttons"
|
||||||
android:layout_width="fill_parent"
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
android:layout_height="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_gravity="center_vertical"
|
android:layout_height="54dp">
|
||||||
android:layout_weight="1"
|
|
||||||
android:scaleType="center"
|
|
||||||
android:background="?attr/dashboard_button"
|
|
||||||
android:src="@drawable/ic_action_fav_dark"/>
|
|
||||||
|
|
||||||
<View
|
<ImageButton
|
||||||
android:layout_height="match_parent"
|
android:id="@+id/context_menu_route_button"
|
||||||
android:layout_width="1dp"
|
android:layout_width="fill_parent"
|
||||||
android:background="?attr/dashboard_divider"/>
|
android:layout_height="match_parent"
|
||||||
|
android:layout_gravity="center_vertical"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:background="?attr/dashboard_button"
|
||||||
|
android:scaleType="center"
|
||||||
|
android:src="@drawable/map_directions"/>
|
||||||
|
|
||||||
<ImageButton
|
<View
|
||||||
android:id="@+id/context_menu_share_button"
|
android:layout_width="1dp"
|
||||||
android:layout_width="fill_parent"
|
android:layout_height="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:background="?attr/dashboard_divider"/>
|
||||||
android:layout_gravity="center_vertical"
|
|
||||||
android:layout_weight="1"
|
|
||||||
android:scaleType="center"
|
|
||||||
android:background="?attr/dashboard_button"
|
|
||||||
android:src="@drawable/abc_ic_menu_share_mtrl_alpha"/>
|
|
||||||
|
|
||||||
<View
|
<ImageButton
|
||||||
android:layout_height="match_parent"
|
android:id="@+id/context_menu_fav_button"
|
||||||
android:layout_width="1dp"
|
android:layout_width="fill_parent"
|
||||||
android:background="?attr/dashboard_divider"/>
|
android:layout_height="match_parent"
|
||||||
|
android:layout_gravity="center_vertical"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:background="?attr/dashboard_button"
|
||||||
|
android:scaleType="center"
|
||||||
|
android:src="@drawable/ic_action_fav_dark"/>
|
||||||
|
|
||||||
<ImageButton
|
<View
|
||||||
android:id="@+id/context_menu_more_button"
|
android:layout_width="1dp"
|
||||||
android:layout_width="fill_parent"
|
android:layout_height="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:background="?attr/dashboard_divider"/>
|
||||||
android:layout_gravity="center_vertical"
|
|
||||||
android:layout_weight="1"
|
<ImageButton
|
||||||
android:scaleType="center"
|
android:id="@+id/context_menu_share_button"
|
||||||
android:background="?attr/dashboard_button"
|
android:layout_width="fill_parent"
|
||||||
android:src="@drawable/ic_overflow_menu_white"/>
|
android:layout_height="match_parent"
|
||||||
|
android:layout_gravity="center_vertical"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:background="?attr/dashboard_button"
|
||||||
|
android:scaleType="center"
|
||||||
|
android:src="@drawable/abc_ic_menu_share_mtrl_alpha"/>
|
||||||
|
|
||||||
|
<View
|
||||||
|
android:layout_width="1dp"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:background="?attr/dashboard_divider"/>
|
||||||
|
|
||||||
|
<ImageButton
|
||||||
|
android:id="@+id/context_menu_more_button"
|
||||||
|
android:layout_width="fill_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:layout_gravity="center_vertical"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:background="?attr/dashboard_button"
|
||||||
|
android:scaleType="center"
|
||||||
|
android:src="@drawable/ic_overflow_menu_white"/>
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
|
@ -169,14 +185,8 @@
|
||||||
android:id="@+id/context_menu_bottom_view"
|
android:id="@+id/context_menu_bottom_view"
|
||||||
android:layout_width="fill_parent"
|
android:layout_width="fill_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:orientation="vertical"
|
android:background="?attr/ctx_menu_info_view_bg"
|
||||||
android:background="?attr/ctx_menu_info_view_bg">
|
android:orientation="vertical">
|
||||||
|
|
||||||
<View
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="1dp"
|
|
||||||
android:background="?attr/dashboard_divider"/>
|
|
||||||
|
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
|
|
|
@ -25,6 +25,7 @@ import net.osmand.plus.OsmandApplication;
|
||||||
import net.osmand.plus.R;
|
import net.osmand.plus.R;
|
||||||
import net.osmand.plus.activities.MapActivity;
|
import net.osmand.plus.activities.MapActivity;
|
||||||
import net.osmand.plus.mapcontextmenu.sections.MenuController;
|
import net.osmand.plus.mapcontextmenu.sections.MenuController;
|
||||||
|
import net.osmand.plus.views.OsmandMapTileView;
|
||||||
|
|
||||||
import org.apache.commons.logging.Log;
|
import org.apache.commons.logging.Log;
|
||||||
|
|
||||||
|
@ -45,6 +46,7 @@ public class MapContextMenuFragment extends Fragment {
|
||||||
MenuController menuController;
|
MenuController menuController;
|
||||||
|
|
||||||
private int menuTopHeight;
|
private int menuTopHeight;
|
||||||
|
private int menuTopShadowHeight;
|
||||||
private int menuButtonsHeight;
|
private int menuButtonsHeight;
|
||||||
private int menuBottomViewHeight;
|
private int menuBottomViewHeight;
|
||||||
private int menuFullHeight;
|
private int menuFullHeight;
|
||||||
|
@ -97,6 +99,7 @@ public class MapContextMenuFragment extends Fragment {
|
||||||
public void onGlobalLayout() {
|
public void onGlobalLayout() {
|
||||||
|
|
||||||
menuTopHeight = view.findViewById(R.id.context_menu_top_view).getHeight();
|
menuTopHeight = view.findViewById(R.id.context_menu_top_view).getHeight();
|
||||||
|
menuTopShadowHeight = view.findViewById(R.id.context_menu_top_shadow).getHeight();
|
||||||
menuButtonsHeight = view.findViewById(R.id.context_menu_buttons).getHeight();
|
menuButtonsHeight = view.findViewById(R.id.context_menu_buttons).getHeight();
|
||||||
menuBottomViewHeight = view.findViewById(R.id.context_menu_bottom_view).getHeight();
|
menuBottomViewHeight = view.findViewById(R.id.context_menu_bottom_view).getHeight();
|
||||||
menuFullHeight = view.findViewById(R.id.context_menu_main).getHeight();
|
menuFullHeight = view.findViewById(R.id.context_menu_main).getHeight();
|
||||||
|
@ -130,11 +133,9 @@ public class MapContextMenuFragment extends Fragment {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
View topView = view.findViewById(R.id.context_menu_top_view);
|
|
||||||
mainView = view.findViewById(R.id.context_menu_main);
|
mainView = view.findViewById(R.id.context_menu_main);
|
||||||
|
|
||||||
topView.setOnTouchListener(new View.OnTouchListener() {
|
View.OnTouchListener slideTouchListener = new View.OnTouchListener() {
|
||||||
|
|
||||||
private float dy;
|
private float dy;
|
||||||
private float dyMain;
|
private float dyMain;
|
||||||
private int destinationState;
|
private int destinationState;
|
||||||
|
@ -144,11 +145,29 @@ public class MapContextMenuFragment extends Fragment {
|
||||||
|
|
||||||
private float velocityY;
|
private float velocityY;
|
||||||
|
|
||||||
|
private float startX;
|
||||||
|
private float startY;
|
||||||
|
private long lastTouchDown;
|
||||||
|
private final int CLICK_ACTION_THRESHHOLD = 200;
|
||||||
|
|
||||||
|
private boolean isClick(float endX, float endY) {
|
||||||
|
float differenceX = Math.abs(startX - endX);
|
||||||
|
float differenceY = Math.abs(startY - endY);
|
||||||
|
if (differenceX > 3 || differenceY > 3 || System.currentTimeMillis() - lastTouchDown > CLICK_ACTION_THRESHHOLD) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onTouch(View v, MotionEvent event) {
|
public boolean onTouch(View v, MotionEvent event) {
|
||||||
|
|
||||||
switch (event.getAction()) {
|
switch (event.getAction()) {
|
||||||
case MotionEvent.ACTION_DOWN:
|
case MotionEvent.ACTION_DOWN:
|
||||||
|
startX = event.getX();
|
||||||
|
startY = event.getY();
|
||||||
|
lastTouchDown = System.currentTimeMillis();
|
||||||
|
|
||||||
dy = event.getY();
|
dy = event.getY();
|
||||||
dyMain = mainView.getY();
|
dyMain = mainView.getY();
|
||||||
velocity = VelocityTracker.obtain();
|
velocity = VelocityTracker.obtain();
|
||||||
|
@ -177,6 +196,8 @@ public class MapContextMenuFragment extends Fragment {
|
||||||
|
|
||||||
case MotionEvent.ACTION_UP:
|
case MotionEvent.ACTION_UP:
|
||||||
case MotionEvent.ACTION_CANCEL:
|
case MotionEvent.ACTION_CANCEL:
|
||||||
|
float endX = event.getX();
|
||||||
|
float endY = event.getY();
|
||||||
|
|
||||||
slidingUp = Math.abs(velocityY) > 500 && (mainView.getY() - dyMain) < -50;
|
slidingUp = Math.abs(velocityY) > 500 && (mainView.getY() - dyMain) < -50;
|
||||||
slidingDown = Math.abs(velocityY) > 500 && (mainView.getY() - dyMain) > 50;
|
slidingDown = Math.abs(velocityY) > 500 && (mainView.getY() - dyMain) > 50;
|
||||||
|
@ -203,7 +224,7 @@ public class MapContextMenuFragment extends Fragment {
|
||||||
posY = view.getHeight() - menuFullHeight;
|
posY = view.getHeight() - menuFullHeight;
|
||||||
break;
|
break;
|
||||||
case MenuController.MenuState.FULL_SCREEN:
|
case MenuController.MenuState.FULL_SCREEN:
|
||||||
posY = 0;
|
posY = -menuTopShadowHeight;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
@ -222,20 +243,24 @@ public class MapContextMenuFragment extends Fragment {
|
||||||
bottomBorder.animate().y(posY + menuFullHeight).setDuration(200).setInterpolator(new DecelerateInterpolator()).start();
|
bottomBorder.animate().y(posY + menuFullHeight).setDuration(200).setInterpolator(new DecelerateInterpolator()).start();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// OnClick event
|
||||||
/*
|
if (isClick(endX, endY)) {
|
||||||
lp = shadowView.getLayoutParams();
|
OsmandMapTileView mapView = getMapActivity().getMapView();
|
||||||
lp.height = view.getHeight() - (int)posY;
|
mapView.getAnimatedDraggingThread().startMoving(getCtxMenu().getPointDescription().getLat(), getCtxMenu().getPointDescription().getLon(),
|
||||||
shadowView.setLayoutParams(lp);
|
mapView.getZoom(), true);
|
||||||
shadowView.requestLayout();
|
}
|
||||||
*/
|
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
});
|
};
|
||||||
|
|
||||||
|
View topView = view.findViewById(R.id.context_menu_top_view);
|
||||||
|
topView.setOnTouchListener(slideTouchListener);
|
||||||
|
View topShadowView = view.findViewById(R.id.context_menu_top_shadow);
|
||||||
|
topShadowView.setOnTouchListener(slideTouchListener);
|
||||||
|
|
||||||
// Left icon
|
// Left icon
|
||||||
IconsCache iconsCache = getMyApplication().getIconsCache();
|
IconsCache iconsCache = getMyApplication().getIconsCache();
|
||||||
|
@ -357,7 +382,7 @@ public class MapContextMenuFragment extends Fragment {
|
||||||
break;
|
break;
|
||||||
case MenuController.MenuState.FULL_SCREEN:
|
case MenuController.MenuState.FULL_SCREEN:
|
||||||
shadowViewHeight = 0;
|
shadowViewHeight = 0;
|
||||||
bottomBorderHeight = view.getHeight() - menuFullHeight;
|
bottomBorderHeight = view.getHeight() - menuFullHeight + menuTopShadowHeight;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
@ -376,6 +401,8 @@ public class MapContextMenuFragment extends Fragment {
|
||||||
lp.height = menuFullHeight;
|
lp.height = menuFullHeight;
|
||||||
mainView.setLayoutParams(lp);
|
mainView.setLayoutParams(lp);
|
||||||
|
|
||||||
|
mainView.bringToFront();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void dismissMenu() {
|
public void dismissMenu() {
|
||||||
|
|
|
@ -26,6 +26,8 @@ import static android.util.TypedValue.COMPLEX_UNIT_DIP;
|
||||||
|
|
||||||
public class AmenityInfoMenuBuilder extends MenuBuilder {
|
public class AmenityInfoMenuBuilder extends MenuBuilder {
|
||||||
|
|
||||||
|
private static float SHADOW_HEIGHT = 6f; // in dp
|
||||||
|
|
||||||
private final Amenity amenity;
|
private final Amenity amenity;
|
||||||
|
|
||||||
public AmenityInfoMenuBuilder(OsmandApplication app, final Amenity amenity) {
|
public AmenityInfoMenuBuilder(OsmandApplication app, final Amenity amenity) {
|
||||||
|
@ -33,7 +35,7 @@ public class AmenityInfoMenuBuilder extends MenuBuilder {
|
||||||
this.amenity = amenity;
|
this.amenity = amenity;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void buildRow(View view, int iconId, String text) {
|
private void buildRow(View view, int iconId, String text, boolean firstRow) {
|
||||||
boolean light = app.getSettings().isLightContent();
|
boolean light = app.getSettings().isLightContent();
|
||||||
|
|
||||||
LinearLayout ll = new LinearLayout(view.getContext());
|
LinearLayout ll = new LinearLayout(view.getContext());
|
||||||
|
@ -45,13 +47,13 @@ public class AmenityInfoMenuBuilder extends MenuBuilder {
|
||||||
// Icon
|
// Icon
|
||||||
LinearLayout llIcon = new LinearLayout(view.getContext());
|
LinearLayout llIcon = new LinearLayout(view.getContext());
|
||||||
llIcon.setOrientation(LinearLayout.HORIZONTAL);
|
llIcon.setOrientation(LinearLayout.HORIZONTAL);
|
||||||
llIcon.setLayoutParams(new LinearLayout.LayoutParams(dpToPx(72f), dpToPx(48f)));
|
llIcon.setLayoutParams(new LinearLayout.LayoutParams(dpToPx(72f), firstRow ? dpToPx(48f) - dpToPx(SHADOW_HEIGHT) : dpToPx(48f)));
|
||||||
llIcon.setGravity(Gravity.CENTER_VERTICAL);
|
llIcon.setGravity(Gravity.CENTER_VERTICAL);
|
||||||
ll.addView(llIcon);
|
ll.addView(llIcon);
|
||||||
|
|
||||||
ImageView icon = new ImageView(view.getContext());
|
ImageView icon = new ImageView(view.getContext());
|
||||||
LinearLayout.LayoutParams llIconParams = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT) ;
|
LinearLayout.LayoutParams llIconParams = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT) ;
|
||||||
llIconParams.setMargins(dpToPx(16f), dpToPx(12f), dpToPx(32f), dpToPx(12f));
|
llIconParams.setMargins(dpToPx(16f), firstRow ? dpToPx(12f) - dpToPx(SHADOW_HEIGHT) : dpToPx(12f), dpToPx(32f), dpToPx(12f));
|
||||||
llIconParams.gravity = Gravity.CENTER_VERTICAL;
|
llIconParams.gravity = Gravity.CENTER_VERTICAL;
|
||||||
icon.setLayoutParams(llIconParams);
|
icon.setLayoutParams(llIconParams);
|
||||||
icon.setScaleType(ImageView.ScaleType.CENTER);
|
icon.setScaleType(ImageView.ScaleType.CENTER);
|
||||||
|
@ -65,18 +67,22 @@ public class AmenityInfoMenuBuilder extends MenuBuilder {
|
||||||
|
|
||||||
TextView textView = new TextView(view.getContext());
|
TextView textView = new TextView(view.getContext());
|
||||||
LinearLayout.LayoutParams llTextParams = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
|
LinearLayout.LayoutParams llTextParams = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
|
||||||
llTextParams.setMargins(0, dpToPx(8f), 0, dpToPx(8f));
|
llTextParams.setMargins(0, firstRow ? dpToPx(8f) - dpToPx(SHADOW_HEIGHT) : dpToPx(8f), 0, dpToPx(8f));
|
||||||
textView.setLayoutParams(llTextParams);
|
textView.setLayoutParams(llTextParams);
|
||||||
textView.setTextSize(18); // todo: create constant
|
textView.setTextSize(16); // todo: create constant
|
||||||
textView.setTextColor(app.getResources().getColor(light ? R.color.ctx_menu_info_text_light : R.color.ctx_menu_info_text_dark));
|
textView.setTextColor(app.getResources().getColor(light ? R.color.ctx_menu_info_text_light : R.color.ctx_menu_info_text_dark));
|
||||||
|
|
||||||
SpannableString spannable = new SpannableString(text);
|
//text = "http://ru.wikipedia.org/wiki/Храм Святого Розария (Владимир)";
|
||||||
Linkify.addLinks(spannable, Linkify.ALL);
|
|
||||||
textView.setClickable(true);
|
//SpannableString spannable = new SpannableString(text);
|
||||||
textView.setMovementMethod(LinkMovementMethod.getInstance());
|
//Linkify.addLinks(spannable, Linkify.ALL);
|
||||||
|
//textView.setClickable(true);
|
||||||
|
//textView.setMovementMethod(LinkMovementMethod.getInstance());
|
||||||
|
textView.setAutoLinkMask(Linkify.ALL);
|
||||||
|
//textView.setSingleLine();
|
||||||
textView.setLinksClickable(true);
|
textView.setLinksClickable(true);
|
||||||
|
|
||||||
textView.setText(spannable);
|
textView.setText(text);
|
||||||
//textView.setText("sdf dsaf fsdasdfg adsf asdsfd asdf sdf adsfg asdf sdfa sdf dsf agsfdgd fgsfd sdf asdf adg adf sdf asdf dfgdfsg sdfg adsf asdf asdf sdf SDF ASDF ADSF ASDF ASDF DAF SDAF dfg dsfg dfg sdfg rg rth sfghs dfgs dfgsdfg adfg dfg sdfg dfs ");
|
//textView.setText("sdf dsaf fsdasdfg adsf asdsfd asdf sdf adsfg asdf sdfa sdf dsf agsfdgd fgsfd sdf asdf adg adf sdf asdf dfgdfsg sdfg adsf asdf asdf sdf SDF ASDF ADSF ASDF ASDF DAF SDAF dfg dsfg dfg sdfg rg rth sfghs dfgs dfgsdfg adfg dfg sdfg dfs ");
|
||||||
|
|
||||||
LinearLayout.LayoutParams llTextViewParams = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
|
LinearLayout.LayoutParams llTextViewParams = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
|
||||||
|
@ -109,6 +115,8 @@ public class AmenityInfoMenuBuilder extends MenuBuilder {
|
||||||
@Override
|
@Override
|
||||||
public void build(View view) {
|
public void build(View view) {
|
||||||
|
|
||||||
|
boolean firstRow = true;
|
||||||
|
|
||||||
MapPoiTypes poiTypes = app.getPoiTypes();
|
MapPoiTypes poiTypes = app.getPoiTypes();
|
||||||
for(Map.Entry<String, String> e : amenity.getAdditionalInfo().entrySet()) {
|
for(Map.Entry<String, String> e : amenity.getAdditionalInfo().entrySet()) {
|
||||||
int iconId;
|
int iconId;
|
||||||
|
@ -141,7 +149,8 @@ public class AmenityInfoMenuBuilder extends MenuBuilder {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
buildRow(view, iconId, vl);
|
buildRow(view, iconId, vl, firstRow);
|
||||||
|
firstRow = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue