Commit 93a4e04d authored by mengcuiguang's avatar mengcuiguang

代码优化

parent e6ac82fb
......@@ -127,7 +127,7 @@
<!-- </activity>-->
<activity
android:name=".ui.activitys.SplashYlhActivity"
android:name=".ui.activitys.SplashActivity"
android:screenOrientation="portrait"
android:theme="@style/NormalSplash">
<intent-filter>
......
......@@ -34,62 +34,63 @@ class MainActivity : BaseActivity(), MainView, View.OnClickListener {
// 底部标签切换的Fragment
private var moneyFragment: Fragment? = null
private var turnTableFragment: Fragment? = null
private var panFragment: Fragment? = null
private var friendsFragment: Fragment? = null
private var myFragment: Fragment? = null
private var channelFragment: Fragment? = null
private var kuYinyueFragment: Fragment? = null
private var idiomFragment: Fragment? = null
private var wzFragment: Fragment? = null
private var foodSubsidyFragment: Fragment? = null
private var currentFragment: Fragment? = null
private var mainFriendsStatus: Int = 0// 0-平台分红 1-微转 2-猜成语,防止线程不一样
private var isMainShowWz: Boolean = false// 是否显示来电秀,防止线程不一样
override fun getContentViewLayoutID() = R.layout.activity_main
override fun initViewsAndEvents() {
showShortVedioLayout()
if (moneyFragment == null) {
moneyFragment = MoneyFragment()
// ZhangyueManager.onCreateIreader(baseApplication)
// MokuManager.init(this)
// showShortVedioLayout()
AppConfig.fragmentClickFlag = Constant.FRAGMENT_CLICK_FIVE
if (myFragment == null) {
myFragment = MyFragment()
}
if (!moneyFragment!!.isAdded) {
if (!myFragment!!.isAdded) {
// 提交事务
supportFragmentManager.beginTransaction()
.add(R.id.content_layout, moneyFragment!!).commitAllowingStateLoss()
.add(R.id.content_layout, myFragment!!).commitAllowingStateLoss()
// 记录当前Fragment
currentFragment = moneyFragment
currentFragment = myFragment
}
mainFriendsStatus=AppConfig.mainFriendsStatus
// 0-平台分红 1-微转 2-猜成语,防止线程不一样
when (mainFriendsStatus) {
0 -> {
tab_iv_four.setImageResource(R.drawable.tab_friends_btn)
tab_tv_four.text = "平台分红"
mainFriendsStatus = 0
}
1 -> {
tab_iv_four.setImageResource(R.drawable.tab_friends_btn)
tab_tv_four.text = "分享"
mainFriendsStatus = 1
}
2 -> {
tab_iv_four.setImageResource(R.drawable.tab_wz_share_btn)
tab_tv_four.text = "猜成语"
mainFriendsStatus = 2
}
}
tab_iv_one.isSelected = true
tab_tv_one.isSelected = true
tab_rl_one.setOnClickListener(this)
tab_rl_three.setOnClickListener(this)
tab_rl_two.setOnClickListener(this)
tab_rl_five.isSelected = true
tab_iv_four.setImageResource(R.drawable.tab_friends_btn)
tab_tv_four.text = "饭补"
// if (AppConfig.isMainShowWz) {
// tab_iv_four.setImageResource(R.drawable.tab_wz_share_btn)
// tab_tv_four.text = "猜成语"
// isMainShowWz = true
// } else {
// tab_iv_four.setImageResource(R.drawable.tab_friends_btn)
// tab_tv_four.text = "平台分红"
// isMainShowWz = false
// }
// tab_iv_one.isSelected = true
// tab_tv_one.isSelected = true
//
// tab_rl_one.setOnClickListener(this)
// tab_rl_three.setOnClickListener(this)
// tab_rl_two.setOnClickListener(this)
tab_rl_four.setOnClickListener(this)
tab_rl_five.setOnClickListener(this)
}
......@@ -97,6 +98,7 @@ class MainActivity : BaseActivity(), MainView, View.OnClickListener {
override fun isApplyKitKatTranslucency() = false
public override fun onDestroy() {
super.onDestroy()
TTPreLoadCarrierExpressManager.getInstance().onDestroy()
......@@ -136,10 +138,10 @@ class MainActivity : BaseActivity(), MainView, View.OnClickListener {
override fun onClick(view: View) {
when (view.id) {
R.id.tab_rl_one -> clickTab1Layout()
R.id.tab_rl_two -> clickTab2Layout()
// R.id.tab_rl_one -> clickTab1Layout()
// R.id.tab_rl_two -> clickTab2Layout()
R.id.tab_rl_four -> clickTab4Layout()
R.id.tab_rl_three -> clickTab3Layout()
// R.id.tab_rl_three -> clickTab3Layout()
R.id.tab_rl_five -> clickTab5Layout()
}
}
......@@ -154,10 +156,10 @@ class MainActivity : BaseActivity(), MainView, View.OnClickListener {
}
addOrShowFragment(supportFragmentManager, moneyFragment!!, Constant.FRAGMENT_TAG_ONE)
tab_iv_one.isSelected = true
tab_tv_one.isSelected = true
tab_iv_two.isSelected = false
tab_tv_two.isSelected = false
// tab_iv_one.isSelected = true
// tab_tv_one.isSelected = true
// tab_iv_two.isSelected = false
// tab_tv_two.isSelected = false
// tab_iv_three.isSelected = false
// tab_tv_three.isSelected = false
tab_iv_four.isSelected = false
......@@ -200,10 +202,10 @@ class MainActivity : BaseActivity(), MainView, View.OnClickListener {
channelFragment = HorizonChannelFragment()
}
addOrShowFragment(supportFragmentManager, channelFragment!!, Constant.FRAGMENT_TAG_TWO)
tab_iv_one.isSelected = false
tab_tv_one.isSelected = false
tab_iv_two.isSelected = true
tab_tv_two.isSelected = true
// tab_iv_one.isSelected = false
// tab_tv_one.isSelected = false
// tab_iv_two.isSelected = true
// tab_tv_two.isSelected = true
// tab_iv_three.isSelected = false
// tab_tv_three.isSelected = false
tab_iv_four.isSelected = false
......@@ -217,45 +219,65 @@ class MainActivity : BaseActivity(), MainView, View.OnClickListener {
* 点击第四个tab
*/
fun clickTab4Layout() {
AppConfig.fragmentClickFlag = Constant.FRAGMENT_CLICK_FOUR
// 0-平台分红 1-微转 2-猜成语,防止线程不一样
when (mainFriendsStatus) {
0 -> {
if (friendsFragment == null) {
friendsFragment = FriendsFragment()
}
addOrShowFragment(supportFragmentManager, friendsFragment!!, Constant.FRAGMENT_TAG_FOUR)
}
1 -> {
if (wzFragment == null) {
wzFragment = WzFragment()
}
addOrShowFragment(supportFragmentManager, wzFragment!!, Constant.FRAGMENT_TAG_FOUR)
}
2 -> {
if (!AppConfig.scene_flag) {
SceneManager.signIn(this)
}
if (TextUtils.isEmpty(UserManager.getInstance().userID)) {
showToast("请先登录账号")
return
}
// 猜成语
if (idiomFragment == null) {
idiomFragment = SceneIdiomFragment()
}
addOrShowFragment(supportFragmentManager, idiomFragment!!, Constant.FRAGMENT_TAG_FOUR)
}
// 猜成语
AppConfig.fragmentClickFlag = Constant.FRAGMENT_CLICK_FOUR
if (foodSubsidyFragment == null) {
foodSubsidyFragment = FoodSubsidyFragment()
}
tab_iv_one.isSelected = false
tab_tv_one.isSelected = false
tab_iv_two.isSelected = false
tab_tv_two.isSelected = false
addOrShowFragment(supportFragmentManager, foodSubsidyFragment!!, Constant.FRAGMENT_TAG_FOUR)
// tab_iv_one.isSelected = false
// tab_tv_one.isSelected = false
// tab_iv_two.isSelected = false
// tab_tv_two.isSelected = false
tab_iv_four.isSelected = true
tab_tv_four.isSelected = true
tab_iv_five.isSelected = false
tab_tv_five.isSelected = false
// 是否显示微转
// if (isMainShowWz) {
//// if (!AppConfig.scene_flag) {
//// SceneManager.signIn(this)
//// }
//
// if (TextUtils.isEmpty(UserManager.getInstance().userID)) {
// showToast("请先登录账号")
// return
// }
//
// // 猜成语
// AppConfig.fragmentClickFlag = Constant.FRAGMENT_CLICK_FOUR
// if (idiomFragment == null) {
// idiomFragment = SceneIdiomFragment()
// }
// addOrShowFragment(supportFragmentManager, idiomFragment!!, Constant.FRAGMENT_TAG_FOUR)
//
//// tab_iv_one.isSelected = false
//// tab_tv_one.isSelected = false
//// tab_iv_two.isSelected = false
//// tab_tv_two.isSelected = false
// tab_iv_four.isSelected = true
// tab_tv_four.isSelected = true
// tab_iv_five.isSelected = false
// tab_tv_five.isSelected = false
// } else {
// AppConfig.fragmentClickFlag = Constant.FRAGMENT_CLICK_FOUR
// if (friendsFragment == null) {
// friendsFragment = FriendsFragment()
// }
// addOrShowFragment(supportFragmentManager, friendsFragment!!, Constant.FRAGMENT_TAG_FOUR)
//
//// tab_iv_one.isSelected = false
//// tab_tv_one.isSelected = false
//// tab_iv_two.isSelected = false
//// tab_tv_two.isSelected = false
// tab_iv_four.isSelected = true
// tab_tv_four.isSelected = true
// tab_iv_five.isSelected = false
// tab_tv_five.isSelected = false
// }
}
/**
......@@ -263,14 +285,14 @@ class MainActivity : BaseActivity(), MainView, View.OnClickListener {
*/
private fun clickTab3Layout() {
AppConfig.fragmentClickFlag = Constant.FRAGMENT_CLICK_THREE
if (turnTableFragment == null) {
turnTableFragment = TurnTableFragment()
if (panFragment == null) {
panFragment = PanFragment()
}
addOrShowFragment(supportFragmentManager, turnTableFragment!!, Constant.FRAGMENT_TAG_THREE)
tab_iv_one.isSelected = false
tab_tv_one.isSelected = false
tab_iv_two.isSelected = false
tab_tv_two.isSelected = false
addOrShowFragment(supportFragmentManager, panFragment!!, Constant.FRAGMENT_TAG_THREE)
// tab_iv_one.isSelected = false
// tab_tv_one.isSelected = false
// tab_iv_two.isSelected = false
// tab_tv_two.isSelected = false
// tab_iv_three.isSelected = true
// tab_tv_three.isSelected = true
tab_iv_four.isSelected = false
......@@ -288,10 +310,10 @@ class MainActivity : BaseActivity(), MainView, View.OnClickListener {
myFragment = MyFragment()
}
addOrShowFragment(supportFragmentManager, myFragment!!, Constant.FRAGMENT_TAG_FIVE)
tab_iv_one.isSelected = false
tab_tv_one.isSelected = false
tab_iv_two.isSelected = false
tab_tv_two.isSelected = false
// tab_iv_one.isSelected = false
// tab_tv_one.isSelected = false
// tab_iv_two.isSelected = false
// tab_tv_two.isSelected = false
// tab_iv_three.isSelected = false
// tab_tv_three.isSelected = false
tab_iv_four.isSelected = false
......@@ -320,10 +342,10 @@ class MainActivity : BaseActivity(), MainView, View.OnClickListener {
}
fun showShortVedioLayout() {
if (AppConfig.showAdFlag) {
tab_rl_two.visibility = View.VISIBLE
} else {
tab_rl_two.visibility = View.GONE
}
// if (AppConfig.showAdFlag) {
// tab_rl_two.visibility = View.VISIBLE
// } else {
// tab_rl_two.visibility = View.GONE
// }
}
}
\ No newline at end of file
package com.mints.goodmoney.ui.fragment
import android.os.Bundle
import com.mints.goodmoney.R
import com.mints.goodmoney.common.Constant
import com.mints.goodmoney.mvp.model.MealBean
import com.mints.goodmoney.mvp.presenters.FoodSubsidyPresenter
import com.mints.goodmoney.mvp.views.FoodSubsidyView
import com.mints.goodmoney.ui.activitys.AwardActivity
import com.mints.goodmoney.ui.fragment.base.BaseFragment
import com.mints.goodmoney.ui.widgets.MealView
import com.mints.goodmoney.ui.widgets.StepView
import kotlinx.android.synthetic.main.fragment_food_subsidy.*
class FoodSubsidyFragment : BaseFragment(), FoodSubsidyView, StepView.StepViewListener, MealView.MealViewListener {
private val foodSubsidyPresenter by lazy { FoodSubsidyPresenter() }
private var curCoin = 0//点击的汽泡金币
private var buttonCoin = 0//点击的汽泡金币
private var isCanClickVideo = false
override fun getContentViewLayoutID() = R.layout.fragment_food_subsidy
override fun initViewsAndEvents() {
foodSubsidyPresenter.attachView(this)
initListener()
}
override fun onResume() {
super.onResume()
// initExpress()
foodSubsidyPresenter.getMealMsg()
}
override fun onDestroy() {
super.onDestroy()
svWalk?.destoryAnim()
// flSubsidykAd?.removeAllViews()
foodSubsidyPresenter.detachView()
}
private fun initListener() {
svWalk.setMealViewListener(this)
}
override fun clickWater(water: Int, waterCoin: String) {
if (water == 0) {
val bundle = Bundle()
bundle.putInt(Constant.MAIN_CUR_COIN, buttonCoin)
bundle.putString(Constant.MAIN_CARRIER_TYPE, Constant.CARRIER_EATMEAL)
readyGo(AwardActivity::class.java, bundle)
} else {
if (isCanClickVideo) {
val bundle = Bundle()
bundle.putInt(Constant.MAIN_CUR_COIN, curCoin)
bundle.putString(Constant.MAIN_CARRIER_TYPE, Constant.CARRIER_EATMEAL_SUBSIDY)
readyGo(AwardActivity::class.java, bundle)
svWalk.setCancelAnim(water)
} else {
val bundle = Bundle()
bundle.putString(Constant.MAIN_CARRIER_TYPE, Constant.CARRIER_EATMEAL_SUBSIDY_NOT)
readyGo(AwardActivity::class.java, bundle)
}
}
// 预加载信息流
// TTPreLoadCarrierExpressManager.getInstance().loadTtFrameLayout(TtCsjAdManager.TT_AD_NATIVEEXPRESS_EAT)
}
/**
* 初始化信息iyc
*/
private fun initExpress() {
// try {
// if (TTPreLoadCarrierExpressManager.getInstance().ttFrameLayout != null) {
// if (flSubsidykAd != null) {
// flSubsidykAd.removeAllViews()
// flSubsidykAd.addView(TTPreLoadCarrierExpressManager.getInstance().ttFrameLayout)
// }
// }
// } catch (e: Exception) {
// e.printStackTrace()
// }
}
override fun getFoodSubsidySuc(data: MealBean) {
svWalk.setThreeBtnGone()
curCoin = data.vedioCoin
buttonCoin = data.buttonCoin
this.isCanClickVideo = data.isCanClickVedio
for (i in 0 until data.vedioCount) {
svWalk.setWaterTextviewLayout(i + 1, 0)
}
// 是否可领取奖励
if (data.isCanClickButton) {
svWalk.setTvDrinkBtnEnable()
} else {
svWalk.setTvDrinkBtnNone()
}
svWalk.setTvDrinkBtnText(data.buttonMsg)
}
}
\ No newline at end of file
......@@ -9,6 +9,7 @@ import android.content.Intent
import android.content.IntentFilter
import android.os.Bundle
import android.text.TextUtils
import android.view.Gravity
import android.view.LayoutInflater
import android.view.View
import android.widget.AdapterView
......@@ -41,8 +42,10 @@ import com.mints.goodmoney.ui.adapter.ViewPagerAdapter
import com.mints.goodmoney.ui.adapter.listener.OnItemChildClickListener
import com.mints.goodmoney.ui.fragment.base.BaseFragment
import com.mints.goodmoney.ui.widgets.ShareDialog
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.ui.widgets.dialog.PowerDialog
import com.mints.goodmoney.ui.widgets.seekbar.BubbleUtils
import com.mints.goodmoney.utils.*
import com.mints.library.net.netstatus.NetUtils
......@@ -79,17 +82,21 @@ class MyFragment : BaseFragment(),
OnItemChildClickListener,
OnRefreshListener,
View.OnClickListener,
AdapterView.OnItemClickListener, AdBannerAdapter.OnPageClickListener {
AdapterView.OnItemClickListener {
private val ps by lazy { AppPreferences(context) }
private val myPresenter by lazy { MyPresenter() }
private val userManager by lazy { UserManager.getInstance() }
private lateinit var vedioAdingManager: VideoAdingManager
private var loadVedioFailCount = 0
companion object {
// 热门活动每页展示数据
const val HOT_PAGE_SIZE = 8
}
private val ps by lazy { AppPreferences(context) }
private val myPresenter by lazy { MyPresenter() }
private val userManager by lazy { UserManager.getInstance() }
private lateinit var videoAdingManager: VideoAdingManager
private var loadVideoFailCount = 0
// 热门活动下标
private var mCurrentIndex = 0
private var userConfig: MyInfo? = null
private val hotList: MutableList<BannerBean.ListBean> = mutableListOf()
......@@ -108,18 +115,15 @@ class MyFragment : BaseFragment(),
// 任务数据
private val dataList: MutableList<MyInfo.AutoListBean> = mutableListOf()
private var mainMyAdapter: MainMyAdapter? = null
// Banner
private var mAdBannerAdapter: AdBannerAdapter? = null
private var mBannerData: RotationChartBean? = null
// private var mainMyAdapter: MainMyAdapter? = null
// 高额任务
private var mCurrentPkg: String? = null
private var mReceiverBroadcastReceiver: BroadcastReceiver? = null
// 热门活动下标
private var mCurrentIndex = 0
private var cdaa: CustomDialogAsApple? = null
private var powerDialog: PowerDialog? = null
override fun getContentViewLayoutID() = R.layout.fragment_main_my
......@@ -127,12 +131,13 @@ class MyFragment : BaseFragment(),
myPresenter.attachView(this)
srl_my.setOnRefreshListener(this)
showPowerDialog()
initManager()
initView()
initRecy()
// initRecy()
}
override fun onHiddenChanged(hidden: Boolean) {
if (hidden) { // 不在最前端界面显示
onPause()
......@@ -144,48 +149,47 @@ class MyFragment : BaseFragment(),
override fun onPause() {
super.onPause()
banner_view.stopAutoScroll()
item_clock_signview.stopRedbox()
}
override fun onResume() {
super.onResume()
if (AppConfig.fragmentClickFlag == Constant.FRAGMENT_CLICK_FIVE) {
DownloadApkManager.tryOnceInstallApk()
if (!TextUtils.isEmpty(userManager.userID)) {
myPresenter.getAutoUserHallBaseMsg()
refreshHighTask()
// refreshHighTask()
} else {
// 游客登录
myPresenter.userLogin()
}
// 防止banner刷新太快
// if (AntiShake.check(fl_my_banner?.id)) return
// BannerManager.getTtBanner(TtCsjAdManager.TT_AD_BANNER_MY, fl_my_banner)
// 刷新喜马拉雅信息流
TTPreLoadExpressXmlyManager.getInstance().loadTtFrameLayout()
// TTPreLoadExpressXmlyManager.getInstance().loadTtFrameLayout()
}
}
/**
* 刷新高额任务
*/
private fun refreshHighTask() {
if (AppConfig.isHighTask && mCurrentPkg != null) {
if (AppTryPlayManager.getTryPlayIsOK(mCurrentPkg!!, 30)) {
myPresenter.setHighTaskType(Constant.CARRIER_HIGH_ACTIVITY, "1")
} else {
val bundle = Bundle()
bundle.putInt(Constant.MAIN_CUR_COIN, 0)
bundle.putString(Constant.MAIN_CARRIER_TYPE, Constant.CARRIER_HIGH_ACTIVITY)
readyGo(AwardActivity::class.java, bundle)
myPresenter.setHighTaskType(Constant.CARRIER_HIGH_ACTIVITY, "0")
}
AppConfig.isHighTask = false
}
}
// private fun refreshHighTask() {
// if (AppConfig.isHighTask && mCurrentPkg != null) {
// if (AppTryPlayManager.getTryPlayIsOK(mCurrentPkg!!, 30)) {
// myPresenter.setHighTaskType(Constant.CARRIER_HIGH_ACTIVITY, "1")
// } else {
// val bundle = Bundle()
// bundle.putInt(Constant.MAIN_CUR_COIN, 0)
// bundle.putString(Constant.MAIN_CARRIER_TYPE, Constant.CARRIER_HIGH_ACTIVITY)
// readyGo(AwardActivity::class.java, bundle)
//
// myPresenter.setHighTaskType(Constant.CARRIER_HIGH_ACTIVITY, "0")
// }
// AppConfig.isHighTask = false
// }
// }
override fun onDestroyView() {
item_clock_signview.onDestory()
......@@ -194,8 +198,7 @@ class MyFragment : BaseFragment(),
override fun onDestroy() {
super.onDestroy()
fl_my_banner?.removeAllViews()
BxmManager.onDestory()
// fl_my_banner?.removeAllViews()
BannerManager.onDestroy()
myPresenter.detachView()
......@@ -211,12 +214,11 @@ class MyFragment : BaseFragment(),
}
myPresenter.getSignInHomePageMsg()
myPresenter.myHotActivity()
myPresenter.getHallBaseMsg()
myPresenter.myRotationChart()
// myPresenter.myHotActivity()
// myPresenter.getHallBaseMsg()
userConfig = data
handleRecyData()
// handleRecyData()
setUserLoginStatus()
}
......@@ -269,11 +271,9 @@ class MyFragment : BaseFragment(),
piv_grid.setAnimationType(AnimationType.THIN_WORM)
vp_grid.adapter = ViewPagerAdapter(pagerList)
// vp_grid.addOnPageChangeListener(object : ViewPager.OnPageChangeListener {
// override fun onPageScrollStateChanged(state: Int) {
// }
// override fun onPageScrollStateChanged(state: Int) {}
//
// override fun onPageScrolled(position: Int, positionOffset: Float, positionOffsetPixels: Int) {
// }
// override fun onPageScrolled(position: Int, positionOffset: Float, positionOffsetPixels: Int) {}
//
// override fun onPageSelected(position: Int) {
// mCurrentIndex = position
......@@ -296,14 +296,15 @@ class MyFragment : BaseFragment(),
}
override fun signInHomePageSuc() {
val bundle = Bundle()
bundle.putInt(Constant.MAIN_CUR_COIN, curSignCoin)
bundle.putString(Constant.MAIN_CARRIER_TYPE, Constant.CARRIER_SIGNIN_HOMEPAGE_AWARD)
readyGo(AwardActivity::class.java, bundle)
// val bundle = Bundle()
// bundle.putInt(Constant.MAIN_CUR_COIN, curSignCoin)
// bundle.putString(Constant.MAIN_CARRIER_TYPE, Constant.CARRIER_SIGNIN_HOMEPAGE_AWARD)
// readyGo(AwardActivity::class.java, bundle)
}
override fun userLoginSuc() {
SceneManager.signIn(requireActivity())
// SceneManager.signIn(requireActivity())
RsNewsManager.init(baseApplication)
myPresenter.getAutoUserHallBaseMsg()
myPresenter.getHallBaseMsg()
......@@ -320,7 +321,9 @@ class MyFragment : BaseFragment(),
// 更新权重
initAdWeight(data)
initExpress(data.flowAdRules)
AppConfig.app_black_name = data.userRiskApps.userRiskAppName
AppConfig.app_black_pkg = data.userRiskApps.userRiskAppPkg
AppConfig.flVideoFlag = data.vedioRules.isFlVideoFlag
......@@ -350,37 +353,8 @@ class MyFragment : BaseFragment(),
}
}
/**
* 设置Banner
*/
override fun getMyRotationChartSuc(data: RotationChartBean) {
mBannerData = data
if (mBannerData?.list == null || mBannerData?.list!!.size == 0) {
mAdBannerAdapter = null
fl_my_banner.visibility = View.VISIBLE
LogUtil.d("TAG", "getMyRotationChartSuc")
banner_view.visibility = View.GONE
banner_view.stopAutoScroll()
BannerManager.getTtBanner(TtCsjAdManager.TT_AD_BANNER_MY, fl_my_banner)
} else {
fl_my_banner.visibility = View.GONE
banner_view.visibility = View.VISIBLE
mAdBannerAdapter = AdBannerAdapter(activity)
mAdBannerAdapter?.let {
val list: MutableList<RotationChartBean.ListBean?> = mutableListOf()
list.addAll(mBannerData?.list!!)
list.add(data.position, null)
it.setOnPageClickListener(this)
it.setData(list)
it.setAdPosition(data.position)
banner_view.setAdapter(it)
}
banner_view.startAutoScroll()
}
TODO("Not yet implemented")
}
override fun onRefresh(refreshLayout: RefreshLayout) {
......@@ -391,7 +365,6 @@ class MyFragment : BaseFragment(),
} else {
myPresenter.userLogin()
}
}
/**
......@@ -476,7 +449,7 @@ class MyFragment : BaseFragment(),
if (nowDate == day) {
if (finalSignStatus == 1) {
carrierType = Constant.CARRIER_SIGNIN_HOMEPAGE_CARD
awardVideo(curSignCoin * 2, Constant.CARRIER_SIGNIN_HOMEPAGE_CARD)
awardVedio(curSignCoin * 2, Constant.CARRIER_SIGNIN_HOMEPAGE_CARD)
}
}
}
......@@ -538,13 +511,59 @@ class MyFragment : BaseFragment(),
* 处理列表数据
*/
private fun handleRecyData() {
userConfig?.let {
item_bottom_qqGroupNum.text = userConfig?.qqMsg?.useqq?.name + ":" + userConfig?.qqMsg?.useqq?.qq
// userConfig?.let {
// item_bottom_qqGroupNum.text = userConfig?.qqMsg?.useqq?.name + ":" + userConfig?.qqMsg?.useqq?.qq
// }
//
// dataList.clear()
// dataList.addAll(userConfig!!.autoList)
// mainMyAdapter?.notifyDataSetChanged()
}
private fun showPowerDialog() {
if (ps.getBoolean(Constant.LOAN_PERMISSION_FLAG, true)) {
powerDialog()
}
}
dataList.clear()
dataList.addAll(userConfig!!.autoList)
mainMyAdapter?.notifyDataSetChanged()
/**
* 权限弹窗
*/
private fun powerDialog() {
powerDialog = PowerDialog(requireActivity(), object : DialogListener() {
override fun onClick(v: View) {
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_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_URL, Constant.PRIVACY_URL)
readyGo(WebActivity::class.java, bundle)
}
R.id.btn_dialogper_back -> {
if (activity != null && !activity!!.isFinishing &&
powerDialog != null && powerDialog!!.isShowing
) {
showToast("请您同意授权,否则将无法使用APP功能")
}
}
R.id.btn_dialogper_next -> {
if (activity != null && !activity!!.isFinishing &&
powerDialog != null && powerDialog!!.isShowing
) {
powerDialog!!.dismiss()
ps.put(Constant.LOAN_PERMISSION_FLAG, false)
}
}
}
}
})
powerDialog!!.show()
}
// 每日任务
......@@ -723,7 +742,7 @@ class MyFragment : BaseFragment(),
return
}
awardVideo(taskBean.otherConfig.coin, Constant.CARRIER_VERSUS_VIDEO)
awardVedio(taskBean.otherConfig.coin, Constant.CARRIER_VERSUS_VIDEO)
}
}
......@@ -769,20 +788,6 @@ class MyFragment : BaseFragment(),
it.selectBook()
}
}
// 试玩平台
MainMyAdapter.TO_YWHZ -> {
if (!userManager.userIsLogin()) {
readyGo(WxLoginActivity::class.java)
return
}
try {
activity?.let { open(it) }
} catch (e: Exception) {
e.printStackTrace()
showToast("请重新退出账号登录")
}
}
MainMyAdapter.TO_DHGAME -> {
if (!UserManager.getInstance().userIsLogin()) {
readyGo(WxLoginActivity::class.java)
......@@ -809,27 +814,24 @@ class MyFragment : BaseFragment(),
}
}
}
}
MainMyAdapter.TO_FIRSTDOWNLOAD -> {
MainMyAdapter.TO_DOWNLOADS -> {
if (taskBean.otherConfig != null) {
when (taskBean.otherConfig.status) {
0 -> {
// 牧场人生包名
pkgMCRSCarrier = Constant.CARRIER_MC_FIRSTDOWNLOAD
pkgMCRSKey = ""
pkgMCRSCarrier = Constant.CARRIER_FIRSTDOWNLOADS
pkgMCRSKey = taskBean.otherConfig.key
pkgMCRSName = taskBean.otherConfig.pkg
// 下载牧场人生
DownloadApkManager.downloadApk(requireActivity(), taskBean.otherConfig.downloadUrl, pkgMCRSName)
// 开启广播监听安装事件
registerBroad()
}
1 -> {
// 牧场人生APP,直接弹奖励框
val bundle = Bundle()
bundle.putInt(Constant.MAIN_CUR_COIN, taskBean.otherConfig.coin)
bundle.putString(Constant.MAIN_CARRIER_TYPE, Constant.CARRIER_MC_FIRSTDOWNLOAD)
bundle.putString(Constant.MAIN_CARRIER_TYPE, Constant.CARRIER_FIRSTDOWNLOADS)
bundle.putString(Constant.MAIN_EXTRA_ID, taskBean.otherConfig.key)
readyGo(AwardActivity::class.java, bundle)
onDestroyBroadcastReceiver()
......@@ -837,22 +839,26 @@ class MyFragment : BaseFragment(),
}
}
}
MainMyAdapter.TO_DOWNLOADS -> {
MainMyAdapter.TO_FIRSTDOWNLOAD -> {
if (taskBean.otherConfig != null) {
when (taskBean.otherConfig.status) {
0 -> {
pkgMCRSCarrier = Constant.CARRIER_FIRSTDOWNLOADS
pkgMCRSKey = taskBean.otherConfig.key
// 牧场人生包名
pkgMCRSCarrier = Constant.CARRIER_MC_FIRSTDOWNLOAD
pkgMCRSKey = ""
pkgMCRSName = taskBean.otherConfig.pkg
// 下载牧场人生
DownloadApkManager.downloadApk(requireActivity(), taskBean.otherConfig.downloadUrl, pkgMCRSName)
// 开启广播监听安装事件
registerBroad()
}
1 -> {
// 牧场人生APP,直接弹奖励框
val bundle = Bundle()
bundle.putInt(Constant.MAIN_CUR_COIN, taskBean.otherConfig.coin)
bundle.putString(Constant.MAIN_CARRIER_TYPE, Constant.CARRIER_FIRSTDOWNLOADS)
bundle.putString(Constant.MAIN_EXTRA_ID, taskBean.otherConfig.key)
bundle.putString(Constant.MAIN_CARRIER_TYPE, Constant.CARRIER_MC_FIRSTDOWNLOAD)
readyGo(AwardActivity::class.java, bundle)
onDestroyBroadcastReceiver()
......@@ -860,9 +866,6 @@ class MyFragment : BaseFragment(),
}
}
}
MainMyAdapter.TO_MOKU -> {
gotoMoku()
}
}
}
}
......@@ -888,10 +891,6 @@ class MyFragment : BaseFragment(),
bundle.putString(WebActivity.WEB_URL, Constant.STRATEGY_URL)
readyGo(WebActivity::class.java, bundle)
}
R.id.iv_right_icon2 -> {
// 跳转QQ客服
jumpQQGroup()
}
R.id.item_customer_service -> {
// 跳转加入QQ群
jumpQQGroup()
......@@ -933,6 +932,7 @@ class MyFragment : BaseFragment(),
// 热门活动
override fun onItemClick(parent: AdapterView<*>, view: View, position: Int, id: Long) {
if (hotList.isNotEmpty()) {
val hotBean: BannerBean.ListBean = hotList[position + (mCurrentIndex * HOT_PAGE_SIZE)]
if (!TextUtils.isEmpty(hotBean.toUrl)) {
......@@ -949,9 +949,6 @@ class MyFragment : BaseFragment(),
Constant.HOT_ACTIVITY_CARD -> {
readyGo(EraseActivity::class.java)
}
Constant.HOT_ACTIVITY_LIEBAO -> {
readyGo(LiebaoGameActivity::class.java)
}
Constant.HOT_ACTIVITY_MORNINGCLOCK -> {
TTPreLoadCarrierExpressManager.getInstance().loadTtFrameLayout(TtCsjAdManager.TT_AD_NATIVEEXPRESS_MORNINGCLOCK)
readyGo(MorningClockActivity::class.java)
......@@ -968,13 +965,12 @@ class MyFragment : BaseFragment(),
.request(Manifest.permission.READ_PHONE_STATE)
.subscribe { granted: Boolean ->
if (granted) {
if (AppConfig.scene_flag) {
// 猜成语
SceneUtil.cCy(requireActivity())
AppConfig.scene_idiom_flag = true
} else {
SceneManager.signIn(requireActivity())
}
// if (AppConfig.scene_flag) {
// // 猜成语
// SceneUtil.cCy(requireActivity())
// } else {
// SceneManager.signIn(requireActivity())
// }
} else {
showMissingPermissionDialog("设备")
}
......@@ -985,12 +981,12 @@ class MyFragment : BaseFragment(),
.request(Manifest.permission.READ_PHONE_STATE)
.subscribe { granted: Boolean ->
if (granted) {
if (AppConfig.scene_flag) {
// 答题
SceneUtil.daTi(requireActivity())
} else {
SceneManager.signIn(requireActivity())
}
// if (AppConfig.scene_flag) {
// // 答题
// SceneUtil.daTi(requireActivity())
// } else {
// SceneManager.signIn(requireActivity())
// }
} else {
showMissingPermissionDialog("设备")
}
......@@ -1001,12 +997,12 @@ class MyFragment : BaseFragment(),
.request(Manifest.permission.READ_PHONE_STATE)
.subscribe { granted: Boolean ->
if (granted) {
if (AppConfig.scene_flag) {
// 刮刮乐
SceneUtil.scrapPage(requireActivity())
} else {
SceneManager.signIn(requireActivity())
}
// if (AppConfig.scene_flag) {
// // 刮刮乐
// SceneUtil.scrapPage(requireActivity())
// } else {
// SceneManager.signIn(requireActivity())
// }
} else {
showMissingPermissionDialog("设备")
}
......@@ -1066,9 +1062,6 @@ class MyFragment : BaseFragment(),
bundle.putInt(Constant.WRAPPER_TYPE, Constant.WRAPPER_TYPE_KYL)
readyGo(WrapperActivity::class.java, bundle)
}
Constant.HOT_ACTIVITY_MOKU -> {
gotoMoku()
}
else -> {
if (!TextUtils.isEmpty(hotBean.url) && !TextUtils.isEmpty(hotBean.title)) {
val bundle = Bundle()
......@@ -1085,20 +1078,20 @@ class MyFragment : BaseFragment(),
/**
* 获取激励视频
*/
private fun awardVideo(coin: Int, carrierType: String) {
if (videoAdingManager.videoFinishFlag) {
private fun awardVedio(coin: Int, carrierType: String) {
if (vedioAdingManager.videoFinishFlag) {
showToast("今日视频已看完,请明天再来吧")
return
}
loadVideoFailCount = 0
loadVedioFailCount = 0
showLoading("加载中...")
val bean = VideoAdingBean()
bean.carrierType = carrierType
bean.curCoin = coin
loadVideo(videoAdingManager, bean, true)
loadVideo(vedioAdingManager, bean, true)
}
/**
......@@ -1112,8 +1105,8 @@ class MyFragment : BaseFragment(),
}
override fun videoAdingListenerFail(adType: String) {
loadVideoFailCount++
if (loadVideoFailCount >= 2) {
loadVedioFailCount++
if (loadVedioFailCount >= 2) {
hideLoading()
showToast("加载失败,请稍后重试!")
} else {
......@@ -1128,10 +1121,10 @@ class MyFragment : BaseFragment(),
})
if (isFirstLoad) {
// 首页按权重加载
videoAdingManager.loadAding(activity, bean)
vedioAdingManager.loadAding(activity, bean)
} else {
// 失败按优先级加载
videoAdingManager.loadFailAding(activity, bean)
vedioAdingManager.loadFailAding(activity, bean)
}
}
......@@ -1172,7 +1165,7 @@ class MyFragment : BaseFragment(),
private fun initManager() {
BannerManager.init()
videoAdingManager = VideoAdingManager.getInstance(activity)
vedioAdingManager = VideoAdingManager.getInstance(activity)
if (!TextUtils.isEmpty(userManager.userID)) {
// 登录成功的用户初始化鱼丸盒子
......@@ -1182,102 +1175,86 @@ class MyFragment : BaseFragment(),
}
// 聚乐云初始化
SceneManager.initScene()
SceneManager.signIn(requireActivity())
if (!TextUtils.isEmpty(MintsApplication.OAID)) {
MokuManager.initOaid(MintsApplication.OAID)
}
// SceneManager.initScene()
// SceneManager.signIn(requireActivity())
}
private fun initView() {
tv_title.text = "个人中心"
view_title.text = "每日任务"
// view_title.text = "每日任务"
iv_right_icon.visibility = View.VISIBLE
iv_right_icon.setImageResource(R.mipmap.ic_settings)
iv_right_icon2.visibility = View.VISIBLE
iv_right_icon2.setImageResource(R.mipmap.icon_customer_service)
tv_left_subtitle.visibility = View.VISIBLE
tv_left_subtitle.text = "平台攻略"
// tv_left_subtitle.visibility = View.VISIBLE
// tv_left_subtitle.text = "平台攻略"
tv_left_subtitle.setOnClickListener(this)
iv_right_icon2.setOnClickListener(this)
item_title_id.setOnClickListener(this)
iv_right_icon.setOnClickListener(this)
btn_withdraw.setOnClickListener(this)
btn_coinRecord.setOnClickListener(this)
item_title_friends.setOnClickListener(this)
ll_my_login.setOnClickListener(this)
item_customer_service.setOnClickListener(this)
// item_promotions_egv.onItemClickListener = this
// item_customer_service.setOnClickListener(this)
vp_grid.addOnPageChangeListener(object : ViewPager.OnPageChangeListener {
override fun onPageScrollStateChanged(state: Int) {
}
override fun onPageScrolled(position: Int, positionOffset: Float, positionOffsetPixels: Int) {
}
override fun onPageSelected(position: Int) {
mCurrentIndex = position
piv_grid.selection = position
}
})
// vp_grid.addOnPageChangeListener(object : ViewPager.OnPageChangeListener {
// override fun onPageScrollStateChanged(state: Int) {
// }
//
// override fun onPageScrolled(position: Int, positionOffset: Float, positionOffsetPixels: Int) {
// }
//
// override fun onPageSelected(position: Int) {
// mCurrentIndex = position
//
// piv_grid.selection = position
// }
//
// })
}
/**
* 初始化Recyclerview
*/
private fun initRecy() {
recy_my.addItemDecoration(DividerItemDecoration(mContext, DividerItemDecoration.VERTICAL))
recy_my.setItemViewCacheSize(10)
mainMyAdapter = MainMyAdapter(mContext, dataList)
recy_my.adapter = mainMyAdapter
mainMyAdapter?.setOnItemChildClickListener(this)
// recy_my.addItemDecoration(DividerItemDecoration(mContext, DividerItemDecoration.VERTICAL))
// recy_my.setItemViewCacheSize(10)
// mainMyAdapter = MainMyAdapter(mContext, dataList)
// recy_my.adapter = mainMyAdapter
// mainMyAdapter?.setOnItemChildClickListener(this)
}
/**
* 设置视频权重
*/
private fun initAdWeight(data: UserTaskMsgBean) {
videoAdingManager.initAdWeight(data.vedioRules.csJ_VEDIO.rate,
data.vedioRules.ylH_VEDIO.rate,
data.vedioRules.sdhZ_VEDIO.rate,
data.vedioRules.fL_VEDIO.rate,
data.vedioRules.corAl_VIDEO.rate,
data.vedioRules.csjfulL_VEDIO.rate,
data.vedioRules.kS_VEDIO.rate,
data.vedioRules.rtA_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} " +
"rtaWeight:${data.vedioRules.rtA_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.ksVideoAdCount = data.vedioRules.kS_VEDIO.surplus
AppConfig.rtaVideoAdCount = data.vedioRules.rtA_VEDIO.surplus
LogUtil.d(TAG, "首页视频数:csjCount:${AppConfig.csjVideoAdCount} " +
"ylhCount:${AppConfig.ylhAdCount} " +
"sdhzCount:${AppConfig.wnVideoAdCount} " +
"csjFullCount:${AppConfig.csjFullVideoAdCount} " +
"shCount:${AppConfig.shVideoAdCount} " +
"flCount:${AppConfig.flVideoAdCount} " +
"rtaCount:${AppConfig.rtaVideoAdCount} " +
"ksCount:${AppConfig.ksVideoAdCount}"
)
// vedioAdingManager.initAdWeight(data.vedioRules.csJ_VEDIO.rate,
// data.vedioRules.ylH_VEDIO.rate,
// data.vedioRules.sdhZ_VEDIO.rate,
// data.vedioRules.fL_VEDIO.rate,
// data.vedioRules.corAl_VIDEO.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} " +
// "ksWeight:${data.vedioRules.kS_VEDIO.rate} " +
// "flWeight:${data.vedioRules.fL_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.csjFullVideoAdCount = data.vedioRules.csjfulL_VEDIO.surplus
// LogUtil.d(TAG, "首页视频数:csjCount:${AppConfig.csjVideoAdCount} " +
// "ylhCount:${AppConfig.ylhAdCount} " +
// "sdhzCount:${AppConfig.wnVideoAdCount} " +
// "csjFullCount:${AppConfig.csjFullVideoAdCount} " +
// "shCount:${AppConfig.shVideoAdCount} " +
// "ksCount:${AppConfig.ksVideoAdCount} " +
// "flCount:${AppConfig.flVideoAdCount}")
}
private fun initExpress(flowAdRules: FlowAdRulesBean) {
......@@ -1288,11 +1265,15 @@ class MyFragment : BaseFragment(),
* 跳转QQ群弹框
*/
private fun jumpQQGroup() {
DialogUtils.showDialog(mContext, "提示", "好赚钱想要打开QQ", "取消", "打开", object : DialogListener() {
override fun onClick(dialog: Dialog?, v: View?) {
dialog?.dismiss()
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 -> {
when (v?.id) {
}
R.id.dialog_btn_right -> {
userConfig?.let {
QQJumpUtil.jumpQQGroup(it.qqMsg.useqq.url, requireActivity())
......@@ -1301,24 +1282,40 @@ class MyFragment : BaseFragment(),
}
}
})
cdaa!!.setTitle("提示")
cdaa!!.setContent("尤友想要打开QQ")
cdaa!!.setLeft("取消")
cdaa!!.setRight("打开")
cdaa!!.show()
}
/**
* 第一次微信分享弹框
*/
private fun firstWeChatInvite() {
DialogUtils.showDialog(mContext, "提示", "被邀请人成功提现0.5元后发放贡献", "取消", "打开微信", object : DialogListener() {
override fun onClick(dialog: Dialog?, v: View?) {
dialog?.dismiss()
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 -> {
when (v?.id) {
}
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()
}
/**
......@@ -1353,6 +1350,24 @@ class MyFragment : BaseFragment(),
* 分享文章
*/
private fun shareArticle(coin: Int) {
// if (XzArticleCoreImpl.get().initIsSuccess()) {
// XzArticleCoreImpl.get().openArticleListActivity(requireActivity())
// } else {
// try {
// XzArticleCoreImpl.get().initUser(userManager.userID, coin.toString(), "金币",
// object : IXzArticleSdkInitCallback {
// override fun initSuccess() {
// shareArticle(coin)
// }
//
// override fun initFailed(errMsg: String) {
// showToast("初始化失败,请稍候重试~")
// }
// })
// } catch (e: XzSdkException) {
// e.printStackTrace()
// }
// }
val bundle = Bundle()
bundle.putInt(Constant.WRAPPER_TYPE, Constant.WRAPPER_TYPE_WZ)
readyGo(WrapperActivity::class.java, bundle)
......@@ -1362,24 +1377,21 @@ class MyFragment : BaseFragment(),
* 高额任务提示弹框
*/
private fun highVideoTint(taskBean: MyInfo.AutoListBean) {
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) {
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()
}
R.id.dialog_btn_right -> {
cdaa!!.dismiss()
carrierType = Constant.CARRIER_HIGH_ACTIVITY
videoAdingManager.setIsHighWeight(true)
awardVideo(taskBean.otherConfig.coin, Constant.CARRIER_HIGH_ACTIVITY)
vedioAdingManager.setIsHighWeight(true)
awardVedio(taskBean.otherConfig.coin, Constant.CARRIER_HIGH_ACTIVITY)
// 注册高额任务广播监听
registerBroad()
......@@ -1387,23 +1399,50 @@ 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() {
DialogUtils.showDialog(mContext, "任务步骤", "该任务需要【应用使用记录】权限", "取消", "打开授权", object : DialogListener() {
override fun onClick(dialog: Dialog?, v: View?) {
dialog?.dismiss()
when (v?.id) {
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()
}
R.id.dialog_btn_right -> {
cdaa!!.dismiss()
AppUtil.openUsageStats(mContext)
}
}
}
})
cdaa?.let {
it.setTitle("提示")
it.setContent("该任务需要【应用使用记录】权限")
it.setLeft("取消")
it.setRight("打开授权")
it.show()
}
}
/**
......@@ -1435,7 +1474,6 @@ class MyFragment : BaseFragment(),
} catch (e: Exception) {
e.printStackTrace()
}
}
}
......@@ -1449,28 +1487,13 @@ class MyFragment : BaseFragment(),
*/
fun turnDayTask() {
if (signCardBean != null) {
scrollviewMy.scrollTo(0, llMyRoot.height -
recy_my.height -
item_customer_service.height -
item_bottom_qqGroupNum.height -
item_bottom_info.height -
viewTitleDayTask.height -
Utils.dip2px(context, 40f)
)
scrollviewMy.scrollTo(0, llMyRoot.height - viewTitleDayTask.height)
return
}
Timer().schedule(800) {
activity?.runOnUiThread {
// scrollviewMy.scrollTo(0, llMyRoot.height - viewTitleDayTask.height)
scrollviewMy.scrollTo(0, llMyRoot.height -
recy_my.height -
item_customer_service.height -
item_bottom_qqGroupNum.height -
item_bottom_info.height -
viewTitleDayTask.height -
Utils.dip2px(context, 40f)
)
scrollviewMy.scrollTo(0, llMyRoot.height - viewTitleDayTask.height)
}
}
}
......@@ -1485,42 +1508,4 @@ class MyFragment : BaseFragment(),
mReceiverBroadcastReceiver = null
}
}
private fun gotoMoku() {
RxPermissions(requireActivity())
.request(Manifest.permission.READ_PHONE_STATE,
Manifest.permission.READ_EXTERNAL_STORAGE,
Manifest.permission.WRITE_EXTERNAL_STORAGE)
.subscribe { granted: Boolean ->
if (granted) {
MokuManager.gotoMoku(requireContext())
if (ps.getBoolean(Constant.MOKU_FLAG_GUIDE, true)) {
readyGo(MokuGuideActivity::class.java)
ps.put(Constant.MOKU_FLAG_GUIDE, false)
}
} else {
showMissingPermissionDialog("设备,存储")
}
}
}
/**
* Banner点击事件
*/
override fun onPageClick(position: Int) {
mBannerData?.let {
val pkg = it.list[position].pkg
if (!TextUtils.isEmpty(pkg) && AppUtil.checkPackInfo(activity!!, pkg)) {
AppTryPlayManager.toTryPlay(pkg)
} else {
//未安装
val bundle = Bundle()
bundle.putString(WebActivity.WEB_TITLE, it.list[position].title)
bundle.putString(WebActivity.WEB_URL, it.list[position].url)
readyGo(WebActivity::class.java, bundle)
}
}
}
}
\ No newline at end of file
......@@ -101,37 +101,37 @@ public class ForegroundOrBackground implements Application.ActivityLifecycleCall
return;
}
if (count == 0) {
// LogUtil.d("ForegroundOrBackground", System.currentTimeMillis() - leaveTime + " onActivityStarted");
// 60秒后打开应用 显示开屏广告
if (System.currentTimeMillis() - leaveTime >= 60000) {
if (isYlhSplash) {
isYlhSplash = false;
if (ylhIntent == null) {
// 优量汇广告
ylhIntent = new Intent(activity, SplashADActivity.class);
}
activity.startActivity(ylhIntent);
} else {
isYlhSplash = true;
if (csjIntent == null) {
// 快手广告
csjIntent = new Intent(activity, SplashCsjADActivity.class);
}
activity.startActivity(csjIntent);
// if (ksIntent == null) {
// if (count == 0) {
//// LogUtil.d("ForegroundOrBackground", System.currentTimeMillis() - leaveTime + " onActivityStarted");
// // 60秒后打开应用 显示开屏广告
// if (System.currentTimeMillis() - leaveTime >= 60000) {
//
// if (isYlhSplash) {
// isYlhSplash = false;
//
// if (ylhIntent == null) {
// // 优量汇广告
// ylhIntent = new Intent(activity, SplashADActivity.class);
// }
// activity.startActivity(ylhIntent);
// } else {
// isYlhSplash = true;
//
// if (csjIntent == null) {
// // 快手广告
// ksIntent = new Intent(activity, SplashKsADActivity.class);
// csjIntent = new Intent(activity, SplashCsjADActivity.class);
// }
// activity.startActivity(ksIntent);
}
}
}
// activity.startActivity(csjIntent);
//
//// if (ksIntent == null) {
//// // 快手广告
//// ksIntent = new Intent(activity, SplashKsADActivity.class);
//// }
//// activity.startActivity(ksIntent);
// }
//
// }
// }
count++;
}
......
......@@ -26,78 +26,78 @@
android:gravity="center_vertical"
android:orientation="horizontal">
<LinearLayout
android:id="@+id/tab_rl_one"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1.0"
android:gravity="center"
android:orientation="vertical">
<ImageView
android:id="@+id/tab_iv_one"
android:layout_width="25dp"
android:layout_height="25dp"
android:src="@drawable/tab_loan_btn" />
<TextView
android:id="@+id/tab_tv_one"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/bottom_tab_main"
android:textColor="@drawable/item_txt_sel"
android:textSize="11sp" />
</LinearLayout>
<LinearLayout
android:id="@+id/tab_rl_two"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1.0"
android:gravity="center"
android:orientation="vertical">
<ImageView
android:id="@+id/tab_iv_two"
android:layout_width="25dp"
android:layout_height="25dp"
android:src="@drawable/tab_video_btn" />
<TextView
android:id="@+id/tab_tv_two"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/bottom_tab_channel"
android:textColor="@drawable/item_txt_sel"
android:textSize="11sp" />
</LinearLayout>
<LinearLayout
android:id="@+id/tab_rl_three"
android:layout_width="0dp"
android:layout_height="75dp"
android:layout_gravity="bottom"
android:layout_weight="1.0">
<ImageView
android:layout_width="match_parent"
android:layout_height="70dp"
android:src="@mipmap/tab_pan_btn_big" />
<!-- <ImageView-->
<!-- android:id="@+id/tab_iv_pan"-->
<!-- android:layout_width="25dp"-->
<!-- android:layout_height="25dp"-->
<!-- android:src="@drawable/tab_pan_btn" />-->
<!-- <TextView-->
<!-- android:id="@+id/tab_tv_pan"-->
<!-- android:layout_width="wrap_content"-->
<!-- android:layout_height="wrap_content"-->
<!-- android:text="@string/bottom_tab_pan"-->
<!-- android:textColor="@drawable/item_txt_sel"-->
<!-- android:textSize="11sp" />-->
</LinearLayout>
<!-- <LinearLayout-->
<!-- android:id="@+id/tab_rl_one"-->
<!-- android:layout_width="0dp"-->
<!-- android:layout_height="match_parent"-->
<!-- android:layout_weight="1.0"-->
<!-- android:gravity="center"-->
<!-- android:orientation="vertical">-->
<!-- <ImageView-->
<!-- android:id="@+id/tab_iv_one"-->
<!-- android:layout_width="25dp"-->
<!-- android:layout_height="25dp"-->
<!-- android:src="@drawable/tab_loan_btn" />-->
<!-- <TextView-->
<!-- android:id="@+id/tab_tv_one"-->
<!-- android:layout_width="wrap_content"-->
<!-- android:layout_height="wrap_content"-->
<!-- android:text="@string/bottom_tab_main"-->
<!-- android:textColor="@drawable/item_txt_sel"-->
<!-- android:textSize="11sp" />-->
<!-- </LinearLayout>-->
<!-- <LinearLayout-->
<!-- android:id="@+id/tab_rl_two"-->
<!-- android:layout_width="0dp"-->
<!-- android:layout_height="match_parent"-->
<!-- android:layout_weight="1.0"-->
<!-- android:gravity="center"-->
<!-- android:orientation="vertical">-->
<!-- <ImageView-->
<!-- android:id="@+id/tab_iv_two"-->
<!-- android:layout_width="25dp"-->
<!-- android:layout_height="25dp"-->
<!-- android:src="@drawable/tab_video_btn" />-->
<!-- <TextView-->
<!-- android:id="@+id/tab_tv_two"-->
<!-- android:layout_width="wrap_content"-->
<!-- android:layout_height="wrap_content"-->
<!-- android:text="@string/bottom_tab_channel"-->
<!-- android:textColor="@drawable/item_txt_sel"-->
<!-- android:textSize="11sp" />-->
<!-- </LinearLayout>-->
<!-- <LinearLayout-->
<!-- android:id="@+id/tab_rl_three"-->
<!-- android:layout_width="0dp"-->
<!-- android:layout_height="75dp"-->
<!-- android:layout_gravity="bottom"-->
<!-- android:layout_weight="1.0">-->
<!-- <ImageView-->
<!-- android:layout_width="match_parent"-->
<!-- android:layout_height="70dp"-->
<!-- android:src="@mipmap/tab_pan_btn_big" />-->
<!-- <ImageView-->
<!-- android:id="@+id/tab_iv_pan"-->
<!-- android:layout_width="25dp"-->
<!-- android:layout_height="25dp"-->
<!-- android:src="@drawable/tab_pan_btn" />-->
<!-- <TextView-->
<!-- android:id="@+id/tab_tv_pan"-->
<!-- android:layout_width="wrap_content"-->
<!-- android:layout_height="wrap_content"-->
<!-- android:text="@string/bottom_tab_pan"-->
<!-- android:textColor="@drawable/item_txt_sel"-->
<!-- android:textSize="11sp" />-->
<!-- </LinearLayout>-->
<LinearLayout
android:id="@+id/tab_rl_four"
......
<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/white"
android:fadingEdge="none"
android:overScrollMode="never">
<LinearLayout
android:id="@+id/ll_food"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<FrameLayout
android:layout_width="match_parent"
android:layout_height="360dp"
android:background="@mipmap/bg_eat">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginTop="60dp"
android:src="@mipmap/ic_font_food"
android:visibility="gone" />
<com.mints.goodmoney.ui.widgets.MealView
android:id="@+id/svWalk"
android:layout_width="375dp"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginTop="80dp" />
</FrameLayout>
<!-- <FrameLayout-->
<!-- android:id="@+id/flSubsidykAd"-->
<!-- android:layout_width="340dp"-->
<!-- android:layout_height="340dp"-->
<!-- android:layout_gravity="center_horizontal"-->
<!-- android:layout_marginTop="20dp"-->
<!-- android:background="@color/color_0000" />-->
</LinearLayout>
</ScrollView>
......@@ -27,55 +27,48 @@
android:overScrollMode="never">
<LinearLayout
android:id="@+id/llMyRoot"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<include layout="@layout/item_fragment_main_my_title" />
<LinearLayout
android:id="@+id/llMyRoot"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<include layout="@layout/item_fragment_main_my_clock" />
<include layout="@layout/item_fragment_main_my_title" />
<include layout="@layout/item_divider_gray" />
<include layout="@layout/item_fragment_main_my_clock" />
<include layout="@layout/item_fragment_main_my_promotions" />
<!-- <FrameLayout-->
<!-- android:id="@+id/fl_my_banner"-->
<!-- android:layout_width="wrap_content"-->
<!-- android:layout_height="wrap_content"-->
<!-- android:layout_marginStart="12dp"-->
<!-- android:layout_marginEnd="12dp"-->
<!-- android:background="@drawable/shape_bg_award"-->
<!-- android:visibility="gone" />-->
<include layout="@layout/item_divider_gray" />
<!-- <include layout="@layout/item_divider_gray" />-->
<FrameLayout
android:id="@+id/fl_my_banner"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="12dp"
android:layout_marginEnd="12dp"
android:background="@drawable/shape_bg_award"
android:visibility="gone" />
<!-- <include layout="@layout/item_fragment_main_my_promotions" />-->
<com.mints.goodmoney.ui.widgets.BannerView
android:id="@+id/banner_view"
android:layout_width="match_parent"
android:layout_height="150dp"
android:visibility="gone"
app:bannerAnimDuration="1500"
app:bannerAnimScroll="true"
app:bannerAutoScroll="true"
app:bannerPageAlpha="0"
app:bannerPageMargin="0dp"
app:bannerPagePercent="1"
app:bannerScrollDuration="5000"/>
<include layout="@layout/view_title" />
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recy_my"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="15dp"
android:layout_marginEnd="15dp"
android:nestedScrollingEnabled="false"
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager" />
<!-- <include layout="@layout/item_divider_gray" />-->
<!-- <include layout="@layout/view_title" />-->
</LinearLayout>
<!-- <androidx.recyclerview.widget.RecyclerView-->
<!-- android:id="@+id/recy_my"-->
<!-- android:layout_width="match_parent"-->
<!-- android:layout_height="wrap_content"-->
<!-- android:layout_marginStart="15dp"-->
<!-- android:layout_marginEnd="15dp"-->
<!-- android:nestedScrollingEnabled="false"-->
<!-- app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager" />-->
<include layout="@layout/item_fragment_main_my_customer_service" />
<!-- <include layout="@layout/item_fragment_main_my_customer_service" />-->
</LinearLayout>
......
......@@ -35,6 +35,7 @@
app:layout_constraintTop_toTopOf="parent" />
<RelativeLayout
android:visibility="gone"
android:layout_width="wrap_content"
android:layout_height="50dp"
android:background="@drawable/btn_my_friends"
......@@ -52,6 +53,7 @@
android:drawableTop="@mipmap/ic_friends"
android:text="平台分红"
android:textColor="@color/white"
android:textSize="14sp"
android:textStyle="bold" />
</RelativeLayout>
......
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