forked from organicmaps/organicmaps
[android] Implemented come back to the bookmark list after the specific bookmark is shown on the map
This commit is contained in:
parent
26f616712d
commit
d9e00c0723
10 changed files with 184 additions and 31 deletions
|
@ -26,11 +26,13 @@ import androidx.annotation.Nullable;
|
|||
import androidx.annotation.StyleRes;
|
||||
import androidx.appcompat.app.AlertDialog;
|
||||
import androidx.appcompat.widget.Toolbar;
|
||||
import androidx.coordinatorlayout.widget.CoordinatorLayout;
|
||||
import androidx.fragment.app.DialogFragment;
|
||||
import androidx.fragment.app.Fragment;
|
||||
import androidx.fragment.app.FragmentActivity;
|
||||
import androidx.fragment.app.FragmentManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
import com.google.android.material.appbar.AppBarLayout;
|
||||
import com.mapswithme.maps.Framework.PlacePageActivationListener;
|
||||
import com.mapswithme.maps.ads.LikesManager;
|
||||
import com.mapswithme.maps.api.ParsedMwmRequest;
|
||||
|
@ -46,10 +48,12 @@ import com.mapswithme.maps.bookmarks.AuthBundleFactory;
|
|||
import com.mapswithme.maps.bookmarks.BookmarkCategoriesActivity;
|
||||
import com.mapswithme.maps.bookmarks.BookmarksCatalogActivity;
|
||||
import com.mapswithme.maps.bookmarks.data.BookmarkCategory;
|
||||
import com.mapswithme.maps.bookmarks.data.BookmarkInfo;
|
||||
import com.mapswithme.maps.bookmarks.data.BookmarkManager;
|
||||
import com.mapswithme.maps.bookmarks.data.CatalogCustomProperty;
|
||||
import com.mapswithme.maps.bookmarks.data.CatalogTagsGroup;
|
||||
import com.mapswithme.maps.bookmarks.data.MapObject;
|
||||
import com.mapswithme.maps.bookmarks.data.Track;
|
||||
import com.mapswithme.maps.dialog.AlertDialogCallback;
|
||||
import com.mapswithme.maps.dialog.DefaultConfirmationAlertDialog;
|
||||
import com.mapswithme.maps.dialog.DialogUtils;
|
||||
|
@ -141,7 +145,9 @@ import com.mapswithme.maps.widget.menu.MyPositionButton;
|
|||
import com.mapswithme.maps.widget.placepage.PlacePageController;
|
||||
import com.mapswithme.maps.widget.placepage.PlacePageData;
|
||||
import com.mapswithme.maps.widget.placepage.PlacePageFactory;
|
||||
import com.mapswithme.maps.widget.placepage.PlacePageStateObserver;
|
||||
import com.mapswithme.maps.widget.placepage.RoutingModeListener;
|
||||
import com.mapswithme.maps.widget.placepage.ToolbarBehavior;
|
||||
import com.mapswithme.util.Counters;
|
||||
import com.mapswithme.util.InputUtils;
|
||||
import com.mapswithme.util.NetworkPolicy;
|
||||
|
@ -195,7 +201,8 @@ public class MwmActivity extends BaseMwmFragmentActivity
|
|||
OnIsolinesLayerToggleListener,
|
||||
OnGuidesLayerToggleListener,
|
||||
GuidesGalleryListener,
|
||||
NoConnectionListener
|
||||
NoConnectionListener,
|
||||
PlacePageStateObserver
|
||||
{
|
||||
private static final Logger LOGGER = LoggerFactory.INSTANCE.getLogger(LoggerFactory.Type.MISC);
|
||||
private static final String TAG = MwmActivity.class.getSimpleName();
|
||||
|
@ -303,10 +310,9 @@ public class MwmActivity extends BaseMwmFragmentActivity
|
|||
private Tutorial mTutorial;
|
||||
@Nullable
|
||||
private OnboardingTip mOnboardingTip;
|
||||
|
||||
@SuppressWarnings("NullableProblems")
|
||||
@SuppressWarnings("NotNullFieldNotInitialized")
|
||||
@NonNull
|
||||
private ChartController mChartController;
|
||||
private Toolbar mPlacePageToolbar;
|
||||
|
||||
public interface LeftAnimationTrackListener
|
||||
{
|
||||
|
@ -551,7 +557,7 @@ public class MwmActivity extends BaseMwmFragmentActivity
|
|||
setContentView(R.layout.activity_map);
|
||||
|
||||
mPlacePageController = PlacePageFactory.createCompositePlacePageController(
|
||||
this, this, this, this);
|
||||
this, this, this, this, this);
|
||||
mPlacePageController.initialize(this);
|
||||
mPlacePageController.onActivityCreated(this, savedInstanceState);
|
||||
|
||||
|
@ -564,6 +570,7 @@ public class MwmActivity extends BaseMwmFragmentActivity
|
|||
mSearchController.getToolbar().getViewTreeObserver().addOnGlobalLayoutListener(new ToolbarLayoutChangeListener());
|
||||
mSearchController.setVisibilityListener(this);
|
||||
|
||||
mPlacePageToolbar = findViewById(R.id.pp_toolbar);
|
||||
boolean isLaunchByDeepLink = getIntent().getBooleanExtra(EXTRA_LAUNCH_BY_DEEP_LINK, false);
|
||||
initViews(isLaunchByDeepLink);
|
||||
|
||||
|
@ -2713,6 +2720,65 @@ public class MwmActivity extends BaseMwmFragmentActivity
|
|||
return mMainMenuController;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPlacePageDetails()
|
||||
{
|
||||
// Do nothing.
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPlacePagePreview()
|
||||
{
|
||||
// Do nothing.
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPlacePageClosed()
|
||||
{
|
||||
AppBarLayout appBarLayout = (AppBarLayout) mPlacePageToolbar.getParent();
|
||||
CoordinatorLayout.LayoutParams params
|
||||
= (CoordinatorLayout.LayoutParams) appBarLayout.getLayoutParams();
|
||||
ToolbarBehavior behavior = (ToolbarBehavior) params.getBehavior();
|
||||
Objects.requireNonNull(behavior);
|
||||
if (behavior.isBookmarkModeEnabled())
|
||||
{
|
||||
behavior.setBookmarkModeEnabled(false);
|
||||
UiUtils.hide(appBarLayout);
|
||||
mPlacePageToolbar.setNavigationOnClickListener(v -> closePlacePage());
|
||||
}
|
||||
}
|
||||
|
||||
public void showTrackOnMap(long trackId)
|
||||
{
|
||||
Track track = BookmarkManager.INSTANCE.getTrack(trackId);
|
||||
Objects.requireNonNull(track);
|
||||
setupToolbarForUserMark(track.getName(), track.getCategoryId());
|
||||
Framework.nativeShowTrackRect(trackId);
|
||||
}
|
||||
|
||||
public void showBookmarkOnMap(long bookmarkId)
|
||||
{
|
||||
BookmarkInfo info = BookmarkManager.INSTANCE.getBookmarkInfo(bookmarkId);
|
||||
Objects.requireNonNull(info);
|
||||
setupToolbarForUserMark(info.getName(), info.getCategoryId());
|
||||
BookmarkManager.INSTANCE.showBookmarkOnMap(bookmarkId);
|
||||
}
|
||||
|
||||
private void setupToolbarForUserMark(@NonNull String name, long categoryId)
|
||||
{
|
||||
AppBarLayout appBarLayout = (AppBarLayout) mPlacePageToolbar.getParent();
|
||||
CoordinatorLayout.LayoutParams params = (CoordinatorLayout.LayoutParams) appBarLayout.getLayoutParams();
|
||||
ToolbarBehavior behavior = (ToolbarBehavior) params.getBehavior();
|
||||
Objects.requireNonNull(behavior);
|
||||
behavior.setBookmarkModeEnabled(true);
|
||||
mPlacePageToolbar.setTitle(name);
|
||||
mPlacePageToolbar.setNavigationOnClickListener(v -> {
|
||||
BookmarkCategory category = BookmarkManager.INSTANCE.getCategoryById(categoryId);
|
||||
BookmarkCategoriesActivity.startForResult(this, category, true);
|
||||
closePlacePage();
|
||||
});
|
||||
}
|
||||
|
||||
private class CurrentPositionClickListener implements OnClickListener
|
||||
{
|
||||
@Override
|
||||
|
|
|
@ -48,7 +48,7 @@ public abstract class BaseBookmarkCategoriesFragment extends BaseMwmRecyclerFrag
|
|||
|
||||
{
|
||||
static final int REQ_CODE_CATALOG = 101;
|
||||
private static final int REQ_CODE_DELETE_CATEGORY = 102;
|
||||
static final int REQ_CODE_DELETE_CATEGORY = 102;
|
||||
|
||||
private static final int MAX_CATEGORY_NAME_LENGTH = 60;
|
||||
|
||||
|
|
|
@ -4,14 +4,15 @@ import android.app.Activity;
|
|||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
|
||||
import androidx.annotation.CallSuper;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.annotation.StyleRes;
|
||||
import androidx.fragment.app.Fragment;
|
||||
|
||||
import com.mapswithme.maps.R;
|
||||
import com.mapswithme.maps.base.BaseToolbarActivity;
|
||||
import com.mapswithme.maps.bookmarks.data.BookmarkCategory;
|
||||
import com.mapswithme.maps.bookmarks.data.BookmarkManager;
|
||||
import com.mapswithme.util.SharedPropertiesUtils;
|
||||
import com.mapswithme.util.ThemeUtils;
|
||||
|
@ -67,19 +68,35 @@ public class BookmarkCategoriesActivity extends BaseToolbarActivity
|
|||
}
|
||||
|
||||
public static void startForResult(@NonNull Activity context, int initialPage,
|
||||
@Nullable String catalogDeeplink)
|
||||
@Nullable String catalogDeeplink, boolean openBookmarkList,
|
||||
@Nullable BookmarkCategory category)
|
||||
{
|
||||
Bundle args = new Bundle();
|
||||
args.putInt(BookmarkCategoriesPagerFragment.ARG_CATEGORIES_PAGE, initialPage);
|
||||
args.putString(BookmarkCategoriesPagerFragment.ARG_CATALOG_DEEPLINK, catalogDeeplink);
|
||||
args.putBoolean(BookmarkCategoriesPagerFragment.ARG_OPEN_BOOKMARK_LIST, openBookmarkList);
|
||||
args.putParcelable(BookmarksListFragment.EXTRA_CATEGORY, category);
|
||||
Intent intent = new Intent(context, BookmarkCategoriesActivity.class);
|
||||
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP).putExtras(args);
|
||||
context.startActivityForResult(intent, REQ_CODE_DOWNLOAD_BOOKMARK_CATEGORY);
|
||||
}
|
||||
|
||||
public static void startForResult(@NonNull Activity context, int initialPage,
|
||||
@Nullable String catalogDeeplink)
|
||||
{
|
||||
startForResult(context, initialPage, catalogDeeplink, false, null);
|
||||
}
|
||||
|
||||
public static void startForResult(@NonNull Activity context)
|
||||
{
|
||||
int initialPage = SharedPropertiesUtils.getLastVisibleBookmarkCategoriesPage(context);
|
||||
startForResult(context, initialPage, null);
|
||||
startForResult(context, initialPage, null, false, null);
|
||||
}
|
||||
|
||||
public static void startForResult(@NonNull Activity context, @Nullable BookmarkCategory category,
|
||||
boolean openBookmarkList)
|
||||
{
|
||||
int initialPage = SharedPropertiesUtils.getLastVisibleBookmarkCategoriesPage(context);
|
||||
startForResult(context, initialPage, null, true, category);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,19 +2,20 @@ package com.mapswithme.maps.bookmarks;
|
|||
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import com.google.android.material.tabs.TabLayout;
|
||||
import androidx.fragment.app.FragmentManager;
|
||||
import androidx.viewpager.widget.ViewPager;
|
||||
import android.text.TextUtils;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.fragment.app.FragmentManager;
|
||||
import androidx.viewpager.widget.ViewPager;
|
||||
import com.google.android.material.tabs.TabLayout;
|
||||
import com.mapswithme.maps.R;
|
||||
import com.mapswithme.maps.auth.TargetFragmentCallback;
|
||||
import com.mapswithme.maps.base.BaseMwmFragment;
|
||||
import com.mapswithme.maps.bookmarks.data.BookmarkCategory;
|
||||
import com.mapswithme.maps.dialog.AlertDialogCallback;
|
||||
import com.mapswithme.maps.purchase.PurchaseUtils;
|
||||
import com.mapswithme.util.SharedPropertiesUtils;
|
||||
|
@ -28,6 +29,7 @@ public class BookmarkCategoriesPagerFragment extends BaseMwmFragment
|
|||
{
|
||||
final static String ARG_CATEGORIES_PAGE = "arg_categories_page";
|
||||
final static String ARG_CATALOG_DEEPLINK = "arg_catalog_deeplink";
|
||||
final static String ARG_OPEN_BOOKMARK_LIST = "arg_open_bookmark_list";
|
||||
|
||||
@SuppressWarnings("NullableProblems")
|
||||
@NonNull
|
||||
|
@ -96,6 +98,21 @@ public class BookmarkCategoriesPagerFragment extends BaseMwmFragment
|
|||
return root;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState)
|
||||
{
|
||||
super.onViewCreated(view, savedInstanceState);
|
||||
Bundle args = getArguments();
|
||||
if (args != null && args.getBoolean(ARG_OPEN_BOOKMARK_LIST))
|
||||
{
|
||||
BookmarkCategory category = args.getParcelable(BookmarksListFragment.EXTRA_CATEGORY);
|
||||
if (category == null)
|
||||
return;
|
||||
|
||||
BookmarkListActivity.startForResult(requireActivity(), category);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStart()
|
||||
{
|
||||
|
|
|
@ -1,12 +1,15 @@
|
|||
package com.mapswithme.maps.bookmarks;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Intent;
|
||||
|
||||
import androidx.annotation.CallSuper;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.StyleRes;
|
||||
import androidx.fragment.app.Fragment;
|
||||
|
||||
import com.mapswithme.maps.R;
|
||||
import com.mapswithme.maps.base.BaseToolbarActivity;
|
||||
import com.mapswithme.maps.bookmarks.data.BookmarkCategory;
|
||||
import com.mapswithme.maps.bookmarks.data.BookmarkManager;
|
||||
import com.mapswithme.util.ThemeUtils;
|
||||
|
||||
|
@ -52,4 +55,11 @@ public class BookmarkListActivity extends BaseToolbarActivity
|
|||
{
|
||||
return R.layout.bookmarks_activity;
|
||||
}
|
||||
|
||||
static void startForResult(@NonNull Activity activity, @NonNull BookmarkCategory category)
|
||||
{
|
||||
Intent intent = new Intent(activity, BookmarkListActivity.class);
|
||||
intent.putExtra(BookmarksListFragment.EXTRA_CATEGORY, category);
|
||||
activity.startActivityForResult(intent, BaseBookmarkCategoriesFragment.REQ_CODE_DELETE_CATEGORY);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,12 +9,16 @@ import android.util.Log;
|
|||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.appcompat.widget.Toolbar;
|
||||
import androidx.coordinatorlayout.widget.CoordinatorLayout;
|
||||
import androidx.fragment.app.DialogFragment;
|
||||
import androidx.fragment.app.Fragment;
|
||||
import com.google.android.material.appbar.AppBarLayout;
|
||||
import com.mapswithme.maps.DownloadResourcesLegacyActivity;
|
||||
import com.mapswithme.maps.Framework;
|
||||
import com.mapswithme.maps.MapFragment;
|
||||
import com.mapswithme.maps.MwmActivity;
|
||||
import com.mapswithme.maps.R;
|
||||
import com.mapswithme.maps.api.Const;
|
||||
import com.mapswithme.maps.api.ParsedMwmRequest;
|
||||
import com.mapswithme.maps.api.ParsedRoutingData;
|
||||
|
@ -25,6 +29,8 @@ import com.mapswithme.maps.background.NotificationCandidate;
|
|||
import com.mapswithme.maps.bookmarks.BookmarkCategoriesActivity;
|
||||
import com.mapswithme.maps.bookmarks.BookmarksCatalogActivity;
|
||||
import com.mapswithme.maps.bookmarks.BookmarksPageFactory;
|
||||
import com.mapswithme.maps.bookmarks.data.BookmarkCategory;
|
||||
import com.mapswithme.maps.bookmarks.data.BookmarkInfo;
|
||||
import com.mapswithme.maps.bookmarks.data.BookmarkManager;
|
||||
import com.mapswithme.maps.bookmarks.data.FeatureId;
|
||||
import com.mapswithme.maps.bookmarks.data.MapObject;
|
||||
|
@ -41,11 +47,13 @@ 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;
|
||||
import com.mapswithme.util.StorageUtils;
|
||||
import com.mapswithme.util.UTM;
|
||||
import com.mapswithme.util.UiUtils;
|
||||
import com.mapswithme.util.Utils;
|
||||
import com.mapswithme.util.concurrency.ThreadPool;
|
||||
import com.mapswithme.util.log.Logger;
|
||||
|
@ -59,6 +67,7 @@ import java.io.OutputStream;
|
|||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Objects;
|
||||
|
||||
public class Factory
|
||||
{
|
||||
|
@ -1071,7 +1080,7 @@ public class Factory
|
|||
@Override
|
||||
public boolean run(@NonNull MwmActivity target)
|
||||
{
|
||||
BookmarkManager.INSTANCE.showBookmarkOnMap(mId);
|
||||
target.showBookmarkOnMap(mId);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -1088,7 +1097,7 @@ public class Factory
|
|||
@Override
|
||||
public boolean run(@NonNull MwmActivity target)
|
||||
{
|
||||
Framework.nativeShowTrackRect(mId);
|
||||
target.showTrackOnMap(mId);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -21,6 +21,8 @@ class PlacePageControllerComposite implements PlacePageController
|
|||
private final RoutingModeListener mRoutingModeListener;
|
||||
@Nullable
|
||||
private final GuidesGalleryListener mGuidesGalleryListener;
|
||||
@Nullable
|
||||
private final PlacePageStateObserver mStateObserver;
|
||||
@NonNull
|
||||
private final List<PlacePageController> mControllers = new ArrayList<>();
|
||||
@SuppressWarnings("NullableProblems")
|
||||
|
@ -30,12 +32,14 @@ class PlacePageControllerComposite implements PlacePageController
|
|||
PlacePageControllerComposite(@NonNull AdsRemovalPurchaseControllerProvider adsProvider,
|
||||
@NonNull SlideListener slideListener,
|
||||
@Nullable RoutingModeListener routingModeListener,
|
||||
@Nullable GuidesGalleryListener galleryListener)
|
||||
@Nullable GuidesGalleryListener galleryListener,
|
||||
@Nullable PlacePageStateObserver stateObserver)
|
||||
{
|
||||
mAdsProvider = adsProvider;
|
||||
mSlideListener = slideListener;
|
||||
mRoutingModeListener = routingModeListener;
|
||||
mGuidesGalleryListener = galleryListener;
|
||||
mStateObserver = stateObserver;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -119,7 +123,7 @@ class PlacePageControllerComposite implements PlacePageController
|
|||
|
||||
PlacePageController richController =
|
||||
PlacePageFactory.createRichController(mAdsProvider, mSlideListener,
|
||||
mRoutingModeListener);
|
||||
mRoutingModeListener, mStateObserver);
|
||||
richController.initialize(activity);
|
||||
mControllers.add(richController);
|
||||
|
||||
|
|
|
@ -13,19 +13,21 @@ public class PlacePageFactory
|
|||
@NonNull AdsRemovalPurchaseControllerProvider provider,
|
||||
@NonNull PlacePageController.SlideListener slideListener,
|
||||
@NonNull RoutingModeListener routingModeListener,
|
||||
@Nullable GuidesGalleryListener galleryListener)
|
||||
@Nullable GuidesGalleryListener galleryListener,
|
||||
@Nullable PlacePageStateObserver stateObserver)
|
||||
{
|
||||
return new PlacePageControllerComposite(provider, slideListener, routingModeListener,
|
||||
galleryListener);
|
||||
galleryListener, stateObserver);
|
||||
}
|
||||
|
||||
@NonNull
|
||||
static PlacePageController createRichController(
|
||||
@NonNull AdsRemovalPurchaseControllerProvider provider,
|
||||
@NonNull PlacePageController.SlideListener listener,
|
||||
@Nullable RoutingModeListener routingModeListener)
|
||||
@Nullable RoutingModeListener routingModeListener,
|
||||
@Nullable PlacePageStateObserver stateObserver)
|
||||
{
|
||||
return new RichPlacePageController(provider, listener, routingModeListener);
|
||||
return new RichPlacePageController(provider, listener, routingModeListener, stateObserver);
|
||||
}
|
||||
|
||||
@NonNull
|
||||
|
|
|
@ -82,6 +82,8 @@ public class RichPlacePageController implements PlacePageController, LocationLis
|
|||
private final SlideListener mSlideListener;
|
||||
@Nullable
|
||||
private final RoutingModeListener mRoutingModeListener;
|
||||
@Nullable
|
||||
private final PlacePageStateObserver mStateObserver;
|
||||
@NonNull
|
||||
private final BottomSheetChangedListener mBottomSheetChangedListener = new BottomSheetChangedListener()
|
||||
{
|
||||
|
@ -89,6 +91,8 @@ public class RichPlacePageController implements PlacePageController, LocationLis
|
|||
public void onSheetHidden()
|
||||
{
|
||||
onHiddenInternal();
|
||||
if (mStateObserver != null)
|
||||
mStateObserver.onPlacePageClosed();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -102,6 +106,8 @@ public class RichPlacePageController implements PlacePageController, LocationLis
|
|||
{
|
||||
mBannerController.onPlacePageDetails();
|
||||
mPlacePageTracker.onDetails();
|
||||
if (mStateObserver != null)
|
||||
mStateObserver.onPlacePageDetails();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -110,6 +116,8 @@ public class RichPlacePageController implements PlacePageController, LocationLis
|
|||
mPlacePage.resetScroll();
|
||||
mBannerController.onPlacePagePreview();
|
||||
setPeekHeight();
|
||||
if (mStateObserver != null)
|
||||
mStateObserver.onPlacePagePreview();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -196,11 +204,13 @@ public class RichPlacePageController implements PlacePageController, LocationLis
|
|||
|
||||
RichPlacePageController(@NonNull AdsRemovalPurchaseControllerProvider provider,
|
||||
@NonNull SlideListener listener,
|
||||
@Nullable RoutingModeListener routingModeListener)
|
||||
@Nullable RoutingModeListener routingModeListener,
|
||||
@Nullable PlacePageStateObserver stateObserver)
|
||||
{
|
||||
mPurchaseControllerProvider = provider;
|
||||
mSlideListener = listener;
|
||||
mRoutingModeListener = routingModeListener;
|
||||
mStateObserver = stateObserver;
|
||||
}
|
||||
|
||||
@SuppressLint("ClickableViewAccessibility")
|
||||
|
|
|
@ -1,17 +1,19 @@
|
|||
package com.mapswithme.maps.widget.placepage;
|
||||
|
||||
import android.content.Context;
|
||||
import com.google.android.material.appbar.AppBarLayout;
|
||||
import androidx.coordinatorlayout.widget.CoordinatorLayout;
|
||||
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.
|
||||
|
@ -29,20 +31,36 @@ public class ToolbarBehavior extends AppBarLayout.ScrollingViewBehavior
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean onDependentViewChanged(CoordinatorLayout parent, View child, View dependency)
|
||||
public boolean onDependentViewChanged(CoordinatorLayout parent, View toolbar, View placePage)
|
||||
{
|
||||
if (dependency.getY() == 0 && UiUtils.isHidden(child))
|
||||
if (mBookmarkMode)
|
||||
{
|
||||
UiUtils.show(child);
|
||||
UiUtils.show(toolbar);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (dependency.getY() > 0 && UiUtils.isVisible(child))
|
||||
if (placePage.getY() == 0 && UiUtils.isHidden(toolbar))
|
||||
{
|
||||
UiUtils.hide(child);
|
||||
UiUtils.show(toolbar);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (placePage.getY() > 0 && UiUtils.isVisible(toolbar))
|
||||
{
|
||||
UiUtils.hide(toolbar);
|
||||
return false;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public void setBookmarkModeEnabled(boolean enable)
|
||||
{
|
||||
mBookmarkMode = enable;
|
||||
}
|
||||
|
||||
public boolean isBookmarkModeEnabled()
|
||||
{
|
||||
return mBookmarkMode;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue