diff --git a/android/build.gradle b/android/build.gradle
index e01bc725d1..174aa5fe0a 100644
--- a/android/build.gradle
+++ b/android/build.gradle
@@ -89,7 +89,6 @@ dependencies {
implementation 'com.google.android.material:material:1.7.0-alpha02'
implementation 'com.google.code.gson:gson:2.9.0'
implementation 'com.timehop.stickyheadersrecyclerview:library:0.4.3@aar'
- implementation 'com.trafi:anchor-bottom-sheet-behavior:0.14-alpha'
implementation 'com.github.devnullorthrow:MPAndroidChart:3.2.0-alpha'
implementation 'net.jcip:jcip-annotations:1.0'
diff --git a/android/res/layout-land/elevation_profile_bottom_sheet.xml b/android/res/layout-land/elevation_profile_bottom_sheet.xml
index af4694642f..1c522066f8 100644
--- a/android/res/layout-land/elevation_profile_bottom_sheet.xml
+++ b/android/res/layout-land/elevation_profile_bottom_sheet.xml
@@ -11,9 +11,6 @@
android:clickable="true"
android:focusable="true"
android:fillViewport="true"
- app:behavior_defaultState="hidden"
- app:behavior_skipCollapsed="true"
- app:behavior_hideable="true"
app:layout_behavior="@string/placepage_behavior">
-
-
-
-
-
-
-
-
-
-
-
diff --git a/android/res/values/donottranslate.xml b/android/res/values/donottranslate.xml
index 0cc1e1741d..a858a14bc7 100644
--- a/android/res/values/donottranslate.xml
+++ b/android/res/values/donottranslate.xml
@@ -60,7 +60,7 @@
NEVER
ALWAYS
AUTO
- com.trafi.anchorbottomsheetbehavior.AnchorBottomSheetBehavior
+ com.google.android.material.bottomsheet.BottomSheetBehavior
https://organicmaps.app/privacy
https://organicmaps.app/terms
diff --git a/android/src/com/mapswithme/maps/widget/placepage/DefaultBottomSheetCallback.java b/android/src/com/mapswithme/maps/widget/placepage/DefaultBottomSheetCallback.java
index 68167b1829..b9ab35b7a1 100644
--- a/android/src/com/mapswithme/maps/widget/placepage/DefaultBottomSheetCallback.java
+++ b/android/src/com/mapswithme/maps/widget/placepage/DefaultBottomSheetCallback.java
@@ -3,13 +3,13 @@ package com.mapswithme.maps.widget.placepage;
import android.view.View;
import androidx.annotation.NonNull;
+import com.google.android.material.bottomsheet.BottomSheetBehavior;
import com.mapswithme.util.log.Logger;
-import com.trafi.anchorbottomsheetbehavior.AnchorBottomSheetBehavior;
-import static com.mapswithme.maps.widget.placepage.PlacePageUtils.isAnchoredState;
+import static com.mapswithme.maps.widget.placepage.PlacePageUtils.isHalfExpandedState;
import static com.mapswithme.maps.widget.placepage.PlacePageUtils.isExpandedState;
-public class DefaultBottomSheetCallback extends AnchorBottomSheetBehavior.BottomSheetCallback
+public class DefaultBottomSheetCallback extends BottomSheetBehavior.BottomSheetCallback
{
private static final String TAG = DefaultBottomSheetCallback.class.getSimpleName();
@NonNull
@@ -21,10 +21,9 @@ public class DefaultBottomSheetCallback extends AnchorBottomSheetBehavior.Bottom
}
@Override
- public void onStateChanged(@NonNull View bottomSheet, int oldState, int newState)
+ public void onStateChanged(@NonNull View bottomSheet, int newState)
{
- Logger.d(TAG, "State change, new = " + PlacePageUtils.toString(newState) +
- " old = " + PlacePageUtils.toString(oldState));
+ Logger.d(TAG, "State change, new = " + PlacePageUtils.toString(newState));
if (PlacePageUtils.isSettlingState(newState) || PlacePageUtils.isDraggingState(newState))
{
return;
@@ -38,7 +37,7 @@ public class DefaultBottomSheetCallback extends AnchorBottomSheetBehavior.Bottom
mSheetChangedListener.onSheetDirectionIconChange();
- if (isAnchoredState(newState) || isExpandedState(newState))
+ if (isHalfExpandedState(newState) || isExpandedState(newState))
{
mSheetChangedListener.onSheetDetailsOpened();
return;
diff --git a/android/src/com/mapswithme/maps/widget/placepage/PlacePageGestureListener.java b/android/src/com/mapswithme/maps/widget/placepage/PlacePageGestureListener.java
index 8a729a70be..6a32a5859c 100644
--- a/android/src/com/mapswithme/maps/widget/placepage/PlacePageGestureListener.java
+++ b/android/src/com/mapswithme/maps/widget/placepage/PlacePageGestureListener.java
@@ -5,21 +5,20 @@ import android.view.MotionEvent;
import android.view.View;
import androidx.annotation.NonNull;
-
-import com.trafi.anchorbottomsheetbehavior.AnchorBottomSheetBehavior;
+import com.google.android.material.bottomsheet.BottomSheetBehavior;
class PlacePageGestureListener extends GestureDetector.SimpleOnGestureListener
{
@NonNull
- private final AnchorBottomSheetBehavior mBottomSheetBehavior;
+ private final BottomSheetBehavior mBottomSheetBehavior;
- PlacePageGestureListener(@NonNull AnchorBottomSheetBehavior bottomSheetBehavior)
+ PlacePageGestureListener(@NonNull BottomSheetBehavior bottomSheetBehavior)
{
mBottomSheetBehavior = bottomSheetBehavior;
}
@NonNull
- AnchorBottomSheetBehavior getBottomSheetBehavior()
+ BottomSheetBehavior getBottomSheetBehavior()
{
return mBottomSheetBehavior;
}
@@ -27,17 +26,17 @@ class PlacePageGestureListener extends GestureDetector.SimpleOnGestureListener
@Override
public boolean onSingleTapConfirmed(MotionEvent e)
{
- @AnchorBottomSheetBehavior.State
+ @BottomSheetBehavior.State
int state = mBottomSheetBehavior.getState();
if (PlacePageUtils.isCollapsedState(state))
{
- mBottomSheetBehavior.setState(AnchorBottomSheetBehavior.STATE_ANCHORED);
+ mBottomSheetBehavior.setState(BottomSheetBehavior.STATE_HALF_EXPANDED);
return true;
}
- if (PlacePageUtils.isAnchoredState(state) || PlacePageUtils.isExpandedState(state))
+ if (PlacePageUtils.isHalfExpandedState(state) || PlacePageUtils.isExpandedState(state))
{
- mBottomSheetBehavior.setState(AnchorBottomSheetBehavior.STATE_COLLAPSED);
+ mBottomSheetBehavior.setState(BottomSheetBehavior.STATE_COLLAPSED);
return true;
}
diff --git a/android/src/com/mapswithme/maps/widget/placepage/PlacePageUtils.java b/android/src/com/mapswithme/maps/widget/placepage/PlacePageUtils.java
index ae92c18cdb..92bef8e014 100644
--- a/android/src/com/mapswithme/maps/widget/placepage/PlacePageUtils.java
+++ b/android/src/com/mapswithme/maps/widget/placepage/PlacePageUtils.java
@@ -10,11 +10,11 @@ import androidx.annotation.DrawableRes;
import androidx.annotation.IdRes;
import androidx.annotation.NonNull;
+import com.google.android.material.bottomsheet.BottomSheetBehavior;
import com.mapswithme.maps.Framework;
import com.mapswithme.maps.R;
import com.mapswithme.util.Graphics;
import com.mapswithme.util.UiUtils;
-import com.trafi.anchorbottomsheetbehavior.AnchorBottomSheetBehavior;
class PlacePageUtils
{
@@ -66,20 +66,20 @@ class PlacePageUtils
});
}
- static void setPullDrawable(@NonNull AnchorBottomSheetBehavior behavior, @NonNull View bottomSheet,
+ static void setPullDrawable(@NonNull BottomSheetBehavior behavior, @NonNull View bottomSheet,
@IdRes int pullDrawableId)
{
final ImageView img = bottomSheet.findViewById(pullDrawableId);
if (img == null)
return;
- @AnchorBottomSheetBehavior.State
+ @BottomSheetBehavior.State
int state = behavior.getState();
@DrawableRes
int drawableId = UiUtils.NO_ID;
if (PlacePageUtils.isCollapsedState(state))
drawableId = R.drawable.ic_disclosure_up;
- else if (PlacePageUtils.isAnchoredState(state) || PlacePageUtils.isExpandedState(state))
+ else if (PlacePageUtils.isHalfExpandedState(state) || PlacePageUtils.isExpandedState(state))
drawableId = R.drawable.ic_disclosure_down;
if (drawableId == UiUtils.NO_ID)
@@ -90,52 +90,52 @@ class PlacePageUtils
img.setImageDrawable(drawable);
}
- static boolean isSettlingState(@AnchorBottomSheetBehavior.State int state)
+ static boolean isSettlingState(@BottomSheetBehavior.State int state)
{
- return state == AnchorBottomSheetBehavior.STATE_SETTLING;
+ return state == BottomSheetBehavior.STATE_SETTLING;
}
- static boolean isDraggingState(@AnchorBottomSheetBehavior.State int state)
+ static boolean isDraggingState(@BottomSheetBehavior.State int state)
{
- return state == AnchorBottomSheetBehavior.STATE_DRAGGING;
+ return state == BottomSheetBehavior.STATE_DRAGGING;
}
- static boolean isCollapsedState(@AnchorBottomSheetBehavior.State int state)
+ static boolean isCollapsedState(@BottomSheetBehavior.State int state)
{
- return state == AnchorBottomSheetBehavior.STATE_COLLAPSED;
+ return state == BottomSheetBehavior.STATE_COLLAPSED;
}
- static boolean isAnchoredState(@AnchorBottomSheetBehavior.State int state)
+ static boolean isHalfExpandedState(@BottomSheetBehavior.State int state)
{
- return state == AnchorBottomSheetBehavior.STATE_ANCHORED;
+ return state == BottomSheetBehavior.STATE_HALF_EXPANDED;
}
- static boolean isExpandedState(@AnchorBottomSheetBehavior.State int state)
+ static boolean isExpandedState(@BottomSheetBehavior.State int state)
{
- return state == AnchorBottomSheetBehavior.STATE_EXPANDED;
+ return state == BottomSheetBehavior.STATE_EXPANDED;
}
- static boolean isHiddenState(@AnchorBottomSheetBehavior.State int state)
+ static boolean isHiddenState(@BottomSheetBehavior.State int state)
{
- return state == AnchorBottomSheetBehavior.STATE_HIDDEN;
+ return state == BottomSheetBehavior.STATE_HIDDEN;
}
@NonNull
- static String toString(@AnchorBottomSheetBehavior.State int state)
+ static String toString(@BottomSheetBehavior.State int state)
{
switch (state)
{
- case AnchorBottomSheetBehavior.STATE_EXPANDED:
+ case BottomSheetBehavior.STATE_EXPANDED:
return "EXPANDED";
- case AnchorBottomSheetBehavior.STATE_COLLAPSED:
+ case BottomSheetBehavior.STATE_COLLAPSED:
return "COLLAPSED";
- case AnchorBottomSheetBehavior.STATE_ANCHORED:
- return "ANCHORED";
- case AnchorBottomSheetBehavior.STATE_DRAGGING:
+ case BottomSheetBehavior.STATE_HALF_EXPANDED:
+ return "HALF_EXPANDED";
+ case BottomSheetBehavior.STATE_DRAGGING:
return "DRAGGING";
- case AnchorBottomSheetBehavior.STATE_SETTLING:
+ case BottomSheetBehavior.STATE_SETTLING:
return "SETTLING";
- case AnchorBottomSheetBehavior.STATE_HIDDEN:
+ case BottomSheetBehavior.STATE_HIDDEN:
return "HIDDEN";
default:
throw new AssertionError("Unsupported state detected: " + state);
diff --git a/android/src/com/mapswithme/maps/widget/placepage/RichPlacePageController.java b/android/src/com/mapswithme/maps/widget/placepage/RichPlacePageController.java
index 712ff233de..2c174cbbeb 100644
--- a/android/src/com/mapswithme/maps/widget/placepage/RichPlacePageController.java
+++ b/android/src/com/mapswithme/maps/widget/placepage/RichPlacePageController.java
@@ -13,6 +13,7 @@ import android.view.ViewGroup;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.core.view.GestureDetectorCompat;
+import com.google.android.material.bottomsheet.BottomSheetBehavior;
import com.mapswithme.maps.Framework;
import com.mapswithme.maps.R;
import com.mapswithme.maps.bookmarks.data.MapObject;
@@ -20,7 +21,6 @@ import com.mapswithme.maps.location.LocationHelper;
import com.mapswithme.maps.location.LocationListener;
import com.mapswithme.util.UiUtils;
import com.mapswithme.util.log.Logger;
-import com.trafi.anchorbottomsheetbehavior.AnchorBottomSheetBehavior;
import java.util.Objects;
@@ -35,7 +35,7 @@ public class RichPlacePageController implements PlacePageController, LocationLis
private static final int ANIM_CHANGE_PEEK_HEIGHT_MS = 100;
@SuppressWarnings("NullableProblems")
@NonNull
- private AnchorBottomSheetBehavior mPlacePageBehavior;
+ private BottomSheetBehavior mPlacePageBehavior;
@SuppressWarnings("NullableProblems")
@NonNull
private View mButtonsLayout;
@@ -91,7 +91,7 @@ public class RichPlacePageController implements PlacePageController, LocationLis
};
@NonNull
- private final AnchorBottomSheetBehavior.BottomSheetCallback mSheetCallback
+ private final BottomSheetBehavior.BottomSheetCallback mSheetCallback
= new DefaultBottomSheetCallback(mBottomSheetChangedListener);
private boolean mDeactivateMapSelection = true;
@@ -120,8 +120,10 @@ public class RichPlacePageController implements PlacePageController, LocationLis
Resources res = activity.getResources();
mViewportMinHeight = res.getDimensionPixelSize(R.dimen.viewport_min_height);
mPlacePage = activity.findViewById(R.id.placepage);
- mPlacePageBehavior = AnchorBottomSheetBehavior.from(mPlacePage);
+ mPlacePageBehavior = BottomSheetBehavior.from(mPlacePage);
mPlacePageBehavior.addBottomSheetCallback(mSheetCallback);
+ mPlacePageBehavior.setHideable(true);
+ mPlacePageBehavior.setState(BottomSheetBehavior.STATE_HIDDEN);
PlacePageGestureListener ppGestureListener = new PlacePageGestureListener(mPlacePageBehavior);
GestureDetectorCompat gestureDetector = new GestureDetectorCompat(activity, ppGestureListener);
mPlacePage.addPlacePageGestureListener(ppGestureListener);
@@ -149,7 +151,7 @@ public class RichPlacePageController implements PlacePageController, LocationLis
mDeactivateMapSelection = true;
MapObject object = (MapObject) data;
mPlacePage.setMapObject(object, (isSameObject) -> {
- @AnchorBottomSheetBehavior.State
+ @BottomSheetBehavior.State
int state = mPlacePageBehavior.getState();
if (isSameObject && !PlacePageUtils.isHiddenState(state))
return;
@@ -158,7 +160,7 @@ public class RichPlacePageController implements PlacePageController, LocationLis
if (object.getOpeningMode() == MapObject.OPENING_MODE_DETAILS)
{
- mPlacePageBehavior.setState(AnchorBottomSheetBehavior.STATE_ANCHORED);
+ mPlacePageBehavior.setState(BottomSheetBehavior.STATE_HALF_EXPANDED);
return;
}
@@ -172,7 +174,7 @@ public class RichPlacePageController implements PlacePageController, LocationLis
{
mPlacePage.post(() -> {
setPeekHeight();
- mPlacePageBehavior.setState(AnchorBottomSheetBehavior.STATE_COLLAPSED);
+ mPlacePageBehavior.setState(BottomSheetBehavior.STATE_COLLAPSED);
setPlacePageAnchor();
});
}
@@ -189,7 +191,7 @@ public class RichPlacePageController implements PlacePageController, LocationLis
if (peekHeight == mPlacePageBehavior.getPeekHeight())
return;
- @AnchorBottomSheetBehavior.State
+ @BottomSheetBehavior.State
int currentState = mPlacePageBehavior.getState();
if (PlacePageUtils.isSettlingState(currentState) || PlacePageUtils.isDraggingState(currentState))
{
@@ -218,7 +220,7 @@ public class RichPlacePageController implements PlacePageController, LocationLis
{
mPeekHeightAnimating = true;
mPlacePage.setScrollable(false);
- mPlacePageBehavior.setAllowUserDragging(false);
+ mPlacePageBehavior.setDraggable(false);
}
@Override
@@ -227,7 +229,7 @@ public class RichPlacePageController implements PlacePageController, LocationLis
mPlacePage.setTranslationY(0);
mPeekHeightAnimating = false;
mPlacePage.setScrollable(true);
- mPlacePageBehavior.setAllowUserDragging(true);
+ mPlacePageBehavior.setDraggable(true);
mPlacePageBehavior.setPeekHeight(peekHeight);
}
});
@@ -243,8 +245,7 @@ public class RichPlacePageController implements PlacePageController, LocationLis
private void setPlacePageAnchor()
{
- View parent = (View) mPlacePage.getParent();
- mPlacePageBehavior.setAnchorOffset((int) (parent.getHeight() * ANCHOR_RATIO));
+ mPlacePageBehavior.setHalfExpandedRatio(ANCHOR_RATIO);
}
private int calculatePeekHeight()
@@ -270,7 +271,7 @@ public class RichPlacePageController implements PlacePageController, LocationLis
public void close(boolean deactivateMapSelection)
{
mDeactivateMapSelection = deactivateMapSelection;
- mPlacePageBehavior.setState(AnchorBottomSheetBehavior.STATE_HIDDEN);
+ mPlacePageBehavior.setState(BottomSheetBehavior.STATE_HIDDEN);
mPlacePage.reset();
}
@@ -289,7 +290,7 @@ public class RichPlacePageController implements PlacePageController, LocationLis
@Override
public void onCompassUpdated(long time, double north)
{
- @AnchorBottomSheetBehavior.State
+ @BottomSheetBehavior.State
int currentState = mPlacePageBehavior.getState();
if (PlacePageUtils.isHiddenState(currentState) || PlacePageUtils.isDraggingState(currentState)
|| PlacePageUtils.isSettlingState(currentState))
@@ -331,7 +332,7 @@ public class RichPlacePageController implements PlacePageController, LocationLis
@Override
public void onRestore(@NonNull Bundle inState)
{
- if (mPlacePageBehavior.getState() == AnchorBottomSheetBehavior.STATE_HIDDEN)
+ if (mPlacePageBehavior.getState() == BottomSheetBehavior.STATE_HIDDEN)
return;
if (!Framework.nativeHasPlacePageInfo())
@@ -344,14 +345,14 @@ public class RichPlacePageController implements PlacePageController, LocationLis
if (object == null)
return;
- @AnchorBottomSheetBehavior.State
+ @BottomSheetBehavior.State
int state = mPlacePageBehavior.getState();
mPlacePage.setMapObject(object, (isSameObject) -> {
restorePlacePageState(object, state);
});
}
- private void restorePlacePageState(@NonNull MapObject object, @AnchorBottomSheetBehavior.State int state)
+ private void restorePlacePageState(@NonNull MapObject object, @BottomSheetBehavior.State int state)
{
mPlacePage.post(() -> {
setPlacePageAnchor();
diff --git a/android/src/com/mapswithme/maps/widget/placepage/SimplePlacePageController.java b/android/src/com/mapswithme/maps/widget/placepage/SimplePlacePageController.java
index 36e075baa6..6f4946ec7e 100644
--- a/android/src/com/mapswithme/maps/widget/placepage/SimplePlacePageController.java
+++ b/android/src/com/mapswithme/maps/widget/placepage/SimplePlacePageController.java
@@ -12,10 +12,10 @@ import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.core.view.GestureDetectorCompat;
+import com.google.android.material.bottomsheet.BottomSheetBehavior;
import com.mapswithme.maps.Framework;
import com.mapswithme.maps.R;
import com.mapswithme.util.UiUtils;
-import com.trafi.anchorbottomsheetbehavior.AnchorBottomSheetBehavior;
import java.util.Objects;
@@ -29,7 +29,7 @@ public class SimplePlacePageController implements PlacePageController
private View mSheet;
@SuppressWarnings("NullableProblems")
@NonNull
- private AnchorBottomSheetBehavior mSheetBehavior;
+ private BottomSheetBehavior mSheetBehavior;
@NonNull
private final SlideListener mSlideListener;
private int mViewportMinHeight;
@@ -96,7 +96,7 @@ public class SimplePlacePageController implements PlacePageController
}
};
- private final AnchorBottomSheetBehavior.BottomSheetCallback mSheetCallback
+ private final BottomSheetBehavior.BottomSheetCallback mSheetCallback
= new DefaultBottomSheetCallback(mBottomSheetChangedListener);
private boolean mDeactivateMapSelection = true;
@@ -119,16 +119,16 @@ public class SimplePlacePageController implements PlacePageController
mDeactivateMapSelection = true;
mViewRenderer.render(data);
if (mSheetBehavior.getSkipCollapsed())
- mSheetBehavior.setState(AnchorBottomSheetBehavior.STATE_EXPANDED);
+ mSheetBehavior.setState(BottomSheetBehavior.STATE_EXPANDED);
else
- mSheetBehavior.setState(AnchorBottomSheetBehavior.STATE_COLLAPSED);
+ mSheetBehavior.setState(BottomSheetBehavior.STATE_COLLAPSED);
}
@Override
public void close(boolean deactivateMapSelection)
{
mDeactivateMapSelection = deactivateMapSelection;
- mSheetBehavior.setState(AnchorBottomSheetBehavior.STATE_HIDDEN);
+ mSheetBehavior.setState(BottomSheetBehavior.STATE_HIDDEN);
}
@Override
@@ -188,8 +188,10 @@ public class SimplePlacePageController implements PlacePageController
mSheet = activity.findViewById(mSheetResId);
mViewportMinHeight = mSheet.getResources().getDimensionPixelSize(R.dimen.viewport_min_height);
mViewPortMinWidth = mSheet.getResources().getDimensionPixelSize(R.dimen.viewport_min_width);
- mSheetBehavior = AnchorBottomSheetBehavior.from(mSheet);
+ mSheetBehavior = BottomSheetBehavior.from(mSheet);
mSheetBehavior.addBottomSheetCallback(mSheetCallback);
+ mSheetBehavior.setHideable(true);
+ mSheetBehavior.setState(BottomSheetBehavior.STATE_HIDDEN);
boolean isLandscape = UiUtils.isLandscape(mApplication);
GestureDetectorCompat gestureDetector = new GestureDetectorCompat(
activity, new SimplePlacePageGestureListener(mSheetBehavior, isLandscape));
@@ -228,7 +230,7 @@ public class SimplePlacePageController implements PlacePageController
// we should expand bottom sheet forcibly for horizontal orientation. It's by design.
if (!PlacePageUtils.isHiddenState(mSheetBehavior.getState()))
{
- mSheetBehavior.setState(AnchorBottomSheetBehavior.STATE_EXPANDED);
+ mSheetBehavior.setState(BottomSheetBehavior.STATE_EXPANDED);
}
return;
}
@@ -261,7 +263,7 @@ public class SimplePlacePageController implements PlacePageController
{
private final boolean mLandscape;
- SimplePlacePageGestureListener(@NonNull AnchorBottomSheetBehavior bottomSheetBehavior,
+ SimplePlacePageGestureListener(@NonNull BottomSheetBehavior bottomSheetBehavior,
boolean landscape)
{
super(bottomSheetBehavior);
@@ -273,7 +275,7 @@ public class SimplePlacePageController implements PlacePageController
{
if (mLandscape)
{
- getBottomSheetBehavior().setState(AnchorBottomSheetBehavior.STATE_HIDDEN);
+ getBottomSheetBehavior().setState(BottomSheetBehavior.STATE_HIDDEN);
return false;
}
diff --git a/data/copyright.html b/data/copyright.html
index 25c33e598e..d63a9fb11f 100644
--- a/data/copyright.html
+++ b/data/copyright.html
@@ -230,9 +230,6 @@
sticky-headers-recyclerview
© 2014 Jacob Tabak; Apache License
- AnchorBottomSheetBehavior
- Apache License
-
Ordnance Survey data
© Crown copyright and database right 2018; Open Government Licence