Commit 2bdc3af0 authored by 王雪伟's avatar 王雪伟

[提交人]:王雪伟

[提交简述] :1.1.3
[实现方案] :加入红包列表
parent e3a0a7be
package com.zxbw.modulemain.activity
import android.view.View
import androidx.recyclerview.widget.GridLayoutManager
import androidx.recyclerview.widget.LinearLayoutManager
import com.zxbw.modulemain.R
import com.zxbw.modulemain.adapter.RedEnvelopeListAdapter
import com.zxbw.modulemain.adapter.RedEnvelopeTopListAdapter
import com.zxhl.cms.common.base.BaseActivity
import com.zxhl.cms.utils.OnRecycleItemClickListener
import kotlinx.android.synthetic.main.activity_layout_grab_red_envelope.*
/**
* @author (wangXuewei)
* @datetime 2022-06-28 15:01 GMT+8
* @detail :
*/
class GrabRedEnvelopeActivity : BaseActivity() {
class GrabRedEnvelopeActivity : BaseActivity(),OnRecycleItemClickListener<Any> {
private var mRedEnvelopeAdapter: RedEnvelopeListAdapter? = null
private var mRedEnvelopeTopAdapter: RedEnvelopeTopListAdapter? = null
override fun layoutID(): Int = R.layout.activity_layout_grab_red_envelope
......@@ -18,6 +27,17 @@ class GrabRedEnvelopeActivity : BaseActivity() {
}
override fun init() {
mRedEnvelopeAdapter = RedEnvelopeListAdapter(this,this)
id_rcl_red_envelope_list.layoutManager = GridLayoutManager(this, 4)
id_rcl_red_envelope_list.adapter = mRedEnvelopeAdapter
mRedEnvelopeTopAdapter = RedEnvelopeTopListAdapter(this)
id_rcl_today_top_list.layoutManager = LinearLayoutManager(this)
id_rcl_today_top_list.adapter = mRedEnvelopeTopAdapter
}
override fun onItemClick(view: View?, position: Int, data: Any?) {
}
}
\ No newline at end of file
package com.zxbw.modulemain.activity
import android.content.Intent
import android.os.Handler
import android.text.TextUtils
import android.util.Log
import android.view.View
......
package com.zxbw.modulemain.adapter
import android.app.Activity
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.*
import androidx.recyclerview.widget.RecyclerView
import com.zxbw.modulemain.R
import com.zxhl.cms.AppContext
import com.zxhl.cms.common.base.BaseRecyclerAdapter
import com.zxhl.cms.utils.OnRecycleItemClickListener
class RedEnvelopeListAdapter : BaseRecyclerAdapter<Any, RedEnvelopeListAdapter.ViewHolder> {
private var mContext: Activity? = null
private val listener: OnRecycleItemClickListener<Any>
constructor(
content: Activity?,
listener: OnRecycleItemClickListener<Any>
) : super() {
mContext = content
this.listener = listener
}
override fun onBindViewHolder(holder: ViewHolder, position: Int) {
holder.id_ll_red_envelop_view?.setOnClickListener {
listener.onItemClick(it, position, null)
}
}
override fun getItemCount(): Int {
return 24
}
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ViewHolder {
return ViewHolder(
LayoutInflater.from(AppContext.get())
.inflate(R.layout.item_layout_red_envelope_view, parent, false)
)
}
class ViewHolder : RecyclerView.ViewHolder {
var id_ll_red_envelop_view: LinearLayout?
var id_tv_time: TextView?
var id_img_red_envelope_bg: ImageView?
constructor(
itemView: View
) : super(itemView) {
id_ll_red_envelop_view = itemView.findViewById<LinearLayout>(R.id.id_ll_red_envelop_view)
id_tv_time = itemView.findViewById<TextView>(R.id.id_tv_time)
id_img_red_envelope_bg = itemView.findViewById<ImageView>(R.id.id_img_red_envelope_bg)
}
}
}
\ No newline at end of file
package com.zxbw.modulemain.adapter
import android.app.Activity
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.*
import androidx.recyclerview.widget.RecyclerView
import com.zxbw.modulemain.R
import com.zxhl.cms.AppContext
import com.zxhl.cms.common.base.BaseRecyclerAdapter
import com.zxhl.cms.utils.OnRecycleItemClickListener
class RedEnvelopeTopListAdapter : BaseRecyclerAdapter<Any, RedEnvelopeTopListAdapter.ViewHolder> {
private var mContext: Activity? = null
constructor(
content: Activity?
) : super() {
mContext = content
}
override fun onBindViewHolder(holder: ViewHolder, position: Int) {
}
override fun getItemCount(): Int {
return 10
}
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ViewHolder {
return ViewHolder(
LayoutInflater.from(AppContext.get())
.inflate(R.layout.item_layout_red_envelope_top_user_view, parent, false)
)
}
class ViewHolder : RecyclerView.ViewHolder {
var id_ll_top_user_view: LinearLayout?
var id_tv_user_phone: TextView?
var id_tv_user_money: TextView?
var id_img_user_headimg: ImageView?
var id_img_top_icon: ImageView?
constructor(
itemView: View
) : super(itemView) {
id_ll_top_user_view =
itemView.findViewById<LinearLayout>(R.id.id_ll_top_user_view)
id_tv_user_phone = itemView.findViewById<TextView>(R.id.id_tv_user_phone)
id_tv_user_money = itemView.findViewById<TextView>(R.id.id_tv_user_money)
id_img_user_headimg = itemView.findViewById<ImageView>(R.id.id_img_user_headimg)
id_img_top_icon = itemView.findViewById<ImageView>(R.id.id_img_top_icon)
}
}
}
\ No newline at end of file
......@@ -128,7 +128,11 @@
android:layout_marginStart="12dp"
android:layout_marginTop="10dp"
android:layout_marginEnd="12dp"
android:background="@drawable/shape_white_r10" />
android:background="@drawable/shape_white_r10"
android:paddingLeft="11dp"
android:paddingTop="17dp"
android:paddingRight="11dp"
android:paddingBottom="15dp" />
<LinearLayout
......
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/id_ll_top_user_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="2dp"
android:gravity="center_vertical"
android:orientation="horizontal">
<ImageView
android:id="@+id/id_img_user_headimg"
android:layout_width="37dp"
android:layout_height="37dp"
android:layout_marginEnd="8dp"
android:src="@drawable/icon_user_photo_default" />
<ImageView
android:id="@+id/id_img_top_icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="10dp"
android:src="@drawable/icon_qhb_number1" />
<TextView
android:id="@+id/id_tv_user_phone"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="199******95"
android:textColor="@color/color_333333"
android:textSize="14sp" />
<TextView
android:id="@+id/id_tv_user_money"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="0.05元"
android:textColor="@color/color_333333"
android:textSize="14sp"
android:textStyle="bold" />
</LinearLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/id_ll_red_envelop_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="3dp"
android:layout_marginEnd="3dp"
android:layout_marginBottom="15dp"
android:background="@drawable/shape_ffffff_r5"
android:gravity="center_horizontal"
android:orientation="vertical">
<ImageView
android:id="@+id/id_img_red_envelope_bg"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:adjustViewBounds="true"
android:scaleType="fitXY"
android:src="@drawable/icon_qhb_laiwanle" />
<TextView
android:id="@+id/id_tv_time"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="周日"
android:layout_marginTop="4dp"
android:textColor="@color/color_666666"
android:textSize="12sp"
android:textStyle="bold" />
</LinearLayout>
\ No newline at end of file
......@@ -32,7 +32,7 @@ import com.zx.ad.utils.Utils
object AdManager {
private var TAG = "AdManager"
private var isLoadReward = false
private var isLoadFull = false
private var isLoadSplash = false
private var mLoading: LoadingDialog? = null
private fun showLoadIng(activity: Activity) {
activity.runOnUiThread {
......@@ -106,19 +106,26 @@ object AdManager {
if (context.isFinishing){
return
}
if (isLoadSplash) {
Log.d("AdManager", "Splash正在加载..")
return
} else {
isLoadSplash = true
}
ZXADClient.adApi.getAds(ADType.AD_SPLASH)
.compose(RxSchedulers.observableIO2Main())
.subscribe(object : BaseObserver<List<NewsEntity>?>() {
override fun onSuccess(result: List<NewsEntity>?) {
if (result.isNullOrEmpty()) {
isLoadSplash = false
listener.onError("loadSplashAd IS NULL")
} else {
LogUtils.d("loadSplashAd result:${result.size}")
loadingSplashAd(context, result, mSplashContainer, listener)
}
}
override fun onFailure(e: Throwable?, code: String?, errorMsg: String?) {
isLoadSplash = false
listener.onError("loadSplashAd Error code:${code} errorMsg:${errorMsg}")
}
})
......@@ -133,8 +140,10 @@ object AdManager {
var totalEntity = ArrayList<NewsEntity>()
totalEntity.add(result[0])
totalEntity.addAll(result[0].backups)
LogUtils.d("loadSplashAd totalEntity:${totalEntity.size}")
var callBack = object : AdLoadCallBack {
override fun OnAdLoadSuccess(platform: String, entity: NewsEntity) {
isLoadSplash = false
when (platform) {
ADType.PLATFORM_AD_TT -> {
CSJAdManager.showSplashAd(
......@@ -166,6 +175,7 @@ object AdManager {
override fun OnAdLoadFail(errorMsg: String?) {
LogUtils.e(errorMsg)
if (totalEntity.isNullOrEmpty()) {
isLoadSplash = false
listener.onError("loadFail end")
} else {
var entity = totalEntity[0];
......
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