版本优化:一些细节处理
This commit is contained in:
@@ -745,7 +745,7 @@ public class GiftDialog extends BottomSheetDialog implements View.OnClickListene
|
||||
if (firstCharmRankUser.getUid() == 0) return;
|
||||
EventBus.getDefault().post(new ShowUserInfoDialogEvent(String.valueOf(firstCharmRankUser.getUid())));
|
||||
});
|
||||
tvNickCharm.setText(StringExtensionKt.subAndReplaceDot(firstCharmRankUser.getNick(), 7));
|
||||
tvNickCharm.setText(StringExtensionKt.subAndReplaceDot(firstCharmRankUser.getNick(), 6));
|
||||
} else {
|
||||
ivAvatarCharm.setOnClickListener(null);
|
||||
ivAvatarCharm.setImageResource(R.drawable.default_avatar);
|
||||
@@ -759,7 +759,7 @@ public class GiftDialog extends BottomSheetDialog implements View.OnClickListene
|
||||
if (firstLevelRankUser.getUid() == 0) return;
|
||||
EventBus.getDefault().post(new ShowUserInfoDialogEvent(String.valueOf(firstLevelRankUser.getUid())));
|
||||
});
|
||||
tvNickLevel.setText(StringExtensionKt.subAndReplaceDot(firstLevelRankUser.getNick(), 7));
|
||||
tvNickLevel.setText(StringExtensionKt.subAndReplaceDot(firstLevelRankUser.getNick(), 6));
|
||||
} else {
|
||||
ivAvatarLevel.setOnClickListener(null);
|
||||
ivAvatarLevel.setImageResource(R.drawable.default_avatar);
|
||||
|
@@ -1,6 +1,7 @@
|
||||
package com.mango.moshen.ui.widget.drawgift;
|
||||
|
||||
import android.animation.Animator;
|
||||
import android.animation.AnimatorListenerAdapter;
|
||||
import android.animation.ValueAnimator;
|
||||
import android.content.Context;
|
||||
import android.graphics.Canvas;
|
||||
@@ -15,21 +16,16 @@ import java.util.List;
|
||||
|
||||
public class DrawGiftPlayView extends View {
|
||||
|
||||
private static final int DRAW_ONE_GIFT = 0;
|
||||
//需要被画上的全部的礼物,采用链表的方式,每次取第0个
|
||||
private final LinkedList<List<DrawGiftModel>> allDrawGiftsLinkedList;
|
||||
|
||||
//为了体现最后的消失动画效果,才引入了这个Paint
|
||||
private final Paint mPaint = new Paint();
|
||||
private final Handler mHandler;
|
||||
;
|
||||
//当前这幅画播放到第几个礼物
|
||||
private int currentGiftShowIndex;
|
||||
|
||||
private DrawAnimationListener onDrawAnimationListener;
|
||||
|
||||
//为了体现最后的消失动画效果,才引入了这个Paint
|
||||
private final Paint mPaint = new Paint();;
|
||||
|
||||
private static final int DRAW_ONE_GIFT = 0;
|
||||
|
||||
private final Handler mHandler;
|
||||
|
||||
private final Handler.Callback mCallback = new Handler.Callback() {
|
||||
@Override
|
||||
public boolean handleMessage(Message msg) {
|
||||
@@ -39,17 +35,16 @@ public class DrawGiftPlayView extends View {
|
||||
currentGiftShowIndex = msg.arg1;
|
||||
invalidate();
|
||||
|
||||
if (currentGiftShowIndex == allDrawGiftsLinkedList.getFirst().size()){
|
||||
if (currentGiftShowIndex == allDrawGiftsLinkedList.getFirst().size()) {
|
||||
postDelayed(() -> {
|
||||
//进入这里,说明已经播放完最后一个礼物了
|
||||
//播放扩大动画,然后消失
|
||||
ValueAnimator valueAnimator = ValueAnimator.ofFloat(1, 2);
|
||||
valueAnimator.setDuration(500);
|
||||
valueAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
|
||||
@Override
|
||||
public void onAnimationUpdate(ValueAnimator animation) {
|
||||
valueAnimator.addUpdateListener(animation -> {
|
||||
float p = (float) animation.getAnimatedValue();
|
||||
//透明效果(所有礼物都做这个动作)
|
||||
mPaint.setAlpha((int)((2.0F - p) * 255));
|
||||
mPaint.setAlpha((int) ((2.0F - p) * 255));
|
||||
//放大效果(所有礼物都做这个动作)
|
||||
for (DrawGiftModel giftModel : allDrawGiftsLinkedList.getFirst()) {
|
||||
|
||||
@@ -59,14 +54,8 @@ public class DrawGiftPlayView extends View {
|
||||
}
|
||||
|
||||
invalidate();
|
||||
}
|
||||
});
|
||||
valueAnimator.addListener(new Animator.AnimatorListener(){
|
||||
|
||||
@Override
|
||||
public void onAnimationStart(Animator animation) {
|
||||
|
||||
}
|
||||
valueAnimator.addListener(new AnimatorListenerAdapter() {
|
||||
|
||||
@Override
|
||||
public void onAnimationEnd(Animator animation) {
|
||||
@@ -80,7 +69,7 @@ public class DrawGiftPlayView extends View {
|
||||
//当前的这一幅画结束
|
||||
onDrawAnimationListener.onAnimationNodeEnd(DrawGiftPlayView.this);
|
||||
|
||||
if (allDrawGiftsLinkedList.isEmpty()){
|
||||
if (allDrawGiftsLinkedList.isEmpty()) {
|
||||
//所有画全部结束
|
||||
onDrawAnimationListener.onAnimationAllOver(DrawGiftPlayView.this);
|
||||
} else {
|
||||
@@ -95,18 +84,9 @@ public class DrawGiftPlayView extends View {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAnimationCancel(Animator animation) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAnimationRepeat(Animator animation) {
|
||||
|
||||
}
|
||||
});
|
||||
valueAnimator.start();
|
||||
}, 1000);
|
||||
} else {
|
||||
//继续画下一个礼物
|
||||
Message message = Message.obtain();
|
||||
@@ -145,16 +125,16 @@ public class DrawGiftPlayView extends View {
|
||||
super.onDraw(canvas);
|
||||
|
||||
int size = allDrawGiftsLinkedList.getFirst().size();
|
||||
for(int i = 0; i <= currentGiftShowIndex && i < size; i++) {
|
||||
for (int i = 0; i <= currentGiftShowIndex && i < size; i++) {
|
||||
DrawGiftModel giftModel = allDrawGiftsLinkedList.getFirst().get(i);
|
||||
canvas.drawBitmap(giftModel.getGiftBitmap(), giftModel.getMatrix(), mPaint);
|
||||
}
|
||||
}
|
||||
|
||||
public void addDrawGifts(List<DrawGiftModel> currentDrawGiftArray, boolean insertToFirst){
|
||||
public void addDrawGifts(List<DrawGiftModel> currentDrawGiftArray, boolean insertToFirst) {
|
||||
|
||||
//处理每个小bitmap的大小和位置
|
||||
for(int i = 0; i < currentDrawGiftArray.size(); i++) {
|
||||
for (int i = 0; i < currentDrawGiftArray.size(); i++) {
|
||||
DrawGiftModel giftModel = currentDrawGiftArray.get(i);
|
||||
|
||||
giftModel.getMatrix().reset();
|
||||
@@ -162,8 +142,8 @@ public class DrawGiftPlayView extends View {
|
||||
}
|
||||
|
||||
//添加到队列
|
||||
if (insertToFirst){
|
||||
if (allDrawGiftsLinkedList.size() > 0){
|
||||
if (insertToFirst) {
|
||||
if (allDrawGiftsLinkedList.size() > 0) {
|
||||
//说明队列里已经有画在draw了。
|
||||
//由于我目前的逻辑是:取first节点,画完了再remove;而不是先remove再设置为全局变量。所以要插入到第1个元素
|
||||
allDrawGiftsLinkedList.add(1, currentDrawGiftArray);
|
||||
@@ -176,11 +156,11 @@ public class DrawGiftPlayView extends View {
|
||||
allDrawGiftsLinkedList.offerLast(currentDrawGiftArray);
|
||||
}
|
||||
|
||||
if (allDrawGiftsLinkedList.size() == 1){
|
||||
if (allDrawGiftsLinkedList.size() == 1) {
|
||||
//刚插入完,size==1,说明是刚开始,这时候要开始播放
|
||||
List<DrawGiftModel> firstDrawGiftArray = this.allDrawGiftsLinkedList.getFirst();
|
||||
|
||||
if (firstDrawGiftArray != null){
|
||||
if (firstDrawGiftArray != null) {
|
||||
//说明有需要播放的,开始draw
|
||||
Message message = Message.obtain();
|
||||
message.arg1 = 0;
|
||||
@@ -191,7 +171,7 @@ public class DrawGiftPlayView extends View {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAttachedToWindow(){
|
||||
public void onAttachedToWindow() {
|
||||
super.onAttachedToWindow();
|
||||
}
|
||||
|
||||
@@ -207,9 +187,10 @@ public class DrawGiftPlayView extends View {
|
||||
this.onDrawAnimationListener = onDrawAnimationListener;
|
||||
}
|
||||
|
||||
public interface DrawAnimationListener{
|
||||
public interface DrawAnimationListener {
|
||||
//礼物动画全部结束
|
||||
public void onAnimationNodeEnd(DrawGiftPlayView drawGiftPlayView);
|
||||
|
||||
//礼物动画当前的这一幅画结束
|
||||
public void onAnimationAllOver(DrawGiftPlayView drawGiftPlayView);
|
||||
}
|
||||
|
Binary file not shown.
Before Width: | Height: | Size: 14 KiB After Width: | Height: | Size: 13 KiB |
@@ -95,7 +95,7 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="12dp"
|
||||
android:gravity="center"
|
||||
android:text="本周该礼物冠名者"
|
||||
android:text="该礼物冠名者"
|
||||
android:textColor="@color/color_333333"
|
||||
android:textSize="10sp" />
|
||||
|
||||
@@ -155,7 +155,7 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="12dp"
|
||||
android:gravity="center"
|
||||
android:text="本周该礼物周星神豪"
|
||||
android:text="该礼物周星神豪"
|
||||
android:textColor="@color/color_333333"
|
||||
android:textSize="10sp" />
|
||||
|
||||
|
@@ -84,38 +84,6 @@
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/ll_room_pk_order"
|
||||
android:layout_width="72dp"
|
||||
android:layout_height="72dp"
|
||||
android:layout_below="@id/contribute_list"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:layout_marginTop="5dp"
|
||||
android:background="@drawable/bg_room_pk_order"
|
||||
android:gravity="center"
|
||||
android:orientation="vertical"
|
||||
android:visibility="gone">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="17dp"
|
||||
android:includeFontPadding="false"
|
||||
android:text="下一场PK"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="10sp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_room_pk_order_time"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="2dp"
|
||||
android:includeFontPadding="false"
|
||||
android:textColor="#fffff333"
|
||||
android:textSize="10sp"
|
||||
tools:text="04:55" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<com.mango.moshen.ui.widget.rollviewpager.RollPagerView
|
||||
android:id="@+id/pager_view_wish_list"
|
||||
@@ -155,6 +123,39 @@
|
||||
android:src="@drawable/icon_music_flag"
|
||||
android:visibility="gone" />
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/ll_room_pk_order"
|
||||
android:layout_width="72dp"
|
||||
android:layout_height="72dp"
|
||||
android:layout_below="@id/tv_hour_rank"
|
||||
android:layout_marginTop="5dp"
|
||||
android:background="@drawable/bg_room_pk_order"
|
||||
android:gravity="center"
|
||||
android:orientation="vertical"
|
||||
android:visibility="gone">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="17dp"
|
||||
android:includeFontPadding="false"
|
||||
android:text="下一场PK"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="10sp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_room_pk_order_time"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="2dp"
|
||||
android:includeFontPadding="false"
|
||||
android:textColor="#fffff333"
|
||||
android:textSize="10sp"
|
||||
tools:text="04:55" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/ll_dating_step"
|
||||
android:layout_width="wrap_content"
|
||||
|
Reference in New Issue
Block a user