相亲动态文字插入方式修改
This commit is contained in:
@@ -78,44 +78,36 @@ import static com.yizhuan.xchat_android_constants.XChatConstants.SELECT_ANIM_DUR
|
||||
*/
|
||||
public class RoomEffectView extends FrameLayout {
|
||||
|
||||
private boolean isSvgaPlaying;
|
||||
private final List<String> mCarEffectList = new ArrayList<>();
|
||||
|
||||
private Animation animation;
|
||||
private List<ChatRoomMessage> messages;
|
||||
private Disposable boxDisposable;
|
||||
private boolean isCreate;
|
||||
|
||||
private List<ChatRoomMessage> messagesBoxSVGA;
|
||||
private Disposable boxSVGADisposable;
|
||||
private boolean isBoxSVGACreate;
|
||||
|
||||
private Animation animationLuckyGift;
|
||||
private List<ChatRoomMessage> messagesLuckyGift;
|
||||
private boolean isCreateLuckyGift;
|
||||
private Disposable disposableLuckyGift;
|
||||
|
||||
private List<ChatRoomMessage> messagesMemberIn;
|
||||
private boolean isCreateMemberIn;
|
||||
private Disposable disposableMemberIn;
|
||||
|
||||
private List<ChatRoomMessage> messagesLevelUp;
|
||||
private boolean isCreateLevelUp;
|
||||
private Disposable disposableLevelUp;
|
||||
|
||||
private Animation animationDatingAll;
|
||||
private List<ChatRoomMessage> messagesDatingAll;
|
||||
private boolean isCreateDatingAll;
|
||||
private Disposable disposableDatingAll;
|
||||
|
||||
//顶部飘屏总展示时间
|
||||
private final int SHOW_TIME = 3500;
|
||||
//顶部飘屏周期
|
||||
private final int PERIOD = 1000;
|
||||
|
||||
private final LayoutRoomEffectBinding binding;
|
||||
private final Context mContext;
|
||||
private final Disposable imDisposable;
|
||||
private boolean isSvgaPlaying;
|
||||
private Animation animation;
|
||||
private List<ChatRoomMessage> messages;
|
||||
private Disposable boxDisposable;
|
||||
private boolean isCreate;
|
||||
private List<ChatRoomMessage> messagesBoxSVGA;
|
||||
private Disposable boxSVGADisposable;
|
||||
private boolean isBoxSVGACreate;
|
||||
private Animation animationLuckyGift;
|
||||
private List<ChatRoomMessage> messagesLuckyGift;
|
||||
private boolean isCreateLuckyGift;
|
||||
private Disposable disposableLuckyGift;
|
||||
private List<ChatRoomMessage> messagesMemberIn;
|
||||
private boolean isCreateMemberIn;
|
||||
private Disposable disposableMemberIn;
|
||||
private List<ChatRoomMessage> messagesLevelUp;
|
||||
private boolean isCreateLevelUp;
|
||||
private Disposable disposableLevelUp;
|
||||
private Animation animationDatingAll;
|
||||
private List<ChatRoomMessage> messagesDatingAll;
|
||||
private boolean isCreateDatingAll;
|
||||
private Disposable disposableDatingAll;
|
||||
private Disposable datingDisposable;
|
||||
|
||||
public RoomEffectView(@NonNull Context context) {
|
||||
@@ -423,7 +415,7 @@ public class RoomEffectView extends FrameLayout {
|
||||
public void onError() {
|
||||
|
||||
}
|
||||
},null);
|
||||
}, null);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -529,7 +521,7 @@ public class RoomEffectView extends FrameLayout {
|
||||
public void onError() {
|
||||
|
||||
}
|
||||
},null);
|
||||
}, null);
|
||||
}
|
||||
|
||||
|
||||
@@ -596,7 +588,7 @@ public class RoomEffectView extends FrameLayout {
|
||||
public void onError() {
|
||||
|
||||
}
|
||||
},null);
|
||||
}, null);
|
||||
binding.roomLevelUpSvga.setOnClickListener(v ->
|
||||
AVRoomActivity.start(mContext, roomUid));
|
||||
} catch (MalformedURLException e) {
|
||||
@@ -641,8 +633,33 @@ public class RoomEffectView extends FrameLayout {
|
||||
textPaint.setTextSize(ScreenUtil.sp2px(10));
|
||||
AnimHelper.addDynamicImage(binding.svgaDating, dynamicEntity, datingNotifyInfo.getAvatar(), "z_tx");
|
||||
AnimHelper.addDynamicImage(binding.svgaDating, dynamicEntity, datingNotifyInfo.getTargetAvatar(), "y_tx");
|
||||
dynamicEntity.setDynamicText(StringExtensionKt.subAndReplaceDot(datingNotifyInfo.getNickname(), 5), textPaint, "z_yhname");
|
||||
dynamicEntity.setDynamicText(StringExtensionKt.subAndReplaceDot(datingNotifyInfo.getTargetNickname(), 5), textPaint, "y_yhname");
|
||||
|
||||
String nickName = StringExtensionKt.subAndReplaceDot(datingNotifyInfo.getNickname(), 5);
|
||||
dynamicEntity.setDynamicText(
|
||||
new StaticLayout(
|
||||
nickName,
|
||||
0,
|
||||
nickName.length(),
|
||||
textPaint,
|
||||
0,
|
||||
Layout.Alignment.ALIGN_CENTER,
|
||||
1.0f,
|
||||
0.0f,
|
||||
false
|
||||
), "z_yhname");
|
||||
|
||||
String targetNickName = StringExtensionKt.subAndReplaceDot(datingNotifyInfo.getTargetNickname(), 5);
|
||||
dynamicEntity.setDynamicText(new StaticLayout(
|
||||
targetNickName,
|
||||
0,
|
||||
targetNickName.length(),
|
||||
textPaint,
|
||||
0,
|
||||
Layout.Alignment.ALIGN_CENTER,
|
||||
1.0f,
|
||||
0.0f,
|
||||
false
|
||||
), "y_yhname");
|
||||
SVGADrawable drawable = new SVGADrawable(svgaVideoEntity, dynamicEntity);
|
||||
binding.svgaDating.setImageDrawable(drawable);
|
||||
binding.svgaDating.startAnimation();
|
||||
@@ -654,7 +671,7 @@ public class RoomEffectView extends FrameLayout {
|
||||
public void onError() {
|
||||
emitter.onError(new Throwable("svga解析失败"));
|
||||
}
|
||||
},null)))
|
||||
}, null)))
|
||||
.flatMap(info -> Observable.intervalRange(1, info.getSvgaSecond(), 1, 1, TimeUnit.SECONDS))
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.doAfterTerminate(() -> binding.flSvgaDating.setVisibility(View.GONE))
|
||||
@@ -750,7 +767,7 @@ public class RoomEffectView extends FrameLayout {
|
||||
isSvgaPlaying = false;
|
||||
binding.roomCarSvga.setVisibility(View.GONE);
|
||||
}
|
||||
},null);
|
||||
}, null);
|
||||
} catch (MalformedURLException e) {
|
||||
e.printStackTrace();
|
||||
isSvgaPlaying = false;
|
||||
|
Reference in New Issue
Block a user