Commit 14bb5679 authored by mengcuiguang's avatar mengcuiguang

需求优化

parent a0de7dff
......@@ -60,9 +60,10 @@ public class DrawcashBean implements Serializable {
this.cashOutMoneyArr = cashOutMoneyArr;
}
public class CashOutMoneyArrBean implements Serializable{
public class CashOutMoneyArrBean implements Serializable {
private double money;
private boolean canCashOut;
private String remark;
public double getMoney() {
return money;
......@@ -79,5 +80,13 @@ public class DrawcashBean implements Serializable {
public void setCanCashOut(boolean canCashOut) {
this.canCashOut = canCashOut;
}
public String getRemark() {
return remark;
}
public void setRemark(String remark) {
this.remark = remark;
}
}
}
package com.mints.goodmoney.ui.adapter
import android.content.Context
import android.text.TextUtils
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
......@@ -34,6 +35,7 @@ class DrawcashAdapter(val priceList: MutableList<DrawcashBean.CashOutMoneyArrBea
inner class ViewHolder(view: View) : RecyclerView.ViewHolder(view) {
val llDrawItem: LinearLayout = view.findViewById(R.id.llDrawItem)
val tvDrawItemHint: TextView = view.findViewById(R.id.tvDrawItemHint)
val tvDrawItemCash: TextView = view.findViewById(R.id.tvDrawItemCash)
val tvDrawItemGold: TextView = view.findViewById(R.id.tvDrawItemGold)
}
......@@ -52,6 +54,12 @@ class DrawcashAdapter(val priceList: MutableList<DrawcashBean.CashOutMoneyArrBea
} else {
holder.tvDrawItemCash.text = "${priceBean.money}元"
}
if (TextUtils.isEmpty(priceBean.remark)) {
holder.tvDrawItemHint.visibility = View.GONE
} else {
holder.tvDrawItemHint.visibility = View.VISIBLE
holder.tvDrawItemHint.text = priceBean.remark
}
holder.tvDrawItemGold.text = "约${String.format("%.0f", priceBean.money * 10000)}金币"
holder.llDrawItem.setOnClickListener {
......@@ -72,10 +80,12 @@ class DrawcashAdapter(val priceList: MutableList<DrawcashBean.CashOutMoneyArrBea
//当前选中
if (getPosition() == position) {
holder.tvDrawItemCash.setTextColor(ContextCompat.getColor(context, R.color.white))
holder.tvDrawItemHint.setTextColor(ContextCompat.getColor(context, R.color.white))
holder.tvDrawItemGold.setTextColor(ContextCompat.getColor(context, R.color.white))
holder.llDrawItem.setBackgroundResource(R.drawable.shape_vip_adapter_none)
} else {
holder.tvDrawItemCash.setTextColor(ContextCompat.getColor(context, R.color.black))
holder.tvDrawItemHint.setTextColor(ContextCompat.getColor(context, R.color.gray))
holder.tvDrawItemGold.setTextColor(ContextCompat.getColor(context, R.color.gray))
holder.llDrawItem.setBackgroundResource(R.drawable.shape_vip_adapter)
}
......
......@@ -48,8 +48,66 @@ class HorizChannelFragment : BaseFragment(), HorizChannelView, View.OnClickListe
initListener()
}
private fun initListener() {
cdvvYilanTime.setOnClickListener(this)
override fun getContentViewLayoutID() = R.layout.fragment_horiz_channel
override fun setUserVisibleHint(isVisibleToUser: Boolean) {
super.setUserVisibleHint(isVisibleToUser)
channelFragment?.userVisibleHint = isVisibleToUser
}
override fun onHiddenChanged(hidden: Boolean) {
if (hidden) {
onPause()
} else {
onResume()
}
super.onHiddenChanged(hidden)
channelFragment?.onHiddenChanged(hidden)
}
override fun onResume() {
super.onResume()
if (AppConfig.fragmentClickFlag == Constant.FRAGMENT_CLICK_CHANNEL) {
// 调用金币视频信息接口
horizChannelPresenter.getSmallHomeVedioBaseMsg()
registerPlayerCallBack()
channelFragment?.onResume()
}
}
override fun onPause() {
super.onPause()
if (AppConfig.fragmentClickFlag == Constant.FRAGMENT_CLICK_CHANNEL) {
YLPlayerConfig.config().unRegisterPlayerCallback()
}
pauseDownloadTime()
channelFragment?.onPause()
}
override fun onDestroy() {
super.onDestroy()
cdvvYilanTime?.onDestory()
cdvvYilanTime?.setCountDownVedioListener(null)
horizChannelPresenter.detachView()
}
override fun onClick(v: View?) {
when (v?.id) {
R.id.cdvvYilanTime -> {
if (isAward && isToCreateReward) {
isAward = false
val bundle = Bundle()
bundle.putInt(Constant.MAIN_CUR_COIN, rewardCoin)
bundle.putString(Constant.MAIN_CARRIER_TYPE, Constant.CARRIER_SMALLHOMEVEDIO)
bundle.putString(Constant.MAIN_EXTRA_ID, rewardDoubleCoin.toString())
readyGo(AwardActivity::class.java, bundle)
}
}
}
}
override fun getHomeVedioMsgSuc(data: MainVedioMsgBean) {
......@@ -67,7 +125,7 @@ class HorizChannelFragment : BaseFragment(), HorizChannelView, View.OnClickListe
// 防止界面切换 重置倒计时
// 第一次能过 isFirstLoadVedio 判断好兔先加载视频
if (!isFirstLoadVideo && !cdvvYilanTime.isPlaying && !isAward) {
cdvvYilanTime.setRedpkgImg(R.mipmap.ic_main_grey)
cdvvYilanTime?.stopRedbox()
cdvvYilanTime?.reset()
cdvvYilanTime?.start()
}
......@@ -76,6 +134,34 @@ class HorizChannelFragment : BaseFragment(), HorizChannelView, View.OnClickListe
}
}
/**
* 红包倒计时初始化
*/
private fun initTimeView() {
cdvvYilanTime.setCountDownVedioListener {
if (isFirstWatchVideo) {
// 第一次观看完视频提醒用户
val vs = vs_tips.inflate()
Handler(Looper.getMainLooper()).postDelayed({
vs.visibility = View.GONE
}, 3000)
isFirstWatchVideo = false
}
// 转满一圈,可领金币标记
isAward = true
cdvvYilanTime?.showRedbox()
stopDownloadTime()
}
val videoTime = ps.getInt(Constant.MAIN_VEDIO_TIME, 30)
cdvvYilanTime.setTime(videoTime)
cdvvYilanTime.start()
}
private fun initListener() {
cdvvYilanTime.setOnClickListener(this)
}
private fun initChannelFragment() {
val transaction: FragmentTransaction = childFragmentManager.beginTransaction()
if (channelFragment == null) {
......@@ -89,6 +175,31 @@ class HorizChannelFragment : BaseFragment(), HorizChannelView, View.OnClickListe
}
/**
* 倒计时红包暂停
*/
private fun pauseDownloadTime() {
cdvvYilanTime?.pause()
}
/**
*用户主动暂时或网络异常结束后 重新加载倒计时红包
*/
private fun resumeDownloadTime(id: String) {
if (!TextUtils.isEmpty(id)) {
if (!isAward) {
cdvvYilanTime?.resume()
}
}
}
/**
* 停止转动
*/
private fun stopDownloadTime() {
cdvvYilanTime?.stop()
}
private fun registerPlayerCallBack() {
// 设置点击的item播放状态,callback返回true标识用户已经处理了event,返回false,标识使用播放器内部逻辑处理event。
YLPlayerConfig.config().registerPlayerCallBack(object : OnPlayerCallBack {
......@@ -135,116 +246,4 @@ class HorizChannelFragment : BaseFragment(), HorizChannelView, View.OnClickListe
})
}
override fun getContentViewLayoutID() = R.layout.fragment_horiz_channel
override fun onClick(v: View?) {
when (v?.id) {
R.id.cdvvYilanTime -> {
if (isAward && isToCreateReward) {
isAward = false
val bundle = Bundle()
bundle.putInt(Constant.MAIN_CUR_COIN, rewardCoin)
bundle.putString(Constant.MAIN_CARRIER_TYPE, Constant.CARRIER_SMALLHOMEVEDIO)
bundle.putString(Constant.MAIN_EXTRA_ID, rewardDoubleCoin.toString())
readyGo(AwardActivity::class.java, bundle)
}
}
}
}
override fun setUserVisibleHint(isVisibleToUser: Boolean) {
super.setUserVisibleHint(isVisibleToUser)
channelFragment?.userVisibleHint = isVisibleToUser
}
override fun onHiddenChanged(hidden: Boolean) {
if (hidden) {
onPause()
} else {
onResume()
}
super.onHiddenChanged(hidden)
channelFragment?.onHiddenChanged(hidden)
}
override fun onResume() {
super.onResume()
if (AppConfig.fragmentClickFlag == Constant.FRAGMENT_CLICK_CHANNEL) {
// 调用金币视频信息接口
horizChannelPresenter.getSmallHomeVedioBaseMsg()
registerPlayerCallBack()
channelFragment?.onResume()
}
}
override fun onPause() {
super.onPause()
if (AppConfig.fragmentClickFlag == Constant.FRAGMENT_CLICK_CHANNEL) {
YLPlayerConfig.config().unRegisterPlayerCallback()
}
pauseDownloadTime()
channelFragment?.onPause()
}
/**
* 倒计时红包暂停
*/
private fun pauseDownloadTime() {
cdvvYilanTime?.pause()
}
/**
*用户主动暂时或网络异常结束后 重新加载倒计时红包
*/
private fun resumeDownloadTime(id: String) {
if (!TextUtils.isEmpty(id)) {
if (!isAward) {
cdvvYilanTime?.resume()
}
}
}
/**
* 停止转动
*/
private fun stopDownloadTime() {
cdvvYilanTime?.stop()
}
/**
* 红包倒计时初始化
*/
private fun initTimeView() {
cdvvYilanTime.setCountDownVedioListener {
if (isFirstWatchVideo) {
// 第一次观看完视频提醒用户
val vs = vs_tips.inflate()
Handler(Looper.getMainLooper()).postDelayed({
vs.visibility = View.GONE
}, 3000)
isFirstWatchVideo = false
}
cdvvYilanTime.setRedpkgImg(R.mipmap.ic_main_red)
// 转满一圈,可领金币标记
isAward = true
cdvvYilanTime?.showRedbox()
stopDownloadTime()
}
val videoTime = ps.getInt(Constant.MAIN_VEDIO_TIME, 30)
cdvvYilanTime.setTime(videoTime)
cdvvYilanTime.start()
}
override fun onDestroy() {
super.onDestroy()
cdvvYilanTime?.setCountDownVedioListener(null)
horizChannelPresenter.detachView()
}
}
\ No newline at end of file
......@@ -133,6 +133,7 @@ class MainFragment : BaseFragment(), HomeView, View.OnClickListener {
override fun onDestroy() {
super.onDestroy()
cdvvYilanTime?.onDestory()
cdvvYilanTime?.setCountDownVedioListener(null)
// 广告回调解绑
YLUIConfig.getInstance().unRegisterAdListener()
......@@ -195,7 +196,7 @@ class MainFragment : BaseFragment(), HomeView, View.OnClickListener {
// 防止界面切换 重置倒计时
// 好兔视频已加载 且 红包已转满 且 奖励已领过
if (!isFirstLoadVedio && !cdvvYilanTime.isPlaying && !isAward) {
cdvvYilanTime.setRedpkgImg(R.mipmap.ic_main_grey)
cdvvYilanTime?.stopRedbox()
cdvvYilanTime?.reset()
cdvvYilanTime?.start()
}
......@@ -404,7 +405,6 @@ class MainFragment : BaseFragment(), HomeView, View.OnClickListener {
isFirstWatchVideo = false
}
cdvvYilanTime.setRedpkgImg(R.mipmap.ic_main_red)
// 转满一圈,可领金币标记
isAward = true
cdvvYilanTime?.showRedbox()
......
......@@ -22,6 +22,7 @@ public class CountDownVedioView extends LinearLayout {
private ImageView ivCountVedioRedbox;
private boolean isPlaying = false;
private YoYo.YoYoString rope;
public CountDownVedioView(Context context) {
this(context, null);
......@@ -92,7 +93,7 @@ public class CountDownVedioView extends LinearLayout {
cdCountVedioView.setTime(time);
}
public void setRedpkgImg(int img){
public void setRedpkgImg(int img) {
ivCountVedioRedbox.setImageResource(img);
}
......@@ -109,10 +110,20 @@ public class CountDownVedioView extends LinearLayout {
*/
public void showRedbox() {
if (ivCountVedioRedbox != null) {
// ivCountVedioRedbox.setVisibility(VISIBLE);
YoYo.with(Techniques.Tada).duration(2000)
.repeat(2)
.playOn(ivCountVedioRedbox);
rope = YoYo.with(Techniques.Tada).duration(2000).repeat(-1).playOn(ivCountVedioRedbox);
}
}
public void stopRedbox() {
if (ivCountVedioRedbox != null && rope != null) {
rope.stop();
}
}
public void onDestory() {
if (rope != null) {
rope.stop();
rope = null;
}
}
}
......@@ -61,7 +61,7 @@ public class CountDownView extends View {
TypedArray array = context.obtainStyledAttributes(attrs, R.styleable.CountDownView);
mRetreatType = array.getInt(R.styleable.CountDownView_cd_retreat_type, 1);
location = array.getInt(R.styleable.CountDownView_cd_location, 1);
mCircleRadius = (int) array.getDimension(R.styleable.CountDownView_cd_circle_radius, dip2px(context, 25));//默认25dp
mCircleRadius = (int) array.getDimension(R.styleable.CountDownView_cd_circle_radius, dip2px(context, 3));//默认25dp
mPaintArcWidth = array.getDimension(R.styleable.CountDownView_cd_arc_width, dip2px(context, 3));//默认3dp
mPaintArcColor = array.getColor(R.styleable.CountDownView_cd_arc_color, mPaintArcColor);
mTextSize = (int) array.getDimension(R.styleable.CountDownView_cd_text_size, dip2px(context, 14));//默认14sp
......
......@@ -83,8 +83,8 @@ public class ForegroundOrBackground implements Application.ActivityLifecycleCall
if (count == 0) {
// LogUtil.d("ForegroundOrBackground", System.currentTimeMillis() - leaveTime + " onActivityStarted");
// 30秒后打开应用 显示开屏广告
if (System.currentTimeMillis() - leaveTime >= 30000) {
// 60秒后打开应用 显示开屏广告
if (System.currentTimeMillis() - leaveTime >= 60000) {
if (intent == null) {
intent = new Intent(activity, SplashADActivity.class);
}
......
......@@ -41,7 +41,7 @@
android:id="@+id/cdvvYilanTime"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="100dp" />
android:layout_marginBottom="30dp" />
</LinearLayout>
</LinearLayout>
......
......@@ -12,7 +12,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="end|bottom"
android:layout_marginEnd="8dp"
android:layout_marginEnd="4dp"
android:orientation="horizontal">
<ViewStub
......
......@@ -13,13 +13,22 @@
android:layout_marginTop="6dp"
android:layout_marginBottom="6dp">
<TextView
android:id="@+id/tvDrawItemHint"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:visibility="gone"
android:layout_marginBottom="-4dp"
android:textSize="12sp" />
<TextView
android:id="@+id/tvDrawItemCash"
android:layout_width="wrap_content"
android:layout_marginTop="8dp"
android:layout_height="wrap_content"
android:text="0.3元"
android:textStyle="bold"
android:layout_marginTop="8dp"
android:textSize="22sp" />
<TextView
......
......@@ -4,6 +4,7 @@
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/shape_write">
<com.mints.goodmoney.ui.widgets.CountDownView
......@@ -16,7 +17,7 @@
app:cd_arc_color="@color/main_mints"
app:cd_arc_width="3dp"
app:cd_bg_color="#20FF9837"
app:cd_circle_radius="22dp"
app:cd_circle_radius="25dp"
app:cd_location="top"
app:cd_retreat_type="forward"
app:cd_text_color="#00000000"
......@@ -24,8 +25,8 @@
<ImageView
android:id="@+id/iv_count_redbox"
android:layout_width="24dp"
android:layout_height="28dp"
android:layout_width="26dp"
android:layout_height="30dp"
android:layout_gravity="center"
android:src="@mipmap/ic_main_grey" />
android:src="@mipmap/ic_main_red" />
</FrameLayout>
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