Commit bbbb08cd authored by jyx's avatar jyx

添加快手联盟广告,Dialog集中管理,好兔SDK版本更新

parent e5c1900c
......@@ -193,7 +193,7 @@ dependencies {
implementation 'cn.jiguang.sdk:jcore:2.3.8'
// 移动安全联盟
implementation(name: 'oaid_sdk_1.0.23', ext: 'aar')
// 穿山甲广告
// 穿山甲广告 版本3.4.1.2
implementation(name: 'open_ad_sdk', ext: 'aar')
// 广点通广告 腾讯
implementation(name: 'GDTSDK.unionNoPlugin.4.294.1164', ext: 'aar')
......@@ -207,8 +207,8 @@ dependencies {
implementation 'com.umeng.umsdk:crash:0.0.4' // native crash包依赖(必选)
// TalkingDada(已集成)
// 一览视频
implementation("com.yilan.sdk:ui:3.1.0.4") {
exclude group: 'com.yilan.sdk', module: 'toutiao'
implementation("com.yilan.sdk:ui:3.3.1.2") {
exclude group: 'com.yilan.sdk', module: 'yb_extra'
exclude group: 'com.yilan.sdk', module: 'gdt'
exclude group: 'com.yilan.sdk', module: 'ks'
}
......@@ -248,7 +248,7 @@ dependencies {
// 枫岚
implementation(name: 'mh-adsdk', ext: 'aar')
implementation(name: 'mh-adsdk-ext', ext: 'aar')
implementation(name: 'ks_3.3.5.3', ext: 'aar')
// implementation(name: 'ks_3.3.5.3', ext: 'aar')
// 聚乐云
implementation(name: 'okgo-2.2', ext: 'aar')
implementation(name: 'scenemodule-2.2', ext: 'aar')
......@@ -265,6 +265,8 @@ dependencies {
implementation(name: 'tzsdk_coral-2.0.0-20200807131516-release', ext: 'aar')
implementation(name: 'tzsdk_core-3.0.0-20200807131516-release', ext: 'aar')
implementation(name: 'tzsdk_reporter-3.0.0-20200807131516-release', ext: 'aar')
// 快手
implementation(name: 'kssdk-ad-3.3.6-publishRelease', ext: 'aar')
// testImplementation 'junit:junit:4.13'
// androidTestImplementation 'androidx.test.ext:junit:1.1.2'
......
......@@ -632,6 +632,9 @@
# ======================= 微转分享 END ================
# ===================== OAID START ================
-keep class XI.CA.XI.**{*;}
-keep class XI.K0.XI.**{*;}
......@@ -646,4 +649,18 @@
-keep class com.samsung.android.deviceidservice.**{*;}
-keep class org.json.**{*;}
-keep public class com.netease.nis.sdkwrapper.Utils {public <methods>;}
# ======================= OAID END ================
# ===================== 快手 START ================ 好兔视频已混淆
# -keep class org.chromium.** {*;}
# -keep class org.chromium.** { *; }
# -keep class aegon.chrome.** { *; }
# -keep class com.kwai.**{ *; }
# -dontwarn com.kwai.**
# -dontwarn com.kwad.**
# -dontwarn com.ksad.**
# -dontwarn aegon.chrome.**
# ======================= OAID END ================
\ No newline at end of file
......@@ -38,10 +38,17 @@
<uses-permission android:name="android.permission.ANSWER_PHONE_CALLS" />
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW" />
<uses-permission android:name="com.mints.goodmoney.permission" />
<permission
android:name="com.mints.goodmoney.permission"
android:protectionLevel="normal" />
<!-- 快手SDK内⾃定义的权限,与下载相关,aar中已经申请 -->
<permission
android:name="${applicationId}.permission.KW_SDK_BROADCAST"
android:protectionLevel="signature" />
<uses-permission android:name="${applicationId}.permission.KW_SDK_BROADCAST" />
<application
android:name=".MintsApplication"
android:allowBackup="true"
......@@ -184,6 +191,9 @@
<activity
android:name=".ui.activitys.SplashADActivity"
android:screenOrientation="portrait" />
<activity
android:name=".ui.activitys.SplashKsADActivity"
android:screenOrientation="portrait" />
<activity
android:name=".ui.activitys.MorningClockActivity"
android:screenOrientation="portrait" />
......@@ -218,10 +228,10 @@
android:screenOrientation="portrait" />
<activity
android:name=".call.permission.PermissionActivity"
android:screenOrientation="portrait"/>
android:screenOrientation="portrait" />
<activity
android:name=".call.detail.DetailApplyActivity"
android:screenOrientation="portrait"/>
android:screenOrientation="portrait" />
<service
android:name=".service.UpdateService"
......
......@@ -13,6 +13,7 @@ import androidx.multidex.MultiDexApplication;
import com.hjq.toast.ToastUtils;
import com.mints.goodmoney.common.Constant;
import com.mints.goodmoney.manager.ChannelManager;
import com.mints.goodmoney.manager.KsManager;
import com.mints.goodmoney.manager.LiebaoManager;
import com.mints.goodmoney.manager.MhManager;
import com.mints.goodmoney.manager.MiitHelper;
......@@ -122,11 +123,14 @@ public class MintsApplication extends MultiDexApplication {
// 穿山甲
TtCsjAdManager.init(this);
// 快手
KsManager.INSTANCE.initKs(this);
// 闪电盒子
WnManager.INSTANCE.initWn(this);
// 枫岚广告
MhManager.INSTANCE.initWn(this);
MhManager.INSTANCE.initMn(this);
// 一览视频
YlVideoManager.INSTANCE.init(this);
......
......@@ -24,16 +24,28 @@ object BannerManager {
TtCsjAdManager.get().requestPermissionIfNecessary(MintsApplication.getContext())
}
/**
* 获取view宽高
*/
private fun getViewWidth(): Float {
val displayMetrics = MintsApplication.getContext().resources.displayMetrics
val density = displayMetrics.density
// 屏幕宽度 - margin宽度
val pxWidth = displayMetrics.widthPixels - (20 * density + 0.5f)
return pxWidth / density + 0.5f
}
/**
* 获取穿山甲banner
*/
fun getTtBanner(codeId: String, frameLayout: FrameLayout?) {
var expressViewAcceptedSizeWidth = 380f
var expressViewAcceptedSizeHeight = 280f
var expressViewAcceptedSizeWidth = getViewWidth()
var expressViewAcceptedSizeHeight = 0f
when (codeId) {
TtCsjAdManager.TT_AD_BANNER_MY -> {
expressViewAcceptedSizeWidth = 380f
expressViewAcceptedSizeHeight = 280f
expressViewAcceptedSizeWidth = getViewWidth()
expressViewAcceptedSizeHeight = 0f
}
}
......
package com.mints.goodmoney.ad.express
import android.view.View
import android.view.ViewGroup
import android.widget.FrameLayout
import com.mints.goodmoney.MintsApplication
import com.qq.e.ads.nativ.NativeExpressADView
object PreLoadExpressManager : TTADLoadSuccessListener, YLHADLoadSuccessListener {
/**
* 预加载信息流管理类
*/
object PreLoadExpressManager : TTADLoadSuccessListener, YLHADLoadSuccessListener, KSADLoadSuccessListener {
// 是否是穿山甲信息流
@Volatile
private var isTTExpressAd = false
private var currentIndex = 0
@Volatile
private var mAdFrameLayout: FrameLayout? = null
......@@ -17,42 +23,52 @@ object PreLoadExpressManager : TTADLoadSuccessListener, YLHADLoadSuccessListener
mAdFrameLayout = FrameLayout(MintsApplication.getContext())
YlhPreLoadExpressManager.setListener(this)
TTPreLoadExpressManager.getInstance().setListener(this)
KsPreLoadExpressManager.setListener(this)
}
fun loadADFrameLayout() {
mAdFrameLayout?.removeAllViews()
if (isTTExpressAd) {
TTPreLoadExpressManager.getInstance().loadTtFrameLayout(mAdFrameLayout)
} else {
YlhPreLoadExpressManager.loadYlhFrameLayout()
when (++currentIndex) {
1 -> {
TTPreLoadExpressManager.getInstance().loadTtFrameLayout(mAdFrameLayout)
}
2 -> {
YlhPreLoadExpressManager.loadYlhFrameLayout()
}
3 -> {
KsPreLoadExpressManager.loadKsFrameLayout(mAdFrameLayout as ViewGroup)
}
}
}
fun getADFrameLayout(): FrameLayout? {
// mAdFrameLayout = if (isTTExpressAd) {
// TTPreLoadExpressManager.getInstance().ttFrameLayout
// } else {
// YlhPreLoadExpressManager.getYlhFrameLayout()
// }
isTTExpressAd = !isTTExpressAd
if (currentIndex >= 3) currentIndex = 0
return mAdFrameLayout
}
fun onDestroy() {
TTPreLoadExpressManager.getInstance().onDestroy()
YlhPreLoadExpressManager.onDestroy()
KsPreLoadExpressManager.onDestroy()
}
override fun onTTAdLoadSuc(adFrameLayout: FrameLayout?) {
if (isTTExpressAd) {
if (currentIndex == 1) {
mAdFrameLayout = adFrameLayout
}
}
override fun onYlhAdLoadSuc(adFrameLayout: NativeExpressADView?) {
if (!isTTExpressAd) {
mAdFrameLayout?.addView(adFrameLayout)
override fun onYlhAdLoadSuc(view: NativeExpressADView?) {
if (currentIndex == 2) {
mAdFrameLayout?.addView(view)
}
}
override fun onKSAdLoadSuc(view: View?) {
if (currentIndex == 3) {
mAdFrameLayout?.addView(view)
}
}
......@@ -64,4 +80,8 @@ interface TTADLoadSuccessListener {
interface YLHADLoadSuccessListener {
fun onYlhAdLoadSuc(view: NativeExpressADView?)
}
interface KSADLoadSuccessListener {
fun onKSAdLoadSuc(ksNativeAd: View?)
}
\ No newline at end of file
......@@ -10,6 +10,7 @@ import androidx.annotation.NonNull;
import com.mints.goodmoney.MintsApplication;
import com.mints.goodmoney.manager.TTNativeExpressManager;
import com.mints.goodmoney.utils.ToastUtil;
public class TTPreLoadCarrierExpressManager {
......
package com.mints.goodmoney.ad.express;
import android.util.DisplayMetrics;
import android.widget.FrameLayout;
import com.mints.goodmoney.MintsApplication;
import com.mints.goodmoney.manager.TTNativeExpressManager;
import com.mints.goodmoney.manager.TtCsjAdManager;
import com.mints.goodmoney.utils.Utils;
public class TTPreLoadExpressManager {
private static TTPreLoadExpressManager _inst;
// private FrameLayout ttFrameLayout;
private TTNativeExpressManager ttNativeExpressManager;
public static TTPreLoadExpressManager getInstance() {
......@@ -31,39 +33,31 @@ public class TTPreLoadExpressManager {
}
}
// public FrameLayout getTtFrameLayout() {
// return ttFrameLayout;
// }
private TTADLoadSuccessListener mADLoadSuccessListener;
public void setListener(TTADLoadSuccessListener adLoadSuccessListener) {
mADLoadSuccessListener = adLoadSuccessListener;
}
private float getViewWidth() {
DisplayMetrics displayMetrics = MintsApplication.getContext().getResources().getDisplayMetrics();
float density = displayMetrics.density;
float pxWidth = displayMetrics.widthPixels - (50 * density + 0.5f);
float dpWidth = pxWidth / density + 0.5f;
return dpWidth;
}
/**
* 预加载 信息流
*/
public void loadTtFrameLayout(FrameLayout adFrameLayout) {
init();
// Context context = MintsApplication.getContext();
// ttFrameLayout = null;
try {
// FrameLayout ttFrameLayout = new FrameLayout(context);
ttNativeExpressManager.getNativeExpressInit(TtCsjAdManager.TT_AD_NATIVEEXPRESS_AWARD, adFrameLayout, 310, 0);
ttNativeExpressManager.getNativeExpressInit(TtCsjAdManager.TT_AD_NATIVEEXPRESS_AWARD, adFrameLayout, getViewWidth(), 0);
ttNativeExpressManager.setTTNativeExpressManagerListener(view -> {
// if (view == null) {
// ttFrameLayout = null;
// } else {
//
// try {
// ttFrameLayout = view;
// } catch (Exception e) {
// e.printStackTrace();
// ttFrameLayout = null;
// }
// }
try {
if (view != null) {
if (mADLoadSuccessListener != null) {
......
......@@ -9,10 +9,11 @@ import com.qq.e.ads.nativ.NativeExpressAD
import com.qq.e.ads.nativ.NativeExpressADView
import com.qq.e.comm.util.AdError
/**
* 优量汇预加载信息流
*/
object YlhPreLoadExpressManager {
// private var ylhFrameLayout: FrameLayout? = null
private var nativeExpressAD: NativeExpressAD? = null
private var nativeExpressADView: NativeExpressADView? = null
......@@ -22,15 +23,8 @@ object YlhPreLoadExpressManager {
mADLoadSuccessListener = adLoadSuccessListener
}
// fun getYlhFrameLayout(): FrameLayout? {
// return ylhFrameLayout
// }
fun loadYlhFrameLayout() {
// val context = MintsApplication.getContext()
try {
// ylhFrameLayout = FrameLayout(context)
nativeExpressAD = NativeExpressAD(MintsApplication.getContext(), ADSize(ADSize.FULL_WIDTH, ADSize.AUTO_HEIGHT), YlhAdManager.YLH_AD_NATIVEEXPRESS_AWARD, object : NativeExpressAD.NativeExpressADListener {
override fun onNoAD(p0: AdError?) {
if (BuildConfig.DEBUG) {
......@@ -59,15 +53,10 @@ object YlhPreLoadExpressManager {
nativeExpressADView?.destroy()
nativeExpressADView = p0?.get(0)
//
// if (ylhFrameLayout!!.childCount > 0) {
// ylhFrameLayout!!.removeAllViews()
// }
// 广告可见才会产生曝光,否则将无法产生收益。
mADLoadSuccessListener?.onYlhAdLoadSuc(nativeExpressADView)
// ylhFrameLayout!!.addView(nativeExpressADView)
nativeExpressADView?.render()
}
......
......@@ -7,7 +7,7 @@ import android.view.KeyEvent
import com.mints.goodmoney.MintsApplication
import com.mints.goodmoney.common.Constant
import com.mints.goodmoney.mvp.views.BaseView
import com.mints.goodmoney.ui.widgets.LoadingDialog
import com.mints.goodmoney.ui.widgets.dialog.LoadingDialog
import com.mints.goodmoney.utils.ToastUtil
import java.util.HashMap
......
......@@ -10,7 +10,6 @@ import com.bytedance.sdk.openadsdk.TTFullScreenVideoAd;
import com.mints.goodmoney.common.Constant;
import com.mints.goodmoney.manager.TrackManager;
import com.mints.goodmoney.manager.TtCsjAdManager;
import com.mints.goodmoney.mvp.presenters.CsjFullVedioAdPresenter;
import com.mints.goodmoney.mvp.views.VideoAdManagerView;
/**
......@@ -20,7 +19,6 @@ public class CsjFullVideoAdManager extends BaseVideoAd implements VideoAdManager
private static CsjFullVideoAdManager _inst;
private CsjFullVedioAdPresenter csjFullVedioAdPresenter;
private CsjFullVedioAdListener csjFullVedioAdListener;
Activity activity;
......@@ -46,8 +44,6 @@ public class CsjFullVideoAdManager extends BaseVideoAd implements VideoAdManager
private void init(Activity activity) {
this.activity = activity;
ttAdNative = TTAdSdk.getAdManager().createAdNative(activity);
csjFullVedioAdPresenter = new CsjFullVedioAdPresenter();
csjFullVedioAdPresenter.attachView(this);
}
/**
......@@ -108,7 +104,7 @@ public class CsjFullVideoAdManager extends BaseVideoAd implements VideoAdManager
csjFullVedioAdListener.csjFullVedioAdSuccess();
}
if (activity != null) {
csjFullVedioAdPresenter.reportAddCoinMsg(activity, getAdMapVO(carrierType, Constant.AD_SOURCE_CSJFULL, extraId, curCoin));
TrackManager.getInstance().reportAddCoinMsg(activity, getAdMapVO(carrierType, Constant.AD_SOURCE_CSJFULL, extraId, curCoin));
}
}
......@@ -147,10 +143,6 @@ public class CsjFullVideoAdManager extends BaseVideoAd implements VideoAdManager
mttFullVideoAd.setFullScreenVideoAdInteractionListener(null);
}
if (csjFullVedioAdPresenter != null) {
csjFullVedioAdPresenter.dispose();
csjFullVedioAdPresenter.detachView();
}
activity = null;
}
......
......@@ -41,12 +41,10 @@ public class CsjVideoAdManager extends BaseVideoAd {
private boolean isClickScreen = true; // 是否点击屏幕跳转广告
public static CsjVideoAdManager getInstance(Activity activity) {
if (_inst != null) {
return _inst;
} else {
if (_inst == null) {
_inst = new CsjVideoAdManager(activity);
return _inst;
}
return _inst;
}
private CsjVideoAdManager(Activity activity) {
......@@ -179,7 +177,6 @@ public class CsjVideoAdManager extends BaseVideoAd {
mttRewardVideoAd = ad;
if (mttRewardVideoAd != null) {
mttRewardVideoAd.setRewardAdInteractionListener(new TTRewardVideoAd.RewardAdInteractionListener() {
@Override
......@@ -209,6 +206,8 @@ public class CsjVideoAdManager extends BaseVideoAd {
public void onAdClose() {
TrackManager.getInstance().addCallImp(Constant.AD_SOURCE_CSJ, Constant.EVENT_TYPE_THREE, "", "");
TrackManager.getInstance().reportAddCoinMsg(activity, getAdMapVO(carrierType, Constant.AD_SOURCE_CSJ, extraId, curCoin));
if (csjVideoAdListener != null) {
csjVideoAdListener.csjVideoAdSuccess();
}
......
package com.mints.goodmoney.ad.video
import android.app.Activity
import com.kwad.sdk.api.KsAdSDK
import com.kwad.sdk.api.KsLoadManager
import com.kwad.sdk.api.KsRewardVideoAd
import com.kwad.sdk.api.KsScene
import com.mints.goodmoney.common.AppConfig
import com.mints.goodmoney.common.Constant
import com.mints.goodmoney.manager.KsManager
import com.mints.goodmoney.manager.TrackManager
import com.mints.goodmoney.mvp.views.VideoAdManagerView
import com.mints.goodmoney.utils.LogUtil
import com.mints.goodmoney.utils.ToastUtil
private val TAG = KsVideoAdManager::class.java.simpleName
/**
* 快手广告视频
*/
class KsVideoAdManager private constructor(activity: Activity) :
BaseVideoAd(activity), VideoAdManagerView {
private var ksVideoAdListener: KsVideoAdListener? = null
private var mRewardVideoAd: KsRewardVideoAd? = null
private var isClickScreen: Boolean = true
override var activity: Activity? = null
companion object {
private var _inst: KsVideoAdManager? = null
fun getInstance(activity: Activity): KsVideoAdManager? {
return if (_inst != null) {
_inst
} else {
_inst = KsVideoAdManager(activity)
_inst
}
}
}
init {
init(activity)
}
private fun init(activity: Activity) {
this.activity = activity
}
override fun loadAd(activity: Activity, curCoin: Int, carrierType: String, extraId: String?) {
this.activity = activity
isClickScreen = true
val scene = KsScene.Builder(KsManager.KS_AD_VEDIO_POSTID).build()
KsAdSDK.getLoadManager().loadRewardVideoAd(scene, object : KsLoadManager.RewardVideoAdListener {
override fun onError(p0: Int, p1: String?) {
}
override fun onRewardVideoAdLoad(p0: MutableList<KsRewardVideoAd>?) {
mRewardVideoAd = p0?.get(0)
if (mRewardVideoAd != null && mRewardVideoAd!!.isAdEnable) {
mRewardVideoAd!!.setRewardAdInteractionListener(object : KsRewardVideoAd.RewardAdInteractionListener {
override fun onAdClicked() {
ToastUtil.show(activity, "快手激励视频⼴告点击")
if (AppConfig.needReportClickAdEvent) {
TrackManager.getInstance().reportClickAdEvent()
}
LogUtil.d(TAG, "onADClick")
TrackManager.getInstance().addCallImp(Constant.AD_SOURCE_KS, Constant.EVENT_TYPE_TWO, "", "")
if (isClickScreen) {
// 防止重复
TrackManager.getInstance().addCallImp(Constant.AD_SOURCE_KS, Constant.EVENT_TYPE_FOUR, "", "")
isClickScreen = false
}
if (ksVideoAdListener != null) {
ksVideoAdListener?.ksVideoAdDownload()
}
}
override fun onPageDismiss() {
ToastUtil.show(activity, "快手激励视频⼴告关闭")
TrackManager.getInstance().reportAddCoinMsg(activity, getAdMapVO(carrierType, Constant.AD_SOURCE_KS, extraId, curCoin))
TrackManager.getInstance().addCallImp(Constant.AD_SOURCE_KS, Constant.EVENT_TYPE_THREE, "", "")
if (ksVideoAdListener != null) {
ksVideoAdListener?.ksVideoAdSuccess()
}
}
override fun onVideoPlayError(p0: Int, p1: Int) {
ToastUtil.show(activity, "快手激励视频⼴告播放出错")
TrackManager.getInstance().addCallImp(Constant.AD_SOURCE_KS, Constant.EVENT_TYPE_ONE, (p0).toString(), "")
if (ksVideoAdListener != null) {
ksVideoAdListener?.ksVideoAdFail()
}
}
override fun onVideoPlayEnd() {
ToastUtil.show(activity, "快手激励视频⼴告播放完成")
}
override fun onVideoPlayStart() {
ToastUtil.show(activity, "快手激励视频⼴告播放开始")
}
override fun onRewardVerify() {
ToastUtil.show(activity, "快手激励视频⼴告获取激励")
TrackManager.getInstance().addCallImp(Constant.AD_SOURCE_KS, Constant.EVENT_TYPE_ZERO, "", "")
}
})
// PlayConfig默认竖屏播放,传null
mRewardVideoAd!!.showRewardVideoAd(activity, null)
}
}
})
}
fun setKsVideoAdListener(ksVideoAdListener: KsVideoAdListener?) {
this.ksVideoAdListener = ksVideoAdListener
}
interface KsVideoAdListener {
fun ksVideoAdSuccess()
fun ksVideoAdFail()
fun ksVideoAdDownload()
}
override fun onDestroy() {
mRewardVideoAd = null
activity = null
}
}
\ No newline at end of file
......@@ -6,7 +6,6 @@ import com.mints.goodmoney.common.AppConfig
import com.mints.goodmoney.common.Constant
import com.mints.goodmoney.manager.MhManager
import com.mints.goodmoney.manager.TrackManager
import com.mints.goodmoney.mvp.presenters.MhVideoAdPresenter
import com.mints.goodmoney.mvp.views.VideoAdManagerView
import com.mints.goodmoney.utils.LogUtil
......@@ -18,7 +17,6 @@ private val TAG = MhVideoAdManager::class.java.simpleName
class MhVideoAdManager private constructor(activity: Activity) :
BaseVideoAd(activity), VideoAdManagerView {
private var mhVideoAdPresenter: MhVideoAdPresenter? = null
private var mhVideoAdListener: MhVideoAdListener? = null
private var mRewardVideoAd: RewardVideoAd? = null
......@@ -43,8 +41,6 @@ class MhVideoAdManager private constructor(activity: Activity) :
private fun init(activity: Activity) {
this.activity = activity
mhVideoAdPresenter = MhVideoAdPresenter()
mhVideoAdPresenter?.attachView(this)
}
override fun loadAd(activity: Activity, curCoin: Int, carrierType: String, extraId: String?) {
......@@ -100,7 +96,7 @@ class MhVideoAdManager private constructor(activity: Activity) :
override fun onADClose() {
LogUtil.d(TAG, "onADClose")
mhVideoAdPresenter?.reportAddCoinMsg(activity, getAdMapVO(carrierType, Constant.AD_SOURCE_FL, extraId, curCoin))
TrackManager.getInstance().reportAddCoinMsg(activity, getAdMapVO(carrierType, Constant.AD_SOURCE_FL, extraId, curCoin))
TrackManager.getInstance().addCallImp(Constant.AD_SOURCE_FL, Constant.EVENT_TYPE_THREE, "", "")
......@@ -135,11 +131,6 @@ class MhVideoAdManager private constructor(activity: Activity) :
}
override fun onDestroy() {
mhVideoAdPresenter?.let {
it.dispose()
it.detachView()
}
mRewardVideoAd = null
activity = null
}
......
......@@ -166,6 +166,8 @@ class ShVideoAdManager private constructor(activity: Activity) :
override fun onVideoClosed(@Nullable coralAD: CoralAD?, @Nullable s: String?): Boolean {
LogUtil.d(TAG, "onVideoClosed")
TrackManager.getInstance().reportAddCoinMsg(activity, getAdMapVO(carrierType, Constant.AD_SOURCE_SH, extraId, curCoin))
TrackManager.getInstance().addCallImp(Constant.AD_SOURCE_SH, Constant.EVENT_TYPE_THREE, "", "")
if (shVideoAdListener != null) {
......
......@@ -39,6 +39,7 @@ public class VideoAdingManager {
private MhVideoAdManager mhVideoAdManager;
private ShVideoAdManager shVideoAdManager;
private CsjFullVideoAdManager csjFullVideoAdManager;
private KsVideoAdManager ksVideoAdManager;
private int wnWeight;
private int ylhWeight;
......@@ -46,6 +47,7 @@ public class VideoAdingManager {
private int flVideoWeight;
private int shVideoWeight;
private int csjFullVideoWeight;
private int ksVideoWeight;
private ArrayList<WeightBean> weightList;
......@@ -71,16 +73,17 @@ public class VideoAdingManager {
/**
* 初始化广告manager
*
* @param activity
* @param activity _
*/
private void init(Activity activity) {
this.activity = activity;
csjVideoAdManager = CsjVideoAdManager.getInstance(activity);
ylhVideoAdManager = YlhVideoAdManager.getInstance(activity);
csjFullVideoAdManager = CsjFullVideoAdManager.getInstance(activity);
wnVideoAdManager = WnVideoAdManager.Companion.getInstance(activity);
mhVideoAdManager = MhVideoAdManager.Companion.getInstance(activity);
shVideoAdManager = ShVideoAdManager.Companion.getInstance(activity);
csjFullVideoAdManager = CsjFullVideoAdManager.getInstance(activity);
ksVideoAdManager = KsVideoAdManager.Companion.getInstance(activity);
weightList = new ArrayList<>();
}
......@@ -126,19 +129,21 @@ public class VideoAdingManager {
/**
* 初始化广告权重
*/
public void initAdWeight(int csjVideoWeight, int ylhWeight, int wnWeight, int flVideoWeight, int shVideoWeight, int csjFullVideoWeight) {
public void initAdWeight(int csjVideoWeight, int ylhWeight, int wnWeight, int flVideoWeight,
int shVideoWeight, int csjFullVideoWeight, int ksVideoWeight) {
this.csjVideoWeight = csjVideoWeight;
this.ylhWeight = ylhWeight;
this.wnWeight = wnWeight;
this.flVideoWeight = flVideoWeight;
this.shVideoWeight = shVideoWeight;
this.csjFullVideoWeight = csjFullVideoWeight;
this.ksVideoWeight = ksVideoWeight;
}
/**
* 根据类型加载对应视频(第一次加载)
*
* @param bean
* @param bean _
*/
public void loadAding(Activity activity, VideoAdingBean bean) {
WeakReference<Activity> activityWeakReference = new WeakReference<>(activity);
......@@ -157,7 +162,7 @@ public class VideoAdingManager {
/**
* 根据载体优先加载枫岚
*
* @param bean
* @param bean _
*/
private void firstLoadFlVideo(VideoAdingBean bean) {
String adType;
......@@ -182,7 +187,7 @@ public class VideoAdingManager {
/**
* 加载失败优先级对应视频
*
* @param bean
* @param bean _
*/
public void loadFailAding(Activity activity, VideoAdingBean bean) {
WeakReference<Activity> activityWeakReference = new WeakReference<>(activity);
......@@ -201,7 +206,7 @@ public class VideoAdingManager {
nextAdType = Constant.CSJ_VEDIO_AD;
} else if (AppConfig.ylhAdCount > 0) {
nextAdType = Constant.YLH_VEDIO_AD;
} else if (AppConfig.csjFullVedioAdCount > 0) {
} else if (AppConfig.csjFullVideoAdCount > 0) {
nextAdType = Constant.CSJ_FULL_AD;
} else if (AppConfig.shVideoAdCount > 0) {
nextAdType = Constant.SH_VEDIO_AD;
......@@ -235,7 +240,7 @@ public class VideoAdingManager {
/**
* 高额任务广告类型
*
* @return
* @return _
*/
private String getHighWeight() {
isTTVideoAd = !isTTVideoAd;
......@@ -249,7 +254,7 @@ public class VideoAdingManager {
/**
* 根据权重获取广告类型
*
* @return
* @return _
*/
private String getRandomWeight() {
if (weightList != null) {
......@@ -267,7 +272,7 @@ public class VideoAdingManager {
weight = weight + ylhWeight;
LogUtil.d(TAG, "权重值:ylhWeight:" + ylhWeight);
}
if (AppConfig.csjFullVedioAdCount > 0) {
if (AppConfig.csjFullVideoAdCount > 0) {
weightList.add(new WeightBean(csjFullVideoWeight, Constant.CSJ_FULL_AD));
weight = weight + csjFullVideoWeight;
LogUtil.d(TAG, "权重值:csjFullVedioWeight:" + csjFullVideoWeight);
......@@ -287,6 +292,11 @@ public class VideoAdingManager {
weight = weight + shVideoWeight;
LogUtil.d(TAG, "权重值:shWeight:" + shVideoWeight);
}
if (AppConfig.ksVideoAdCount > 0) {
weightList.add(new WeightBean(ksVideoWeight, Constant.KS_VEDIO_AD));
weight = weight + ksVideoWeight;
LogUtil.d(TAG, "权重值:ksWeight:" + ksVideoWeight);
}
// 权重随机
if (weightList != null && weightList.size() > 0 && weight > 0) {
......@@ -294,7 +304,9 @@ public class VideoAdingManager {
Random r = new Random();
int randomWeight = r.nextInt(weight) + 1;
LogUtil.d(TAG, "2、权重随机值:" + randomWeight);
// ToastUtil.show(MintsApplication.getContext(),"权重随机值:" + randomWeight);
ToastUtil.show(MintsApplication.getContext(), "权重随机值:" + randomWeight);
for (WeightBean weightBean : weightList) {
randomWeight -= weightBean.getWeight();
if (randomWeight <= 0) {
......@@ -368,6 +380,11 @@ public class VideoAdingManager {
shVideoAdManager.onDestroy();
shVideoAdManager = null;
}
if (ksVideoAdManager != null) {
ksVideoAdManager.setKsVideoAdListener(null);
ksVideoAdManager.onDestroy();
ksVideoAdManager = null;
}
if (mReceiverBroadcastReceiver != null) {
activity.stopService(new Intent(activity, AppInstallService.class));
......@@ -623,6 +640,43 @@ public class VideoAdingManager {
});
shVideoAdManager.loadAd(activity, bean.getCurCoin(), bean.getCarrierType(), bean.getExtraId());
} else if (TextUtils.equals(videoAdType, Constant.KS_VEDIO_AD)) {
// 快手广告激励视频
if (ksVideoAdManager == null) {
if (activity == null) {
if (videoAdingListener != null) {
videoAdingListener.videoAdingListenerError(Constant.KS_VEDIO_AD);
}
return;
}
ksVideoAdManager = KsVideoAdManager.Companion.getInstance(activity);
}
ksVideoAdManager.setKsVideoAdListener(new KsVideoAdManager.KsVideoAdListener() {
@Override
public void ksVideoAdSuccess() {
AppConfig.shVideoAdCount--;
if (videoAdingListener != null) {
videoAdingListener.videoAdingListenerSuccess(Constant.SH_VEDIO_AD);
}
}
@Override
public void ksVideoAdFail() {
if (videoAdingListener != null) {
videoAdingListener.videoAdingListenerFail(Constant.SH_VEDIO_AD);
}
}
@Override
public void ksVideoAdDownload() {
isVideoAdDownload = true;
// 注册下载任务监听
registerBroad();
}
});
ksVideoAdManager.loadAd(activity, bean.getCurCoin(), bean.getCarrierType(), bean.getExtraId());
}
} catch (Exception e) {
e.printStackTrace();
......
......@@ -5,7 +5,6 @@ import com.mints.goodmoney.common.AppConfig
import com.mints.goodmoney.common.Constant
import com.mints.goodmoney.manager.TrackManager
import com.mints.goodmoney.manager.WnManager
import com.mints.goodmoney.mvp.presenters.WnVideoAdPresenter
import com.mints.goodmoney.mvp.views.VideoAdManagerView
import com.mints.goodmoney.utils.LogUtil
import com.wannuosili.sdk.*
......@@ -18,7 +17,6 @@ private val TAG = WnVideoAdManager::class.java.simpleName
class WnVideoAdManager private constructor(activity: Activity) :
BaseVideoAd(activity), VideoAdManagerView {
private var wnVideoAdPresenter: WnVideoAdPresenter? = null
private var wnVideoAdListener: WnVideoAdListener? = null
private var mRewardVideoAd: WNRewardVideoAd? = null
......@@ -43,8 +41,6 @@ class WnVideoAdManager private constructor(activity: Activity) :
private fun init(activity: Activity) {
this.activity = activity
wnVideoAdPresenter = WnVideoAdPresenter()
wnVideoAdPresenter?.attachView(this)
}
override fun loadAd(activity: Activity, curCoin: Int, carrierType: String, extraId: String?) {
......@@ -98,7 +94,7 @@ class WnVideoAdManager private constructor(activity: Activity) :
}
override fun onAdClose() {
wnVideoAdPresenter?.reportAddCoinMsg(activity, getAdMapVO(carrierType, Constant.AD_SOURCE_SDHZ, extraId, curCoin))
TrackManager.getInstance().reportAddCoinMsg(activity, getAdMapVO(carrierType, Constant.AD_SOURCE_SDHZ, extraId, curCoin))
TrackManager.getInstance().addCallImp(Constant.AD_SOURCE_SDHZ, Constant.EVENT_TYPE_THREE, "", "")
......@@ -141,11 +137,6 @@ class WnVideoAdManager private constructor(activity: Activity) :
}
override fun onDestroy() {
wnVideoAdPresenter?.let {
it.dispose()
it.detachView()
}
mRewardVideoAd?.let {
it.downloadListener = null
it.interactionListener = null
......
package com.mints.goodmoney.ad.video;
import android.app.Activity;
import android.content.BroadcastReceiver;
import android.content.Intent;
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.TtCsjAdManager;
import com.mints.goodmoney.manager.YlhAdManager;
import com.mints.goodmoney.mvp.presenters.YlhVideoAdPresenter;
import com.mints.goodmoney.mvp.views.VideoAdManagerView;
import com.mints.goodmoney.service.AppInstallService;
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;
......@@ -32,7 +25,6 @@ public class YlhVideoAdManager extends BaseVideoAd implements VideoAdManagerView
// 优量汇激励视频
private RewardVideoAD rewardVideoAD;
private YlhVideoAdPresenter ylhVideoAdPresenter;
private YlhVideoAdListener ylhVideoAdListener;
Activity activity;
......@@ -56,18 +48,10 @@ public class YlhVideoAdManager extends BaseVideoAd implements VideoAdManagerView
private void init(Activity activity) {
this.activity = activity;
ylhVideoAdPresenter = new YlhVideoAdPresenter();
ylhVideoAdPresenter.attachView(this);
}
@Override
public void onDestroy() {
if (ylhVideoAdPresenter != null) {
ylhVideoAdPresenter.dispose();
ylhVideoAdPresenter.detachView();
}
activity = null;
}
......@@ -223,7 +207,7 @@ public class YlhVideoAdManager extends BaseVideoAd implements VideoAdManagerView
public void onADClose() {//激励视频广告被关闭
TrackManager.getInstance().addCallImp(Constant.AD_SOURCE_YLH, Constant.EVENT_TYPE_THREE, "", "");
ylhVideoAdPresenter.reportAddCoinMsg(activity, getAdMapVO(carrierType, Constant.AD_SOURCE_YLH, extraId, curCoin));
TrackManager.getInstance().reportAddCoinMsg(activity, getAdMapVO(carrierType, Constant.AD_SOURCE_YLH, extraId, curCoin));
if (ylhVideoAdListener != null) {
ylhVideoAdListener.ylhVideoAdSuccess();
......
......@@ -77,18 +77,21 @@ public class AppConfig {
*/
public static int wnVideoAdCount = 5;
/**
* flVideo 剩余广告播放数
* csjFull 剩余广告播放数
*/
public static int flVedioAdCount = 5;
public static int csjFullVideoAdCount = 5;
/**
* csjFull 剩余广告播放数
* flVideo 剩余广告播放数
*/
public static int csjFullVedioAdCount = 5;
public static int flVideoAdCount = 5;
/**
* shVideo 剩余广告播放数
*/
public static int shVideoAdCount = 5;
/**
* ksVideo 剩余广告播放数
*/
public static int ksVideoAdCount = 5;
/**
* 高额试玩任务标识
......
......@@ -145,6 +145,7 @@ object Constant {
const val AD_SOURCE_FL = "FL" //枫岚
const val AD_SOURCE_CSJFULL = "CSJFULL"
const val AD_SOURCE_SH = "CORAL" //珊瑚天卓
const val AD_SOURCE_KS = "KS" //快手
// 调用事件 0 成功 1失败 2点击 3-有效展示 4-去重
const val EVENT_TYPE_ZERO = "0"
......@@ -165,6 +166,7 @@ object Constant {
const val FL_VEDIO_AD = "Fl_VEDIO_AD"
const val CSJ_FULL_AD = "CSJFULL_VEDIO_AD"
const val SH_VEDIO_AD = "SH_VEDIO_AD"
const val KS_VEDIO_AD = "KS_VEDIO_AD"
// 游戏类型
const val EVENT_TYPE_CLICK = "CLICK"
......
package com.mints.goodmoney.manager
import android.app.Activity
import android.app.Dialog
import android.content.Context
import android.view.View
import com.mints.goodmoney.MintsApplication
import com.mints.goodmoney.R
import com.mints.goodmoney.ui.widgets.CustomDialogAsApple
import com.mints.goodmoney.ui.widgets.DialogListener
import com.mints.goodmoney.ui.widgets.dialog.CustomDialogAsApple
import com.mints.goodmoney.ui.widgets.dialog.DialogListener
import com.mints.goodmoney.ui.widgets.dialog.DialogUtils
import com.mints.goodmoney.utils.AppUtil
import com.mints.goodmoney.utils.LogUtil
import java.lang.ref.WeakReference
......@@ -27,32 +29,23 @@ object AppTryPlayManager {
return timePkgUsed >= useTime
}
private var cdaa: CustomDialogAsApple? = null
/**
* 打开应用使用记录授权弹框
*/
fun openAppUsageStats(activity: Activity) {
val weakReference = WeakReference<Activity>(activity)
cdaa = CustomDialogAsApple(weakReference.get(), object : DialogListener() {
override fun onClick(v: View) {
if (cdaa != null && cdaa!!.isShowing) {
cdaa!!.dismiss()
}
when (v.id) {
DialogUtils.showDialog(activity as Context, "提示", "该任务需要【应用使用记录】权限", "取消", "打开授权", object : DialogListener() {
override fun onClick(dialog: Dialog?, v: View?) {
dialog?.dismiss()
when (v?.id) {
R.id.dialog_btn_right -> {
AppUtil.openUsageStats(weakReference.get() as Context)
AppUtil.openUsageStats(activity as Context)
}
}
}
})
cdaa?.let {
it.setTitle("提示")
it.setContent("该任务需要【应用使用记录】权限")
it.setLeft("取消")
it.setRight("打开授权")
it.show()
}
}
}
\ No newline at end of file
......@@ -17,9 +17,8 @@ import com.downloader.OnDownloadListener
import com.downloader.PRDownloader
import com.mints.goodmoney.MintsApplication
import com.mints.goodmoney.R
import com.mints.goodmoney.ui.widgets.DownloadProgressDialog
import com.mints.goodmoney.ui.widgets.dialog.DownloadProgressDialog
import com.mints.goodmoney.utils.CacheUtil
import com.mints.goodmoney.utils.LogUtil
import com.mints.goodmoney.utils.MD5
import java.io.File
......
package com.mints.goodmoney.manager
import android.app.Application
import com.kwad.sdk.api.KsAdSDK
import com.kwad.sdk.api.SdkConfig
import com.mints.goodmoney.R
/**
* 描述:快手联盟
* 作者:孟崔广
*/
object KsManager {
private const val KS_APP_ID = "551900002"
/* splash-postid */
const val KS_AD_SPLASH_POSTID = 5519000005
/*信息流*/
val KS_AD_NATIVEEXPRESS_DRAW = 5519000008
const val KS_AD_NATIVEEXPRESS_AWARD = 5519000007
/* vedio-postid */
const val KS_AD_VEDIO_POSTID = 5519000006
/**
* 初始化
*/
fun initKs(application: Application) {
KsAdSDK.init(application, SdkConfig.Builder()
.appId(KS_APP_ID) // 测试aapId,请联系快⼿平台申请正式AppId,必填
.appName(application.getString(R.string.app_name)) // 测试appName,请填写您应⽤的名称,⾮必填
.showNotification(true) // 是否展示下载通知栏
.debug(true) // 是否开启sdk 调试⽇志 可选
.build())
}
}
\ No newline at end of file
......@@ -15,7 +15,7 @@ object MhManager {
/**
* 初始化
*/
fun initWn(application: Application) {
fun initMn(application: Application) {
MaplehazeSDK.init(application)
}
}
\ No newline at end of file
package com.mints.goodmoney.manager;
import android.app.Activity;
import android.text.TextUtils;
import com.mints.goodmoney.MintsApplication;
import com.mints.goodmoney.mvp.presenters.TrackPresenter;
import java.util.HashMap;
/**
* 描述:离线管理器
*/
......@@ -110,4 +113,10 @@ public class TrackManager {
trackPresenter.saveInstallAppRecord(pkg, name, icon);
}
}
public void reportAddCoinMsg(Activity activity, HashMap<String, Object> vo) {
if (trackPresenter != null) {
trackPresenter.reportAddCoinMsg(activity, vo);
}
}
}
......@@ -86,10 +86,12 @@ public class DrawcashBean implements Serializable {
private int YLH_VEDIO;
private int FL_VEDIO;
private int CORAL_VEDIO;
private int KS_VEDIO;
public int getCORAL_VEDIO() {
return CORAL_VEDIO;
}
public int getSDHZ_VEDIO() {
return SDHZ_VEDIO;
}
......@@ -109,6 +111,10 @@ public class DrawcashBean implements Serializable {
public int getFL_VEDIO() {
return FL_VEDIO;
}
public int getKS_VEDIO() {
return KS_VEDIO;
}
}
public class CashOutMoneyArrBean implements Serializable {
......
......@@ -10,6 +10,7 @@ public class VedioRulesBean implements Serializable {
private FLVedioBean FL_VEDIO;
private CsjfullVedioBean CSJFULL_VEDIO;
private CORALVedioBean CORAL_VEDIO;
private KSVedioBean KS_VEDIO;
private boolean flVideoFlag;
public class CsjVedioBean implements Serializable {
......@@ -77,6 +78,19 @@ public class VedioRulesBean implements Serializable {
}
}
public class KSVedioBean implements Serializable {
private int surplus;
private int rate;
public int getSurplus() {
return surplus;
}
public int getRate() {
return rate;
}
}
public class CsjfullVedioBean implements Serializable {
private int surplus;
private int rate;
......@@ -111,6 +125,10 @@ public class VedioRulesBean implements Serializable {
return CORAL_VEDIO;
}
public KSVedioBean getKS_VEDIO() {
return KS_VEDIO;
}
public CsjfullVedioBean getCSJFULL_VEDIO() {
return CSJFULL_VEDIO;
}
......
......@@ -15,6 +15,7 @@ import com.mints.goodmoney.utils.LogUtil
import com.mints.library.net.neterror.BaseSubscriber
import com.mints.library.net.neterror.Throwable
import com.mints.library.utils.json.JsonUtil
import kotlin.collections.HashMap
class TaskPresenter : BasePresenter<TaskView>() {
......@@ -51,7 +52,7 @@ class TaskPresenter : BasePresenter<TaskView>() {
fun cmtImp(url: String) {
AppHttpManager.getInstance(loanApplication)
.call(CpdService.Factory.getInstance().cmtImp(url),
object : BaseSubscriber<Any>() {
object : BaseSubscriber<JsonObject>() {
override fun onCompleted() {
}
......@@ -60,7 +61,7 @@ class TaskPresenter : BasePresenter<TaskView>() {
LogUtil.d("TaskPresenter", "onError->${e.printStackTrace()}")
}
override fun onNext(baseResponse: Any) {
override fun onNext(baseResponse: JsonObject) {
if (isLinkView) return
if (BuildConfig.DEBUG) {
LogUtil.d("TaskPresenter", "onNext->${url} JsonUtil:${JsonUtil.toJson(baseResponse)}")
......
package com.mints.goodmoney.mvp.presenters;
import android.app.Activity;
import com.google.gson.JsonObject;
import com.mints.goodmoney.MintsApplication;
import com.mints.goodmoney.common.AppConfig;
import com.mints.goodmoney.common.Constant;
import com.mints.goodmoney.manager.AppHttpManager;
import com.mints.goodmoney.mvp.model.BaseResponse;
import com.mints.goodmoney.mvp.model.CommonParamBean;
import com.mints.goodmoney.mvp.model.UserTaskMsgBean;
import com.mints.library.net.neterror.BaseSubscriber;
import com.mints.library.net.neterror.Throwable;
import java.util.HashMap;
import rx.android.schedulers.AndroidSchedulers;
public class TrackPresenter extends BaseTrackPresenter {
/**
......@@ -245,4 +249,33 @@ public class TrackPresenter extends BaseTrackPresenter {
}
});
}
/**
* 上送金币信息
*/
public void reportAddCoinMsg(Activity activity, HashMap<String, Object> vo) {
if (activity == null)
return;
loanApplication = (MintsApplication) activity.getApplication();
loanService = loanApplication.getLoanService();
subscription = loanService.reportAddCoinMsg(vo)
.observeOn(AndroidSchedulers.mainThread())
.subscribeOn(loanApplication.defaultSubscribeScheduler())
.subscribe(new BaseSubscriber<BaseResponse<Object>>() {
@Override
public void onCompleted() {
}
@Override
public void onError(Throwable e) {
}
@Override
public void onNext(BaseResponse<Object> baseResponse) {
}
});
}
}
......@@ -6,6 +6,7 @@ import android.text.TextUtils;
import com.google.gson.JsonObject;
import com.mints.goodmoney.BuildConfig;
import com.orhanobut.logger.Logger;
import java.util.concurrent.TimeUnit;
import okhttp3.OkHttpClient;
......@@ -42,11 +43,12 @@ public interface CpdService {
* @return
*/
@GET
Observable<Object> cmtImp(@Url String url);
Observable<JsonObject> cmtImp(@Url String url);
class Factory {
private Factory() { }
private Factory() {
}
private static CpdService sCpdService;
......
package com.mints.goodmoney.service;
import android.app.Activity;
import android.app.Dialog;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
......@@ -8,10 +9,10 @@ import android.os.Bundle;
import android.text.TextUtils;
import android.view.View;
import com.mints.goodmoney.ui.widgets.dialog.DialogUtils;
import com.mints.library.utils.TLog;
import com.mints.goodmoney.ui.activitys.MainActivity;
import com.mints.goodmoney.ui.widgets.CustomDialogAsApple;
import com.mints.goodmoney.ui.widgets.DialogListener;
import com.mints.goodmoney.ui.widgets.dialog.DialogListener;
import com.mints.goodmoney.utils.ForegroundOrBackground;
import org.json.JSONException;
......@@ -25,8 +26,6 @@ public class JpushReceiver extends BroadcastReceiver {
private static final String TAG = "JPush";
private CustomDialogAsApple cdaa;
@Override
public void onReceive(Context context, Intent intent) {
Bundle bundle = intent.getExtras();
......@@ -61,17 +60,13 @@ public class JpushReceiver extends BroadcastReceiver {
Activity forwardActivity = ForegroundOrBackground.getApp_activity();
try {
if (forwardActivity != null && !forwardActivity.isFinishing() && forwardActivity.hasWindowFocus()) {
cdaa = new CustomDialogAsApple(forwardActivity, new DialogListener() {
DialogUtils.INSTANCE.showDialog(forwardActivity, "", "alert", "取消", "确定", new DialogListener() {
@Override
public void onClick(View v) {
if (cdaa != null && cdaa.isShowing()) {
cdaa.dismiss();
}
protected void onClick(Dialog dialog, View v) {
dialog.dismiss();
}
});
cdaa.setContent(alert);
cdaa.setLeft("确定");
cdaa.show();
}
} catch (Exception e) {
}
......
......@@ -8,7 +8,6 @@ import com.mints.goodmoney.MintsApplication
import com.mints.goodmoney.R
import com.mints.goodmoney.common.AppConfig
import com.mints.goodmoney.common.Constant
import com.mints.goodmoney.manager.TtCsjAdManager
import com.mints.goodmoney.ui.activitys.base.BaseActivity
import com.mints.goodmoney.utils.ToastUtil
import com.mints.library.utils.CommonUtils
......
......@@ -13,8 +13,8 @@ import com.mints.goodmoney.mvp.model.AccountMsgBean
import com.mints.goodmoney.mvp.presenters.AccountMergePresenter
import com.mints.goodmoney.mvp.views.AccountMergeView
import com.mints.goodmoney.ui.activitys.base.BaseActivity
import com.mints.goodmoney.ui.widgets.CustomDialogAsApple
import com.mints.goodmoney.ui.widgets.DialogListener
import com.mints.goodmoney.ui.widgets.dialog.CustomDialogAsApple
import com.mints.goodmoney.ui.widgets.dialog.DialogListener
import com.mints.goodmoney.utils.SpanUtils
import com.mints.library.utils.GlideUtils
import kotlinx.android.synthetic.main.activity_account_merge.*
......
......@@ -9,6 +9,7 @@ import android.os.Bundle
import android.text.TextUtils
import android.view.KeyEvent
import android.view.View
import android.widget.FrameLayout
import androidx.core.content.ContextCompat
import com.mints.goodmoney.R
import com.mints.goodmoney.ad.express.PreLoadExpressManager
......
......@@ -49,7 +49,7 @@ class BindMobileActivity : BaseActivity(), LoginView, View.OnClickListener {
finish()
}
R.id.tvLoginSendcode -> {
var mobile = etLoginMobile.getText().toString().trim()
var mobile = etLoginMobile.text.toString().trim()
if (mobile.length < 13) {
showToast("请输入手机号")
return
......@@ -60,13 +60,13 @@ class BindMobileActivity : BaseActivity(), LoginView, View.OnClickListener {
loginPresenter.sendMobileBindingCode(mobile)
}
R.id.tvLoginNext -> {
var mobile = etLoginMobile.getText().toString().trim()
var mobile = etLoginMobile.text.toString().trim()
if (mobile.length < 13) {
showToast("请输入手机号")
return
}
var code = etLoginCode.getText().toString().trim()
val code = etLoginCode.text.toString().trim()
if (code.length < 4) {
showToast("请输入验证码")
return
......@@ -130,17 +130,17 @@ class BindMobileActivity : BaseActivity(), LoginView, View.OnClickListener {
fun sendCodeThread() {
num = 60
tvLoginSendcode?.let {
it.setEnabled(false)
it.setText("($num)重新获取")
it.isEnabled = false
it.text = "($num)重新获取"
run = object : Runnable {
override fun run() {
num--
if (num == 0) {
it.setText("重新获取")
it.setEnabled(true)
it.text = "重新获取"
it.isEnabled = true
} else {
it.setText("($num)重新获取")
it.text = "($num)重新获取"
it.postDelayed(this, 1000)
}
}
......
......@@ -16,6 +16,8 @@ import com.mints.goodmoney.utils.MD5
import com.mints.goodmoney.utils.URIEncoder
import kotlinx.android.synthetic.main.fragment_main_dh.*
import kotlinx.android.synthetic.main.header_layout.*
import java.util.*
import kotlin.collections.HashMap
class DhGameActivity : BaseActivity(), View.OnClickListener {
......@@ -49,8 +51,9 @@ class DhGameActivity : BaseActivity(), View.OnClickListener {
dh_webview?.let {
it.destroyDrawingCache()
val parent = it.getParent() as ViewGroup
parent.removeView(it)
(it.parent as ViewGroup).apply {
removeView(it)
}
it.removeAllViews()
it.destroy()
}
......@@ -83,14 +86,13 @@ class DhGameActivity : BaseActivity(), View.OnClickListener {
}
settings.javaScriptEnabled = true
settings.javaScriptCanOpenWindowsAutomatically = true
it.setWebViewClient(object : WebViewClient() {
it.webViewClient = object : WebViewClient() {
override fun shouldOverrideUrlLoading(
view: android.webkit.WebView,
url: String
): Boolean {
if (url.startsWith("weixin://wap/pay?") || url.startsWith("alipay")) {
val hasApp: Boolean
hasApp = if (url.startsWith("weixin://wap/pay?")) {
val hasApp: Boolean = if (url.startsWith("weixin://wap/pay?")) {
isAppExist("com.tencent.mm")
} else {
(isAppExist("com.eg.android.AlipayGphone") || isAppExist("com.alipay.android.app"))
......@@ -113,7 +115,7 @@ class DhGameActivity : BaseActivity(), View.OnClickListener {
}
return super.shouldOverrideUrlLoading(view, url)
}
})
}
it.loadUrl(loadUrl)
}
}
......@@ -123,8 +125,8 @@ class DhGameActivity : BaseActivity(), View.OnClickListener {
*/
fun getLoadUrl(): String {
val currentTimeMillis = System.currentTimeMillis() / 1000
val loadUrl = "${AUTH_URL}?" +
"channel=${CHANNEL}&" +
return "$AUTH_URL?" +
"channel=$CHANNEL&" +
"openid=${URIEncoder.encodeURIComponent(UserManager.getInstance().userID)}&" +
"time=${currentTimeMillis}&" +
"nick=${URIEncoder.encodeURIComponent(UserManager.getInstance().userID)}&" +
......@@ -133,7 +135,6 @@ class DhGameActivity : BaseActivity(), View.OnClickListener {
"phone=${UserManager.getInstance().mobile}&" +
"sdw_simple=${2}&" +
"sign=${getSignStr(currentTimeMillis)}"
return loadUrl
}
/**
......@@ -147,16 +148,16 @@ class DhGameActivity : BaseActivity(), View.OnClickListener {
"avatar=https://mints-pkg.oss-cn-beijing.aliyuncs.com/pkg_goodmoney/img/ic_my.png&" +
"sex=${0}&" +
"phone=${UserManager.getInstance().mobile}${KEY}"
return MD5.GetMD5Code(signStr).toLowerCase()
return MD5.GetMD5Code(signStr).toLowerCase(Locale.ROOT)
}
fun isAppExist(pkgName: String): Boolean {
var info: ApplicationInfo? = null
try {
info = context?.getPackageManager()!!.getApplicationInfo(pkgName, 0)
info = context?.packageManager!!.getApplicationInfo(pkgName, 0)
context!!.startActivity(context!!.packageManager.getLaunchIntentForPackage(pkgName))
} catch (e: Exception) {
}
return if (info != null) true else false
return info != null
}
}
\ No newline at end of file
......@@ -21,8 +21,7 @@ import com.mints.goodmoney.mvp.views.DrawcashView
import com.mints.goodmoney.ui.activitys.base.BaseActivity
import com.mints.goodmoney.ui.adapter.DrawcashAdapter
import com.mints.goodmoney.ui.adapter.listener.OnItemClickListener
import com.mints.goodmoney.ui.widgets.DrawcashVideoDialog
import com.mints.goodmoney.ui.widgets.JDTintDialog
import com.mints.goodmoney.ui.widgets.dialog.DrawcashVideoDialog
import com.mints.goodmoney.utils.LogUtil
import com.mints.library.utils.CommonUtils
import com.mints.library.utils.json.JsonUtil
......@@ -32,6 +31,8 @@ import kotlinx.android.synthetic.main.view_title.*
import java.math.BigDecimal
import java.util.*
private val TAG = DrawcashActivity::class.java.simpleName
/**
* 描述:提现
* 作者:孟崔广
......@@ -40,8 +41,6 @@ import java.util.*
class DrawcashActivity : BaseActivity(),
DrawcashView, View.OnClickListener, OnItemClickListener, OnLoginListener, CompoundButton.OnCheckedChangeListener {
private val TAG = DrawcashActivity::class.java.simpleName
private var drawcashVideoDialog: DrawcashVideoDialog? = null
private lateinit var vedioAdingManager: VideoAdingManager
......@@ -57,7 +56,7 @@ class DrawcashActivity : BaseActivity(),
// private var isJDNewUser = false
// private var jumpJdUrl: String? = null
private var jdTintDialog: JDTintDialog? = null
// private var jdTintDialog: JDTintDialog? = null
override fun getContentViewLayoutID() = R.layout.activity_drawcash
......@@ -188,11 +187,11 @@ class DrawcashActivity : BaseActivity(),
tvDrawcashHint.text = data.drawcashHint
tvDrawcashGold.text = CommonUtils.formatString(data.coin.toString())
if (TextUtils.isEmpty(data.openid)) {
tvDrawcashWx.setText("去授权")
tvDrawcashName.setText("微信昵称")
tvDrawcashWx.text = "去授权"
tvDrawcashName.text = "微信昵称"
} else {
tvDrawcashWx.setText("已授权")
tvDrawcashName.setText(data.nickName)
tvDrawcashWx.text = "已授权"
tvDrawcashName.text = data.nickName
}
// if (data.isJDNewUser) {
......@@ -230,7 +229,7 @@ class DrawcashActivity : BaseActivity(),
val allcoinBig = BigDecimal(data.coin.toString())
val rateBig = BigDecimal("10000")
val cashStr: String = allcoinBig.divide(rateBig).setScale(2, BigDecimal.ROUND_DOWN).toString()
tvDrawcashGoldabout.setText("约" + cashStr + "元")
tvDrawcashGoldabout.text = "约" + cashStr + "元"
}
override fun editUserMsgSuc() {
......@@ -251,14 +250,14 @@ class DrawcashActivity : BaseActivity(),
try {
wxInfo = WXInfo()
wxInfo?.let {
it.setUnionid(res["unionid"].toString() + "")
it.setOpenid(res["openid"].toString() + "")
it.setProvince(res["province"].toString() + "")
it.setCity(res["city"].toString() + "")
it.setCountry(res["country"].toString() + "")
it.setHeadimgurl(res["headimgurl"].toString() + "")
it.setNickname(res["nickname"].toString() + "")
it.setSex((res["sex"].toString() + "").toInt())
it.unionid = res["unionid"].toString() + ""
it.openid = res["openid"].toString() + ""
it.province = res["province"].toString() + ""
it.city = res["city"].toString() + ""
it.country = res["country"].toString() + ""
it.headimgurl = res["headimgurl"].toString() + ""
it.nickname = res["nickname"].toString() + ""
it.sex = (res["sex"].toString() + "").toInt()
}
if (!isFinishing) {
......@@ -298,25 +297,31 @@ class DrawcashActivity : BaseActivity(),
* 设置视频权重
*/
private fun initAdWeight(data: DrawcashBean.VedioRules) {
vedioAdingManager.initAdWeight(data.csJ_VEDIO,
vedioAdingManager.initAdWeight(
data.csJ_VEDIO,
data.ylH_VEDIO,
data.sdhZ_VEDIO,
data.fL_VEDIO,
data.coraL_VEDIO,
data.csjfulL_VEDIO)
data.csjfulL_VEDIO,
data.kS_VEDIO
)
LogUtil.d(TAG, "提现权重值:csjWeight:${data.csJ_VEDIO} " +
"ylhWeight:${data.ylH_VEDIO} " +
"sdhzWeight:${data.sdhZ_VEDIO} " +
"csjFullWeight:${data.csjfulL_VEDIO} " +
"shWeight:${data.coraL_VEDIO} " +
"flWeight:${data.fL_VEDIO}")
"flWeight:${data.fL_VEDIO} " +
"ksWeight:${data.kS_VEDIO}"
)
// 广告视频数
AppConfig.csjVideoAdCount = 10
AppConfig.ylhAdCount = 10
AppConfig.wnVideoAdCount = 10
AppConfig.flVideoAdCount = 10
AppConfig.shVideoAdCount = 10
AppConfig.csjFullVedioAdCount = 10
AppConfig.csjFullVideoAdCount = 10
AppConfig.ksVideoAdCount = 10
}
/**
......@@ -344,7 +349,7 @@ class DrawcashActivity : BaseActivity(),
}
override fun checkJDNewUsersSuc(isJdNewUser: Boolean, JDUrl: String?) {
jdTintDialog?.dismiss()
// jdTintDialog?.dismiss()
if (isJdNewUser) {
JDUrl?.let {
......@@ -360,7 +365,7 @@ class DrawcashActivity : BaseActivity(),
}
override fun checkJDNewUsersFail() {
jdTintDialog?.dismiss()
// jdTintDialog?.dismiss()
showToast("手机号已注册京东金融")
}
......
......@@ -26,7 +26,7 @@ class FoodSubsidyActivity : BaseActivity(), View.OnClickListener, FoodSubsidyVie
private var curCoin = 0//点击的汽泡金币
private var buttonCoin = 0//点击的汽泡金币
private var isCanClickVedio = false
private var isCanClickVideo = false
override fun getContentViewLayoutID() = R.layout.activity_food_subsidy
......@@ -74,7 +74,7 @@ class FoodSubsidyActivity : BaseActivity(), View.OnClickListener, FoodSubsidyVie
readyGo(AwardActivity::class.java, bundle)
} else {
if (isCanClickVedio) {
if (isCanClickVideo) {
val bundle = Bundle()
bundle.putInt(Constant.MAIN_CUR_COIN, curCoin)
bundle.putString(Constant.MAIN_CARRIER_TYPE, Constant.CARRIER_EATMEAL_SUBSIDY)
......@@ -114,7 +114,7 @@ class FoodSubsidyActivity : BaseActivity(), View.OnClickListener, FoodSubsidyVie
curCoin = data.vedioCoin
buttonCoin = data.buttonCoin
this.isCanClickVedio = data.isCanClickVedio
this.isCanClickVideo = data.isCanClickVedio
for (i in 0 until data.vedioCount) {
svWalk.setWaterTextviewLayout(i + 1, 0)
......
......@@ -2,6 +2,7 @@ package com.mints.goodmoney.ui.activitys
import android.os.Bundle
import android.view.View
import androidx.core.content.ContextCompat
import com.cmcm.cmgame.*
import com.google.gson.JsonParser
import com.mints.goodmoney.R
......@@ -21,7 +22,8 @@ import java.util.*
* 时间:2020/10/12 10:09
*/
class LiebaoGameActivity : BaseActivity(),
View.OnClickListener, GameView,
View.OnClickListener,
GameView,
IAppCallback,
IGamePlayTimeCallback,
IGameAdCallback,
......@@ -95,9 +97,9 @@ class LiebaoGameActivity : BaseActivity(),
tvGameHint.text = "今日游戏任务已完成"
} else {
tvGameHint.text = SpanUtils()
.append("畅玩").append("${sumTime / 60}").setForegroundColor(mContext.resources.getColor(R.color.color_FF9837)).append("分钟, ")
.append("奖励").append("$sumCoin").setForegroundColor(mContext.resources.getColor(R.color.color_cb4a39)).append("金币, ")
.append("已玩").append("${gameTime / 60}").setForegroundColor(mContext.resources.getColor(R.color.color_FF9837)).append("分钟")
.append("畅玩").append("${sumTime / 60}").setForegroundColor(ContextCompat.getColor(mContext, R.color.color_FF9837)).append("分钟, ")
.append("奖励").append("$sumCoin").setForegroundColor(ContextCompat.getColor(mContext, R.color.color_cb4a39)).append("金币, ")
.append("已玩").append("${gameTime / 60}").setForegroundColor(ContextCompat.getColor(mContext, R.color.color_FF9837)).append("分钟")
.create()
}
}
......
......@@ -2,6 +2,7 @@ package com.mints.goodmoney.ui.activitys
import android.os.Bundle
import android.view.View
import androidx.core.content.ContextCompat
import androidx.recyclerview.widget.GridLayoutManager
import com.mints.goodmoney.R
import com.mints.goodmoney.ad.video.VideoAdingManager
......@@ -22,8 +23,7 @@ import kotlinx.android.synthetic.main.activity_morning_clock.*
* 作者:孟崔广
* 时间:2020/11/18 19:19
*/
class MorningClockActivity : BaseActivity()
, View.OnClickListener, MorningClockView {
class MorningClockActivity : BaseActivity(), View.OnClickListener, MorningClockView {
private val morningClockPresenter by lazy { MorningClockPresenter() }
private lateinit var morningClockAdapter: MorningClockAdapter
......@@ -73,16 +73,16 @@ class MorningClockActivity : BaseActivity()
morningClockList = data.targetList
if (data.isCanClick) {
tvMorningClockClick.background = resources.getDrawable(R.drawable.shape_water_btn)
tvMorningClockClick.background = ContextCompat.getDrawable(mContext, R.drawable.shape_water_btn)
tvMorningClockClick.isEnabled = true
} else {
tvMorningClockClick.background = resources.getDrawable(R.drawable.shape_tv_gold_none)
tvMorningClockClick.background = ContextCompat.getDrawable(mContext, R.drawable.shape_tv_gold_none)
tvMorningClockClick.isEnabled = false
}
tvMorningClockClick.text = data.buttonMsg
tvMorningClockDay.text = SpanUtils()
.append("打卡领金币 已连续打卡")
.append("${data.continuityDays}").setForegroundColor(resources.getColor(R.color.color_FF9837))
.append("${data.continuityDays}").setForegroundColor(ContextCompat.getColor(mContext, R.color.color_FF9837))
.append("天")
.create()
......
package com.mints.goodmoney.ui.activitys
import android.annotation.SuppressLint
import android.app.Dialog
import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
......@@ -22,8 +23,8 @@ import com.mints.goodmoney.mvp.model.WXInfo
import com.mints.goodmoney.mvp.presenters.SettingsPresenter
import com.mints.goodmoney.mvp.views.SettingsView
import com.mints.goodmoney.ui.activitys.base.BaseActivity
import com.mints.goodmoney.ui.widgets.CustomDialogAsApple
import com.mints.goodmoney.ui.widgets.DialogListener
import com.mints.goodmoney.ui.widgets.dialog.DialogListener
import com.mints.goodmoney.ui.widgets.dialog.DialogUtils
import com.mints.goodmoney.utils.CacheUtil
import com.mints.library.utils.json.JsonUtil
import com.mints.library.utils.nodoubleclick.AntiShake
......@@ -33,7 +34,6 @@ import java.util.*
class SettingsActivity : BaseActivity(), View.OnClickListener, OnLoginListener, SettingsView {
private lateinit var cdaa: CustomDialogAsApple
private val userManager by lazy { UserManager.getInstance() }
private val settingsPresenter by lazy { SettingsPresenter() }
private val loginApi by lazy { LoginApi() }
......@@ -83,7 +83,7 @@ class SettingsActivity : BaseActivity(), View.OnClickListener, OnLoginListener,
btn_switch.setOnClickListener(this)
item_phone.findViewById<TextView>(R.id.tv_title).text = "手机号"
val phone = ContextCompat.getDrawable(this,R.mipmap.icon_settings_tel)
val phone = ContextCompat.getDrawable(this, R.mipmap.icon_settings_tel)
phone?.setBounds(0, 0, 56, 56)
item_phone.findViewById<TextView>(R.id.tv_title).setCompoundDrawables(phone, null, null, null)
item_phone.findViewById<TextView>(R.id.tv_right).visibility = View.VISIBLE
......@@ -107,15 +107,15 @@ class SettingsActivity : BaseActivity(), View.OnClickListener, OnLoginListener,
}
item_invitedCode.findViewById<TextView>(R.id.tv_title).text = "邀请码"
val invitedCode = resources.getDrawable(R.mipmap.icon_settings_invite)
invitedCode.setBounds(0, 0, 56, 56)
val invitedCode = ContextCompat.getDrawable(mContext, R.mipmap.icon_settings_invite)
invitedCode?.setBounds(0, 0, 56, 56)
item_invitedCode.findViewById<TextView>(R.id.tv_title).setCompoundDrawables(invitedCode, null, null, null)
item_invitedCode.findViewById<TextView>(R.id.tv_right).visibility = View.VISIBLE
item_invitedCode.findViewById<ImageView>(R.id.iv_right).visibility = View.GONE
item_invitedCode.findViewById<TextView>(R.id.tv_right).text = UserManager.getInstance().codeID
item_cleanCache.findViewById<TextView>(R.id.tv_title).text = "清理缓存"
val cleanCache = ContextCompat.getDrawable(this,R.mipmap.icon_settings_clean)
val cleanCache = ContextCompat.getDrawable(this, R.mipmap.icon_settings_clean)
cleanCache?.setBounds(0, 0, 56, 56)
item_cleanCache.findViewById<TextView>(R.id.tv_title).setCompoundDrawables(cleanCache, null, null, null)
item_cleanCache.findViewById<TextView>(R.id.tv_right).visibility = View.VISIBLE
......@@ -123,28 +123,28 @@ class SettingsActivity : BaseActivity(), View.OnClickListener, OnLoginListener,
item_cleanCache.findViewById<TextView>(R.id.tv_right).text = CacheUtil.getTotalCacheSize(this)
item_userAgree.findViewById<TextView>(R.id.tv_title).text = "服务协议"
val userAgree = ContextCompat.getDrawable(this,R.mipmap.icon_settings_user)
val userAgree = ContextCompat.getDrawable(this, R.mipmap.icon_settings_user)
userAgree?.setBounds(0, 0, 56, 56)
item_userAgree.findViewById<TextView>(R.id.tv_title).setCompoundDrawables(userAgree, null, null, null)
item_userAgree.findViewById<TextView>(R.id.tv_right).visibility = View.GONE
item_userAgree.findViewById<ImageView>(R.id.iv_right).visibility = View.VISIBLE
item_privacyAgree.findViewById<TextView>(R.id.tv_title).text = "隐私协议"
val privacyAgree = ContextCompat.getDrawable(this,R.mipmap.icon_settings_privacy)
val privacyAgree = ContextCompat.getDrawable(this, R.mipmap.icon_settings_privacy)
privacyAgree?.setBounds(0, 0, 56, 56)
item_privacyAgree.findViewById<TextView>(R.id.tv_title).setCompoundDrawables(privacyAgree, null, null, null)
item_privacyAgree.findViewById<TextView>(R.id.tv_right).visibility = View.GONE
item_privacyAgree.findViewById<ImageView>(R.id.iv_right).visibility = View.VISIBLE
item_aboutUs.findViewById<TextView>(R.id.tv_title).text = "关于我们"
val aboutUs = ContextCompat.getDrawable(this,R.mipmap.icon_settings_about)
val aboutUs = ContextCompat.getDrawable(this, R.mipmap.icon_settings_about)
aboutUs?.setBounds(0, 0, 56, 56)
item_aboutUs.findViewById<TextView>(R.id.tv_title).setCompoundDrawables(aboutUs, null, null, null)
item_aboutUs.findViewById<TextView>(R.id.tv_right).visibility = View.GONE
item_aboutUs.findViewById<ImageView>(R.id.iv_right).visibility = View.VISIBLE
item_feedBack.findViewById<TextView>(R.id.tv_title).text = "问题反馈"
val feedBack = ContextCompat.getDrawable(this,R.mipmap.icon_settings_feedback)
val feedBack = ContextCompat.getDrawable(this, R.mipmap.icon_settings_feedback)
feedBack?.setBounds(0, 0, 56, 56)
item_feedBack.findViewById<TextView>(R.id.tv_title).setCompoundDrawables(feedBack, null, null, null)
item_feedBack.findViewById<TextView>(R.id.tv_right).visibility = View.GONE
......@@ -217,12 +217,11 @@ class SettingsActivity : BaseActivity(), View.OnClickListener, OnLoginListener,
}
private fun backDialog() {
cdaa = CustomDialogAsApple(context, object : DialogListener() {
override fun onClick(v: View) {
if (cdaa.isShowing) {
cdaa.dismiss()
}
when (v.id) {
DialogUtils.showDialog(context, "", "确定要退出登录吗?", "确定", "取消", object : DialogListener() {
override fun onClick(dialog: Dialog?, v: View?) {
dialog?.dismiss()
when (v?.id) {
R.id.dialog_btn_left -> {
UserManager.getInstance().userLogout()
readyGoThenKill(MainActivity::class.java)
......@@ -230,10 +229,7 @@ class SettingsActivity : BaseActivity(), View.OnClickListener, OnLoginListener,
}
}
})
cdaa.setContent("确定要退出登录吗?")
cdaa.setLeft("确定")
cdaa.setRight("取消")
cdaa.show()
}
private fun submitInvitedCode() {
......@@ -264,15 +260,11 @@ class SettingsActivity : BaseActivity(), View.OnClickListener, OnLoginListener,
}
private fun clearDialog() {
cdaa = CustomDialogAsApple(context, object : DialogListener() {
override fun onClick(v: View) {
if (cdaa.isShowing) {
cdaa.dismiss()
}
when (v.id) {
R.id.dialog_btn_left -> {
DialogUtils.showDialog(context, "提示", "确定清除缓存吗?", "取消", "确定", object : DialogListener() {
override fun onClick(dialog: Dialog?, v: View?) {
dialog?.dismiss()
}
when (v?.id) {
R.id.dialog_btn_right -> {
CacheUtil.clearAllCache(context)
item_cleanCache.findViewById<TextView>(R.id.tv_right).text = "0KB"
......@@ -280,11 +272,6 @@ class SettingsActivity : BaseActivity(), View.OnClickListener, OnLoginListener,
}
}
})
cdaa.setTitle("提示")
cdaa.setContent("确定清除缓存吗?")
cdaa.setLeft("取消")
cdaa.setRight("确定")
cdaa.show()
}
override fun onLogin(platform: String?, res: HashMap<String, Any>): Boolean {
......
......@@ -8,16 +8,13 @@ import android.view.KeyEvent
import android.view.View
import android.view.ViewGroup
import android.widget.TextView
import com.mints.goodmoney.MintsApplication
import com.mints.goodmoney.R
import com.mints.goodmoney.manager.YlhAdManager
import com.mints.goodmoney.ui.activitys.base.BaseActivity
import com.mints.goodmoney.utils.ToastUtil
import com.mints.library.net.netstatus.NetUtils
import com.qq.e.ads.splash.SplashAD
import com.qq.e.ads.splash.SplashADListener
import com.qq.e.comm.util.AdError
import com.yilan.sdk.ui.little.YLLittleVideoFragment
/**
* 后台返回时每次都展示
......
......@@ -59,7 +59,7 @@ class SplashActivity : BaseActivity() {
* 校验App签名
*/
private fun checkAppSign() {
val deviceInfo: DeviceInfo = DeviceInfo.instance!!
val deviceInfo: DeviceInfo = DeviceInfo.instance
if (!deviceInfo.signInfo) {
finish()
} else {
......
package com.mints.goodmoney.ui.activitys
import android.os.Handler
import android.os.Looper
import android.view.KeyEvent
import android.view.View
import android.view.ViewGroup
import com.kwad.sdk.api.KsAdSDK
import com.kwad.sdk.api.KsLoadManager
import com.kwad.sdk.api.KsScene
import com.kwad.sdk.api.KsSplashScreenAd
import com.mints.goodmoney.R
import com.mints.goodmoney.manager.KsManager
import com.mints.goodmoney.ui.activitys.base.BaseActivity
import com.mints.goodmoney.utils.LogUtil
import com.mints.library.net.netstatus.NetUtils
private val TAG = SplashKsADActivity::class.java.simpleName
/**
* 后台返回时每次都展示 快手广告
*/
class SplashKsADActivity : BaseActivity() {
private var container: ViewGroup? = null
private var mIsPaused = false
var canJump = false
/**
* 记录拉取广告的时间
*/
private val handler = Handler(Looper.getMainLooper())
override fun getContentViewLayoutID(): Int {
return R.layout.activity_splash_ylh
}
override fun initViewsAndEvents() {
if (!NetUtils.isNetworkConnected(context)) {
finish()
} else {
try {
container = findViewById<View>(R.id.splash_container) as ViewGroup
requestSplashScreenAd()
} catch (e: Exception) {
readyGoOtherActivity()
}
}
}
private fun addView(splashScreenAd: KsSplashScreenAd) {
val view = splashScreenAd.getView(this, object : KsSplashScreenAd.SplashScreenAdInteractionListener {
override fun onAdClicked() {
canJump = true
LogUtil.d(TAG, "onAdClicked")
}
override fun onAdShowError(p0: Int, p1: String?) {
LogUtil.d(TAG, "onAdShowError -> $p1")
next()
}
override fun onAdShowEnd() {
LogUtil.d(TAG, "onAdShowEnd")
next()
}
override fun onAdShowStart() {
LogUtil.d(TAG, "onAdShowStart")
}
override fun onSkippedAd() {
LogUtil.d(TAG, "onSkippedAd")
next()
}
})
if (!isFinishing) {
container?.removeAllViews()
view.layoutParams = ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
ViewGroup.LayoutParams.MATCH_PARENT)
container?.addView(view)
}
}
override fun isApplyKitKatTranslucency(): Boolean {
return false
}
private fun requestSplashScreenAd() {
val scene = KsScene
.Builder(KsManager.KS_AD_SPLASH_POSTID)
.build()
KsAdSDK.getLoadManager().loadSplashScreenAd(scene, object : KsLoadManager.SplashScreenAdListener {
override fun onError(p0: Int, p1: String?) {
LogUtil.d(TAG, "onError -> $p1")
next()
}
override fun onSplashScreenAdLoad(p0: KsSplashScreenAd?) {
LogUtil.d(TAG, "onSplashScreenAdLoad")
addView(p0!!)
}
})
}
/**
* 设置一个变量来控制当前开屏页面是否可以跳转,当开屏广告为普链类广告时,点击会打开一个广告落地页,此时开发者还不能打开自己的App主页。当从广告落地页返回以后,
* 才可以跳转到开发者自己的App主页;当开屏广告是App类广告时只会下载App。
*/
private operator fun next() {
if (mIsPaused) {
canJump = true
} else {
readyGoOtherActivity()
}
}
override fun onPause() {
super.onPause()
mIsPaused = true
}
override fun onResume() {
super.onResume()
mIsPaused = false
if (canJump) {
next()
}
}
override fun onDestroy() {
super.onDestroy()
handler.removeCallbacksAndMessages(null)
}
/**
* 开屏页一定要禁止用户对返回按钮的控制,否则将可能导致用户手动退出了App而广告无法正常曝光和计费
*/
override fun onKeyDown(keyCode: Int, event: KeyEvent): Boolean {
return if (keyCode == KeyEvent.KEYCODE_BACK) {
true
} else super.onKeyDown(keyCode, event)
}
private fun readyGoOtherActivity() {
finish()
}
}
\ No newline at end of file
package com.mints.goodmoney.ui.activitys
import android.app.Dialog
import android.view.View
import androidx.fragment.app.Fragment
import androidx.viewpager.widget.ViewPager
......@@ -9,8 +10,8 @@ import com.mints.goodmoney.ui.activitys.base.BaseActivity
import com.mints.goodmoney.ui.adapter.MessageFragAdapter
import com.mints.goodmoney.ui.fragment.TaskCpdFragment
import com.mints.goodmoney.ui.fragment.TaskCpdHistoryFragment
import com.mints.goodmoney.ui.widgets.CustomDialogAsApple
import com.mints.goodmoney.ui.widgets.DialogListener
import com.mints.goodmoney.ui.widgets.dialog.DialogListener
import com.mints.goodmoney.ui.widgets.dialog.DialogUtils
import com.mints.goodmoney.utils.CacheUtil
import kotlinx.android.synthetic.main.activity_task_cpd.*
import kotlinx.android.synthetic.main.header_layout.*
......@@ -22,8 +23,6 @@ import kotlinx.android.synthetic.main.header_layout.*
*/
class TaskCpdActivity : BaseActivity(), View.OnClickListener {
private var cdaa: CustomDialogAsApple? = null
override fun getContentViewLayoutID() = R.layout.activity_task_cpd
override fun isApplyKitKatTranslucency() = false
......@@ -39,12 +38,6 @@ class TaskCpdActivity : BaseActivity(), View.OnClickListener {
initListener()
}
override fun onDestroy() {
super.onDestroy()
cdaa = null
}
override fun onBackPressed() {
backDialog()
}
......@@ -85,23 +78,17 @@ class TaskCpdActivity : BaseActivity(), View.OnClickListener {
}
private fun backDialog() {
cdaa = CustomDialogAsApple(this, object : DialogListener() {
override fun onClick(v: View) {
if (cdaa != null && cdaa!!.isShowing) {
cdaa!!.dismiss()
}
when (v.id) {
DialogUtils.showDialog(context, "提示", "退出当前页面将会重置当前任务状态", "取消", "确定", object : DialogListener() {
override fun onClick(dialog: Dialog?, v: View?) {
dialog?.dismiss()
when (v?.id) {
R.id.dialog_btn_right -> {
finish()
}
}
}
})
cdaa!!.setTitle("提示")
cdaa!!.setContent("退出当前页面将会重置当前任务状态")
cdaa!!.setLeft("取消")
cdaa!!.setRight("确定")
cdaa!!.show()
}
}
......@@ -45,7 +45,7 @@ class WrapperActivity : BaseActivity(), View.OnClickListener {
}
private fun initPage() {
var currentFragment: Fragment? = null
var currentFragment: Fragment?
when (wrapperType) {
Constant.WRAPPER_TYPE_NEWS -> {
tv_title.text = "新闻"
......@@ -67,12 +67,16 @@ class WrapperActivity : BaseActivity(), View.OnClickListener {
layoutWrapper.visibility = View.GONE
currentFragment = WzFragment(true)
}
else -> {
tv_title.text = "书城"
currentFragment = MyZhangyueFragment()
}
}
if (!currentFragment!!.isAdded) {
if (!currentFragment.isAdded) {
// 提交事务
supportFragmentManager.beginTransaction()
.add(R.id.flWrapper, currentFragment!!).commitAllowingStateLoss()
.add(R.id.flWrapper, currentFragment).commitAllowingStateLoss()
}
}
......
......@@ -71,14 +71,14 @@ class XmlyAwardActivity : BaseActivity(), View.OnClickListener {
mTimer?.setOnCountDownTimerListener(object : OnCountDownTimerListener {
override fun onTick(millisUntilFinished: Long) {
if (!this@XmlyAwardActivity.isFinishing) {
tvAwardBack?.setText("${millisUntilFinished / 1000}")
tvAwardBack?.text = "${millisUntilFinished / 1000}"
}
}
override fun onFinish() {
if (!this@XmlyAwardActivity.isFinishing) {
ivAwardBack?.setVisibility(View.VISIBLE)
tvAwardBack?.setVisibility(View.GONE)
ivAwardBack?.visibility = View.VISIBLE
tvAwardBack?.visibility = View.GONE
}
}
})
......
......@@ -13,17 +13,14 @@ import androidx.core.content.ContextCompat;
import android.text.TextUtils;
import android.view.KeyEvent;
import android.view.MotionEvent;
import android.view.View;
import android.view.WindowManager;
import android.view.inputmethod.InputMethodManager;
import android.widget.EditText;
import com.mints.goodmoney.MintsApplication;
import com.mints.goodmoney.R;
import com.mints.goodmoney.common.Constant;
import com.mints.goodmoney.mvp.views.BaseView;
import com.mints.goodmoney.ui.widgets.LoadingDialog;
import com.mints.goodmoney.ui.widgets.dialog.LoadingDialog;
import com.mints.goodmoney.utils.StatusBarUtil;
import com.mints.goodmoney.utils.ToastUtil;
import com.mints.library.base.BaseAppCompatActivity;
......
......@@ -30,6 +30,8 @@ import kotlinx.android.synthetic.main.layout_red_bag.*
import kotlinx.android.synthetic.main.layout_red_box.*
import net.grandcentrix.tray.AppPreferences
private val TAG = HorizonChannelFragment::class.java.simpleName
/**
* 描述:横版视频页面
* 作者:孟崔广
......@@ -37,8 +39,6 @@ import net.grandcentrix.tray.AppPreferences
*/
class HorizonChannelFragment : BaseFragment(), HorizChannelView, View.OnClickListener {
private val TAG = HorizonChannelFragment::class.java.simpleName
private val horizChannelPresenter by lazy { HorizChannelPresenter() }
private val ps by lazy { AppPreferences(context) }
......
package com.mints.goodmoney.ui.fragment
import android.app.Dialog
import android.os.Bundle
import android.os.Handler
import android.os.Looper
......@@ -27,11 +28,11 @@ import com.mints.goodmoney.mvp.views.HomeView
import com.mints.goodmoney.ui.activitys.AwardActivity
import com.mints.goodmoney.ui.activitys.WebActivity
import com.mints.goodmoney.ui.fragment.base.BaseFragment
import com.mints.goodmoney.ui.widgets.BindWxDialog
import com.mints.goodmoney.ui.widgets.DialogListener
import com.mints.goodmoney.ui.widgets.PowerDialog
import com.mints.goodmoney.ui.widgets.dialog.BindWxDialog
import com.mints.goodmoney.ui.widgets.dialog.DialogListener
import com.mints.goodmoney.ui.widgets.countdowntimer.CountDownTimerSupport
import com.mints.goodmoney.ui.widgets.countdowntimer.OnCountDownTimerListener
import com.mints.goodmoney.ui.widgets.dialog.DialogUtils
import com.mints.goodmoney.ui.widgets.seekbar.BubbleUtils
import com.mints.goodmoney.utils.LogUtil
import com.mints.goodmoney.utils.TimeRender
......@@ -57,7 +58,6 @@ class MainFragment : BaseFragment(), HomeView, View.OnClickListener {
private val homePresenter by lazy { HomePresenter() }
private val userManager by lazy { UserManager.getInstance() }
private val ps by lazy { AppPreferences(context) }
private var powerDialog: PowerDialog? = null
private var bindWxDialog: BindWxDialog? = null
private var userMsgBean: UserTaskMsgBean? = null
......@@ -170,7 +170,7 @@ class MainFragment : BaseFragment(), HomeView, View.OnClickListener {
// 倒计时红包暂停
pauseDownloadTime()
destoryTimerRedbox()
destroyTimerRedbox()
littleVideoFragment?.onPause()
if (isToCreateReward) {
......@@ -397,7 +397,7 @@ class MainFragment : BaseFragment(), HomeView, View.OnClickListener {
rl_fragment_main_redbox.isClickable = false
// 广告回调
YLUIConfig.getInstance().registerAdListener(object : YLAdListener {
YLUIConfig.getInstance().registerAdListener(object : YLAdListener() {
override fun onSuccess(p0: String?, p1: Int, p2: String?, p3: String?) {
}
......@@ -518,9 +518,9 @@ class MainFragment : BaseFragment(), HomeView, View.OnClickListener {
* 权限弹窗
*/
private fun powerDialog() {
powerDialog = PowerDialog(requireActivity(), object : DialogListener() {
override fun onClick(v: View) {
when (v.id) {
DialogUtils.showPowerDialog(requireActivity(), object : DialogListener() {
override fun onClick(dialog: Dialog?, v: View?) {
when (v?.id) {
R.id.tv_dialogper_agreement -> {
val bundle = Bundle()
bundle.putString(WebActivity.WEB_TITLE, getString(R.string.register_name))
......@@ -534,17 +534,13 @@ class MainFragment : BaseFragment(), HomeView, View.OnClickListener {
readyGo(WebActivity::class.java, bundle)
}
R.id.btn_dialogper_back -> {
if (activity != null && !activity!!.isFinishing &&
powerDialog != null && powerDialog!!.isShowing
) {
if (activity != null && !activity!!.isFinishing && dialog != null && dialog.isShowing) {
showToast("请您同意授权,否则将无法使用APP功能")
}
}
R.id.btn_dialogper_next -> {
if (activity != null && !activity!!.isFinishing &&
powerDialog != null && powerDialog!!.isShowing
) {
powerDialog!!.dismiss()
if (activity != null && !activity!!.isFinishing && dialog != null && dialog.isShowing) {
dialog.dismiss()
ps.put(Constant.LOAN_PERMISSION_FLAG, false)
// 数美初始化
......@@ -562,9 +558,9 @@ class MainFragment : BaseFragment(), HomeView, View.OnClickListener {
}
}
}
}
})
powerDialog!!.show()
}
/**
......@@ -576,26 +572,33 @@ class MainFragment : BaseFragment(), HomeView, View.OnClickListener {
data.vedioRules.sdhZ_VEDIO.rate,
data.vedioRules.fL_VEDIO.rate,
data.vedioRules.corAl_VIDEO.rate,
data.vedioRules.csjfulL_VEDIO.rate)
data.vedioRules.csjfulL_VEDIO.rate,
data.vedioRules.kS_VEDIO.rate
)
LogUtil.d(TAG, "首页权重值:csjWeight:${data.vedioRules.csJ_VEDIO.rate} " +
"ylhWeight:${data.vedioRules.ylH_VEDIO.rate} " +
"sdhzWeight:${data.vedioRules.sdhZ_VEDIO.rate} " +
"csjFullWeight:${data.vedioRules.csjfulL_VEDIO.rate} " +
"shWeight:${data.vedioRules.corAl_VIDEO.rate} " +
"flWeight:${data.vedioRules.fL_VEDIO.rate}")
"flWeight:${data.vedioRules.fL_VEDIO.rate} " +
"ksWeight:${data.vedioRules.kS_VEDIO.rate}"
)
// 广告视频数
AppConfig.csjVideoAdCount = data.vedioRules.csJ_VEDIO.surplus
AppConfig.ylhAdCount = data.vedioRules.ylH_VEDIO.surplus
AppConfig.wnVideoAdCount = data.vedioRules.sdhZ_VEDIO.surplus
AppConfig.flVideoAdCount = data.vedioRules.fL_VEDIO.surplus
AppConfig.csjFullVedioAdCount = data.vedioRules.csjfulL_VEDIO.surplus
AppConfig.csjFullVideoAdCount = data.vedioRules.csjfulL_VEDIO.surplus
AppConfig.shVideoAdCount = data.vedioRules.corAl_VIDEO.surplus
AppConfig.ksVideoAdCount = data.vedioRules.kS_VEDIO.surplus
LogUtil.d(TAG, "首页视频数:csjCount:${AppConfig.csjVideoAdCount} " +
"ylhCount:${AppConfig.ylhAdCount} " +
"sdhzCount:${AppConfig.wnVideoAdCount} " +
"csjFullCount:${AppConfig.csjFullVedioAdCount} " +
"csjFullCount:${AppConfig.csjFullVideoAdCount} " +
"shCount:${AppConfig.shVideoAdCount} " +
"flCount:${AppConfig.flVideoAdCount}")
"flCount:${AppConfig.flVideoAdCount}" +
"ksCount:${AppConfig.ksVideoAdCount}"
)
}
/**
......@@ -642,7 +645,7 @@ class MainFragment : BaseFragment(), HomeView, View.OnClickListener {
}
stopRedbox()
destoryTimerRedbox()
destroyTimerRedbox()
mRedBoxTimer = CountDownTimerSupport(time * 1000, 1000)
rl_fragment_main_redbox.isClickable = false
......@@ -670,7 +673,7 @@ class MainFragment : BaseFragment(), HomeView, View.OnClickListener {
}
}
private fun destoryTimerRedbox() {
private fun destroyTimerRedbox() {
mRedBoxTimer?.stop()
mRedBoxTimer = null
}
......
......@@ -6,9 +6,9 @@ import android.content.BroadcastReceiver
import android.content.Context
import android.content.Intent
import android.content.IntentFilter
import android.app.Dialog
import android.os.Bundle
import android.text.TextUtils
import android.view.Gravity
import android.view.View
import android.widget.AdapterView
import androidx.core.content.ContextCompat
......@@ -33,9 +33,9 @@ import com.mints.goodmoney.ui.adapter.GvMyAdapter
import com.mints.goodmoney.ui.adapter.MainMyAdapter
import com.mints.goodmoney.ui.adapter.listener.OnItemChildClickListener
import com.mints.goodmoney.ui.fragment.base.BaseFragment
import com.mints.goodmoney.ui.widgets.CustomDialogAsApple
import com.mints.goodmoney.ui.widgets.DialogListener
import com.mints.goodmoney.ui.widgets.dialog.DialogListener
import com.mints.goodmoney.ui.widgets.ShareDialog
import com.mints.goodmoney.ui.widgets.dialog.DialogUtils
import com.mints.goodmoney.ui.widgets.seekbar.BubbleUtils
import com.mints.goodmoney.utils.AppUtil
import com.mints.goodmoney.utils.LogUtil
......@@ -99,8 +99,6 @@ class MyFragment : BaseFragment(),
private var mCurrentPkg: String? = null
private var mReceiverBroadcastReceiver: BroadcastReceiver? = null
private var cdaa: CustomDialogAsApple? = null
override fun getContentViewLayoutID() = R.layout.fragment_main_my
override fun initViewsAndEvents() {
......@@ -1071,38 +1069,43 @@ class MyFragment : BaseFragment(),
data.vedioRules.sdhZ_VEDIO.rate,
data.vedioRules.fL_VEDIO.rate,
data.vedioRules.corAl_VIDEO.rate,
data.vedioRules.csjfulL_VEDIO.rate)
data.vedioRules.csjfulL_VEDIO.rate,
data.vedioRules.kS_VEDIO.rate
)
LogUtil.d(TAG, "首页权重值:csjWeight:${data.vedioRules.csJ_VEDIO.rate} " +
"ylhWeight:${data.vedioRules.ylH_VEDIO.rate} " +
"sdhzWeight:${data.vedioRules.sdhZ_VEDIO.rate} " +
"csjFullWeight:${data.vedioRules.csjfulL_VEDIO.rate} " +
"shWeight:${data.vedioRules.corAl_VIDEO.rate} " +
"flWeight:${data.vedioRules.fL_VEDIO.rate}")
"flWeight:${data.vedioRules.fL_VEDIO.rate} " +
"ksWeight:${data.vedioRules.kS_VEDIO.rate}"
)
// 广告视频数
AppConfig.csjVideoAdCount = data.vedioRules.csJ_VEDIO.surplus
AppConfig.ylhAdCount = data.vedioRules.ylH_VEDIO.surplus
AppConfig.wnVideoAdCount = data.vedioRules.sdhZ_VEDIO.surplus
AppConfig.flVideoAdCount = data.vedioRules.fL_VEDIO.surplus
AppConfig.shVideoAdCount = data.vedioRules.corAl_VIDEO.surplus
AppConfig.csjFullVedioAdCount = data.vedioRules.csjfulL_VEDIO.surplus
AppConfig.ksVideoAdCount = data.vedioRules.kS_VEDIO.surplus
LogUtil.d(TAG, "首页视频数:csjCount:${AppConfig.csjVideoAdCount} " +
"ylhCount:${AppConfig.ylhAdCount} " +
"sdhzCount:${AppConfig.wnVideoAdCount} " +
"csjFullCount:${AppConfig.csjFullVedioAdCount} " +
"csjFullCount:${AppConfig.csjFullVideoAdCount} " +
"shCount:${AppConfig.shVideoAdCount} " +
"flCount:${AppConfig.flVideoAdCount}")
"flCount:${AppConfig.flVideoAdCount} " +
"ksCount:${AppConfig.ksVideoAdCount}"
)
}
/**
* 跳转QQ群弹框
*/
private fun jumpQQGroup() {
cdaa = CustomDialogAsApple(context, object : DialogListener() {
override fun onClick(v: View) {
if (cdaa != null && cdaa!!.isShowing) {
cdaa!!.dismiss()
}
when (v.id) {
DialogUtils.showDialog(mContext, "提示", "好赚钱想要打开QQ", "取消", "打开", object : DialogListener() {
override fun onClick(dialog: Dialog?, v: View?) {
dialog?.dismiss()
when (v?.id) {
R.id.dialog_btn_left -> {
}
......@@ -1114,40 +1117,27 @@ class MyFragment : BaseFragment(),
}
}
})
cdaa!!.setTitle("提示")
cdaa!!.setContent("好赚钱想要打开QQ")
cdaa!!.setLeft("取消")
cdaa!!.setRight("打开")
cdaa!!.show()
}
/**
* 第一次微信分享弹框
*/
private fun firstWeChatInvite() {
cdaa = CustomDialogAsApple(context, object : DialogListener() {
override fun onClick(v: View) {
if (cdaa != null && cdaa!!.isShowing) {
cdaa!!.dismiss()
}
when (v.id) {
DialogUtils.showDialog(mContext, "提示", "被邀请人成功提现0.5元后发放贡献", "取消", "打开微信", object : DialogListener() {
override fun onClick(dialog: Dialog?, v: View?) {
dialog?.dismiss()
when (v?.id) {
R.id.dialog_btn_left -> {
}
R.id.dialog_btn_right -> {
ps.put(Constant.FIRST_SHARE_MY, true)
cdaa!!.dismiss()
shareImgDialog()
}
}
}
})
cdaa!!.setTitle("提示")
cdaa!!.setContent("被邀请人成功提现0.5元后发放贡献")
cdaa!!.setLeft("取消")
cdaa!!.setRight("打开微信")
cdaa!!.show()
}
/**
......@@ -1191,17 +1181,20 @@ class MyFragment : BaseFragment(),
* 高额任务提示弹框
*/
private fun highVideoTint(taskBean: MyInfo.AutoListBean) {
cdaa = CustomDialogAsApple(context, object : DialogListener() {
override fun onClick(v: View) {
if (cdaa != null && cdaa!!.isShowing) {
cdaa!!.dismiss()
}
when (v.id) {
R.id.dialog_btn_left -> {
cdaa!!.dismiss()
}
val ssb = SpanUtils()
.append("1.点击开始任务,观看广告时,点击广告中的下载APP区域\r\n" +
"2.等待APP下载完成后,安装该APP\r\n" +
"3.通过好赚钱APP打开该APP并试玩至少30秒" +
"\n\n")
.append("说明:有些可能不是下载APP类型的广告,请关闭广告后重试").setFontSize(BubbleUtils.dp2px(12))
.create()
DialogUtils.showDialog(mContext, "任务步骤", ssb, "取消", "开始任务", object : DialogListener() {
override fun onClick(dialog: Dialog?, v: View?) {
dialog?.dismiss()
when (v?.id) {
R.id.dialog_btn_right -> {
cdaa!!.dismiss()
carrierType = Constant.CARRIER_HIGH_ACTIVITY
vedioAdingManager.setIsHighWeight(true)
......@@ -1213,50 +1206,23 @@ class MyFragment : BaseFragment(),
}
}
})
val ssb = SpanUtils()
.append("1.点击开始任务,观看广告时,点击广告中的下载APP区域\r\n" +
"2.等待APP下载完成后,安装该APP\r\n" +
"3.通过好赚钱APP打开该APP并试玩至少30秒" +
"\n\n")
.append("说明:有些可能不是下载APP类型的广告,请关闭广告后重试").setFontSize(BubbleUtils.dp2px(12))
.create()
cdaa?.let {
it.setTitle("任务步骤")
it.setContent(ssb)
it.setContentGravity(Gravity.START)
it.setLeft("取消")
it.setRight("开始任务")
it.show()
}
}
/**
* 打开应用使用记录授权弹框
*/
private fun openAppUsageStats() {
cdaa = CustomDialogAsApple(context, object : DialogListener() {
override fun onClick(v: View) {
if (cdaa != null && cdaa!!.isShowing) {
cdaa!!.dismiss()
}
when (v.id) {
R.id.dialog_btn_left -> {
cdaa!!.dismiss()
}
DialogUtils.showDialog(mContext, "任务步骤", "该任务需要【应用使用记录】权限", "取消", "打开授权", object : DialogListener() {
override fun onClick(dialog: Dialog?, v: View?) {
dialog?.dismiss()
when (v?.id) {
R.id.dialog_btn_right -> {
cdaa!!.dismiss()
AppUtil.openUsageStats(mContext)
}
}
}
})
cdaa?.let {
it.setTitle("提示")
it.setContent("该任务需要【应用使用记录】权限")
it.setLeft("取消")
it.setRight("打开授权")
it.show()
}
}
/**
......
......@@ -5,6 +5,7 @@ import android.content.Context
import android.content.Intent
import android.content.IntentFilter
import android.os.Bundle
import android.text.TextUtils
import android.view.View
import androidx.recyclerview.widget.GridLayoutManager
import com.mints.goodmoney.R
......@@ -25,9 +26,9 @@ import com.mints.goodmoney.ui.activitys.TaskCpdActivity
import com.mints.goodmoney.ui.adapter.TaskAdapter
import com.mints.goodmoney.ui.adapter.listener.OnItemChildClickListener
import com.mints.goodmoney.ui.fragment.base.BaseFragment
import com.mints.goodmoney.ui.widgets.DialogListener
import com.mints.goodmoney.ui.widgets.TaskCpdDialog
import com.mints.goodmoney.ui.widgets.TaskDialog
import com.mints.goodmoney.ui.widgets.dialog.DialogListener
import com.mints.goodmoney.ui.widgets.dialog.TaskCpdDialog
import com.mints.goodmoney.ui.widgets.dialog.TaskDialog
import com.mints.goodmoney.utils.*
import com.mints.goodmoney.utils.rxutil.CommonRxTask
import com.mints.goodmoney.utils.rxutil.RxjavaUtil
......@@ -48,7 +49,7 @@ class TaskCpdFragment : BaseFragment(), TaskView,
private val taskPresenter by lazy { TaskPresenter() }
private var mTaskAdapter: TaskAdapter? = null
private val mFakeTaskList: MutableList<TzTaskBean> = arrayListOf()
private val mFakeTaskList: MutableList<TzTaskBean> = mutableListOf()
// 任务弹框
private var taskDialog: TaskDialog? = null
......@@ -75,7 +76,10 @@ class TaskCpdFragment : BaseFragment(), TaskView,
private var shMax = 0 //珊瑚 广告最大填充数
private var cpdMax = 0 //CPD 广告最大填充数
@Volatile
private var shLoadCountTime = 0 // 珊瑚 加载广告次数
@Volatile
private var cpdLoadCountTime = 0 // CPD 加载广告次数
override fun initViewsAndEvents() {
......@@ -173,7 +177,6 @@ class TaskCpdFragment : BaseFragment(), TaskView,
}
override fun getCpdModelSuc(dataBean: CpdModelBean.DataBean) {
LogUtil.d(TAG, "syd getCpdModelSuc")
for (material in dataBean.materials) {
val tzTaskBean = TzTaskBean(material.icons, material.description, material.title, false, mCoin, 0, material.app_apk_name)
......@@ -186,14 +189,18 @@ class TaskCpdFragment : BaseFragment(), TaskView,
if (cpdLoadCountTime++ >= cpdMax - 1) {
getCpdRepeatPkg()
}
LogUtil.d(TAG, "syd getCpdModelSuc " + cpdLoadCountTime)
}
override fun getCpdModelFail() {
LogUtil.d(TAG, "syd getCpdModelFail")
// LogUtil.d(TAG, "syd getCpdModelFail")
if (cpdLoadCountTime++ >= cpdMax - 1) {
getCpdRepeatPkg()
}
LogUtil.d(TAG, "syd getCpdModelFail " + cpdLoadCountTime)
}
override fun onRefresh(refreshLayout: RefreshLayout) {
......@@ -223,11 +230,12 @@ class TaskCpdFragment : BaseFragment(), TaskView,
var flag = true
for (j in 0 until mFakeTaskList.size) {
if (!mFakeTaskList[i].isShCpd && !mFakeTaskList[j].isShCpd) {
// 数据重复
if (i != j && mFakeTaskList[i].downLoadPkgName == mFakeTaskList[j].downLoadPkgName) {
LogUtil.d(TAG, "syd currentPkgName:" + mFakeTaskList[i].downLoadPkgName)
LogUtil.d(TAG, "syd currentPkgName:" + mFakeTaskList[j].downLoadPkgName)
flag = false
break
......@@ -237,7 +245,8 @@ class TaskCpdFragment : BaseFragment(), TaskView,
if (flag) {
// 添加未安装app
if (!DeviceInfo.instance.isLoadingPkg(mFakeTaskList[i].downLoadPkgName)) {
if (!TextUtils.isEmpty(mFakeTaskList[i].downLoadPkgName) &&
!DeviceInfo.instance.isLoadingPkg(mFakeTaskList[i].downLoadPkgName)) {
cpdLoadCountTime--
newPkgData.add(mFakeTaskList[i])
}
......
......@@ -13,7 +13,7 @@ import android.view.View;
import com.mints.goodmoney.MintsApplication;
import com.mints.goodmoney.R;
import com.mints.goodmoney.ui.widgets.LoadingDialog;
import com.mints.goodmoney.ui.widgets.dialog.LoadingDialog;
import com.mints.goodmoney.utils.ToastUtil;
import com.mints.library.base.BaseAppFragment;
......
package com.mints.goodmoney.ui.widgets.dialog;
import android.app.Dialog;
import android.content.Context;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.annotation.StyleRes;
/**
* 描述:dialog屏幕适配
* 作者:孟崔广
* 时间:2017/10/10 17:51
* 邮箱:mengcga@163.com
*/
public abstract class BaseDialog extends Dialog {
public BaseDialog(@NonNull Context context) {
super(context);
}
public BaseDialog(@NonNull Context context, @StyleRes int themeResId) {
super(context, themeResId);
}
protected BaseDialog(@NonNull Context context, boolean cancelable, @Nullable OnCancelListener cancelListener) {
super(context, cancelable, cancelListener);
}
}
package com.mints.goodmoney.ui.widgets.dialog
import android.app.Activity
import android.app.Dialog
import android.content.Intent
import android.os.Bundle
import android.view.Gravity
import android.view.KeyEvent
import android.view.View
import android.view.WindowManager
import cn.sharesdk.framework.ShareSDK
import cn.sharesdk.wechat.friends.Wechat
import com.mints.goodmoney.MintsApplication
import com.mints.goodmoney.R
import com.mints.goodmoney.common.Constant
import com.mints.goodmoney.login.LoginApi
import com.mints.goodmoney.login.OnLoginListener
import com.mints.goodmoney.mvp.model.DrawcashBean
import com.mints.goodmoney.mvp.model.WXInfo
import com.mints.goodmoney.mvp.presenters.SettingsPresenter
import com.mints.goodmoney.mvp.views.SettingsView
import com.mints.goodmoney.ui.activitys.AccountMergeActivity
import com.mints.goodmoney.utils.ToastUtil
import com.mints.library.utils.json.JsonUtil
import com.mints.library.utils.nodoubleclick.AntiShake
import java.util.*
/**
* 微信授权弹窗
*/
class BindWxDialog(context: Activity) :
Dialog(context, R.style.dialog), OnLoginListener, SettingsView, View.OnClickListener {
private var loginApi: LoginApi? = null
private var settingsPresenter: SettingsPresenter? = null
private var wxInfo: WXInfo? = null
init {
setContentView(R.layout.dialog_bindwx)
// 设置window属性
val lp = window!!.attributes
lp.gravity = Gravity.CENTER
lp.width = WindowManager.LayoutParams.MATCH_PARENT
lp.windowAnimations = R.style.DialogAnimBottom
window!!.attributes = lp
// 设置外部不可关闭
setCancelable(false)
setCanceledOnTouchOutside(false)
setOnKeyListener { _, i, _ ->
i == KeyEvent.KEYCODE_BACK
}
findViewById<View>(R.id.btn_dialogper_next).setOnClickListener(this)
loginApi = LoginApi()
settingsPresenter = SettingsPresenter()
settingsPresenter?.attachView(this)
}
override fun dismiss() {
super.dismiss()
loginApi?.setOnLoginListener(null)
settingsPresenter?.detachView()
}
override fun onClick(v: View) {
if (AntiShake.check(v?.id)) return
when (v.id) {
R.id.btn_dialogper_next -> {
val wechat = ShareSDK.getPlatform(Wechat.NAME)
if (!wechat.isClientValid) {
showToast("请先安装微信")
return
}
loginApi?.let {
it.setOnLoginListener(this)
it.setPlatform(Wechat.NAME)
it.login(context)
}
}
}
}
override fun onLogin(platform: String?, res: HashMap<String, Any>): Boolean {
try {
wxInfo = WXInfo()
wxInfo?.let {
it.setUnionid(res["unionid"].toString() + "")
it.setOpenid(res["openid"].toString() + "")
it.setProvince(res["province"].toString() + "")
it.setCity(res["city"].toString() + "")
it.setCountry(res["country"].toString() + "")
it.setHeadimgurl(res["headimgurl"].toString() + "")
it.setNickname(res["nickname"].toString() + "")
it.setSex((res["sex"].toString() + "").toInt())
}
settingsPresenter?.editUserMsg(res["openid"].toString(), JsonUtil.toJson(wxInfo))
} catch (e: Exception) {
e.printStackTrace()
}
return false
}
override fun mergeAccount(mobile: String, wxOpenId: String, key: String) {
val bundle = Bundle()
bundle.putString(Constant.MERGE_MOBILE, mobile)
bundle.putString(Constant.MERGE_WXOPENID, wxOpenId)
bundle.putString(Constant.MERGE_KEY, key)
readyGo(AccountMergeActivity::class.java, bundle)
}
protected fun readyGo(clazz: Class<*>?, bundle: Bundle?) {
val intent = Intent(context, clazz)
if (null != bundle) {
intent.putExtras(bundle)
}
context.startActivity(intent)
}
override fun editUserMsgSuc() {
ToastUtil.show(context, "微信绑定成功")
dismiss()
}
override fun getUserTaskMsgSuc(data: DrawcashBean) {
}
override fun showLoading(msg: String?) {
}
override fun showToast(msg: String?) {
ToastUtil.showLong(context, msg)
}
override fun hideLoading() {
}
override fun getBaseApplication(): MintsApplication {
return MintsApplication.getContext() as MintsApplication
}
}
\ No newline at end of file
package com.mints.goodmoney.ui.widgets.dialog
import android.app.Dialog
import android.content.Context
import android.view.Gravity
import android.view.KeyEvent
import android.view.View
import android.view.WindowManager
import android.widget.Button
import android.widget.TextView
import com.mints.goodmoney.R
import com.mints.goodmoney.ui.widgets.dialog.DialogListener
/**
* 提示弹框
*/
class BonusDialog(context: Context, private val listener: DialogListener) :
Dialog(context, R.style.dialog) {
private val lp: WindowManager.LayoutParams
private val tv_dialogper_title: TextView
private val tv_dialogper_content: TextView
private val btn_dialogper_submit: Button
fun setTitle(title: String) {
tv_dialogper_title.visibility = View.VISIBLE
tv_dialogper_title.text = title
}
fun setContent(content: String) {
tv_dialogper_content.text = content
}
fun setBtnStr(btnStr: String) {
btn_dialogper_submit.text = btnStr
}
init {
setContentView(R.layout.dialog_friends)
// 设置window属性
lp = window!!.attributes
lp.gravity = Gravity.CENTER
lp.width = WindowManager.LayoutParams.MATCH_PARENT
lp.windowAnimations = R.style.DialogAnimBottom
window!!.attributes = lp
// 设置外部不可关闭
setCancelable(false)
setCanceledOnTouchOutside(false)
setOnKeyListener { _, i, _ ->
i == KeyEvent.KEYCODE_BACK
}
// 查找View
tv_dialogper_title =
findViewById<View>(R.id.tv_title) as TextView
tv_dialogper_content =
findViewById<View>(R.id.tv_content) as TextView
btn_dialogper_submit =
findViewById<View>(R.id.btn_submit) as Button
tv_dialogper_content.setOnClickListener(listener)
tv_dialogper_title.setOnClickListener(listener)
btn_dialogper_submit.setOnClickListener(listener)
}
}
\ No newline at end of file
package com.mints.goodmoney.ui.widgets.dialog;
import android.content.Context;
import androidx.core.content.ContextCompat;
import android.os.CountDownTimer;
import android.text.Spanned;
import android.text.TextUtils;
import android.text.method.ScrollingMovementMethod;
import android.view.Gravity;
import android.view.KeyEvent;
import android.view.View;
import android.view.WindowManager.LayoutParams;
import android.widget.Button;
import android.widget.TextView;
import com.mints.goodmoney.R;
import com.mints.goodmoney.ui.widgets.dialog.BaseDialog;
import com.mints.goodmoney.ui.widgets.dialog.DialogListener;
/**
* 仿苹果自定义dialog选择框
*/
public class CustomDialogAsApple extends BaseDialog {
private Context context;
private LayoutParams lp;
private DialogListener listener;
private TextView dialog_tv_title, dialog_tv_content;
private Button dialog_btn_left, dialog_btn_right;
private View dialog_v_line;
public CustomDialogAsApple(Context context, DialogListener listener) {
super(context, R.style.dialog);
this.context = context;
this.listener = listener;
setContentView(R.layout.dialog_main);
// 设置window属性
lp = getWindow().getAttributes();
lp.gravity = Gravity.CENTER;
lp.width = LayoutParams.MATCH_PARENT;
lp.height = LayoutParams.WRAP_CONTENT;
lp.windowAnimations = R.style.DialogAnimBottom;
getWindow().setAttributes(lp);
// 设置外部不可关闭
setCancelable(false);
setCanceledOnTouchOutside(false);
setOnKeyListener((dialog, keyCode, event) -> keyCode == KeyEvent.KEYCODE_BACK);
// 查找View
dialog_tv_title = findViewById(R.id.dialog_tv_title);
dialog_tv_content = findViewById(R.id.dialog_tv_content);
dialog_tv_content.setMovementMethod(ScrollingMovementMethod.getInstance());
dialog_btn_left = findViewById(R.id.dialog_btn_left);
dialog_btn_right = findViewById(R.id.dialog_btn_right);
dialog_v_line = findViewById(R.id.dialog_v_line);
initListener();
}
private void initListener() {
if (listener != null) {
dialog_btn_left.setOnClickListener(listener);
dialog_btn_right.setOnClickListener(listener);
}
}
public void setDialogListener(DialogListener listener) {
this.listener = listener;
}
/**
* Dialog显示标题
*
* @param s
*/
public void setTitle(String s) {
dialog_tv_title.setVisibility(View.VISIBLE);
dialog_tv_title.setText(s);
}
/**
* Dialog显示标题
*
* @param size
*/
public void setTitleSize(int size) {
dialog_tv_title.setTextSize(size);
}
/**
* Dialog显示内容
*
* @param s
*/
public void setContent(String s) {
dialog_tv_content.setText(s);
}
public void setContent(Spanned s) {
dialog_tv_content.setText(s);
}
/**
* Dialog显示content文字
*
* @param color
*/
public void setContentColor(int color) {
dialog_tv_content.setTextColor(ContextCompat.getColor(context, color));
}
/**
* content文字大小
*
* @param size
*/
public void setContentSize(int size) {
dialog_tv_content.setTextSize(size);
}
public void setContentGravity(int gravity) {
dialog_tv_content.setGravity(gravity);
}
/**
* Dialog显示left按钮文字
*
* @param s
*/
public void setLeft(String s) {
dialog_btn_left.setText(s);
if (TextUtils.isEmpty(dialog_btn_right.getText())) {
dialog_btn_right.setVisibility(View.GONE);
dialog_v_line.setVisibility(View.GONE);
} else {
dialog_btn_left.setVisibility(View.VISIBLE);
dialog_v_line.setVisibility(View.VISIBLE);
}
}
/**
* Dialog显示left按钮文字颜色
*
* @param color
*/
public void setLeftColor(int color) {
dialog_btn_left.setTextColor(ContextCompat.getColor(context, color));
}
/**
* Dialog显示right按钮文字
*
* @param s
*/
public void setRight(String s) {
dialog_btn_right.setText(s);
if (TextUtils.isEmpty(dialog_btn_left.getText())) {
dialog_btn_left.setVisibility(View.GONE);
dialog_v_line.setVisibility(View.GONE);
} else {
dialog_btn_right.setVisibility(View.VISIBLE);
dialog_v_line.setVisibility(View.VISIBLE);
}
}
/**
* Dialog显示right按钮文字
*
* @param s
*/
public void setRightDelay(String s, int second) {
dialog_btn_right.setText(s);
if (TextUtils.isEmpty(dialog_btn_left.getText())) {
dialog_btn_left.setVisibility(View.GONE);
dialog_v_line.setVisibility(View.GONE);
} else {
dialog_btn_right.setVisibility(View.VISIBLE);
dialog_v_line.setVisibility(View.VISIBLE);
dialog_btn_right.setEnabled(false);
CountDownTimer countDownTimer = new CountDownTimer(second * 1000, 1000) {
@Override
public void onTick(long millisUntilFinished) {
String value = String.valueOf((int) ((millisUntilFinished / 1000) + 1));
dialog_btn_right.setText(s + "(" + value + ")");
}
@Override
public void onFinish() {
dialog_btn_right.setText(s);
dialog_btn_right.setEnabled(true);
}
};
countDownTimer.start();
}
}
/**
* Dialog显示right按钮文字颜色
*
* @param color
*/
public void setRightColor(int color) {
dialog_btn_right.setTextColor(ContextCompat.getColor(context, color));
}
}
package com.mints.goodmoney.ui.widgets.dialog;
import android.app.Dialog;
import android.view.View;
import android.view.View.OnClickListener;
/**
* 自定义dialog父类监听
*
* @author renjl
*/
public abstract class DialogListener implements OnClickListener {
private Dialog mDialog;
public DialogListener(Dialog dialog) {
this.mDialog = dialog;
}
public DialogListener() { }
public void setDialog(Dialog dialog) {
mDialog = dialog;
}
@Override
public void onClick(View v) {
onClick(mDialog, v);
}
protected void onClick(Dialog dialog, View v) {
}
}
package com.mints.goodmoney.ui.widgets.dialog
import android.content.Context
import android.text.Spanned
import java.lang.ref.WeakReference
object DialogUtils {
/**
*
* 普通弹框
*/
fun showDialog(ctx: Context, title: String, content: String, leftStr: String, rightStr: String, dialogListener: DialogListener) {
val weakReference = WeakReference<Context>(ctx)
val cdaa = CustomDialogAsApple(weakReference.get(), dialogListener)
cdaa.let {
it.setTitle(title)
it.setContent(content)
it.setLeft(leftStr)
it.setRight(rightStr)
it.show()
}
dialogListener.setDialog(cdaa)
cdaa.setDialogListener(dialogListener)
}
fun showDialog(ctx: Context, title: String, content: Spanned, leftStr: String, rightStr: String, dialogListener: DialogListener) {
val weakReference = WeakReference<Context>(ctx)
val cdaa = CustomDialogAsApple(weakReference.get(), dialogListener)
cdaa.let {
it.setTitle(title)
it.setContent(content)
it.setLeft(leftStr)
it.setRight(rightStr)
it.show()
}
dialogListener.setDialog(cdaa)
cdaa.setDialogListener(dialogListener)
}
/**
*
* 分红奖励页弹框
*/
fun showBonusDialog(ctx: Context, title: String, content: String, btnStr: String, dialogListener: DialogListener) {
val weakReference = WeakReference<Context>(ctx)
val bonusDialog = BonusDialog(weakReference.get()!!, dialogListener)
bonusDialog.let {
it.setTitle(title)
it.setContent(content)
it.setBtnStr(btnStr)
it.show()
}
dialogListener.setDialog(bonusDialog)
}
/**
*
* 权限请求弹框
*/
fun showPowerDialog(ctx: Context, dialogListener: DialogListener) {
val weakReference = WeakReference<Context>(ctx)
val bonusDialog = PowerDialog(weakReference.get()!!, dialogListener)
bonusDialog.show()
dialogListener.setDialog(bonusDialog)
}
}
\ No newline at end of file
package com.mints.goodmoney.ui.widgets.dialog
import android.app.Dialog
import android.content.Context
import android.view.Gravity
import android.view.KeyEvent
import android.view.View
import android.view.WindowManager
import android.widget.ImageView
import android.widget.TextView
import com.downloader.Progress
import com.mints.goodmoney.R
import com.mints.goodmoney.utils.Utils
import com.mints.library.utils.nodoubleclick.AntiShake
/**
* 下载进度弹窗
*/
class DownloadProgressDialog(context: Context) :
Dialog(context, R.style.dialog), View.OnClickListener {
private var tvDownloadProgress: TextView? = null
init {
setContentView(R.layout.dialog_download_progress)
// 设置window属性
val lp = window!!.attributes
lp.gravity = Gravity.CENTER
lp.width = WindowManager.LayoutParams.MATCH_PARENT
lp.windowAnimations = R.style.DialogAnimBottom
window!!.attributes = lp
// 设置外部不可关闭
setCancelable(false)
setCanceledOnTouchOutside(false)
setOnKeyListener { _, i, _ ->
i == KeyEvent.KEYCODE_BACK
}
findViewById<ImageView>(R.id.iv_download_quit).setOnClickListener(this)
tvDownloadProgress = findViewById(R.id.tv_download_progress)
}
override fun onClick(v: View) {
if (AntiShake.check(v?.id)) return
when (v.id) {
R.id.iv_download_quit -> {
dismiss()
}
}
}
fun setProgress(progress: Progress) {
tvDownloadProgress?.text = "正在下载 " + Utils.getProgressDisplayLine(progress.currentBytes, progress.totalBytes)
}
}
\ No newline at end of file
package com.mints.goodmoney.ui.widgets.dialog
import android.app.Activity
import android.app.Dialog
import android.text.TextUtils
import android.view.Gravity
import android.view.View
import android.view.WindowManager
import android.widget.TextView
import com.mints.goodmoney.R
import com.mints.goodmoney.ad.video.VideoAdingManager
import com.mints.goodmoney.common.Constant
import com.mints.goodmoney.manager.TrackManager
import com.mints.goodmoney.mvp.model.VideoAdingBean
import com.mints.goodmoney.utils.ToastUtil
import com.mints.library.utils.nodoubleclick.AntiShake
/**
* 提现弹窗
*/
class DrawcashVideoDialog(activity: Activity) :
Dialog(activity, R.style.dialog), View.OnClickListener {
private var onClickListener: OnClickListener? = null
private var videoAdingManager: VideoAdingManager? = null
private var loadVideoFailCount = 0
private var tvContent: TextView
private var tvNext: TextView
private var activity: Activity? = null
init {
setContentView(R.layout.dialog_drawcash)
// 设置window属性
val lp = window!!.attributes
lp.gravity = Gravity.CENTER
lp.width = WindowManager.LayoutParams.MATCH_PARENT
lp.windowAnimations = R.style.DialogAnimBottom
window!!.attributes = lp
videoAdingManager = VideoAdingManager.getInstance(activity)
findViewById<View>(R.id.btn_dialog_drawcash_back).setOnClickListener(this)
tvContent = findViewById<View>(R.id.btn_dialog_drawcash_content) as TextView
tvNext = findViewById<View>(R.id.btn_dialog_drawcash_next) as TextView
tvNext.setOnClickListener(this)
this.activity = activity
}
fun onDestory(){
videoAdingManager?.setVideoAdingListener(null)
videoAdingManager?.onDestory()
activity = null
}
override fun onClick(v: View) {
if (AntiShake.check(v.id)) return
when (v.id) {
R.id.btn_dialog_drawcash_next -> {
if (TextUtils.equals(tvNext.text.toString(), "去提现")) {
onClickListener?.onClick()
dismiss()
} else {
awardVideo()
}
}
R.id.btn_dialog_drawcash_back -> {
dismiss()
}
}
}
fun setContent(content: String) {
tvContent.text = content
}
fun setBtnText(text: String) {
tvNext.text = text
}
/**
* 获取激励视频
*/
private fun awardVideo() {
if (activity == null) return
loadVideoFailCount = 0
ToastUtil.show(activity, "加载中...")
val bean = VideoAdingBean()
bean.carrierType = Constant.CARRIER_DRAWCASH
videoAdingManager?.let { loadVideo(it, bean, true) }
}
/**
* 加载激励视频
*/
private fun loadVideo(videoAdingManager: VideoAdingManager?, bean: VideoAdingBean, isFirstLoad: Boolean) {
if (activity == null) return
videoAdingManager?.let {
it.setVideoAdingListener(object : VideoAdingManager.VideoAdingListener {
override fun videoAdingListenerError(adType: String) {
ToastUtil.show(activity, "加载超时,请休息一下")
}
override fun videoAdingListenerFail(adType: String) {
loadVideoFailCount++
if (loadVideoFailCount >= 2) {
ToastUtil.show(activity, "加载超时,请休息一下")
} else {
loadVideo(videoAdingManager, bean, false)
}
}
override fun videoAdingListenerSuccess(adType: String) {
if (it.isVideoAdDownload) {
TrackManager.getInstance().drawcashVideo()
}
}
})
if (isFirstLoad) {
// 首页按权重加载
it.loadAding(activity, bean)
} else {
// 失败按优先级加载
it.loadFailAding(activity, bean)
}
}
}
interface OnClickListener {
fun onClick()
}
fun setOnClickListener(onClickListener: OnClickListener?) {
this.onClickListener = onClickListener
}
}
\ No newline at end of file
package com.mints.goodmoney.ui.widgets.dialog
import android.app.Dialog
import android.content.Context
import android.view.Gravity
import android.view.KeyEvent
import android.view.WindowManager
import android.widget.Button
import android.widget.ImageView
import com.mints.goodmoney.R
import com.mints.goodmoney.ui.widgets.ClearEditText
/**
* 提示弹框
*/
class JDTintDialog(context: Context, listener: DialogListener) :
Dialog(context, R.style.dialog) {
private val lp: WindowManager.LayoutParams
private val etLoginMobile: ClearEditText
private val btnBindMobile: Button
private val ivClose: ImageView
init {
setContentView(R.layout.dialog_jd_bind_mobile)
// 设置window属性
lp = window!!.attributes
lp.gravity = Gravity.CENTER
lp.width = WindowManager.LayoutParams.WRAP_CONTENT
lp.windowAnimations = R.style.DialogAnimBottom
window!!.attributes = lp
// 设置外部不可关闭
setCancelable(false)
setCanceledOnTouchOutside(false)
setOnKeyListener { _, i, _ ->
i == KeyEvent.KEYCODE_BACK
}
// 查找View
etLoginMobile = findViewById(R.id.etLoginMobile)
btnBindMobile = findViewById(R.id.btnBindMobile)
ivClose = findViewById(R.id.ivClose)
ivClose.setOnClickListener(listener)
etLoginMobile.setOnClickListener(listener)
btnBindMobile.setOnClickListener(listener)
}
fun getMobileNum(): String {
return etLoginMobile.text.toString().trim()
}
}
\ No newline at end of file
package com.mints.goodmoney.ui.widgets.dialog;
import android.app.Dialog;
import android.content.Context;
import android.graphics.drawable.Drawable;
import androidx.core.content.ContextCompat;
import android.text.TextUtils;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.View;
import android.view.WindowManager.LayoutParams;
import android.widget.LinearLayout;
import android.widget.ProgressBar;
import android.widget.TextView;
import com.mints.goodmoney.R;
/**
* 描述:加载中dialog
* 作者:孟崔广
* 时间:2017/10/10 17:51
* 邮箱:mengcga@163.com
*/
public class LoadingDialog extends Dialog {
private Context mContext;
private LayoutInflater inflater;
private LayoutParams lp;
private TextView loadtext;
private LinearLayout loading_ll;
public LoadingDialog(Context context) {
super(context, R.style.dialog);
this.mContext = context;
inflater = (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
View layout = inflater.inflate(R.layout.loadingdialog, null);
if (android.os.Build.VERSION.SDK_INT > 22) {//android 6.0替换clip的加载动画
final Drawable drawable = ContextCompat.getDrawable(mContext, R.drawable.ufo_loading_refresh);
ProgressBar loading_bar = (ProgressBar) layout.findViewById(R.id.loading_bar);
loading_bar.setIndeterminateDrawable(drawable);
}
loadtext = (TextView) layout.findViewById(R.id.loading_text);
loading_ll = (LinearLayout) layout.findViewById(R.id.loading_ll);
setContentView(layout);
// 设置window属性
lp = getWindow().getAttributes();
lp.gravity = Gravity.CENTER;
lp.dimAmount = 0; // 去背景遮盖
// lp.alpha = 1.0f;//透明效果
getWindow().setAttributes(lp);
}
/**
* 设置显示文字
*
* @param content 文字内容
*/
public void setLoadText(String content) {
if (TextUtils.isEmpty(content)) {
loading_ll.setVisibility(View.GONE);
} else {
loading_ll.setVisibility(View.VISIBLE);
loadtext.setText(content);
}
}
}
\ No newline at end of file
package com.mints.goodmoney.ui.widgets.dialog
import android.app.Dialog
import android.content.Context
import android.view.Gravity
import android.view.KeyEvent
import android.view.View
import android.view.WindowManager
import android.widget.TextView
import com.mints.goodmoney.R
import com.mints.goodmoney.ui.widgets.dialog.DialogListener
/**
* 授权弹窗
*/
class PowerDialog(context: Context, private val listener: DialogListener) :
Dialog(context, R.style.dialog) {
private val lp: WindowManager.LayoutParams
private val tv_dialogper_agreement: TextView
private val tv_dialogper_policy: TextView
private val btn_dialogper_back: TextView
private val btn_dialogper_next: TextView
init {
setContentView(R.layout.dialog_power)
// 设置window属性
lp = window!!.attributes
lp.gravity = Gravity.CENTER
lp.width = WindowManager.LayoutParams.MATCH_PARENT
lp.windowAnimations = R.style.DialogAnimBottom
// lp.dimAmount = 0; // 去背景遮盖
// lp.alpha = 1.0f;//透明效果
window!!.attributes = lp
// 设置外部不可关闭
setCancelable(false)
setCanceledOnTouchOutside(false)
setOnKeyListener { _, i, _ ->
i == KeyEvent.KEYCODE_BACK
}
// 查找View
tv_dialogper_agreement =
findViewById<View>(R.id.tv_dialogper_agreement) as TextView
tv_dialogper_policy =
findViewById<View>(R.id.tv_dialogper_policy) as TextView
btn_dialogper_back =
findViewById<View>(R.id.btn_dialogper_back) as TextView
btn_dialogper_next =
findViewById<View>(R.id.btn_dialogper_next) as TextView
tv_dialogper_policy.setOnClickListener(listener)
tv_dialogper_agreement.setOnClickListener(listener)
btn_dialogper_back.setOnClickListener(listener)
btn_dialogper_next.setOnClickListener(listener)
}
}
\ No newline at end of file
package com.mints.goodmoney.ui.widgets.dialog
import android.app.Dialog
import android.content.Context
import android.view.Gravity
import android.view.WindowManager
import android.widget.ImageView
import android.widget.TextView
import com.mints.goodmoney.R
import com.mints.library.utils.GlideUtils
/**
* 提示弹框
*/
class TaskCpdDialog(context: Context, listener: DialogListener) :
Dialog(context, R.style.dialog) {
private val lp: WindowManager.LayoutParams
private val tvTitle: TextView
private val tvText1: TextView
private val tvText2: TextView
private val tvInfo: TextView
private val ivAvatar: ImageView
private val textView: TextView
init {
setContentView(R.layout.dialog_task)
// 设置window属性
lp = window!!.attributes
lp.gravity = Gravity.CENTER
lp.width = WindowManager.LayoutParams.WRAP_CONTENT
lp.windowAnimations = R.style.DialogAnimBottom
window!!.attributes = lp
// 设置外部不可关闭
// setCancelable(false)
// setCanceledOnTouchOutside(false)
// setOnKeyListener { _, i, _ ->
// i == KeyEvent.KEYCODE_BACK
// }
// 查找View
tvTitle = findViewById(R.id.dialog_tv_title)
tvText1 = findViewById(R.id.dialog_tv_text1)
tvText2 = findViewById(R.id.dialog_tv_text2)
ivAvatar = findViewById(R.id.dialog_iv_avatar)
tvInfo = findViewById(R.id.dialog_tv_info)
textView = findViewById(R.id.dialog_btn_download)
textView.setOnClickListener(listener)
}
fun setData(title: String?, description: String?, icon: String?, seconds: Int, coin: Int) {
if (seconds > 0) {
tvText1.text = "下载并试玩$seconds" + "秒"
} else {
tvText1.text = "下载领取金币"
}
tvText2.text = "+$coin" + "金币"
tvTitle.text = title
GlideUtils.loadImageView(context, icon, ivAvatar)
tvInfo.text = description
}
}
\ No newline at end of file
package com.mints.goodmoney.ui.widgets.dialog
import android.app.Dialog
import android.content.Context
import android.view.Gravity
import android.view.WindowManager
import android.widget.ImageView
import android.widget.TextView
import com.mints.goodmoney.R
import com.mints.library.utils.GlideUtils
import com.tz.sdk.coral.ad.CoralAD
import com.tz.sdk.core.ui.ADContainer
/**
* 提示弹框
*/
class TaskDialog(context: Context) : Dialog(context, R.style.dialog) {
private val lp: WindowManager.LayoutParams
private val tvTitle: TextView
private val tvText1: TextView
private val tvText2: TextView
private val tvInfo: TextView
private val ivAvatar: ImageView
private val textView: TextView
private var adContainer: ADContainer? = null
init {
setContentView(R.layout.dialog_task)
// 设置window属性
lp = window!!.attributes
lp.gravity = Gravity.CENTER
lp.width = WindowManager.LayoutParams.WRAP_CONTENT
lp.windowAnimations = R.style.DialogAnimBottom
window!!.attributes = lp
// 设置外部不可关闭
// setCancelable(false)
// setCanceledOnTouchOutside(false)
// setOnKeyListener { _, i, _ ->
// i == KeyEvent.KEYCODE_BACK
// }
// 查找View
tvTitle = findViewById(R.id.dialog_tv_title)
tvText1 = findViewById(R.id.dialog_tv_text1)
tvText2 = findViewById(R.id.dialog_tv_text2)
ivAvatar = findViewById(R.id.dialog_iv_avatar)
tvInfo = findViewById(R.id.dialog_tv_info)
textView = findViewById(R.id.dialog_btn_download)
adContainer = findViewById(R.id.ad_container)
}
fun setData(data: CoralAD, seconds: Int, coin: Int) {
if (seconds > 0) {
tvText1.text = "下载并试玩$seconds" + "秒"
} else {
tvText1.text = "下载领取金币"
}
tvText2.text = "+$coin" + "金币"
tvTitle.text = data.title
GlideUtils.loadImageView(context, data.icon, ivAvatar)
tvInfo.text = data.description
adContainer?.setAdModel(data)
}
override fun dismiss() {
super.dismiss()
// adContainer?.removeAllViews()
adContainer = null
}
}
\ No newline at end of file
......@@ -9,6 +9,7 @@ import android.text.TextUtils;
import com.mints.goodmoney.manager.TrackManager;
import com.mints.goodmoney.mvp.presenters.VersionUpdatePresenter;
import com.mints.goodmoney.ui.activitys.SplashADActivity;
import com.mints.goodmoney.ui.activitys.SplashKsADActivity;
import java.lang.ref.WeakReference;
......@@ -22,12 +23,14 @@ public class ForegroundOrBackground implements Application.ActivityLifecycleCall
private static ForegroundOrBackground instance;
public int count = 0;
private volatile boolean isKsSplash = false;
//获取当前最上层的activity
private static WeakReference<Activity> app_activity;
private VersionUpdatePresenter vup;
private WeakReference<Activity> reference;
private Intent intent;
private Intent ylhIntent;
private Intent ksIntent;
public static ForegroundOrBackground init(Application application) {
if (instance == null) {
......@@ -99,10 +102,25 @@ public class ForegroundOrBackground implements Application.ActivityLifecycleCall
// LogUtil.d("ForegroundOrBackground", System.currentTimeMillis() - leaveTime + " onActivityStarted");
// 60秒后打开应用 显示开屏广告
if (System.currentTimeMillis() - leaveTime >= 60000) {
if (intent == null) {
intent = new Intent(activity, SplashADActivity.class);
if (isKsSplash) {
isKsSplash = false;
if (ylhIntent == null) {
// 优量汇广告
ylhIntent = new Intent(activity, SplashKsADActivity.class);
}
activity.startActivity(ylhIntent);
} else {
isKsSplash = true;
if (ksIntent == null) {
// 快手广告
ksIntent = new Intent(activity, SplashADActivity.class);
}
activity.startActivity(ksIntent);
}
activity.startActivity(intent);
}
}
count++;
......
......@@ -45,6 +45,22 @@ public final class Utils {
// no instance
}
/**
* 根据手机的分辨率从 dp 的单位 转成为 px(像素)
*/
public static int dip2px(Context context, float dpValue) {
final float scale = context.getResources().getDisplayMetrics().density;
return (int) (dpValue * scale + 0.5f);
}
/**
* 根据手机的分辨率从 px(像素) 的单位 转成为 dp
*/
public static int px2dip(Context context, float pxValue) {
final float scale = context.getResources().getDisplayMetrics().density;
return (int) (pxValue / scale + 0.5f);
}
public static String getRootDirPath(Context context) {
if (Environment.MEDIA_MOUNTED.equals(Environment.getExternalStorageState())) {
File file = ContextCompat.getExternalFilesDirs(context.getApplicationContext(),
......@@ -128,6 +144,7 @@ public final class Utils {
}
return false;
}
/**
* 判断Activity是否Destroy
*
......
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<stroke
android:width="1dp"
android:color="#168FFF" />
<corners android:radius="4dp" />
</shape>
\ No newline at end of file
......@@ -111,8 +111,8 @@
android:background="@drawable/shape_btn_gold_right"
android:drawablePadding="4dp"
android:paddingStart="20dp"
android:paddingEnd="20dp"
android:paddingTop="10dp"
android:paddingEnd="20dp"
android:paddingBottom="10dp"
android:text="超级加倍领取"
android:textColor="@color/white"
......@@ -171,12 +171,12 @@
<FrameLayout
android:id="@+id/flAwardAd"
android:layout_width="wrap_content"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginLeft="25dp"
android:layout_marginTop="10dp"
android:layout_marginRight="25dp"
android:background="@drawable/shape_bg_award" />
android:background="@drawable/shape_bg_award"
android:gravity="center" />
</LinearLayout>
\ No newline at end of file
......@@ -45,8 +45,8 @@
android:id="@+id/fl_my_banner"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingStart="5dp"
android:paddingEnd="5dp"
android:layout_marginStart="10dp"
android:layout_marginEnd="10dp"
android:visibility="gone" />
<include layout="@layout/item_divider_gray" />
......
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tool="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="36dp"
android:gravity="center_vertical"
android:orientation="horizontal"
tool:ignore="SpUsage,ContentDescription">
<ImageView
android:id="@+id/app_icon"
android:layout_width="36dp"
android:layout_height="36dp"
android:src="@mipmap/test_app_default_icon" />
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_gravity="center_vertical"
android:layout_marginLeft="8dp"
android:layout_marginRight="16dp"
android:layout_weight="1"
android:gravity="center_vertical"
android:orientation="vertical"
tool:ignore="RtlHardcoded">
<TextView
android:id="@+id/app_title"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:ellipsize="end"
android:includeFontPadding="false"
android:maxLines="1"
android:textColor="#222222"
android:textSize="14dp"
tool:text="快手APP" />
<TextView
android:id="@+id/app_desc"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="2dp"
android:ellipsize="end"
android:includeFontPadding="false"
android:maxLines="1"
android:textColor="#9C9C9C"
android:textSize="11dp"
tool:text="记录美好生活" />
</LinearLayout>
<TextView
android:id="@+id/app_download_btn"
android:layout_width="64dp"
android:layout_height="24dp"
android:background="@drawable/native_item_btn_bg"
android:gravity="center"
android:textColor="#168FFF"
android:textSize="11dp"
tool:text="立即下载" />
</LinearLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
tools:ignore="ContentDescription,SpUsage,RtlHardcoded">
<TextView
android:id="@+id/ad_desc"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:ellipsize="end"
android:maxLines="2"
android:textColor="#020202"
android:textSize="18dp"
tools:text="快手广告快手广告快手广告快手广告快手广告快手广告快手广告快手广告快手广告快手广告" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="200dp"
android:layout_marginTop="8dp"
android:layout_marginBottom="8dp">
<ImageView
android:id="@+id/ad_image_left"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_gravity="center"
android:layout_weight="1"
android:scaleType="centerCrop" />
<ImageView
android:id="@+id/ad_image_mid"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_gravity="center"
android:layout_marginLeft="4dp"
android:layout_marginRight="4dp"
android:layout_weight="1"
android:scaleType="centerCrop" />
<ImageView
android:id="@+id/ad_image_right"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_gravity="center"
android:layout_weight="1"
android:scaleType="centerCrop" />
</LinearLayout>
<include
android:id="@+id/ad_download_container"
layout="@layout/native_item_app_download"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:visibility="gone"
tools:visibility="visible" />
<include
android:id="@+id/ad_h5_container"
layout="@layout/native_item_h5_open"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:visibility="gone"
tools:visibility="visible" />
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="24dp"
android:layout_marginTop="4dp"
tools:ignore="ContentDescription,RtlHardcoded">
<ImageView
android:layout_width="35dp"
android:layout_height="12dp"
android:layout_alignParentLeft="true"
android:layout_centerVertical="true"
android:src="@mipmap/test_ad_label_gray" />
<ImageView
android:id="@+id/ad_dislike"
android:layout_width="24dp"
android:layout_height="24dp"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:src="@mipmap/test_dislike_gray" />
</RelativeLayout>
</LinearLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tool="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="24dp"
android:gravity="center_vertical"
android:orientation="horizontal"
tool:ignore="SpUsage,RtlHardcoded">
<TextView
android:id="@+id/h5_desc"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_marginRight="16dp"
android:layout_weight="1"
android:ellipsize="end"
android:gravity="center|left"
android:includeFontPadding="false"
android:maxLines="1"
android:textColor="#9C9C9C"
android:textSize="11dp"
tool:text="快手广告快手广告快手广告快手广告快手广告快手广告" />
<TextView
android:id="@+id/h5_open_btn"
android:layout_width="64dp"
android:layout_height="24dp"
android:background="@drawable/native_item_btn_bg"
android:gravity="center"
android:textColor="#168FFF"
android:textSize="11dp"
tool:text="查看详情" />
</LinearLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
tools:ignore="HardcodedText">
<TextView
android:id="@+id/tv"
android:layout_width="match_parent"
android:layout_height="60dp"
android:layout_margin="16dp"
android:gravity="center"
android:text="普通的view" />
</RelativeLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
tools:ignore="ContentDescription,SpUsage,RtlHardcoded">
<TextView
android:id="@+id/ad_desc"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:ellipsize="end"
android:maxLines="2"
android:textColor="#020202"
android:textSize="18dp"
tools:text="快手广告快手广告快手广告快手广告快手广告快手广告快手广告快手广告快手广告快手广告" />
<ImageView
android:id="@+id/ad_image"
android:layout_width="match_parent"
android:layout_height="200dp"
android:layout_marginTop="8dp"
android:layout_marginBottom="8dp"
android:scaleType="centerCrop" />
<include
android:id="@+id/ad_download_container"
layout="@layout/native_item_app_download"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:visibility="gone"
tools:visibility="visible" />
<include
android:id="@+id/ad_h5_container"
layout="@layout/native_item_h5_open"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:visibility="gone"
tools:visibility="visible" />
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="24dp"
android:layout_marginTop="4dp"
tools:ignore="ContentDescription,RtlHardcoded">
<ImageView
android:layout_width="35dp"
android:layout_height="12dp"
android:layout_alignParentLeft="true"
android:layout_centerVertical="true"
android:src="@mipmap/test_ad_label_gray" />
<ImageView
android:id="@+id/ad_dislike"
android:layout_width="24dp"
android:layout_height="24dp"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:src="@mipmap/test_dislike_gray" />
</RelativeLayout>
</LinearLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
tools:ignore="ContentDescription,SpUsage,RtlHardcoded">
<TextView
android:id="@+id/ad_desc"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:ellipsize="end"
android:maxLines="2"
android:textColor="#020202"
android:textSize="18dp"
tools:text="快手广告快手广告快手广告快手广告快手广告快手广告快手广告快手广告快手广告快手广告" />
<FrameLayout
android:id="@+id/video_container"
android:layout_width="match_parent"
android:layout_height="200dp"
android:layout_marginTop="8dp"
android:layout_marginBottom="8dp" />
<include
android:id="@+id/ad_download_container"
layout="@layout/native_item_app_download"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:visibility="gone"
tools:visibility="visible" />
<include
android:id="@+id/ad_h5_container"
layout="@layout/native_item_h5_open"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:visibility="gone"
tools:visibility="visible" />
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="24dp"
android:layout_marginTop="4dp"
tools:ignore="ContentDescription,RtlHardcoded">
<ImageView
android:layout_width="35dp"
android:layout_height="12dp"
android:layout_alignParentLeft="true"
android:layout_centerVertical="true"
android:src="@mipmap/test_ad_label_gray" />
<ImageView
android:id="@+id/ad_dislike"
android:layout_width="24dp"
android:layout_height="24dp"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:src="@mipmap/test_dislike_gray" />
</RelativeLayout>
</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