Commit 744dd84b authored by Li's avatar Li

[李俊岐] 优化每日福利

parent 65669fd8
...@@ -102,8 +102,8 @@ class GameActivity : UnityPlayerActivity(), IDialogViewCloseCallback { ...@@ -102,8 +102,8 @@ class GameActivity : UnityPlayerActivity(), IDialogViewCloseCallback {
} }
private fun checkUpdateApp() { private fun checkUpdateApp() {
val updateVersionManager = this?.let { it1 -> UpdateVersionManager(it1) } val updateVersionManager = UpdateVersionManager(this)
updateVersionManager?.checkUpdate(true) updateVersionManager?.checkUpdate(false)
} }
override fun onResume() { override fun onResume() {
......
...@@ -287,5 +287,6 @@ class WelfareActivity : BaseActivity(), WelfareContract.View, ...@@ -287,5 +287,6 @@ class WelfareActivity : BaseActivity(), WelfareContract.View,
override fun onDestroy() { override fun onDestroy() {
super.onDestroy() super.onDestroy()
clearAnimation() clearAnimation()
taskAdapter?.clearAnimation()
} }
} }
\ No newline at end of file
package com.ym.game.adapter package com.ym.game.adapter
import android.animation.ObjectAnimator
import android.animation.ValueAnimator
import android.app.Activity import android.app.Activity
import android.text.TextUtils
import android.util.Log
import android.view.LayoutInflater import android.view.LayoutInflater
import android.view.View import android.view.View
import android.view.ViewGroup import android.view.ViewGroup
import android.widget.* import android.widget.*
import androidx.recyclerview.widget.RecyclerView import androidx.recyclerview.widget.RecyclerView
import com.bird.cc.it import com.bird.cc.it
import com.bumptech.glide.Glide
import com.ym.library.listener.OnRecycleItemClickListener import com.ym.library.listener.OnRecycleItemClickListener
import com.ym.library.base.BaseRecyclerAdapter import com.ym.library.base.BaseRecyclerAdapter
import com.ym.library.utils.Utils import com.ym.library.utils.Utils
import com.ym.ddcy.R import com.ym.ddcy.R
import com.ym.library.module.NewsEntity import com.ym.library.module.NewsEntity
import com.ym.library.module.TaskListEntity
/** /**
*Craeted by ${junqi.li} *Craeted by ${junqi.li}
...@@ -40,9 +44,34 @@ class WelfareTaskAdpater : ...@@ -40,9 +44,34 @@ class WelfareTaskAdpater :
if (mList.size > 0) { if (mList.size > 0) {
val data = mList[position] val data = mList[position]
holder.tvTitle.text = data.title holder.tvTitle.text = data.title
holder.tvCount.text = "+${data.coins}"
holder.tvSubtitle.text = data.description holder.tvSubtitle.text = data.description
if (data?.awardRangeStart != null && data?.awardRangeEnd != null) {
holder.tvCount.text = "+${data?.awardRangeStart}~${data?.awardRangeEnd}"
} else {
holder.tvCount.text = "+${data.coins}"
}
if (data?.adRenderStyle != null && data?.adRenderStyle == 2) {
holder?.layoutBg.setBackgroundResource(R.drawable.shape_ffedf7_r8)
} else {
holder?.layoutBg.setBackgroundResource(R.drawable.shape_fefce2_r8)
}
if (data?.buttonSway != null && data?.buttonSway == 1) {
startAnimator(holder?.layoutStatus)
} else {
holder?.layoutStatus.clearAnimation()
}
if (data?.adMarkImage != null && "" != data?.adMarkImage) {
holder?.ivTitle?.visibility = View.VISIBLE
Glide.with(mContext!!).load(data?.adMarkImage)
.into(holder?.ivTitle)
} else {
holder?.ivTitle?.visibility = View.GONE
}
holder.ivStatus.setOnClickListener { holder.ivStatus.setOnClickListener {
if (Utils.isFastClick()) { if (Utils.isFastClick()) {
listener.onItemClick(it, position, mList[position]) listener.onItemClick(it, position, mList[position])
...@@ -60,10 +89,12 @@ class WelfareTaskAdpater : ...@@ -60,10 +89,12 @@ class WelfareTaskAdpater :
holder?.tvStatus.text = "去完成" holder?.tvStatus.text = "去完成"
} }
1 -> { 1 -> {
holder?.layoutStatus?.clearAnimation()
holder.ivStatus.setImageResource(R.drawable.icon_item_welfare_task_receiveed) holder.ivStatus.setImageResource(R.drawable.icon_item_welfare_task_receiveed)
holder?.tvStatus.text = "已领取" holder?.tvStatus.text = "已领取"
} }
2 -> { 2 -> {
holder?.layoutStatus?.clearAnimation()
holder.ivStatus.setImageResource(R.drawable.icon_item_welfare_task_receive) holder.ivStatus.setImageResource(R.drawable.icon_item_welfare_task_receive)
holder?.tvStatus.text = "立即领取" holder?.tvStatus.text = "立即领取"
} }
...@@ -78,11 +109,44 @@ class WelfareTaskAdpater : ...@@ -78,11 +109,44 @@ class WelfareTaskAdpater :
} }
inner class WelfareTaskHolder(itemView: View) : RecyclerView.ViewHolder(itemView) { inner class WelfareTaskHolder(itemView: View) : RecyclerView.ViewHolder(itemView) {
val layoutBg: RelativeLayout = itemView.findViewById(R.id.layout_welfare_item_bg)
val tvTitle: TextView = itemView.findViewById(R.id.tv_welfare_item_title) val tvTitle: TextView = itemView.findViewById(R.id.tv_welfare_item_title)
val tvSubtitle: TextView = itemView.findViewById(R.id.tv_welfare_item_subtitle) val tvSubtitle: TextView = itemView.findViewById(R.id.tv_welfare_item_subtitle)
val tvCount: TextView = itemView.findViewById(R.id.tv_welfare_item_count) val tvCount: TextView = itemView.findViewById(R.id.tv_welfare_item_count)
val tvStatus: TextView = itemView.findViewById(R.id.tv_welfare_item_status) val tvStatus: TextView = itemView.findViewById(R.id.tv_welfare_item_status)
val ivStatus: ImageView = itemView.findViewById(R.id.iv_welfare_item_status) val ivStatus: ImageView = itemView.findViewById(R.id.iv_welfare_item_status)
val ivTitle: ImageView = itemView.findViewById(R.id.iv_welfare_item_title)
val layoutStatus: RelativeLayout = itemView.findViewById(R.id.layout_welfare_item_status)
}
private var animatorList: MutableList<ObjectAnimator> = ArrayList()
private var viewList: MutableList<View> = ArrayList()
private fun startAnimator(view: View) {
val oa: ObjectAnimator = ObjectAnimator.ofFloat(
view,
View.ROTATION,
0F, 8F, -8F, 0F, 0F, 0F, 0F, 0F, 0F
)
oa.repeatCount = ValueAnimator.INFINITE
oa.setDuration(1000).start()
animatorList.add(oa)
viewList.add(view)
}
fun clearAnimation() {
if (animatorList.size > 0) {
for (animator in animatorList) {
animator?.cancel()
}
animatorList.clear()
}
if (viewList.size > 0) {
for (view in viewList) {
view?.clearAnimation()
}
viewList.clear()
}
} }
} }
\ No newline at end of file
...@@ -52,16 +52,15 @@ class BaseApplication : MultiDexApplication() { ...@@ -52,16 +52,15 @@ class BaseApplication : MultiDexApplication() {
private var backToFrontTime: Long = 0 private var backToFrontTime: Long = 0
override fun onCreate() { override fun onCreate() {
super.onCreate() super.onCreate()
NetConfig.setBase_Url(NetConfig.Environment.PRODUCT)// TODO 上线之后提成成 NetConfig.Environment.PRODUCT NetConfig.setBase_Url(NetConfig.Environment.DEV)// TODO 上线之后提成成 NetConfig.Environment.PRODUCT
NetConfig.BASE_FEED_URL="https://fsapi.ihuomao.com/" // NetConfig.BASE_FEED_URL="https://fsapi.ihuomao.com/"
NetConfig.BASE_AD_URL="https://bs.ihuomao.com/" // NetConfig.BASE_AD_URL="https://bs.ihuomao.com/"
NetConfig.URL_REPORT_BASE="http://report.ihuomao.com/" // NetConfig.URL_REPORT_BASE="http://report.ihuomao.com/"
//TODO 上线去掉测试地址 //TODO 上线去掉测试地址
// NetConfig.BASE_FEED_URL = "http://feedapitest2.zhangxinhulian.com/" NetConfig.BASE_FEED_URL = "http://feedapitest2.zhangxinhulian.com/"
// Constant.appLs = "afcbef40e31631d3"//appls
AdManager.init(this,"afcbef40e31631d3") AdManager.init(this,"afcbef40e31631d3")
LogUtils.getConfig().logSwitch = false LogUtils.getConfig().logSwitch = false
UMConfigure.setLogEnabled(true) UMConfigure.setLogEnabled(true)
......
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="#FFEDF7"/>
<corners android:radius="8dp"/>
</shape>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/layout_welfare_item_bg"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="66dp" android:layout_height="66dp"
android:layout_marginBottom="12dp" android:layout_marginBottom="12dp"
...@@ -12,6 +13,11 @@ ...@@ -12,6 +13,11 @@
android:gravity="center_vertical" android:gravity="center_vertical"
android:orientation="vertical"> android:orientation="vertical">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center_vertical">
<com.ym.game.wedget.MediumBoldTextView <com.ym.game.wedget.MediumBoldTextView
android:id="@+id/tv_welfare_item_title" android:id="@+id/tv_welfare_item_title"
android:layout_width="wrap_content" android:layout_width="wrap_content"
...@@ -21,6 +27,16 @@ ...@@ -21,6 +27,16 @@
android:textColor="@color/color_333333" android:textColor="@color/color_333333"
android:textSize="17sp" /> android:textSize="17sp" />
<ImageView
android:id="@+id/iv_welfare_item_title"
android:layout_width="62dp"
android:layout_height="17dp"
android:layout_marginLeft="10dp"
android:visibility="gone" />
</LinearLayout>
<TextView <TextView
android:id="@+id/tv_welfare_item_subtitle" android:id="@+id/tv_welfare_item_subtitle"
android:layout_width="wrap_content" android:layout_width="wrap_content"
...@@ -67,6 +83,7 @@ ...@@ -67,6 +83,7 @@
</LinearLayout> </LinearLayout>
<RelativeLayout <RelativeLayout
android:id="@+id/layout_welfare_item_status"
android:layout_width="86dp" android:layout_width="86dp"
android:layout_height="34dp" android:layout_height="34dp"
android:layout_marginTop="3dp"> android:layout_marginTop="3dp">
......
...@@ -70,7 +70,7 @@ class UpdateVersionManager : UpdateVersionContract.View, View.OnClickListener { ...@@ -70,7 +70,7 @@ class UpdateVersionManager : UpdateVersionContract.View, View.OnClickListener {
} }
override fun onNoUpdate() { override fun onNoUpdate() {
// Utils.showToast(AppliContext.get(), "暂无更新") Utils.showToast(AppliContext.get(), "暂无更新")
} }
override fun onDownloadError() { override fun onDownloadError() {
......
...@@ -119,6 +119,10 @@ class NewsEntity : Serializable { ...@@ -119,6 +119,10 @@ class NewsEntity : Serializable {
var status: Int = 0 var status: Int = 0
var autoPlay: Int = 0 var autoPlay: Int = 0
var quiet: Int = 0 var quiet: Int = 0
var awardRangeStart: Int? = null // 奖励范围
var awardRangeEnd: Int? = null
var buttonSway: Int? = 0//按钮是否晃动 1晃动 2不晃动
var adRenderStyle: Int? = 0 //1普通 2幸运
var clickViewUpY: String? = "" var clickViewUpY: String? = ""
......
...@@ -75,7 +75,7 @@ class SettingActivity : BaseActivity() { ...@@ -75,7 +75,7 @@ class SettingActivity : BaseActivity() {
} }
//版本升级 //版本升级
id_setting_update_version.setOnClickListener { id_setting_update_version.setOnClickListener {
val updateVersionManager = this?.let { it1 -> UpdateVersionManager(it1) } val updateVersionManager = UpdateVersionManager(this)
updateVersionManager?.checkUpdate(true) updateVersionManager?.checkUpdate(true)
} }
......
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