Commit bd2cabc6 authored by mengcuiguang's avatar mengcuiguang

添加首页签约入口

parent ef8cd6d4
......@@ -208,16 +208,6 @@ class SettingsActivity : BaseActivity(), View.OnClickListener {
Handler(Looper.getMainLooper()).postDelayed({
finish()
}, 200)
// UcropUtils.clipData(address)
// ToastUtil.show(this@SettingsActivity, "邮箱已经复制到您的剪切板上!")
//
// val uri = Uri.parse("mailto:$address")
// val data = Intent(Intent.ACTION_SENDTO, uri)
// data.putExtra(Intent.EXTRA_EMAIL, address)
// data.putExtra(Intent.EXTRA_SUBJECT, "申请注销账户")
// data.putExtra(Intent.EXTRA_TEXT, "申请注销账户ID:\n申请注销账户微信号:\n申请注销账户手机号:\n")
// startActivity(Intent.createChooser(data, "选择邮箱"))
}
})
}
......
package com.duben.xixiplayletu.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.xixiplayletu.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.xixiplayletu.MintsApplication
import com.duben.xixiplayletu.manager.AppHttpManager
import com.duben.xixiplayletu.ui.activitys.*
import com.duben.xixiplayletu.ui.widgets.DialogListener
import com.duben.xixiplayletu.ui.widgets.DialogUtils
import com.duben.xixiplayletu.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,9 +206,80 @@ 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)
}
})
}
private fun loadData() {
Timer().schedule(200) {
......@@ -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
)
}
}
......@@ -208,8 +317,8 @@ class MainFragment : LazyLoadBaseFragment(), HomeView, View.OnClickListener, OnR
override fun onItemClick(position: Int) {
if (topList.size > 0) {
LocalVedioManager.startVedioDetailActivityForType(
requireActivity(),
topList[position]
requireActivity(),
topList[position]
)
}
}
......@@ -278,9 +387,9 @@ class MainFragment : LazyLoadBaseFragment(), HomeView, View.OnClickListener, OnR
val cacheVedio = LocalVedioManager.getCacheVedio()
if (cacheVedio != null) {
GlideUtils.loadImageViewGifForCenterCrop(
requireContext(),
cacheVedio.coverImage,
iv_main_watching_pic
requireContext(),
cacheVedio.coverImage,
iv_main_watching_pic
)
tv_main_watching_name.text = cacheVedio.title
tv_main_watching_text1.text = "上次观看至第${cacheVedio.seeIndex}集"
......@@ -317,22 +426,22 @@ class MainFragment : LazyLoadBaseFragment(), HomeView, View.OnClickListener, OnR
}
banner.addBannerLifecycleObserver(this)
.setAdapter(ImageTitleAdapter(bannerList))
.setOnBannerListener { data2, position ->
val banner = data.list.get(position)
if (banner.createType == 4) {
// 九宫格
val bundle = Bundle()
bundle.putBoolean(NineActivity.IS_AD_SHOW, true)
readyGo(NineActivity::class.java, bundle)
} else {
LocalVedioManager.startVedioDetailActivityForType(
requireActivity(),
banner
)
}
.setAdapter(ImageTitleAdapter(bannerList))
.setOnBannerListener { data2, position ->
val banner = data.list.get(position)
if (banner.createType == 4) {
// 九宫格
val bundle = Bundle()
bundle.putBoolean(NineActivity.IS_AD_SHOW, true)
readyGo(NineActivity::class.java, bundle)
} else {
LocalVedioManager.startVedioDetailActivityForType(
requireActivity(),
banner
)
}
}
}
}
......@@ -380,16 +489,16 @@ class MainFragment : LazyLoadBaseFragment(), HomeView, View.OnClickListener, OnR
val need = data.need
if (complete >= need) {
tv_lucky_status.text = SpanUtils()
.append("可领取")
.setForegroundColor(resources.getColor(R.color.apk_uninstalled))
.create()
.append("可领取")
.setForegroundColor(resources.getColor(R.color.apk_uninstalled))
.create()
} else {
tv_lucky_status.text = SpanUtils()
.append(complete.toString())
.setForegroundColor(resources.getColor(R.color.red))
.append("/")
.append(need.toString())
.create()
.append(complete.toString())
.setForegroundColor(resources.getColor(R.color.red))
.append("/")
.append(need.toString())
.create()
}
}
......@@ -423,7 +532,7 @@ class MainFragment : LazyLoadBaseFragment(), HomeView, View.OnClickListener, OnR
if (UserManager.getInstance().newFlag && !UserManager.getInstance().vipFlag) {
// 1、第一次打开app并关闭付费页进首页时出现一次
val mainFirstRecommend =
AppPreferencesManager.get().getBoolean(Constant.MAIN_FIRST_RECOMMEND, false)
AppPreferencesManager.get().getBoolean(Constant.MAIN_FIRST_RECOMMEND, false)
if (!mainFirstRecommend) {
if (AppConfig.enterVipAct) {
AppConfig.enterVipAct = false
......
......@@ -243,6 +243,17 @@
</RelativeLayout>
</LinearLayout>
<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" />
<ImageView
android:id="@+id/iv_kefu_main"
android:layout_width="80dp"
......
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