Commit 77383a63 authored by jyx's avatar jyx

添加横版短视频

parent 61ea2bb2
......@@ -7,6 +7,7 @@ import android.content.Intent
import cn.jpush.android.api.BasicPushNotificationBuilder
import cn.jpush.android.api.JPushInterface
import com.mints.goodmoney.manager.BxmManager.initBxm
import com.mints.goodmoney.manager.LiebaoManager
import com.mints.goodmoney.manager.ShumeiManager
import com.mints.goodmoney.manager.ZhangyueManager
import com.mints.library.utils.CommonUtils
......@@ -84,6 +85,9 @@ class InitAppService : IntentService("InitializeService") {
// 变现猫
initBxm(this.application)
// 猎豹游戏初始化
LiebaoManager.getInstance().initCmGameSdk()
}
/**
......
......@@ -13,7 +13,6 @@ import androidx.multidex.MultiDexApplication;
import com.bun.miitmdid.core.JLibrary;
import com.component.dly.xzzq_ywsdk.YwSDK;
import com.mints.goodmoney.common.Constant;
import com.mints.goodmoney.manager.LiebaoManager;
import com.mints.goodmoney.manager.MiitHelper;
import com.mints.goodmoney.manager.TtCsjAdManager;
import com.mints.goodmoney.manager.UserManager;
......@@ -112,8 +111,8 @@ public class MintsApplication extends MultiDexApplication {
// 一览视频
initYL();
// 猎豹游戏初始化
LiebaoManager.getInstance().initCmGameSdk();
// // 猎豹游戏初始化
// LiebaoManager.getInstance().initCmGameSdk();
}
private MiitHelper.AppIdsUpdater appIdsUpdater = ids -> OAID = ids;
......@@ -160,6 +159,7 @@ public class MintsApplication extends MultiDexApplication {
YLUIConfig.getInstance() //抖音样式小视频配置
.littleLikeShow(true) //是否显示点赞
.littleShareShow(false) //是否显示分享
.littleShowGuide(true)//是否显示新手引导滑动浮层(第一次安装进入显示)
.littleComment(CommentConfig.CommentType.DISMISS_COMMENT) //评论,参数详见文档;
//feed流短视频样式配置
.videoComment(CommentConfig.CommentType.DISMISS_COMMENT) //评论,参数详见文档;
......@@ -167,8 +167,9 @@ public class MintsApplication extends MultiDexApplication {
.videoShareShow(false) //是否显示分享
.followAvailable(false) //关注功能是否可用
.feedAvatarClickable(true) //头像是否支持点击跳转到作者页面
.feedPlayAuto(true) //feed自动播放
.feedSwipeRefreshEnable(true); //feed是否可以下拉刷新
FeedConfig.getInstance().setPlayerStyle(FeedConfig.STYLE_NATIVE); //FeedConfig.STYLE_STYLE_FEED_PLAY当前页面播放
FeedConfig.getInstance().setPlayerStyle(FeedConfig.STYLE_FEED_PLAY); //FeedConfig.STYLE_FEED_PLAY当前页面播放
}
/**
......
......@@ -59,12 +59,13 @@ object Constant {
var ICASH_PATH = Environment.getExternalStorageDirectory().path + "/money/" + "apk/"
/**
* app应用首页 0-主页 1-pan 2-friends 3-我
* app应用首页 0-主页 1-横屏视频 2-pan 3-friends 4-我
*/
const val FRAGMENT_CLICK_MAIN = 0
const val FRAGMENT_CLICK_PAN = 1
const val FRAGMENT_CLICK_FRIENDS = 2
const val FRAGMENT_CLICK_MY = 3
const val FRAGMENT_CLICK_CHANNEL = 2
const val FRAGMENT_CLICK_FRIENDS = 3
const val FRAGMENT_CLICK_MY = 4
// 协议地址
var REGISTER_URL = BuildConfig.MainIp + "gm/register.html"//服务协议
......
......@@ -74,7 +74,6 @@ class HomePresenter : BasePresenter<HomeView>() {
if (isLinkView) return
view.hideLoading()
view.showToast(e.message)
view.getHallBaseMsgFail()
}
override fun onNext(baseResponse: BaseResponse<UserTaskMsgBean>) {
......@@ -83,8 +82,7 @@ class HomePresenter : BasePresenter<HomeView>() {
val message = baseResponse.getMessage()
when (code) {
200 -> view.getHallBaseMsgSuc(baseResponse.getData())
else ->{
view.getHallBaseMsgFail()
else -> {
view.showToast(message)
}
}
......
package com.mints.goodmoney.mvp.presenters
import com.mints.goodmoney.manager.AppHttpManager
import com.mints.goodmoney.mvp.model.BaseResponse
import com.mints.goodmoney.mvp.model.MainVedioMsgBean
import com.mints.goodmoney.mvp.views.HorizChannelView
import com.mints.library.net.neterror.BaseSubscriber
import com.mints.library.net.neterror.Throwable
class HorizChannelPresenter : BasePresenter<HorizChannelView>() {
fun getSmallHomeVedioBaseMsg() {
AppHttpManager.getInstance(loanApplication)
.call(loanService.smallHomeVedioBaseMsg,
object : BaseSubscriber<BaseResponse<MainVedioMsgBean>>() {
override fun onCompleted() {
if (isLinkView) return
}
override fun onError(e: Throwable) {
if (isLinkView) return
}
override fun onNext(baseResponse: BaseResponse<MainVedioMsgBean>) {
if (isLinkView) return
val code = baseResponse.getStatus()
val message = baseResponse.getMessage()
when (code) {
200 -> view.getHomeVedioMsgSuc(baseResponse.data)
else -> view.showToast(message)
}
}
})
}
}
\ No newline at end of file
......@@ -11,7 +11,6 @@ import com.mints.goodmoney.mvp.views.MyView
import com.mints.goodmoney.utils.DeviceUuidFactory
import com.mints.library.net.neterror.BaseSubscriber
import com.mints.library.net.neterror.Throwable
import net.grandcentrix.tray.AppPreferences
import java.util.*
class MyPresenter : BasePresenter<MyView>() {
......@@ -20,7 +19,6 @@ class MyPresenter : BasePresenter<MyView>() {
* 获取签到内容
*/
open fun getSignInHomePageMsg() {
// view.showLoading("加载中...");
AppHttpManager.getInstance(loanApplication)
.call(loanService.signInHomePageMsg,
......@@ -76,14 +74,17 @@ class MyPresenter : BasePresenter<MyView>() {
val message = baseResponse.message
when (code) {
200 -> view.signInHomePageSuc()
else -> {
view.showToast(message)
}
}
}
})
}
fun getUserHallBaseMsg() {
fun getAutoUserHallBaseMsg() {
AppHttpManager.getInstance(loanApplication)
.call(loanService.userHallBaseMsg, object : BaseSubscriber<BaseResponse<MyInfo>>() {
.call(loanService.autoUserHallBaseMsg, object : BaseSubscriber<BaseResponse<MyInfo>>() {
override fun onCompleted() {
if (isLinkView)
......@@ -121,6 +122,46 @@ class MyPresenter : BasePresenter<MyView>() {
})
}
// fun getUserHallBaseMsg() {
// AppHttpManager.getInstance(loanApplication)
// .call(loanService.userHallBaseMsg, object : BaseSubscriber<BaseResponse<MyInfo>>() {
//
// override fun onCompleted() {
// if (isLinkView)
// return
//
// view.hideLoading()
// }
//
// override fun onNext(baseResponse: BaseResponse<MyInfo>) {
// if (isLinkView) return
//
// val code: Int = baseResponse.status
// val message: String = baseResponse.message
// when (code) {
// 200 -> {
// view.getUserTaskMsgSuc(baseResponse.data)
// }
// 401 -> view.getUserTaskMsgFail()
// else -> {
// view.getUserTaskMsgFail()
// view.showToast(message)
// }
// }
//
// }
//
// override fun onError(e: Throwable?) {
// if (isLinkView) return
//
// view.hideLoading()
// view.showToast(e!!.message)
// view.getUserTaskMsgFail()
// }
//
// })
// }
/**
* 热门活动接口
*/
......
......@@ -6,6 +6,5 @@ import com.mints.goodmoney.mvp.model.UserTaskMsgBean
interface HomeView : BaseView {
fun getHallBaseMsgSuc(data: UserTaskMsgBean)
fun getHallBaseMsgFail()
fun getHomeVedioMsgSuc(data: MainVedioMsgBean)
}
package com.mints.goodmoney.mvp.views
import com.mints.goodmoney.mvp.model.MainVedioMsgBean
interface HorizChannelView : BaseView {
fun getHomeVedioMsgSuc(data: MainVedioMsgBean)
}
\ No newline at end of file
......@@ -89,13 +89,13 @@ public interface LoanService {
@POST("api/saveTerminalInfo")
Observable<BaseResponse<Object>> saveTerminalInfo(@Body Map<String, Object> vo);
/**
* 我的界面信息
*
* @return
*/
@POST("api/getUserHallBaseMsg")
Observable<BaseResponse<MyInfo>> getUserHallBaseMsg();
// /**
// * 我的界面信息
// *
// * @return
// */
// @POST("api/getUserHallBaseMsg")
// Observable<BaseResponse<MyInfo>> getUserHallBaseMsg();
/**
* 热门活动接口
......@@ -313,6 +313,14 @@ public interface LoanService {
@POST("api/getHomeVedioBaseMsg")
Observable<BaseResponse<MainVedioMsgBean>> getHomeVedioMsg();
/**
* 横版视频信息
*
* @return
*/
@POST("api/getSmallHomeVedioBaseMsg")
Observable<BaseResponse<MainVedioMsgBean>> getSmallHomeVedioBaseMsg();
/**
* 阅读时长
*
......@@ -361,6 +369,14 @@ public interface LoanService {
@POST("api/contributionOutToCash")
Observable<BaseResponse<JsonObject>> contributionOutToCash();
/**
* 新版 我的界面信息
*
* @return
*/
@POST("api/getAutoUserHallBaseMsg")
Observable<BaseResponse<MyInfo>> getAutoUserHallBaseMsg();
/**
* 默认http工厂
......
......@@ -87,6 +87,16 @@ class AwardActivity : BaseActivity(), AwardView, View.OnClickListener {
carrierType = Constant.CARRIER_HOMEVEDIO_DOUBLE
}
Constant.CARRIER_SMALLHOMEVEDIO -> {
val vo = HashMap<String, Any>()
vo["carrierType"] = carrierType
awardPresenter.reportAddCoinMsg(vo)
tvAwardContent.setText(curCoin.toString() + "金币已到账")
tvAwardNext.setText("看视频赚${extraId}金币")
carrierType = Constant.CARRIER_SMALLHOMEVEDIO_DOUBLE
}
Constant.CHALLENGE_SHAREFRIEND -> {
val vo = HashMap<String, Any>()
vo["carrierType"] = carrierType
......@@ -190,6 +200,7 @@ class AwardActivity : BaseActivity(), AwardView, View.OnClickListener {
Constant.CARRIER_OFFLINE_DOUBLE, Constant.CARRIER_SIGNIN_HOMEPAGE_CARD,
Constant.CARRIER_CHALLENGE_TURN, Constant.CARRIER_CHALLENGE_CARD,
Constant.CARRIER_WALK_BUBBLE, Constant.CARRIER_HOMEVEDIO_DOUBLE,
Constant.CARRIER_SMALLHOMEVEDIO_DOUBLE,
Constant.CARRIER_WALK, Constant.CARRIER_HOMEWATER -> {
awardVedio()
}
......
......@@ -12,8 +12,6 @@ import com.mints.goodmoney.ui.activitys.base.BaseActivity
import com.mints.goodmoney.utils.SpanUtils
import com.mints.library.utils.json.JsonUtil
import kotlinx.android.synthetic.main.activity_liebao_game.*
import kotlinx.android.synthetic.main.fragment_main_zy.*
import kotlinx.android.synthetic.main.header_activity.*
import kotlinx.android.synthetic.main.header_layout.*
import java.util.*
......
......@@ -14,10 +14,7 @@ import com.mints.goodmoney.common.AppConfig
import com.mints.goodmoney.common.Constant
import com.mints.goodmoney.mvp.views.MainView
import com.mints.goodmoney.ui.activitys.base.BaseActivity
import com.mints.goodmoney.ui.fragment.FriendsFragment
import com.mints.goodmoney.ui.fragment.MoneyFragment
import com.mints.goodmoney.ui.fragment.MyFragment
import com.mints.goodmoney.ui.fragment.PanFragment
import com.mints.goodmoney.ui.fragment.*
import kotlinx.android.synthetic.main.activity_main.*
/**
......@@ -35,6 +32,7 @@ class MainActivity : BaseActivity(), MainView, View.OnClickListener {
private var panFragment: Fragment? = null
private var friendsFragment: Fragment? = null
private var myFragment: Fragment? = null
private var channelFragment: Fragment? = null
private var currentFragment: Fragment? = null
override fun getContentViewLayoutID() = R.layout.activity_main
......@@ -51,25 +49,12 @@ class MainActivity : BaseActivity(), MainView, View.OnClickListener {
// 记录当前Fragment
currentFragment = moneyFragment
}
tab_iv_main.setSelected(true)
tab_tv_main.setSelected(true)
// if (panFragment == null) {
// panFragment = PanFragment()
// }
// if (!panFragment!!.isAdded) {
// // 提交事务
// supportFragmentManager.beginTransaction()
// .add(R.id.content_layout, panFragment!!).commitAllowingStateLoss()
//
// // 记录当前Fragment
// currentFragment = panFragment
// }
// tab_iv_pan.setSelected(true)
// tab_tv_pan.setSelected(true)
tab_iv_main.isSelected = true
tab_tv_main.isSelected = true
tab_rl_main.setOnClickListener(this)
tab_rl_pan.setOnClickListener(this)
tab_rl_channel.setOnClickListener(this)
tab_rl_friends.setOnClickListener(this)
tab_rl_my.setOnClickListener(this)
}
......@@ -118,12 +103,10 @@ class MainActivity : BaseActivity(), MainView, View.OnClickListener {
override fun onClick(view: View) {
when (view.id) {
R.id.tab_rl_main -> clickTab1Layout()
R.id.tab_rl_pan -> clickTab2Layout()
R.id.tab_rl_friends -> {
clickTab3Layout()
// readyGo(AwardActivity::class.java)
}
R.id.tab_rl_my -> clickTab4Layout()
R.id.tab_rl_channel -> clickTab2Layout()
R.id.tab_rl_pan -> clickTab3Layout()
R.id.tab_rl_friends -> clickTab4Layout()
R.id.tab_rl_my -> clickTab5Layout()
}
}
......@@ -137,17 +120,19 @@ class MainActivity : BaseActivity(), MainView, View.OnClickListener {
}
addOrShowFragment(supportFragmentManager.beginTransaction(), moneyFragment!!)
tab_iv_main.setSelected(true)
tab_tv_main.setSelected(true)
tab_iv_pan.setSelected(false)
tab_tv_pan.setSelected(false)
tab_iv_friends.setSelected(false)
tab_tv_friends.setSelected(false)
tab_iv_my.setSelected(false)
tab_tv_my.setSelected(false)
tab_iv_main.isSelected = true
tab_tv_main.isSelected = true
tab_iv_channel.isSelected = false
tab_iv_channel.isSelected = false
tab_iv_pan.isSelected = false
tab_tv_pan.isSelected = false
tab_iv_friends.isSelected = false
tab_tv_friends.isSelected = false
tab_iv_my.isSelected = false
tab_tv_my.isSelected = false
}
fun selectVedio(){
fun selectVedio() {
moneyFragment?.let {
(it as MoneyFragment).selectVedio()
}
......@@ -157,58 +142,84 @@ class MainActivity : BaseActivity(), MainView, View.OnClickListener {
* 点击第二个tab
*/
fun clickTab2Layout() {
AppConfig.fragmentClickFlag = Constant.FRAGMENT_CLICK_CHANNEL
if (channelFragment == null) {
channelFragment = HorizChannelFragment()
}
addOrShowFragment(supportFragmentManager.beginTransaction(), channelFragment!!)
tab_iv_main.isSelected = false
tab_tv_main.isSelected = false
tab_iv_channel.isSelected = true
tab_iv_channel.isSelected = true
tab_iv_pan.isSelected = false
tab_tv_pan.isSelected = false
tab_iv_friends.isSelected = false
tab_tv_friends.isSelected = false
tab_iv_my.isSelected = false
tab_tv_my.isSelected = false
}
/**
* 点击第三个tab
*/
fun clickTab3Layout() {
AppConfig.fragmentClickFlag = Constant.FRAGMENT_CLICK_PAN
if (panFragment == null) {
panFragment = PanFragment()
// panFragment = ZhangyueFragment()
}
addOrShowFragment(supportFragmentManager.beginTransaction(), panFragment!!)
tab_iv_main.setSelected(false)
tab_tv_main.setSelected(false)
tab_iv_pan.setSelected(true)
tab_tv_pan.setSelected(true)
tab_iv_friends.setSelected(false)
tab_tv_friends.setSelected(false)
tab_iv_my.setSelected(false)
tab_tv_my.setSelected(false)
tab_iv_main.isSelected = false
tab_tv_main.isSelected = false
tab_iv_channel.isSelected = false
tab_iv_channel.isSelected = false
tab_iv_pan.isSelected = true
tab_tv_pan.isSelected = true
tab_iv_friends.isSelected = false
tab_tv_friends.isSelected = false
tab_iv_my.isSelected = false
tab_tv_my.isSelected = false
}
/**
* 点击第个tab
* 点击第个tab
*/
private fun clickTab3Layout() {
private fun clickTab4Layout() {
AppConfig.fragmentClickFlag = Constant.FRAGMENT_CLICK_FRIENDS
if (friendsFragment == null) {
friendsFragment = FriendsFragment()
}
addOrShowFragment(supportFragmentManager.beginTransaction(), friendsFragment!!)
tab_iv_main.setSelected(false)
tab_tv_main.setSelected(false)
tab_iv_pan.setSelected(false)
tab_tv_pan.setSelected(false)
tab_iv_friends.setSelected(true)
tab_tv_friends.setSelected(true)
tab_iv_my.setSelected(false)
tab_tv_my.setSelected(false)
tab_iv_main.isSelected = false
tab_tv_main.isSelected = false
tab_iv_channel.isSelected = false
tab_iv_channel.isSelected = false
tab_iv_pan.isSelected = false
tab_tv_pan.isSelected = false
tab_iv_friends.isSelected = true
tab_tv_friends.isSelected = true
tab_iv_my.isSelected = false
tab_tv_my.isSelected = false
}
/**
* 点击第个tab
* 点击第个tab
*/
private fun clickTab4Layout() {
private fun clickTab5Layout() {
AppConfig.fragmentClickFlag = Constant.FRAGMENT_CLICK_MY
if (myFragment == null) {
myFragment = MyFragment()
}
addOrShowFragment(supportFragmentManager.beginTransaction(), myFragment!!)
tab_iv_main.setSelected(false)
tab_tv_main.setSelected(false)
tab_iv_pan.setSelected(false)
tab_tv_pan.setSelected(false)
tab_iv_friends.setSelected(false)
tab_tv_friends.setSelected(false)
tab_iv_my.setSelected(true)
tab_tv_my.setSelected(true)
tab_iv_main.isSelected = false
tab_tv_main.isSelected = false
tab_iv_channel.isSelected = false
tab_iv_channel.isSelected = false
tab_iv_pan.isSelected = false
tab_tv_pan.isSelected = false
tab_iv_friends.isSelected = false
tab_tv_friends.isSelected = false
tab_iv_my.isSelected = true
tab_tv_my.isSelected = true
}
/**
......
......@@ -15,6 +15,7 @@ import com.mints.library.net.netstatus.NetUtils
import com.qq.e.ads.splash.SplashAD
import com.qq.e.ads.splash.SplashADListener
import com.qq.e.comm.util.AdError
import com.yilan.sdk.ui.little.YLLittleVideoFragment
/**
* 后台返回时每次都展示
......@@ -52,6 +53,9 @@ class SplashADActivity : BaseActivity(), SplashADListener {
readyGoOtherActivity()
}
}
// 预加载好兔视频
YLLittleVideoFragment.preloadVideo()
}
override fun isApplyKitKatTranslucency(): Boolean {
......
......@@ -8,6 +8,7 @@ import com.mints.goodmoney.R
import com.mints.goodmoney.common.Constant
import com.mints.goodmoney.common.DeviceInfo
import com.mints.goodmoney.ui.activitys.base.BaseActivity
import com.yilan.sdk.ui.little.YLLittleVideoFragment
import kotlinx.android.synthetic.main.activity_splash.*
import net.grandcentrix.tray.AppPreferences
......@@ -20,7 +21,7 @@ class SplashActivity : BaseActivity() {
private val animationSet by lazy { AnimationSet(true) }
private val ps by lazy { AppPreferences(context) }
override fun isApplyKitKatTranslucency()=false
override fun isApplyKitKatTranslucency() = false
override fun initViewsAndEvents() {
if (!isTaskRoot) {
......@@ -32,9 +33,12 @@ class SplashActivity : BaseActivity() {
// 校验APP签名
checkAppSign()
// 预加载好兔视频
YLLittleVideoFragment.preloadVideo()
}
override fun getContentViewLayoutID()= R.layout.activity_splash
override fun getContentViewLayoutID() = R.layout.activity_splash
override fun toggleIsBack2Left() = true
......@@ -45,7 +49,6 @@ class SplashActivity : BaseActivity() {
}
override fun onDestroy() {
super.onDestroy()
......@@ -57,7 +60,6 @@ class SplashActivity : BaseActivity() {
}
/**
* 校验App签名
*/
......@@ -85,13 +87,13 @@ class SplashActivity : BaseActivity() {
}
private val mAnimationListener: Animation.AnimationListener =
object : Animation.AnimationListener {
override fun onAnimationStart(animation: Animation) {}
override fun onAnimationRepeat(animation: Animation) {}
override fun onAnimationEnd(animation: Animation) {
readyGoOtherActivity()
object : Animation.AnimationListener {
override fun onAnimationStart(animation: Animation) {}
override fun onAnimationRepeat(animation: Animation) {}
override fun onAnimationEnd(animation: Animation) {
readyGoOtherActivity()
}
}
}
private fun readyGoOtherActivity() {
val customVersion: Int = ps.getInt(Constant.CUSTOM_VERSION, 0)
......
......@@ -65,6 +65,9 @@ class SplashYlhActivity : BaseActivity(), SplashADListener {
}
// 校验APP签名
checkAppSign()
// 预加载好兔视频
YLLittleVideoFragment.preloadVideo()
}
override fun isApplyKitKatTranslucency(): Boolean {
......
......@@ -5,28 +5,35 @@ import android.graphics.Color
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.ImageView
import android.widget.ProgressBar
import android.widget.TextView
import androidx.recyclerview.widget.RecyclerView
import com.mints.goodmoney.R
import com.mints.goodmoney.mvp.model.TaskBean
import com.mints.goodmoney.mvp.model.MyInfo
import com.mints.goodmoney.ui.adapter.listener.OnItemChildClickListener
import com.mints.goodmoney.ui.adapter.listener.OnItemClickListener
class MainMyAdapter(context: Context, taskData: MutableList<TaskBean>) : RecyclerView.Adapter<RecyclerView.ViewHolder>() {
class MainMyAdapter(context: Context, taskData: MutableList<MyInfo.AutoListBean>) : RecyclerView.Adapter<RecyclerView.ViewHolder>() {
companion object {
const val TASK_TYPE_HOME = 0x00000001
const val TASK_TYPE_INVITE = 0x00000002
const val TASK_TYPE_VIDEO = 0x00000003
const val TASK_TYPE_GAME = 0x00000004
const val TASK_TYPE_FICTION = 0x00000005
const val TASK_TYPE_DEMO = 0x00000006
// 跳转首页
const val TO_HOME = "TO_HOME"
// 邀请好友
const val APP_SHAREFRIEND = "APP_SHAREFRIEND"
// 看福利视频
const val APP_VEDIO = "APP_VEDIO"
// 试玩平台
const val TO_YWHZ = "TO_YWHZ"
// 玩游戏,赚金币
const val TO_LIEBAO = "TO_LIEBAO"
}
private var mContext: Context = context
private var taskData: List<TaskBean>? = taskData
private var taskData: List<MyInfo.AutoListBean>? = taskData
private var mOnItemClickListener: OnItemClickListener? = null
private var mOnItemChildClickListener: OnItemChildClickListener? = null
......@@ -54,46 +61,74 @@ class MainMyAdapter(context: Context, taskData: MutableList<TaskBean>) : Recycle
holder.itemTaskClick.setOnClickListener { it2 ->
mOnItemChildClickListener?.onItemChildClick(it2, position)
}
holder.itemTaskTitle.text = taskBean.title
holder.itemTaskContent.text = taskBean.title
// 标题
holder.itemTaskTitle.text = taskBean.baseConfig.title
// 内容
holder.itemTaskContent.text = taskBean.baseConfig.context
// 按钮文字
holder.itemTaskClick.text = taskBean.baseConfig.buttonText
// 金币
holder.itemTaskMoney.text = " " + taskBean.baseConfig.coinText
// holder.itemTaskImg.setImageDrawable(mContext.resources.getDrawable(taskBean.imageSrc))
if (taskBean.btnStr.isEmpty()) {
if (taskBean.baseConfig.buttonText == null) {
holder.itemTaskClick.visibility = View.GONE
} else {
holder.itemTaskClick.visibility = View.VISIBLE
holder.itemTaskClick.text = taskBean.btnStr
holder.itemTaskPb.progress = 10
when (taskBean.btnStr) {
"立即领取" -> {
holder.itemTaskClick.setBackgroundResource(R.drawable.shape_btn_orange_complete)
holder.itemTaskClick.setTextColor(Color.WHITE)
}
"已完成" -> {
holder.itemTaskClick.setBackgroundResource(R.drawable.shape_btn_gury)
holder.itemTaskClick.setTextColor(Color.WHITE)
}
else -> {
holder.itemTaskClick.setBackgroundResource(R.drawable.shape_btn_orange)
holder.itemTaskClick.setTextColor(mContext.resources.getColor(R.color.my_color_orange))
// 按钮颜色
if (taskBean.otherConfig != null) {
when (taskBean.otherConfig.status) {
1 -> {
holder.itemTaskClick.setBackgroundResource(R.drawable.shape_btn_orange_complete)
holder.itemTaskClick.setTextColor(Color.WHITE)
}
2 -> {
if (taskBean.baseConfig.taskId == APP_SHAREFRIEND) {
holder.itemTaskClick.setBackgroundResource(R.drawable.shape_btn_orange)
holder.itemTaskClick.setTextColor(mContext.resources.getColor(R.color.my_color_orange))
} else {
holder.itemTaskClick.setBackgroundResource(R.drawable.shape_btn_gury)
holder.itemTaskClick.setTextColor(Color.WHITE)
}
}
0 -> {
holder.itemTaskClick.setBackgroundResource(R.drawable.shape_btn_orange)
holder.itemTaskClick.setTextColor(mContext.resources.getColor(R.color.my_color_orange))
}
}
} else {
holder.itemTaskClick.setBackgroundResource(R.drawable.shape_btn_orange)
holder.itemTaskClick.setTextColor(mContext.resources.getColor(R.color.my_color_orange))
}
}
if (taskBean.progressStr.isEmpty()) {
holder.itemTaskProgress.visibility = View.GONE
// 进度条
if (taskBean.otherConfig != null) {
if (taskBean.baseConfig != null) {
holder.itemTaskPb.visibility = View.VISIBLE
holder.itemTaskPb.progress = taskBean.otherConfig.complete
holder.itemTaskPb.max = taskBean.otherConfig.max
} else {
holder.itemTaskPb.visibility = View.GONE
}
} else {
holder.itemTaskPb.visibility = View.GONE
}
if (taskBean.baseConfig.runingText != null) {
holder.itemTaskProgress.visibility = View.VISIBLE
holder.itemTaskProgress.text = taskBean.progressStr
holder.itemTaskProgress.text = taskBean.baseConfig.runingText
} else {
holder.itemTaskProgress.visibility = View.GONE
}
}
}
}
private inner class TaskHolder(itemView: View) : RecyclerView.ViewHolder(itemView) {
// val itemTaskImg: ImageView = itemView.findViewById(R.id.item_title_img)
// val itemTaskImg: ImageView = itemView.findViewById(R.id.item_title_img)
val itemTaskTitle: TextView = itemView.findViewById(R.id.item_task_title)
val itemTaskMoney: TextView = itemView.findViewById(R.id.item_task_money)
val itemTaskProgress: TextView = itemView.findViewById(R.id.item_task_progress)
val itemTaskClick: TextView = itemView.findViewById(R.id.item_task_click)
val itemTaskContent: TextView = itemView.findViewById(R.id.item_task_content)
......
package com.mints.goodmoney.ui.fragment
import android.os.Bundle
import android.os.Handler
import android.os.Looper
import android.text.TextUtils
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.model.MainVedioMsgBean
import com.mints.goodmoney.mvp.presenters.HorizChannelPresenter
import com.mints.goodmoney.mvp.views.HorizChannelView
import com.mints.goodmoney.ui.activitys.AwardActivity
import com.mints.goodmoney.ui.fragment.base.BaseFragment
import com.yilan.sdk.player.ylplayer.YLPlayerConfig
import com.yilan.sdk.player.ylplayer.callback.OnPlayerCallBack
import com.yilan.sdk.ui.category.ChannelFragment
import kotlinx.android.synthetic.main.fragment_horiz_channel.cdvvYilanTime
import kotlinx.android.synthetic.main.fragment_horiz_channel.vs_tips
import net.grandcentrix.tray.AppPreferences
class HorizChannelFragment : BaseFragment(), HorizChannelView, View.OnClickListener {
private val horizChannelPresenter by lazy { HorizChannelPresenter() }
private val ps by lazy { AppPreferences(context) }
private var channelFragment: ChannelFragment? = null
private val videoMaxCount = 12 // 当前缓存视频id最大数
private val videoIdList by lazy { ArrayList<String>() }//记录播放的视频id
// 是否是第一次观看完视频
private var isFirstWatchVideo = true
private var isFirstLoadVideo = true // 首次加载视频初始化
private var rewardDoubleCoin = 0 // 大金币
private var rewardCoin = 0 // 小金币
private var isToCreateReward = true // 是否还有剩余红包 服务器返回
private var isAward = false // 是否可以领金币 本地判断
override fun initViewsAndEvents() {
horizChannelPresenter.attachView(this)
initChannelFragment()
initListener()
// 调用金币视频信息接口
horizChannelPresenter.getSmallHomeVedioBaseMsg()
}
private fun initListener() {
cdvvYilanTime.setOnClickListener(this)
}
override fun getHomeVedioMsgSuc(data: MainVedioMsgBean) {
if (activity == null || requireActivity().isFinishing) {
return
}
ps.put(Constant.MAIN_VEDIO_TIME, data.createRewardNeedTime)
rewardCoin = data.rewardCoin
rewardDoubleCoin = data.rewardDoubleCoin
isToCreateReward = data.isToCreateReward
if (isToCreateReward) {
// 防止界面切换 重置倒计时
// 第一次能过 isFirstLoadVedio 判断好兔先加载视频
if (!isFirstLoadVideo && !cdvvYilanTime.isPlaying && !isAward) {
cdvvYilanTime?.reset()
cdvvYilanTime?.start()
}
} else {
stopDownloadTime()
}
}
private fun initChannelFragment() {
val transaction: FragmentTransaction = childFragmentManager.beginTransaction()
if (channelFragment == null) {
// 设置点击的item播放状态,callback返回true标识用户已经处理了event,返回false,标识使用播放器内部逻辑处理event。
YLPlayerConfig.config().registerPlayerCallBack(object : OnPlayerCallBack {
override fun onStart(p0: String?, videoid: String, p2: String?) {
// 防止网络异常时, 第一次加载倒计时红包
if (isFirstLoadVideo) {
isFirstLoadVideo = false
initTimeView()
} else {
resumeDownloadTime(videoid)
}
}
override fun onPause(p0: String?, p1: String?, p2: String?) {
pauseDownloadTime()
}
override fun onResume(p0: String?, videoid: String, p2: String?) {
resumeDownloadTime(videoid)
}
override fun onComplete(p0: String?, videoid: String, p2: String?) {
}
override fun onLoopComplete(pager: String?, videoID: String, taskID: String?, num: Int) {
addVedioIdList(videoID)
pauseDownloadTime()
}
override fun onStuckStart(p0: String?, p1: String?, p2: String?) {
}
override fun onStuckEnd(p0: String?, p1: String?, p2: String?) {
}
override fun onError(p0: String?, p1: String?, p2: String?) {
pauseDownloadTime()
}
override fun onStop(p0: String?, p1: String?, p2: String?) {
}
})
channelFragment = ChannelFragment()
transaction.add(R.id.yilan_fragment_frame_container, channelFragment!!, ChannelFragment::class.java.simpleName)
} else {
transaction.show(channelFragment!!)
}
transaction.commitAllowingStateLoss()
}
override fun getContentViewLayoutID() = R.layout.fragment_horiz_channel
override fun onClick(v: View?) {
when (v?.id) {
R.id.cdvvYilanTime -> {
if (isAward && isToCreateReward) {
isAward = false
val bundle = Bundle()
bundle.putInt(Constant.MAIN_CUR_COIN, rewardCoin)
bundle.putString(Constant.MAIN_CARRIER_TYPE, Constant.CARRIER_SMALLHOMEVEDIO)
bundle.putString(Constant.MAIN_EXTRA_ID, rewardDoubleCoin.toString())
readyGo(AwardActivity::class.java, bundle)
}
}
}
}
override fun setUserVisibleHint(isVisibleToUser: Boolean) {
super.setUserVisibleHint(isVisibleToUser)
channelFragment?.userVisibleHint = isVisibleToUser
}
override fun onHiddenChanged(hidden: Boolean) {
if (hidden) {
onPause()
} else {
onResume()
}
super.onHiddenChanged(hidden)
channelFragment?.onHiddenChanged(hidden)
}
override fun onResume() {
super.onResume()
if (AppConfig.fragmentClickFlag == Constant.FRAGMENT_CLICK_CHANNEL) {
channelFragment?.onResume()
}
}
override fun onPause() {
super.onPause()
channelFragment?.onPause()
// pauseDownloadTime()
}
/**
* 倒计时红包暂停
*/
private fun pauseDownloadTime() {
cdvvYilanTime?.pause()
}
/**
* 将播放的id记录到list中
*/
private fun addVedioIdList(id: String) {
// 达到12个视频时 删除前10个记录
if (videoIdList.size >= videoMaxCount) {
videoIdList.subList(0, 10).clear()
}
if (!videoIdList.contains(id)) videoIdList.add(id)
}
/**
*用户主动暂时或网络异常结束后 重新加载倒计时红包
*/
private fun resumeDownloadTime(id: String) {
if (!TextUtils.isEmpty(id)) {
if (videoIdList.contains(id)) {
cdvvYilanTime?.pause()
return
}
if (!isAward) {
cdvvYilanTime?.resume()
}
}
}
/**
* 停止转动
*/
private fun stopDownloadTime() {
cdvvYilanTime?.stop()
}
/**
* 红包倒计时初始化
*/
private fun initTimeView() {
cdvvYilanTime.setCountDownVedioListener {
if (isFirstWatchVideo) {
// 第一次观看完视频提醒用户
val vs = vs_tips.inflate()
Handler(Looper.getMainLooper()).postDelayed({
vs.visibility = View.GONE
}, 3000)
isFirstWatchVideo = false
}
// 转满一圈,可领金币标记
isAward = true
cdvvYilanTime?.showRedbox()
stopDownloadTime()
}
val videoTime = ps.getInt(Constant.MAIN_VEDIO_TIME, 30)
cdvvYilanTime.setTime(videoTime)
cdvvYilanTime.start()
}
override fun onDestroy() {
super.onDestroy()
cdvvYilanTime?.setCountDownVedioListener(null)
horizChannelPresenter.detachView()
YLPlayerConfig.config().unRegisterPlayerCallback()
}
}
\ No newline at end of file
......@@ -22,7 +22,6 @@ import com.mints.goodmoney.ui.fragment.base.BaseFragment
import com.mints.goodmoney.ui.widgets.DialogListener
import com.mints.goodmoney.ui.widgets.PowerDialog
import com.mints.goodmoney.utils.LogUtil
import com.yilan.sdk.common.ui.mvp.YLPresenter
import com.yilan.sdk.player.ylplayer.YLPlayerConfig
import com.yilan.sdk.player.ylplayer.callback.OnPlayerCallBack
import com.yilan.sdk.ui.little.YLLittleVideoFragment
......@@ -47,7 +46,7 @@ class MainFragment : BaseFragment(), HomeView, View.OnClickListener {
private var rewardDoubleCoin = 0 // 大金币
private var rewardCoin = 0 // 小金币
private var littleVideoFragment: YLLittleVideoFragment? = null
private val VEDIO_MAX_COUNT = 12 // 当前缓存视频id最大数
private val videoMaxCount = 12 // 当前缓存视频id最大数
private val vedioIdList by lazy { ArrayList<String>() }//记录播放的视频id
private var isToCreateReward = true // 是否还有剩余红包 服务器返回
......@@ -58,7 +57,7 @@ class MainFragment : BaseFragment(), HomeView, View.OnClickListener {
private var vedioAdingManager: VedioAdingManager? = null
// 是否是第一次观看完视频
private var isFristWacthVideo = true
private var isFirstWatchVideo = true
override fun getContentViewLayoutID() = R.layout.fragment_main_first
......@@ -279,7 +278,7 @@ class MainFragment : BaseFragment(), HomeView, View.OnClickListener {
*/
private fun addVedioIdList(id: String) {
// 达到12个视频时 删除前10个记录
if (vedioIdList.size >= VEDIO_MAX_COUNT) {
if (vedioIdList.size >= videoMaxCount) {
vedioIdList.subList(0, 10).clear()
}
if (!vedioIdList.contains(id)) vedioIdList.add(id)
......@@ -321,13 +320,13 @@ class MainFragment : BaseFragment(), HomeView, View.OnClickListener {
*/
private fun initTimeview() {
cdvvYilanTime.setCountDownVedioListener {
if (isFristWacthVideo) {
if (isFirstWatchVideo) {
// 第一次观看完视频提醒用户
val vs = vs_tips.inflate()
Handler(Looper.getMainLooper()).postDelayed({
vs.visibility = View.GONE
}, 3000)
isFristWacthVideo = false
isFirstWatchVideo = false
}
// 转满一圈,可领金币标记
......@@ -335,7 +334,7 @@ class MainFragment : BaseFragment(), HomeView, View.OnClickListener {
cdvvYilanTime?.showRedbox()
stopDownloadTime()
}
var vedioTime = ps.getInt(Constant.MAIN_VEDIO_TIME, 30)
val vedioTime = ps.getInt(Constant.MAIN_VEDIO_TIME, 30)
cdvvYilanTime.setTime(vedioTime)
cdvvYilanTime.start()
}
......
......@@ -9,24 +9,20 @@ 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.presenters.HomePresenter
import com.mints.goodmoney.mvp.views.BookView
import com.mints.goodmoney.mvp.views.HomeView
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.activity_drawcash.*
import kotlinx.android.synthetic.main.fragment_main_zy.*
private val TAG = ZhangyueFragment::class.java.simpleName
/**
* 描述:掌阅书城
* 作者:孟崔广
*/
class ZhangyueFragment : LazyLoadBaseFragment(), BookView, IreaderApi.OnReadChangeListener {
private val TAG = ZhangyueFragment::class.java.simpleName
private val bookPresenter by lazy { BookPresenter() }
private var bookFragment: Fragment? = null
......
......@@ -49,6 +49,29 @@
android:textSize="11sp" />
</LinearLayout>
<LinearLayout
android:id="@+id/tab_rl_channel"
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_channel"
android:layout_width="25dp"
android:layout_height="25dp"
android:src="@drawable/tab_pan_btn" />
<TextView
android:id="@+id/tab_tv_channel"
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_pan"
android:layout_width="0dp"
......
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<FrameLayout
android:id="@+id/yilan_fragment_frame_container"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingTop="20dp" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="end|bottom"
android:layout_marginEnd="8dp"
android:orientation="horizontal">
<ViewStub
android:id="@+id/vs_tips"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout="@layout/layout_watchvideo_tips" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="30dp"
android:orientation="vertical">
<ImageView
android:id="@+id/ivMainBox"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginBottom="20dp"
android:src="@mipmap/ic_main_box"
android:visibility="gone" />
<com.mints.goodmoney.ui.widgets.CountDownVedioView
android:id="@+id/cdvvYilanTime"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="100dp" />
</LinearLayout>
</LinearLayout>
</FrameLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<RelativeLayout
android:id="@+id/yilan_fragment_frame_container"
android:layout_width="match_parent"
android:layout_height="match_parent">
</RelativeLayout>
android:layout_height="match_parent" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_alignParentBottom="true"
android:layout_gravity="end|bottom"
android:layout_marginEnd="8dp"
android:orientation="horizontal">
......@@ -48,4 +43,4 @@
android:layout_marginBottom="270dp" />
</LinearLayout>
</LinearLayout>
</RelativeLayout>
\ No newline at end of file
</FrameLayout>
\ No newline at end of file
......@@ -3,7 +3,8 @@
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="10dp">
android:paddingTop="10dp"
android:paddingBottom="10dp">
<!-- <ImageView-->
<!-- android:id="@+id/item_title_img"-->
......@@ -28,7 +29,6 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:text=" +100金币"
android:textColor="@color/main_mints"
android:textSize="15sp"
app:layout_constraintStart_toEndOf="@id/item_task_title"
......@@ -36,7 +36,7 @@
<TextView
android:id="@+id/item_task_content"
android:layout_width="200dp"
android:layout_width="260dp"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:textColor="@color/grayc"
......
......@@ -12,6 +12,7 @@
<!-- 项目主页string -->
<string name="bottom_tab_main">首页</string>
<string name="bottom_tab_pan">大转盘</string>
<string name="bottom_tab_channel">短视频</string>
<string name="bottom_tab_friends">邀请好友</string>
<string name="bottom_tab_my">个人中心</string>
......
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