Commit 3505d8cb authored by jyx's avatar jyx

上传激励视频点击事件

parent 02c53e98
......@@ -210,7 +210,7 @@ dependencies {
implementation 'com.umeng.umsdk:asms:1.1.3' // asms包依赖(必选)
implementation 'com.umeng.umsdk:crash:0.0.4' // native crash包依赖(必选)
// TalkingDada
// implementation files('libs/SaaS_AppAnalytics_Android_SDK_V4.0.36.jar')
implementation files('libs/SaaS_AppAnalytics_Android_SDK_V4.0.36.jar')
// 一览视频
implementation("com.yilan.sdk:ui:3.1.0.4") {
exclude group: 'com.yilan.sdk', module: 'toutiao'
......
......@@ -29,8 +29,8 @@ object BannerManager {
* 获取穿山甲banner
*/
fun getTtBanner(codeId: String, frameLayout: FrameLayout?) {
var expressViewAcceptedSizeWidth: Float = 380f
var expressViewAcceptedSizeHeight: Float = 280f
var expressViewAcceptedSizeWidth = 380f
var expressViewAcceptedSizeHeight = 280f
when (codeId) {
TtCsjAdManager.TT_AD_BANNER_MY -> {
expressViewAcceptedSizeWidth = 380f
......@@ -40,7 +40,6 @@ object BannerManager {
// ToastUtil.showLong(MintsApplication.getContext(), "csj banner:$codeId")
adNative?.let {
val adSlot = AdSlot.Builder()
.setCodeId(codeId) //广告位id
......
......@@ -8,6 +8,7 @@ import com.bytedance.sdk.openadsdk.TTAdNative;
import com.bytedance.sdk.openadsdk.TTAppDownloadListener;
import com.bytedance.sdk.openadsdk.TTRewardVideoAd;
import com.mints.goodmoney.BuildConfig;
import com.mints.goodmoney.common.AppConfig;
import com.mints.goodmoney.common.Constant;
import com.mints.goodmoney.manager.TTNativeExpressManager;
import com.mints.goodmoney.manager.TrackManager;
......@@ -178,6 +179,10 @@ public class CsjVedioAdManager extends BaseVedioAd {
@Override
public void onAdVideoBarClick() {//广告的下载bar点击回调
if (AppConfig.needReportClickAdEvent) {
TrackManager.getInstance().reportClickAdEvent();
}
TrackManager.getInstance().addCallImp(Constant.AD_SOURCE_CSJ, Constant.EVENT_TYPE_TWO, "", "");
if (isClickScreen) {
......
......@@ -2,6 +2,7 @@ package com.mints.goodmoney.ad.vedio
import android.app.Activity
import com.maplehaze.adsdk.video.RewardVideoAd
import com.mints.goodmoney.common.AppConfig
import com.mints.goodmoney.common.Constant
import com.mints.goodmoney.manager.MhManager
import com.mints.goodmoney.manager.TrackManager
......@@ -76,6 +77,10 @@ class MhVedioAdManager private constructor(activity: Activity) :
}
override fun onADClick() {
if (AppConfig.needReportClickAdEvent) {
TrackManager.getInstance().reportClickAdEvent()
}
LogUtil.d(TAG, "onADClick")
TrackManager.getInstance().addCallImp(Constant.AD_SOURCE_FL, Constant.EVENT_TYPE_TWO, "", "")
if (isClickScreen) {
......
......@@ -463,4 +463,5 @@ public class VedioAdingManager {
}
}
}
}
\ No newline at end of file
package com.mints.goodmoney.ad.vedio
import android.app.Activity
import com.mints.goodmoney.common.AppConfig
import com.mints.goodmoney.common.Constant
import com.mints.goodmoney.common.DeviceInfo.Companion.instance
import com.mints.goodmoney.manager.AppTryPlayManager
import com.mints.goodmoney.manager.TrackManager
import com.mints.goodmoney.manager.WnManager
import com.mints.goodmoney.mvp.presenters.WnVedioAdPresenter
......@@ -82,6 +81,9 @@ class WnVedioAdManager private constructor(activity: Activity) :
}
override fun onAdClick() {
if (AppConfig.needReportClickAdEvent) {
TrackManager.getInstance().reportClickAdEvent()
}
TrackManager.getInstance().addCallImp(Constant.AD_SOURCE_SDHZ, Constant.EVENT_TYPE_TWO, "", "")
......
......@@ -3,14 +3,13 @@ package com.mints.goodmoney.ad.vedio;
import android.app.Activity;
import android.os.SystemClock;
import com.mints.goodmoney.MintsApplication;
import com.mints.goodmoney.common.AppConfig;
import com.mints.goodmoney.common.Constant;
import com.mints.goodmoney.manager.TrackManager;
import com.mints.goodmoney.manager.YlhAdManager;
import com.mints.goodmoney.mvp.presenters.YlhVedioAdPresenter;
import com.mints.goodmoney.mvp.views.VedioAdManagerView;
import com.mints.goodmoney.utils.LogUtil;
import com.mints.goodmoney.utils.ToastUtil;
import com.qq.e.ads.rewardvideo.RewardVideoAD;
import com.qq.e.ads.rewardvideo.RewardVideoADListener;
import com.qq.e.comm.util.AdError;
......@@ -181,6 +180,10 @@ public class YlhVedioAdManager extends BaseVedioAd implements VedioAdManagerView
@Override
public void onADClick() {//激励视频广告被点击
if (AppConfig.needReportClickAdEvent) {
TrackManager.getInstance().reportClickAdEvent();
}
TrackManager.getInstance().addCallImp(Constant.AD_SOURCE_YLH, Constant.EVENT_TYPE_TWO, "", "");
if (isClickScreen) {
......
......@@ -81,4 +81,9 @@ public class AppConfig {
*/
public static boolean isHighTask = false;
/**
* 是否需要上报点击广告
*/
public static boolean needReportClickAdEvent = false;
}
......@@ -4,6 +4,7 @@ package com.mints.goodmoney.manager;
import android.text.TextUtils;
import com.mints.goodmoney.MintsApplication;
import com.mints.goodmoney.common.AppConfig;
import com.mints.goodmoney.mvp.presenters.TrackPresenter;
/**
......@@ -55,6 +56,16 @@ public class TrackManager {
}
}
/**
* 激励视频点击
*/
public void reportClickAdEvent() {
if (trackPresenter != null) {
trackPresenter.reportClickAdEvent();
}
}
/**
* 提现看视频
*/
......
......@@ -10,11 +10,21 @@ public class UserTaskMsgBean implements Serializable {
private VedioRulesBean vedioRules;
private BlessingBigMsgBean blessingBigMsg;
private UserRiskAppsBean userRiskApps;
private AdcodeBean adcode_v1=null;
private AdcodeBean adcode_v1 = null;
private String ip;
private String channel;
private boolean needReportClickAdEvent;
public boolean isNeedReportClickAdEvent() {
return needReportClickAdEvent;
}
public void setNeedReportClickAdEvent(boolean needReportClickAdEvent) {
this.needReportClickAdEvent = needReportClickAdEvent;
}
public BlessingBigMsgBean getBlessingBigMsgBean() {
return blessingBigMsg;
}
......
......@@ -84,7 +84,7 @@ class HomePresenter : BasePresenter<HomeView>() {
val message = baseResponse.getMessage()
when (code) {
200 -> view.getHallBaseMsgSuc(baseResponse.getData())
else ->{
else -> {
view.showToast(message)
}
}
......
package com.mints.goodmoney.mvp.presenters;
import com.google.gson.JsonObject;
import com.mints.goodmoney.common.Constant;
import com.mints.goodmoney.manager.AppHttpManager;
import com.mints.goodmoney.mvp.model.BaseResponse;
......@@ -107,4 +108,26 @@ public class TrackPresenter extends BaseTrackPresenter {
});
}
/**
* 上报点击广告
*/
public void reportClickAdEvent() {
AppHttpManager.getInstance(loanApplication)
.call(loanService.reportClickAdEvent(),
new BaseSubscriber<BaseResponse<Object>>() {
@Override
public void onCompleted() {
}
@Override
public void onError(Throwable e) {
}
@Override
public void onNext(BaseResponse<Object> baseResponse) {
}
});
}
}
......@@ -510,6 +510,14 @@ public interface LoanService {
@POST("api/getCommonJdUrl")
Observable<BaseResponse<JsonObject>> getCommonJdUrl();
/**
* 上报点击广告接口
*
* @return
*/
@POST("api/reportClickAdEvent")
Observable<BaseResponse<JsonObject>> reportClickAdEvent();
/**
* 默认http工厂
*/
......
......@@ -8,6 +8,9 @@ import android.content.IntentFilter;
import android.os.IBinder;
public class AppInstallService extends Service {
public static final String APP_INSTALL_ACTION = "com.mints.goodmoney.updateInstallPkg";
BroadcastReceiver broadcastReceiver = new BroadcastReceiver() {
public void onReceive(Context param1Context, Intent param1Intent) {
if (param1Intent == null)
......@@ -19,7 +22,7 @@ public class AppInstallService extends Service {
if (!str.equals(AppInstallService.this.getPackageName())) {
try {
Intent intent = new Intent();
intent.setAction("com.mints.goodmoney.updateInstallPkg");
intent.setAction(APP_INSTALL_ACTION);
intent.putExtra("pkg", str);
AppInstallService.this.sendBroadcast(intent);
} catch (Exception e) {
......
......@@ -66,9 +66,9 @@ public class GvMyAdapter extends BaseAdapter {
convertView = inflater.inflate(R.layout.item_list_my, null);
viewHolder = new ViewHolder();
viewHolder.fl_my_icon = (FrameLayout) convertView.findViewById(R.id.fl_my_icon);
viewHolder.ic_my_icon = (ImageView) convertView.findViewById(R.id.ic_my_icon);
viewHolder.tv_my_title = (TextView) convertView.findViewById(R.id.tv_my_title);
viewHolder.fl_my_icon = convertView.findViewById(R.id.fl_my_icon);
viewHolder.ic_my_icon = convertView.findViewById(R.id.ic_my_icon);
viewHolder.tv_my_title = convertView.findViewById(R.id.tv_my_title);
convertView.setTag(viewHolder);
} else {
......
......@@ -103,12 +103,12 @@ class MainMyAdapter(context: Context, taskData: MutableList<MyInfo.AutoListBean>
holder.itemTaskClick.setTextColor(Color.WHITE)
}
2 -> {
if (taskBean.baseConfig.taskId == APP_SHAREFRIEND || taskBean.baseConfig.taskId == TO_SHARE_NEWS) {
holder.itemTaskClick.setBackgroundResource(R.drawable.shape_btn_orange)
holder.itemTaskClick.setTextColor(mContext.resources.getColor(R.color.color_FB560C))
} else {
if (taskBean.baseConfig.taskId == APP_VEDIO || taskBean.baseConfig.taskId == TO_SHARE_NEWS) {
holder.itemTaskClick.setBackgroundResource(R.drawable.shape_btn_gury)
holder.itemTaskClick.setTextColor(Color.WHITE)
} else {
holder.itemTaskClick.setBackgroundResource(R.drawable.shape_btn_orange)
holder.itemTaskClick.setTextColor(mContext.resources.getColor(R.color.color_FB560C))
}
}
0 -> {
......
......@@ -226,6 +226,9 @@ class MainFragment : BaseFragment(), HomeView, View.OnClickListener {
// 手机号登录未绑定微信 弹出界面不能关闭
loginMobileBindWx()
// 是否上报点击广告
AppConfig.needReportClickAdEvent = data.isNeedReportClickAdEvent
data.blessingBigMsgBean?.let {
if (it.surplusCount > 0) {
if (rl_fragment_main_redbox.visibility == View.GONE) {
......
......@@ -59,6 +59,8 @@ import net.grandcentrix.tray.AppPreferences
import java.math.BigDecimal
import java.util.*
private val TAG = MyFragment::class.java.simpleName
/**
* 描述:我
* 作者:孟崔广
......@@ -67,8 +69,6 @@ import java.util.*
@SuppressLint("SetTextI18n")
class MyFragment : BaseFragment(), MyView, OnItemChildClickListener, OnRefreshListener, View.OnClickListener, AdapterView.OnItemClickListener {
private val TAG = MyFragment::class.java.simpleName
private val ps by lazy { AppPreferences(context) }
private val myPresenter by lazy { MyPresenter() }
private val userManager by lazy { UserManager.getInstance() }
......@@ -102,8 +102,6 @@ class MyFragment : BaseFragment(), MyView, OnItemChildClickListener, OnRefreshLi
override fun initViewsAndEvents() {
myPresenter.attachView(this)
srl_my.setOnRefreshListener(this)
// 注册广播监听
registerBroad()
initManager()
initView()
......@@ -175,7 +173,9 @@ class MyFragment : BaseFragment(), MyView, OnItemChildClickListener, OnRefreshLi
BannerManager.onDestroy()
myPresenter.detachView()
mContext.unregisterReceiver(this.mReceiverBroadcastReceiver)
if (mReceiverBroadcastReceiver != null) {
mContext.unregisterReceiver(mReceiverBroadcastReceiver)
}
}
override fun getUserTaskMsgSuc(data: MyInfo?) {
......@@ -240,7 +240,6 @@ class MyFragment : BaseFragment(), MyView, OnItemChildClickListener, OnRefreshLi
SceneManager.signIn(requireActivity())
RsNewsManager.init(baseApplication)
myPresenter.getAutoUserHallBaseMsg()
myPresenter.getHallBaseMsg()
}
......@@ -261,6 +260,8 @@ class MyFragment : BaseFragment(), MyView, OnItemChildClickListener, OnRefreshLi
}
ChannelManager.updataCodeIdForRegisterChannel(data.adcode)
// 是否上报点击广告
AppConfig.needReportClickAdEvent = data.isNeedReportClickAdEvent
// 新人福利
if (data.userMsg.firstGiveCoin > 0) {
......@@ -466,7 +467,8 @@ class MyFragment : BaseFragment(), MyView, OnItemChildClickListener, OnRefreshLi
}
when (taskBean.otherConfig.status) {
0 -> {// 0-去下载 1-去领取 3-去试玩
// 0-去下载 1-去领取 3-去试玩
0 -> {
if (AppUtil.isOpenUsageStats()) {
highVideoTint(taskBean)
} else {
......@@ -519,23 +521,23 @@ class MyFragment : BaseFragment(), MyView, OnItemChildClickListener, OnRefreshLi
}
// 跳转首页视频
MainMyAdapter.TO_HOME -> {
// if (taskBean.otherConfig != null) {
// when (taskBean.otherConfig.status) {
// 0, 2 -> {
// val activity: MainActivity? = activity as MainActivity?
// activity?.let {
// it.clickTab1Layout()
// it.selectVedio()
// }
// }
// 1 -> {
// val bundle = Bundle()
// bundle.putInt(Constant.MAIN_CUR_COIN, taskBean.otherConfig.coin)
// bundle.putString(Constant.MAIN_CARRIER_TYPE, Constant.CARRIER_HOMEVEDIO_CHALLENGE)
// readyGo(AwardActivity::class.java, bundle)
// }
// }
// }
if (taskBean.otherConfig != null) {
when (taskBean.otherConfig.status) {
0, 2 -> {
val activity: MainActivity? = activity as MainActivity?
activity?.let {
it.clickTab1Layout()
it.selectVedio()
}
}
1 -> {
val bundle = Bundle()
bundle.putInt(Constant.MAIN_CUR_COIN, taskBean.otherConfig.coin)
bundle.putString(Constant.MAIN_CARRIER_TYPE, Constant.CARRIER_HOMEVEDIO_CHALLENGE)
readyGo(AwardActivity::class.java, bundle)
}
}
}
}
// 跳转短视频
MainMyAdapter.TO_MINI_VEDIO -> {
......@@ -855,7 +857,16 @@ class MyFragment : BaseFragment(), MyView, OnItemChildClickListener, OnRefreshLi
return
}
shareArticle(300)
if (dataList.isNotEmpty()) {
for (listBean in dataList) {
if (listBean.baseConfig.taskId == MainMyAdapter.TO_SHARE_NEWS) {
shareArticle(listBean.otherConfig.readCoin)
return
}
}
shareArticle(300)
}
}
else -> {
if (!TextUtils.isEmpty(hotBean.url) && !TextUtils.isEmpty(hotBean.title)) {
......@@ -923,6 +934,9 @@ class MyFragment : BaseFragment(), MyView, OnItemChildClickListener, OnRefreshLi
}
}
/**
* 激励视频播放成功回调
*/
private fun videoAdingSuccess(adType: String) {
if (activity != null && !activity!!.isFinishing) {
// 高额任务
......@@ -1117,7 +1131,6 @@ class MyFragment : BaseFragment(), MyView, OnItemChildClickListener, OnRefreshLi
}
override fun initFailed(errMsg: String) {
LogUtil.d(errMsg)
showToast("初始化失败,请稍候重试~")
}
})
......@@ -1127,6 +1140,9 @@ class MyFragment : BaseFragment(), MyView, OnItemChildClickListener, OnRefreshLi
}
}
/**
* 高额任务提示弹框
*/
private fun highVideoTint(taskBean: MyInfo.AutoListBean) {
cdaa = CustomDialogAsApple(context, object : DialogListener() {
override fun onClick(v: View) {
......@@ -1144,7 +1160,11 @@ class MyFragment : BaseFragment(), MyView, OnItemChildClickListener, OnRefreshLi
vedioAdingManager.setIsHighWeight(true)
awardVedio(taskBean.otherConfig.coin, Constant.CARRIER_HIGH_ACTIVITY)
//
mContext.startService(Intent(context, AppInstallService::class.java))
// 注册高额任务广播监听
registerBroad()
}
}
}
......@@ -1166,6 +1186,9 @@ class MyFragment : BaseFragment(), MyView, OnItemChildClickListener, OnRefreshLi
}
}
/**
* 打开应用使用记录授权弹框
*/
private fun openAppUsageStats() {
cdaa = CustomDialogAsApple(context, object : DialogListener() {
override fun onClick(v: View) {
......@@ -1192,26 +1215,31 @@ class MyFragment : BaseFragment(), MyView, OnItemChildClickListener, OnRefreshLi
}
}
/**
* 注册高额任务监听
*/
private fun registerBroad() {
val intentFilter = IntentFilter()
intentFilter.addAction("com.mints.goodmoney.updateInstallPkg")
mContext.registerReceiver(this.mReceiverBroadcastReceiver, intentFilter)
}
private val mReceiverBroadcastReceiver = object : BroadcastReceiver() {
override fun onReceive(context: Context?, intent: Intent?) {
if (intent == null) return
// 非高额任务不监听下载安装
if (TextUtils.equals(carrierType, Constant.CARRIER_HIGH_ACTIVITY)) {
try {
val pkg = intent.getStringExtra("pkg")
mCurrentPkg = pkg
myPresenter.setHighTaskType("3")
} catch (e: Exception) {
e.printStackTrace()
mReceiverBroadcastReceiver = object : BroadcastReceiver() {
override fun onReceive(context: Context?, intent: Intent?) {
if (intent == null) return
// 非高额任务不监听下载安装
if (TextUtils.equals(carrierType, Constant.CARRIER_HIGH_ACTIVITY)) {
try {
val pkg = intent.getStringExtra("pkg")
mCurrentPkg = pkg
myPresenter.setHighTaskType("3")
} catch (e: Exception) {
e.printStackTrace()
}
}
}
}
val intentFilter = IntentFilter()
intentFilter.addAction(AppInstallService.APP_INSTALL_ACTION)
mContext.registerReceiver(this.mReceiverBroadcastReceiver, intentFilter)
}
private var mReceiverBroadcastReceiver: BroadcastReceiver? = null
}
\ No newline at end of file
......@@ -36,13 +36,10 @@
<FrameLayout
android:id="@+id/fl_my_banner"
android:paddingStart="5dp"
android:paddingEnd="5dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginLeft="4dp"
android:layout_marginTop="4dp"
android:layout_marginRight="4dp"
android:background="@drawable/shape_border_top"
android:visibility="gone" />
<include layout="@layout/item_divider_gray" />
......@@ -70,4 +67,4 @@
</com.scwang.smartrefresh.layout.SmartRefreshLayout>
</LinearLayout>
</LinearLayout>
\ No newline at end of file
......@@ -6,10 +6,9 @@
android:visibility="gone"
android:layout_marginTop="2dp"
android:layout_marginBottom="16dp"
android:columnWidth="80dp"
android:columnWidth="85dp"
android:divider="@null"
android:dividerHeight="10dp"
android:elevation="6dip"
android:listSelector="@color/color_0000"
android:numColumns="4"
android:scrollbars="none"
......
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