Commit 744dd84b authored by Li's avatar Li

[李俊岐] 优化每日福利

parent 65669fd8
......@@ -102,8 +102,8 @@ class GameActivity : UnityPlayerActivity(), IDialogViewCloseCallback {
}
private fun checkUpdateApp() {
val updateVersionManager = this?.let { it1 -> UpdateVersionManager(it1) }
updateVersionManager?.checkUpdate(true)
val updateVersionManager = UpdateVersionManager(this)
updateVersionManager?.checkUpdate(false)
}
override fun onResume() {
......
......@@ -287,5 +287,6 @@ class WelfareActivity : BaseActivity(), WelfareContract.View,
override fun onDestroy() {
super.onDestroy()
clearAnimation()
taskAdapter?.clearAnimation()
}
}
\ No newline at end of file
package com.ym.game.adapter
import android.animation.ObjectAnimator
import android.animation.ValueAnimator
import android.app.Activity
import android.text.TextUtils
import android.util.Log
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.*
import androidx.recyclerview.widget.RecyclerView
import com.bird.cc.it
import com.bumptech.glide.Glide
import com.ym.library.listener.OnRecycleItemClickListener
import com.ym.library.base.BaseRecyclerAdapter
import com.ym.library.utils.Utils
import com.ym.ddcy.R
import com.ym.library.module.NewsEntity
import com.ym.library.module.TaskListEntity
/**
*Craeted by ${junqi.li}
......@@ -40,9 +44,34 @@ class WelfareTaskAdpater :
if (mList.size > 0) {
val data = mList[position]
holder.tvTitle.text = data.title
holder.tvCount.text = "+${data.coins}"
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 {
if (Utils.isFastClick()) {
listener.onItemClick(it, position, mList[position])
......@@ -60,10 +89,12 @@ class WelfareTaskAdpater :
holder?.tvStatus.text = "去完成"
}
1 -> {
holder?.layoutStatus?.clearAnimation()
holder.ivStatus.setImageResource(R.drawable.icon_item_welfare_task_receiveed)
holder?.tvStatus.text = "已领取"
}
2 -> {
holder?.layoutStatus?.clearAnimation()
holder.ivStatus.setImageResource(R.drawable.icon_item_welfare_task_receive)
holder?.tvStatus.text = "立即领取"
}
......@@ -78,11 +109,44 @@ class WelfareTaskAdpater :
}
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 tvSubtitle: TextView = itemView.findViewById(R.id.tv_welfare_item_subtitle)
val tvCount: TextView = itemView.findViewById(R.id.tv_welfare_item_count)
val tvStatus: TextView = itemView.findViewById(R.id.tv_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() {
private var backToFrontTime: Long = 0
override fun onCreate() {
super.onCreate()
NetConfig.setBase_Url(NetConfig.Environment.PRODUCT)// TODO 上线之后提成成 NetConfig.Environment.PRODUCT
NetConfig.BASE_FEED_URL="https://fsapi.ihuomao.com/"
NetConfig.BASE_AD_URL="https://bs.ihuomao.com/"
NetConfig.URL_REPORT_BASE="http://report.ihuomao.com/"
NetConfig.setBase_Url(NetConfig.Environment.DEV)// TODO 上线之后提成成 NetConfig.Environment.PRODUCT
// NetConfig.BASE_FEED_URL="https://fsapi.ihuomao.com/"
// NetConfig.BASE_AD_URL="https://bs.ihuomao.com/"
// NetConfig.URL_REPORT_BASE="http://report.ihuomao.com/"
//TODO 上线去掉测试地址
// NetConfig.BASE_FEED_URL = "http://feedapitest2.zhangxinhulian.com/"
// Constant.appLs = "afcbef40e31631d3"//appls
NetConfig.BASE_FEED_URL = "http://feedapitest2.zhangxinhulian.com/"
AdManager.init(this,"afcbef40e31631d3")
LogUtils.getConfig().logSwitch = false
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"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/layout_welfare_item_bg"
android:layout_width="match_parent"
android:layout_height="66dp"
android:layout_marginBottom="12dp"
......@@ -12,6 +13,11 @@
android:gravity="center_vertical"
android:orientation="vertical">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center_vertical">
<com.ym.game.wedget.MediumBoldTextView
android:id="@+id/tv_welfare_item_title"
android:layout_width="wrap_content"
......@@ -21,6 +27,16 @@
android:textColor="@color/color_333333"
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
android:id="@+id/tv_welfare_item_subtitle"
android:layout_width="wrap_content"
......@@ -67,6 +83,7 @@
</LinearLayout>
<RelativeLayout
android:id="@+id/layout_welfare_item_status"
android:layout_width="86dp"
android:layout_height="34dp"
android:layout_marginTop="3dp">
......
......@@ -70,7 +70,7 @@ class UpdateVersionManager : UpdateVersionContract.View, View.OnClickListener {
}
override fun onNoUpdate() {
// Utils.showToast(AppliContext.get(), "暂无更新")
Utils.showToast(AppliContext.get(), "暂无更新")
}
override fun onDownloadError() {
......
......@@ -119,6 +119,10 @@ class NewsEntity : Serializable {
var status: Int = 0
var autoPlay: 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? = ""
......
......@@ -75,7 +75,7 @@ class SettingActivity : BaseActivity() {
}
//版本升级
id_setting_update_version.setOnClickListener {
val updateVersionManager = this?.let { it1 -> UpdateVersionManager(it1) }
val updateVersionManager = UpdateVersionManager(this)
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