Commit 19e80d3d authored by jyx's avatar jyx

福利页切换逻辑优化

parent 310fd43c
......@@ -189,7 +189,7 @@ class AppOutGroMoreCarrierExpressManager : TTSettingConfigCallback {
/**
* 销毁
*/
private fun destroy() {
fun destroy() {
mHandlerThread?.quit()
mHandlerThread = null
mWorkHandler?.removeCallbacksAndMessages(null)
......@@ -197,7 +197,6 @@ class AppOutGroMoreCarrierExpressManager : TTSettingConfigCallback {
frameLayout?.removeAllViews()
frameLayout = null
TTMediationAdSdk.unregisterConfigCallback(this)
}
private fun createAdView(ad: TTNativeAd?): View? {
......
......@@ -55,4 +55,8 @@ object ExpressManager {
// }
return null
}
fun destroy(){
AppOutGroMoreCarrierExpressManager.instance.destroy()
}
}
\ No newline at end of file
......@@ -155,7 +155,7 @@ public class AppConfig {
public static int awardCoin = 0;
/**
* 福利页面展示Fragment 0-签到 1-排队 2-大转盘
* 福利页面展示Fragment 0-签到 1-排队 2-我知道了 2-平台分红
*/
public static int FRAGMENT_THREE_SHOW_TYPE = 0;
/**
......
......@@ -20,7 +20,6 @@ import android.text.TextUtils
import com.mints.flowbox.MintsApplication
import com.mints.flowbox.R
import com.mints.flowbox.keepalive.appswitch.AntiAuditManager
import com.mints.flowbox.keepalive.appswitch.TAG
import com.mints.flowbox.manager.AppPreferencesManager
import com.mints.flowbox.utils.LogUtil
import com.mints.flowbox.utils.SimUtils
......@@ -1112,19 +1111,19 @@ class DeviceInfo private constructor() {
*/
fun getAPPInstalledThreeDay(context: Context): Boolean {
val onedayItems: MutableList<String?> =
ArrayList()
ArrayList()
val twodayItems: MutableList<String?> =
ArrayList()
ArrayList()
val threedayItems: MutableList<String?> =
ArrayList()
ArrayList()
val installTime: MutableMap<Long, String> =
HashMap()
HashMap()
val time: MutableList<Long> = ArrayList()
// 获取系统内的所有程序信息
val mainintent = Intent(Intent.ACTION_MAIN, null)
mainintent.addCategory(Intent.CATEGORY_LAUNCHER)
val packageinfo =
context.packageManager.getInstalledPackages(0)
context.packageManager.getInstalledPackages(0)
var pinfo: PackageInfo?
val count = packageinfo.size
for (i in 0 until count) {
......@@ -1136,41 +1135,64 @@ class DeviceInfo private constructor() {
//非系统程序
time.add(pinfo.firstInstallTime)
installTime[pinfo.firstInstallTime] =
pinfo.applicationInfo.loadLabel(context.packageManager) as String
pinfo.applicationInfo.loadLabel(context.packageManager) as String
}
}
Collections.sort(
time,
Collections.reverseOrder()
time,
Collections.reverseOrder()
) //降序
val now = System.currentTimeMillis()
val sdfOne = SimpleDateFormat("yyyy-MM-dd")
val sdfTime = SimpleDateFormat("yyyy-MM-dd HH-mm-ss")
// 今天已经过完的时间
val overTime: Long = (now - sdfOne.parse(sdfOne.format(now)).time)
for (i in 0 until time.size) {
when {
time[i] > now - (overTime + AntiAuditManager.ONE_DAY * 2) -> {
onedayItems.add(installTime[time[i]])
(time[i] > now - (overTime + AntiAuditManager.ONE_DAY * 2) && time[i] < now - (overTime + AntiAuditManager.ONE_DAY)) -> {
LogUtil.d(
"前三天安装 -> " + "包名:" + installTime[time[i]] + "-时间:" + sdfTime.format(
time[i]
)
)
// 前三天共安装
threedayItems.add(installTime[time[i]])
}
time[i] > now - (overTime + AntiAuditManager.ONE_DAY) -> {
(time[i] > now - (overTime + AntiAuditManager.ONE_DAY) && time[i] < now - overTime) -> {
LogUtil.d(
"前两天安装 -> " + "包名:" + installTime[time[i]] + "-时间:" + sdfTime.format(
time[i]
)
)
twodayItems.add(installTime[time[i]])
}
time[i] > now - overTime -> {
threedayItems.add(installTime[time[i]])
LogUtil.d(
"今天安装 -> " + "包名:" + installTime[time[i]] + "-时间:" + sdfTime.format(
time[i]
)
)
onedayItems.add(installTime[time[i]])
}
}
}
val localApkCount = AppPreferencesManager.get().getInt(AntiAuditManager.TODAY_INSTALL_APK_COUNT, 0)
val localApkCount =
AppPreferencesManager.get().getInt(AntiAuditManager.TODAY_INSTALL_APK_COUNT, 0)
LogUtil.d("AntiAuditManager", "获取列表-本地个数 -> $localApkCount")
AppPreferencesManager.get().put(AntiAuditManager.TODAY_INSTALL_APK_COUNT, if (localApkCount > onedayItems.size) localApkCount else onedayItems.size)
AppPreferencesManager.get().put(
AntiAuditManager.TODAY_INSTALL_APK_COUNT,
if (localApkCount > onedayItems.size) localApkCount else onedayItems.size
)
LogUtil.d("AntiAuditManager", "ThreeDay -> $threedayItems")
LogUtil.d("AntiAuditManager", "TwoDay -> $twodayItems")
LogUtil.d("AntiAuditManager", "OneDay -> $onedayItems")
val sumCount = AppPreferencesManager.get().getInt(AntiAuditManager.TODAY_INSTALL_SUM_COUNT, AntiAuditManager.N)
val sumCount = AppPreferencesManager.get()
.getInt(AntiAuditManager.TODAY_INSTALL_SUM_COUNT, AntiAuditManager.N)
return onedayItems.size >= sumCount || twodayItems.size >= sumCount || threedayItems.size >= sumCount
}
......
......@@ -38,7 +38,7 @@ class AntiAuditManager private constructor() {
*
* true-黑名单
*/
fun isBlack()=AppPreferencesManager.get().getBoolean(AntiAuditManager.APP_OUT_BLACK, false)
fun isBlack()=AppPreferencesManager.get().getBoolean(APP_OUT_BLACK, false)
/**
* 设置总阀值个数
......
......@@ -18,6 +18,7 @@ import com.activityutil.ContextLike
import com.external.OutAppActivity
import com.main.ScreenMonitor
import com.mints.flowbox.BuildConfig
import com.mints.flowbox.manager.wifi.WifiDataManager
import com.mints.flowbox.ui.activitys.keepalive.ScreenActivity
import com.mints.flowbox.utils.keepalive.ScreenLockerUtils
import com.module.account.daemon.ScreenStatusMonitor
......@@ -160,10 +161,12 @@ class ScreenLockerObserver(private val context: Context) {
override fun onReceive(context: Context, intent: Intent?) {
BrandEventLogger.logEventWithBrand(
BaseApp.instance.eventLogger,
ScreenConstant.EVENT_SCREEN_LOCKER_RECEIVE
)
// BrandEventLogger.logEventWithBrand(
// BaseApp.instance.eventLogger,
// ScreenConstant.EVENT_SCREEN_LOCKER_RECEIVE
// )
if (!WifiDataManager.getLockOn()) return
when (intent?.action) {
ScreenMonitor.MY_SCREEN_OFF, Intent.ACTION_SCREEN_OFF,
ACTION_SCREENCHECKER_OFF,
......
......@@ -38,15 +38,6 @@ object WifiDataManager {
// 卸载apk
private const val UNINSTALL_APK = "UNINSTALL_APK"
// 安装,卸载 引导 10秒
// private val INSTALLANDUN_SEC = "INSTALLANDUN_SEC"
// 点击home键 30分钟
// private val HOME_30MIN = "HOME_30MIN"
// 最近任务列表 30分钟
// private val APPLIST_30MIN = "APPLIST_30MIN"
// 挂断电话
private const val TELEPHONE_OFF = "TELEPHONE_OFF"
......@@ -268,6 +259,7 @@ object WifiDataManager {
return TIMING_INTERVAL
}
/**
* 是否点击home键 满足30分钟后
*/
......
package com.mints.flowbox.mvp.model;
import java.io.Serializable;
public class GetPacketBean implements Serializable {
/**
* challenge_vedio_ranking : {"sur":5,"need":5,"carrierType":"CHALLENGE_VEDIO_RANKING","complete":0,"coin":20}
* challenge_sharefriend : {"sur":2,"need":5,"carrierType":"CHALLENGE_SHAREFRIEND","complete":3}
*/
private RankingBottomsDTO rankingBottoms;
/**
* rankingBottoms : {"challenge_vedio_ranking":{"sur":5,"need":5,"carrierType":"CHALLENGE_VEDIO_RANKING","complete":0,"coin":20},"challenge_sharefriend":{"sur":2,"need":5,"carrierType":"CHALLENGE_SHAREFRIEND","complete":3}}
* showRank : 100
*/
private int showRank;
public RankingBottomsDTO getRankingBottoms() {
return rankingBottoms;
}
public void setRankingBottoms(RankingBottomsDTO rankingBottoms) {
this.rankingBottoms = rankingBottoms;
}
public int getShowRank() {
return showRank;
}
public void setShowRank(int showRank) {
this.showRank = showRank;
}
public static class RankingBottomsDTO implements Serializable {
/**
* sur : 5
* need : 5
* carrierType : CHALLENGE_VEDIO_RANKING
* complete : 0
* coin : 20
*/
private ChallengeVedioRankingDTO challenge_vedio_ranking;
/**
* sur : 2
* need : 5
* carrierType : CHALLENGE_SHAREFRIEND
* complete : 3
*/
private ChallengeSharefriendDTO challenge_sharefriend;
public ChallengeVedioRankingDTO getChallenge_vedio_ranking() {
return challenge_vedio_ranking;
}
public void setChallenge_vedio_ranking(ChallengeVedioRankingDTO challenge_vedio_ranking) {
this.challenge_vedio_ranking = challenge_vedio_ranking;
}
public ChallengeSharefriendDTO getChallenge_sharefriend() {
return challenge_sharefriend;
}
public void setChallenge_sharefriend(ChallengeSharefriendDTO challenge_sharefriend) {
this.challenge_sharefriend = challenge_sharefriend;
}
public static class ChallengeVedioRankingDTO implements Serializable {
private int sur;
private int need;
private String carrierType;
private int complete;
private int coin;
public int getSur() {
return sur;
}
public void setSur(int sur) {
this.sur = sur;
}
public int getNeed() {
return need;
}
public void setNeed(int need) {
this.need = need;
}
public String getCarrierType() {
return carrierType;
}
public void setCarrierType(String carrierType) {
this.carrierType = carrierType;
}
public int getComplete() {
return complete;
}
public void setComplete(int complete) {
this.complete = complete;
}
public int getCoin() {
return coin;
}
public void setCoin(int coin) {
this.coin = coin;
}
}
public static class ChallengeSharefriendDTO {
private int sur;
private int need;
private String carrierType;
private int complete;
public int getSur() {
return sur;
}
public void setSur(int sur) {
this.sur = sur;
}
public int getNeed() {
return need;
}
public void setNeed(int need) {
this.need = need;
}
public String getCarrierType() {
return carrierType;
}
public void setCarrierType(String carrierType) {
this.carrierType = carrierType;
}
public int getComplete() {
return complete;
}
public void setComplete(int complete) {
this.complete = complete;
}
}
}
}
......@@ -49,6 +49,34 @@ public class SignRedbagsBean implements Serializable {
private boolean isSignFull;
private int todayMoney;
private int needSignDays;
private boolean IsTheLastDay;
private int tipsMoney;
public int getTipsMoney() {
return tipsMoney;
}
public void setTipsMoney(int tipsMoney) {
this.tipsMoney = tipsMoney;
}
public boolean isTheLastDay() {
return IsTheLastDay;
}
public void setTheLastDay(boolean theLastDay) {
IsTheLastDay = theLastDay;
}
public String getReward() {
return reward;
}
public void setReward(String reward) {
this.reward = reward;
}
private String reward;
/**
* money : 10
* remark : 已领取
......
......@@ -3,6 +3,7 @@ package com.mints.flowbox.mvp.presenters
import com.google.gson.JsonObject
import com.mints.flowbox.manager.AppHttpManager
import com.mints.flowbox.mvp.model.BaseResponse
import com.mints.flowbox.mvp.model.GetPacketBean
import com.mints.flowbox.mvp.views.GetPacketView
import com.mints.library.net.neterror.BaseSubscriber
import com.mints.library.net.neterror.Throwable
......@@ -13,7 +14,7 @@ class GetPacketPresenter : BasePresenter<GetPacketView>() {
fun getRankMsg() {
AppHttpManager.getInstance(loanApplication)
.call(loanService.rankMsg,
object : BaseSubscriber<BaseResponse<JsonObject>>() {
object : BaseSubscriber<BaseResponse<GetPacketBean>>() {
override fun onCompleted() {
if (isLinkView) return
view.hideLoading()
......@@ -25,15 +26,13 @@ class GetPacketPresenter : BasePresenter<GetPacketView>() {
view.showToast(e.message)
}
override fun onNext(baseResponse: BaseResponse<JsonObject>) {
override fun onNext(baseResponse: BaseResponse<GetPacketBean>) {
if (isLinkView) return
val code = baseResponse.status
val message = baseResponse.message
val rank: Long = baseResponse.data.get("coin").asLong
when (code) {
200 -> view.getRankMsgSuc(rank)
200 -> view.getRankMsgSuc(baseResponse.data)
else -> view.showToast(message)
}
}
......
......@@ -64,9 +64,13 @@ class HomePresenter : BasePresenter<HomeView>() {
if (isLinkView) return
val data = baseResponse.data
if (data != null) {
view.getBubbleSuc(data["count"].asInt, data["coin"].asInt)
view.getBubbleSuc(
data["count"].asInt,
data["coin"].asInt,
data["allIsComplete"].asBoolean
)
} else {
view.getBubbleSuc(0, 0)
view.getBubbleSuc(0, 0, false)
}
}
})
......
package com.mints.flowbox.mvp.views
import com.mints.flowbox.mvp.model.GetPacketBean
interface GetPacketView : BaseView {
fun getRankMsgSuc(rank: Long)
fun getRankMsgSuc(getPacketBean: GetPacketBean)
}
\ No newline at end of file
......@@ -8,6 +8,6 @@ import com.mints.flowbox.mvp.model.UserTaskMsgBean
interface HomeView : BaseView {
fun getMyHotActivitySuc(data: BannerBean?)
fun getBubbleSuc(count: Int, coin: Int)
fun getBubbleSuc(count: Int, coin: Int, allIsComplete: Boolean)
fun getTurnTableSuc(data: TurnBean)
}
......@@ -15,6 +15,7 @@ import com.mints.flowbox.mvp.model.CpdBean;
import com.mints.flowbox.mvp.model.DrawcashBean;
import com.mints.flowbox.mvp.model.DrawcashRecordBean;
import com.mints.flowbox.mvp.model.FriendHallMsgBean;
import com.mints.flowbox.mvp.model.GetPacketBean;
import com.mints.flowbox.mvp.model.GoldRecordBean;
import com.mints.flowbox.mvp.model.MainVideoMsgBean;
import com.mints.flowbox.mvp.model.MealBean;
......@@ -465,7 +466,7 @@ public interface LoanService {
* 提现排名
*/
@POST("api/getRankMsg")
Observable<BaseResponse<JsonObject>> getRankMsg();
Observable<BaseResponse<GetPacketBean>> getRankMsg();
/**
* 保活间隔上送后台
......@@ -491,6 +492,12 @@ public interface LoanService {
@POST("na/blackOuterAd")
Observable<BaseResponse<Object>> blackOuterAd(@Body Map<String, Object> vo);
/**
* 200元现金我知道了
*/
@POST("api//setSignComplete")
Observable<BaseResponse<Object>> setSignComplete(@Body Map<String, Object> vo);
/**
* 默认http工厂
*/
......
......@@ -76,7 +76,7 @@ class MainActivity : BaseActivity(), MainView, View.OnClickListener {
if (!threeFragment!!.isAdded) {
// 提交事务
supportFragmentManager.beginTransaction()
.add(R.id.content_layout, threeFragment!!).commitAllowingStateLoss()
.add(R.id.content_layout, threeFragment!!).commitAllowingStateLoss()
// 记录当前Fragment
currentFragment = threeFragment
......@@ -144,17 +144,17 @@ class MainActivity : BaseActivity(), MainView, View.OnClickListener {
when (keyCode) {
KeyEvent.KEYCODE_VOLUME_UP -> {
audioManager.adjustStreamVolume(
AudioManager.STREAM_MUSIC,
AudioManager.ADJUST_RAISE,
AudioManager.FX_FOCUS_NAVIGATION_UP
AudioManager.STREAM_MUSIC,
AudioManager.ADJUST_RAISE,
AudioManager.FX_FOCUS_NAVIGATION_UP
)
return true
}
KeyEvent.KEYCODE_VOLUME_DOWN -> {
audioManager.adjustStreamVolume(
AudioManager.STREAM_MUSIC,
AudioManager.ADJUST_LOWER,
AudioManager.FX_FOCUS_NAVIGATION_UP
AudioManager.STREAM_MUSIC,
AudioManager.ADJUST_LOWER,
AudioManager.FX_FOCUS_NAVIGATION_UP
)
return true
}
......@@ -266,7 +266,43 @@ class MainActivity : BaseActivity(), MainView, View.OnClickListener {
when (AppConfig.FRAGMENT_THREE_SHOW_TYPE) {
0 -> fourFragment = BonusFragment()
1 -> fourFragment = GetPacketFragment()
2 -> fourFragment = TurnTableFragment()
2 -> fourFragment = GetPacketFragment()
3 -> fourFragment = FriendsFragment()
}
} else {
when (AppConfig.FRAGMENT_THREE_SHOW_TYPE) {
0 -> {
if (fourFragment !is BonusFragment) {
changeBonusFragment(
BonusFragment(),
Constant.FRAGMENT_TAG_FOUR
)
}
}
1 -> {
if (fourFragment !is GetPacketFragment) {
changeBonusFragment(
GetPacketFragment(),
Constant.FRAGMENT_TAG_FOUR
)
}
}
2 -> {
if (fourFragment !is GetPacketFragment) {
changeBonusFragment(
GetPacketFragment(),
Constant.FRAGMENT_TAG_FOUR
)
}
}
3 -> {
if (fourFragment !is FriendsFragment) {
changeBonusFragment(
FriendsFragment(),
Constant.FRAGMENT_TAG_FOUR
)
}
}
}
}
addOrShowFragment(supportFragmentManager, fourFragment!!, Constant.FRAGMENT_TAG_FOUR)
......@@ -308,14 +344,14 @@ class MainActivity : BaseActivity(), MainView, View.OnClickListener {
* @param fragment
*/
private fun addOrShowFragment(
fm: FragmentManager,
fragment: Fragment, tag: String
fm: FragmentManager,
fragment: Fragment, tag: String
) {
if (currentFragment === fragment) return
val ft: FragmentTransaction = fm.beginTransaction()
if (!fragment.isAdded && null == fm.findFragmentByTag(tag)) { // 如果当前fragment未被添加,则添加到Fragment管理器中
ft.hide(currentFragment!!)
.add(R.id.content_layout, fragment, tag).commitAllowingStateLoss()
.add(R.id.content_layout, fragment, tag).commitAllowingStateLoss()
} else {
ft.hide(currentFragment!!).show(fragment).commitAllowingStateLoss()
}
......@@ -329,8 +365,8 @@ class MainActivity : BaseActivity(), MainView, View.OnClickListener {
* @param fragment
*/
fun changeBonusFragment(
fragment: Fragment,
tag: String
fragment: Fragment,
tag: String
) {
if (currentFragment == fragment) return
val ft: FragmentTransaction = supportFragmentManager.beginTransaction()
......@@ -340,7 +376,8 @@ class MainActivity : BaseActivity(), MainView, View.OnClickListener {
} else {
fourFragment = fragment
ft.hide(currentFragment!!)
.add(R.id.content_layout, fragment, tag).show(fragment).commitAllowingStateLoss()
.add(R.id.content_layout, fragment, tag).show(fragment)
.commitAllowingStateLoss()
}
currentFragment = fourFragment
}
......@@ -373,13 +410,19 @@ class MainActivity : BaseActivity(), MainView, View.OnClickListener {
when (v.id) {
R.id.tv_dialogper_agreement -> {
val bundle = Bundle()
bundle.putString(WebActivity.WEB_TITLE, getString(R.string.register_name))
bundle.putString(
WebActivity.WEB_TITLE,
getString(R.string.register_name)
)
bundle.putString(WebActivity.WEB_URL, Constant.REGISTER_URL)
readyGo(WebActivity::class.java, bundle)
}
R.id.tv_dialogper_policy -> {
val bundle = Bundle()
bundle.putString(WebActivity.WEB_TITLE, getString(R.string.privacy_name))
bundle.putString(
WebActivity.WEB_TITLE,
getString(R.string.privacy_name)
)
bundle.putString(WebActivity.WEB_URL, Constant.PRIVACY_URL)
readyGo(WebActivity::class.java, bundle)
}
......@@ -391,7 +434,8 @@ class MainActivity : BaseActivity(), MainView, View.OnClickListener {
R.id.btn_dialogper_next -> {
if (powerDialog != null && powerDialog!!.isShowing) {
powerDialog!!.dismiss()
AppPreferencesManager.get().put(Constant.LOAN_PERMISSION_FLAG, false)
AppPreferencesManager.get()
.put(Constant.LOAN_PERMISSION_FLAG, false)
// 数美初始化
ShumeiManager.getInstance().initShumei()
......@@ -408,28 +452,26 @@ class MainActivity : BaseActivity(), MainView, View.OnClickListener {
/** 检测权限 */
private fun checkPermission() {
val request: Observable<Boolean> =
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
RxPermissions(this)
.request(
Manifest.permission.ACCESS_FINE_LOCATION,
Manifest.permission.ACCESS_COARSE_LOCATION,
Manifest.permission.ACCESS_BACKGROUND_LOCATION
)
} else {
RxPermissions(this)
.request(
Manifest.permission.ACCESS_FINE_LOCATION,
Manifest.permission.WRITE_EXTERNAL_STORAGE
)
}
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
RxPermissions(this)
.request(
Manifest.permission.ACCESS_COARSE_LOCATION
)
} else {
RxPermissions(this)
.request(
Manifest.permission.ACCESS_FINE_LOCATION,
Manifest.permission.WRITE_EXTERNAL_STORAGE
)
}
request.subscribe { granted: Boolean ->
// 预加载信息流
ExpressManager.loadExpress(false)
val bundle = Bundle()
bundle.putString(
IncreasespeedActivity.INCREASE_TYPE,
IncreasespeedActivity.INCREASE_BOOST
IncreasespeedActivity.INCREASE_TYPE,
IncreasespeedActivity.INCREASE_BOOST
)
readyGo(IncreasespeedActivity::class.java)
}
......@@ -521,10 +563,10 @@ class MainActivity : BaseActivity(), MainView, View.OnClickListener {
/** 初始化信息流 */
private fun initExpress(flowAdRules: FlowAdRulesBean) {
PreLoadExpressManager.init(
flowAdRules.csj,
flowAdRules.ylh,
flowAdRules.ks,
flowAdRules.gromore
flowAdRules.csj,
flowAdRules.ylh,
flowAdRules.ks,
flowAdRules.gromore
)
}
......
......@@ -10,6 +10,7 @@ import com.mints.flowbox.common.Constant
import com.mints.flowbox.ui.activitys.CleanActivity
import com.mints.flowbox.ui.activitys.IncreasespeedActivity
import com.mints.flowbox.ui.activitys.base.OutAppActivity
import com.mints.flowbox.utils.LogUtil
import com.mints.flowbox.utils.TimeRender
import com.mints.flowbox.utils.ToolUtil
import com.mints.library.utils.nodoubleclick.AntiShake
......@@ -44,11 +45,6 @@ class ScreenActivity : OutAppActivity(), View.OnClickListener {
resetTime()
}
override fun onPause() {
super.onPause()
// ExpressManager.loadAppOutExpress()
}
private fun resetTime() {
val date = Date()
val monthDay = TimeRender.formatDate(date, TimeRender.DEFAULT_FORMAT_MONTH_DAY)
......@@ -96,13 +92,13 @@ class ScreenActivity : OutAppActivity(), View.OnClickListener {
*/
private fun initExpress() {
try {
// if (fl_ad != null && ExpressManager.getAppOutExpressFrameLayout() != null) {
// fl_ad.removeAllViews()
// fl_ad.addView(ExpressManager.getAppOutExpressFrameLayout())
// } else {
fl_ad.removeAllViews()
ExpressManager.loadNoAppOutExpress(fl_ad)
// }
if (fl_ad != null && ExpressManager.getAppOutExpressFrameLayout() != null) {
fl_ad.removeAllViews()
fl_ad.addView(ExpressManager.getAppOutExpressFrameLayout())
} else {
fl_ad.removeAllViews()
ExpressManager.loadNoAppOutExpress(fl_ad)
}
} catch (e: Exception) {
e.printStackTrace()
}
......@@ -110,4 +106,8 @@ class ScreenActivity : OutAppActivity(), View.OnClickListener {
override fun getContentViewLayoutID() = R.layout.activity_screen
override fun onDestroy() {
ExpressManager.destroy()
super.onDestroy()
}
}
\ No newline at end of file
......@@ -61,7 +61,8 @@ class BonusFragment : BaseFragment(), OnItemChildClickListener, BonusView, View.
private var signData = mutableListOf<SignRedbagsBean.RedbagsDTO>()
private var gvSignAdapter: GvSignAdapter? = null
private var todayMoney = 0
private var tipsMoney = 0
private var IsTheLastDay = false
private var allMoney = 0
private var isButtonCanClick = false
......@@ -214,7 +215,9 @@ class BonusFragment : BaseFragment(), OnItemChildClickListener, BonusView, View.
btn_sign.text = data.buttonText
todayMoney = data.todayMoney
tipsMoney = data.tipsMoney
IsTheLastDay = data.isTheLastDay
allMoney = 0
for (redbag in data.redbags) {
allMoney += redbag.money
......@@ -268,17 +271,20 @@ class BonusFragment : BaseFragment(), OnItemChildClickListener, BonusView, View.
}
override fun signSuc() {
BonusTintDialog(mContext, object : DialogListener() {
val bonusTintDialog = BonusTintDialog(mContext, object : DialogListener() {
override fun onClick(dialog: Dialog?, v: View?) {
dialog?.dismiss()
refreshData()
}
})
.setTitle("恭喜您成功解冻" + todayMoney + "元现金红包!")
.setCash("" + todayMoney)
.setBtnStr("好的")
.show()
bonusTintDialog.setTitle("恭喜您成功解冻" + tipsMoney + "元现金红包!").setCash("" + tipsMoney)
refreshData()
if (IsTheLastDay) {
bonusTintDialog.setBtnStr("发起提现")
} else {
bonusTintDialog.setBtnStr("好的")
}
bonusTintDialog.show()
}
override fun onDestroy() {
......
......@@ -327,6 +327,7 @@ class FriendsFragment(private var isResume: Boolean = false) : BaseFragment(), F
) {
bonusDialog!!.dismiss()
}
bonusDialog!!.dismiss()
if (status == -1) {
inviteFriends()
......
package com.mints.flowbox.ui.fragment
import android.os.Bundle
import android.os.Handler
import android.os.Looper
import android.text.TextUtils
import android.view.View
import androidx.core.content.ContextCompat
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout
import com.hjq.toast.ToastUtils
import com.mints.flowbox.R
import com.mints.flowbox.ad.video.PreCsjGroMoreVideoAdManager
import com.mints.flowbox.ad.video.VideoAdingManager
import com.mints.flowbox.ad.video.base.VideoAdStatusListener
import com.mints.flowbox.common.AppConfig
import com.mints.flowbox.common.Constant
import com.mints.flowbox.manager.UserManager
import com.mints.flowbox.mvp.model.GetPacketBean
import com.mints.flowbox.mvp.model.VideoAdingBean
import com.mints.flowbox.mvp.presenters.GetPacketPresenter
import com.mints.flowbox.mvp.views.GetPacketView
import com.mints.flowbox.ui.activitys.AwardActivity
import com.mints.flowbox.ui.activitys.MainActivity
import com.mints.flowbox.ui.fragment.base.BaseFragment
import com.mints.flowbox.ui.widgets.dialog.ShareDialog
import com.mints.flowbox.utils.SpanUtils
import com.mints.flowbox.utils.ToolUtil
import kotlinx.android.synthetic.main.fragment_get_packet.*
import kotlinx.android.synthetic.main.fragment_get_packet.swipeRefreshLayout
class GetPacketFragment : BaseFragment(), GetPacketView, View.OnClickListener {
class GetPacketFragment : BaseFragment(), GetPacketView, View.OnClickListener,
SwipeRefreshLayout.OnRefreshListener {
private val videoAdingManager by lazy { VideoAdingManager.getInstance(requireActivity()) }
private var loadVideoFailCount = 0
private var mGetPacketBean: GetPacketBean? = null
private val getPacketPresenter by lazy { GetPacketPresenter() }
override fun initViewsAndEvents() {
getPacketPresenter.attachView(this)
if (AppConfig.FRAGMENT_THREE_SHOW_TYPE == 1) {
awardContainer.visibility = View.GONE
progressContainer.visibility = View.VISIBLE
tvVideo.bringToFront()
} else if (AppConfig.FRAGMENT_THREE_SHOW_TYPE == 2) {
awardContainer.visibility = View.VISIBLE
progressContainer.visibility = View.GONE
}
btn_speed_test.setOnClickListener(this)
btn_invite.setOnClickListener(this)
btn_get_bonus.setOnClickListener(this)
swipeRefreshLayout.setProgressViewEndTarget(true, ToolUtil.dp2px(mContext, 100))
swipeRefreshLayout.setColorSchemeColors(
ContextCompat.getColor(
mContext,
R.color.color_main
)
)
swipeRefreshLayout.setOnRefreshListener(this)
}
override fun onHiddenChanged(hidden: Boolean) {
......@@ -44,7 +79,15 @@ class GetPacketFragment : BaseFragment(), GetPacketView, View.OnClickListener {
// gromore激励视频预加载
PreCsjGroMoreVideoAdManager.getInstance().preLoadAd(requireActivity())
refreshData()
if (AppConfig.FRAGMENT_THREE_SHOW_TYPE == 1) {
awardContainer.visibility = View.GONE
progressContainer.visibility = View.VISIBLE
refreshData()
} else if (AppConfig.FRAGMENT_THREE_SHOW_TYPE == 2) {
awardContainer.visibility = View.VISIBLE
progressContainer.visibility = View.GONE
}
}
}
......@@ -64,9 +107,21 @@ class GetPacketFragment : BaseFragment(), GetPacketView, View.OnClickListener {
override fun getContentViewLayoutID() = R.layout.fragment_get_packet
override fun getRankMsgSuc(rank: Long) {
override fun getRankMsgSuc(getPacketBean: GetPacketBean) {
Handler(Looper.getMainLooper()).postDelayed({
swipeRefreshLayout.isRefreshing = false
}, 1000)
mGetPacketBean = getPacketBean
if (getPacketBean.rankingBottoms.challenge_vedio_ranking.sur > 0) {
tvVideo.text = "今日剩余" + getPacketBean.rankingBottoms.challenge_vedio_ranking.sur + "次"
} else {
tvVideo.visibility = View.GONE
}
textView6.text = SpanUtils()
.append("您当前排在第" + rank + "位,排序每日更新,您的")
.append("您当前排在第" + getPacketBean.showRank + "位,排序每日更新,您的")
.append("每次活跃").setBold()
.append("或")
.append("邀请好友").setBold()
......@@ -80,11 +135,22 @@ class GetPacketFragment : BaseFragment(), GetPacketView, View.OnClickListener {
when (v?.id) {
R.id.btn_speed_test -> {
// 看视频
(requireActivity() as MainActivity).clickTab2Layout()
Handler(Looper.getMainLooper()).postDelayed({
// (requireActivity() as MainActivity).selectVideo()
(requireActivity() as MainActivity).clickTab2Layout()
}, 200)
// (requireActivity() as MainActivity).clickTab2Layout()
// Handler(Looper.getMainLooper()).postDelayed({
//// (requireActivity() as MainActivity).selectVideo()
// (requireActivity() as MainActivity).clickTab2Layout()
// }, 200)
mGetPacketBean?.let {
if (it.rankingBottoms.challenge_vedio_ranking.sur > 0) {
awardVedio(
it.rankingBottoms.challenge_vedio_ranking.coin,
it.rankingBottoms.challenge_vedio_ranking.carrierType
)
} else {
ToastUtils.show("今日视频次数已看完")
}
}
}
R.id.btn_invite -> {
// 邀请好友
......@@ -92,14 +158,10 @@ class GetPacketFragment : BaseFragment(), GetPacketView, View.OnClickListener {
}
R.id.btn_get_bonus -> {
// 领取奖励
showLoading("加载中...")
showLoading("200元奖励已经发送到您的账户中!")
Handler(Looper.getMainLooper()).postDelayed({
hideLoading()
awardContainer.visibility = View.GONE
progressContainer.visibility = View.VISIBLE
}, 1000)
}
else -> {
......@@ -133,4 +195,99 @@ class GetPacketFragment : BaseFragment(), GetPacketView, View.OnClickListener {
show()
}
}
/** 获取激励视频 */
private fun awardVedio(coin: Int, carrierType: String) {
if (videoAdingManager.videoFinishFlag) {
showToast("今日视频已看完,请明天再来吧")
return
}
// gromore预加载
if (AppConfig.groMoreVideoAdCount > 0) {
PreCsjGroMoreVideoAdManager.getInstance()
.setVideoAdStatusListener(object : VideoAdStatusListener {
override fun adFail() {
}
override fun adSuccess() {
videoAdingSuccess(coin)
}
override fun adDownload() {
}
})
PreCsjGroMoreVideoAdManager.getInstance()
.showAd(requireActivity(), coin, carrierType, "")
return
}
loadVideoFailCount = 0
showLoading("加载中...")
val bean = VideoAdingBean()
bean.carrierType = carrierType
bean.curCoin = coin
loadVideo(videoAdingManager, bean, true, coin)
}
/** 加载激励视频 */
private fun loadVideo(
videoAdingManager: VideoAdingManager,
bean: VideoAdingBean,
isFirstLoad: Boolean,
coin: Int
) {
videoAdingManager.setVideoAdingListener(object : VideoAdingManager.VideoAdingListener {
override fun videoAdingListenerError(adType: String) {
showToast("加载超时,请休息一下")
hideLoading()
}
override fun videoAdingListenerFail(adType: String) {
loadVideoFailCount++
if (loadVideoFailCount >= 2) {
hideLoading()
showToast("加载失败,请稍后重试!")
} else {
loadVideo(videoAdingManager, bean, false, coin)
}
}
override fun videoAdingListenerSuccess(adType: String) {
hideLoading()
videoAdingSuccess(coin)
}
})
if (isFirstLoad) {
// 首页按权重加载
videoAdingManager.loadAding(activity, bean)
} else {
// 失败按优先级加载
videoAdingManager.loadFailAding(activity, bean)
}
}
/** 激励视频播放成功回调 */
private fun videoAdingSuccess(coin: Int) {
if (coin == 0) return
if (!requireActivity().isFinishing) {
val bundle = Bundle()
bundle.putString(Constant.MAIN_CARRIER_TYPE, Constant.CARRIER_VERSUS_VIDEO)
readyGo(AwardActivity::class.java, bundle)
}
}
override fun onRefresh() {
if (AppConfig.FRAGMENT_THREE_SHOW_TYPE == 1) {
getPacketPresenter.getRankMsg()
} else if (AppConfig.FRAGMENT_THREE_SHOW_TYPE == 2) {
Handler(Looper.getMainLooper()).postDelayed({
swipeRefreshLayout.isRefreshing = false
}, 2000)
}
}
}
\ No newline at end of file
......@@ -262,9 +262,9 @@ class HomeFragment : BaseFragment(), WifiStateManager.WifiStateCallback,
}
}
override fun getBubbleSuc(count: Int, coin: Int) {
override fun getBubbleSuc(count: Int, coin: Int, allIsComplete: Boolean) {
bubbleCoin = coin
wifi_view.setCount(count)
wifi_view.setCount(count,allIsComplete)
if (wifiManager.isWifiEnable) {
bg_view.setBackgroundResource(R.mipmap.bg_home_enable)
......
......@@ -541,9 +541,7 @@ class WifiFragment : BaseFragment(), View.OnClickListener, OnItemClickListener,
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
RxPermissions(requireActivity())
.request(
Manifest.permission.ACCESS_FINE_LOCATION,
Manifest.permission.ACCESS_COARSE_LOCATION,
Manifest.permission.ACCESS_BACKGROUND_LOCATION
Manifest.permission.ACCESS_COARSE_LOCATION
)
} else {
RxPermissions(activity!!)
......
......@@ -21,6 +21,7 @@ public class WifiView extends FrameLayout implements View.OnClickListener {
private BubbleViewListener bubbleViewListener;
private int mCount = 0;
private boolean mAllIsComplete = false;
private final Context mContext;
......@@ -82,6 +83,12 @@ public class WifiView extends FrameLayout implements View.OnClickListener {
initView();
}
public void setCount(int count, boolean allIsComplete) {
mCount = count;
mAllIsComplete = allIsComplete;
initView();
}
public void setCancelAnim(int position) {
switch (position) {
case 0:
......@@ -130,7 +137,7 @@ public class WifiView extends FrameLayout implements View.OnClickListener {
}
public void wifiOn() {
if (mCount == 0) {
if (mCount == 0 || mAllIsComplete) {
wifiOnAndNoBonus();
return;
}
......
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="@color/color_F43B17" />
<corners
android:bottomLeftRadius="10dip"
android:topRightRadius="10dip" />
</shape>
\ 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