描述:

1.启动页背景图文字
2.支付item新增UI
3.启动页背景使用网络图片
This commit is contained in:
level 2025-04-03 15:48:01 +08:00
parent 8711f3a1b4
commit 83b36d8e62
23 changed files with 261 additions and 108 deletions

View File

@ -55,6 +55,7 @@ class LoginActivity : BaseActivity(), View.OnClickListener {
private lateinit var loginUserName: String
private var username_encrypt = ""
private var password_encrypt = ""
private var user_oaid = ""
private var registerHost = ""
private var kefuHost = ""
@ -170,7 +171,7 @@ class LoginActivity : BaseActivity(), View.OnClickListener {
var currentHost = MMKV.defaultMMKV()
.decodeString(BZYConstants.MMKV_KEY_CURRENT_HOST, "")
// com.cncat.vpn.common.log.Log.d("tryButton CHECK_LOGIN currentHost==>${currentHost}")
loginViewMode.login(username_encrypt, password_encrypt)
loginViewMode.login(username_encrypt, password_encrypt,user_oaid)
}
override fun cancel() {
@ -445,12 +446,16 @@ class LoginActivity : BaseActivity(), View.OnClickListener {
password_encrypt = AESUtil.byteArrayToHexStr(
AESUtil.encrypt(password)
)
Log.d("OALD","OAID.....::"+MainApplication.OAID)
user_oaid=AESUtil.byteArrayToHexStr(
AESUtil.encrypt(MainApplication.OAID)
)
loginUserName = username
if (!userAgreementCB.isChecked) {
RxToast.warning(resources.getString(R.string.ReadAgreement))
return
}
loginViewMode.login(username_encrypt, password_encrypt)
loginViewMode.login(username_encrypt, password_encrypt,user_oaid)
}
R.id.tv_register -> {

View File

@ -39,6 +39,7 @@ import com.yingmao.clash.net.http.HttpReqType
import com.yingmao.clash.net.http.HttpStatus
import com.yingmao.clash.net.http.entity.Grade
import com.yingmao.clash.net.http.entity.PayRsp
import com.yingmao.clash.net.http.entity.RechargeInfo
import com.yingmao.clash.net.http.entity.RechargeInfoRsp
import com.yingmao.clash.net.http.entity.Trade
import com.yingmao.clash.util.CommonUtils
@ -256,12 +257,8 @@ class MemberRechargeActivity: BaseActivity() {
if (it.code != "1000") {
RxToast.error(if (it.message.isNullOrBlank())resources.getString(R.string.FailedRechargeList)+ "${it.code}" else "${it.code}:${it.message}")
} else {
it.data?.let { it1 ->
it1.grade?.let {
if (it.size > 0) {
initAdapter(it)
}
}
it.data?.let { rechargeInfo ->
initAdapter(rechargeInfo)
}
}
}
@ -393,8 +390,7 @@ class MemberRechargeActivity: BaseActivity() {
rxDialogShapeLoading.cancel()
}
}
private fun initAdapter(recharge: MutableList<Grade>) {
Log.i("dataInfo::${recharge.size}")
private fun initAdapter(recharge: RechargeInfo) {
val rechargeListAdapter = VIPRechargeAdapter()
rvRechargeList.layoutManager =GridLayoutManager(CommonUtils.getApp(), 2, GridLayoutManager.VERTICAL, false)
rechargeListAdapter.setCloudServiceList(recharge,this@MemberRechargeActivity)

View File

@ -3,6 +3,8 @@ package com.yingmao.clash.act
import android.Manifest
import android.content.Intent
import android.content.pm.PackageManager
import android.graphics.Bitmap
import android.graphics.drawable.BitmapDrawable
import android.net.Uri
import android.os.Build
import android.os.Bundle
@ -10,6 +12,7 @@ import android.provider.Settings
import android.util.Log
import android.view.View
import android.view.WindowManager
import android.widget.RelativeLayout
import android.widget.Toast
import androidx.annotation.RequiresApi
import androidx.core.app.ActivityCompat
@ -17,6 +20,9 @@ import androidx.core.content.ContextCompat
import androidx.lifecycle.ViewModelProvider
import com.afollestad.materialdialogs.MaterialDialog
import com.afollestad.materialdialogs.customview.customView
import com.bumptech.glide.Glide
import com.bumptech.glide.request.target.SimpleTarget
import com.bumptech.glide.request.transition.Transition
import com.google.gson.JsonObject
import com.orhanobut.logger.Logger
import com.tencent.mmkv.MMKV
@ -39,6 +45,7 @@ import com.yingmao.clash.net.http.entity.RegisterRsp
import com.cncat.vpn.service.ClashManager
import com.cncat.vpn.service.remote.IClashManager
import com.cncat.vpn.service.remote.wrap
import com.yingmao.clash.net.http.entity.StartingBeans
import com.yingmao.clash.util.AESUtil
import com.yingmao.clash.util.Utils
import com.yingmao.clash.view.RxToast
@ -60,6 +67,7 @@ class SplashActivity : BaseActivity() {
private lateinit var rlPb: View
private lateinit var ll_action: View
private lateinit var username: String
private lateinit var rlMain: RelativeLayout
private lateinit var splashAtyVM: SplashAtyVM
private var registerKey = ""
@ -78,6 +86,8 @@ class SplashActivity : BaseActivity() {
splashAtyVM = ViewModelProvider(this).get(SplashAtyVM::class.java)
observe(this, splashAtyVM)
setContentView(R.layout.layout_splash_activity)
rlMain=findViewById(R.id.rlMain)
rlPb = findViewById(R.id.rl_pb)
ll_action = findViewById(R.id.ll_action)
serStore.isYM = BuildConfig.is_ym
@ -133,8 +143,8 @@ class SplashActivity : BaseActivity() {
// com.cncat.vpn.common.log.Log.d("onOAIDGetComplete result==>${ DeviceIdentifier.getOAID(this)}")
//获取配置背景
splashAtyVM.getSplashBg()
var clashBinder = MainApplication.getApp()?.let {
ClashManager(it).wrap() as IClashManager
}
@ -626,6 +636,31 @@ class SplashActivity : BaseActivity() {
}
}
}
HttpReqType.SplashBg->{
val startingBeans = httpStatus.rsp as StartingBeans
startingBeans.data
if(startingBeans.data!=null){
if(startingBeans.data!!.exist){
Log.d("SplashActivityStarting","startingBeans.data!!.img::"+ startingBeans.data!!.img)
startingBeans.data!!.img.let {
Glide.with(this).asBitmap()
.load(startingBeans.data!!.img)
.into(object :SimpleTarget<Bitmap>(){
override fun onResourceReady(
resource: Bitmap,
transition: Transition<in Bitmap>?
) {
val bitmapDrawable = BitmapDrawable(resource)
rlMain.setBackgroundDrawable(bitmapDrawable)
}
})
}
}
}
}
else -> {}
}

View File

@ -11,11 +11,11 @@ import androidx.recyclerview.widget.RecyclerView
import com.cncat.vpn.common.log.Log
import com.yingmao.clash.R
import com.yingmao.clash.net.http.entity.Grade
import com.yingmao.clash.net.http.entity.RechargeInfo
class VIPRechargeAdapter : RecyclerView.Adapter<VIPRechargeAdapter.VIPRechargeViewHolder>() {
private var selectorPosition = 0
private var vipList = mutableListOf<Grade>()
private lateinit var rechargeInfo: RechargeInfo
//设置回调监听
private var listener: VIPRechargeItemClickListener? = null
private var context: Context? = null
@ -26,8 +26,8 @@ class VIPRechargeAdapter : RecyclerView.Adapter<VIPRechargeAdapter.VIPRechargeVi
}
//设置显示的数据
fun setCloudServiceList(bgList: List<Grade>, context: Context) {
this.vipList = bgList.toMutableList()
fun setCloudServiceList(rechargeInfo: RechargeInfo, context: Context) {
this.rechargeInfo = rechargeInfo
this.context = context
}
@ -36,6 +36,8 @@ class VIPRechargeAdapter : RecyclerView.Adapter<VIPRechargeAdapter.VIPRechargeVi
val tvDayTxt: TextView = itemView.findViewById(R.id.tvDayTxt)
val tvDayAverage: TextView = itemView.findViewById(R.id.tvDayAverage)
val tvDiscount: TextView = itemView.findViewById(R.id.tvDiscount)
val clRandomlySend: ConstraintLayout = itemView.findViewById(R.id.clRandomlySend)
val tvRandomlySend: TextView = itemView.findViewById(R.id.tvRandomlySend)
}
@ -44,49 +46,69 @@ class VIPRechargeAdapter : RecyclerView.Adapter<VIPRechargeAdapter.VIPRechargeVi
.inflate(R.layout.vip_recharge_list_item_layout, parent, false)
)
override fun getItemCount() = vipList.size
// override fun getItemCount() = rechargeInfo.grade?.size
override fun getItemCount(): Int {
if(rechargeInfo.grade!=null){
return rechargeInfo.grade!!.size
}
return 0
}
@SuppressLint("NotifyDataSetChanged", "SetTextI18n")
override fun onBindViewHolder(holder: VIPRechargeViewHolder, @SuppressLint("RecyclerView") position: Int) {
holder.tvDayAverage.text="${vipList[position].amount}"
if(vipList[position].days!=null){
holder.tvDiscount.text=""+context!!.resources.getString(R.string.Discount).replace("$","${vipList[position].monthlyAmount}")
if(context!=null){
when(vipList[position].days){
30->{
holder.tvDayTxt.text=context!!.resources.getString(R.string.price30)
}
90->{
holder.tvDayTxt.text=context!!.resources.getString(R.string.price90)
}
180->{
holder.tvDayTxt.text=context!!.resources.getString(R.string.price180)
}
365->{
holder.tvDayTxt.text=context!!.resources.getString(R.string.price365)
}
else->{
holder.tvDayTxt.text="${vipList[position].days}"+ context!!.resources.getString(R.string.day)
}
}
}
if(rechargeInfo.grade!=null){
holder.tvDayAverage.text="${rechargeInfo.grade!![position].amount}"
if(rechargeInfo.grade!![position].days!=null){
holder.tvDiscount.text=""+context!!.resources.getString(R.string.Discount).replace("$","${rechargeInfo.grade!![position].monthlyAmount}")
if(context!=null){
when(rechargeInfo.grade!![position].days){
30->{
holder.tvDayTxt.text=context!!.resources.getString(R.string.price30)
}
90->{
holder.tvDayTxt.text=context!!.resources.getString(R.string.price90)
}
180->{
holder.tvDayTxt.text=context!!.resources.getString(R.string.price180)
}
365->{
holder.tvDayTxt.text=context!!.resources.getString(R.string.price365)
}
else->{
holder.tvDayTxt.text="${rechargeInfo.grade!![position].days}"+ context!!.resources.getString(R.string.day)
}
}
}
}
if(selectorPosition == position){
holder.rechargeItemRl.isSelected = true
if(selectorPosition==0){
listener?.onItemClick(vipList[position])
}
}else{
holder.rechargeItemRl.isSelected = false
}
holder.rechargeItemRl.setOnClickListener {
Log.i("TESSS position:${position}")
listener?.onItemClick(vipList[position])
selectorPosition=position
notifyDataSetChanged()
}
}
if(selectorPosition == position){
holder.rechargeItemRl.isSelected = true
if(selectorPosition==0){
listener?.onItemClick(rechargeInfo.grade!![position])
}
}else{
holder.rechargeItemRl.isSelected = false
}
holder.rechargeItemRl.setOnClickListener {
Log.i("TESSS position:${position}")
listener?.onItemClick(rechargeInfo.grade!![position])
selectorPosition=position
notifyDataSetChanged()
}
if(rechargeInfo.grade!![position].giftDay!=null&&rechargeInfo.firstPayGiftDay!=null&&rechargeInfo.notFirstPayGiftDay!=null){
val giftDay =rechargeInfo.grade!![position].giftDay?:0
val firstPayGiftDay =rechargeInfo.firstPayGiftDay!!.toInt()
val notFirstPayGiftDay =rechargeInfo.notFirstPayGiftDay!!.toInt()
val totalGiftAmount=giftDay+firstPayGiftDay+notFirstPayGiftDay
if(totalGiftAmount>0){
holder.clRandomlySend.visibility=View.VISIBLE
holder.tvRandomlySend.text=context!!.resources.getString(R.string.GiveawayDay).replace("$","$totalGiftAmount")
}else{
holder.clRandomlySend.visibility=View.GONE
}
}
}
}
/*

View File

@ -28,6 +28,7 @@ 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.SendSmsRsp
import com.yingmao.clash.net.http.entity.StartingBeans
import com.yingmao.clash.net.http.entity.UploadParamData
import com.yingmao.clash.net.http.entity.VipSignRsp
import okhttp3.RequestBody
@ -48,6 +49,11 @@ interface HttpApi {
@POST("/netbarcloud/vpn/phLogin.do")
suspend fun login(@QueryMap params: Map<String, String>): LoginRsp
@Headers(
"User-Agent: Octopus_Android"
)
@GET("/netbarcloud/open/startImg")
suspend fun splashBg(): StartingBeans
@Headers(
"User-Agent: Octopus_Android"
)

View File

@ -52,4 +52,5 @@ enum class HttpReqType(type: Int) {
AppStartupStatus(48),
AppUpStatus(49),
AppStopStatus(50),
SplashBg(51)
}

View File

@ -67,7 +67,14 @@ data class RechargeInfo(
val templateId: Int? = null,
@field:SerializedName("userId")
val userId: String? = null
val userId: String? = null,
//首充赠送天数
@field:SerializedName("firstPayGiftDay")
val firstPayGiftDay: String? = null,
//非首充赠送天数
@field:SerializedName("notFirstPayGiftDay")
val notFirstPayGiftDay: String? = null,
){
override fun toString(): String {
return "RechargeInfo(gradeList=$grade, customizedProduct=$customizedProduct, id=$id, templateId=$templateId, userId=$userId)"
@ -133,6 +140,10 @@ data class Grade(
@field:SerializedName("days")
val days: Int? = null,
//额外赠送天数
@field:SerializedName("giftDay")
val giftDay: Int? = null,
@field:SerializedName("startTime")
val startTime: String? = null,

View File

@ -0,0 +1,18 @@
package com.yingmao.clash.net.http.entity
import com.google.gson.annotations.SerializedName
data class StartingBeans(
@field:SerializedName("code")
var code: String? = null,
@field:SerializedName("data")
var data: StartingBg?=null,
@field:SerializedName("message")
var message: String? = null
)
data class StartingBg(
@field:SerializedName("exist")
var exist: Boolean = false,
@field:SerializedName("img")
var img: String? = null,
)

View File

@ -27,9 +27,8 @@ import retrofit2.Callback
import retrofit2.Response
class LoginAtyVM : PublicViewMode() {
fun login(username: String, password: String) {
fun login(username: String, password: String,oaid:String) {
Log.d("login.....")
android.util.Log.d("OALD","OAID.....::"+MainApplication.OAID)
var imei = ""
/* MainApplication.getApp()?.let {
imei = AESUtil.getSubscriberId(it)
@ -49,7 +48,7 @@ class LoginAtyVM : PublicViewMode() {
// "imsi" to imsi,
// "mac" to mac!!,
"idfa" to "",
"oaid" to MainApplication.OAID
"oaid" to oaid
)
Log.d("login params==>${params}")
val httpApi = NetService.instances.createHttps(HttpApi::class.java)

View File

@ -96,4 +96,8 @@ class SplashAtyVM : PublicViewMode() {
val httpApi = NetService.instances.createHttps(HttpApi::class.java)
doAsync(HttpReqType.LOGIN) { httpApi.login(params) }
}
fun getSplashBg() {
val httpApi = NetService.instances.createHttps(HttpApi::class.java)
doAsync(HttpReqType.SplashBg) { httpApi.splashBg() }
}
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 87 KiB

After

Width:  |  Height:  |  Size: 78 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 37 KiB

After

Width:  |  Height:  |  Size: 32 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 140 KiB

After

Width:  |  Height:  |  Size: 127 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 302 KiB

After

Width:  |  Height:  |  Size: 277 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 523 KiB

After

Width:  |  Height:  |  Size: 487 KiB

View File

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<ripple xmlns:android="http://schemas.android.com/apk/res/android"
android:color="#BFD5D5D5" >
<item>
<shape>
<solid android:color="#FFA433"/>
<corners android:radius="10dp"/>
</shape>
</item>
</ripple>

View File

@ -5,6 +5,7 @@
android:layout_height="match_parent"
android:background="@drawable/splash_background"
tools:context=".act.SplashActivity"
android:id="@+id/rlMain"
>
<RelativeLayout
android:layout_width="match_parent"

View File

@ -6,62 +6,103 @@
android:layout_height="wrap_content"
android:layout_margin="5dp">
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/rl_recharge_item"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent"
android:background="@drawable/setting_pay_things"
>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent"
android:orientation="vertical"
android:layout_marginTop="20dp"
android:layout_marginBottom="20dp"
android:layout_marginStart="49dp"
android:layout_marginEnd="49dp"
app:layout_constraintBottom_toBottomOf="parent"
>
<TextView
android:id="@+id/tvDayTxt"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@color/blue_4072FE"
android:textSize="21sp"
android:textStyle="bold"
android:layout_gravity="center"
android:gravity="center"
/>
<TextView
android:id="@+id/tvDayAverage"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@color/orange_FF991A"
android:text="¥36.8"
android:textSize="21sp"
android:layout_gravity="center"
android:layout_marginTop="5dp"
android:gravity="center"
/>
<TextView
android:id="@+id/tvDiscount"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@color/gray_828282"
android:text="¥36.8/月"
android:textSize="14sp"
android:layout_marginTop="5dp"
android:layout_gravity="center"
android:gravity="center"
android:drawablePadding="@dimen/dp_10"
/>
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/rl_recharge_item"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent"
android:background="@drawable/setting_pay_things"
android:layout_marginTop="@dimen/dp_10"
>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent"
android:orientation="vertical"
android:layout_marginTop="20dp"
android:layout_marginBottom="20dp"
android:layout_marginStart="49dp"
android:layout_marginEnd="49dp"
app:layout_constraintBottom_toBottomOf="parent"
>
<TextView
android:id="@+id/tvDayTxt"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@color/blue_4072FE"
android:textSize="21sp"
android:textStyle="bold"
android:layout_gravity="center"
android:gravity="center"
/>
<TextView
android:id="@+id/tvDayAverage"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@color/orange_FF991A"
android:text="¥36.8"
android:textSize="21sp"
android:layout_gravity="center"
android:layout_marginTop="5dp"
android:gravity="center"
/>
</LinearLayout>
<TextView
android:id="@+id/tvDiscount"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@color/gray_828282"
android:text="¥36.8/月"
android:textSize="14sp"
android:layout_marginTop="5dp"
android:layout_gravity="center"
android:gravity="center"
android:drawablePadding="@dimen/dp_10"
/>
</LinearLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/clRandomlySend"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:background="@drawable/pay_title_bg"
android:visibility="visible"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
android:layout_marginStart="30dp"
android:layout_marginEnd="30dp"
>
<TextView
android:id="@+id/tvRandomlySend"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:padding="5dp"
android:gravity="center"
android:text="随机送3-20天"
android:textColor="@color/white"
android:textSize="12sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@ -342,4 +342,5 @@ Service Description\n
<string name="Update">Update</string>
<string name="TimeOver">Free time has ended\nPlease recharge</string>
<string name="GORecharge">Go to recharge</string>
<string name="GiveawayDay">Randomly send $ days</string>
</resources>

View File

@ -332,4 +332,5 @@
<string name="Update">更新</string>
<string name="TimeOver">免費時長已結束\n請充值使用</string>
<string name="GORecharge">去充值</string>
<string name="GiveawayDay">隨機送$天</string>
</resources>

View File

@ -331,4 +331,5 @@
<string name="Update">更新</string>
<string name="TimeOver">免費時長已結束\n請充值使用</string>
<string name="GORecharge">去充值</string>
<string name="GiveawayDay">隨機送$天</string>
</resources>

View File

@ -348,4 +348,5 @@
<string name="Update">更新</string>
<string name="TimeOver">免费时长已结束\n请充值使用</string>
<string name="GORecharge">去充值</string>
<string name="GiveawayDay">随机送$天</string>
</resources>

View File

@ -27,7 +27,7 @@
</style>
<style name="SplashTheme" parent="Theme.MaterialComponents.DayNight.NoActionBar">
<item name="android:windowBackground">@drawable/splash_background</item>
<!-- <item name="android:windowBackground">@drawable/splash_background</item>-->
</style>
<style name="MyTranslucentTheme" parent="Theme.AppCompat.Light.NoActionBar">