forked from organicmaps/organicmaps
[andorid] Added animation to CTA button in banner
[android] Changed handling clicks in banner logic
This commit is contained in:
parent
b9fee34985
commit
a8535737ec
5 changed files with 20 additions and 7 deletions
|
@ -10,6 +10,7 @@
|
|||
android:paddingTop="@dimen/margin_half"
|
||||
android:background="?bannerBackground"
|
||||
android:clipToPadding="false"
|
||||
android:clickable="true"
|
||||
tools:layout_height="wrap_content">
|
||||
|
||||
<TextView
|
||||
|
|
|
@ -65,7 +65,6 @@ class FacebookNativeAd extends CachedMwmNativeAd
|
|||
public void registerView(@NonNull View bannerView)
|
||||
{
|
||||
List<View> clickableViews = new ArrayList<>();
|
||||
clickableViews.add(bannerView.findViewById(R.id.tv__banner_title));
|
||||
clickableViews.add(bannerView.findViewById(R.id.tv__action_small));
|
||||
clickableViews.add(bannerView.findViewById(R.id.tv__action_large));
|
||||
mAd.registerViewForInteraction(bannerView, clickableViews);
|
||||
|
|
|
@ -4,6 +4,7 @@ import android.support.annotation.NonNull;
|
|||
import android.view.View;
|
||||
import android.widget.ImageView;
|
||||
|
||||
import com.mapswithme.maps.R;
|
||||
import com.my.target.ads.CustomParams;
|
||||
import com.my.target.nativeads.NativeAd;
|
||||
import com.my.target.nativeads.banners.NativePromoBanner;
|
||||
|
@ -67,7 +68,8 @@ class MyTargetNativeAd extends CachedMwmNativeAd
|
|||
@Override
|
||||
public void registerView(@NonNull View bannerView)
|
||||
{
|
||||
mAd.registerView(bannerView);
|
||||
mAd.registerView(bannerView.findViewById(R.id.tv__action_small));
|
||||
mAd.registerView(bannerView.findViewById(R.id.tv__action_large));
|
||||
}
|
||||
|
||||
@NonNull
|
||||
|
|
|
@ -155,8 +155,8 @@ public class MapObject implements Parcelable
|
|||
{
|
||||
List<Banner> banners = new ArrayList<>();
|
||||
banners.add(getBanner());
|
||||
/* Banner banner = new Banner("1", 2);
|
||||
banners.add(banner);*/
|
||||
// Banner banner = new Banner("1", 2);
|
||||
// banners.add(banner);
|
||||
return banners;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
package com.mapswithme.maps.widget.placepage;
|
||||
|
||||
import android.animation.ObjectAnimator;
|
||||
import android.content.res.Resources;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.text.TextUtils;
|
||||
import android.view.MotionEvent;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
@ -94,6 +94,18 @@ final class BannerController
|
|||
loader.setAdListener(new MyNativeAdsListener());
|
||||
mAdsLoader = loader;
|
||||
mAdTracker = tracker;
|
||||
mFrame.setOnClickListener(new View.OnClickListener()
|
||||
{
|
||||
@Override
|
||||
public void onClick(View v)
|
||||
{
|
||||
View view = mOpened ? mFrame.findViewById(R.id.tv__action_large)
|
||||
: mFrame.findViewById(R.id.tv__action_small);
|
||||
ObjectAnimator anim = ObjectAnimator.ofFloat(view, "alpha", 0.3f, 1f);
|
||||
anim.setDuration(700);
|
||||
anim.start();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void setErrorStatus(boolean value)
|
||||
|
@ -248,8 +260,7 @@ final class BannerController
|
|||
|
||||
boolean isActionButtonTouched(@NonNull MotionEvent event)
|
||||
{
|
||||
return isTouched(mActionSmall, event) || isTouched(mActionLarge, event)
|
||||
|| isTouched(mTitle, event);
|
||||
return isTouched(mFrame, event);
|
||||
}
|
||||
|
||||
interface BannerListener
|
||||
|
|
Loading…
Add table
Reference in a new issue