Commit 525cffb2 authored by mengcuiguang2's avatar mengcuiguang2

代码优化

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