Replaced crown btn for new dog btn
10
android/res/anim/dog_btn_rotation.xml
Normal file
|
@ -0,0 +1,10 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<rotate
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:duration="1000"
|
||||
android:fromDegrees="15"
|
||||
android:pivotX="50%"
|
||||
android:pivotY="50%"
|
||||
android:repeatCount="infinite"
|
||||
android:repeatMode="reverse"
|
||||
android:toDegrees="-60" />
|
BIN
android/res/drawable-hdpi/ic_dog.png
Executable file
After Width: | Height: | Size: 2.5 KiB |
BIN
android/res/drawable-hdpi/ic_dog_bg.png
Executable file
After Width: | Height: | Size: 3.3 KiB |
BIN
android/res/drawable-mdpi/ic_dog.png
Executable file
After Width: | Height: | Size: 1.5 KiB |
BIN
android/res/drawable-mdpi/ic_dog_bg.png
Executable file
After Width: | Height: | Size: 2 KiB |
BIN
android/res/drawable-xhdpi/ic_dog.png
Executable file
After Width: | Height: | Size: 3.4 KiB |
BIN
android/res/drawable-xhdpi/ic_dog_bg.png
Executable file
After Width: | Height: | Size: 4.8 KiB |
BIN
android/res/drawable-xxhdpi/ic_dog.png
Executable file
After Width: | Height: | Size: 5.5 KiB |
BIN
android/res/drawable-xxhdpi/ic_dog_bg.png
Executable file
After Width: | Height: | Size: 8.3 KiB |
BIN
android/res/drawable-xxxhdpi/ic_dog.png
Executable file
After Width: | Height: | Size: 7.7 KiB |
BIN
android/res/drawable-xxxhdpi/ic_dog_bg.png
Executable file
After Width: | Height: | Size: 12 KiB |
|
@ -53,13 +53,26 @@
|
|||
android:contentDescription="@string/core_my_position"
|
||||
android:tint="@null"/>
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/subs_screen_btn"
|
||||
style="@style/MwmWidget.MapButton.Traffic"
|
||||
android:background="?attr/bg_crown"
|
||||
android:src="@drawable/ic_crown"
|
||||
<FrameLayout
|
||||
android:id="@+id/subs_screen_btn_container"
|
||||
android:layout_alignBottom="@id/nav_zoom_out"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_alignParentStart="true"/>
|
||||
android:layout_alignParentStart="true"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/dog_btn_bg"
|
||||
style="@style/MwmWidget.MapButton.Traffic"
|
||||
android:layout_gravity="center"
|
||||
android:src="@drawable/ic_dog_bg"/>
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/subs_screen_btn"
|
||||
style="@style/MwmWidget.MapButton.Traffic"
|
||||
android:layout_gravity="center"
|
||||
android:src="@drawable/ic_dog"
|
||||
android:background="@null"/>
|
||||
</FrameLayout>
|
||||
</RelativeLayout>
|
||||
|
|
|
@ -53,13 +53,26 @@
|
|||
android:layout_alignParentRight="true"
|
||||
android:layout_alignParentEnd="true"/>
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/subs_screen_btn"
|
||||
style="@style/MwmWidget.MapButton.Traffic"
|
||||
android:background="?attr/bg_crown"
|
||||
android:src="@drawable/ic_crown"
|
||||
<FrameLayout
|
||||
android:id="@+id/subs_screen_btn_container"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_alignBottom="@id/nav_zoom_in"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_alignParentStart="true"/>
|
||||
android:layout_alignParentStart="true"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/dog_btn_bg"
|
||||
android:layout_gravity="center"
|
||||
style="@style/MwmWidget.MapButton.Traffic"
|
||||
android:src="@drawable/ic_dog_bg"/>
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/subs_screen_btn"
|
||||
style="@style/MwmWidget.MapButton.Traffic"
|
||||
android:layout_gravity="center"
|
||||
android:background="@null"
|
||||
android:src="@drawable/ic_dog"/>
|
||||
</FrameLayout>
|
||||
</RelativeLayout>
|
||||
|
|
|
@ -74,12 +74,13 @@ import com.mapswithme.maps.maplayer.traffic.widget.TrafficButton;
|
|||
import com.mapswithme.maps.metrics.UserActionsLogger;
|
||||
import com.mapswithme.maps.onboarding.IntroductionDialogFragment;
|
||||
import com.mapswithme.maps.onboarding.IntroductionScreenFactory;
|
||||
import com.mapswithme.maps.onboarding.OnboardingScreen;
|
||||
import com.mapswithme.maps.onboarding.OnboardingTip;
|
||||
import com.mapswithme.maps.promo.Promo;
|
||||
import com.mapswithme.maps.promo.PromoAfterBooking;
|
||||
import com.mapswithme.maps.promo.PromoBookingDialogFragment;
|
||||
import com.mapswithme.maps.purchase.AdsRemovalActivationCallback;
|
||||
import com.mapswithme.maps.purchase.AdsRemovalPurchaseControllerProvider;
|
||||
import com.mapswithme.maps.purchase.BookmarkSubscriptionActivity;
|
||||
import com.mapswithme.maps.purchase.FailedPurchaseChecker;
|
||||
import com.mapswithme.maps.purchase.PurchaseCallback;
|
||||
import com.mapswithme.maps.purchase.PurchaseController;
|
||||
|
@ -140,6 +141,7 @@ import com.mapswithme.util.statistics.Statistics;
|
|||
import uk.co.samuelwall.materialtaptargetprompt.MaterialTapTargetPrompt;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.Stack;
|
||||
|
||||
public class MwmActivity extends BaseMwmFragmentActivity
|
||||
|
@ -721,37 +723,36 @@ public class MwmActivity extends BaseMwmFragmentActivity
|
|||
mNavMyPosition = new MyPositionButton(myPosition, mOnMyPositionClickListener);
|
||||
|
||||
initToggleMapLayerController(frame);
|
||||
View openSubsScreenBtn = frame.findViewById(R.id.subs_screen_btn);
|
||||
boolean hasCrownView = Framework.nativeNeedToShowCrown();
|
||||
View openSubsScreenBtnContainer = frame.findViewById(R.id.subs_screen_btn_container);
|
||||
boolean hasCrownView = OnboardingTip.get() != null;
|
||||
|
||||
mNavAnimationController = new NavigationButtonsAnimationController(
|
||||
zoomIn, zoomOut, myPosition, getWindow().getDecorView().getRootView(), this,
|
||||
hasCrownView ? openSubsScreenBtn : null);
|
||||
hasCrownView ? openSubsScreenBtnContainer : null);
|
||||
|
||||
UiUtils.showIf(hasCrownView, openSubsScreenBtn);
|
||||
UiUtils.showIf(hasCrownView, openSubsScreenBtnContainer);
|
||||
if (hasCrownView)
|
||||
{
|
||||
openSubsScreenBtn.setOnClickListener(v -> onCrownClicked());
|
||||
openSubsScreenBtnContainer.findViewById(R.id.subs_screen_btn)
|
||||
.setOnClickListener(v -> onBoardingBtnClicked());
|
||||
Statistics.ParameterBuilder builder = Statistics.makeGuidesSubscriptionBuilder();
|
||||
Statistics.INSTANCE.trackEvent(Statistics.EventName.MAP_SPONSORED_BUTTON_SHOW, builder);
|
||||
}
|
||||
}
|
||||
|
||||
private void onCrownClicked()
|
||||
private void onBoardingBtnClicked()
|
||||
{
|
||||
openBookmarkSubscriptionScreen();
|
||||
OnboardingTip tip = Objects.requireNonNull(OnboardingTip.get());
|
||||
|
||||
OnboardingScreen screen = OnboardingScreen.values()[tip.getType()];
|
||||
screen.getOnboardingActivityLauncher().launchScreen(this, tip.getUrl());
|
||||
UserActionsLogger.logCrownClicked();
|
||||
Statistics.ParameterBuilder builder = Statistics.makeGuidesSubscriptionBuilder();
|
||||
Statistics.INSTANCE.trackEvent(Statistics.EventName.MAP_SPONSORED_BUTTON_CLICK, builder);
|
||||
if (mNavAnimationController == null)
|
||||
return;
|
||||
|
||||
mNavAnimationController.hideCrownView();
|
||||
}
|
||||
|
||||
private void openBookmarkSubscriptionScreen()
|
||||
{
|
||||
BookmarkSubscriptionActivity.startForResult(this);
|
||||
mNavAnimationController.hideOnBoardingTipBtn();
|
||||
}
|
||||
|
||||
private void initToggleMapLayerController(@NonNull View frame)
|
||||
|
|
|
@ -4,6 +4,8 @@ import android.content.res.Resources;
|
|||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import android.view.View;
|
||||
import android.view.animation.Animation;
|
||||
import android.view.animation.AnimationUtils;
|
||||
|
||||
import com.mapswithme.maps.location.LocationHelper;
|
||||
import com.mapswithme.maps.location.LocationState;
|
||||
|
@ -20,7 +22,7 @@ class NavigationButtonsAnimationController
|
|||
@NonNull
|
||||
private final View mMyPosition;
|
||||
@Nullable
|
||||
private View mCrownView;
|
||||
private View mObBoardingTipBtnContainer;
|
||||
|
||||
@Nullable
|
||||
private final OnTranslationChangedListener mTranslationListener;
|
||||
|
@ -37,11 +39,11 @@ class NavigationButtonsAnimationController
|
|||
NavigationButtonsAnimationController(@NonNull View zoomIn, @NonNull View zoomOut,
|
||||
@NonNull View myPosition, @NonNull final View contentView,
|
||||
@Nullable OnTranslationChangedListener translationListener,
|
||||
@Nullable View crownView)
|
||||
@Nullable View onBoardingTipBtnContainer)
|
||||
{
|
||||
mZoomIn = zoomIn;
|
||||
mZoomOut = zoomOut;
|
||||
mCrownView = crownView;
|
||||
mZoomIn = zoomIn;
|
||||
mObBoardingTipBtnContainer = onBoardingTipBtnContainer;
|
||||
checkZoomButtonsVisibility();
|
||||
mMyPosition = myPosition;
|
||||
Resources res = mZoomIn.getResources();
|
||||
|
@ -49,17 +51,14 @@ class NavigationButtonsAnimationController
|
|||
mBottomLimit = res.getDimension(R.dimen.menu_line_height);
|
||||
mCompassHeight = res.getDimension(R.dimen.compass_height);
|
||||
calculateLimitTranslations();
|
||||
contentView.addOnLayoutChangeListener(new View.OnLayoutChangeListener()
|
||||
{
|
||||
@Override
|
||||
public void onLayoutChange(View v, int left, int top, int right, int bottom, int oldLeft,
|
||||
int oldTop, int oldRight, int oldBottom)
|
||||
{
|
||||
mContentHeight = bottom - top;
|
||||
contentView.removeOnLayoutChangeListener(this);
|
||||
}
|
||||
});
|
||||
contentView.addOnLayoutChangeListener(new ContentViewLayoutChangeListener(contentView));
|
||||
mTranslationListener = translationListener;
|
||||
if (onBoardingTipBtnContainer != null)
|
||||
{
|
||||
Animation animation = AnimationUtils.loadAnimation(onBoardingTipBtnContainer.getContext(),
|
||||
R.anim.dog_btn_rotation);
|
||||
onBoardingTipBtnContainer.findViewById(R.id.subs_screen_btn).setAnimation(animation);
|
||||
}
|
||||
}
|
||||
|
||||
private void checkZoomButtonsVisibility()
|
||||
|
@ -114,15 +113,15 @@ class NavigationButtonsAnimationController
|
|||
mMyPosition.setTranslationY(translation);
|
||||
mZoomOut.setTranslationY(translation);
|
||||
mZoomIn.setTranslationY(translation);
|
||||
if (mCrownView != null)
|
||||
mCrownView.setTranslationY(translation);
|
||||
if (mObBoardingTipBtnContainer != null)
|
||||
mObBoardingTipBtnContainer.setTranslationY(translation);
|
||||
|
||||
if (mZoomIn.getVisibility() == View.VISIBLE
|
||||
&& !isViewInsideLimits(mZoomIn))
|
||||
{
|
||||
UiUtils.invisible(mZoomIn, mZoomOut);
|
||||
if (mCrownView != null)
|
||||
UiUtils.invisible(mCrownView);
|
||||
if (mObBoardingTipBtnContainer != null)
|
||||
UiUtils.invisible(mObBoardingTipBtnContainer);
|
||||
|
||||
if (mTranslationListener != null)
|
||||
mTranslationListener.onFadeOutZoomButtons();
|
||||
|
@ -131,8 +130,8 @@ class NavigationButtonsAnimationController
|
|||
&& isViewInsideLimits(mZoomIn))
|
||||
{
|
||||
UiUtils.show(mZoomIn, mZoomOut);
|
||||
if (mCrownView != null)
|
||||
UiUtils.show(mCrownView);
|
||||
if (mObBoardingTipBtnContainer != null)
|
||||
UiUtils.show(mObBoardingTipBtnContainer);
|
||||
if (mTranslationListener != null)
|
||||
mTranslationListener.onFadeInZoomButtons();
|
||||
}
|
||||
|
@ -169,19 +168,19 @@ class NavigationButtonsAnimationController
|
|||
return;
|
||||
|
||||
UiUtils.hide(mZoomIn, mZoomOut);
|
||||
if (mCrownView == null)
|
||||
if (mObBoardingTipBtnContainer == null)
|
||||
return;
|
||||
|
||||
UiUtils.hide(mCrownView);
|
||||
UiUtils.hide(mObBoardingTipBtnContainer);
|
||||
}
|
||||
|
||||
void hideCrownView()
|
||||
void hideOnBoardingTipBtn()
|
||||
{
|
||||
if (mCrownView == null)
|
||||
if (mObBoardingTipBtnContainer == null)
|
||||
return;
|
||||
|
||||
mCrownView.setVisibility(View.GONE);
|
||||
mCrownView = null;
|
||||
mObBoardingTipBtnContainer.setVisibility(View.GONE);
|
||||
mObBoardingTipBtnContainer = null;
|
||||
}
|
||||
|
||||
void appearZoomButtons()
|
||||
|
@ -191,10 +190,10 @@ class NavigationButtonsAnimationController
|
|||
|
||||
UiUtils.show(mZoomIn, mZoomOut);
|
||||
|
||||
if (mCrownView == null)
|
||||
if (mObBoardingTipBtnContainer == null)
|
||||
return;
|
||||
|
||||
UiUtils.show(mCrownView);
|
||||
UiUtils.show(mObBoardingTipBtnContainer);
|
||||
}
|
||||
|
||||
private static boolean showZoomButtons()
|
||||
|
@ -221,4 +220,23 @@ class NavigationButtonsAnimationController
|
|||
|
||||
void onFadeOutZoomButtons();
|
||||
}
|
||||
|
||||
private class ContentViewLayoutChangeListener implements View.OnLayoutChangeListener
|
||||
{
|
||||
@NonNull
|
||||
private final View mContentView;
|
||||
|
||||
public ContentViewLayoutChangeListener(@NonNull View contentView)
|
||||
{
|
||||
mContentView = contentView;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLayoutChange(View v, int left, int top, int right, int bottom, int oldLeft,
|
||||
int oldTop, int oldRight, int oldBottom)
|
||||
{
|
||||
mContentHeight = bottom - top;
|
||||
mContentView.removeOnLayoutChangeListener(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,16 @@
|
|||
package com.mapswithme.maps.onboarding;
|
||||
|
||||
import android.content.Intent;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.fragment.app.FragmentActivity;
|
||||
import com.mapswithme.maps.purchase.BookmarksAllSubscriptionActivity;
|
||||
|
||||
public class BuySubscriptionScreenLauncher implements OnboardingScreenLauncher
|
||||
{
|
||||
@Override
|
||||
public void launchScreen(@NonNull FragmentActivity activity, @NonNull String url)
|
||||
{
|
||||
activity.startActivity(new Intent(activity, BookmarksAllSubscriptionActivity.class));
|
||||
}
|
||||
}
|
|
@ -0,0 +1,24 @@
|
|||
package com.mapswithme.maps.onboarding;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
public enum OnboardingScreen
|
||||
{
|
||||
DISCOVER_CATALOG(new OpenCatalogLauncher()),
|
||||
DOWNLOAD_SAMPLES(new OpenCatalogLauncher()),
|
||||
BUY_SUBSCRIPTION(new BuySubscriptionScreenLauncher());
|
||||
|
||||
@NonNull
|
||||
private final OnboardingScreenLauncher mLauncher;
|
||||
|
||||
OnboardingScreen(@NonNull OnboardingScreenLauncher launcher)
|
||||
{
|
||||
mLauncher = launcher;
|
||||
}
|
||||
|
||||
@NonNull
|
||||
public OnboardingScreenLauncher getOnboardingActivityLauncher()
|
||||
{
|
||||
return mLauncher;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,9 @@
|
|||
package com.mapswithme.maps.onboarding;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.fragment.app.FragmentActivity;
|
||||
|
||||
public interface OnboardingScreenLauncher
|
||||
{
|
||||
void launchScreen(@NonNull FragmentActivity activity, @NonNull String url);
|
||||
}
|
|
@ -0,0 +1,14 @@
|
|||
package com.mapswithme.maps.onboarding;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.fragment.app.FragmentActivity;
|
||||
import com.mapswithme.maps.bookmarks.BookmarksCatalogActivity;
|
||||
|
||||
public class OpenCatalogLauncher implements OnboardingScreenLauncher
|
||||
{
|
||||
@Override
|
||||
public void launchScreen(@NonNull FragmentActivity activity, @NonNull String url)
|
||||
{
|
||||
BookmarksCatalogActivity.start(activity, url);
|
||||
}
|
||||
}
|