Commit 8285f2f2 authored by jyx's avatar jyx

枫岚广告集成

parent ae8cbd71
......@@ -202,6 +202,7 @@ dependencies {
implementation("com.yilan.sdk:ui:3.0.0.3") {
exclude group: 'com.yilan.sdk', module: 'toutiao'
exclude group: 'com.yilan.sdk', module: 'gdt'
exclude group: 'com.yilan.sdk', module: 'ks'
}
implementation('com.aliyun.ams:alicloud-android-httpdns:1.2.3@aar') {
transitive true
......@@ -234,6 +235,10 @@ dependencies {
implementation(name: 'bxmsdk-release-3.0.0-csj3300', ext: 'aar')
// 闪电盒子
implementation(name: 'wannuosili_ad_2.0.0', ext: 'aar')
// 枫岚
implementation(name: 'mh-adsdk', ext: 'aar')
implementation(name: 'mh-adsdk-ext', ext: 'aar')
implementation(name: 'ks_3.3.5.3', ext: 'aar')
// testImplementation 'junit:junit:4.13'
......
......@@ -140,7 +140,9 @@
<activity
android:name=".ui.activitys.AboutusActivity"
android:screenOrientation="portrait" />
<activity android:name=".ui.activitys.GuideActivity" />
<activity
android:name=".ui.activitys.GuideActivity"
android:screenOrientation="portrait" />
<activity
android:name=".ui.activitys.LiebaoGameActivity"
android:screenOrientation="portrait" />
......@@ -179,7 +181,7 @@
android:screenOrientation="portrait" />
<activity
android:name=".ui.activitys.AccountMergeActivity"
android:screenOrientation="portrait"/>
android:screenOrientation="portrait" />
<service
android:name=".service.UpdateService"
......
......@@ -50,7 +50,7 @@ class InitAppService : IntentService("InitializeService") {
if (ACTION_INIT == action) {
initApplication()
isInit = false
isInit = true
}
}
}
......
......@@ -14,6 +14,7 @@ import androidx.multidex.MultiDexApplication;
import com.bun.miitmdid.core.JLibrary;
import com.mints.goodmoney.common.Constant;
import com.mints.goodmoney.manager.LiebaoManager;
import com.mints.goodmoney.manager.MhManager;
import com.mints.goodmoney.manager.MiitHelper;
import com.mints.goodmoney.manager.TtCsjAdManager;
import com.mints.goodmoney.manager.WnManager;
......@@ -37,7 +38,7 @@ public class MintsApplication extends MultiDexApplication {
private static MintsApplication mContext;
public static String OAID = "";
private static LocalBroadcastManager mLocalBroadcatManager;
private static LocalBroadcastManager mLocalBroadcastManager;
private Scheduler defaultSubscribeScheduler;
private LoanService loanService;
......@@ -49,12 +50,10 @@ public class MintsApplication extends MultiDexApplication {
@Override
public void onCreate() {
super.onCreate();
mContext = this;
// 判断应用是否在前台
ForegroundOrBackground.init(this);
// 9.0之后不可多进程使用一个目录下的WebView,写在SDK初始化之前
androidPWebView();
// 三方配置
thirdConfig();
}
......@@ -81,6 +80,9 @@ public class MintsApplication extends MultiDexApplication {
super.attachBaseContext(base);
MultiDex.install(base);
// 9.0之后不可多进程使用一个目录下的WebView,写在SDK初始化之前
androidPWebView();
// 移动安全联盟
try {
JLibrary.InitEntry(base);
......@@ -115,6 +117,9 @@ public class MintsApplication extends MultiDexApplication {
// 闪电盒子
WnManager.INSTANCE.initWn(this);
// 枫岚广告
MhManager.INSTANCE.initWn(this);
// 一览视频
YlVideoManager.INSTANCE.init(this);
......@@ -153,10 +158,10 @@ public class MintsApplication extends MultiDexApplication {
* 获得LocalBroadcastManager对象
*/
public static LocalBroadcastManager getLocalBroadcastManager() {
if (mLocalBroadcatManager == null) {
mLocalBroadcatManager = LocalBroadcastManager.getInstance(mContext);
if (mLocalBroadcastManager == null) {
mLocalBroadcastManager = LocalBroadcastManager.getInstance(mContext);
}
return mLocalBroadcatManager;
return mLocalBroadcastManager;
}
public LoanService getLoanService() {
......
package com.mints.goodmoney.ad.video
import android.app.Activity
import com.maplehaze.adsdk.video.RewardVideoAd
import com.mints.goodmoney.common.Constant
import com.mints.goodmoney.manager.MhManager
import com.mints.goodmoney.manager.TrackManager
import com.mints.goodmoney.mvp.presenters.MhVedioAdPresenter
import com.mints.goodmoney.mvp.views.VedioAdManagerView
import com.mints.goodmoney.utils.LogUtil
/**
* 枫岚广告视频
*/
class MhVedioAdManager private constructor(activity: Activity) :
BaseVideoAd(activity), VedioAdManagerView {
private val TAG = MhVedioAdManager::class.java.simpleName
private var mhVdedioAdPresenter: MhVedioAdPresenter? = null
private var mhVedioAdListener: MhVedioAdListener? = null
private var mRewardVideoAd: RewardVideoAd? = null
private var isClickScreen: Boolean = true
override var activity: Activity? = null
companion object {
private var _inst: MhVedioAdManager? = null
fun getInstance(activity: Activity): MhVedioAdManager? {
return if (_inst != null) {
_inst
} else {
_inst = MhVedioAdManager(activity)
_inst
}
}
}
init {
init(activity)
}
private fun init(activity: Activity) {
this.activity = activity
mhVdedioAdPresenter = MhVedioAdPresenter()
mhVdedioAdPresenter?.attachView(this)
}
override fun loadAd(activity: Activity, curCoin: Int, carrierType: String, extraId: String?) {
this.activity = activity
isClickScreen = true
var postId: String = when (carrierType) {
Constant.CARRIER_VERSUS_VIDEO -> MhManager.POS_ID
Constant.CARRIER_HOMEWATER -> MhManager.POS_ID
Constant.CARRIER_CHALLENGE_TURN, Constant.CARRIER_DRAWCASH -> MhManager.POS_ID
Constant.CARRIER_CHALLENGE_CARD -> MhManager.POS_ID
else -> MhManager.POS_ID
}
val orientation = RewardVideoAd.VERTICAL
mRewardVideoAd = RewardVideoAd(activity, MhManager.APP_ID, postId, orientation, object : RewardVideoAd.RewardVideoListener {
override fun onADCached() {
LogUtil.d(TAG, "onADCached")
mRewardVideoAd?.showAd(activity)
}
override fun onADShow() {
LogUtil.d(TAG, "onADShow")
TrackManager.getInstance().addCallImp(Constant.AD_SOURCE_FL, Constant.EVENT_TYPE_ZERO, "", "")
}
override fun onReward() {
LogUtil.d(TAG, "onReward")
}
override fun onADClick() {
LogUtil.d(TAG, "onADClick")
TrackManager.getInstance().addCallImp(Constant.AD_SOURCE_FL, Constant.EVENT_TYPE_TWO, "", "")
if (isClickScreen) {
// 防止重复
TrackManager.getInstance().addCallImp(Constant.AD_SOURCE_FL, Constant.EVENT_TYPE_FOUR, "", "")
isClickScreen = false
}
if (mhVedioAdListener != null) {
mhVedioAdListener?.mhVedioAdDownload()
}
}
override fun onVideoComplete() {
LogUtil.d(TAG, "onVideoComplete")
}
override fun onADClose() {
LogUtil.d(TAG, "onADClose")
mhVdedioAdPresenter?.reportAddCoinMsg(activity, getAdMapVO(carrierType, Constant.AD_SOURCE_FL, extraId, curCoin))
TrackManager.getInstance().addCallImp(Constant.AD_SOURCE_FL, Constant.EVENT_TYPE_THREE, "", "")
if (mhVedioAdListener != null) {
mhVedioAdListener?.mhVedioAdSuccess()
}
}
override fun onADError(p0: Int) {
LogUtil.d(TAG, "onADError->$p0")
TrackManager.getInstance().addCallImp(Constant.AD_SOURCE_FL, Constant.EVENT_TYPE_ONE, (p0).toString(), "")
if (mhVedioAdListener != null) {
mhVedioAdListener?.mhVedioAdFail()
}
}
})
mRewardVideoAd?.loadAd()
}
fun setMhVedioAdListener(mhVedioAdListener: MhVedioAdListener?) {
this.mhVedioAdListener = mhVedioAdListener
}
interface MhVedioAdListener {
fun mhVedioAdSuccess()
fun mhVedioAdFail()
fun mhVedioAdDownload()
}
override fun onDestory() {
mhVdedioAdPresenter?.let {
it.dispose()
it.detachView()
}
mRewardVideoAd = null
activity = null
}
}
\ No newline at end of file
......@@ -26,22 +26,22 @@ public class VedioAdingManager {
private WnVedioAdManager wnVedioAdManager;
private CsjVedioAdManager csjVedioAdManager;
private YlhVedioAdManager ylhVedioAdManager;
private MhVedioAdManager mhVedioAdManager;
private int wnWeight;
private int ylhWeight;
private int csjVedioWeight;
private int flVedioWeight;
private ArrayList<WeightBean> weightList;
private Activity activity;
private boolean isVedioAdDownload = false;// 是否点击广告下载 true-点击
public static VedioAdingManager getInstance(Activity activity) {
if (_inst != null) {
return _inst;
} else {
if (_inst == null) {
_inst = new VedioAdingManager(activity);
return _inst;
}
return _inst;
}
private VedioAdingManager(Activity activity) {
......@@ -58,9 +58,20 @@ public class VedioAdingManager {
csjVedioAdManager = CsjVedioAdManager.getInstance(activity);
ylhVedioAdManager = YlhVedioAdManager.getInstance(activity);
wnVedioAdManager = WnVedioAdManager.Companion.getInstance(activity);
mhVedioAdManager = MhVedioAdManager.Companion.getInstance(activity);
weightList = new ArrayList<>();
}
/**
* 初始化广告权重
*/
public void initAdWeight(int csjVedioWeight, int ylhWeight, int wnWeight, int flVedioWeight) {
this.csjVedioWeight = csjVedioWeight;
this.ylhWeight = ylhWeight;
this.wnWeight = wnWeight;
this.flVedioWeight = flVedioWeight;
}
/**
* 初始化广告权重
*/
......@@ -81,6 +92,17 @@ public class VedioAdingManager {
loadAdVedio(getVedioAdType(), bean);
}
/**
* 根据类型加载对应视频(第一次加载)
*
* @param bean
*/
public void loadAding(Activity activity, VedioAdingBean bean, int i) {
this.activity = activity;
isVedioAdDownload = false;
loadAdVedio(Constant.FL_VEDIO_AD, bean);
}
/**
* 加载失败优先级对应视频
*
......@@ -101,6 +123,8 @@ public class VedioAdingManager {
String nextAdType = "";
if (AppConfig.csjVedioAdCount > 0) {
nextAdType = Constant.CSJ_VEDIO_AD;
} else if (AppConfig.flVedioAdCount > 0) {
nextAdType = Constant.FL_VEDIO_AD;
} else if (AppConfig.ylhAdCount > 0) {
nextAdType = Constant.YLH_VEDIO_AD;
} else {
......@@ -143,6 +167,11 @@ public class VedioAdingManager {
weight = weight + csjVedioWeight;
LogUtil.d(TAG, "权重值:csjVedioWeight:" + csjVedioWeight);
}
if (AppConfig.flVedioAdCount > 0) {
weightList.add(new WeightBean(flVedioWeight, Constant.FL_VEDIO_AD));
weight = weight + flVedioWeight;
LogUtil.d(TAG, "权重值:flVedioWeight:" + flVedioWeight);
}
if (AppConfig.ylhAdCount > 0) {
weightList.add(new WeightBean(ylhWeight, Constant.YLH_VEDIO_AD));
weight = weight + ylhWeight;
......@@ -186,8 +215,9 @@ public class VedioAdingManager {
int csjVedioAdCount = AppConfig.csjVedioAdCount;
int ylhAdCount = AppConfig.ylhAdCount;
int wnAdCount = AppConfig.wnVedioAdCount;
int flVedioAdCount = AppConfig.flVedioAdCount;
if (ylhAdCount <= 0 && csjVedioAdCount <= 0 && wnAdCount <= 0) {
if (ylhAdCount <= 0 && csjVedioAdCount <= 0 && wnAdCount <= 0 && flVedioAdCount <= 0) {
// showToast("今日视频已看完,请明天再来吧");
return true;
}
......@@ -208,12 +238,16 @@ public class VedioAdingManager {
ylhVedioAdManager.onDestory();
ylhVedioAdManager = null;
}
if (wnVedioAdManager != null) {
wnVedioAdManager.setWnVedioAdListener(null);
wnVedioAdManager.onDestory();
wnVedioAdManager = null;
}
if (mhVedioAdManager != null) {
mhVedioAdManager.setMhVedioAdListener(null);
mhVedioAdManager.onDestory();
mhVedioAdManager = null;
}
activity = null;
}
......@@ -342,8 +376,41 @@ public class VedioAdingManager {
isVedioAdDownload = true;
}
});
wnVedioAdManager.loadAd(activity, bean.getCurCoin(), bean.getCarrierType(), bean.getExtraId());
} else if (TextUtils.equals(vedioAdType, Constant.FL_VEDIO_AD)) {
// 枫岚广告激励视频
if (mhVedioAdManager == null) {
if (activity == null) {
if (vedioAdingListener != null) {
vedioAdingListener.vedioAdingListenerError(Constant.FL_VEDIO_AD);
}
return;
}
mhVedioAdManager = MhVedioAdManager.Companion.getInstance(activity);
}
mhVedioAdManager.setMhVedioAdListener(new MhVedioAdManager.MhVedioAdListener() {
@Override
public void mhVedioAdSuccess() {
AppConfig.flVedioAdCount--;
if (vedioAdingListener != null) {
vedioAdingListener.vedioAdingListenerSuccess(Constant.FL_VEDIO_AD);
}
}
@Override
public void mhVedioAdFail() {
if (vedioAdingListener != null) {
vedioAdingListener.vedioAdingListenerFail(Constant.FL_VEDIO_AD);
}
}
@Override
public void mhVedioAdDownload() {
isVedioAdDownload = true;
}
});
mhVedioAdManager.loadAd(activity, bean.getCurCoin(), bean.getCarrierType(), bean.getExtraId());
}
} catch (Exception e) {
e.printStackTrace();
......
......@@ -31,5 +31,9 @@ public class AppConfig {
* wnVedio 剩余广告播放数
*/
public static int wnVedioAdCount = 5;
/**
* flVedio 剩余广告播放数
*/
public static int flVedioAdCount = 5;
}
......@@ -123,6 +123,7 @@ object Constant {
const val AD_SOURCE_CSJ = "CSJ"
const val AD_SOURCE_YLH = "YLH"
const val AD_SOURCE_SDHZ = "SDHZ" //闪电盒子
const val AD_SOURCE_FL = "FL" //枫岚
// 调用事件 0 成功 1失败 2点击 3-有效展示 4-去重
const val EVENT_TYPE_ZERO = "0"
......@@ -141,6 +142,7 @@ object Constant {
const val CSJ_VEDIO_AD = "CSJ_VEDIO_AD"
const val YLH_VEDIO_AD = "YLH_VEDIO_AD"
const val SDHZ_VEDIO_AD = "SDHZ_VEDIO_AD"
const val FL_VEDIO_AD = "Fl_VEDIO_AD"
// 游戏类型
......
package com.mints.goodmoney.manager
import android.app.Application
import com.maplehaze.adsdk.MaplehazeSDK
/**
* 描述:枫岚激励视频
* 作者:孟崔广
*/
object MhManager {
const val APP_ID = "10200"
const val POS_ID = "56834"
/**
* 初始化
*/
fun initWn(application: Application) {
MaplehazeSDK.init(application)
}
}
\ No newline at end of file
......@@ -60,6 +60,7 @@ public class DrawcashBean implements Serializable {
private int SDHZ_VEDIO;
private int CSJ_VEDIO;
private int YLH_VEDIO;
private int FL_VEDIO;
public int getSDHZ_VEDIO() {
return SDHZ_VEDIO;
......@@ -72,6 +73,10 @@ public class DrawcashBean implements Serializable {
public int getYLH_VEDIO() {
return YLH_VEDIO;
}
public int getFL_VEDIO() {
return FL_VEDIO;
}
}
public class CashOutMoneyArrBean implements Serializable {
......
......@@ -7,8 +7,9 @@ public class VedioRulesBean implements Serializable {
private CsjVedioBean CSJ_VEDIO;
private YlhVedioBean YLH_VEDIO;
private SdhzVedioBean SDHZ_VEDIO;
private FLVedioBean FL_VEDIO;
public class CsjVedioBean implements Serializable{
public class CsjVedioBean implements Serializable {
private int surplus;//剩余可看视频数
private int rate;//权重
......@@ -21,7 +22,7 @@ public class VedioRulesBean implements Serializable {
}
}
public class YlhVedioBean implements Serializable{
public class YlhVedioBean implements Serializable {
private int surplus;
private int rate;
......@@ -34,7 +35,7 @@ public class VedioRulesBean implements Serializable {
}
}
public class SdhzVedioBean implements Serializable{
public class SdhzVedioBean implements Serializable {
private int surplus;
private int rate;
......@@ -47,6 +48,23 @@ public class VedioRulesBean implements Serializable {
}
}
public class FLVedioBean implements Serializable {
private int surplus;
private int rate;
public int getSurplus() {
return surplus;
}
public int getRate() {
return rate;
}
}
public FLVedioBean getFL_VEDIO() {
return FL_VEDIO;
}
public CsjVedioBean getCSJ_VEDIO() {
return CSJ_VEDIO;
}
......
package com.mints.goodmoney.mvp.presenters
import android.app.Activity
import com.mints.goodmoney.MintsApplication
import com.mints.goodmoney.mvp.model.BaseResponse
import com.mints.goodmoney.mvp.views.VedioAdManagerView
import com.mints.library.net.neterror.BaseSubscriber
import com.mints.library.net.neterror.Throwable
import rx.Subscription
import rx.android.schedulers.AndroidSchedulers
import java.util.*
class MhVedioAdPresenter : BasePresenter<VedioAdManagerView>() {
fun reportAddCoinMsg(activity: Activity?, vo: HashMap<String, Any>) {
if (activity == null) return
loanApplication = activity.application as MintsApplication
loanService = loanApplication.loanService
subscription = loanService.reportAddCoinMsg(vo)
.observeOn(AndroidSchedulers.mainThread())
.subscribeOn(loanApplication.defaultSubscribeScheduler())
.subscribe(object : BaseSubscriber<BaseResponse<Any>>() {
override fun onCompleted() {}
override fun onError(e: Throwable) {
}
override fun onNext(baseResponse: BaseResponse<Any>) {}
})
}
fun dispose() {
loanService = null
loanApplication = null
if (subscription != null && !subscription.isUnsubscribed()) {
subscription.unsubscribe()
}
}
}
\ No newline at end of file
......@@ -15,7 +15,7 @@ class WnVedioAdPresenter : BasePresenter<VedioAdManagerView>() {
fun reportAddCoinMsg(activity: Activity?, vo: HashMap<String, Any>) {
if (activity == null) return
loanApplication = activity.application as MintsApplication
loanService = loanApplication.getLoanService()
loanService = loanApplication.loanService
subscription = loanService.reportAddCoinMsg(vo)
.observeOn(AndroidSchedulers.mainThread())
.subscribeOn(loanApplication.defaultSubscribeScheduler())
......
......@@ -269,6 +269,7 @@ class DrawcashActivity : BaseActivity(),
* 设置视频权重
*/
private fun initAdWeight(data: DrawcashBean.VedioRules) {
// vedioAdingManager?.initAdWeight(data.csJ_VEDIO, data.ylH_VEDIO, data.sdhZ_VEDIO, data.fL_VEDIO)
vedioAdingManager?.initAdWeight(data.csJ_VEDIO, data.ylH_VEDIO, data.sdhZ_VEDIO)
LogUtil.d(TAG, "提现权重值:csjWeight:${data.csJ_VEDIO} ylhWeight:${data.ylH_VEDIO} sdhzWeight:${data.sdhZ_VEDIO}")
// 广告视频数
......
......@@ -3,10 +3,8 @@ package com.mints.goodmoney.ui.activitys
import android.os.Bundle
import android.view.KeyEvent
import android.view.View
import android.view.View.OnLongClickListener
import android.view.ViewGroup
import android.webkit.WebChromeClient
import com.github.lzyzsd.jsbridge.BridgeHandler
import com.github.lzyzsd.jsbridge.CallBackFunction
import com.github.lzyzsd.jsbridge.DefaultHandler
import com.mints.goodmoney.BuildConfig
......@@ -83,22 +81,20 @@ class EraseActivity : BaseActivity(), View.OnClickListener{
private fun loadTurnUrl() {
getTurnUrl()
blEarseWebview.setDefaultHandler(DefaultHandler())
blEarseWebview.setWebChromeClient(WebChromeClient())
blEarseWebview.setOnLongClickListener(OnLongClickListener { true })
blEarseWebview.registerHandler("getEraseResult", BridgeHandler { data, function ->
if(!isFinishing){
blEarseWebview.webChromeClient = WebChromeClient()
blEarseWebview.setOnLongClickListener { true }
blEarseWebview.registerHandler("getEraseResult") { data, _ ->
if (!isFinishing) {
val turntableBean: TurntableBean = JsonUtil.parseJson(data, TurntableBean::class.java)
if (turntableBean != null) {
val bundle = Bundle()
bundle.putInt(Constant.MAIN_CUR_COIN, turntableBean.getCoin())
bundle.putInt(Constant.MAIN_CUR_COIN, turntableBean.coin)
bundle.putString(Constant.MAIN_CARRIER_TYPE, carrierType)
bundle.putString(Constant.MAIN_EXTRA_ID, turntableBean.getKey())
bundle.putString(Constant.MAIN_EXTRA_ID, turntableBean.key)
readyGo(AwardActivity::class.java, bundle)
androidCallJsReferse()
}
}
})
blEarseWebview.setDefaultHandler(object : DefaultHandler() {
override fun handler(data: String, function: CallBackFunction) {
showToast(data)
......@@ -110,7 +106,7 @@ class EraseActivity : BaseActivity(), View.OnClickListener{
* 获取url
*/
private fun getTurnUrl() {
val tokenID: String = userManager.getTokenID()
val tokenID: String = userManager.tokenID
val url: String = BuildConfig.MainIp+ "hang/card.html?carrierType=" + carrierType + "&token=" + tokenID
LogUtil.d("getTurnUrl",url)
blEarseWebview.loadUrl(url)
......
package com.mints.goodmoney.ui.activitys
import android.annotation.SuppressLint
import android.text.Editable
import android.text.TextUtils
import android.text.TextWatcher
......@@ -54,13 +55,14 @@ class FeedbackActivity : BaseActivity()
etFeedbackContent.addTextChangedListener(object : TextWatcher {
override fun beforeTextChanged(s: CharSequence, start: Int, count: Int, after: Int) {}
@SuppressLint("SetTextI18n")
override fun onTextChanged(s: CharSequence, start: Int, before: Int, count: Int) {
if (s.toString().trim { it <= ' ' }.length > maxLength) {
etFeedbackContent.setText(s.toString().substring(0, maxLength))
etFeedbackContent.setSelection(maxLength)
showToast("您最多能输入150个字")
}
tvFeedbackCount.setText(etFeedbackContent.getText().toString().length.toString() + "/150")
tvFeedbackCount.text = etFeedbackContent.text.toString().length.toString() + "/150"
}
override fun afterTextChanged(s: Editable) {}
......
......@@ -62,7 +62,7 @@ class GuideActivity : BaseActivity() {
mImageViews.add(imageView)
}
val viewPagerAdapter = ViewPagerAdapter(mImageViews)
vp_guide_viewpager.setAdapter(viewPagerAdapter)
vp_guide_viewpager.adapter = viewPagerAdapter
vp_guide_viewpager.setOnPageChangeListener(mOnPagerChangeListener)
}
......@@ -72,16 +72,16 @@ class GuideActivity : BaseActivity() {
private val mOnPagerChangeListener: OnPageChangeListener = object : OnPageChangeListener {
//当界面切换完成的时候调用的方法
override fun onPageSelected(position: Int) {
pageIndicatorView.setSelection(position)
pageIndicatorView.selection = position
if (position == mImageViews.size - 1) {
val alphaAnimator = ObjectAnimator.ofFloat(btn_guide_start, "alpha", 0f, 1f)
alphaAnimator.repeatCount = 0
animatorSet.play(alphaAnimator)
animatorSet.duration = 1500
animatorSet.start()
btn_guide_start.setVisibility(View.VISIBLE)
btn_guide_start.visibility = View.VISIBLE
} else {
btn_guide_start.setVisibility(View.INVISIBLE)
btn_guide_start.visibility = View.INVISIBLE
}
}
......
......@@ -20,8 +20,8 @@ import java.util.*
* 作者:孟崔广
* 时间:2020/10/12 10:09
*/
class LiebaoGameActivity : BaseActivity()
, View.OnClickListener, GameView,
class LiebaoGameActivity : BaseActivity(),
View.OnClickListener, GameView,
IAppCallback,
IGamePlayTimeCallback,
IGameAdCallback,
......@@ -89,17 +89,16 @@ class LiebaoGameActivity : BaseActivity()
}
override fun gameInfo(sumTime: Int, sumCoin: Int, gameTime: Int) {
if(!isFinishing){
if (!isFinishing) {
tvGameHint.visibility = View.VISIBLE
if (gameTime >= sumTime) {
tvGameHint.setText("今日游戏任务已完成")
tvGameHint.text = "今日游戏任务已完成"
} else {
tvGameHint.setText(
SpanUtils()
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("$sumCoin").setForegroundColor(mContext.resources.getColor(R.color.color_cb4a39)).append("金币, ")
.append("已玩").append("${gameTime / 60}").setForegroundColor(mContext.resources.getColor(R.color.color_FF9837)).append("分钟")
.create())
.create()
}
}
}
......
......@@ -13,7 +13,6 @@ import com.mints.goodmoney.R
import com.mints.goodmoney.ad.video.VedioAdingManager
import com.mints.goodmoney.common.AppConfig
import com.mints.goodmoney.common.Constant
import com.mints.goodmoney.manager.TTPreLoadCarrierExpressManager
import com.mints.goodmoney.manager.ZhangyueManager
import com.mints.goodmoney.mvp.views.MainView
import com.mints.goodmoney.ui.activitys.base.BaseActivity
......
......@@ -51,7 +51,7 @@ class MobileLoginActivity : BaseActivity()
finish()
}
R.id.tvLoginSendcode -> {
var mobile = etLoginMobile.getText().toString().trim()
var mobile = etLoginMobile.text.toString().trim()
if (mobile.length < 13) {
showToast("请输入手机号")
return
......@@ -62,13 +62,13 @@ class MobileLoginActivity : BaseActivity()
loginPresenter.sendMobileCode(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
......@@ -107,7 +107,7 @@ class MobileLoginActivity : BaseActivity()
}
override fun sendCodeSuc() {
if (!isFinishing()) {
if (!isFinishing) {
sendCodeThread()
}
}
......@@ -141,18 +141,18 @@ class MobileLoginActivity : BaseActivity()
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--
LogUtil.d("login", "login num:" + num)
LogUtil.d("login", "login num:$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)
}
}
......
......@@ -236,7 +236,7 @@ class SettingsActivity : BaseActivity(), View.OnClickListener, OnLoginListener,
val dialog = AlertDialog.Builder(this)
.setTitle("请输入邀请码")
.setPositiveButton("确定") { dialog, which ->
.setPositiveButton("确定") { dialog, _ ->
if (etInput.text.isEmpty()) {
showToast("请输入邀请码")
} else {
......@@ -244,7 +244,7 @@ class SettingsActivity : BaseActivity(), View.OnClickListener, OnLoginListener,
}
}
.setNegativeButton("取消") { dialog, which ->
.setNegativeButton("取消") { dialog, _ ->
dialog.dismiss()
}
.create()
......@@ -290,14 +290,14 @@ class SettingsActivity : BaseActivity(), View.OnClickListener, OnLoginListener,
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) {
......
......@@ -54,8 +54,6 @@ class SplashADActivity : BaseActivity(), SplashADListener {
}
}
// 预加载好兔视频
YLLittleVideoFragment.preloadVideo()
}
override fun isApplyKitKatTranslucency(): Boolean {
......
......@@ -33,9 +33,6 @@ class SplashActivity : BaseActivity() {
// 校验APP签名
checkAppSign()
// 预加载好兔视频
YLLittleVideoFragment.preloadVideo()
}
override fun getContentViewLayoutID() = R.layout.activity_splash
......@@ -52,12 +49,10 @@ class SplashActivity : BaseActivity() {
override fun onDestroy() {
super.onDestroy()
if (mAlph != null) mAlph.cancel()
if (animationSet != null) {
mAlph.cancel()
animationSet.cancel()
animationSet.setAnimationListener(null)
}
}
/**
......@@ -68,6 +63,9 @@ class SplashActivity : BaseActivity() {
if (!deviceInfo.signInfo) {
finish()
} else {
// 预加载好兔视频
YLLittleVideoFragment.preloadVideo()
setAnimation()
}
}
......
......@@ -65,9 +65,6 @@ class SplashYlhActivity : BaseActivity(), SplashADListener {
}
// 校验APP签名
checkAppSign()
// 预加载好兔视频
YLLittleVideoFragment.preloadVideo()
}
override fun isApplyKitKatTranslucency(): Boolean {
......
......@@ -28,11 +28,11 @@ class WebActivity : BaseActivity(), View.OnClickListener {
}
override fun initViewsAndEvents() {
pb_web.setProgress(0)
pb_web.progress = 0
if (TextUtils.isEmpty(title)) {
tv_activity_title.setText("推荐")
tv_activity_title.text = "推荐"
} else {
tv_activity_title.setText(title)
tv_activity_title.text = title
}
if (!TextUtils.isEmpty(url)
......@@ -46,7 +46,7 @@ class WebActivity : BaseActivity(), View.OnClickListener {
}
if (!TextUtils.isEmpty(url)) {
browser_layout.webView?.setWebViewClient(object : WebViewClient() {
browser_layout.webView?.webViewClient = object : WebViewClient() {
override fun shouldOverrideUrlLoading(
view: WebView,
url: String
......@@ -63,10 +63,7 @@ class WebActivity : BaseActivity(), View.OnClickListener {
return super.shouldOverrideUrlLoading(view, url)
}
override fun onPageFinished(view: WebView, url: String) {
super.onPageFinished(view, url)
}
})
browser_layout.loadUrl(url)
} else {
showToast("获取URL地址失败")
......
......@@ -139,14 +139,14 @@ class WxLoginActivity : 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) {
......@@ -170,8 +170,8 @@ class WxLoginActivity : BaseActivity()
}
override fun updateDrawState(ds: TextPaint) {
ds.setColor(resources.getColor(R.color.color_FF9837))
ds.setUnderlineText(false)
ds.color = resources.getColor(R.color.color_FF9837)
ds.isUnderlineText = false
}
})
.append("、")
......@@ -184,8 +184,8 @@ class WxLoginActivity : BaseActivity()
}
override fun updateDrawState(ds: TextPaint) {
ds.setColor(resources.getColor(R.color.color_FF9837))
ds.setUnderlineText(false)
ds.color = resources.getColor(R.color.color_FF9837)
ds.isUnderlineText = false
}
})
.append("与您的利益切身相关。请您注册前务必仔细阅读!点击登录即表示您同意并愿意遵守好赚钱协议")
......
......@@ -5,14 +5,11 @@ import android.content.Intent
import android.content.pm.ApplicationInfo
import android.net.Uri
import android.os.Build
import android.text.TextUtils
import android.view.View
import android.view.ViewGroup
import android.webkit.WebSettings
import android.webkit.WebViewClient
import com.mints.goodmoney.R
import com.mints.goodmoney.common.AppConfig
import com.mints.goodmoney.common.Constant
import com.mints.goodmoney.manager.UserManager
import com.mints.goodmoney.ui.fragment.base.LazyLoadBaseFragment
import com.mints.goodmoney.utils.LogUtil
......@@ -20,7 +17,6 @@ import com.mints.goodmoney.utils.MD5
import com.mints.goodmoney.utils.URIEncoder
import kotlinx.android.synthetic.main.fragment_main_dh.*
/**
* 描述:电魂游戏
* 作者:孟崔广
......
......@@ -175,9 +175,6 @@ class FriendsFragment : BaseFragment(), FriendsView, OnRefreshListener, View.OnC
}
2 -> {
friendsPresenter.getContributionLeaders()
}
else -> {
}
}
}
......@@ -223,8 +220,6 @@ class FriendsFragment : BaseFragment(), FriendsView, OnRefreshListener, View.OnC
2 -> {
friendsPresenter.getContributionLeaders()
}
else -> {
}
}
}
}
......
......@@ -21,6 +21,11 @@ import kotlinx.android.synthetic.main.fragment_horiz_channel.cdvvYilanTime
import kotlinx.android.synthetic.main.fragment_horiz_channel.vs_tips
import net.grandcentrix.tray.AppPreferences
/**
* 描述:横版视频页面
* 作者:孟崔广
* 时间:2020/10/29 13:48
*/
class HorizChannelFragment : BaseFragment(), HorizChannelView, View.OnClickListener {
private val TAG = HorizChannelFragment::class.java.simpleName
......
......@@ -490,6 +490,7 @@ class MainFragment : BaseFragment(), HomeView, View.OnClickListener {
* 设置视频权重
*/
private fun initAdWeight(data: UserTaskMsgBean) {
// vedioAdingManager?.initAdWeight(data.vedioRules.csJ_VEDIO.rate, data.vedioRules.ylH_VEDIO.rate, data.vedioRules.sdhZ_VEDIO.rate, data.vedioRules.fL_VEDIO.rate)
vedioAdingManager?.initAdWeight(data.vedioRules.csJ_VEDIO.rate, data.vedioRules.ylH_VEDIO.rate, data.vedioRules.sdhZ_VEDIO.rate)
LogUtil.d(TAG, "首页权重值:csjWeight:${data.vedioRules.csJ_VEDIO.rate} ylhWeight:${data.vedioRules.ylH_VEDIO.rate} sdhzWeight:${data.vedioRules.sdhZ_VEDIO.rate}")
// 广告视频数
......
......@@ -16,7 +16,6 @@ import com.mints.goodmoney.ad.banner.BannerManager
import com.mints.goodmoney.ad.video.VedioAdingManager
import com.mints.goodmoney.common.AppConfig
import com.mints.goodmoney.common.Constant
import com.mints.goodmoney.common.DeviceInfo
import com.mints.goodmoney.manager.*
import com.mints.goodmoney.mvp.model.*
import com.mints.goodmoney.mvp.presenters.MyPresenter
......@@ -690,31 +689,31 @@ class MyFragment : BaseFragment(), MyView, OnItemChildClickListener, OnRefreshLi
}
}
/**
* 跳转QQ弹框
*/
private fun jumpQQ() {
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 -> {
}
R.id.dialog_btn_right -> {
QQJumpUtil.jumpQQ(requireActivity())
}
}
}
})
cdaa!!.setTitle("提示")
cdaa!!.setContent("好赚钱想要打开QQ")
cdaa!!.setLeft("取消")
cdaa!!.setRight("打开")
cdaa!!.show()
}
// /**
// * 跳转QQ弹框
// */
// private fun jumpQQ() {
// 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 -> {
//
// }
// R.id.dialog_btn_right -> {
// QQJumpUtil.jumpQQ(requireActivity())
// }
// }
// }
// })
// cdaa!!.setTitle("提示")
// cdaa!!.setContent("好赚钱想要打开QQ")
// cdaa!!.setLeft("取消")
// cdaa!!.setRight("打开")
// cdaa!!.show()
// }
/**
* 跳转QQ群弹框
......@@ -849,12 +848,13 @@ class MyFragment : BaseFragment(), MyView, OnItemChildClickListener, OnRefreshLi
* 设置视频权重
*/
private fun initAdWeight(data: UserTaskMsgBean) {
vedioAdingManager?.initAdWeight(data.vedioRules.csJ_VEDIO.rate, data.vedioRules.ylH_VEDIO.rate, data.vedioRules.sdhZ_VEDIO.rate)
LogUtil.d(TAG, "首页权重值:csjWeight:${data.vedioRules.csJ_VEDIO.rate} ylhWeight:${data.vedioRules.ylH_VEDIO.rate} sdhzWeight:${data.vedioRules.sdhZ_VEDIO.rate}")
vedioAdingManager.initAdWeight(data.vedioRules.csJ_VEDIO.rate, data.vedioRules.ylH_VEDIO.rate, data.vedioRules.sdhZ_VEDIO.rate)
// vedioAdingManager.initAdWeight(data.vedioRules.csJ_VEDIO.rate, data.vedioRules.ylH_VEDIO.rate, data.vedioRules.sdhZ_VEDIO.rate, data.vedioRules.fL_VEDIO.rate)
LogUtil.d(TAG, "首页权重值:csjWeight:${data.vedioRules.csJ_VEDIO.rate} ylhWeight:${data.vedioRules.ylH_VEDIO.rate} sdhzWeight:${data.vedioRules.sdhZ_VEDIO.rate} flWeight:${data.vedioRules.fL_VEDIO.rate}")
// 广告视频数
AppConfig.csjVedioAdCount = data.vedioRules.csJ_VEDIO.surplus
AppConfig.ylhAdCount = data.vedioRules.ylH_VEDIO.surplus
AppConfig.wnVedioAdCount = data.vedioRules.sdhZ_VEDIO.surplus
LogUtil.d(TAG, "首页视频数:csjCount:${AppConfig.csjVedioAdCount} ylhCount:${AppConfig.ylhAdCount} sdhzCount:${AppConfig.wnVedioAdCount}")
LogUtil.d(TAG, "首页视频数:csjCount:${AppConfig.csjVedioAdCount} ylhCount:${AppConfig.ylhAdCount} sdhzCount:${AppConfig.wnVedioAdCount} flCount:${AppConfig.flVedioAdCount}")
}
}
\ No newline at end of file
......@@ -3,7 +3,6 @@ package com.mints.goodmoney.ui.fragment
import android.os.Bundle
import android.text.TextUtils
import android.view.MotionEvent
import android.view.View
import android.webkit.WebChromeClient
import com.github.lzyzsd.jsbridge.CallBackFunction
import com.github.lzyzsd.jsbridge.DefaultHandler
......@@ -49,7 +48,7 @@ class PanFragment : BaseFragment(), PanView {
override fun onResume() {
super.onResume()
if (AppConfig.fragmentClickFlag === Constant.FRAGMENT_CLICK_PAN) {
if (AppConfig.fragmentClickFlag == Constant.FRAGMENT_CLICK_PAN) {
if (TextUtils.isEmpty(userManager?.userID)) {
// 游客登录
panPresenter.userLogin()
......@@ -73,18 +72,13 @@ class PanFragment : BaseFragment(), PanView {
*/
private fun loadTurnUrl() {
getTurnUrl()
blTurntableWebview.setOnTouchListener(object : View.OnTouchListener {
override fun onTouch(v: View?, event: MotionEvent): Boolean {
return event.action == MotionEvent.ACTION_MOVE
}
})
blTurntableWebview.setOnTouchListener { _, event -> event.action == MotionEvent.ACTION_MOVE }
blTurntableWebview.setDefaultHandler(DefaultHandler())
blTurntableWebview.webChromeClient = WebChromeClient()
blTurntableWebview.setOnLongClickListener { true }
//注册监听方法当js中调用callHandler方法时会调用此方法(handlerName必须和js中相同)
blTurntableWebview.registerHandler("getTurnResult") { data, function ->
blTurntableWebview.registerHandler("getTurnResult") { data, _ ->
val turntableBean: TurntableBean = JsonUtil.parseJson(data, TurntableBean::class.java)
if (turntableBean != null) {
val bundle = Bundle()
bundle.putInt(Constant.MAIN_CUR_COIN, turntableBean.coin)
bundle.putString(Constant.MAIN_CARRIER_TYPE, carrierType)
......@@ -93,7 +87,6 @@ class PanFragment : BaseFragment(), PanView {
androidCallJsReferse()
}
}
blTurntableWebview.setDefaultHandler(object : DefaultHandler() {
override fun handler(data: String, function: CallBackFunction) {
showToast(data)
......
......@@ -92,7 +92,7 @@ class ZhangyueFragment : LazyLoadBaseFragment(), BookView, IreaderApi.OnReadChan
} else {
tvZhangContent.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("$sumCoin").setForegroundColor(mContext.resources.getColor(R.color.color_cb4a39)).append("金币, ")
.append("已读").append("${readTime / 60}").setForegroundColor(mContext.resources.getColor(R.color.color_FF9837)).append("分钟")
.create()
}
......
......@@ -6,49 +6,37 @@ import android.view.MotionEvent;
import androidx.viewpager.widget.ViewPager;
public class MyViewPager extends ViewPager
{
public class MyViewPager extends ViewPager {
public MyViewPager(Context context)
{
public MyViewPager(Context context) {
super(context);
}
public MyViewPager(Context context, AttributeSet attrs)
{
public MyViewPager(Context context, AttributeSet attrs) {
super(context, attrs);
// TODO Auto-generated constructor stub
}
private boolean isCanScroll = false;
public void setCanScroll(boolean isCanScroll)
{
public void setCanScroll(boolean isCanScroll) {
this.isCanScroll = isCanScroll;
}
@Override
public boolean onTouchEvent(MotionEvent arg0)
{
if (isCanScroll)
{
public boolean onTouchEvent(MotionEvent arg0) {
if (isCanScroll) {
return super.onTouchEvent(arg0);
}
else
{
} else {
return false;
}
}
@Override
public boolean onInterceptTouchEvent(MotionEvent arg0)
{
if (isCanScroll)
{
public boolean onInterceptTouchEvent(MotionEvent arg0) {
if (isCanScroll) {
return super.onInterceptTouchEvent(arg0);
}
else
{
} else {
return false;
}
}
......
......@@ -784,8 +784,8 @@ public class BubbleSeekBar extends View {
mProgress = (mThumbCenterX - mLeft) * mDelta / mTrackLength + mMin;
mBubbleCenterRawX = mBubbleCenterRawSolidX + mThumbCenterX - mLeft;
mLayoutParams.x = (int) (mBubbleCenterRawX + 0.5f);
if (mBubbleView.getParent() != null && mWindowManager != null) {
mLayoutParams.x = (int) (mBubbleCenterRawX + 0.5f);
mWindowManager.updateViewLayout(mBubbleView, mLayoutParams);
}
mBubbleView.setProgressText(isShowProgressInFloat ?
......
......@@ -24,7 +24,7 @@ object SystemUtils {
am.runningAppProcesses
?: return null
for (procInfo in runningApps) {
if (procInfo.pid === pid) {
if (procInfo.pid == pid) {
return procInfo.processName
}
}
......
......@@ -38,7 +38,6 @@
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/color_F8F8F8"
android:orientation="vertical">
<RelativeLayout
......@@ -294,8 +293,7 @@
android:orientation="vertical"
app:layout_constraintEnd_toStartOf="@id/ll2"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/line"
tools:layout_editor_absoluteY="9dp">
app:layout_constraintTop_toBottomOf="@id/line">
<TextView
android:id="@+id/friends_sum"
......@@ -322,8 +320,7 @@
android:orientation="vertical"
app:layout_constraintEnd_toStartOf="@id/ll3"
app:layout_constraintStart_toEndOf="@id/ll1"
app:layout_constraintTop_toBottomOf="@id/line"
tools:layout_editor_absoluteY="9dp">
app:layout_constraintTop_toBottomOf="@id/line">
<TextView
android:id="@+id/friends_directly_sum"
......@@ -353,8 +350,7 @@
android:orientation="vertical"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@id/ll2"
app:layout_constraintTop_toBottomOf="@id/line"
tools:layout_editor_absoluteY="9dp">
app:layout_constraintTop_toBottomOf="@id/line">
<TextView
android:id="@+id/friends_indirect_sum"
......
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