Commit d809c8ce authored by jyx's avatar jyx

代码优化

parent e9c5156c
......@@ -4,4 +4,7 @@ seeds.txt
unused.txt
priguardMapping.txt
/facai
/smartclean
\ No newline at end of file
/huawei
/oppo
/xiaomi
/vivo
\ No newline at end of file
......@@ -9,15 +9,17 @@ import android.os.Bundle
import android.os.Handler
import android.os.Looper
import android.text.TextUtils
import android.util.Log
import android.view.KeyEvent
import android.view.View
import android.widget.CompoundButton
import androidx.recyclerview.widget.GridLayoutManager
import android.widget.LinearLayout
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
import com.alipay.sdk.app.OpenAuthTask
import com.daimajia.androidanimations.library.Techniques
import com.daimajia.androidanimations.library.YoYo
import com.duben.library.utils.GlideUtils
import com.duben.library.utils.nodoubleclick.AntiShake
import com.duben.loveplayletu.BuildConfig
import com.duben.loveplayletu.R
import com.duben.loveplayletu.common.AppConfig
......@@ -33,8 +35,6 @@ import com.duben.loveplayletu.ui.adapter.VipBannerAdapter
import com.duben.loveplayletu.ui.widgets.*
import com.duben.loveplayletu.ui.widgets.countdowntimer.CountDownTimerSupport
import com.duben.loveplayletu.ui.widgets.countdowntimer.OnCountDownTimerListener
import com.duben.library.utils.GlideUtils
import com.duben.library.utils.nodoubleclick.AntiShake
import com.duben.loveplayletu.utils.SpanUtils
import com.jobo.alipay.AliPay
import com.jobo.alipay.AlipayInfoImpl
......@@ -47,7 +47,7 @@ import com.tencent.mm.opensdk.openapi.IWXAPI
import com.tencent.mm.opensdk.openapi.WXAPIFactory
import com.youth.banner.listener.OnPageChangeListener
import kotlinx.android.synthetic.main.activity_new_vip.*
import java.net.URLDecoder
import kotlinx.android.synthetic.main.header_layout.*
import java.net.URLEncoder
......@@ -421,8 +421,9 @@ class VipActivity : BaseActivity(), VipView, View.OnClickListener,
private fun initRvView() {
if (vipList != null && vipList!!.size > 0) {
val gridLayoutManager = LinearLayoutManager(this)
rvVip.layoutManager = gridLayoutManager
val linearLayoutManager = LinearLayoutManager(this)
linearLayoutManager.orientation = LinearLayoutManager.HORIZONTAL
rvVip.layoutManager = linearLayoutManager
vipAdapter = VipAdapter(vipList!!)
rvVip.adapter = vipAdapter
vipAdapter.setOnItemClickListener(this)
......
......@@ -13,7 +13,7 @@ import com.duben.loveplayletu.mvp.model.VipBean
import com.duben.loveplayletu.utils.BubbleUtils
import com.duben.loveplayletu.utils.SpanUtils
class VipAdapter(val vipList: MutableList<VipBean.ListBean>) :
class VipAdapter(private val vipList: MutableList<VipBean.ListBean>) :
RecyclerView.Adapter<VipAdapter.ViewHolder>() {
var myPos: Int = 0
......@@ -22,8 +22,8 @@ class VipAdapter(val vipList: MutableList<VipBean.ListBean>) :
lateinit var mOnItemClickListener: OnItemClickListener
init {
if (vipList != null && vipList.size > 0) {
for (i in 0..vipList.size - 1) {
if (vipList.size > 0) {
for (i in 0 until vipList.size) {
if (vipList[i].activityType == 1) {
myPos = i
break
......@@ -105,13 +105,13 @@ class VipAdapter(val vipList: MutableList<VipBean.ListBean>) :
// holder.tvVipItemCurMoney.text = "¥${vipBean.price}"
//// holder.tvVipItemCurMoney.text = "¥${String.format("%.0f", vipBean.price)}"
// }
if(vipBean.price==0.0){
if (vipBean.price == 0.0) {
holder.tvVipItemCurMoney.text = SpanUtils()
.append("0.01")
.setFontSize(BubbleUtils.sp2px(34))
.append("元")
.create()
}else{
} else {
holder.tvVipItemCurMoney.text = SpanUtils()
.append(vipBean.price.toString())
.setFontSize(BubbleUtils.sp2px(34))
......
......@@ -47,11 +47,10 @@
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/rvVip"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_width="match_parent"
android:layout_height="200dp"
android:layout_gravity="center_horizontal"
android:background="@null"
android:overScrollMode="never" />
android:background="@color/color_2F155E" />
<LinearLayout
android:layout_width="match_parent"
......
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_width="200dp"
android:layout_marginLeft="20dp"
android:layout_marginRight="20dp"
android:layout_marginTop="10dp"
......
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