添加活动功能
This commit is contained in:
parent
59c3217f38
commit
dcb8bd924f
|
|
@ -135,7 +135,7 @@
|
|||
android:name=".act.ForGetPwdActivity"
|
||||
android:screenOrientation="portrait" />
|
||||
<activity
|
||||
android:name=".act.activityActivity"
|
||||
android:name=".act.ActivityActivity"
|
||||
android:screenOrientation="portrait" />
|
||||
<activity
|
||||
android:name=".act.LossPreventionActivity"
|
||||
|
|
|
|||
|
|
@ -0,0 +1,233 @@
|
|||
package com.yingmao.clash.act
|
||||
|
||||
import android.content.ClipData
|
||||
import android.content.ClipboardManager
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.graphics.Color
|
||||
import android.net.Uri
|
||||
import android.os.Bundle
|
||||
import android.view.View
|
||||
import android.widget.TextView
|
||||
import androidx.lifecycle.ViewModelProvider
|
||||
import androidx.recyclerview.widget.LinearLayoutManager
|
||||
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout
|
||||
import com.afollestad.materialdialogs.MaterialDialog
|
||||
import com.afollestad.materialdialogs.customview.customView
|
||||
import com.afollestad.materialdialogs.customview.getCustomView
|
||||
import com.chad.library.adapter.base.BaseQuickAdapter
|
||||
import com.chad.library.adapter.base.listener.OnItemChildClickListener
|
||||
import com.chad.library.adapter.base.listener.OnItemClickListener
|
||||
import com.tencent.mmkv.MMKV
|
||||
import com.yingmao.clash.BuildConfig
|
||||
import com.yingmao.clash.R
|
||||
import com.yingmao.clash.app.MainApplication
|
||||
import com.yingmao.clash.base.BaseActivity
|
||||
import com.yingmao.clash.common.log.Log
|
||||
import com.yingmao.clash.conf.BZYConstants
|
||||
import com.yingmao.clash.listener.MyAdapterListener
|
||||
import com.yingmao.clash.net.http.HttpReqType
|
||||
import com.yingmao.clash.net.http.HttpStatus
|
||||
import com.yingmao.clash.net.http.entity.Activity_
|
||||
import com.yingmao.clash.net.http.entity.GetActivityRsp
|
||||
|
||||
import com.yingmao.clash.view.RxToast
|
||||
import com.yingmao.clash.view.adapter.GetActivityAdapter
|
||||
|
||||
class ActivityActivity : BaseActivity() {
|
||||
private lateinit var activityAtyVM: ActivityAtyVM
|
||||
private lateinit var swipeLayout: SwipeRefreshLayout
|
||||
private lateinit var expensesRecordRv: RecyclerView
|
||||
private lateinit var getActivityAdapter: GetActivityAdapter
|
||||
private val mPageInfo = PageInfo()
|
||||
|
||||
companion object {
|
||||
}
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
setContentView(R.layout.layout_activity_activity)
|
||||
showTitleBar("活动")
|
||||
|
||||
activityAtyVM = ViewModelProvider(this).get(ActivityAtyVM::class.java)
|
||||
observe(this, activityAtyVM)
|
||||
initView()
|
||||
initAdapter()
|
||||
initRefreshLayout()
|
||||
initLoadMore()
|
||||
}
|
||||
|
||||
private fun initView() {
|
||||
swipeLayout = findViewById(R.id.swipeLayout)
|
||||
expensesRecordRv = findViewById(R.id.rv_expenses_record)
|
||||
expensesRecordRv.layoutManager = LinearLayoutManager(this)
|
||||
}
|
||||
|
||||
private fun initAdapter() {
|
||||
getActivityAdapter =
|
||||
GetActivityAdapter(R.layout.get_activity_item_layout, object : MyAdapterListener {
|
||||
override fun onMyItemChildClickListener(itemBean: Activity_) {
|
||||
showActDialog(itemBean)
|
||||
}
|
||||
|
||||
})
|
||||
getActivityAdapter.animationEnable = true
|
||||
expensesRecordRv.adapter = getActivityAdapter
|
||||
|
||||
}
|
||||
|
||||
private fun showActDialog(bean: Activity_) {
|
||||
|
||||
if (bean.vipRule == 1) {
|
||||
checkExpire();
|
||||
}
|
||||
var command = MMKV.defaultMMKV().decodeString(BZYConstants.MMKV_KEY_VPN_UserCommand, "")!!
|
||||
command = "领会员${command}"
|
||||
copyToClipboard(command)
|
||||
var act_dialog = MaterialDialog(this@ActivityActivity).show {
|
||||
this.cancelable(false)
|
||||
cornerRadius(res = R.dimen.dp_10)
|
||||
customView(
|
||||
R.layout.act_dialog_layout,
|
||||
scrollable = false,
|
||||
noVerticalPadding = true,
|
||||
horizontalPadding = false
|
||||
)
|
||||
getCustomView().findViewById<TextView>(R.id.tv_pay_finish).setOnClickListener {
|
||||
goLink(bean.redirectLink);
|
||||
dismiss()
|
||||
}
|
||||
getCustomView().findViewById<TextView>(R.id.tv_pay_cancle).setOnClickListener {
|
||||
dismiss()
|
||||
}
|
||||
getCustomView().findViewById<TextView>(R.id.act_dia_title).text = bean.title
|
||||
getCustomView().findViewById<TextView>(R.id.tv_act_info).text = bean.content
|
||||
getCustomView().findViewById<TextView>(R.id.tv_act_tz).text =
|
||||
"跳转链接: " + bean.redirectLink
|
||||
getCustomView().findViewById<TextView>(R.id.tv_act_com).text =
|
||||
"口令: " + command + " (已复制,加群后发送)"
|
||||
}
|
||||
}
|
||||
|
||||
private fun checkExpire(): Boolean {
|
||||
val validPeriod = MMKV.defaultMMKV().decodeLong(BZYConstants.MMKV_KEY_VPN_VALID_PERIOD)
|
||||
if (validPeriod > 0) {
|
||||
var nowTime = System.currentTimeMillis();
|
||||
com.yingmao.clash.common.log.Log.d("validPeriod==>$validPeriod, nowTime==>$nowTime")
|
||||
if (validPeriod >= nowTime) {
|
||||
return false
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
private fun goLink(url: String) {
|
||||
var uri = Uri.parse(url)
|
||||
val intent = Intent(Intent.ACTION_VIEW)
|
||||
intent.setData(uri)
|
||||
startActivity(intent)
|
||||
}
|
||||
|
||||
private fun copyToClipboard(text: String) {
|
||||
val clipboard = getSystemService(Context.CLIPBOARD_SERVICE) as ClipboardManager
|
||||
val clip = ClipData.newPlainText("label", text)
|
||||
clipboard.setPrimaryClip(clip)
|
||||
|
||||
}
|
||||
|
||||
private fun initRefreshLayout() {
|
||||
swipeLayout.setColorSchemeColors(Color.rgb(47, 223, 189))
|
||||
swipeLayout.setOnRefreshListener {
|
||||
refresh()
|
||||
}
|
||||
}
|
||||
|
||||
private fun initLoadMore() {
|
||||
getActivityAdapter.loadMoreModule.setOnLoadMoreListener {
|
||||
loadMore()
|
||||
}
|
||||
getActivityAdapter.loadMoreModule.isAutoLoadMore = true
|
||||
getActivityAdapter.loadMoreModule.isEnableLoadMoreIfNotFullPage = false
|
||||
}
|
||||
|
||||
override fun onStart() {
|
||||
super.onStart()
|
||||
refresh()
|
||||
}
|
||||
|
||||
private fun refresh() {
|
||||
// 这里的作用是防止下拉刷新的时候还可以上拉加载
|
||||
getActivityAdapter.loadMoreModule.isEnableLoadMore = false
|
||||
// 下拉刷新,需要重置页数
|
||||
mPageInfo.reset()
|
||||
loadMore()
|
||||
}
|
||||
|
||||
|
||||
private fun loadMore() {
|
||||
activityAtyVM.getActivity(mPageInfo)
|
||||
}
|
||||
|
||||
override fun httpLoading(httpStatus: HttpStatus.Loading) {
|
||||
if (httpStatus.reqType == HttpReqType.GetActivity) {
|
||||
if (mPageInfo.isFirstPage) {
|
||||
swipeLayout.isRefreshing = true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun httpSuccess(httpStatus: HttpStatus.Success) {
|
||||
if (httpStatus.reqType == HttpReqType.GetActivity) {
|
||||
if (mPageInfo.isFirstPage) {
|
||||
swipeLayout.isRefreshing = false
|
||||
}
|
||||
getActivityAdapter.loadMoreModule.isEnableLoadMore = true
|
||||
if (httpStatus.rsp is GetActivityRsp) {
|
||||
(httpStatus.rsp as GetActivityRsp).let { getActivityRsp ->
|
||||
if (getActivityRsp.code == 200) {
|
||||
if (getActivityRsp.data != null) {
|
||||
val expensesRecordList = getActivityRsp.data.data?.list
|
||||
if (!expensesRecordList.isNullOrEmpty()) {
|
||||
if (mPageInfo.isFirstPage) {
|
||||
getActivityAdapter.data = expensesRecordList
|
||||
} else {
|
||||
getActivityAdapter.addData(expensesRecordList)
|
||||
}
|
||||
mPageInfo.nextPage()
|
||||
if (expensesRecordList.size < 5) {
|
||||
//如果不够一页,显示没有更多数据布局
|
||||
getActivityAdapter.loadMoreModule.loadMoreEnd()
|
||||
// RxToast.info("没有更多数据了")
|
||||
} else {
|
||||
getActivityAdapter.loadMoreModule.loadMoreComplete()
|
||||
}
|
||||
} else {
|
||||
//如果不够一页,显示没有更多数据布局
|
||||
getActivityAdapter.loadMoreModule.loadMoreEnd()
|
||||
// RxToast.info("没有更多数据了")
|
||||
}
|
||||
} else {
|
||||
getActivityAdapter.loadMoreModule.loadMoreComplete()
|
||||
}
|
||||
|
||||
} else {
|
||||
RxToast.error("${getActivityRsp.code}${getActivityRsp.message}")
|
||||
getActivityAdapter.loadMoreModule.loadMoreFail()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun httpFailure(httpStatus: HttpStatus.Failure) {
|
||||
if (httpStatus.reqType == HttpReqType.GetActivity) {
|
||||
if (mPageInfo.isFirstPage) {
|
||||
swipeLayout.isRefreshing = true
|
||||
}
|
||||
RxToast.error("获取订单信息异常")
|
||||
getActivityAdapter.loadMoreModule.loadMoreFail()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,26 @@
|
|||
package com.yingmao.clash.act
|
||||
|
||||
import com.tencent.mmkv.MMKV
|
||||
import com.yingmao.clash.base.PublicViewMode
|
||||
import com.yingmao.clash.conf.BZYConstants
|
||||
import com.yingmao.clash.net.http.HttpApi
|
||||
import com.yingmao.clash.net.http.HttpReqType
|
||||
import com.yingmao.clash.net.http.NetService
|
||||
|
||||
class ActivityAtyVM : PublicViewMode() {
|
||||
|
||||
fun getActivity(mPageInfo: PageInfo) {
|
||||
val httpApi = NetService.instances.createHttps(HttpApi::class.java)
|
||||
val username =
|
||||
MMKV.defaultMMKV().decodeString(BZYConstants.MMKV_KEY_REMEMBER_USERNAME, "")!!
|
||||
val phToken = MMKV.defaultMMKV().decodeString(BZYConstants.MMKV_KEY_PH_TOKEN, "")!!
|
||||
val params = hashMapOf(
|
||||
"phoneNumber" to username,
|
||||
"phToken" to phToken,
|
||||
"pageNum" to "${mPageInfo.page}",
|
||||
"pageSize" to "5",
|
||||
"clientTypeArray" to "1"
|
||||
)
|
||||
doAsync(HttpReqType.GetActivity) { httpApi.getActivity(params) }
|
||||
}
|
||||
}
|
||||
|
|
@ -491,17 +491,17 @@ class NewMainActivity : BaseActivity() {
|
|||
containerVP.offscreenPageLimit = 1
|
||||
if (fragments.isNotEmpty()) fragments.clear()
|
||||
fragments.add(NewAccFragment())
|
||||
fragments.add(RechargeFragment())
|
||||
// fragments.add(RechargeFragment())
|
||||
containerVP.adapter = MainVPAdapter(fragments, supportFragmentManager, lifecycle)
|
||||
containerVP.isUserInputEnabled = false
|
||||
var aniAct=findViewById<LottieAnimationView>(R.id.lottie_activity)
|
||||
aniAct.setAnimation(R.raw.activity)
|
||||
aniAct.playAnimation()
|
||||
aniAct.setOnClickListener {
|
||||
startActivity(Intent(CommonUtils.getApp(), activityActivity::class.java))
|
||||
startActivity(Intent(CommonUtils.getApp(), ActivityActivity::class.java))
|
||||
}
|
||||
findViewById<LinearLayout>(R.id.ll_activity).setOnClickListener {
|
||||
startActivity(Intent(CommonUtils.getApp(), activityActivity::class.java))
|
||||
startActivity(Intent(CommonUtils.getApp(), ActivityActivity::class.java))
|
||||
}
|
||||
setSometion()
|
||||
}
|
||||
|
|
@ -511,6 +511,7 @@ class NewMainActivity : BaseActivity() {
|
|||
MMKV.defaultMMKV().removeValueForKey(BZYConstants.MMKV_KEY_TOKEN)
|
||||
MMKV.defaultMMKV().removeValueForKey(BZYConstants.MMKV_KEY_CURRENT_NODE)
|
||||
MMKV.defaultMMKV().removeValueForKey(BZYConstants.NODE_SELECTED_NAME_KEY)
|
||||
MMKV.defaultMMKV().removeValueForKey(BZYConstants.MMKV_KEY_VPN_UserCommand)
|
||||
startActivity(Intent(CommonUtils.getApp(), LoginActivity::class.java))
|
||||
Log.d("cleanUserInfo clashRunning==>${clashRunning}")
|
||||
if (clashRunning) {
|
||||
|
|
@ -680,8 +681,6 @@ class NewMainActivity : BaseActivity() {
|
|||
}
|
||||
|
||||
private fun showPayResultDialog() {
|
||||
|
||||
|
||||
checkPayResultDia = MaterialDialog(this).show {
|
||||
this.cancelable(false)
|
||||
cornerRadius(res = R.dimen.dp_10)
|
||||
|
|
|
|||
|
|
@ -112,6 +112,10 @@ class SplashActivity : BaseActivity() {
|
|||
})
|
||||
}
|
||||
}
|
||||
|
||||
// val Sgtr= AESUtil.decrypt("DCBF7D3857DB252D9D07265D9EB7F2CF2DD5B6070C6BF6B4EC88A1452B8C30834BBC82465ECD117CAA816E18AF526EBA5749AFA0E504F7EE178912BAFAA308268326299157402233C4C3D7319B1843C680C340F137060762ED370DE8DDB5516A51DE118EE83C6C556B579D2C7B1612D98C64153D11334425298E096461A899DF")
|
||||
//
|
||||
// println("Sgtr==>$Sgtr")
|
||||
}
|
||||
|
||||
private fun checkPermission(): Boolean {
|
||||
|
|
@ -310,11 +314,9 @@ class SplashActivity : BaseActivity() {
|
|||
)
|
||||
splashAtyVM.login(encryName, encryPsw)
|
||||
} else if (code == "20062") {
|
||||
|
||||
message?.let {
|
||||
RxToast.error(it)
|
||||
}
|
||||
|
||||
// if (data != null) {
|
||||
//
|
||||
// var jo =
|
||||
|
|
@ -349,7 +351,7 @@ class SplashActivity : BaseActivity() {
|
|||
if (rsp is LoginRsp) {
|
||||
if (rsp.code == "1000") {
|
||||
val mmkv = MMKV.defaultMMKV()
|
||||
com.yingmao.clash.common.log.Log.i(" HttpReqType.LOGIN token ==> ${rsp.data?.vpnToken}")
|
||||
com.yingmao.clash.common.log.Log.i(" HttpReqType.LOGIN token ==> ${rsp.data?.vpnToken}")
|
||||
mmkv.encode(BZYConstants.MMKV_KEY_TOKEN, rsp.data?.vpnToken)
|
||||
mmkv.encode(BZYConstants.MMKV_KEY_PH_TOKEN, rsp.data?.phToken)
|
||||
mmkv.encode(BZYConstants.MMKV_KEY_USER_ID, rsp.data?.userId)
|
||||
|
|
@ -381,6 +383,7 @@ class SplashActivity : BaseActivity() {
|
|||
if (checkLoginRsp.code == 0) {
|
||||
val expired = checkLoginRsp.data?.expired
|
||||
val isPerfect = checkLoginRsp.data?.isPerfect
|
||||
val userCommand = checkLoginRsp.data?.userCommand
|
||||
val mmkv = MMKV.defaultMMKV()
|
||||
mmkv.encode(BZYConstants.MMKV_KEY_VPN_EXPIRED, expired ?: true)
|
||||
mmkv.encode(
|
||||
|
|
@ -388,6 +391,7 @@ class SplashActivity : BaseActivity() {
|
|||
checkLoginRsp.data?.vpnExpireTime ?: 0
|
||||
)
|
||||
mmkv.encode(BZYConstants.MMKV_KEY_IS_PERFECT, isPerfect ?: true)
|
||||
mmkv.encode(BZYConstants.MMKV_KEY_VPN_UserCommand, userCommand ?: "")
|
||||
toMainPage()
|
||||
} else {
|
||||
toLoginPage()
|
||||
|
|
|
|||
|
|
@ -1,150 +0,0 @@
|
|||
package com.yingmao.clash.act
|
||||
|
||||
import android.app.Activity
|
||||
import android.app.Application
|
||||
import android.content.Intent
|
||||
import android.graphics.Color
|
||||
import android.os.Bundle
|
||||
|
||||
import androidx.lifecycle.ViewModelProvider
|
||||
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout
|
||||
import com.yingmao.clash.R
|
||||
import com.yingmao.clash.app.MainApplication
|
||||
import com.yingmao.clash.base.BaseActivity
|
||||
import com.yingmao.clash.net.http.HttpReqType
|
||||
import com.yingmao.clash.net.http.HttpStatus
|
||||
import com.yingmao.clash.net.http.entity.ExpensesRecordRsp
|
||||
import com.yingmao.clash.view.RxToast
|
||||
import com.yingmao.clash.view.adapter.ExpensesRecordAdapter
|
||||
|
||||
class activityActivity : BaseActivity() {
|
||||
private lateinit var expensesRecordVM :ExpensesRecordVM
|
||||
private lateinit var swipeLayout : SwipeRefreshLayout
|
||||
private lateinit var expensesRecordRv : RecyclerView
|
||||
private lateinit var expensesRecordAdapter : ExpensesRecordAdapter
|
||||
private val mPageInfo = PageInfo()
|
||||
|
||||
companion object{
|
||||
}
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
setContentView(R.layout.layout_activity_activity)
|
||||
showTitleBar("活动")
|
||||
initView()
|
||||
// initAdapter()
|
||||
// initRefreshLayout()
|
||||
// initLoadMore()
|
||||
|
||||
}
|
||||
|
||||
private fun initView() {
|
||||
|
||||
}
|
||||
|
||||
private fun initAdapter() {
|
||||
expensesRecordAdapter = ExpensesRecordAdapter()
|
||||
expensesRecordAdapter.animationEnable = true
|
||||
expensesRecordRv.adapter = expensesRecordAdapter
|
||||
}
|
||||
|
||||
private fun initRefreshLayout() {
|
||||
swipeLayout.setColorSchemeColors(Color.rgb(47, 223, 189))
|
||||
swipeLayout.setOnRefreshListener {
|
||||
refresh()
|
||||
}
|
||||
}
|
||||
|
||||
private fun initLoadMore() {
|
||||
expensesRecordAdapter.loadMoreModule.setOnLoadMoreListener {
|
||||
loadMore()
|
||||
}
|
||||
expensesRecordAdapter.loadMoreModule.isAutoLoadMore = true
|
||||
expensesRecordAdapter.loadMoreModule.isEnableLoadMoreIfNotFullPage = false
|
||||
}
|
||||
|
||||
override fun onStart() {
|
||||
super.onStart()
|
||||
// 进入页面,刷新数据
|
||||
loadFirstPage()
|
||||
}
|
||||
|
||||
|
||||
private fun refresh() {
|
||||
// 这里的作用是防止下拉刷新的时候还可以上拉加载
|
||||
expensesRecordAdapter.loadMoreModule.isEnableLoadMore = false
|
||||
// 下拉刷新,需要重置页数
|
||||
mPageInfo.reset()
|
||||
loadFirstPage()
|
||||
}
|
||||
|
||||
private fun loadFirstPage() {
|
||||
// expensesRecordVM.getExpensesRecord(mPageInfo)
|
||||
}
|
||||
|
||||
private fun loadMore() {
|
||||
expensesRecordVM.getExpensesRecord(mPageInfo)
|
||||
}
|
||||
|
||||
override fun httpLoading(httpStatus: HttpStatus.Loading) {
|
||||
if(httpStatus.reqType == HttpReqType.EXPENSES_RECORD){
|
||||
if(mPageInfo.isFirstPage) {
|
||||
swipeLayout.isRefreshing = true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun httpSuccess(httpStatus: HttpStatus.Success) {
|
||||
if(httpStatus.reqType == HttpReqType.EXPENSES_RECORD){
|
||||
if(mPageInfo.isFirstPage) {
|
||||
swipeLayout.isRefreshing = false
|
||||
}
|
||||
expensesRecordAdapter.loadMoreModule.isEnableLoadMore = true
|
||||
if(httpStatus.rsp is ExpensesRecordRsp){
|
||||
(httpStatus.rsp as ExpensesRecordRsp).let { expensesRecordRsp ->
|
||||
if(expensesRecordRsp.code == "1000"){
|
||||
if(expensesRecordRsp.data != null){
|
||||
val expensesRecordList =expensesRecordRsp.data?.expensesRecords
|
||||
if(!expensesRecordList.isNullOrEmpty()){
|
||||
if(mPageInfo.isFirstPage) {
|
||||
expensesRecordAdapter.data = expensesRecordList
|
||||
}else{
|
||||
expensesRecordAdapter.addData(expensesRecordList)
|
||||
}
|
||||
mPageInfo.nextPage()
|
||||
if (expensesRecordList.size < 5) {
|
||||
//如果不够一页,显示没有更多数据布局
|
||||
expensesRecordAdapter.loadMoreModule.loadMoreEnd()
|
||||
// RxToast.info("没有更多数据了")
|
||||
} else {
|
||||
expensesRecordAdapter.loadMoreModule.loadMoreComplete()
|
||||
}
|
||||
}else{
|
||||
//如果不够一页,显示没有更多数据布局
|
||||
expensesRecordAdapter.loadMoreModule.loadMoreEnd()
|
||||
// RxToast.info("没有更多数据了")
|
||||
}
|
||||
}else{
|
||||
expensesRecordAdapter.loadMoreModule.loadMoreComplete()
|
||||
}
|
||||
|
||||
}else {
|
||||
RxToast.error("${expensesRecordRsp.code}${expensesRecordRsp.message}")
|
||||
expensesRecordAdapter.loadMoreModule.loadMoreFail()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun httpFailure(httpStatus: HttpStatus.Failure) {
|
||||
if(httpStatus.reqType == HttpReqType.EXPENSES_RECORD){
|
||||
if(mPageInfo.isFirstPage) {
|
||||
swipeLayout.isRefreshing = true
|
||||
}
|
||||
RxToast.error("获取订单信息异常")
|
||||
expensesRecordAdapter.loadMoreModule.loadMoreFail()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -40,6 +40,8 @@ class BZYConstants {
|
|||
//vpn是否过期
|
||||
const val MMKV_KEY_VPN_EXPIRED = "expired"
|
||||
|
||||
const val MMKV_KEY_VPN_UserCommand = "userCommand"
|
||||
|
||||
//vpn过期时间
|
||||
const val MMKV_KEY_VPN_VALID_PERIOD = "vpn_valid_period"
|
||||
|
||||
|
|
|
|||
|
|
@ -76,6 +76,9 @@ data class UserData(
|
|||
@field:SerializedName("vpnServerToken")
|
||||
val vpnServerToken: String? = null,
|
||||
|
||||
@field:SerializedName("userCommand")
|
||||
val userCommand: String? = null,
|
||||
|
||||
@field:SerializedName("intervalTime")
|
||||
val intervalTime: Int? = null,
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,9 @@
|
|||
package com.yingmao.clash.listener
|
||||
|
||||
import com.yingmao.clash.net.http.entity.Activity_
|
||||
|
||||
interface MyAdapterListener {
|
||||
|
||||
|
||||
fun onMyItemChildClickListener(itemBean:Activity_);
|
||||
}
|
||||
|
|
@ -22,6 +22,7 @@ import com.yingmao.clash.net.http.entity.WXPayRsp
|
|||
import com.tencent.mmkv.MMKV
|
||||
import com.yingmao.clash.conf.BZYConstants
|
||||
import com.yingmao.clash.net.http.entity.AppVersionCheckRsp
|
||||
import com.yingmao.clash.net.http.entity.GetActivityRsp
|
||||
import com.yingmao.clash.net.http.entity.LoginRsp2
|
||||
import com.yingmao.clash.net.http.entity.RegisterRspOld
|
||||
import com.yingmao.clash.net.http.entity.SendSmsRsp
|
||||
|
|
@ -463,4 +464,16 @@ interface HttpApi {
|
|||
BZYConstants.MMKV_KEY_TOKEN
|
||||
).toString()
|
||||
): VipSignRsp
|
||||
|
||||
//会员签到
|
||||
@Headers(
|
||||
"User-Agent: Octopus_Android"
|
||||
)
|
||||
@POST("/netbarcloud/vpn/getActivity")
|
||||
suspend fun getActivity(
|
||||
@QueryMap params: Map<String, String>,
|
||||
@Header("token") string: String = MMKV.defaultMMKV().decodeString(
|
||||
BZYConstants.MMKV_KEY_TOKEN
|
||||
).toString()
|
||||
): GetActivityRsp
|
||||
}
|
||||
|
|
@ -44,6 +44,7 @@ enum class HttpReqType(type: Int) {
|
|||
PwdSMSCode(40),
|
||||
VIPSIGN(41),
|
||||
Get_Node_Other(42),
|
||||
GetActivity(43)
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -53,9 +53,9 @@ class NetService private constructor() : INetService {
|
|||
val hh = if (!BuildConfig.is_back_cn) {
|
||||
// "https://app.bazhuayujiasu.cc:18001"
|
||||
// "https://api.gaogaoshousoft.cc:18001"
|
||||
// "https://api.yingmaovpn.win:18002"
|
||||
MMKV.defaultMMKV()
|
||||
.decodeString(BZYConstants.MMKV_KEY_CURRENT_HOST, BuildConfig.service_url)!!
|
||||
// "https://api.yingmaovpnpro.win:18002"
|
||||
// "http://113.108.210.50:21002"
|
||||
MMKV.defaultMMKV().decodeString(BZYConstants.MMKV_KEY_CURRENT_HOST, BuildConfig.service_url)!!
|
||||
// MMKV.defaultMMKV().decodeString(BZYConstants.MMKV_KEY_CURRENT_HOST, "https://app.bazhuayujiasu.cc:18001")
|
||||
} else {
|
||||
BuildConfig.service_url
|
||||
|
|
|
|||
|
|
@ -0,0 +1,52 @@
|
|||
package com.yingmao.clash.net.http.entity
|
||||
|
||||
import com.google.gson.annotations.SerializedName
|
||||
|
||||
data class GetActivityRsp(
|
||||
@SerializedName("code") val code: Int,
|
||||
@SerializedName("message") val message: String,
|
||||
@SerializedName("data") val data: ActivityDataWrapper
|
||||
)
|
||||
|
||||
data class ActivityDataWrapper(
|
||||
@SerializedName("data") val data: ActivityData
|
||||
)
|
||||
|
||||
data class ActivityData(
|
||||
@SerializedName("total") val total: Int,
|
||||
@SerializedName("list") val list: MutableList<Activity_>,
|
||||
@SerializedName("pageNum") val pageNum: Int,
|
||||
@SerializedName("pageSize") val pageSize: Int,
|
||||
@SerializedName("size") val size: Int,
|
||||
@SerializedName("startRow") val startRow: Int,
|
||||
@SerializedName("endRow") val endRow: Int,
|
||||
@SerializedName("pages") val pages: Int,
|
||||
@SerializedName("prePage") val prePage: Int,
|
||||
@SerializedName("nextPage") val nextPage: Int,
|
||||
@SerializedName("isFirstPage") val isFirstPage: Boolean,
|
||||
@SerializedName("isLastPage") val isLastPage: Boolean,
|
||||
@SerializedName("hasPreviousPage") val hasPreviousPage: Boolean,
|
||||
@SerializedName("hasNextPage") val hasNextPage: Boolean,
|
||||
@SerializedName("navigatePages") val navigatePages: Int,
|
||||
@SerializedName("navigatepageNums") val navigatepageNums: List<Int>,
|
||||
@SerializedName("navigateFirstPage") val navigateFirstPage: Int,
|
||||
@SerializedName("navigateLastPage") val navigateLastPage: Int,
|
||||
@SerializedName("lastPage") val lastPage: Int,
|
||||
@SerializedName("firstPage") val firstPage: Int
|
||||
)
|
||||
|
||||
data class Activity_(
|
||||
@SerializedName("id") val id: Int,
|
||||
@SerializedName("title") val title: String,
|
||||
@SerializedName("content") val content: String,
|
||||
@SerializedName("awardDay") val awardDay: Int,
|
||||
@SerializedName("vipRule") val vipRule: Int,
|
||||
@SerializedName("status") val status: Int,
|
||||
@SerializedName("redirectLink") val redirectLink: String,
|
||||
@SerializedName("copyContent") val copyContent: String,
|
||||
@SerializedName("clientType") val clientType: String,
|
||||
@SerializedName("clientTypeArray") val clientTypeArray: Any?,
|
||||
@SerializedName("startTime") val startTime: String?,
|
||||
@SerializedName("endTime") val endTime: String?,
|
||||
@SerializedName("createTime") val createTime: String
|
||||
)
|
||||
|
|
@ -0,0 +1,43 @@
|
|||
package com.yingmao.clash.view.adapter
|
||||
|
||||
|
||||
import android.widget.TextView
|
||||
import com.afollestad.materialdialogs.MaterialDialog
|
||||
import com.afollestad.materialdialogs.customview.customView
|
||||
import com.afollestad.materialdialogs.customview.getCustomView
|
||||
import com.chad.library.adapter.base.BaseQuickAdapter
|
||||
import com.chad.library.adapter.base.module.LoadMoreModule
|
||||
import com.chad.library.adapter.base.viewholder.BaseViewHolder
|
||||
import com.tencent.mmkv.MMKV
|
||||
import com.yingmao.clash.R
|
||||
import com.yingmao.clash.app.MainApplication
|
||||
import com.yingmao.clash.common.log.Log
|
||||
import com.yingmao.clash.conf.BZYConstants
|
||||
import com.yingmao.clash.conf.PayType
|
||||
import com.yingmao.clash.listener.MyAdapterListener
|
||||
import com.yingmao.clash.net.http.entity.Activity_
|
||||
|
||||
|
||||
class GetActivityAdapter(
|
||||
layoutResId: Int = R.layout.get_activity_item_layout,
|
||||
private val listener: MyAdapterListener
|
||||
) :
|
||||
BaseQuickAdapter<Activity_, BaseViewHolder>(
|
||||
layoutResId
|
||||
), LoadMoreModule {
|
||||
override fun convert(holder: BaseViewHolder, item: Activity_) {
|
||||
holder.setText(R.id.tv_act_title, "${item.title}")
|
||||
holder.setText(R.id.tv_act_info, "活动内容:${item.content}")
|
||||
|
||||
holder.setText(R.id.tv_act_gift, "奖励时间:${item.awardDay} 天")
|
||||
|
||||
|
||||
holder.itemView.setOnClickListener {
|
||||
|
||||
listener.onMyItemChildClickListener(item)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,97 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@drawable/recharge_user_info_bg"
|
||||
android:gravity="center"
|
||||
|
||||
android:orientation="vertical">
|
||||
|
||||
|
||||
<TextView
|
||||
android:id="@+id/act_dia_title"
|
||||
android:textStyle="bold"
|
||||
android:gravity="center"
|
||||
android:textSize="18sp"
|
||||
android:textColor="@color/white"
|
||||
android:text="活动标题"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="30dp"
|
||||
android:layout_marginBottom="20dp" />
|
||||
|
||||
<LinearLayout
|
||||
android:orientation="vertical"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_act_info"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="20dp"
|
||||
|
||||
android:gravity="center"
|
||||
android:paddingTop="@dimen/dp_10"
|
||||
android:text="活动内容"
|
||||
android:textColor="@color/white" />
|
||||
<TextView
|
||||
android:id="@+id/tv_act_tz"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="20dp"
|
||||
android:textStyle="bold"
|
||||
android:gravity="center"
|
||||
android:paddingTop="@dimen/dp_10"
|
||||
android:text="跳转链接"
|
||||
android:textColor="@color/white" />
|
||||
<TextView
|
||||
android:id="@+id/tv_act_com"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="20dp"
|
||||
android:gravity="center"
|
||||
android:paddingTop="@dimen/dp_10"
|
||||
android:text="口令:xxx 已复制"
|
||||
android:textColor="@color/white" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="@dimen/dp_10"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_pay_cancle"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="20dp"
|
||||
android:layout_weight="1"
|
||||
android:background="@drawable/cancel_btn_bg_selector"
|
||||
android:gravity="center"
|
||||
android:paddingLeft="20dp"
|
||||
android:paddingTop="@dimen/dp_10"
|
||||
android:paddingRight="20dp"
|
||||
android:paddingBottom="@dimen/dp_10"
|
||||
android:text="关闭"
|
||||
android:textColor="@color/white" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_pay_finish"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="50dp"
|
||||
android:layout_marginBottom="20dp"
|
||||
android:layout_weight="1"
|
||||
android:background="@drawable/cancel_btn_bg_selector"
|
||||
android:gravity="center"
|
||||
android:paddingLeft="20dp"
|
||||
android:paddingTop="@dimen/dp_10"
|
||||
android:paddingRight="20dp"
|
||||
android:paddingBottom="@dimen/dp_10"
|
||||
android:text="跳转"
|
||||
android:textColor="@color/white" />
|
||||
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
|
|
@ -0,0 +1,42 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="8dp"
|
||||
android:background="@drawable/mine_frg_info_bg"
|
||||
android:paddingStart="16dp"
|
||||
android:paddingTop="16dp">
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
<TextView
|
||||
android:id="@+id/tv_act_title"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="活动名称"
|
||||
android:textColor="@color/yellow"
|
||||
android:textSize="16sp" />
|
||||
<TextView
|
||||
android:id="@+id/tv_act_info"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
|
||||
android:layout_marginTop="19dp"
|
||||
android:text="活动内容"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="14sp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_act_gift"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
|
||||
android:layout_marginTop="12dp"
|
||||
android:layout_marginBottom="20dp"
|
||||
android:text="奖励时间"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="14sp" />
|
||||
</LinearLayout>
|
||||
</RelativeLayout>
|
||||
|
|
@ -7,10 +7,10 @@
|
|||
<certificates src="user" />
|
||||
</trust-anchors>
|
||||
</base-config>
|
||||
<!-- <domain-config cleartextTrafficPermitted="true"-->
|
||||
<!-- tools:ignore="NetworkSecurityConfig">-->
|
||||
<!-- <domain includeSubdomains="true">58.55.123.165</domain>-->
|
||||
<domain-config cleartextTrafficPermitted="true"
|
||||
tools:ignore="NetworkSecurityConfig">
|
||||
<domain includeSubdomains="true">113.108.210.50</domain>
|
||||
<!-- <domain includeSubdomains="true">test.otcopusapp.cc</domain>-->
|
||||
<!-- </domain-config>-->
|
||||
</domain-config>
|
||||
</network-security-config>
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue