pk头像框小修改,cp动画不出来头像动画最多10次,pk切换房间刷新UI。

This commit is contained in:
2026-01-22 10:18:41 +08:00
parent 1048b8f46e
commit 76f499f022
3 changed files with 53 additions and 24 deletions

View File

@@ -193,11 +193,21 @@ public class RoomCPView extends FrameLayout {
LogUtils.e("onFailed", s);
// 确保所有UI操作在主线程中执行
post(() -> {
// 动画失败,隐藏视图
setVisibility(View.GONE);
anim_cp.setVisibility(View.GONE);
// 继续播放下一个
loadStartAnimation();
if (anim_cp != null) {
// 停止头像动画
stopAvatarAnimation();
// 隐藏动画视图和头像
anim_cp.setVisibility(View.GONE);
avatarContainer1.setVisibility(View.GONE);
if (isOnece) {
return;
}
// 通知播放完成
notifyPlaybackComplete();
loadStartAnimation();
}
});
}
});
@@ -752,12 +762,31 @@ public class RoomCPView extends FrameLayout {
Animation.RELATIVE_TO_SELF, 0.0f, Animation.RELATIVE_TO_SELF, 0.0f,
Animation.RELATIVE_TO_SELF, 0.0f, Animation.RELATIVE_TO_SELF, -0.01f);
avatarsFloatUp.setDuration(900); // 增加动画持续时间,使动画更平滑
avatarsFloatUp.setRepeatCount(Animation.INFINITE);
avatarsFloatUp.setRepeatCount(10);
avatarsFloatUp.setRepeatMode(Animation.REVERSE);
avatarsAnimationSet.addAnimation(avatarsFloatUp);
avatarsParentContainer.startAnimation(avatarsAnimationSet);
// 动画结束后重置位置
avatarsAnimationSet.setAnimationListener(new Animation.AnimationListener() {
@Override
public void onAnimationStart(Animation animation) {
}
@Override
public void onAnimationEnd(Animation animation) {
if (avatarContainer1.getVisibility() == View.VISIBLE) {
avatarContainer1.setVisibility(View.GONE);
}
}
@Override
public void onAnimationRepeat(Animation animation) {
}
});
}
/**

View File

@@ -29,6 +29,22 @@
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<com.xscm.moduleutil.widget.AvatarFrameView
android:id="@+id/iv_frame"
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_marginStart="@dimen/dp_8"
android:layout_marginTop="@dimen/dp_10"
android:layout_marginEnd="@dimen/dp_8"
android:adjustViewBounds="true"
android:scaleType="fitCenter"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintDimensionRatio="1:1"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<com.opensource.svgaplayer.SVGAImageView
android:id="@+id/iv_ripple"
android:layout_width="0dp"
@@ -131,20 +147,6 @@
tools:visibility="visible" />
<com.xscm.moduleutil.widget.AvatarFrameView
android:id="@+id/iv_frame"
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_marginStart="@dimen/dp_12"
android:layout_marginTop="@dimen/dp_12"
android:layout_marginEnd="@dimen/dp_12"
android:adjustViewBounds="true"
android:scaleType="fitCenter"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintDimensionRatio="1:1"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<View
android:id="@+id/view_riv_bottom"
@@ -173,7 +175,7 @@
android:singleLine="true"
android:layout_marginTop="@dimen/dp_3"
android:textColor="@color/white"
android:textSize="@dimen/sp_10"
android:textSize="@dimen/sp_8"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"

View File

@@ -512,9 +512,7 @@ public class SingSongFragment extends BaseRoomFragment<SingSongPresenter, Fragme
public void roomInfoUpdate(RoomInfoResp resp) {
roomInfoResp = resp;
roomId = roomInfoResp == null ? "" : roomInfoResp.getRoom_info().getRoom_id();
// isWhether();
upWhether();
updateWheatData();
upDataView();
}
@Override