forked from organicmaps/organicmaps
[android] Fixed native ad button animation colors
This commit is contained in:
parent
32853aa52b
commit
07024c6bf1
3 changed files with 35 additions and 9 deletions
|
@ -161,9 +161,12 @@
|
|||
<color name="bg_banner_color_night">#FF555A5A</color>
|
||||
<color name="text_banner_color">#28000000</color>
|
||||
<color name="text_banner_color_night">#28FFFFFF</color>
|
||||
<color name="bg_banner_button_color">#FFF3EBDA</color>
|
||||
<color name="bg_banner_button_color_night">#4CFFFAE1</color>
|
||||
<color name="bg_banner_button">#FFF3EBDA</color>
|
||||
<color name="bg_banner_button_night">#4CFFFAE1</color>
|
||||
<color name="text_ads_color">#FFFFFBF2</color>
|
||||
<color name="text_ads_color_night">#FFFFFBF2</color>
|
||||
<color name="banner_action_btn_start_anim_night">#FF888A82</color>
|
||||
<color name="banner_action_btn_end_anim">#FFD9D2C3</color>
|
||||
<color name="banner_action_btn_end_anim_night">#FF71736C</color>
|
||||
|
||||
</resources>
|
||||
|
|
|
@ -86,7 +86,7 @@
|
|||
|
||||
<item name="bannerText">@color/text_banner_color</item>
|
||||
<item name="bannerBackground">@color/bg_banner_color</item>
|
||||
<item name="bannerButtonBackground">@color/bg_banner_button_color</item>
|
||||
<item name="bannerButtonBackground">@color/bg_banner_button</item>
|
||||
<item name="adsBackground">@drawable/bg_ads</item>
|
||||
<item name="adsText">@color/text_ads_color</item>
|
||||
<item name="adsActionBackground">@drawable/bg_ads_action</item>
|
||||
|
@ -187,7 +187,7 @@
|
|||
|
||||
<item name="bannerText">@color/text_banner_color_night</item>
|
||||
<item name="bannerBackground">@color/bg_banner_color_night</item>
|
||||
<item name="bannerButtonBackground">@color/bg_banner_button_color_night</item>
|
||||
<item name="bannerButtonBackground">@color/bg_banner_button_night</item>
|
||||
<item name="adsBackground">@drawable/bg_ads_night</item>
|
||||
<item name="adsText">@color/text_ads_color_night</item>
|
||||
<item name="adsActionBackground">@drawable/bg_ads_action_night</item>
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
package com.mapswithme.maps.widget.placepage;
|
||||
|
||||
import android.animation.ArgbEvaluator;
|
||||
import android.animation.ObjectAnimator;
|
||||
import android.content.Context;
|
||||
import android.content.res.Resources;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.annotation.Nullable;
|
||||
|
@ -18,6 +20,7 @@ import com.mapswithme.maps.ads.MwmNativeAd;
|
|||
import com.mapswithme.maps.ads.NativeAdError;
|
||||
import com.mapswithme.maps.ads.NativeAdListener;
|
||||
import com.mapswithme.util.Config;
|
||||
import com.mapswithme.util.ThemeUtils;
|
||||
import com.mapswithme.util.UiUtils;
|
||||
import com.mapswithme.util.log.Logger;
|
||||
import com.mapswithme.util.log.LoggerFactory;
|
||||
|
@ -99,11 +102,7 @@ final class BannerController
|
|||
@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();
|
||||
animateActionButton();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -263,6 +262,30 @@ final class BannerController
|
|||
return isTouched(mFrame, event);
|
||||
}
|
||||
|
||||
private void animateActionButton()
|
||||
{
|
||||
View view = mOpened ? mFrame.findViewById(R.id.tv__action_large)
|
||||
: mFrame.findViewById(R.id.tv__action_small);
|
||||
ObjectAnimator animator;
|
||||
if (mOpened)
|
||||
{
|
||||
Context context = mFrame.getContext();
|
||||
Resources res = context.getResources();
|
||||
int colorFrom = ThemeUtils.isNightTheme() ? res.getColor(R.color.banner_action_btn_start_anim_night)
|
||||
: res.getColor(R.color.bg_banner_button);
|
||||
int colorTo = ThemeUtils.isNightTheme() ? res.getColor(R.color.banner_action_btn_end_anim_night)
|
||||
: res.getColor(R.color.banner_action_btn_end_anim);
|
||||
animator = ObjectAnimator.ofObject(view, "backgroundColor", new ArgbEvaluator(),
|
||||
colorFrom, colorTo, colorFrom);
|
||||
}
|
||||
else
|
||||
{
|
||||
animator = ObjectAnimator.ofFloat(view, "alpha", 0.3f, 1f);
|
||||
}
|
||||
animator.setDuration(300);
|
||||
animator.start();
|
||||
}
|
||||
|
||||
interface BannerListener
|
||||
{
|
||||
void onSizeChanged();
|
||||
|
|
Loading…
Add table
Reference in a new issue