Commit c2e06615 authored by mengcuiguang's avatar mengcuiguang

广告上传ecpm

parent e3d52ad2
......@@ -11,8 +11,8 @@
<!-- 业务使用权限 -->
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.REQUEST_INSTALL_PACKAGES" />
<uses-permission android:name="android.permission.WRITE_CALENDAR"/>
<uses-permission android:name="android.permission.READ_CALENDAR"/>
<uses-permission android:name="android.permission.WRITE_CALENDAR" />
<uses-permission android:name="android.permission.READ_CALENDAR" />
<!-- 穿山甲 -->
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
......@@ -136,11 +136,11 @@
android:exported="false"
android:theme="@style/TransparentTheme" />
<activity
android:name=".ui.activitys.TaskAwardActivity"
android:name=".ui.activitys.LoadingActivity"
android:exported="false"
android:theme="@style/TransparentTheme" />
<activity
android:name=".ui.activitys.RecommendActivity"
android:name=".ui.activitys.TaskAwardActivity"
android:exported="false"
android:theme="@style/TransparentTheme" />
......
{"v":"5.9.6","fr":29.9700012207031,"ip":0,"op":750.000030548126,"w":720,"h":1000,"nm":"封面滚动动效","ddd":0,"assets":[{"id":"image_0","w":1078,"h":1856,"u":"images/","p":"choose_pay_img_0.png","e":0},{"id":"comp_0","nm":"封面图","fr":29.9700012207031,"layers":[{"ddd":0,"ind":1,"ty":2,"nm":"封面2.png","cl":"png","refId":"image_0","sr":1,"ks":{"o":{"a":0,"k":100,"ix":11},"r":{"a":0,"k":0,"ix":10},"p":{"a":1,"k":[{"i":{"x":0.833,"y":0.833},"o":{"x":0.167,"y":0.167},"t":0,"s":[539,928,0],"to":[0,-309.5,0],"ti":[0,309.5,0]},{"t":749.000030507395,"s":[539,-929,0]}],"ix":2,"l":2},"a":{"a":0,"k":[539,928,0],"ix":1,"l":2},"s":{"a":0,"k":[100,100,100],"ix":6,"l":2}},"ao":0,"ip":0,"op":750.000030548126,"st":0,"bm":0},{"ddd":0,"ind":2,"ty":2,"nm":"封面2.png","cl":"png","refId":"image_0","sr":1,"ks":{"o":{"a":0,"k":100,"ix":11},"r":{"a":0,"k":0,"ix":10},"p":{"a":1,"k":[{"i":{"x":0.833,"y":0.833},"o":{"x":0.167,"y":0.167},"t":0,"s":[539,2784,0],"to":[0,-309.333,0],"ti":[0,309.333,0]},{"t":749.000030507395,"s":[539,928,0]}],"ix":2,"l":2},"a":{"a":0,"k":[539,928,0],"ix":1,"l":2},"s":{"a":0,"k":[100,100,100],"ix":6,"l":2}},"ao":0,"ip":0,"op":750.000030548126,"st":0,"bm":0}]}],"layers":[{"ddd":0,"ind":1,"ty":0,"nm":"封面图","refId":"comp_0","sr":1,"ks":{"o":{"a":0,"k":100,"ix":11},"r":{"a":0,"k":20,"ix":10},"p":{"a":0,"k":[374,400,0],"ix":2,"l":2},"a":{"a":0,"k":[539,928,0],"ix":1,"l":2},"s":{"a":0,"k":[100,100,100],"ix":6,"l":2}},"ao":0,"w":1078,"h":1856,"ip":0,"op":750.000030548126,"st":0,"bm":0}],"markers":[]}
\ No newline at end of file
{"v":"5.9.6","fr":25,"ip":0,"op":25,"w":1080,"h":360,"nm":"引导-播放按钮","ddd":0,"assets":[{"id":"image_0","w":840,"h":228,"u":"images/","p":"recommend_img_0.png","e":0},{"id":"image_1","w":900,"h":288,"u":"images/","p":"recommend_img_1.png","e":0}],"layers":[{"ddd":0,"ind":2,"ty":2,"nm":"Rectangle 6336.png","cl":"png","refId":"image_0","sr":1,"ks":{"o":{"a":1,"k":[{"i":{"x":[0.833],"y":[0.833]},"o":{"x":[0.167],"y":[0.167]},"t":10,"s":[100]},{"t":25,"s":[15]}],"ix":11},"r":{"a":0,"k":0,"ix":10},"p":{"a":0,"k":[540,180,0],"ix":2,"l":2},"a":{"a":0,"k":[420,114,0],"ix":1,"l":2},"s":{"a":1,"k":[{"i":{"x":[0.833,0.833,0.833],"y":[0.833,0.833,0.833]},"o":{"x":[0.167,0.167,0.167],"y":[0.167,0.167,0.167]},"t":0,"s":[75,51,100]},{"i":{"x":[0.833,0.833,0.833],"y":[0.833,0.833,0.833]},"o":{"x":[0.167,0.167,0.167],"y":[0.167,0.167,0.167]},"t":10,"s":[100,100,100]},{"t":25,"s":[120,150,100]}],"ix":6,"l":2}},"ao":0,"ip":0,"op":25,"st":0,"bm":0},{"ddd":0,"ind":3,"ty":2,"nm":"Rectangle 6337.png","cl":"png","refId":"image_1","sr":1,"ks":{"o":{"a":1,"k":[{"i":{"x":[0.833],"y":[0.833]},"o":{"x":[0.167],"y":[0.167]},"t":10,"s":[100]},{"t":23,"s":[0]}],"ix":11},"r":{"a":1,"k":[{"i":{"x":[0.833],"y":[0.833]},"o":{"x":[0.167],"y":[0.167]},"t":0,"s":[0]},{"i":{"x":[0.833],"y":[0.833]},"o":{"x":[0.167],"y":[0.167]},"t":10,"s":[0]},{"t":23,"s":[0]}],"ix":10},"p":{"a":1,"k":[{"i":{"x":0.833,"y":0.833},"o":{"x":0.167,"y":0.167},"t":0,"s":[540,180,0],"to":[0,0,0],"ti":[0,0,0]},{"i":{"x":0.833,"y":0.833},"o":{"x":0.167,"y":0.167},"t":10,"s":[540,180,0],"to":[0,0,0],"ti":[0,0,0]},{"t":23,"s":[540,180,0]}],"ix":2,"l":2},"a":{"a":0,"k":[450,144,0],"ix":1,"l":2},"s":{"a":1,"k":[{"i":{"x":[0.833,0.833,0.833],"y":[0.833,0.833,0.833]},"o":{"x":[0.167,0.167,0.167],"y":[0.167,0.167,0.167]},"t":0,"s":[80,54,100]},{"i":{"x":[0.833,0.833,0.833],"y":[0.833,0.833,0.833]},"o":{"x":[0.167,0.167,0.167],"y":[0.167,0.167,0.167]},"t":10,"s":[100,100,100]},{"t":23,"s":[120,123,100]}],"ix":6,"l":2}},"ao":0,"ip":0,"op":25,"st":0,"bm":0}],"markers":[]}
\ No newline at end of file
......@@ -120,7 +120,7 @@ class AdManager {
*/
fun splashPreLoadAll(activity: Activity) {
this.loadRewardVideo(activity)
// this.loadFullVideo(activity)
this.loadFullVideo(activity)
}
}
\ No newline at end of file
......@@ -9,6 +9,9 @@ import com.bytedance.sdk.openadsdk.mediation.ad.MediationAdSlot
import com.bytedance.sdk.openadsdk.mediation.ad.MediationNativeToBannerListener
import com.mints.helivideo.BuildConfig
import com.mints.helivideo.MintsApplication
import com.mints.helivideo.ad.splash.SplashManager
import com.mints.helivideo.common.Constant
import com.mints.helivideo.manager.TrackManager
import com.mints.helivideo.manager.UserManager
import com.mints.helivideo.utils.LogUtil
import com.mints.helivideo.utils.UIUtils
......@@ -70,6 +73,15 @@ object BannerManager {
}
override fun onAdShow(view: View?, type: Int) {
if (bannerAd != null && bannerAd!!.getMediationManager().getShowEcpm() != null) {
val vo = HashMap<String, Any>()
vo["adcode"] = bannerAd!!.getMediationManager().getShowEcpm().getSlotId()
vo["ecpm"] = bannerAd!!.getMediationManager().getShowEcpm().getEcpm()
vo["adSource"] = bannerAd!!.getMediationManager().getShowEcpm().getSdkName()
vo["adid"] = BuildConfig.GROMORE_BANNER_CODE
vo["adType"] = Constant.GRO_MORE_ADTYPE5
TrackManager.getInstance().reporGromeEcpm(vo)
}
}
override fun onRenderFail(view: View?, msg: String?, code: Int) {
......
......@@ -17,6 +17,8 @@ import com.mints.helivideo.MintsApplication
import com.mints.helivideo.R
import com.mints.helivideo.ad.AdManager
import com.mints.helivideo.ad.express.ExpressAdCallback
import com.mints.helivideo.common.Constant
import com.mints.helivideo.manager.TrackManager
import com.mints.helivideo.utils.ForegroundOrBackground
import com.mints.helivideo.utils.LogUtil
import com.mints.helivideo.utils.TimeRender
......@@ -240,6 +242,15 @@ class DrawExpressManager {
}
override fun onAdShow() {
if (it != null && it!!.getMediationManager().getShowEcpm() != null) {
val vo = HashMap<String, Any>()
vo["adcode"] = it!!.getMediationManager().getShowEcpm().getSlotId()
vo["ecpm"] = it!!.getMediationManager().getShowEcpm().getEcpm()
vo["adSource"] = it!!.getMediationManager().getShowEcpm().getSdkName()
vo["adid"] = BuildConfig.GROMORE_DRAW_CODE
vo["adType"] = Constant.GRO_MORE_ADTYPE6
TrackManager.getInstance().reporGromeEcpm(vo)
}
Log.i(TAG, "onAdShow")
Log.i(TAG, "ad mediaExtraInfo ${it.mediaExtraInfo}")
}
......
......@@ -17,6 +17,8 @@ import com.mints.helivideo.MintsApplication
import com.mints.helivideo.R
import com.mints.helivideo.ad.AdManager
import com.mints.helivideo.ad.express.ExpressAdCallback
import com.mints.helivideo.common.Constant
import com.mints.helivideo.manager.TrackManager
import com.mints.helivideo.utils.ForegroundOrBackground
import com.mints.helivideo.utils.LogUtil
import com.mints.helivideo.utils.TimeRender
......@@ -234,6 +236,15 @@ class HomeDrawExpressManager {
}
override fun onAdShow() {
if (it != null && it!!.getMediationManager().getShowEcpm() != null) {
val vo = HashMap<String, Any>()
vo["adcode"] = it!!.getMediationManager().getShowEcpm().getSlotId()
vo["ecpm"] = it!!.getMediationManager().getShowEcpm().getEcpm()
vo["adSource"] = it!!.getMediationManager().getShowEcpm().getSdkName()
vo["adid"] = BuildConfig.GROMORE_DRAW_CODE
vo["adType"] = Constant.GRO_MORE_ADTYPE6
TrackManager.getInstance().reporGromeEcpm(vo)
}
Log.i(TAG, "onAdShow")
Log.i(TAG, "ad mediaExtraInfo ${it.mediaExtraInfo}")
}
......
......@@ -15,6 +15,9 @@ import com.mints.helivideo.BuildConfig
import com.mints.helivideo.MintsApplication
import com.mints.helivideo.R
import com.mints.helivideo.ad.AdManager
import com.mints.helivideo.ad.banner.BannerManager
import com.mints.helivideo.common.Constant
import com.mints.helivideo.manager.TrackManager
import com.mints.helivideo.utils.ForegroundOrBackground
import com.mints.helivideo.utils.LogUtil
import com.mints.helivideo.utils.TimeRender
......@@ -215,6 +218,15 @@ class ExpressManager {
}
override fun onAdShow() {
if (it != null && it!!.getMediationManager().getShowEcpm() != null) {
val vo = HashMap<String, Any>()
vo["adcode"] = it!!.getMediationManager().getShowEcpm().getSlotId()
vo["ecpm"] = it!!.getMediationManager().getShowEcpm().getEcpm()
vo["adSource"] = it!!.getMediationManager().getShowEcpm().getSdkName()
vo["adid"] = BuildConfig.GROMORE_EXPRESS_CODE
vo["adType"] = Constant.GRO_MORE_ADTYPE1
TrackManager.getInstance().reporGromeEcpm(vo)
}
Log.i(TAG, "onAdShow")
Log.i(TAG, "ad mediaExtraInfo ${it.mediaExtraInfo}")
}
......
......@@ -14,6 +14,8 @@ import com.bytedance.sdk.openadsdk.mediation.ad.MediationViewBinder
import com.mints.helivideo.BuildConfig
import com.mints.helivideo.MintsApplication
import com.mints.helivideo.R
import com.mints.helivideo.common.Constant
import com.mints.helivideo.manager.TrackManager
import com.mints.helivideo.utils.ForegroundOrBackground
import com.mints.helivideo.utils.LogUtil
import com.mints.helivideo.utils.UIUtils
......@@ -151,6 +153,15 @@ class MainExpressManager {
}
override fun onAdShow() {
if (it != null && it!!.getMediationManager().getShowEcpm() != null) {
val vo = HashMap<String, Any>()
vo["adcode"] = it!!.getMediationManager().getShowEcpm().getSlotId()
vo["ecpm"] = it!!.getMediationManager().getShowEcpm().getEcpm()
vo["adSource"] = it!!.getMediationManager().getShowEcpm().getSdkName()
vo["adid"] = BuildConfig.GROMORE_EXPRESS_CODE
vo["adType"] = Constant.GRO_MORE_ADTYPE1
TrackManager.getInstance().reporGromeEcpm(vo)
}
Log.i(TAG, "onAdShow")
Log.i(TAG, "ad mediaExtraInfo ${it.mediaExtraInfo}")
}
......
......@@ -15,6 +15,8 @@ import com.mints.helivideo.MintsApplication
import com.mints.helivideo.BuildConfig
import com.mints.helivideo.R
import com.mints.helivideo.ad.AdManager
import com.mints.helivideo.common.Constant
import com.mints.helivideo.manager.TrackManager
import com.mints.helivideo.utils.ForegroundOrBackground
import com.mints.helivideo.utils.LogUtil
import com.mints.helivideo.utils.TimeRender
......@@ -215,6 +217,15 @@ class MyExpressManager {
}
override fun onAdShow() {
if (it != null && it!!.getMediationManager().getShowEcpm() != null) {
val vo = HashMap<String, Any>()
vo["adcode"] = it!!.getMediationManager().getShowEcpm().getSlotId()
vo["ecpm"] = it!!.getMediationManager().getShowEcpm().getEcpm()
vo["adSource"] = it!!.getMediationManager().getShowEcpm().getSdkName()
vo["adid"] = BuildConfig.GROMORE_EXPRESS_CODE
vo["adType"] = Constant.GRO_MORE_ADTYPE1
TrackManager.getInstance().reporGromeEcpm(vo)
}
Log.i(TAG, "onAdShow")
Log.i(TAG, "ad mediaExtraInfo ${it.mediaExtraInfo}")
}
......
......@@ -12,6 +12,7 @@ import com.mints.helivideo.BuildConfig;
import com.mints.helivideo.ad.AdManager;
import com.mints.helivideo.ad.AdStatusListener;
import com.mints.helivideo.common.Constant;
import com.mints.helivideo.manager.TrackManager;
import com.mints.helivideo.utils.AppPreferencesManager;
import com.mints.helivideo.utils.LogUtil;
import com.mints.helivideo.utils.TimeRender;
......@@ -185,12 +186,15 @@ public class FullScreenManager {
private final TTFullScreenVideoAd.FullScreenVideoAdInteractionListener mTTFullScreenAdListener = new TTFullScreenVideoAd.FullScreenVideoAdInteractionListener() {
@Override
public void onAdShow() {
if (mTtFullScreenVideoAd != null) {
if (mTtFullScreenVideoAd.getMediationManager().getShowEcpm() != null) {
nowAdcode = mTtFullScreenVideoAd.getMediationManager().getShowEcpm().getSlotId();
nowEcpm = mTtFullScreenVideoAd.getMediationManager().getShowEcpm().getEcpm();
nowAdSource = mTtFullScreenVideoAd.getMediationManager().getShowEcpm().getSdkName();
}
if (mTtFullScreenVideoAd != null && mTtFullScreenVideoAd.getMediationManager().getShowEcpm() != null) {
HashMap<String, Object> vo = new HashMap<>();
vo.put("adcode", mTtFullScreenVideoAd.getMediationManager().getShowEcpm().getSlotId());
vo.put("ecpm", mTtFullScreenVideoAd.getMediationManager().getShowEcpm().getEcpm());
vo.put("adSource", mTtFullScreenVideoAd.getMediationManager().getShowEcpm().getSdkName());
vo.put("carrierType", carrierType);
vo.put("adid", BuildConfig.GROMORE_FULL_CODE);
vo.put("adType", Constant.GRO_MORE_ADTYPE4);
TrackManager.getInstance().reporGromeEcpm(vo);
}
LogUtil.d(TAG, "gromore预加载 插全屏广告-->onAdShow");
......
......@@ -12,6 +12,7 @@ import com.mints.helivideo.BuildConfig;
import com.mints.helivideo.ad.AdManager;
import com.mints.helivideo.ad.AdStatusListener;
import com.mints.helivideo.common.Constant;
import com.mints.helivideo.manager.TrackManager;
import com.mints.helivideo.utils.AppPreferencesManager;
import com.mints.helivideo.utils.LogUtil;
......@@ -123,12 +124,15 @@ public class NoPreFullScreenManager {
adStatusListener.adSuccess();
}
if (mTtFullScreenVideoAd != null) {
if (mTtFullScreenVideoAd.getMediationManager().getShowEcpm() != null) {
nowAdcode = mTtFullScreenVideoAd.getMediationManager().getShowEcpm().getSlotId();
nowEcpm = mTtFullScreenVideoAd.getMediationManager().getShowEcpm().getEcpm();
nowAdSource = mTtFullScreenVideoAd.getMediationManager().getShowEcpm().getSdkName();
}
if (mTtFullScreenVideoAd != null && mTtFullScreenVideoAd.getMediationManager().getShowEcpm() != null) {
HashMap<String, Object> vo = new HashMap<>();
vo.put("adcode", mTtFullScreenVideoAd.getMediationManager().getShowEcpm().getSlotId());
vo.put("ecpm", mTtFullScreenVideoAd.getMediationManager().getShowEcpm().getEcpm());
vo.put("adSource", mTtFullScreenVideoAd.getMediationManager().getShowEcpm().getSdkName());
vo.put("carrierType", carrierType);
vo.put("adid", BuildConfig.GROMORE_FULL_CODE);
vo.put("adType", Constant.GRO_MORE_ADTYPE4);
TrackManager.getInstance().reporGromeEcpm(vo);
}
LogUtil.d(TAG, "gromore实时加载 插全屏广告-->onAdShow");
......
package com.mints.helivideo.ad.half;
import android.app.Activity;
import com.bytedance.sdk.openadsdk.AdSlot;
import com.bytedance.sdk.openadsdk.TTAdConstant;
import com.bytedance.sdk.openadsdk.TTAdNative;
import com.bytedance.sdk.openadsdk.TTAdSdk;
import com.bytedance.sdk.openadsdk.TTFullScreenVideoAd;
import com.bytedance.sdk.openadsdk.mediation.ad.MediationAdSlot;
import com.mints.helivideo.BuildConfig;
import com.mints.helivideo.ad.AdManager;
import com.mints.helivideo.ad.AdStatusListener;
import com.mints.helivideo.common.Constant;
import com.mints.helivideo.manager.TrackManager;
import com.mints.helivideo.utils.AppPreferencesManager;
import com.mints.helivideo.utils.LogUtil;
import com.mints.helivideo.utils.TimeRender;
import java.lang.ref.WeakReference;
import java.util.HashMap;
/**
* 插全屏广告-半屏-半屏
*/
public class HalfScreenManager {
private static final String TAG = HalfScreenManager.class.getSimpleName();
private static HalfScreenManager _inst;
public static HalfScreenManager getInstance() {
if (_inst == null) {
_inst = new HalfScreenManager();
}
return _inst;
}
private HalfScreenManager() {
}
private int isLoadSuccess = 0; // 0-加载失败/未加载 1-加载中 2-加载成功
private long adLoadTime = 0; // 广告展示时间,45分钟后当前广告失效,重新预加载广告
private long adPreingTime = 0; // 防止预加载超时 2分钟
private TTFullScreenVideoAd mTtFullScreenVideoAd;
private WeakReference<Activity> weakActivity;
private boolean isPreLoad = false;//是否是预加载调用,需要躲避监听
private AdStatusListener adStatusListener;
/**
* 插全屏
*/
public void preLoadAd(Activity activity) {
boolean isOversped = TimeRender.INSTANCE.isOverspedMin(adLoadTime, AdManager.AD_NO_SHOWTIME_OUT);
boolean isPreingOversped = TimeRender.INSTANCE.isOverspedMin(adPreingTime, AdManager.AD_REQUEST_TIME_OUT);
this.weakActivity = new WeakReference(activity);
LogUtil.d(TAG, "gromore预加载 插全屏广告-半屏-> 1、进入预加载 isPreLoad[为true是预加载调用]=" + isPreLoad);
if ((isLoadSuccess == 0 // 加载失败
|| (adLoadTime > 0 && isOversped) // 超过45分钟
|| (adPreingTime > 0 && isPreingOversped
&& isLoadSuccess == 1)) // 预加载超时
&& this.weakActivity.get() != null) {
adPreingTime = System.currentTimeMillis();
isLoadSuccess = 1;
LogUtil.d(TAG, "gromore预加载 插全屏广告-半屏-> 2、执行预加载去了=" + isLoadSuccess);
LoadAd(activity);
}
}
public void showAd(Activity _activity, AdStatusListener adStatusListener) {
this.adStatusListener = adStatusListener;
this.weakActivity = new WeakReference(_activity);
if (isLoadSuccess == 0) {
LogUtil.e(TAG, "gromore预加载 插全屏广告-半屏--> showRewardAd isLoadSuccess=" + isLoadSuccess);
if (this.adStatusListener != null)
this.adStatusListener.adFail();
return;
}
// 请求未超过1分钟且上一个广告还在异步加载中,这次触发展示广告回调还没回来则返回
boolean isPreingOversped = TimeRender.INSTANCE.isOverspedMin(adPreingTime, AdManager.AD_REQUEST_TIME_OUT);
if (isLoadSuccess == 1 && isPreingOversped) {
LogUtil.e(TAG, "gromore预加载 插全屏广告-半屏-->请求未超过1分钟且上一个广告还在异步加载中 isLoadSuccess=" + isLoadSuccess + " isPreingOversped=" + isPreingOversped);
if (this.adStatusListener != null)
this.adStatusListener.adFail();
return;
}
// 预加载广告成功 且 预加载广告时长未超过45分钟
boolean isOversped = TimeRender.INSTANCE.isOverspedMin(adLoadTime, AdManager.AD_NO_SHOWTIME_OUT);
if (isLoadSuccess == 2 && !isOversped && mTtFullScreenVideoAd != null
&& mTtFullScreenVideoAd.getMediationManager().isReady()
&& this.weakActivity.get() != null) {
mTtFullScreenVideoAd.showFullScreenVideoAd(weakActivity.get());
mTtFullScreenVideoAd.setFullScreenVideoAdInteractionListener(mTTFullScreenAdListener);
} else {
if (this.adStatusListener != null)
this.adStatusListener.adFail();
LogUtil.e(TAG, "gromore预加载 插全屏广告-半屏--> 5、展示广告时失败了,广告可能超时45分钟 onError ");
}
// 广告加载完成状态重置
isLoadSuccess = 0;
}
private void LoadAd(Activity activity) {
TTAdNative adNativeLoader = TTAdSdk.getAdManager().createAdNative(activity);
AdSlot adSlot = new AdSlot.Builder()
.setCodeId(BuildConfig.GROMORE_FULL_CODE)
.setOrientation(TTAdConstant.ORIENTATION_VERTICAL)
.setMediationAdSlot(
new MediationAdSlot.Builder()
.setMuted(false)
.setVolume(0.7f)
.setBidNotify(true)
.build()
).build();
adNativeLoader.loadFullScreenVideoAd(adSlot, new TTAdNative.FullScreenVideoAdListener() {
@Override
public void onError(int i, String s) {
isLoadSuccess = 0;
LogUtil.e(TAG, "gromore预加载 插全屏广告-半屏-->onError " + i + s + "isPreLoad[为true是预加载调用]=" + isPreLoad);
if (adStatusListener != null) {
adStatusListener.adFail();
}
}
@Override
public void onFullScreenVideoAdLoad(TTFullScreenVideoAd ttFullScreenVideoAd) {
}
@Override
public void onFullScreenVideoCached() {
}
@Override
public void onFullScreenVideoCached(TTFullScreenVideoAd ttFullScreenVideoAd) {
LogUtil.d(TAG, "gromore预加载 插全屏广告-半屏--> 4、onRewardVideoCached ");
isLoadSuccess = 2;
adLoadTime = System.currentTimeMillis();
if (adStatusListener != null) {
adStatusListener.adSuccess();
}
mTtFullScreenVideoAd = ttFullScreenVideoAd;
}
});
}
private final TTFullScreenVideoAd.FullScreenVideoAdInteractionListener mTTFullScreenAdListener = new TTFullScreenVideoAd.FullScreenVideoAdInteractionListener() {
@Override
public void onAdShow() {
if (mTtFullScreenVideoAd != null && mTtFullScreenVideoAd.getMediationManager().getShowEcpm() != null) {
HashMap<String, Object> vo = new HashMap<>();
vo.put("adcode", mTtFullScreenVideoAd.getMediationManager().getShowEcpm().getSlotId());
vo.put("ecpm", mTtFullScreenVideoAd.getMediationManager().getShowEcpm().getEcpm());
vo.put("adSource", mTtFullScreenVideoAd.getMediationManager().getShowEcpm().getSdkName());
vo.put("adid", BuildConfig.GROMORE_FULL_CODE);
vo.put("adType", Constant.GRO_MORE_ADTYPE3);
TrackManager.getInstance().reporGromeEcpm(vo);
}
LogUtil.d(TAG, "gromore预加载 插全屏广告-半屏-->onAdShow");
}
@Override
public void onAdVideoBarClick() {
LogUtil.d(TAG, "gromore预加载 插全屏广告-半屏-->onAdVideoBarClick");
}
@Override
public void onAdClose() {
LogUtil.d(TAG, "gromore预加载 插全屏广告-半屏-->onAdClose");
//
HashMap<String, Object> vo = new HashMap<>();
// vo.put("adcode", nowAdcode);
// vo.put("ecpm", nowEcpm);
// vo.put("adSource", nowAdSource);
// vo.put("carrierType", carrierType);
// vo.put("adid", BuildConfig.GROMORE_VIDEO_CODE);
if (adStatusListener != null) {
adStatusListener.adClose(vo);
}
adStatusListener = null;
}
@Override
public void onVideoComplete() {
LogUtil.d(TAG, "gromore预加载 插全屏广告-半屏-->onVideoComplete");
}
@Override
public void onSkippedVideo() {
}
};
}
package com.mints.helivideo.ad.splash
import android.app.Activity
import android.util.Log
import android.view.View
import android.view.ViewGroup
import android.widget.FrameLayout
import com.bytedance.sdk.openadsdk.*
import com.bytedance.sdk.openadsdk.mediation.MediationConstant
......@@ -12,7 +10,8 @@ import com.bytedance.sdk.openadsdk.mediation.ad.MediationSplashRequestInfo
import com.mints.helivideo.BuildConfig
import com.mints.helivideo.MintsApplication
import com.mints.helivideo.ad.AdStatusListener
import com.mints.helivideo.utils.GromorePrintUtil
import com.mints.helivideo.common.Constant
import com.mints.helivideo.manager.TrackManager
import com.mints.helivideo.utils.LogUtil
import com.mints.helivideo.utils.UIUtils
import java.lang.ref.WeakReference
......@@ -160,6 +159,17 @@ object SplashManager {
}
override fun onAdShow(p0: View?, p1: Int) {
if (mTTSplashAd != null && mTTSplashAd!!.getMediationManager().getShowEcpm() != null) {
val vo = HashMap<String, Any>()
vo["adcode"] = mTTSplashAd!!.getMediationManager().getShowEcpm().getSlotId()
vo["ecpm"] = mTTSplashAd!!.getMediationManager().getShowEcpm().getEcpm()
vo["adSource"] = mTTSplashAd!!.getMediationManager().getShowEcpm().getSdkName()
vo["adid"] = BuildConfig.GROMORE_SPLASH_CODE
vo["adType"] = Constant.GRO_MORE_ADTYPE0
TrackManager.getInstance().reporGromeEcpm(vo)
}
isShowAd = true
LogUtil.d(TAG, "gromore 开屏广告--> 6、onAdShow ")
}
......
......@@ -16,6 +16,7 @@ import com.mints.helivideo.common.AppConfig;
import com.mints.helivideo.common.Constant;
import com.mints.helivideo.manager.TrackManager;
import com.mints.helivideo.utils.AppPreferencesManager;
import com.mints.helivideo.utils.GromorePrintUtil;
import com.mints.helivideo.utils.LogUtil;
import com.mints.helivideo.utils.TimeRender;
......@@ -45,11 +46,6 @@ public class InMoneyVideo {
private String carrierType = "";
// 当前播放的广告
private String nowAdcode = "";
private String nowEcpm = "";
private String nowAdSource = "";
private int isLoadSuccess = 0; // 0-加载失败/未加载 1-加载中 2-加载成功
private long adLoadTime = 0; // 广告展示时间,45分钟后当前广告失效,重新预加载广告
private long adPreingTime = 0; // 防止预加载超时 2分钟
......@@ -189,19 +185,16 @@ public class InMoneyVideo {
private final TTRewardVideoAd.RewardAdInteractionListener mTTRewardedAdListener = new TTRewardVideoAd.RewardAdInteractionListener() {
@Override
public void onAdShow() {
if (mttRewardAd != null) {
if (mttRewardAd.getMediationManager().getShowEcpm() != null) {
nowAdcode = mttRewardAd.getMediationManager().getShowEcpm().getSlotId();
nowEcpm = mttRewardAd.getMediationManager().getShowEcpm().getEcpm();
nowAdSource = mttRewardAd.getMediationManager().getShowEcpm().getSdkName();
if (mttRewardAd != null && mttRewardAd.getMediationManager().getShowEcpm() != null) {
HashMap<String, Object> vo = new HashMap<>();
vo.put("adcode", nowAdcode);
vo.put("ecpm", nowEcpm);
vo.put("adSource", nowAdSource);
vo.put("adcode", mttRewardAd.getMediationManager().getShowEcpm().getSlotId());
vo.put("ecpm", mttRewardAd.getMediationManager().getShowEcpm().getEcpm());
vo.put("adSource", mttRewardAd.getMediationManager().getShowEcpm().getSdkName());
vo.put("carrierType", carrierType);
vo.put("adid", BuildConfig.GROMORE_VIDEO_CODE);
vo.put("adType", Constant.GRO_MORE_ADTYPE2);
TrackManager.getInstance().reporGromeEcpm(vo);
}
}
LogUtil.d(TAG, "gromore预加载 激励视频广告-->onAdShow");
if (weakActivity.get() != null) {
......@@ -222,7 +215,6 @@ public class InMoneyVideo {
HashMap<String, Object> vo = new HashMap<>();
vo.put("carrierType", carrierType);
vo.put("ecpmId", AppConfig.gromoreId);
vo.put("adid", BuildConfig.GROMORE_VIDEO_CODE);
TrackManager.getInstance().reportAddCoinMsg(vo);
if (adStatusListener != null) {
adStatusListener.adClose(vo);
......
......@@ -16,6 +16,7 @@ import com.mints.helivideo.common.AppConfig;
import com.mints.helivideo.common.Constant;
import com.mints.helivideo.manager.TrackManager;
import com.mints.helivideo.utils.AppPreferencesManager;
import com.mints.helivideo.utils.GromorePrintUtil;
import com.mints.helivideo.utils.LogUtil;
import java.lang.ref.WeakReference;
......@@ -44,11 +45,6 @@ public class InMoneyVideoNoPre {
private String carrierType = "";
// 当前播放的广告
private String nowAdcode = "";
private String nowEcpm = "";
private String nowAdSource = "";
private TTRewardVideoAd mttRewardAd;
private WeakReference<Activity> weakActivity;
......@@ -128,19 +124,16 @@ public class InMoneyVideoNoPre {
adStatusListener.adSuccess();
}
if (mttRewardAd != null) {
if (mttRewardAd.getMediationManager().getShowEcpm() != null) {
nowAdcode = mttRewardAd.getMediationManager().getShowEcpm().getSlotId();
nowEcpm = mttRewardAd.getMediationManager().getShowEcpm().getEcpm();
nowAdSource = mttRewardAd.getMediationManager().getShowEcpm().getSdkName();
if (mttRewardAd != null && mttRewardAd.getMediationManager().getShowEcpm() != null) {
HashMap<String, Object> vo = new HashMap<>();
vo.put("adcode", nowAdcode);
vo.put("ecpm", nowEcpm);
vo.put("adSource", nowAdSource);
vo.put("adcode", mttRewardAd.getMediationManager().getShowEcpm().getSlotId());
vo.put("ecpm", mttRewardAd.getMediationManager().getShowEcpm().getEcpm());
vo.put("adSource", mttRewardAd.getMediationManager().getShowEcpm().getSdkName());
vo.put("carrierType", carrierType);
vo.put("adid", BuildConfig.GROMORE_VIDEO_CODE);
vo.put("adType", Constant.GRO_MORE_ADTYPE2);
TrackManager.getInstance().reporGromeEcpm(vo);
}
}
LogUtil.d(TAG, "gromore实时加载 激励视频广告-->onAdShow");
// 预加载
......@@ -156,12 +149,11 @@ public class InMoneyVideoNoPre {
@Override
public void onAdClose() {
LogUtil.d(TAG, "gromore实时加载 激励视频广告-->onAdClose nowAdcode=" + nowAdcode);
LogUtil.d(TAG, "gromore实时加载 激励视频广告-->onAdClose ");
HashMap<String, Object> vo = new HashMap<>();
vo.put("carrierType", carrierType);
vo.put("ecpmId", AppConfig.gromoreId);
vo.put("adid", BuildConfig.GROMORE_VIDEO_CODE);
TrackManager.getInstance().reportAddCoinMsg(vo);
if (adStatusListener != null) {
......
......@@ -43,6 +43,15 @@ object Constant {
const val FRAGMENT_CLICK_THREE = 2
const val FRAGMENT_CLICK_FOUR = 3
// 0-开屏,1-信息流,2-激励视频,3-插屏/新插屏 半屏,4-全屏,5-banner,6-DRAW信息流
const val GRO_MORE_ADTYPE0 = "0"
const val GRO_MORE_ADTYPE1 = "1"
const val GRO_MORE_ADTYPE2 = "2"
const val GRO_MORE_ADTYPE3 = "3"
const val GRO_MORE_ADTYPE4 = "4"
const val GRO_MORE_ADTYPE5 = "5"
const val GRO_MORE_ADTYPE6 = "6"
// 协议地址
var REGISTER_URL = "http://mints-web.mints-id.com/agreements/helivideo/yhxy.html"//注册协议
var PRIVACY_URL = "http://mints-web.mints-id.com/agreements/helivideo/syzc.html"//隐私协议
......
......@@ -25,7 +25,6 @@ class HomePresenter : BasePresenter<HomeView>() {
override fun onNext(baseResponse: BaseResponse<UserBean>) {
when (baseResponse.status) {
200 -> {
UserManager.getInstance().saveUserInfo(baseResponse.data)
view.getUserSuc(baseResponse.data)
}
}
......
package com.mints.helivideo.ui.activitys
import android.os.Bundle
import android.view.KeyEvent
import com.mints.helivideo.R
import com.mints.helivideo.ui.activitys.base.BaseActivity
import com.mints.helivideo.ui.widgets.countdowntimer.CountDownTimerSupport
import com.mints.helivideo.ui.widgets.countdowntimer.OnCountDownTimerListener
import kotlinx.android.synthetic.main.activity_loading.*
/**
* 加载页
*/
class LoadingActivity : BaseActivity() {
companion object {
const val TYPE = "TYPE"
}
var timer: CountDownTimerSupport? = null
var type = ""
override fun getContentViewLayoutID() = R.layout.activity_loading
override fun isApplyKitKatTranslucency() = false
override fun toggleOverridePendingTransition() = true
override fun getOverridePendingTransitionMode() = TransitionMode.FADE
override fun getBundleExtras(extras: Bundle?) {
super.getBundleExtras(extras)
extras?.let {
type = it.getString(TYPE, "")
}
}
override fun initViewsAndEvents() {
mProgressBar?.startOneAnim()
startTimer()
}
override fun finish() {
super.finish()
//关闭窗体动画显示
overridePendingTransition(0, R.anim.scale_out)
}
override fun onKeyDown(keyCode: Int, event: KeyEvent): Boolean {
return if (keyCode == KeyEvent.KEYCODE_BACK) {
true
} else super.onKeyDown(
keyCode,
event
)
}
override fun onDestroy() {
super.onDestroy()
if (timer != null) { //防止计时器重复
timer!!.stop()
timer = null
}
}
fun startTimer() {
timer = CountDownTimerSupport(2000, 1000)
timer!!.setOnCountDownTimerListener(object : OnCountDownTimerListener {
override fun onTick(millisUntilFinished: Long) {
}
override fun onFinish() {
finish()
}
})
timer!!.start()
}
}
package com.mints.helivideo.ui.activitys
import android.os.Bundle
import android.view.KeyEvent
import android.view.View
import com.airbnb.lottie.LottieComposition
import com.airbnb.lottie.LottieCompositionFactory
import com.airbnb.lottie.LottieDrawable
import com.bumptech.glide.Glide
import com.bumptech.glide.load.engine.DiskCacheStrategy
import com.google.gson.Gson
import com.mints.helivideo.R
import com.mints.helivideo.common.Constant
import com.mints.helivideo.mvp.model.RecommendBean
import com.mints.helivideo.ui.activitys.base.BaseActivity
import com.mints.helivideo.video.tx.newrecommend.NewTxVideoActivity
import com.mints.helivideo.video.tx.TXVodPlayerWrapper
import com.mints.helivideo.video.tx.VideoModel
import com.mints.library.utils.json.JsonUtil
import com.mints.library.utils.nodoubleclick.AntiShake
import kotlinx.android.synthetic.main.activity_recommend.*
/**
* 描述:推荐弹窗
* 作者:孟崔广
*/
class RecommendActivity : BaseActivity(), View.OnClickListener {
private var recommendBean: RecommendBean? = null
override fun getContentViewLayoutID() = R.layout.activity_recommend
override fun isApplyKitKatTranslucency() = false
override fun toggleOverridePendingTransition() = true
override fun getOverridePendingTransitionMode() = TransitionMode.SCALE
override fun getBundleExtras(extras: Bundle?) {
super.getBundleExtras(extras)
extras?.let {
val json = extras.getString(Constant.RECOMMEND_BEAN)
recommendBean = Gson().fromJson(json, RecommendBean::class.java)
}
}
override fun initViewsAndEvents() {
initView()
initListener()
}
private fun initView() {
val lottieDrawable = LottieDrawable()
LottieCompositionFactory.fromAsset(context, "recommend.json")
.addListener { result: LottieComposition? ->
lottieDrawable.setImagesAssetsFolder("images/")
lottieDrawable.composition = result
lottieDrawable.loop(true)
lottieDrawable.playAnimation()
}
iv_recommend_top.setImageDrawable(lottieDrawable)
Glide.with(context).load(recommendBean?.vedioMsg?.coverImage)
.skipMemoryCache(true)
.diskCacheStrategy(DiskCacheStrategy.ALL).centerCrop()
.into(baseItemView.findViewById(R.id.iv_cover))
val videoModel = VideoModel(recommendBean?.showVedioUrl)
val txVodPlayerWrapper = TXVodPlayerWrapper(mContext)
txVodPlayerWrapper.preStartPlay(videoModel)
txVodPlayerWrapper.setAutoLoop()
baseItemView.hideEmptyView()
baseItemView.setTXVodPlayer(txVodPlayerWrapper)
baseItemView.startPlay()
tv_recommend_name.text = recommendBean?.vedioMsg?.title
tv_recommend_text.text =
"${recommendBean?.vedioMsg?.title}热播中共${recommendBean?.vedioMsg?.vedioTotal}集"
}
private fun initListener() {
ic_recommend_quit.setOnClickListener(this)
btn_recommend_next.setOnClickListener(this)
}
override fun onResume() {
super.onResume()
baseItemView.startPlay()
}
override fun onPause() {
super.onPause()
baseItemView.pausePlayer()
}
override fun finish() {
super.finish()
overridePendingTransition(0, R.anim.scale_out)
}
override fun onKeyDown(keyCode: Int, event: KeyEvent): Boolean {
return if (keyCode == KeyEvent.KEYCODE_BACK) {
true
} else super.onKeyDown(
keyCode,
event
)
}
override fun onClick(v: View) {
if (AntiShake.check(v.id)) return
when (v.id) {
R.id.ic_recommend_quit -> {
finish()
}
R.id.btn_recommend_next -> {
val bundle = Bundle()
bundle.putString(Constant.VEDIO_BEAN, JsonUtil.toJson(recommendBean?.vedioMsg))
readyGoThenKill(NewTxVideoActivity::class.java, bundle)
}
}
}
}
\ No newline at end of file
......@@ -65,13 +65,9 @@ class TasksAdapter(context: Context, var taskData: MutableList<BannerBean>? = nu
inner class ViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView) {
val itemTaskTitle: TextView = itemView.findViewById(R.id.item_task_title)
val itemTaskMoney: TextView = itemView.findViewById(R.id.item_task_money)
val itemTaskCoupons: TextView = itemView.findViewById(R.id.item_task_coupons)
val itemTaskProgress: TextView = itemView.findViewById(R.id.item_task_progress)
val itemTaskClick: TextView = itemView.findViewById(R.id.item_task)
val itemTaskContent: TextView = itemView.findViewById(R.id.item_task_content)
val itemTaskPb: ProgressBar = itemView.findViewById(R.id.item_task_pb)
val llTaskRoot: FrameLayout = itemView.findViewById(R.id.ll_task_root)
val item_task_text: TextView = itemView.findViewById(R.id.item_task_text)
}
fun setItemListener(listener: ItemListener) {
......
package com.mints.helivideo.ui.fragment
import android.app.Dialog
import android.os.Handler
import android.os.Looper
import android.text.TextUtils
import android.view.LayoutInflater
import android.view.View
......@@ -19,11 +21,12 @@ import com.mints.helivideo.ad.banner.BannerManager
import com.mints.helivideo.common.AppConfig
import com.mints.helivideo.common.Constant
import com.mints.helivideo.manager.LocalVedioManager
import com.mints.helivideo.manager.TrackManager
import com.mints.helivideo.manager.UserManager
import com.mints.helivideo.mvp.model.*
import com.mints.helivideo.mvp.presenters.HomePresenter
import com.mints.helivideo.mvp.views.HomeView
import com.mints.helivideo.ui.activitys.LoadingActivity
import com.mints.helivideo.ui.activitys.MainActivity
import com.mints.helivideo.ui.activitys.WatchRecordActivity
import com.mints.helivideo.ui.adapter.HomeVideoPageAdapter
import com.mints.helivideo.ui.adapter.ImageTitleAdapter
......@@ -36,6 +39,7 @@ import com.mints.helivideo.ui.widgets.SignDrawDialog
import com.mints.library.utils.nodoubleclick.AntiShake
import com.scwang.smartrefresh.layout.api.RefreshLayout
import com.scwang.smartrefresh.layout.listener.OnRefreshListener
import kotlinx.android.synthetic.main.dialog_sign.*
import kotlinx.android.synthetic.main.fragment_main.*
import java.lang.reflect.Field
import java.util.*
......@@ -60,6 +64,7 @@ class MainFragment : LazyLoadBaseFragment(), HomeView, View.OnClickListener, OnR
private val topList = mutableListOf<VedioBean>()
private var vpAdapter: HomeVideoPageAdapter? = null
private var topAdapter: TopAdapter? = null
private var isFirstGetUserInfo = true
// 新人红包
var newcomerDialog: NewcomerDialog? = null
......@@ -119,6 +124,7 @@ class MainFragment : LazyLoadBaseFragment(), HomeView, View.OnClickListener, OnR
R.id.tv_main_watchmore -> {
// showSignDrawDialog()
readyGo(WatchRecordActivity::class.java)
// readyGo(LoadingActivity::class.java)
}
R.id.iv_main_sign -> {
showSignDialog(7)
......@@ -249,22 +255,35 @@ class MainFragment : LazyLoadBaseFragment(), HomeView, View.OnClickListener, OnR
override fun ordersSuc(data: BannerList?) {
topList.clear()
if (data != null) {
if (data != null && data.list.size > 0) {
ll_main_look.visibility = View.VISIBLE
topList.addAll(data.list)
}
topAdapter?.notifyDataSetChanged()
} else {
ll_main_look.visibility = View.GONE
}
}
override fun getUserSuc(data: UserBean) {
UserManager.getInstance().saveUserInfo(data)
// 只执行一次
if (isFirstGetUserInfo) {
isFirstGetUserInfo = false
if (data.rewardFirst == 0) {
// 弹出
if (newcomerDialog != null && !newcomerDialog!!.isShowing) {
showNewcomerDialog(data.rewardCoin)
}
} else {
// 不弹
// 弹出签到
}
}
}
override fun onHiddenChanged(hidden: Boolean) {
super.onHiddenChanged(hidden)
if (isHidden) {
......@@ -288,13 +307,15 @@ class MainFragment : LazyLoadBaseFragment(), HomeView, View.OnClickListener, OnR
}
}
private fun showNewcomerDialog() {
newcomerDialog = NewcomerDialog(requireContext())
private fun showNewcomerDialog(rewardCoin: Int) {
newcomerDialog = NewcomerDialog(requireContext(), rewardCoin)
newcomerDialog?.setAdListener(object : NewcomerDialog.AdListener {
override fun showAd() {
showToast("123")
newcomerDialog?.dismiss()
// showAd("")
}
})
......@@ -358,9 +379,12 @@ class MainFragment : LazyLoadBaseFragment(), HomeView, View.OnClickListener, OnR
override fun onClick(dialog: Dialog?, v: View) {
dialog?.dismiss()
when (v.id) {
// R.id.tv_sign -> {
//
// }
R.id.tv_sign_withdraw -> {
readyGo(LoadingActivity::class.java)
Handler(Looper.getMainLooper()).postDelayed({
showAd("")
}, 2500)
}
}
}
}, signDay)
......
package com.mints.helivideo.ui.widgets;
import android.animation.ValueAnimator;
import android.annotation.SuppressLint;
import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.LinearGradient;
import android.graphics.Paint;
import android.graphics.Path;
import android.graphics.PathMeasure;
import android.graphics.PorterDuff;
import android.graphics.PorterDuffXfermode;
import android.graphics.RectF;
import android.graphics.Shader;
import android.util.AttributeSet;
import android.view.View;
import com.mints.helivideo.utils.BubbleUtils;
@SuppressLint("DrawAllocation")
public class LoadingProgress extends View {
private static final long DURATION = 200;
private int mViewWidth;
private int mViewHeight;
private final int mStrokeWidth;
private int mProgressWidth;
private final Paint mBgPaint;
private final Paint mProgressPaint;
private ValueAnimator mAnimator;
// 动画数值(用于控制动画状态,因为同一时间内只允许有一种状态出现,具体数值处理取决于当前状态)
private float mAnimatorValue;
public LoadingProgress(Context context) {
this(context, null);
}
public LoadingProgress(Context context, AttributeSet attrs) {
this(context, attrs, 0);
}
private final int mHeight;
public LoadingProgress(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
mHeight = BubbleUtils.dp2px(15);
mStrokeWidth = BubbleUtils.dp2px(1);
mBgPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
mBgPaint.setStyle(Paint.Style.FILL);
mBgPaint.setStrokeWidth(mHeight);
mBgPaint.setColor(Color.parseColor("#2F2F2F"));
Paint mStrokePaint = new Paint(Paint.ANTI_ALIAS_FLAG);
mStrokePaint.setStyle(Paint.Style.STROKE);
mStrokePaint.setStrokeWidth(mStrokeWidth);
int mStrokeColor = Color.parseColor("#FB918A");
mStrokePaint.setColor(mStrokeColor);
mProgressPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
mProgressPaint.setStrokeWidth(mHeight);
mProgressPaint.setStyle(Paint.Style.FILL);
Paint mMackTickPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
mMackTickPaint.setStyle(Paint.Style.STROKE);
mMackTickPaint.setStrokeWidth(mStrokeWidth);
mMackTickPaint.setColor(mStrokeColor);
setLayerType(LAYER_TYPE_HARDWARE, null);
}
@Override
protected void onSizeChanged(int w, int h, int oldw, int oldh) {
super.onSizeChanged(w, h, oldw, oldh);
mViewHeight = h;
mViewWidth = w;
}
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
setMeasuredDimension(widthMeasureSpec, mHeight);
}
@Override
protected void onDraw(Canvas canvas) {
super.onDraw(canvas);
RectF rectF2 = new RectF(mStrokeWidth, mStrokeWidth, mViewWidth - mStrokeWidth, mHeight - mStrokeWidth);
canvas.drawRoundRect(rectF2, mHeight / 2, mHeight / 2, mBgPaint);
RectF rectF1 = new RectF(mStrokeWidth / 2, mStrokeWidth / 2, mProgressWidth - mStrokeWidth / 2, mViewHeight - mStrokeWidth / 2);
Path path = new Path();
Path dstPath = new Path();
PathMeasure pathMeasure = new PathMeasure();
path.moveTo(0, 0);
path.lineTo(mViewWidth, 0);
pathMeasure.setPath(path, false);
pathMeasure.getSegment(0, pathMeasure.getLength() * mAnimatorValue, dstPath, true);
//渐变
Shader mShader = new LinearGradient(mStrokeWidth / 2, mStrokeWidth / 2, mProgressWidth, mHeight - mStrokeWidth / 2,
Color.parseColor("#2cdeed"), Color.parseColor("#2cdeed"), Shader.TileMode.REPEAT);
//遮罩
mProgressPaint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.SRC_IN));
mProgressPaint.setShader(mShader);
canvas.drawRoundRect(rectF1, mHeight / 2, mHeight / 2, mProgressPaint);
mProgressPaint.setXfermode(null);
}
public void setCompleteNoAnim() {
if (mAnimator != null) {
mAnimator.cancel();
mAnimator = null;
}
mProgressWidth = mViewWidth;
invalidate();
}
public void setComplete() {
if (mAnimator != null) {
mAnimator.cancel();
mAnimator = null;
}
int progress = 1;
mProgressWidth = progress * mViewWidth;
mAnimator = ValueAnimator.ofFloat(0, progress).setDuration(200);
ValueAnimator.AnimatorUpdateListener mUpdateListener = animation -> {
mAnimatorValue = (float) animation.getAnimatedValue();
mProgressWidth = (int) (mAnimatorValue * mViewWidth);
invalidate();
};
mAnimator.addUpdateListener(mUpdateListener);
mAnimator.start();
}
/**
* 0--1
*/
public void startAnim() {
int progress = 1;
int delta = (int) (progress / 0.1);
delta = delta == 0 ? 1 : delta;
mProgressWidth = progress * mViewWidth;
mAnimator = ValueAnimator.ofFloat(0.1f, progress).setDuration(delta * DURATION);
mAnimator.setRepeatCount(ValueAnimator.INFINITE);
ValueAnimator.AnimatorUpdateListener mUpdateListener = animation -> {
mAnimatorValue = (float) animation.getAnimatedValue();
mProgressWidth = (int) (mAnimatorValue * mViewWidth);
invalidate();
};
mAnimator.addUpdateListener(mUpdateListener);
mAnimator.start();
}
/**
* 0--1
*/
public void startOneAnim() {
int progress = 1;
int delta = (int) (progress / 0.1);
delta = delta == 0 ? 1 : delta;
mProgressWidth = progress * mViewWidth;
mAnimator = ValueAnimator.ofFloat(0.1f, progress).setDuration(delta * DURATION);
ValueAnimator.AnimatorUpdateListener mUpdateListener = animation -> {
mAnimatorValue = (float) animation.getAnimatedValue();
mProgressWidth = (int) (mAnimatorValue * mViewWidth);
invalidate();
};
mAnimator.addUpdateListener(mUpdateListener);
mAnimator.start();
}
public void resumeAnim() {
if (mAnimator != null) {
mAnimator.resume();
} else {
startAnim();
}
}
public void pauseAnim() {
if (mAnimator != null) {
mAnimator.pause();
}
}
public void cancelAnim() {
if (mAnimator != null) {
mAnimator.cancel();
mAnimator.removeAllUpdateListeners();
}
}
}
\ No newline at end of file
......@@ -9,16 +9,12 @@ import android.view.View
import android.view.WindowManager
import android.widget.ImageView
import android.widget.TextView
import com.daimajia.androidanimations.library.Techniques
import com.daimajia.androidanimations.library.YoYo
import com.mints.helivideo.R
import com.mints.helivideo.ui.widgets.countdowntimer.CountDownTimerSupport
import com.mints.helivideo.ui.widgets.countdowntimer.OnCountDownTimerListener
import com.mints.helivideo.utils.SpanUtils
import com.mints.helivideo.utils.TimeRender
import java.util.*
import java.math.BigDecimal
class NewcomerDialog(private val context: Context) :
class NewcomerDialog(private val context: Context, private val rewardCoin: Int) :
Dialog(
context, R.style.dialog
) {
......@@ -42,7 +38,7 @@ class NewcomerDialog(private val context: Context) :
setContentView(R.layout.dialog_newcomer)
// 设置window属性
lp = window!!.attributes
lp.gravity = Gravity.BOTTOM
lp.gravity = Gravity.CENTER
lp.width = WindowManager.LayoutParams.MATCH_PARENT
lp.windowAnimations = R.style.DialogAnimBottom
window!!.attributes = lp
......@@ -64,6 +60,12 @@ class NewcomerDialog(private val context: Context) :
adListener?.showAd()
}
val sumCoin = rewardCoin.toString()
val allcoinBig = BigDecimal(sumCoin)
val rateBig = BigDecimal("10000")
val cashStr = allcoinBig.divide(rateBig).setScale(2, BigDecimal.ROUND_DOWN).toString()
println("mcg -->>>>>>>>>>>" + cashStr)
Handler().postDelayed({
startTimer()
}, 200)
......@@ -83,7 +85,7 @@ class NewcomerDialog(private val context: Context) :
timer!!.stop()
timer = null
}
timer = CountDownTimerSupport(4000, 1000)
timer = CountDownTimerSupport(3000, 1000)
timer!!.setOnCountDownTimerListener(object : OnCountDownTimerListener {
override fun onTick(millisUntilFinished: Long) {
if (isShowing) {
......
......@@ -2,9 +2,12 @@ package com.mints.helivideo.ui.widgets
import android.app.Dialog
import android.content.Context
import android.os.Handler
import android.view.Gravity
import android.view.KeyEvent
import android.view.WindowManager
import com.daimajia.androidanimations.library.Techniques
import com.daimajia.androidanimations.library.YoYo
import com.mints.helivideo.R
import com.mints.helivideo.utils.BubbleUtils
import com.mints.helivideo.utils.SpanUtils
......@@ -14,6 +17,7 @@ import kotlinx.android.synthetic.main.dialog_sign.*
class SignDialog(context: Context, listener: DialogListener, signDay: Int) :
Dialog(context, R.style.dialog) {
private var rope: YoYo.YoYoString? = null
init {
setContentView(R.layout.dialog_sign)
......@@ -38,6 +42,16 @@ class SignDialog(context: Context, listener: DialogListener, signDay: Int) :
tv_sign_rule.setOnClickListener(listener)
setLayoutStyle(signDay)
Handler().postDelayed({
rope = YoYo.with(Techniques.Pulse).duration(500).repeat(-1).playOn(tv_sign_withdraw)
}, 300)
}
override fun dismiss() {
super.dismiss()
rope?.stop()
rope = null
}
private fun setLayoutStyle(signDay: Int) {
......
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="@color/white" />
<solid android:color="#f9f9f9" />
<corners android:radius="9dp" />
</shape>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#90000000">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:orientation="vertical">
<ImageView
android:id="@+id/ivLoading"
android:layout_width="140dp"
android:layout_height="140dp"
android:layout_gravity="center_horizontal"
android:src="@mipmap/ic_launcher_main" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginTop="100dp"
android:text="执行中….."
android:textColor="@color/white"
android:textSize="20sp"
android:textStyle="bold" />
<com.mints.helivideo.ui.widgets.LoadingProgress
android:id="@+id/mProgressBar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="40dp"
android:layout_marginTop="20dp"
android:layout_marginRight="40dp" />
</LinearLayout>
</RelativeLayout>
......@@ -59,13 +59,15 @@
android:layout_marginRight="16dp" />
<LinearLayout
android:id="@+id/ll_main_look"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="16dp"
android:layout_marginTop="18dp"
android:layout_marginRight="16dp"
android:background="@drawable/shape_bg_write"
android:orientation="vertical">
android:orientation="vertical"
android:visibility="gone">
<RelativeLayout
android:layout_width="match_parent"
......
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/ll_task_root"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_marginBottom="10dp"
android:background="@drawable/bg_task_list"
android:orientation="vertical"
android:padding="14dp">
android:orientation="horizontal"
android:paddingLeft="10dp"
android:paddingRight="10dp"
android:paddingTop="16dp"
android:paddingBottom="16dp"
>
<LinearLayout
android:layout_width="match_parent"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:orientation="vertical">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical">
<TextView
android:id="@+id/item_task_title"
......@@ -25,94 +34,41 @@
android:ellipsize="end"
android:maxLines="1"
android:singleLine="true"
android:text="领金币"
android:textColor="@color/black"
android:textSize="16sp"
android:text="领金币" />
android:textSize="14sp"
android:textStyle="bold" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_marginTop="10dp"
android:orientation="horizontal">
<ProgressBar
android:id="@+id/item_task_pb"
style="@android:style/Widget.ProgressBar.Horizontal"
android:layout_width="70dp"
android:layout_height="6dp"
android:layout_gravity="center_vertical"
android:gravity="center_vertical"
android:progress="20"
android:progressDrawable="@drawable/progressbar_versus_changevedio_bg" />
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@mipmap/ic_close" />
<TextView
android:id="@+id/item_task_progress"
android:id="@+id/item_task_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginLeft="2dp"
android:gravity="center_vertical|left"
android:textColor="#F13D3D"
android:textSize="11sp"
android:text="88/85" />
android:text="最高领取50红包"
android:textSize="13sp" />
</LinearLayout>
</RelativeLayout>
<TextView
android:id="@+id/item_task_content"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="4dp"
android:layout_marginBottom="8dp"
android:textColor="#464646"
android:textSize="12sp"
android:text="观看福利视频赚金币" />
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:id="@+id/item_task_money"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:drawableLeft="@mipmap/ic_task_sign_coin"
android:gravity="center_vertical"
android:textColor="#F13D3D"
android:textSize="22sp"
android:text="+1500金币" />
</LinearLayout>
<TextView
android:id="@+id/item_task_plus"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_toRightOf="@+id/item_task_money"
android:gravity="center_vertical"
android:text="+"
android:textColor="#FF9700"
android:textSize="20sp"
android:textStyle="bold" />
</LinearLayout>
<TextView
android:id="@+id/item_task_coupons"
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_toRightOf="@+id/item_task_plus"
android:drawableLeft="@mipmap/ic_task_sign_coin"
android:gravity="center_vertical"
android:textColor="#F13D3D"
android:textSize="22sp"
android:text="*15" />
</RelativeLayout>
</LinearLayout>
android:orientation="vertical">
<TextView
android:id="@+id/item_task"
......@@ -122,8 +78,21 @@
android:layout_marginBottom="10dp"
android:background="@drawable/shape_task_btn"
android:gravity="center"
android:text="去完成"
android:textColor="@color/white"
android:textSize="13dp"
android:text="去完成" />
android:textSize="13dp" />
<TextView
android:id="@+id/item_task_progress"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginLeft="2dp"
android:gravity="center_vertical|left"
android:text="已完成0/10"
android:textColor="#F13D3D"
android:textSize="11sp" />
</LinearLayout>
</FrameLayout>
\ No newline at end of file
</LinearLayout>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment