Context menu - few fixes
This commit is contained in:
parent
748337ada6
commit
bb588f0816
2 changed files with 8 additions and 12 deletions
|
@ -2,12 +2,12 @@
|
|||
<LinearLayout android:id="@+id/context_menu_layout"
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="bottom"
|
||||
android:layout_height="fill_parent"
|
||||
android:background="@android:color/transparent"
|
||||
android:orientation="vertical">
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/context_menu_shadow_layout"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="1"
|
||||
|
@ -24,12 +24,12 @@
|
|||
android:id="@+id/context_menu_main"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="0"
|
||||
android:background="?attr/bg_map_context_menu"
|
||||
android:orientation="vertical">
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/context_menu_top_view"
|
||||
android:baselineAligned="false"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
|
|
|
@ -12,7 +12,6 @@ import android.view.ViewGroup;
|
|||
import android.view.animation.DecelerateInterpolator;
|
||||
import android.widget.ImageButton;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
import net.osmand.PlatformUtil;
|
||||
|
@ -85,6 +84,8 @@ public class MapContextMenuFragment extends Fragment {
|
|||
|
||||
View topView = view.findViewById(R.id.context_menu_top_view);
|
||||
mainView = view.findViewById(R.id.context_menu_main);
|
||||
//LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, dpToPx(400));
|
||||
//mainView.setLayoutParams(lp);
|
||||
|
||||
topView.setOnTouchListener(new View.OnTouchListener() {
|
||||
|
||||
|
@ -100,21 +101,16 @@ public class MapContextMenuFragment extends Fragment {
|
|||
|
||||
case MotionEvent.ACTION_MOVE:
|
||||
float y = event.getY();
|
||||
LinearLayout.LayoutParams lp = (LinearLayout.LayoutParams) mainView.getLayoutParams();
|
||||
float top = lp.topMargin + (y - dy);
|
||||
if (top < 0) {
|
||||
lp.topMargin = (int) top;
|
||||
mainView.setLayoutParams(lp);
|
||||
}
|
||||
mainView.setY(mainView.getY() + (y - dy));
|
||||
break;
|
||||
|
||||
case MotionEvent.ACTION_UP:
|
||||
case MotionEvent.ACTION_CANCEL:
|
||||
|
||||
float posY = view.getHeight() - mainViewHeight;
|
||||
if (mainView.getY() != posY) {
|
||||
if (mainView.getY() != posY)
|
||||
mainView.animate().y(posY).setDuration(200).setInterpolator(new DecelerateInterpolator()).start();
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue