Commit ec5c3105 authored by mengcuiguang's avatar mengcuiguang

代码优化

parent c29e4b85
...@@ -151,6 +151,7 @@ public class VedioAdingManager { ...@@ -151,6 +151,7 @@ public class VedioAdingManager {
weight = weight + csjVedioWeight; weight = weight + csjVedioWeight;
LogUtil.d(TAG, "权重值:csjVedioWeight:" + csjVedioWeight); LogUtil.d(TAG, "权重值:csjVedioWeight:" + csjVedioWeight);
} }
if (AppConfig.flVedioAdCount > 0) { if (AppConfig.flVedioAdCount > 0) {
weightList.add(new WeightBean(flVedioWeight, Constant.FL_VEDIO_AD)); weightList.add(new WeightBean(flVedioWeight, Constant.FL_VEDIO_AD));
weight = weight + flVedioWeight; weight = weight + flVedioWeight;
......
...@@ -167,6 +167,8 @@ object Constant { ...@@ -167,6 +167,8 @@ object Constant {
const val HOT_ACTIVITY_SCRAPPAGE = "scrapPage" const val HOT_ACTIVITY_SCRAPPAGE = "scrapPage"
const val HOT_ACTIVITY_DATI = "dati" const val HOT_ACTIVITY_DATI = "dati"
const val HOT_ACTIVITY_CAICY = "ccy" const val HOT_ACTIVITY_CAICY = "ccy"
const val HOT_ACTIVITY_BOOK = "readBook"
const val HOT_ACTIVITY_NEWS = "TO_RUISHI"
// 打开激活 // 打开激活
const val FIRST_DEVICE_FLAG = "first_device_flag" const val FIRST_DEVICE_FLAG = "first_device_flag"
...@@ -193,7 +195,9 @@ object Constant { ...@@ -193,7 +195,9 @@ object Constant {
const val MERGE_KEY = "merge_key" const val MERGE_KEY = "merge_key"
// wrapper type // wrapper type 0-新闻 1-小说
const val WRAPPER_TYPE = "wrapper_type" const val WRAPPER_TYPE = "wrapper_type"
const val WRAPPER_TYPE_NEWS = 0
const val WRAPPER_TYPE_BOOK = 1
} }
...@@ -35,6 +35,7 @@ object YlhAdManager { ...@@ -35,6 +35,7 @@ object YlhAdManager {
const val YLH_AD_INTERSTITIALAD_LIEBAO = "1021648750986824" //猎豹 const val YLH_AD_INTERSTITIALAD_LIEBAO = "1021648750986824" //猎豹
const val YLH_AD_INTERSTITIALAD_JULEYUN = "4051047730890430" //聚乐云 const val YLH_AD_INTERSTITIALAD_JULEYUN = "4051047730890430" //聚乐云
/** /**
* 广告初始化 * 广告初始化
*/ */
......
...@@ -5,7 +5,9 @@ import android.view.View ...@@ -5,7 +5,9 @@ import android.view.View
import com.mints.goodmoney.R import com.mints.goodmoney.R
import com.mints.goodmoney.common.Constant import com.mints.goodmoney.common.Constant
import com.mints.goodmoney.ui.activitys.base.BaseActivity import com.mints.goodmoney.ui.activitys.base.BaseActivity
import com.mints.goodmoney.ui.fragment.MyZhangyueFragment
import com.mints.goodmoney.ui.fragment.RsNewsFragment import com.mints.goodmoney.ui.fragment.RsNewsFragment
import com.mints.goodmoney.ui.fragment.ZhangyueFragment
import kotlinx.android.synthetic.main.header_layout.* import kotlinx.android.synthetic.main.header_layout.*
/** /**
...@@ -15,7 +17,7 @@ import kotlinx.android.synthetic.main.header_layout.* ...@@ -15,7 +17,7 @@ import kotlinx.android.synthetic.main.header_layout.*
*/ */
class WrapperActivity : BaseActivity(), View.OnClickListener { class WrapperActivity : BaseActivity(), View.OnClickListener {
private var wrapperType = 0 private var wrapperType = Constant.WRAPPER_TYPE_NEWS
override fun getContentViewLayoutID() = R.layout.activity_wrapper override fun getContentViewLayoutID() = R.layout.activity_wrapper
...@@ -32,7 +34,7 @@ class WrapperActivity : BaseActivity(), View.OnClickListener { ...@@ -32,7 +34,7 @@ class WrapperActivity : BaseActivity(), View.OnClickListener {
override fun getBundleExtras(extras: Bundle?) { override fun getBundleExtras(extras: Bundle?) {
super.getBundleExtras(extras) super.getBundleExtras(extras)
extras?.let { extras?.let {
wrapperType = it.getInt(Constant.WRAPPER_TYPE, 0) wrapperType = it.getInt(Constant.WRAPPER_TYPE, Constant.WRAPPER_TYPE_NEWS)
} }
} }
...@@ -44,7 +46,7 @@ class WrapperActivity : BaseActivity(), View.OnClickListener { ...@@ -44,7 +46,7 @@ class WrapperActivity : BaseActivity(), View.OnClickListener {
private fun initPage() { private fun initPage() {
when (wrapperType) { when (wrapperType) {
0 -> { Constant.WRAPPER_TYPE_NEWS -> {
tv_title.text = "新闻" tv_title.text = "新闻"
val rsNewsFragment = RsNewsFragment() val rsNewsFragment = RsNewsFragment()
if (!rsNewsFragment.isAdded()) { if (!rsNewsFragment.isAdded()) {
...@@ -53,6 +55,15 @@ class WrapperActivity : BaseActivity(), View.OnClickListener { ...@@ -53,6 +55,15 @@ class WrapperActivity : BaseActivity(), View.OnClickListener {
.add(R.id.flWrapper, rsNewsFragment).commitAllowingStateLoss() .add(R.id.flWrapper, rsNewsFragment).commitAllowingStateLoss()
} }
} }
Constant.WRAPPER_TYPE_BOOK -> {
tv_title.text = "书城"
val zhangyueFragment = MyZhangyueFragment()
if (!zhangyueFragment.isAdded()) {
// 提交事务
supportFragmentManager.beginTransaction()
.add(R.id.flWrapper, zhangyueFragment).commit()
}
}
} }
} }
......
...@@ -12,6 +12,7 @@ import androidx.recyclerview.widget.DividerItemDecoration ...@@ -12,6 +12,7 @@ import androidx.recyclerview.widget.DividerItemDecoration
import com.component.dly.xzzq_ywsdk.YwSDK_WebActivity.Companion.open import com.component.dly.xzzq_ywsdk.YwSDK_WebActivity.Companion.open
import com.fly.scenemodule.SceneUtil import com.fly.scenemodule.SceneUtil
import com.mints.goodmoney.BuildConfig import com.mints.goodmoney.BuildConfig
import com.mints.goodmoney.MintsApplication
import com.mints.goodmoney.R import com.mints.goodmoney.R
import com.mints.goodmoney.ad.banner.BannerManager import com.mints.goodmoney.ad.banner.BannerManager
import com.mints.goodmoney.ad.video.VedioAdingManager import com.mints.goodmoney.ad.video.VedioAdingManager
...@@ -484,7 +485,9 @@ class MyFragment : BaseFragment(), MyView, OnItemChildClickListener, OnRefreshLi ...@@ -484,7 +485,9 @@ class MyFragment : BaseFragment(), MyView, OnItemChildClickListener, OnRefreshLi
if (taskBean.otherConfig != null) { if (taskBean.otherConfig != null) {
when (taskBean.otherConfig.status) { when (taskBean.otherConfig.status) {
0 -> { 0 -> {
readyGo(WrapperActivity::class.java) val bundle = Bundle()
bundle.putInt(Constant.WRAPPER_TYPE, Constant.WRAPPER_TYPE_NEWS)
readyGo(WrapperActivity::class.java, bundle)
} }
1 -> { 1 -> {
val bundle = Bundle() val bundle = Bundle()
...@@ -493,7 +496,9 @@ class MyFragment : BaseFragment(), MyView, OnItemChildClickListener, OnRefreshLi ...@@ -493,7 +496,9 @@ class MyFragment : BaseFragment(), MyView, OnItemChildClickListener, OnRefreshLi
readyGo(AwardActivity::class.java, bundle) readyGo(AwardActivity::class.java, bundle)
} }
2 -> { 2 -> {
readyGo(WrapperActivity::class.java) val bundle = Bundle()
bundle.putInt(Constant.WRAPPER_TYPE, Constant.WRAPPER_TYPE_NEWS)
readyGo(WrapperActivity::class.java, bundle)
} }
} }
} }
...@@ -631,6 +636,18 @@ class MyFragment : BaseFragment(), MyView, OnItemChildClickListener, OnRefreshLi ...@@ -631,6 +636,18 @@ class MyFragment : BaseFragment(), MyView, OnItemChildClickListener, OnRefreshLi
// 刮刮乐 // 刮刮乐
SceneUtil.scrapPage(requireActivity()) SceneUtil.scrapPage(requireActivity())
} }
Constant.HOT_ACTIVITY_BOOK -> {
// 小说
val bundle = Bundle()
bundle.putInt(Constant.WRAPPER_TYPE, Constant.WRAPPER_TYPE_BOOK)
readyGo(WrapperActivity::class.java, bundle)
}
Constant.HOT_ACTIVITY_NEWS -> {
// 新闻
val bundle = Bundle()
bundle.putInt(Constant.WRAPPER_TYPE, Constant.WRAPPER_TYPE_NEWS)
readyGo(WrapperActivity::class.java, bundle)
}
Constant.HOT_ACTIVITY_EAT -> { Constant.HOT_ACTIVITY_EAT -> {
TTPreLoadCarrierExpressManager.getInstance().loadTtFrameLayout(TtCsjAdManager.TT_AD_NATIVEEXPRESS_EAT) TTPreLoadCarrierExpressManager.getInstance().loadTtFrameLayout(TtCsjAdManager.TT_AD_NATIVEEXPRESS_EAT)
readyGo(FoodSubsidyActivity::class.java) readyGo(FoodSubsidyActivity::class.java)
...@@ -825,7 +842,7 @@ class MyFragment : BaseFragment(), MyView, OnItemChildClickListener, OnRefreshLi ...@@ -825,7 +842,7 @@ class MyFragment : BaseFragment(), MyView, OnItemChildClickListener, OnRefreshLi
// 聚乐云 // 聚乐云
SceneManager.initScene() SceneManager.initScene()
// 同步账户 // 同步账户
// SceneUtil.signIn(requireActivity(), SceneManager.SCENE_CHANNEL_Id, userManager.userID, MintsApplication.OAID) SceneUtil.signIn(requireActivity(), SceneManager.SCENE_CHANNEL_Id, userManager.userID, MintsApplication.OAID)
} }
private fun initView() { private fun initView() {
......
package com.mints.goodmoney.ui.fragment
import android.os.Bundle
import android.view.View
import androidx.fragment.app.Fragment
import androidx.fragment.app.FragmentTransaction
import com.ireader.ireadersdk.IreaderApi
import com.mints.goodmoney.R
import com.mints.goodmoney.common.AppConfig
import com.mints.goodmoney.common.Constant
import com.mints.goodmoney.mvp.presenters.BookPresenter
import com.mints.goodmoney.mvp.views.BookView
import com.mints.goodmoney.ui.activitys.AwardActivity
import com.mints.goodmoney.ui.fragment.base.LazyLoadBaseFragment
import com.mints.goodmoney.utils.SpanUtils
import kotlinx.android.synthetic.main.fragment_main_zy.*
/**
* 描述:掌阅书城
* 作者:孟崔广
*/
class MyZhangyueFragment : LazyLoadBaseFragment(), BookView, IreaderApi.OnReadChangeListener {
private val bookPresenter by lazy { BookPresenter() }
private var bookFragment: Fragment? = null
override fun getContentViewLayoutID() = R.layout.fragment_main_zy
override fun initViewsAndEvents() {
bookPresenter.attachView(this)
val transaction: FragmentTransaction = supportFragmentManager.beginTransaction()
if (bookFragment == null) {
// bookFragment = IreaderApi.getNovelBookStoreFragment()
bookFragment = IreaderApi.getNovelChannelFragment()
transaction.add(R.id.fragment, bookFragment!!, bookFragment!!::class.java.simpleName)
IreaderApi.setReadChangeListener(this)
} else {
transaction.show(bookFragment!!)
}
transaction.commitAllowingStateLoss()
}
override fun onFragmentFirstVisible() {
}
override fun onFragmentResume() {
super.onFragmentResume()
if (AppConfig.fragmentClickFlag == Constant.FRAGMENT_CLICK_MAIN) {
bookPresenter.getReadInfo()
}
}
override fun onDestroy() {
super.onDestroy()
IreaderApi.setReadChangeListener(null)
bookPresenter.detachView()
}
override fun onReadStart() {
}
override fun onReadEnd(time: Long) {
// LogUtil.d(TAG, "onReadEnd time:" + time)
// LogUtil.d(TAG, "onReadEnd time(Int):" + (time/1000).toInt())
val seconds = (time / 1000).toInt()
// 阅读5秒以上 保存时长
if (seconds > 5) {
bookPresenter.addReadSeconds(seconds)
}
}
override fun onReadPage(time: Long) {
}
override fun readSecondsSuc(coin: Int) {
if (coin > 0) {
val bundle = Bundle()
bundle.putString(Constant.MAIN_CARRIER_TYPE, Constant.CARRIER_ZHANGYUE)
bundle.putInt(Constant.MAIN_CUR_COIN, coin)
readyGo(AwardActivity::class.java, bundle)
}
}
override fun readInfo(sumTime: Int, sumCoin: Int, readTime: Int) {
//阅读{10}分钟,奖励{xx}金币,已读{x}分钟
tvZhangContent.visibility = View.VISIBLE
if (readTime >= sumTime) {
tvZhangContent.text = "今日阅读任务已完成"
} 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("${readTime / 60}").setForegroundColor(mContext.resources.getColor(R.color.color_FF9837)).append("分钟")
.create()
}
}
}
\ 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