Commit e5052e39 authored by jyx's avatar jyx

戳我分红及签到翻倍金币动画

parent 3d680e8e
......@@ -108,12 +108,6 @@ object Constant {
const val CARRIER_SMALLHOMEVEDIO_DOUBLE = "SMALLHOMEVEDIO_DOUBLE" //首页红包翻倍
const val CARRIER_MORNING_CLOCK = "MORNING_CLOCK" //早上打卡
const val SHAREFRIEND_COMPLETE_1 = "SHAREFRIEND_COMPLETE_1" //邀请任务1
const val SHAREFRIEND_COMPLETE_2 = "SHAREFRIEND_COMPLETE_2" //邀请任务2
const val SHAREFRIEND_COMPLETE_3 = "SHAREFRIEND_COMPLETE_3" //邀请任务3
const val SHAREFRIEND_COMPLETE_4 = "SHAREFRIEND_COMPLETE_4" //邀请任务4
const val SHAREFRIEND_COMPLETE_5 = "SHAREFRIEND_COMPLETE_5" //邀请任务5
const val SHAREFRIEND_COMPLETE_6 = "SHAREFRIEND_COMPLETE_6" //邀请任务6
const val CHALLENGE_SHAREFRIEND = "CHALLENGE_SHAREFRIEND" //邀请好友
......
......@@ -66,9 +66,6 @@ class AwardActivity : BaseActivity(), AwardView, View.OnClickListener {
startTime()
when (carrierType) {
Constant.SHAREFRIEND_COMPLETE_1, Constant.SHAREFRIEND_COMPLETE_2,
Constant.SHAREFRIEND_COMPLETE_3, Constant.SHAREFRIEND_COMPLETE_4,
Constant.SHAREFRIEND_COMPLETE_5, Constant.SHAREFRIEND_COMPLETE_6,
Constant.CARRIER_GAME_ONLINE, Constant.CARRIER_EATMEAL -> {
val vo = HashMap<String, Any>()
vo["carrierType"] = carrierType
......@@ -155,6 +152,9 @@ class AwardActivity : BaseActivity(), AwardView, View.OnClickListener {
tvAwardContent.setText("+" + curCoin + "金币")
tvAwardNext.setText("看视频领取")
}
Constant.CARRIER_VERSUS_VIDEO ->{
tvAwardContent.setText(curCoin.toString() + "金币已到账")
}
else -> {
tvAwardContent.setText(curCoin.toString() + "金币已到账")
}
......
......@@ -3,6 +3,7 @@ package com.mints.goodmoney.ui.fragment
import android.annotation.SuppressLint
import android.text.TextUtils
import android.view.View
import android.view.animation.AccelerateDecelerateInterpolator
import androidx.core.content.ContextCompat
import androidx.recyclerview.widget.DividerItemDecoration
import androidx.recyclerview.widget.RecyclerView
......@@ -10,6 +11,8 @@ import androidx.viewpager.widget.ViewPager
import cn.sharesdk.framework.Platform
import cn.sharesdk.framework.ShareSDK
import cn.sharesdk.wechat.friends.Wechat
import com.daimajia.androidanimations.library.Techniques
import com.daimajia.androidanimations.library.YoYo
import com.mints.goodmoney.R
import com.mints.goodmoney.common.AppConfig
import com.mints.goodmoney.common.Constant
......@@ -60,6 +63,8 @@ class FriendsFragment : BaseFragment(), FriendsView, OnRefreshListener, View.OnC
private var bonusDialog: BonusDialog? = null
private var rope: YoYo.YoYoString? = null
override fun getContentViewLayoutID() = R.layout.fragment_main_friends
override fun initViewsAndEvents() {
......@@ -180,6 +185,10 @@ class FriendsFragment : BaseFragment(), FriendsView, OnRefreshListener, View.OnC
override fun onDestroy() {
super.onDestroy()
friendsPresenter.detachView()
if (rope != null) {
rope?.stop()
rope = null
}
}
override fun onRefresh(refreshLayout: RefreshLayout) {
......@@ -203,6 +212,23 @@ class FriendsFragment : BaseFragment(), FriendsView, OnRefreshListener, View.OnC
}
}
/**
* 显示红包动画
*/
fun showRedbox(view: View?) {
rope = YoYo.with(Techniques.Pulse).duration(1200)
.interpolate(AccelerateDecelerateInterpolator())
.repeat(-1)
.playOn(view)
}
fun stopRedbox() {
if (rope != null) {
rope?.stop()
}
}
private fun generateData(data: FriendHallMsgBean) {
friends_sum.text = "" + data.friendCount
friends_directly_sum.text = "" + data.directFriendsCount
......@@ -210,12 +236,17 @@ class FriendsFragment : BaseFragment(), FriendsView, OnRefreshListener, View.OnC
btn_get_bonus.text = data.button
btn_get_bonus.isEnabled = data.status == 0 && data.cash > 0
if (btn_get_bonus.isEnabled) {
showRedbox(btn_get_bonus)
} else {
stopRedbox()
}
tv_bonus_date.text = data.periods
tv_bonus_sum.text = SpanUtils()
.append("预计总分红 ").setForegroundColor(resources.getColor(R.color.black))
.append(data.titleMsg).setFontSize(52).setForegroundColor(resources.getColor(R.color.color_E72C2B))
.append("今日奖池 ").setForegroundColor(resources.getColor(R.color.black))
.append(data.titleMsg).setFontSize(60).setForegroundColor(resources.getColor(R.color.color_E72C2B))
.append(" 元").setForegroundColor(resources.getColor(R.color.black))
.create()
......
package com.mints.goodmoney.ui.fragment
import android.Manifest
import android.annotation.SuppressLint
import android.content.ClipData
import android.content.ClipboardManager
......@@ -158,6 +157,7 @@ class MyFragment : BaseFragment(), MyView, OnItemChildClickListener, OnRefreshLi
override fun onDestroy() {
super.onDestroy()
BxmManager.onDestory()
item_clock_signview.onDestory()
myPresenter.detachView()
}
......
......@@ -9,6 +9,8 @@ import android.widget.TextView;
import androidx.annotation.Nullable;
import com.daimajia.androidanimations.library.Techniques;
import com.daimajia.androidanimations.library.YoYo;
import com.mints.goodmoney.R;
import com.mints.goodmoney.mvp.model.SignViewBean;
import com.mints.library.utils.nodoubleclick.AntiShake;
......@@ -38,6 +40,8 @@ public class SignView extends LinearLayout implements View.OnClickListener {
private TextView tvSixday;
private TextView tvSevenday;
private YoYo.YoYoString rope;
public SignView(Context context) {
this(context, null);
}
......@@ -161,14 +165,25 @@ public class SignView extends LinearLayout implements View.OnClickListener {
}
}
// public void setSevenAnim(int signDays, int status) {
// if (status == 0 && signDays == 7 && tvSeven != null) {
// YoYo.with(Techniques.Swing).duration(1200)
// .interpolate(new AccelerateDecelerateInterpolator())
// .repeat(15)
// .playOn(tvSeven);
// }
// }
/**
* 显示红包动画
*/
public void showRedbox(View view) {
rope = YoYo.with(Techniques.Tada).duration(1000).repeat(-1).playOn(view);
}
public void stopRedbox() {
if (rope != null) {
rope.stop();
}
}
public void onDestory() {
if (rope != null) {
rope.stop();
rope = null;
}
}
/**
* 设置文字样式
......@@ -199,7 +214,9 @@ public class SignView extends LinearLayout implements View.OnClickListener {
tvContent.setBackground(resources.getDrawable(R.mipmap.ic_sign_video));
tvDay.setTextColor(resources.getColor(R.color.black));
tvDay.setText("可翻倍");
showRedbox(tvContent);
} else {
stopRedbox();
if (days == 7) {
tvContent.setBackground(resources.getDrawable(R.mipmap.ic_sign_newgift_open));
......@@ -237,44 +254,6 @@ public class SignView extends LinearLayout implements View.OnClickListener {
tvDay.setTextColor(resources.getColor(R.color.black));
break;
}
// } else {
// switch (status) {
// case 0:
// if (days == 7) {
// tvContent.setText("");
// tvContent.setBackground(resources.getDrawable(R.mipmap.ic_sign_newgift_close));
//
// } else {
// tvContent.setBackground(resources.getDrawable(R.mipmap.ic_sign_finish));
// }
// tvDay.setTextColor(resources.getColor(R.color.black));
// break;
// case 1:
// case 2:
// if (days == 7) {
// tvContent.setBackground(resources.getDrawable(R.mipmap.ic_sign_newgift_open));
//
// } else {
// tvContent.setBackground(resources.getDrawable(R.mipmap.ic_sign_none));
// }
//
// tvContent.setText("");
// tvContent.setTextColor(resources.getColor(R.color.graya));
// tvDay.setTextColor(resources.getColor(R.color.graya));
// tvDay.setText("已领");
// break;
// default:
// if (days == 7) {
// tvContent.setText("");
// tvContent.setBackground(resources.getDrawable(R.mipmap.ic_sign_newgift_close));
// } else {
// tvContent.setBackground(resources.getDrawable(R.mipmap.ic_sign_finish));
// }
// tvDay.setTextColor(resources.getColor(R.color.black));
// break;
// }
// }
}
......
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="@color/graygai" />
<solid android:color="@color/main_mints" />
<corners android:radius="100dp" />
......
......@@ -94,7 +94,7 @@
android:layout_height="wrap_content"
android:layout_below="@id/img_red"
android:layout_centerHorizontal="true"
android:layout_marginTop="12dp"
android:layout_marginTop="10dp"
android:text="@string/dot"
android:textSize="14sp" />
......@@ -128,8 +128,8 @@
android:id="@+id/tv_bonus_hint"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="2dp"
android:layout_alignParentRight="true"
android:layout_marginTop="2dp"
android:textSize="12sp" />
</RelativeLayout>
......@@ -230,14 +230,13 @@
<Button
android:id="@+id/btn_get_bonus"
android:layout_width="60dp"
android:layout_height="30dp"
android:layout_height="26dp"
android:layout_alignParentEnd="true"
android:layout_centerVertical="true"
android:layout_marginStart="20dp"
android:layout_marginEnd="5dp"
android:background="@drawable/btn_friends_selectored"
android:text="结算中"
android:enabled="false"
android:textColor="@drawable/btn_friends_text_color_selectored"
android:textSize="12sp" />
......
......@@ -29,6 +29,7 @@
android:id="@+id/tv_sign_first"
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_marginTop="5dp"
android:gravity="center"
android:textColor="@color/white"
android:textSize="@dimen/font_size_14" />
......@@ -56,6 +57,7 @@
android:id="@+id/tv_sign_two"
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_marginTop="5dp"
android:gravity="center"
android:textColor="@color/white"
android:textSize="@dimen/font_size_14" />
......@@ -83,6 +85,7 @@
android:id="@+id/tv_sign_three"
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_marginTop="5dp"
android:gravity="center"
android:textColor="@color/white"
android:textSize="@dimen/font_size_14" />
......@@ -110,6 +113,7 @@
android:id="@+id/tv_sign_four"
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_marginTop="5dp"
android:gravity="center"
android:textColor="@color/white"
android:textSize="@dimen/font_size_14" />
......@@ -137,6 +141,7 @@
android:id="@+id/tv_sign_five"
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_marginTop="5dp"
android:gravity="center"
android:textColor="@color/white"
android:textSize="@dimen/font_size_14" />
......@@ -164,6 +169,7 @@
android:id="@+id/tv_sign_six"
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_marginTop="5dp"
android:gravity="center"
android:textColor="@color/white"
android:textSize="@dimen/font_size_14" />
......@@ -191,6 +197,7 @@
android:id="@+id/tv_sign_seven"
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_marginTop="5dp"
android:gravity="center"
android:text="78"
android:textColor="@color/white"
......
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