forked from organicmaps/organicmaps
[android] toolbar behavior is repalaced by sheet states callbacks
This commit is contained in:
parent
0f05b7200a
commit
d22fe2b6e0
5 changed files with 8 additions and 53 deletions
|
@ -101,7 +101,6 @@
|
|||
<include layout="@layout/guests_and_rooms_menu_bottom_sheet" />
|
||||
<com.google.android.material.appbar.AppBarLayout
|
||||
android:id="@+id/app_bar"
|
||||
app:layout_behavior="@string/placepage_toolbar_behavior"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
app:elevation="@dimen/appbar_elevation"
|
||||
|
|
|
@ -96,7 +96,6 @@
|
|||
<string name="never_enum_value" translatable="false">NEVER</string>
|
||||
<string name="always_enum_value" translatable="false">ALWAYS</string>
|
||||
<string name="auto_enum_value" translatable="false">AUTO</string>
|
||||
<string name="placepage_toolbar_behavior" translatable="false">com.mapswithme.maps.widget.placepage.ToolbarBehavior</string>
|
||||
<string name="placepage_behavior" translatable="false">com.trafi.anchorbottomsheetbehavior.AnchorBottomSheetBehavior</string>
|
||||
<string name="booking_filter_date_range" translatable="false">%s - %s</string>
|
||||
</resources>
|
||||
|
|
|
@ -48,7 +48,6 @@ import com.mapswithme.maps.tips.Tutorial;
|
|||
import com.mapswithme.maps.ugc.EditParams;
|
||||
import com.mapswithme.maps.ugc.UGC;
|
||||
import com.mapswithme.maps.ugc.UGCEditorActivity;
|
||||
import com.mapswithme.maps.widget.placepage.ToolbarBehavior;
|
||||
import com.mapswithme.util.Constants;
|
||||
import com.mapswithme.util.CrashlyticsUtils;
|
||||
import com.mapswithme.util.KeyValue;
|
||||
|
|
|
@ -15,6 +15,7 @@ import androidx.annotation.NonNull;
|
|||
import androidx.annotation.Nullable;
|
||||
import androidx.appcompat.widget.Toolbar;
|
||||
import androidx.core.view.GestureDetectorCompat;
|
||||
import com.google.android.material.appbar.AppBarLayout;
|
||||
import com.mapswithme.maps.Framework;
|
||||
import com.mapswithme.maps.R;
|
||||
import com.mapswithme.maps.ads.CompoundNativeAdLoader;
|
||||
|
@ -63,6 +64,9 @@ public class RichPlacePageController implements PlacePageController, LocationLis
|
|||
@SuppressWarnings("NullableProblems")
|
||||
@NonNull
|
||||
private Toolbar mToolbar;
|
||||
@SuppressWarnings("NullableProblems")
|
||||
@NonNull
|
||||
private AppBarLayout mToolbarLayout;
|
||||
private int mViewportMinHeight;
|
||||
private int mCurrentTop;
|
||||
private boolean mPeekHeightAnimating;
|
||||
|
@ -102,6 +106,7 @@ public class RichPlacePageController implements PlacePageController, LocationLis
|
|||
{
|
||||
mBannerController.onPlacePageDetails();
|
||||
mPlacePageTracker.onDetails();
|
||||
UiUtils.show(mToolbarLayout);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -110,6 +115,7 @@ public class RichPlacePageController implements PlacePageController, LocationLis
|
|||
mPlacePage.resetScroll();
|
||||
mBannerController.onPlacePagePreview();
|
||||
setPeekHeight();
|
||||
UiUtils.show(mToolbarLayout);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -141,6 +147,7 @@ public class RichPlacePageController implements PlacePageController, LocationLis
|
|||
PlacePageUtils.moveViewportUp(mPlacePage, mViewportMinHeight);
|
||||
UiUtils.invisible(mButtonsLayout);
|
||||
mPlacePageTracker.onHidden();
|
||||
UiUtils.hide(mToolbarLayout);
|
||||
}
|
||||
|
||||
private void resizeBanner()
|
||||
|
@ -212,6 +219,7 @@ public class RichPlacePageController implements PlacePageController, LocationLis
|
|||
mViewportMinHeight = res.getDimensionPixelSize(R.dimen.viewport_min_height);
|
||||
mOpenBannerTouchSlop = res.getDimensionPixelSize(R.dimen.placepage_banner_open_touch_slop);
|
||||
mToolbar = activity.findViewById(R.id.pp_toolbar);
|
||||
mToolbarLayout = activity.findViewById(R.id.app_bar);
|
||||
UiUtils.extendViewWithStatusBar(mToolbar);
|
||||
UiUtils.showHomeUpButton(mToolbar);
|
||||
mToolbar.setNavigationOnClickListener(v -> close(true));
|
||||
|
|
|
@ -1,50 +0,0 @@
|
|||
package com.mapswithme.maps.widget.placepage;
|
||||
|
||||
import android.content.Context;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.View;
|
||||
|
||||
import androidx.coordinatorlayout.widget.CoordinatorLayout;
|
||||
import com.google.android.material.appbar.AppBarLayout;
|
||||
import com.mapswithme.maps.R;
|
||||
import com.mapswithme.util.UiUtils;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
public class ToolbarBehavior extends AppBarLayout.ScrollingViewBehavior
|
||||
{
|
||||
private boolean mBookmarkMode;
|
||||
|
||||
public ToolbarBehavior()
|
||||
{
|
||||
// Do nothing by default.
|
||||
}
|
||||
|
||||
public ToolbarBehavior(Context context, AttributeSet attrs)
|
||||
{
|
||||
super(context, attrs);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean layoutDependsOn(CoordinatorLayout parent, View child, View dependency)
|
||||
{
|
||||
return dependency.getId() == R.id.placepage;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onDependentViewChanged(CoordinatorLayout parent, View toolbar, View placePage)
|
||||
{
|
||||
if (placePage.getY() == 0 && UiUtils.isHidden(toolbar))
|
||||
{
|
||||
UiUtils.show(toolbar);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (placePage.getY() > 0 && UiUtils.isVisible(toolbar))
|
||||
{
|
||||
UiUtils.hide(toolbar);
|
||||
return false;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
Loading…
Add table
Reference in a new issue