Commit 6e649a50 authored by mengcuiguang's avatar mengcuiguang

删除书城

parent a24bab52
......@@ -2,11 +2,11 @@ apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'kotlin-kapt'
apply plugin: 'dagger.hilt.android.plugin'
apply plugin: 'androidx.navigation.safeargs.kotlin'
apply plugin: 'android-aspectjx'
apply plugin: 'com.sensorsdata.analytics.android'
//apply plugin: 'kotlin-kapt'
//apply plugin: 'dagger.hilt.android.plugin'
//apply plugin: 'androidx.navigation.safeargs.kotlin'
//apply plugin: 'android-aspectjx'
//apply plugin: 'com.sensorsdata.analytics.android'
android {
compileSdkVersion rootProject.ext.androidCompileSdkVersion
......@@ -64,18 +64,18 @@ android {
}
}
kapt {
arguments {
arg("AROUTER_MODULE_NAME", project.getName())
}
}
aspectjx {
exclude 'versions.9'
}
buildFeatures {
dataBinding true
}
// kapt {
// arguments {
// arg("AROUTER_MODULE_NAME", project.getName())
// }
// }
// aspectjx {
// exclude 'versions.9'
// }
//
// buildFeatures {
// dataBinding true
// }
buildTypes {
......@@ -302,50 +302,50 @@ dependencies {
// 激励视频RTA
implementation(name: 'taskwake1.0', ext: 'aar')
// 听读
implementation files('libs/Reader17kSDK-release1.1.3.aar')
implementation files('libs/readerlib-release1.1.aar')
implementation files('libs/filter-lib-release1.1.aar')
compileOnly "com.squareup.inject:assisted-inject-annotations-dagger2:$rootProject.assistedInjectVersion"
kapt "androidx.room:room-compiler:$rootProject.roomVersion"
kapt "com.google.dagger:hilt-android-compiler:$rootProject.hiltVersion"
kapt "androidx.hilt:hilt-compiler:$rootProject.hiltViewModelVersion"
kapt "com.squareup.inject:assisted-inject-processor-dagger2:$rootProject.assistedInjectVersion"
implementation "androidx.core:core-ktx:$rootProject.ktxVersion"
implementation "androidx.fragment:fragment-ktx:$rootProject.fragmentVersion"
implementation "androidx.lifecycle:lifecycle-extensions:$rootProject.lifecycleVersion"
implementation "androidx.lifecycle:lifecycle-livedata-ktx:$rootProject.lifecycleVersion"
implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:$rootProject.lifecycleVersion"
implementation "androidx.navigation:navigation-fragment-ktx:$rootProject.navigationVersion"
implementation "androidx.navigation:navigation-ui-ktx:$rootProject.navigationVersion"
implementation "androidx.paging:paging-runtime:$rootProject.pagingVersion"
implementation "androidx.room:room-runtime:$rootProject.roomVersion"
implementation "androidx.room:room-ktx:$rootProject.roomVersion"
implementation "androidx.viewpager2:viewpager2:$rootProject.viewPagerVersion"
implementation "androidx.work:work-runtime-ktx:$rootProject.workVersion"
implementation "com.google.code.gson:gson:$rootProject.gsonVersion"
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:$rootProject.coroutinesVersion"
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:$rootProject.coroutinesVersion"
implementation "com.google.dagger:hilt-android:$rootProject.hiltVersion"
implementation "androidx.hilt:hilt-lifecycle-viewmodel:$rootProject.hiltViewModelVersion"
implementation "com.scwang.smart:refresh-header-material:$rootProject.refresh_version"
implementation 'com.github.pdog18:dimension-extensions:1.0'
implementation 'com.github.zhpanvip:BannerViewPager:3.2.0'
api "androidx.navigation:navigation-fragment-ktx:$navigationVersion"
api "androidx.navigation:navigation-ui-ktx:$navigationVersion"
api "androidx.navigation:navigation-dynamic-features-fragment:$navigationVersion"
implementation 'com.github.warkiz.widget:indicatorseekbar:1.2.9'
implementation 'org.greenrobot:eventbus:3.2.0'
implementation 'skin.support:skin-support:4.0.5'
implementation 'skin.support:skin-support-appcompat:4.0.5'
implementation 'skin.support:skin-support-design:4.0.5'
implementation 'skin.support:skin-support-cardview:4.0.5'
implementation 'skin.support:skin-support-constraint-layout:4.0.5'
implementation "androidx.datastore:datastore-preferences:1.0.0-alpha02"
implementation 'com.github.F1ReKing:StatusLayout:1.2.1'
kapt "com.alibaba:arouter-compiler:$arouter_compiler_version"
implementation "com.alibaba:arouter-api:$arouter_api_version"
implementation 'com.sensorsdata.analytics.android:SensorsAnalyticsSDK:4.4.3'
api 'org.aspectj:aspectjrt:1.9.5'
// implementation files('libs/Reader17kSDK-release1.1.3.aar')
// implementation files('libs/readerlib-release1.1.aar')
// implementation files('libs/filter-lib-release1.1.aar')
// compileOnly "com.squareup.inject:assisted-inject-annotations-dagger2:$rootProject.assistedInjectVersion"
// kapt "androidx.room:room-compiler:$rootProject.roomVersion"
// kapt "com.google.dagger:hilt-android-compiler:$rootProject.hiltVersion"
// kapt "androidx.hilt:hilt-compiler:$rootProject.hiltViewModelVersion"
// kapt "com.squareup.inject:assisted-inject-processor-dagger2:$rootProject.assistedInjectVersion"
// implementation "androidx.core:core-ktx:$rootProject.ktxVersion"
// implementation "androidx.fragment:fragment-ktx:$rootProject.fragmentVersion"
// implementation "androidx.lifecycle:lifecycle-extensions:$rootProject.lifecycleVersion"
// implementation "androidx.lifecycle:lifecycle-livedata-ktx:$rootProject.lifecycleVersion"
// implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:$rootProject.lifecycleVersion"
// implementation "androidx.navigation:navigation-fragment-ktx:$rootProject.navigationVersion"
// implementation "androidx.navigation:navigation-ui-ktx:$rootProject.navigationVersion"
// implementation "androidx.paging:paging-runtime:$rootProject.pagingVersion"
// implementation "androidx.room:room-runtime:$rootProject.roomVersion"
// implementation "androidx.room:room-ktx:$rootProject.roomVersion"
// implementation "androidx.viewpager2:viewpager2:$rootProject.viewPagerVersion"
// implementation "androidx.work:work-runtime-ktx:$rootProject.workVersion"
// implementation "com.google.code.gson:gson:$rootProject.gsonVersion"
// implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:$rootProject.coroutinesVersion"
// implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:$rootProject.coroutinesVersion"
// implementation "com.google.dagger:hilt-android:$rootProject.hiltVersion"
// implementation "androidx.hilt:hilt-lifecycle-viewmodel:$rootProject.hiltViewModelVersion"
// implementation "com.scwang.smart:refresh-header-material:$rootProject.refresh_version"
// implementation 'com.github.pdog18:dimension-extensions:1.0'
// implementation 'com.github.zhpanvip:BannerViewPager:3.2.0'
// api "androidx.navigation:navigation-fragment-ktx:$navigationVersion"
// api "androidx.navigation:navigation-ui-ktx:$navigationVersion"
// api "androidx.navigation:navigation-dynamic-features-fragment:$navigationVersion"
// implementation 'com.github.warkiz.widget:indicatorseekbar:1.2.9'
// implementation 'org.greenrobot:eventbus:3.2.0'
// implementation 'skin.support:skin-support:4.0.5'
// implementation 'skin.support:skin-support-appcompat:4.0.5'
// implementation 'skin.support:skin-support-design:4.0.5'
// implementation 'skin.support:skin-support-cardview:4.0.5'
// implementation 'skin.support:skin-support-constraint-layout:4.0.5'
// implementation "androidx.datastore:datastore-preferences:1.0.0-alpha02"
// implementation 'com.github.F1ReKing:StatusLayout:1.2.1'
// kapt "com.alibaba:arouter-compiler:$arouter_compiler_version"
// implementation "com.alibaba:arouter-api:$arouter_api_version"
// implementation 'com.sensorsdata.analytics.android:SensorsAnalyticsSDK:4.4.3'
// api 'org.aspectj:aspectjrt:1.9.5'
//小满
implementation ("com.bx:adsdk:1.4.2.2"){
exclude group:"com.miit.sdk"
......
......@@ -16,7 +16,6 @@ import com.mints.goodmoney.manager.KsManager;
import com.mints.goodmoney.manager.LiebaoManager;
import com.mints.goodmoney.manager.MhManager;
import com.mints.goodmoney.manager.MiitHelper;
import com.mints.goodmoney.manager.ReaderManager;
import com.mints.goodmoney.manager.RsNewsManager;
import com.mints.goodmoney.manager.TtCsjAdManager;
import com.mints.goodmoney.manager.TzManager;
......@@ -43,7 +42,6 @@ import com.ximalaya.ting.android.opensdk.util.BaseUtil;
import java.util.concurrent.Executors;
import dagger.hilt.android.HiltAndroidApp;
import rx.Scheduler;
import rx.schedulers.Schedulers;
......@@ -52,7 +50,7 @@ import rx.schedulers.Schedulers;
* 作者:孟崔广
* 时间:2020/10/09 11:40
*/
@HiltAndroidApp
//@HiltAndroidApp
public class MintsApplication extends MultiDexApplication {
private static MintsApplication mContext;
......
package com.mints.goodmoney.manager
import android.app.Application
import android.app.Dialog
import android.view.View
import androidx.appcompat.app.AlertDialog
import com.chineseall.reader.lib.reader.callbacks.OnAdViewReceiver
import com.chineseall.reader17ksdk.ChineseAllReaderApplication.Companion.install
import com.chineseall.reader17ksdk.callbacks.AdProvider
import com.chineseall.reader17ksdk.utils.ActivityStackManager
import com.chineseall.reader17ksdk.utils.DensityUtil.dip2px
import com.chineseall.reader17ksdk.utils.DensityUtil.px2dip
import com.chineseall.reader17ksdk.utils.NetworkUtil.isNetworkAvailable
import com.chineseall.reader17ksdk.utils.NetworkUtil.isWifiConnected
import com.chineseall.reader17ksdk.utils.book.ScreenUtils
import com.mints.goodmoney.MintsApplication
/**
* 中文在线 听读
* 作者:孟崔广
* 时间:2021/04/08 14:44
* 邮箱:mengcga@163.com
*/
object ReaderManager {
private const val APP_ID = "1242"
private const val SECRET = "hzq@1242"
private const val APP = "32"
private const val SUBAPP = "0"
private val csjAd by lazy { ReadToutiaoAD() }
private val ylhAd by lazy { ReadYlhAd() }
private const val csjVedioAD: String = "CSJ"
private const val ylhVedioAD: String = "Ylh"
private var curVedioAd: String = ""
private var isCsjAd: Boolean = true
fun init() {
val applicationContext = MintsApplication.getContext()
install(applicationContext, APP_ID, SECRET, APP, SUBAPP, object : AdProvider {
/**
* 阅读⻚弹窗广告确认按钮的点击回调-激励视频
* @param dialog
* @param block 对话框关闭回调,必须调用,否则计时每次切换章节都会出现弹窗
*/
override fun onAdDialogPositiveClick(dialog: Dialog?, function0: Function0<Unit>) {
if (isNetworkAvailable(applicationContext) && !isWifiConnected(applicationContext)) {
AlertDialog.Builder(ActivityStackManager.getInstance().topActivity)
.setTitle("温馨提示")
.setMessage("当前处于移动网络,播放视频会消耗流量,确定播放?")
.setPositiveButton("观看视频") { dialog, which ->
onAdDialogInvoke(function0)
}.setNegativeButton("取消") { dialog, which -> dialog.dismiss() }
.create().show()
return
} else {
onAdDialogInvoke(function0)
}
}
/**
* 阅读⻚首次打开 弹框广告(信息流) 广告宽度 320 高度 260 * @param adViewContainer 广告view的容器
*/
override fun getReaderScreenAd(view: View, receiver: OnAdViewReceiver,
dialog: Dialog?) {
csjAd.loadAD(applicationContext, receiver, 320, 260, ReadToutiaoAD.OnClickListener { dialog!!.dismiss() })
}
/**
* 阅读⻚翻⻚广告(信息流) 广告宽度 320 高度 260
*/
override fun getReaderPageAd(receiver: OnAdViewReceiver) {
csjAd.loadAD(applicationContext, receiver, px2dip(applicationContext, ScreenUtils.getScreenWidth(applicationContext) - dip2px(applicationContext, 30f).toFloat()), px2dip(applicationContext, 854f), null)
}
/**
* 阅读⻚定时弹窗广告 (激励视频)
*/
override fun getReaderDialogAd(view: View, receiver: OnAdViewReceiver, dialog: Dialog?) {
if (isCsjAd) {
curVedioAd = csjVedioAD
csjAd.loadVideoAd(ActivityStackManager.getInstance().topActivity, receiver)
} else {
curVedioAd = ylhVedioAD
ylhAd.loadVideoAd(ActivityStackManager.getInstance().topActivity, receiver)
}
isCsjAd = !isCsjAd
}
})
}
private fun onAdDialogInvoke(function0: () -> Unit) {
when (curVedioAd) {
csjVedioAD -> {
csjAd.showVideo(ActivityStackManager.getInstance().topActivity) { function0.invoke() }
}
ylhVedioAD -> {
ylhAd.showVideo(ActivityStackManager.getInstance().topActivity) { function0.invoke() }
}
}
}
}
\ No newline at end of file
//package com.mints.goodmoney.manager
//
//import android.app.Application
//import android.app.Dialog
//import android.view.View
//import androidx.appcompat.app.AlertDialog
//import com.chineseall.reader.lib.reader.callbacks.OnAdViewReceiver
//import com.chineseall.reader17ksdk.ChineseAllReaderApplication.Companion.install
//import com.chineseall.reader17ksdk.callbacks.AdProvider
//import com.chineseall.reader17ksdk.utils.ActivityStackManager
//import com.chineseall.reader17ksdk.utils.DensityUtil.dip2px
//import com.chineseall.reader17ksdk.utils.DensityUtil.px2dip
//import com.chineseall.reader17ksdk.utils.NetworkUtil.isNetworkAvailable
//import com.chineseall.reader17ksdk.utils.NetworkUtil.isWifiConnected
//import com.chineseall.reader17ksdk.utils.book.ScreenUtils
//import com.mints.goodmoney.MintsApplication
//
///**
// * 中文在线 听读
// * 作者:孟崔广
// * 时间:2021/04/08 14:44
// * 邮箱:mengcga@163.com
// */
//object ReaderManager {
//
// private const val APP_ID = "1242"
// private const val SECRET = "hzq@1242"
// private const val APP = "32"
// private const val SUBAPP = "0"
//
// private val csjAd by lazy { ReadToutiaoAD() }
// private val ylhAd by lazy { ReadYlhAd() }
//
// private const val csjVedioAD: String = "CSJ"
// private const val ylhVedioAD: String = "Ylh"
// private var curVedioAd: String = ""
//
// private var isCsjAd: Boolean = true
//
// fun init() {
// val applicationContext = MintsApplication.getContext()
// install(applicationContext, APP_ID, SECRET, APP, SUBAPP, object : AdProvider {
// /**
// * 阅读⻚弹窗广告确认按钮的点击回调-激励视频
// * @param dialog
// * @param block 对话框关闭回调,必须调用,否则计时每次切换章节都会出现弹窗
// */
// override fun onAdDialogPositiveClick(dialog: Dialog?, function0: Function0<Unit>) {
// if (isNetworkAvailable(applicationContext) && !isWifiConnected(applicationContext)) {
// AlertDialog.Builder(ActivityStackManager.getInstance().topActivity)
// .setTitle("温馨提示")
// .setMessage("当前处于移动网络,播放视频会消耗流量,确定播放?")
// .setPositiveButton("观看视频") { dialog, which ->
// onAdDialogInvoke(function0)
// }.setNegativeButton("取消") { dialog, which -> dialog.dismiss() }
// .create().show()
// return
// } else {
// onAdDialogInvoke(function0)
// }
// }
//
// /**
// * 阅读⻚首次打开 弹框广告(信息流) 广告宽度 320 高度 260 * @param adViewContainer 广告view的容器
// */
// override fun getReaderScreenAd(view: View, receiver: OnAdViewReceiver,
// dialog: Dialog?) {
// csjAd.loadAD(applicationContext, receiver, 320, 260, ReadToutiaoAD.OnClickListener { dialog!!.dismiss() })
// }
//
// /**
// * 阅读⻚翻⻚广告(信息流) 广告宽度 320 高度 260
// */
// override fun getReaderPageAd(receiver: OnAdViewReceiver) {
// csjAd.loadAD(applicationContext, receiver, px2dip(applicationContext, ScreenUtils.getScreenWidth(applicationContext) - dip2px(applicationContext, 30f).toFloat()), px2dip(applicationContext, 854f), null)
// }
//
// /**
// * 阅读⻚定时弹窗广告 (激励视频)
// */
// override fun getReaderDialogAd(view: View, receiver: OnAdViewReceiver, dialog: Dialog?) {
// if (isCsjAd) {
// curVedioAd = csjVedioAD
// csjAd.loadVideoAd(ActivityStackManager.getInstance().topActivity, receiver)
// } else {
// curVedioAd = ylhVedioAD
// ylhAd.loadVideoAd(ActivityStackManager.getInstance().topActivity, receiver)
// }
// isCsjAd = !isCsjAd
// }
// })
// }
//
// private fun onAdDialogInvoke(function0: () -> Unit) {
// when (curVedioAd) {
// csjVedioAD -> {
// csjAd.showVideo(ActivityStackManager.getInstance().topActivity) { function0.invoke() }
// }
// ylhVedioAD -> {
// ylhAd.showVideo(ActivityStackManager.getInstance().topActivity) { function0.invoke() }
// }
// }
// }
//}
\ No newline at end of file
......@@ -20,7 +20,6 @@ import com.mints.goodmoney.manager.UserManager
import com.mints.goodmoney.mvp.views.MainView
import com.mints.goodmoney.ui.activitys.base.BaseActivity
import com.mints.goodmoney.ui.fragment.*
import dagger.hilt.android.AndroidEntryPoint
import kotlinx.android.synthetic.main.activity_main.*
/**
......@@ -29,7 +28,6 @@ import kotlinx.android.synthetic.main.activity_main.*
* 时间:2020/10/9 10:39
* 邮箱:mengcga@163.com
*/
@AndroidEntryPoint
class MainActivity : BaseActivity(), MainView, View.OnClickListener {
private val audioManager by lazy { getSystemService(Context.AUDIO_SERVICE) as AudioManager }
......
......@@ -3,14 +3,14 @@ package com.mints.goodmoney.ui.activitys
import android.os.Bundle
import android.view.View
import androidx.fragment.app.Fragment
import androidx.fragment.app.FragmentTransaction
import com.chineseall.reader17ksdk.feature.main.bookshop.wellchosen.WellChosenFragment
import com.mints.goodmoney.R
import com.mints.goodmoney.common.Constant
import com.mints.goodmoney.ui.activitys.base.BaseActivity
import com.mints.goodmoney.ui.fragment.*
import com.mints.goodmoney.ui.fragment.FriendsFragment
import com.mints.goodmoney.ui.fragment.KuYinYueFragment
import com.mints.goodmoney.ui.fragment.RsNewsFragment
import com.mints.goodmoney.ui.fragment.WzFragment
import com.mints.goodmoney.ui.widgets.seekbar.BubbleUtils
import dagger.hilt.android.AndroidEntryPoint
import kotlinx.android.synthetic.main.activity_wrapper.*
import kotlinx.android.synthetic.main.header_layout.*
......@@ -19,7 +19,6 @@ import kotlinx.android.synthetic.main.header_layout.*
* 作者:孟崔广
* 时间:2020/12/10 12:39
*/
@AndroidEntryPoint
class WrapperActivity : BaseActivity(), View.OnClickListener {
private var wrapperType = Constant.WRAPPER_TYPE_NEWS
......@@ -64,10 +63,6 @@ class WrapperActivity : BaseActivity(), View.OnClickListener {
// transaction.show(wellChosenFragment)
// transaction.commitAllowingStateLoss()
}
Constant.WRAPPER_TYPE_BOOK -> {
tv_title.text = "书城"
currentFragment = ReaderFragment()
}
Constant.WRAPPER_TYPE_FRIENDS -> {
tv_title.text = "瓜分百万现金福利"
currentFragment = FriendsFragment(true)
......
......@@ -157,7 +157,7 @@ class MainFragment : BaseFragment(), HomeView, View.OnClickListener {
homePresenter.comSaveTerminalInfo(ps)
baseApplication.initUm(context)
baseApplication.TalkingDataConfig()
ReaderManager.init()
// ReaderManager.init()
// }
}
......
......@@ -4,11 +4,9 @@ import androidx.fragment.app.Fragment
import androidx.fragment.app.FragmentManager
import androidx.fragment.app.FragmentTransaction
import com.androidkun.xtablayout.XTabLayout
import com.chineseall.reader17ksdk.feature.main.bookshop.wellchosen.WellChosenFragment
import com.mints.goodmoney.R
import com.mints.goodmoney.common.AppConfig
import com.mints.goodmoney.ui.fragment.base.BaseFragment
import dagger.hilt.android.AndroidEntryPoint
import kotlinx.android.synthetic.main.fragment_main_money.*
/**
......@@ -143,15 +141,15 @@ class MoneyFragment : BaseFragment(), XTabLayout.OnTabSelectedListener {
}
fun selectBook() {
xtFragmentMoney.getTabAt(1)?.select()
if (bookStoreFragment == null) {
bookStoreFragment = ReaderFragment()
}
addOrShowFragment(childFragmentManager, bookStoreFragment!!, FRAGMENT_TAG_BOOKSTORE)
// xtFragmentMoney.getTabAt(1)?.select()
// if (bookStoreFragment == null) {
// bookStoreFragment = ReaderFragment()
// }
// addOrShowFragment(childFragmentManager, bookStoreFragment!!, FRAGMENT_TAG_BOOKSTORE)
}
fun selectXmly() {
xtFragmentMoney.getTabAt(2)?.select()
xtFragmentMoney.getTabAt(1)?.select()
if (xmlyGameFragment == null) {
xmlyGameFragment = XmlyFragment()
}
......@@ -180,25 +178,25 @@ class MoneyFragment : BaseFragment(), XTabLayout.OnTabSelectedListener {
}
}
// 1 -> {
// if (bookStoreFragment == null) {
// bookStoreFragment = ReaderFragment()
// }
// addOrShowFragment(childFragmentManager, bookStoreFragment!!, FRAGMENT_TAG_BOOKSTORE)
// }
1 -> {
if (bookStoreFragment == null) {
bookStoreFragment = ReaderFragment()
}
addOrShowFragment(childFragmentManager, bookStoreFragment!!, FRAGMENT_TAG_BOOKSTORE)
}
2 -> {
if (xmlyGameFragment == null) {
xmlyGameFragment = XmlyFragment()
}
addOrShowFragment(childFragmentManager, xmlyGameFragment!!, FRAGMENT_TAG_XMLY)
}
3 -> {
2 -> {
if (liebaoGameFragment == null) {
liebaoGameFragment = LiebaoGameFragment()
}
addOrShowFragment(childFragmentManager, liebaoGameFragment!!, FRAGMENT_TAG_GAME)
}
4 -> {
3 -> {
if (kuYinyueFragment == null) {
kuYinyueFragment = KuYinYueFragment()
}
......
package com.mints.goodmoney.ui.fragment
import android.os.Bundle
import android.view.View
import androidx.fragment.app.FragmentTransaction
import com.chineseall.reader17ksdk.ChineseAllReaderApplication
import com.chineseall.reader17ksdk.callbacks.OnReadCallBack
import com.chineseall.reader17ksdk.feature.main.bookshop.wellchosen.WellChosenFragment
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.LogUtil
import com.mints.goodmoney.utils.SpanUtils
import kotlinx.android.synthetic.main.fragment_main_zy.*
/**
* 描述:听读
* 作者:孟崔广
* 时间:2021/04/08 10:55
*/
class ReaderFragment : LazyLoadBaseFragment(), BookView, OnReadCallBack {
private val wellChosenFragment by lazy { WellChosenFragment("home") }
private val bookPresenter by lazy { BookPresenter() }
override fun getContentViewLayoutID() = R.layout.fragment_main_zy
override fun initViewsAndEvents() {}
override fun onFragmentFirstVisible() {
bookPresenter.attachView(this)
val transaction: FragmentTransaction = supportFragmentManager.beginTransaction()
transaction.add(R.id.fragment, wellChosenFragment, ReaderFragment::class.java.simpleName)
transaction.show(wellChosenFragment)
transaction.commitAllowingStateLoss()
//间隔30秒 回调一次 间隔任意设置
ChineseAllReaderApplication.setOnReadCallBack(this, 30 * 1000)
}
override fun onFragmentResume() {
super.onFragmentResume()
if (AppConfig.fragmentClickFlag == Constant.FRAGMENT_CLICK_ONE) {
bookPresenter.getReadInfo()
}
}
override fun onDestroy() {
super.onDestroy()
ChineseAllReaderApplication.destory()
bookPresenter.detachView()
}
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()
}
}
override fun onReceive(map: Map<String, Any>) {
val time = map.get("time").toString().toInt()
val seconds = (time / 1000)
// 阅读5秒以上 保存时长
if (seconds > 5) {
bookPresenter.addReadSeconds(seconds)
}
LogUtil.d("ReaderFragment", "time:-->${time}")
}
}
\ No newline at end of file
//package com.mints.goodmoney.ui.fragment
//
//import android.os.Bundle
//import android.view.View
//import androidx.fragment.app.FragmentTransaction
//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.LogUtil
//import com.mints.goodmoney.utils.SpanUtils
//import kotlinx.android.synthetic.main.fragment_main_zy.*
//
///**
// * 描述:听读
// * 作者:孟崔广
// * 时间:2021/04/08 10:55
// */
//class ReaderFragment : LazyLoadBaseFragment(), BookView, OnReadCallBack {
//
// private val wellChosenFragment by lazy { WellChosenFragment("home") }
// private val bookPresenter by lazy { BookPresenter() }
//
// override fun getContentViewLayoutID() = R.layout.fragment_main_zy
//
// override fun initViewsAndEvents() {}
//
// override fun onFragmentFirstVisible() {
// bookPresenter.attachView(this)
//
// val transaction: FragmentTransaction = supportFragmentManager.beginTransaction()
// transaction.add(R.id.fragment, wellChosenFragment, ReaderFragment::class.java.simpleName)
// transaction.show(wellChosenFragment)
// transaction.commitAllowingStateLoss()
//
// //间隔30秒 回调一次 间隔任意设置
// ChineseAllReaderApplication.setOnReadCallBack(this, 30 * 1000)
// }
//
// override fun onFragmentResume() {
// super.onFragmentResume()
// if (AppConfig.fragmentClickFlag == Constant.FRAGMENT_CLICK_ONE) {
// bookPresenter.getReadInfo()
// }
// }
//
// override fun onDestroy() {
// super.onDestroy()
//
// ChineseAllReaderApplication.destory()
// bookPresenter.detachView()
// }
//
// 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()
// }
// }
//
// override fun onReceive(map: Map<String, Any>) {
// val time = map.get("time").toString().toInt()
// val seconds = (time / 1000)
// // 阅读5秒以上 保存时长
// if (seconds > 5) {
// bookPresenter.addReadSeconds(seconds)
// }
// LogUtil.d("ReaderFragment", "time:-->${time}")
// }
//
//}
\ No newline at end of file
......@@ -63,10 +63,10 @@ buildscript {
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
// 听读
classpath "androidx.navigation:navigation-safe-args-gradle-plugin:2.3.1"
classpath "com.google.dagger:hilt-android-gradle-plugin:2.28.3-alpha"
classpath 'com.hujiang.aspectjx:gradle-android-plugin-aspectjx:2.0.10'
classpath 'com.sensorsdata.analytics.android:android-gradle-plugin2:3.3.1'
// classpath "androidx.navigation:navigation-safe-args-gradle-plugin:2.3.1"
// classpath "com.google.dagger:hilt-android-gradle-plugin:2.28.3-alpha"
// classpath 'com.hujiang.aspectjx:gradle-android-plugin-aspectjx:2.0.10'
// classpath 'com.sensorsdata.analytics.android:android-gradle-plugin2:3.3.1'
}
}
......
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