forked from organicmaps/organicmaps
[android] Expanded/improved place page state observer interface to reuse it for simple place page controller
This commit is contained in:
parent
97c6ce7d7d
commit
3132dadb84
3 changed files with 27 additions and 8 deletions
|
@ -4,9 +4,6 @@ import android.animation.ArgbEvaluator;
|
|||
import android.animation.ObjectAnimator;
|
||||
import android.content.Context;
|
||||
import android.content.res.Resources;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.fragment.app.FragmentActivity;
|
||||
import android.text.TextUtils;
|
||||
import android.util.DisplayMetrics;
|
||||
import android.view.LayoutInflater;
|
||||
|
@ -15,6 +12,9 @@ import android.view.ViewGroup;
|
|||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.fragment.app.FragmentActivity;
|
||||
import com.mapswithme.maps.R;
|
||||
import com.mapswithme.maps.ads.AdTracker;
|
||||
import com.mapswithme.maps.ads.Banner;
|
||||
|
@ -465,8 +465,7 @@ final class BannerController implements PlacePageStateObserver
|
|||
banner.setLayoutParams(lp);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPlacePageStateChanged()
|
||||
private void onPlacePageStateChanged()
|
||||
{
|
||||
if (mCurrentAd == null)
|
||||
return;
|
||||
|
@ -475,6 +474,24 @@ final class BannerController implements PlacePageStateObserver
|
|||
setBannerState(newState);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPlacePageDetails()
|
||||
{
|
||||
onPlacePageStateChanged();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPlacePagePreview()
|
||||
{
|
||||
onPlacePageStateChanged();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPlacePageClosed()
|
||||
{
|
||||
// Do nothing.
|
||||
}
|
||||
|
||||
private class MyNativeAdsListener implements NativeAdListener
|
||||
{
|
||||
@Nullable
|
||||
|
|
|
@ -2,5 +2,7 @@ package com.mapswithme.maps.widget.placepage;
|
|||
|
||||
public interface PlacePageStateObserver
|
||||
{
|
||||
void onPlacePageStateChanged();
|
||||
void onPlacePageDetails();
|
||||
void onPlacePagePreview();
|
||||
void onPlacePageClosed();
|
||||
}
|
||||
|
|
|
@ -100,7 +100,7 @@ public class RichPlacePageController implements PlacePageController, LocationLis
|
|||
@Override
|
||||
public void onSheetDetailsOpened()
|
||||
{
|
||||
mBannerController.onPlacePageStateChanged();
|
||||
mBannerController.onPlacePageDetails();
|
||||
mPlacePageTracker.onDetails();
|
||||
}
|
||||
|
||||
|
@ -108,7 +108,7 @@ public class RichPlacePageController implements PlacePageController, LocationLis
|
|||
public void onSheetCollapsed()
|
||||
{
|
||||
mPlacePage.resetScroll();
|
||||
mBannerController.onPlacePageStateChanged();
|
||||
mBannerController.onPlacePagePreview();
|
||||
setPeekHeight();
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue