Merge branch 'master' of https://github.com/osmandapp/Osmand
This commit is contained in:
commit
3ec6d6361a
12 changed files with 191 additions and 119 deletions
|
@ -600,11 +600,11 @@ public class RouteResultPreparation {
|
|||
// mpi = MapUtils.degreesDiff(prev.getBearingEnd(), begin);
|
||||
}
|
||||
if (mpi >= TURN_DEGREE_MIN) {
|
||||
if (mpi < 60) {
|
||||
if (mpi < 45) {
|
||||
t = TurnType.valueOf(TurnType.TSLL, leftSide);
|
||||
} else if (mpi < 120) {
|
||||
t = TurnType.valueOf(TurnType.TL, leftSide);
|
||||
} else if (mpi < 135 || leftSide) {
|
||||
} else if (mpi < 150 || leftSide) {
|
||||
t = TurnType.valueOf(TurnType.TSHL, leftSide);
|
||||
} else {
|
||||
t = TurnType.valueOf(TurnType.TU, leftSide);
|
||||
|
@ -612,11 +612,11 @@ public class RouteResultPreparation {
|
|||
int[] lanes = getTurnLanesInfo(prev, t.getValue());
|
||||
t.setLanes(lanes);
|
||||
} else if (mpi < -TURN_DEGREE_MIN) {
|
||||
if (mpi > -60) {
|
||||
if (mpi > -45) {
|
||||
t = TurnType.valueOf(TurnType.TSLR, leftSide);
|
||||
} else if (mpi > -120) {
|
||||
t = TurnType.valueOf(TurnType.TR, leftSide);
|
||||
} else if (mpi > -135 || !leftSide) {
|
||||
} else if (mpi > -150 || !leftSide) {
|
||||
t = TurnType.valueOf(TurnType.TSHR, leftSide);
|
||||
} else {
|
||||
t = TurnType.valueOf(TurnType.TRU, leftSide);
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout
|
||||
<FrameLayout
|
||||
android:id="@+id/context_menu_layout"
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="fill_parent"
|
||||
|
@ -10,15 +10,14 @@
|
|||
<LinearLayout
|
||||
android:id="@+id/context_menu_shadow_view"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="0"
|
||||
android:layout_height="fill_parent"
|
||||
android:gravity="center"
|
||||
android:orientation="vertical"/>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/context_menu_main"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="bottom"
|
||||
android:layout_height="fill_parent"
|
||||
android:orientation="vertical">
|
||||
|
||||
<LinearLayout
|
||||
|
@ -182,24 +181,25 @@
|
|||
|
||||
</LinearLayout>
|
||||
|
||||
<ScrollView
|
||||
android:id="@+id/context_menu_bottom_scroll"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="fill_parent"
|
||||
android:background="?attr/ctx_menu_info_view_bg"
|
||||
android:fillViewport="true">
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/context_menu_bottom_view"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?attr/ctx_menu_info_view_bg"
|
||||
android:orientation="vertical">
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/context_menu_bottom_border"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="0dp"
|
||||
android:background="?attr/ctx_menu_info_view_bg"
|
||||
android:orientation="vertical">
|
||||
</ScrollView>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
</FrameLayout>
|
|
@ -1185,12 +1185,12 @@
|
|||
|
||||
<string name="poi_population">Befolkning</string>
|
||||
|
||||
<string name="poi_parking_multi_storey">Fleretages</string>
|
||||
<string name="poi_parking_multi_storey">Fleretagesparkering</string>
|
||||
|
||||
<string name="poi_bicycle_parking_stands">Stativ</string>
|
||||
<string name="poi_bicycle_parking_stands">Cykelsstativ</string>
|
||||
<string name="poi_bicycle_parking_wall_loops">Væg sløjfer</string>
|
||||
<string name="poi_bicycle_parking_building">Bygning</string>
|
||||
<string name="poi_bicycle_parking_shed">Skur</string>
|
||||
<string name="poi_bicycle_parking_building">Særlig bygning</string>
|
||||
<string name="poi_bicycle_parking_shed">Cykelskur</string>
|
||||
<string name="poi_bicycle_parking_bollard">Pullert</string>
|
||||
<string name="poi_bicycle_parking_informal">Uformel</string>
|
||||
|
||||
|
@ -1223,6 +1223,12 @@
|
|||
<string name="poi_trees_coffea">Kaffe</string>
|
||||
<string name="poi_trees_pomegranate">Granatæble</string>
|
||||
|
||||
<string name="poi_parking_underground">Kælder</string>
|
||||
<string name="poi_parking_underground">Párkeringskælder</string>
|
||||
<string name="poi_bicycle_parking_rack">Reol</string>
|
||||
<string name="poi_nudism_yes">Naturisme: tilladt</string>
|
||||
<string name="poi_nudism_no">Naturisme: forbudt</string>
|
||||
<string name="poi_nudism_obligatory">Naturisme: obligatorisk</string>
|
||||
<string name="poi_nudism_customary">Naturisme: sædvanlig</string>
|
||||
<string name="poi_nudism_permissive">Naturisme: liberalt</string>
|
||||
|
||||
</resources>
|
||||
|
|
|
@ -2129,6 +2129,6 @@
|
|||
<string name="favourites">Favoritter</string>
|
||||
<string name="poi_action_delete">slet</string>
|
||||
<string name="saved_at_time">Gemt korrekt: %1$s</string>
|
||||
<string name="poi_deleted_localy">IP vil blive slettet, når ændringer overføres</string>
|
||||
<string name="poi_deleted_localy">Interessepunkt (IP) vil blive slettet, når ændringer overføres</string>
|
||||
<string name="show_gpx">Vis GPX</string>
|
||||
</resources>
|
||||
|
|
|
@ -1186,4 +1186,30 @@
|
|||
<string name="poi_trees_banana">Banano</string>
|
||||
<string name="poi_trees_hazel">Avellanos</string>
|
||||
<string name="poi_trees_coconut">Cocotero</string>
|
||||
<string name="poi_nudism_yes">Nudismo permitido</string>
|
||||
<string name="poi_nudism_no">Nudismo prohibido</string>
|
||||
<string name="poi_nudism_obligatory">Nudismo obligatorio</string>
|
||||
<string name="poi_nudism_customary">Nudismo habitual</string>
|
||||
<string name="poi_nudism_permissive">Nudismo permisivo</string>
|
||||
|
||||
<string name="poi_bicycle_parking_rack">Bastidores</string>
|
||||
<string name="poi_bicycle_parking_building">Edificio especial</string>
|
||||
<string name="poi_bicycle_parking_shed">Caseta</string>
|
||||
<string name="poi_bicycle_parking_bollard">Bolardos</string>
|
||||
<string name="poi_trees_persimmon">Caqui</string>
|
||||
<string name="poi_trees_cherry">Cerezo</string>
|
||||
<string name="poi_trees_walnut">Nogal</string>
|
||||
<string name="poi_trees_plum">Ciruelo</string>
|
||||
<string name="poi_trees_peach">Duraznero</string>
|
||||
<string name="poi_trees_tea">Té</string>
|
||||
<string name="poi_trees_coca">Coca</string>
|
||||
<string name="poi_trees_kiwi">Kiwi</string>
|
||||
<string name="poi_trees_meadow_orchard">Huerto</string>
|
||||
<string name="poi_trees_mango">Mango</string>
|
||||
<string name="poi_trees_rubber">Caucho</string>
|
||||
<string name="poi_trees_date">Fecha</string>
|
||||
<string name="poi_trees_coffea">Café</string>
|
||||
<string name="poi_trees_pomegranate">Granada</string>
|
||||
|
||||
<string name="poi_trees_nectorine">Nectarina</string>
|
||||
</resources>
|
||||
|
|
|
@ -1200,4 +1200,14 @@
|
|||
<string name="poi_trees_coffea">Café</string>
|
||||
<string name="poi_trees_pomegranate">Granada</string>
|
||||
|
||||
<string name="poi_nudism_yes">Nudismo permitido</string>
|
||||
<string name="poi_nudism_no">Nudismo prohibido</string>
|
||||
<string name="poi_nudism_obligatory">Nudismo obligatorio</string>
|
||||
<string name="poi_nudism_customary">Nudismo habitual</string>
|
||||
<string name="poi_nudism_permissive">Nudismo permisivo</string>
|
||||
|
||||
<string name="poi_bicycle_parking_wall_loops">Anclajes de pared</string>
|
||||
<string name="poi_bicycle_parking_rack">Bastidores</string>
|
||||
<string name="poi_bicycle_parking_building">Edificio especial</string>
|
||||
<string name="poi_bicycle_parking_shed">Caseta</string>
|
||||
</resources>
|
||||
|
|
|
@ -1172,7 +1172,7 @@
|
|||
<string name="poi_parking_multi_storey">Vários andares</string>
|
||||
|
||||
<string name="poi_bicycle_parking_stands">U-invertido</string>
|
||||
<string name="poi_bicycle_parking_building">Edifício</string>
|
||||
<string name="poi_bicycle_parking_building">Edifício especial</string>
|
||||
<string name="poi_bicycle_parking_shed">Galpão</string>
|
||||
<string name="poi_bicycle_parking_bollard">Poste de amarração</string>
|
||||
<string name="poi_bicycle_parking_informal">Informal</string>
|
||||
|
@ -1188,4 +1188,28 @@
|
|||
<string name="poi_trees_orange">Laranjeira</string>
|
||||
<string name="poi_trees_almond">Amendoeira</string>
|
||||
<string name="poi_trees_banana">Bananeira</string>
|
||||
<string name="poi_trees_hazel">Aveleira</string>
|
||||
<string name="poi_trees_coconut">Coqueiro</string>
|
||||
<string name="poi_trees_persimmon">Caquizeiro</string>
|
||||
<string name="poi_trees_cherry">Cerejeira</string>
|
||||
<string name="poi_trees_walnut">Nogueira</string>
|
||||
<string name="poi_trees_plum">Ameixeira</string>
|
||||
<string name="poi_trees_peach">Pessegueiro</string>
|
||||
<string name="poi_trees_kiwi">Kiwizeiro</string>
|
||||
<string name="poi_trees_nectorine">Nectarineira</string>
|
||||
<string name="poi_trees_mango">Mangueira</string>
|
||||
<string name="poi_trees_rubber">Seringueira</string>
|
||||
<string name="poi_trees_coffea">Cafeeiro</string>
|
||||
<string name="poi_trees_pomegranate">Romãzeira</string>
|
||||
|
||||
<string name="poi_nudism_yes">Nudismo: autorizado</string>
|
||||
<string name="poi_nudism_no">Nudismo: proibido</string>
|
||||
<string name="poi_nudism_obligatory">Nudismo: obrigatório</string>
|
||||
<string name="poi_nudism_customary">Nudismo: habitual</string>
|
||||
<string name="poi_nudism_permissive">Nudismo: permissido</string>
|
||||
|
||||
<string name="poi_trees_date">Tamareira</string>
|
||||
<string name="poi_trees_tea">Erveira</string>
|
||||
<string name="poi_trees_coca">Coca</string>
|
||||
<string name="poi_trees_meadow_orchard">Prado com pomar</string>
|
||||
</resources>
|
||||
|
|
|
@ -2091,4 +2091,6 @@
|
|||
<string name="working_days">Рабочие дни</string>
|
||||
<string name="favourites">Избранное</string>
|
||||
<string name="saved_at_time">Успешно сохранён в: %1$s</string>
|
||||
<string name="poi_deleted_localy">POI будут удалены после того как вы загрузите ваши изменения</string>
|
||||
<string name="show_gpx">Показать GPX</string>
|
||||
</resources>
|
||||
|
|
|
@ -1995,4 +1995,6 @@
|
|||
<string name="recent_places">Nyliga platser</string>
|
||||
<string name="poi_action_delete">ta bort</string>
|
||||
<string name="saved_at_time">Sparades utan problem kl. %1$s</string>
|
||||
<string name="poi_deleted_localy">POI tas bort så snart du laddat upp dina ändringar</string>
|
||||
<string name="show_gpx">Visa GPX</string>
|
||||
</resources>
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
package net.osmand.plus.mapcontextmenu;
|
||||
|
||||
import android.animation.Animator;
|
||||
import android.animation.AnimatorListenerAdapter;
|
||||
import android.annotation.TargetApi;
|
||||
import android.app.Activity;
|
||||
import android.content.res.Resources;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.os.Looper;
|
||||
import android.support.v4.app.Fragment;
|
||||
import android.util.DisplayMetrics;
|
||||
import android.util.TypedValue;
|
||||
|
@ -45,15 +45,17 @@ public class MapContextMenuFragment extends Fragment {
|
|||
private View mainView;
|
||||
private View bottomView;
|
||||
private View shadowView;
|
||||
private View bottomBorder;
|
||||
|
||||
MenuController menuController;
|
||||
|
||||
private int menuTopHeight;
|
||||
private int menuTopShadowHeight;
|
||||
private int menuTopShadowAllHeight;
|
||||
private int menuTitleHeight;
|
||||
private int menuButtonsHeight;
|
||||
private int menuBottomViewHeight;
|
||||
private int menuFullHeight;
|
||||
private int menuFullHeightMax;
|
||||
|
||||
@Override
|
||||
public void onAttach(Activity activity) {
|
||||
|
@ -113,10 +115,13 @@ public class MapContextMenuFragment extends Fragment {
|
|||
|
||||
menuTopHeight = view.findViewById(R.id.context_menu_top_view).getHeight();
|
||||
menuTopShadowHeight = view.findViewById(R.id.context_menu_top_shadow).getHeight();
|
||||
menuTopShadowAllHeight = view.findViewById(R.id.context_menu_top_shadow_all).getHeight();
|
||||
menuButtonsHeight = view.findViewById(R.id.context_menu_buttons).getHeight();
|
||||
menuBottomViewHeight = view.findViewById(R.id.context_menu_bottom_view).getHeight();
|
||||
menuFullHeight = view.findViewById(R.id.context_menu_main).getHeight();
|
||||
|
||||
menuTitleHeight = menuTopShadowHeight + menuTopShadowAllHeight;
|
||||
menuFullHeightMax = menuTitleHeight + menuBottomViewHeight + dpToPx(2f);
|
||||
|
||||
ViewTreeObserver obs = view.getViewTreeObserver();
|
||||
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
|
||||
|
@ -130,14 +135,6 @@ public class MapContextMenuFragment extends Fragment {
|
|||
|
||||
});
|
||||
|
||||
bottomBorder = view.findViewById(R.id.context_menu_bottom_border);
|
||||
bottomBorder.setOnTouchListener(new View.OnTouchListener() {
|
||||
@Override
|
||||
public boolean onTouch(View v, MotionEvent event) {
|
||||
return true;
|
||||
}
|
||||
});
|
||||
|
||||
shadowView = view.findViewById(R.id.context_menu_shadow_view);
|
||||
shadowView.setOnTouchListener(new View.OnTouchListener() {
|
||||
public boolean onTouch(View view, MotionEvent event) {
|
||||
|
@ -151,12 +148,13 @@ public class MapContextMenuFragment extends Fragment {
|
|||
final View.OnTouchListener slideTouchListener = new View.OnTouchListener() {
|
||||
private float dy;
|
||||
private float dyMain;
|
||||
private int destinationState;
|
||||
private VelocityTracker velocity;
|
||||
private boolean slidingUp;
|
||||
private boolean slidingDown;
|
||||
|
||||
private float velocityX;
|
||||
private float velocityY;
|
||||
private float maxVelocityY;
|
||||
|
||||
private float startX;
|
||||
private float startY;
|
||||
|
@ -166,7 +164,11 @@ public class MapContextMenuFragment extends Fragment {
|
|||
private boolean isClick(float endX, float endY) {
|
||||
float differenceX = Math.abs(startX - endX);
|
||||
float differenceY = Math.abs(startY - endY);
|
||||
if (differenceX > 1 || differenceY > 1 || System.currentTimeMillis() - lastTouchDown > CLICK_ACTION_THRESHHOLD) {
|
||||
if (differenceX > 1 ||
|
||||
differenceY > 1 ||
|
||||
Math.abs(velocityX) > 10 ||
|
||||
Math.abs(velocityY) > 10 ||
|
||||
System.currentTimeMillis() - lastTouchDown > CLICK_ACTION_THRESHHOLD) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
|
@ -184,26 +186,29 @@ public class MapContextMenuFragment extends Fragment {
|
|||
dy = event.getY();
|
||||
dyMain = mainView.getY();
|
||||
velocity = VelocityTracker.obtain();
|
||||
velocityX = 0;
|
||||
velocityY = 0;
|
||||
maxVelocityY = 0;
|
||||
velocity.addMovement(event);
|
||||
break;
|
||||
|
||||
case MotionEvent.ACTION_MOVE:
|
||||
float y = event.getY();
|
||||
float newY = mainView.getY() + (y - dy);
|
||||
mainView.setY(newY);
|
||||
mainView.setY((int)newY);
|
||||
|
||||
ViewGroup.LayoutParams lp = bottomBorder.getLayoutParams();
|
||||
lp.height = (int)(view.getHeight() - newY - menuFullHeight) + 10;
|
||||
bottomBorder.setLayoutParams(lp);
|
||||
bottomBorder.setY(newY + menuFullHeight);
|
||||
bottomBorder.requestLayout();
|
||||
menuFullHeight = view.getHeight() - (int) newY + 10;
|
||||
ViewGroup.LayoutParams lp = mainView.getLayoutParams();
|
||||
lp.height = Math.max(menuFullHeight, menuTitleHeight);
|
||||
mainView.setLayoutParams(lp);
|
||||
mainView.requestLayout();
|
||||
|
||||
velocity.addMovement(event);
|
||||
velocity.computeCurrentVelocity(1000);
|
||||
float vel = Math.abs(velocity.getYVelocity());
|
||||
if (vel > velocityY)
|
||||
velocityY = vel;
|
||||
velocityX = Math.abs(velocity.getXVelocity());
|
||||
velocityY = Math.abs(velocity.getYVelocity());
|
||||
if (velocityY > maxVelocityY)
|
||||
maxVelocityY = velocityY;
|
||||
|
||||
break;
|
||||
|
||||
|
@ -212,8 +217,8 @@ public class MapContextMenuFragment extends Fragment {
|
|||
float endX = event.getX();
|
||||
float endY = event.getY();
|
||||
|
||||
slidingUp = Math.abs(velocityY) > 500 && (mainView.getY() - dyMain) < -50;
|
||||
slidingDown = Math.abs(velocityY) > 500 && (mainView.getY() - dyMain) > 50;
|
||||
slidingUp = Math.abs(maxVelocityY) > 500 && (mainView.getY() - dyMain) < -50;
|
||||
slidingDown = Math.abs(maxVelocityY) > 500 && (mainView.getY() - dyMain) > 50;
|
||||
|
||||
velocity.recycle();
|
||||
|
||||
|
@ -223,37 +228,31 @@ public class MapContextMenuFragment extends Fragment {
|
|||
} else if (slidingDown) {
|
||||
menuController.slideDown();
|
||||
}
|
||||
destinationState = menuController.getCurrentMenuState();
|
||||
} else {
|
||||
destinationState = MenuController.MenuState.HEADER_ONLY;
|
||||
}
|
||||
|
||||
float posY = 0;
|
||||
switch (destinationState) {
|
||||
case MenuController.MenuState.HEADER_ONLY:
|
||||
posY = view.getHeight() - (menuFullHeight - menuBottomViewHeight - dpToPx(SHADOW_HEIGHT_BOTTOM_DP));
|
||||
break;
|
||||
case MenuController.MenuState.HALF_SCREEN:
|
||||
posY = view.getHeight() - menuFullHeight;
|
||||
break;
|
||||
case MenuController.MenuState.FULL_SCREEN:
|
||||
posY = -menuTopShadowHeight - dpToPx(SHADOW_HEIGHT_TOP_DP);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
float minY = Math.min(posY, mainView.getY());
|
||||
lp = bottomBorder.getLayoutParams();
|
||||
lp.height = (int)(view.getHeight() - minY - menuFullHeight) + 10;
|
||||
if (lp.height < 0)
|
||||
lp.height = 0;
|
||||
bottomBorder.setLayoutParams(lp);
|
||||
bottomBorder.requestLayout();
|
||||
final int posY = getPosY();
|
||||
|
||||
if (mainView.getY() != posY) {
|
||||
mainView.animate().y(posY).setDuration(200).setInterpolator(new DecelerateInterpolator()).start();
|
||||
bottomBorder.animate().y(posY + menuFullHeight).setDuration(200).setInterpolator(new DecelerateInterpolator()).start();
|
||||
|
||||
if (posY < mainView.getY()) {
|
||||
updateMainViewLayout(posY);
|
||||
}
|
||||
|
||||
mainView.animate().y(posY)
|
||||
.setDuration(200)
|
||||
.setInterpolator(new DecelerateInterpolator())
|
||||
.setListener(new AnimatorListenerAdapter() {
|
||||
@Override
|
||||
public void onAnimationCancel(Animator animation) {
|
||||
updateMainViewLayout(posY);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAnimationEnd(Animator animation) {
|
||||
updateMainViewLayout(posY);
|
||||
}
|
||||
})
|
||||
.start();
|
||||
}
|
||||
|
||||
// OnClick event
|
||||
|
@ -323,7 +322,7 @@ public class MapContextMenuFragment extends Fragment {
|
|||
// Action buttons
|
||||
final ImageButton buttonNavigate = (ImageButton) view.findViewById(R.id.context_menu_route_button);
|
||||
buttonNavigate.setImageDrawable(iconsCache.getIcon(R.drawable.map_directions,
|
||||
light ? R.color.icon_color : R.color.dash_search_icon_dark));
|
||||
light ? R.color.icon_color : R.color.dashboard_subheader_text_dark));
|
||||
buttonNavigate.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
|
@ -333,7 +332,7 @@ public class MapContextMenuFragment extends Fragment {
|
|||
|
||||
final ImageButton buttonFavorite = (ImageButton) view.findViewById(R.id.context_menu_fav_button);
|
||||
buttonFavorite.setImageDrawable(iconsCache.getIcon(R.drawable.ic_action_fav_dark,
|
||||
light ? R.color.icon_color : R.color.dash_search_icon_dark));
|
||||
light ? R.color.icon_color : R.color.dashboard_subheader_text_dark));
|
||||
buttonFavorite.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
|
@ -343,7 +342,7 @@ public class MapContextMenuFragment extends Fragment {
|
|||
|
||||
final ImageButton buttonShare = (ImageButton) view.findViewById(R.id.context_menu_share_button);
|
||||
buttonShare.setImageDrawable(iconsCache.getIcon(R.drawable.abc_ic_menu_share_mtrl_alpha,
|
||||
light ? R.color.icon_color : R.color.dash_search_icon_dark));
|
||||
light ? R.color.icon_color : R.color.dashboard_subheader_text_dark));
|
||||
buttonShare.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
|
@ -353,7 +352,7 @@ public class MapContextMenuFragment extends Fragment {
|
|||
|
||||
final ImageButton buttonMore = (ImageButton) view.findViewById(R.id.context_menu_more_button);
|
||||
buttonMore.setImageDrawable(iconsCache.getIcon(R.drawable.ic_overflow_menu_white,
|
||||
light ? R.color.icon_color : R.color.dash_search_icon_dark));
|
||||
light ? R.color.icon_color : R.color.dashboard_subheader_text_dark));
|
||||
buttonMore.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
|
@ -374,56 +373,54 @@ public class MapContextMenuFragment extends Fragment {
|
|||
menuController.build(bottomView);
|
||||
}
|
||||
|
||||
bottomView.measure(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
|
||||
menuBottomViewHeight = bottomView.getMeasuredHeight();
|
||||
|
||||
return view;
|
||||
}
|
||||
|
||||
private void doLayoutMenu() {
|
||||
int shadowViewHeight = 0;
|
||||
int bottomBorderHeight = 0;
|
||||
private int getPosY() {
|
||||
int destinationState;
|
||||
int minHalfY;
|
||||
if (menuController != null) {
|
||||
destinationState = menuController.getCurrentMenuState();
|
||||
minHalfY = view.getHeight() - (int)(view.getHeight() * menuController.getHalfScreenMaxHeightKoef());
|
||||
} else {
|
||||
destinationState = MenuController.MenuState.HEADER_ONLY;
|
||||
minHalfY = view.getHeight();
|
||||
}
|
||||
|
||||
int menuState;
|
||||
if (menuController != null)
|
||||
menuState = menuController.getCurrentMenuState();
|
||||
else
|
||||
menuState = MenuController.MenuState.HEADER_ONLY;
|
||||
|
||||
switch (menuState) {
|
||||
int posY = 0;
|
||||
switch (destinationState) {
|
||||
case MenuController.MenuState.HEADER_ONLY:
|
||||
shadowViewHeight = view.getHeight() - (menuFullHeight - menuBottomViewHeight) + dpToPx(SHADOW_HEIGHT_BOTTOM_DP);
|
||||
bottomBorderHeight = 0;
|
||||
posY = view.getHeight() - (menuTitleHeight - dpToPx(SHADOW_HEIGHT_BOTTOM_DP));
|
||||
break;
|
||||
case MenuController.MenuState.HALF_SCREEN:
|
||||
int maxHeight = (int)(menuController.getHalfScreenMaxHeightKoef() * view.getHeight());
|
||||
if (maxHeight > menuFullHeight) {
|
||||
shadowViewHeight = view.getHeight() - menuFullHeight;
|
||||
bottomBorderHeight = 0;
|
||||
} else {
|
||||
shadowViewHeight = view.getHeight() - maxHeight;
|
||||
bottomBorderHeight = 0;
|
||||
mainView.setY(shadowViewHeight);
|
||||
}
|
||||
posY = view.getHeight() - menuFullHeightMax;
|
||||
posY = Math.max(posY, minHalfY);
|
||||
break;
|
||||
case MenuController.MenuState.FULL_SCREEN:
|
||||
shadowViewHeight = 0;
|
||||
bottomBorderHeight = view.getHeight() - menuFullHeight + menuTopShadowHeight + dpToPx(SHADOW_HEIGHT_TOP_DP);
|
||||
posY = -menuTopShadowHeight - dpToPx(SHADOW_HEIGHT_TOP_DP);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return posY;
|
||||
}
|
||||
|
||||
ViewGroup.LayoutParams lp = bottomBorder.getLayoutParams();
|
||||
lp.height = bottomBorderHeight + 10;
|
||||
bottomBorder.setLayoutParams(lp);
|
||||
bottomBorder.setY(view.getHeight() - bottomBorderHeight);
|
||||
|
||||
lp = shadowView.getLayoutParams();
|
||||
lp.height = shadowViewHeight;
|
||||
shadowView.setLayoutParams(lp);
|
||||
|
||||
private void updateMainViewLayout(int posY) {
|
||||
ViewGroup.LayoutParams lp;
|
||||
menuFullHeight = view.getHeight() - posY;
|
||||
lp = mainView.getLayoutParams();
|
||||
lp.height = menuFullHeight;
|
||||
lp.height = Math.max(menuFullHeight, menuTitleHeight);
|
||||
mainView.setLayoutParams(lp);
|
||||
mainView.requestLayout();
|
||||
}
|
||||
|
||||
private void doLayoutMenu() {
|
||||
final int posY = getPosY();
|
||||
mainView.setY(posY);
|
||||
updateMainViewLayout(posY);
|
||||
}
|
||||
|
||||
public void dismissMenu() {
|
||||
|
|
|
@ -9,6 +9,11 @@ public class AmenityInfoMenuController extends MenuController {
|
|||
super(new AmenityInfoMenuBuilder(app, amenity));
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getInitialMenuState() {
|
||||
return MenuState.HEADER_ONLY;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getSupportedMenuStates() {
|
||||
return MenuState.HEADER_ONLY | MenuState.HALF_SCREEN | MenuState.FULL_SCREEN;
|
||||
|
|
|
@ -63,7 +63,7 @@ public abstract class MenuController {
|
|||
}
|
||||
|
||||
public float getHalfScreenMaxHeightKoef() {
|
||||
return .6f;
|
||||
return .7f;
|
||||
}
|
||||
|
||||
public boolean shouldShowButtons() {
|
||||
|
|
Loading…
Reference in a new issue