Commit 8bdfa54c authored by jyx's avatar jyx

代码优化

parent 446cfee7
......@@ -10,8 +10,8 @@ android {
applicationId "com.duben.miaoquplayletu"
minSdkVersion rootProject.ext.androidMinSdkVersion
targetSdkVersion rootProject.ext.androidTargetSdkVersion
versionCode 721
versionName "7.2.1"
versionCode 722
versionName "7.2.2"
flavorDimensions "default"
// dex突破65535的限制
......
......@@ -3,6 +3,7 @@ package com.duben.miaoquplayletu.ui.activitys
import android.animation.ValueAnimator
import android.app.Dialog
import android.content.Intent
import android.graphics.Color
import android.net.Uri
import android.os.Bundle
import android.os.Handler
......@@ -207,6 +208,13 @@ class VipActivity : BaseActivity(), VipView, View.OnClickListener,
if (!TextUtils.isEmpty(bean.remarks)) {
tv_vip_hint.text = bean.remarks
tv_vip_hint.visibility = View.VISIBLE
if (bean.isShowCycTips) {
tv_vip_hint.setTextColor(Color.parseColor("#FFAC5E"))
tv_vip_hint.textSize = 12f
} else {
tv_vip_hint.setTextColor(Color.parseColor("#97ffffff"))
tv_vip_hint.textSize = 10f
}
} else {
tv_vip_hint.visibility = View.INVISIBLE
}
......
package com.duben.miaoquplayletu.ui.fragment
import android.app.Dialog
import android.content.Intent
import android.net.Uri
import android.os.Bundle
import android.os.Handler
import android.os.Looper
......@@ -11,6 +14,8 @@ import androidx.core.content.ContextCompat
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
import androidx.viewpager2.widget.ViewPager2
import com.duben.library.net.neterror.BaseSubscriber
import com.duben.library.net.neterror.Throwable
import com.google.android.material.tabs.TabLayout
import com.google.android.material.tabs.TabLayoutMediator
import com.scwang.smartrefresh.layout.api.RefreshLayout
......@@ -35,8 +40,16 @@ import com.duben.miaoquplayletu.utils.SpanUtils
import com.duben.library.utils.GlideUtils
import com.duben.library.utils.json.JsonUtil
import com.duben.library.utils.nodoubleclick.AntiShake
import com.duben.miaoquplayletu.MintsApplication
import com.duben.miaoquplayletu.manager.AppHttpManager
import com.duben.miaoquplayletu.ui.activitys.*
import com.duben.miaoquplayletu.ui.widgets.DialogListener
import com.duben.miaoquplayletu.ui.widgets.DialogUtils
import com.duben.miaoquplayletu.utils.ToastUtil
import com.google.gson.JsonObject
import kotlinx.android.synthetic.main.activity_order_record.*
import kotlinx.android.synthetic.main.fragment_main.*
import kotlinx.android.synthetic.main.header_layout.*
import java.lang.reflect.Field
import java.util.*
import kotlin.concurrent.schedule
......@@ -58,6 +71,7 @@ class MainFragment : LazyLoadBaseFragment(), HomeView, View.OnClickListener, OnR
private var vpAdapter: HomeVideoPageAdapter? = null
private var topAdapter: TopAdapter? = null
private var recommendVedioBean: RecoBean? = null
private var mAgreementDTO: OrderRecordBean.AgreementDTO? = null
private val homePresenter by lazy { HomePresenter() }
......@@ -135,13 +149,30 @@ class MainFragment : LazyLoadBaseFragment(), HomeView, View.OnClickListener, OnR
homePresenter.topTabs()
homePresenter.orders()
TrackManager.getInstance().getMyInfo()
getData()
// showRecommendAct()
}
AppConfig.showVipAdDialog=false
AppConfig.showVipAdDialog = false
}
}
private fun getData() {
AppHttpManager.getInstance(baseApplication)
.call(baseApplication.loanService.cashOutRecords,
object : BaseSubscriber<BaseResponse<OrderRecordBean>>() {
override fun onError(e: Throwable) {
}
override fun onNext(t: BaseResponse<OrderRecordBean>) {
if (t.status == 200) {
mAgreementDTO = t.data.agreement
}
}
})
}
override fun onFragmentPause() {
banner?.stop()
}
......@@ -152,6 +183,7 @@ class MainFragment : LazyLoadBaseFragment(), HomeView, View.OnClickListener, OnR
tv_main_watching_goto.setOnClickListener(this)
ll_lucky.setOnClickListener(this)
iv_kefu_main.setOnClickListener(this)
iv_sign_main.setOnClickListener(this)
}
override fun onClick(v: View?) {
......@@ -174,7 +206,78 @@ class MainFragment : LazyLoadBaseFragment(), HomeView, View.OnClickListener, OnR
R.id.iv_kefu_main -> {
(requireActivity() as MainActivity).backPhoneDialog()
}
R.id.iv_sign_main -> {
if (mAgreementDTO == null) {
showToast("暂未开通自动续费")
} else {
signDialog()
}
}
}
}
private fun signDialog() {
DialogUtils.showDialog(
requireActivity(),
SpanUtils()
.append("是否要取消签约?")
.setForegroundColor(
ContextCompat.getColor(
requireContext(),
R.color.tv_message_recente_money
)
)
.create(),
"提示",
"确定",
object : DialogListener() {
override fun onClick(dialog: Dialog?, v: View?) {
dialog?.dismiss()
unSign()
}
}, "返回", object : DialogListener() {
override fun onClick(dialog: Dialog?, v: View?) {
dialog?.dismiss()
}
})
}
private fun unSign() {
AppHttpManager.getInstance(baseApplication)
.call(baseApplication.loanService.unSign(),
object : BaseSubscriber<BaseResponse<JsonObject>>() {
override fun onError(e: Throwable) {}
override fun onNext(t: BaseResponse<JsonObject>) {
if (t.status == 200) {
kefuAccount()
}
}
})
}
private fun kefuAccount() {
DialogUtils.showDialog(
requireActivity(),
SpanUtils()
.append("如有问题请联系客服\n" +
"4000969950")
.setForegroundColor(ContextCompat.getColor(requireContext(), R.color.tv_message_recente_money))
.create(),
"提示",
"确定",
object : DialogListener() {
override fun onClick(dialog: Dialog?, v: View?) {
dialog?.dismiss()
val intent = Intent(Intent.ACTION_DIAL)
intent.data = Uri.parse("tel:" + "4000969950")
requireContext().startActivity(intent)
}
})
}
......@@ -195,6 +298,12 @@ class MainFragment : LazyLoadBaseFragment(), HomeView, View.OnClickListener, OnR
iv_kefu_main,
1
)
GlideUtils.loadImageViewGifForCenterCrop(
it,
"https://mints-pkg.oss-cn-beijing.aliyuncs.com/pkg/img/ic_main_nosign.png",
iv_sign_main,
1
)
}
}
......
......@@ -254,6 +254,17 @@
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent" />
<ImageView
android:id="@+id/iv_sign_main"
android:layout_width="80dp"
android:layout_height="88dp"
android:layout_marginEnd="5dp"
android:layout_marginBottom="170dp"
android:gravity="center"
android:orientation="vertical"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent" />
<LinearLayout
android:id="@+id/ll_lucky"
android:layout_width="wrap_content"
......
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