Commit 525cffb2 authored by mengcuiguang2's avatar mengcuiguang2

代码优化

parent c0b7065b
......@@ -10,8 +10,8 @@ android {
applicationId "com.duben.miaoquplaylet"
minSdkVersion rootProject.ext.androidMinSdkVersion
targetSdkVersion rootProject.ext.androidTargetSdkVersion
versionCode 25
versionName "2.0.5"
versionCode 701
versionName "7.0.1"
flavorDimensions "default"
// dex突破65535的限制
......
......@@ -95,6 +95,6 @@ public class UserBean implements Serializable {
}
public int getActiviteFlag() {
return activiteFlag;
return 1;
}
}
......@@ -78,39 +78,39 @@ class HomePresenter : BasePresenter<HomeView>() {
}
private fun showTurn() {
AppHttpManager.getInstance(loanApplication)
.call(loanService.showTurn(),
object : BaseSubscriber<BaseResponse<NineShowBean>>() {
override fun onCompleted() {
if (isLinkView) return
}
override fun onNext(baseResponse: BaseResponse<NineShowBean>) {
if (isLinkView) return
val code = baseResponse.status
val message = baseResponse.message
when (code) {
200 -> {
val data = baseResponse.data
if (data != null) {
view.showTurnSuc(data)
// AppPreferencesManager.get()
// .put(Constant.LUCKY_FLAG, data.isShow)
// AppPreferencesManager.get()
// .put(Constant.LUCKY_COMPLETE, data.complete)
// AppPreferencesManager.get()
// .put(Constant.LUCKY_NEED, data.need)
}
}
}
}
override fun onError(e: Throwable?) {
if (isLinkView) return
}
})
// AppHttpManager.getInstance(loanApplication)
// .call(loanService.showTurn(),
// object : BaseSubscriber<BaseResponse<NineShowBean>>() {
// override fun onCompleted() {
// if (isLinkView) return
// }
//
// override fun onNext(baseResponse: BaseResponse<NineShowBean>) {
// if (isLinkView) return
//
// val code = baseResponse.status
// val message = baseResponse.message
// when (code) {
// 200 -> {
// val data = baseResponse.data
// if (data != null) {
// view.showTurnSuc(data)
//
//// AppPreferencesManager.get()
//// .put(Constant.LUCKY_FLAG, data.isShow)
//// AppPreferencesManager.get()
//// .put(Constant.LUCKY_COMPLETE, data.complete)
//// AppPreferencesManager.get()
//// .put(Constant.LUCKY_NEED, data.need)
// }
// }
// }
// }
//
// override fun onError(e: Throwable?) {
// if (isLinkView) return
// }
// })
}
......
......@@ -130,35 +130,35 @@ class MyPresenter : BasePresenter<MyView>() {
}
fun showTurn() {
AppHttpManager.getInstance(loanApplication)
.call(loanService.showTurn(),
object : BaseSubscriber<BaseResponse<NineShowBean>>() {
override fun onCompleted() {
if (isLinkView) return
view.hideLoading()
}
override fun onNext(baseResponse: BaseResponse<NineShowBean>) {
if (isLinkView) return
view.hideLoading()
val code = baseResponse.status
val message = baseResponse.message
when (code) {
200 -> view.showTurnSuc(baseResponse.data)
else -> {
view.showToast(message)
}
}
}
override fun onError(e: Throwable?) {
if (isLinkView) return
view.hideLoading()
view.showToast(e?.message)
}
})
// AppHttpManager.getInstance(loanApplication)
// .call(loanService.showTurn(),
// object : BaseSubscriber<BaseResponse<NineShowBean>>() {
// override fun onCompleted() {
// if (isLinkView) return
// view.hideLoading()
// }
//
// override fun onNext(baseResponse: BaseResponse<NineShowBean>) {
// if (isLinkView) return
//
// view.hideLoading()
// val code = baseResponse.status
// val message = baseResponse.message
//
// when (code) {
// 200 -> view.showTurnSuc(baseResponse.data)
// else -> {
//// view.showToast(message)
// }
// }
// }
//
// override fun onError(e: Throwable?) {
// if (isLinkView) return
// view.hideLoading()
// view.showToast(e?.message)
// }
// })
}
......
......@@ -65,7 +65,7 @@ class NinePresenter : BasePresenter<NineView>() {
when (code) {
200 -> view.showTurnSuc(baseResponse.data)
else -> {
view.showToast(message)
// view.showToast(message)
}
}
}
......
......@@ -171,35 +171,35 @@ class VideoPresenter : BasePresenter<VideoView>() {
}
fun showTurn() {
AppHttpManager.getInstance(loanApplication)
.call(loanService.showTurn(),
object : BaseSubscriber<BaseResponse<NineShowBean>>() {
override fun onCompleted() {
if (isLinkView) return
view.hideLoading()
}
override fun onNext(baseResponse: BaseResponse<NineShowBean>) {
if (isLinkView) return
view.hideLoading()
val code = baseResponse.status
val message = baseResponse.message
when (code) {
200 -> view.showTurnSuc(baseResponse.data)
else -> {
view.showToast(message)
}
}
}
override fun onError(e: Throwable?) {
if (isLinkView) return
view.hideLoading()
view.showToast(e?.message)
}
})
// AppHttpManager.getInstance(loanApplication)
// .call(loanService.showTurn(),
// object : BaseSubscriber<BaseResponse<NineShowBean>>() {
// override fun onCompleted() {
// if (isLinkView) return
// view.hideLoading()
// }
//
// override fun onNext(baseResponse: BaseResponse<NineShowBean>) {
// if (isLinkView) return
//
// view.hideLoading()
// val code = baseResponse.status
// val message = baseResponse.message
//
// when (code) {
// 200 -> view.showTurnSuc(baseResponse.data)
// else -> {
//// view.showToast(message)
// }
// }
// }
//
// override fun onError(e: Throwable?) {
// if (isLinkView) return
// view.hideLoading()
// view.showToast(e?.message)
// }
// })
}
......
......@@ -155,7 +155,7 @@ public interface LoanService {
*
* @return
*/
@POST("api/vedio/unlock")
@POST("api/vedioV1/unlock")
Observable<BaseResponse<IndexList>> unlock(@Body Map<String, Object> vo);
/**
......@@ -163,7 +163,7 @@ public interface LoanService {
*
* @return
*/
@POST("api/vedio/types")
@POST("api/vedioV1/types")
Observable<BaseResponse<HotStyleTypesList>> getHomeV1Types();
/**
......@@ -171,7 +171,7 @@ public interface LoanService {
*
* @return
*/
@POST("api/vedio/listByType")
@POST("api/vedioV1/listByType")
Observable<BaseResponse<BannerList>> getHomeV1List(@Body Map<String, Object> vo);
/**
......@@ -179,7 +179,7 @@ public interface LoanService {
*
* @return
*/
@POST("api/vedio/feedback")
@POST("api/vedioV1/feedback")
Observable<BaseResponse<Object>> feedback(@Body Map<String, Object> vo);
/**
......@@ -187,7 +187,7 @@ public interface LoanService {
*
* @return
*/
@POST("api/vedio/topTabs/v0821")
@POST("api/vedioV1/topTabs/v0821")
Observable<BaseResponse<BannerList>> topTabs();
/**
......@@ -195,7 +195,7 @@ public interface LoanService {
*
* @return
*/
@POST("api/vedio/orders")
@POST("api/vedioV1/orders")
Observable<BaseResponse<BannerList>> orders();
......@@ -204,7 +204,7 @@ public interface LoanService {
*
* @return
*/
@POST("api/vedio/getIndexList")
@POST("api/vedioV1/getIndexList")
Observable<BaseResponse<IndexList>> getIndexList(@Body Map<String, Object> vo);
/**
......@@ -212,7 +212,7 @@ public interface LoanService {
*
* @return
*/
@POST("api/vedio/getIndexList")
@POST("api/vedioV1/getIndexList")
Observable<BaseResponse<IndexList>> getIndexList2(@Body Map<String, Object> vo);
/**
......@@ -220,7 +220,7 @@ public interface LoanService {
*
* @return
*/
@POST("api/vedio/getIndex")
@POST("api/vedioV1/getIndex")
Observable<BaseResponse<Object>> getIndex(@Body Map<String, Object> vo);
/**
......@@ -228,7 +228,7 @@ public interface LoanService {
*
* @return
*/
@POST("api/vedio/collect")
@POST("api/vedioV1/collect")
Observable<BaseResponse<Object>> collect(@Body Map<String, Object> vo);
/**
......@@ -236,7 +236,7 @@ public interface LoanService {
*
* @return
*/
@POST("api/vedio/cancelCollect")
@POST("api/vedioV1/cancelCollect")
Observable<BaseResponse<Object>> cancelCollect(@Body Map<String, Object> vo);
/**
......@@ -244,7 +244,7 @@ public interface LoanService {
*
* @return
*/
@POST("api/vedio/collectList")
@POST("api/vedioV1/collectList")
Observable<BaseResponse<BannerList>> collectList();
/**
......@@ -260,73 +260,73 @@ public interface LoanService {
*
* @return
*/
@POST("api/vedio/history")
@POST("api/vedioV1/history")
Observable<BaseResponse<BannerList>> history();
/**
* 提交视频信息
*/
@POST("api/vedio/reportIndex")
@POST("api/vedioV1/reportIndex")
Observable<BaseResponse<Object>> reportIndex(@Body Map<String, Object> vo);
/**
* 推荐
*/
@POST("api/vedio/autoList")
@POST("api/vedioV1/autoList")
Observable<BaseResponse<BannerList>> autoList();
/**
* 穿山甲上传剧集
*/
@POST("api/vedio/initCsj")
@POST("api/vedioV1/initCsj")
Observable<BaseResponse<Object>> commitCsjShotInfo(@Body Map<String, Object> vo);
/**
* 推荐
*/
@POST("api/vedio/firstVedio")
@POST("api/vedioV1/firstVedio")
Observable<BaseResponse<IndexList>> getSoltVedio();
/**
* 匹配推荐
*/
@POST("api/vedio/vedio3Msg")
@POST("api/vedioV1/vedio3Msg")
Observable<BaseResponse<RecoBean>> getRecommendVedio();
/**
* 9宫格信息
*/
@POST("api/vedio/getTurnConfig")
@POST("api/vedioV1/getTurnConfig")
Observable<BaseResponse<NineListBean>> getTurnConfig();
/**
* 9宫格抽奖
*/
@POST("api/vedio/toTurn")
@POST("api/vedioV1/toTurn")
Observable<BaseResponse<NineListBean.NineBean>> toTurn();
/**
* 是否展示9宫格
*/
@POST("api/vedio/showTurn")
@POST("api/vedioV1/showTurn")
Observable<BaseResponse<NineShowBean>> showTurn();
/**
* 获取推荐状态
*/
@POST("api/vedio/showVedio4")
@POST("api/vedioV1/showVedio4")
Observable<BaseResponse<JsonObject>> firstShowVedio();
/**
* 推荐banner
*/
@POST("api/vedio/vedio4Msg")
@POST("api/vedioV1/vedio4Msg")
Observable<BaseResponse<RecommendBannerList>> vedio4Msg(@Body Map<String, Object> vo);
/**
* Vip尊享剧场
*/
@POST("api/vedio/vedio4List")
@POST("api/vedioV1/vedio4List")
Observable<BaseResponse<BannerList>> vedio4List(@Body Map<String, Object> vo);
/**
......
......@@ -134,7 +134,7 @@ class MainFragment : LazyLoadBaseFragment(), HomeView, View.OnClickListener, OnR
homePresenter.topTabs()
homePresenter.orders()
TrackManager.getInstance().getMyInfo()
showRecommendAct()
// showRecommendAct()
}
}
}
......@@ -379,11 +379,21 @@ class MainFragment : LazyLoadBaseFragment(), HomeView, View.OnClickListener, OnR
override fun onHiddenChanged(hidden: Boolean) {
super.onHiddenChanged(hidden)
if (isHidden) {
vpAdapter?.getFragments()?.get(mSelectTabIndex)?.onPause()
} else {
vpAdapter?.getFragments()?.get(mSelectTabIndex)?.onResume()
}
// if (isHidden) {
// vpAdapter?.getFragments()?.get(mSelectTabIndex)?.onPause()
// } else {
// vpAdapter?.getFragments()?.get(mSelectTabIndex)?.onResume()
// }
}
override fun onFragmentResume(firstResume: Boolean) {
super.onFragmentResume(firstResume)
vpAdapter?.getFragments()?.get(mSelectTabIndex)?.onResume()
}
override fun onPause() {
super.onPause()
vpAdapter?.getFragments()?.get(mSelectTabIndex)?.onPause()
}
/**
......
......@@ -87,16 +87,13 @@ class TxVideoAdapter : BaseMultiItemQuickAdapter<VideoMultiItemEntity, BaseViewH
if (it.isRecommendVedio) { // 推荐剧集逻辑
if (holder.adapterPosition < it.unlockIndex) { // 观看激励视频解锁
vipBtn.visibility = View.GONE
adBtn.visibility = View.VISIBLE
holder.getView<TextView>(R.id.tv_title).text = String.format(
"解锁%s·第%d集",
it.title,
holder.adapterPosition + 1
)
holder.getView<TextView>(R.id.tv_info).text = String.format(
"看激励视频解锁1集剧情\n请按照顺序解锁"
)
adBtn.visibility = View.GONE
vipBtn.visibility = View.VISIBLE
holder.getView<TextView>(R.id.tv_info).visibility = View.GONE
vipBtn.setBackgroundResource(R.mipmap.bg_detail_bottom_vip)
holder.getView<TextView>(R.id.tv_title).text =
String.format("解锁%s·全集", it.title)
} else { // 开通会员解锁
adBtn.visibility = View.GONE
vipBtn.visibility = View.VISIBLE
......@@ -108,18 +105,13 @@ class TxVideoAdapter : BaseMultiItemQuickAdapter<VideoMultiItemEntity, BaseViewH
}
} else {
adBtn.visibility = View.VISIBLE
holder.getView<TextView>(R.id.tv_title).text = String.format(
"解锁%s·第%d-%d集",
it.title,
it.unlockIndex + 1,
it.unlockIndex + it.adGiveVedioNum
)
holder.getView<TextView>(R.id.tv_info).text = String.format(
"看激励视频解锁%d集剧情\n请按照顺序解锁",
it.adGiveVedioNum
)
adBtn.visibility = View.GONE
vipBtn.visibility = View.VISIBLE
holder.getView<TextView>(R.id.tv_info).visibility = View.GONE
vipBtn.setBackgroundResource(R.mipmap.bg_detail_bottom_vip)
holder.getView<TextView>(R.id.tv_title).text =
String.format("解锁%s·全集", it.title)
}
holder.getView<TextView>(R.id.unlock).text = String.format("查看激励视频")
holder.getView<View>(R.id.unlock).setOnClickListener { it2 ->
......
......@@ -59,16 +59,13 @@ class NewTxVideoAdapter : BaseMultiItemQuickAdapter<VideoMultiItemEntity4, BaseV
vedioBean?.let {
when (type) {
VEDIO3DOS_AD -> { // 观看激励视频解锁
vipBtn.visibility = View.GONE
adBtn.visibility = View.VISIBLE
holder.getView<TextView>(R.id.tv_title).text = String.format(
"解锁%s·第%d集",
it.title,
holder.adapterPosition + 1
)
holder.getView<TextView>(R.id.tv_info).text = String.format(
"看激励视频解锁1集剧情\n请按照顺序解锁"
)
adBtn.visibility = View.GONE
vipBtn.visibility = View.VISIBLE
holder.getView<TextView>(R.id.tv_info).visibility = View.GONE
vipBtn.setBackgroundResource(R.mipmap.bg_detail_bottom_vip)
holder.getView<TextView>(R.id.tv_title).text =
String.format("解锁%s·全集", it.title)
}
VEDIO3DOS_PAY -> { // 开通会员解锁
adBtn.visibility = View.GONE
......@@ -80,18 +77,13 @@ class NewTxVideoAdapter : BaseMultiItemQuickAdapter<VideoMultiItemEntity4, BaseV
String.format("解锁%s·全集", it.title)
}
else -> {
adBtn.visibility = View.VISIBLE
holder.getView<TextView>(R.id.tv_title).text = String.format(
"解锁%s·第%d-%d集",
it.title,
it.unlockIndex + 1,
it.unlockIndex + it.adGiveVedioNum
)
holder.getView<TextView>(R.id.tv_info).text = String.format(
"看激励视频解锁%d集剧情\n请按照顺序解锁",
it.adGiveVedioNum
)
adBtn.visibility = View.GONE
vipBtn.visibility = View.VISIBLE
holder.getView<TextView>(R.id.tv_info).visibility = View.GONE
vipBtn.setBackgroundResource(R.mipmap.bg_detail_bottom_vip)
holder.getView<TextView>(R.id.tv_title).text =
String.format("解锁%s·全集", it.title)
}
}
......
......@@ -44,6 +44,7 @@
android:textStyle="bold" />
<TextView
android:visibility="invisible"
android:id="@+id/tv_info"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
......@@ -52,6 +53,7 @@
android:text="试看已结束" />
<Button
android:visibility="invisible"
android:id="@+id/unlock"
android:layout_width="230dp"
android:layout_height="40dp"
......
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