Fix threshold distance scroll

This commit is contained in:
Vitaliy 2020-08-25 21:07:38 +03:00
parent 742fb68f45
commit ff93fbc274
4 changed files with 27 additions and 8 deletions

View file

@ -13,6 +13,14 @@
<include layout="@layout/context_menu_top_shadow" />
<include layout="@layout/plan_route_progress_bar" />
<LinearLayout
android:id="@+id/gpx_approximation_top_shadow_all"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical" />
<FrameLayout
android:id="@+id/bottom_container"
android:layout_width="match_parent"
@ -36,8 +44,6 @@
</net.osmand.plus.LockableScrollView>
<include layout="@layout/plan_route_progress_bar"/>
</FrameLayout>
</LinearLayout>

View file

@ -66,6 +66,7 @@ public abstract class ContextMenuFragment extends BaseOsmAndFragment {
private View view;
private OnLayoutChangeListener containerLayoutListener;
private View topShadow;
private ViewGroup topView;
private View bottomScrollView;
private LinearLayout cardsContainer;
private FrameLayout bottomContainer;
@ -167,6 +168,11 @@ public abstract class ContextMenuFragment extends BaseOsmAndFragment {
return mainView;
}
@Nullable
public ViewGroup getTopView() {
return topView;
}
public boolean isNightMode() {
return nightMode;
}
@ -290,7 +296,7 @@ public abstract class ContextMenuFragment extends BaseOsmAndFragment {
final int touchSlop = vc.getScaledTouchSlop();
if (getTopViewId() != 0) {
View topView = view.findViewById(getTopViewId());
topView = view.findViewById(getTopViewId());
AndroidUtils.setBackground(app, topView, nightMode, R.color.card_and_list_background_light, R.color.card_and_list_background_dark);
}
if (!portrait) {

View file

@ -61,6 +61,11 @@ public class GpxApproximationFragment extends ContextMenuScrollFragment
return R.layout.fragment_gpx_approximation_bottom_sheet_dialog;
}
@Override
public int getTopViewId() {
return R.id.gpx_approximation_top_shadow_all;
}
@Override
public int getHeaderViewHeight() {
return menuTitleHeight;
@ -259,9 +264,11 @@ public class GpxApproximationFragment extends ContextMenuScrollFragment
ViewGroup cardsContainer = getCardsContainer();
cardsContainer.removeAllViews();
SliderCard sliderCard = new SliderCard(mapActivity, distanceThreshold);
sliderCard.setListener(this);
cardsContainer.addView(sliderCard.build(mapActivity));
if (getTopView() != null) {
SliderCard sliderCard = new SliderCard(mapActivity, distanceThreshold);
sliderCard.setListener(this);
getTopView().addView(sliderCard.build(mapActivity));
}
ProfileCard profileCard = new ProfileCard(mapActivity, snapToRoadAppMode);
profileCard.setListener(this);

View file

@ -477,8 +477,8 @@ public class MapRouteInfoMenuFragment extends ContextMenuFragment {
AndroidUtils.setBackground(ctx, getCardsContainer(), isNightMode(),
R.color.activity_background_light, R.color.activity_background_dark);
if (getTopViewId() != 0) {
View topView = view.findViewById(getTopViewId());
if (getTopView() != null) {
View topView = getTopView();
AndroidUtils.setBackground(ctx, topView, isNightMode(), R.color.card_and_list_background_light, R.color.card_and_list_background_dark);
}