新增贵族特权:隐身进房和进房特效

This commit is contained in:
huangjian
2022-04-27 18:43:11 +08:00
parent 7dd7161e35
commit 0266356a0c
11 changed files with 188 additions and 37 deletions

View File

@@ -1261,6 +1261,10 @@
android:name=".vip.VipMainActivity"
android:screenOrientation="portrait" />
<activity
android:name=".vip.VipSettingActivity"
android:screenOrientation="portrait" />
<!--com.yizhuan.xchat_android_core.skill-->
<activity
android:name=".skill.activity.AddSkillActivity"

View File

@@ -123,6 +123,7 @@ import com.yizhuan.xchat_android_core.community.attachment.DynamicSysAttachment;
import com.yizhuan.xchat_android_core.community.event.SquareTaskEvent;
import com.yizhuan.xchat_android_core.community.event.UnReadCountEvent;
import com.yizhuan.xchat_android_core.home.bean.MainTabType;
import com.yizhuan.xchat_android_core.home.event.RefreshHomeDataEvent;
import com.yizhuan.xchat_android_core.home.event.VisitorUnreadCountEvent;
import com.yizhuan.xchat_android_core.community.im.WorldDynamicAttachment;
import com.yizhuan.xchat_android_core.home.model.GameHomeModel;
@@ -194,8 +195,12 @@ import org.jetbrains.annotations.NotNull;
import java.lang.ref.WeakReference;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.TimeUnit;
import io.flutter.embedding.android.FlutterFragment;
import io.reactivex.Observable;
import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.functions.Consumer;
import static com.yizhuan.xchat_android_core.channel_page.model.ChannelPageModel.KEY_FLAG_VALID_CHANNEL_PAGE;
@@ -297,6 +302,7 @@ public class MainActivity extends BaseMvpActivity<IMainView, MainPresenter>
mCurrentTabType = savedInstanceState.getInt(Constants.KEY_MAIN_POSITION);
}
@SuppressLint("CheckResult")
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
@@ -325,6 +331,11 @@ public class MainActivity extends BaseMvpActivity<IMainView, MainPresenter>
EventBus.getDefault().register(this);
otherModelInit();
Observable.interval(15, TimeUnit.SECONDS)
.compose(bindToLifecycle())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(aLong -> EventBus.getDefault().post(new RefreshHomeDataEvent()));
}
private void otherModelInit() {

View File

@@ -33,8 +33,6 @@ import com.opensource.svgaplayer.SVGADynamicEntity;
import com.opensource.svgaplayer.SVGAImageView;
import com.opensource.svgaplayer.SVGAParser;
import com.opensource.svgaplayer.SVGAVideoEntity;
import com.tencent.qgame.animplayer.AnimConfig;
import com.tencent.qgame.animplayer.inter.IAnimListener;
import com.yizhuan.erban.R;
import com.yizhuan.erban.avroom.activity.AVRoomActivity;
import com.yizhuan.erban.avroom.helper.AnimHelper;
@@ -62,7 +60,7 @@ import com.yizhuan.xchat_android_core.room.bean.DatingAllNotifyInfo;
import com.yizhuan.xchat_android_core.room.bean.DatingNotifyInfo;
import com.yizhuan.xchat_android_core.super_admin.util.SuperAdminUtil;
import com.yizhuan.xchat_android_core.user.UserModel;
import com.yizhuan.xchat_android_core.utils.LogUtils;
import com.yizhuan.xchat_android_core.user.bean.UserInfo;
import com.yizhuan.xchat_android_core.utils.StringExtensionKt;
import com.yizhuan.xchat_android_library.utils.ListUtils;
@@ -451,6 +449,7 @@ public class RoomEffectView extends FrameLayout {
private void showMemberInNotify(ChatRoomMessage chatRoomMessage) {
ChatRoomNotificationAttachment attachment = (ChatRoomNotificationAttachment) chatRoomMessage.getAttachment();
Map<String, Object> remoteExtension = chatRoomMessage.getRemoteExtension();
if (remoteExtension == null) return;
int experLevelSeq = (int) remoteExtension.get("experLevelSeq");
List<String> targetNicks = attachment.getTargetNicks();
if (ListUtils.isListEmpty(targetNicks)) {
@@ -475,7 +474,18 @@ public class RoomEffectView extends FrameLayout {
}
text.append(enterText, new ForegroundColorSpan(Color.WHITE));
textView.setText(text.build());
playMemberInAnim("" + StringExtensionKt.subAndReplaceDot(targetNicks.get(0), 7) + "" + enterText, memberInSvgaPath(experLevelSeq));
String enterRoomEffects = "";
if (remoteExtension.containsKey(UserInfo.ENTER_ROOM_EFFECTS)) {
enterRoomEffects = (String) remoteExtension.get(UserInfo.ENTER_ROOM_EFFECTS);
}
String wrapNick = "" + StringExtensionKt.subAndReplaceDot(targetNicks.get(0), 7) + "" + enterText;
if (!TextUtils.isEmpty(enterRoomEffects)) {
playMemberInAnimByUrl(wrapNick, enterRoomEffects);
} else {
playMemberInAnimByPath(wrapNick, memberInSvgaPath(experLevelSeq));
}
}
private String memberInSvgaPath(int level) {
@@ -498,31 +508,11 @@ public class RoomEffectView extends FrameLayout {
return path;
}
private void playMemberInAnim(String text, String path) {
private void playMemberInAnimByPath(final String text, final String path) {
SVGAParser.Companion.shareParser().decodeFromAssets(path, new SVGAParser.ParseCompletion() {
@Override
public void onComplete(@Nullable SVGAVideoEntity svgaVideoEntity) {
binding.roomMenberInSvga.setVisibility(View.VISIBLE);
binding.roomMenberInSvga.setLoops(1);
binding.roomMenberInSvga.setClearsAfterStop(true);
SVGADynamicEntity dynamicEntity = new SVGADynamicEntity();
TextPaint textPaint = new TextPaint();
textPaint.setColor(Color.WHITE);//字体颜色
textPaint.setTextSize(22);//字体大小
dynamicEntity.setDynamicText(new StaticLayout(
text,
0,
text.length(),
textPaint,
0,
Layout.Alignment.ALIGN_NORMAL,
1.0f,
0.0f,
false
), "room_text");
SVGADrawable drawable = new SVGADrawable(svgaVideoEntity, dynamicEntity);
binding.roomMenberInSvga.setImageDrawable(drawable);
binding.roomMenberInSvga.stepToFrame(0, true);
playMemberInAnim(text, svgaVideoEntity);
}
@Override
@@ -532,6 +522,48 @@ public class RoomEffectView extends FrameLayout {
}, null);
}
private void playMemberInAnimByUrl(String text, String url) {
try {
SVGAParser.Companion.shareParser().decodeFromURL(new URL(url), new SVGAParser.ParseCompletion() {
@Override
public void onComplete(@Nullable SVGAVideoEntity svgaVideoEntity) {
playMemberInAnim(text, svgaVideoEntity);
}
@Override
public void onError() {
}
}, null);
} catch (MalformedURLException e) {
e.printStackTrace();
}
}
private void playMemberInAnim(String text, @Nullable SVGAVideoEntity svgaVideoEntity) {
binding.roomMenberInSvga.setVisibility(View.VISIBLE);
binding.roomMenberInSvga.setLoops(1);
binding.roomMenberInSvga.setClearsAfterStop(true);
SVGADynamicEntity dynamicEntity = new SVGADynamicEntity();
TextPaint textPaint = new TextPaint();
textPaint.setColor(Color.WHITE);//字体颜色
textPaint.setTextSize(22);//字体大小
dynamicEntity.setDynamicText(new StaticLayout(
text,
0,
text.length(),
textPaint,
0,
Layout.Alignment.ALIGN_NORMAL,
1.0f,
0.0f,
false
), "room_text");
SVGADrawable drawable = new SVGADrawable(svgaVideoEntity, dynamicEntity);
binding.roomMenberInSvga.setImageDrawable(drawable);
binding.roomMenberInSvga.stepToFrame(0, true);
}
/**
* 升级飘屏

View File

@@ -68,12 +68,6 @@ class HomeFragment : BaseFragment(), View.OnClickListener,
@SuppressLint("CheckResult")
override fun initiate() {
initTitleTab()
Observable.interval(15, TimeUnit.SECONDS)
.compose(bindToLifecycle())
.observeOn(AndroidSchedulers.mainThread())
.subscribe {
EventBus.getDefault().post(RefreshHomeDataEvent())
}
}
/**

View File

@@ -77,6 +77,12 @@ class VipMainActivity : BaseViewBindingActivity<ActivityVipMainBinding>(),
}
})
mTitleBar.addAction(object : TitleBar.ImageAction(R.drawable.ic_vip_setting) {
override fun performAction(view: View) {
VipSettingActivity.start(this@VipMainActivity)
}
})
binding.ivTimeHelp.setOnClickListener {
VipRemainTimeDialog.newInstance().show(this)
}

View File

@@ -0,0 +1,50 @@
package com.yizhuan.erban.vip
import android.annotation.SuppressLint
import android.content.Context
import android.content.Intent
import androidx.activity.viewModels
import com.netease.nim.uikit.StatusBarUtil
import com.yizhuan.erban.R
import com.yizhuan.erban.base.BaseViewBindingActivity
import com.yizhuan.erban.databinding.ActivityVipSettingBinding
class VipSettingActivity : BaseViewBindingActivity<ActivityVipSettingBinding>() {
companion object {
@JvmStatic
fun start(context: Context) {
val starter = Intent(context, VipSettingActivity::class.java)
context.startActivity(starter)
}
}
private val vipViewModel: VipViewModel by viewModels()
@SuppressLint("SetTextI18n")
override fun init() {
initWhiteTitleBar("贵族设置")
}
override fun initWhiteTitleBar(title: String?) {
mTitleBar = findViewById(R.id.title_bar)
if (mTitleBar != null) {
mTitleBar.setTitle(title)
mTitleBar.setImmersive(false)
mTitleBar.setTitleColor(resources.getColor(R.color.white))
mTitleBar.setLeftImageResource(R.drawable.arrow_left_white)
mTitleBar.setCommonBackgroundColor(resources.getColor(R.color.transparent))
mTitleBar.setLeftClickListener { onLeftClickListener() }
}
}
override fun needSteepStateBar() = true
override fun setStatusBar() {
super.setStatusBar()
StatusBarUtil.transparencyBar(this)
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

View File

@@ -0,0 +1,41 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#232017"
android:orientation="vertical">
<com.yizhuan.erban.base.TitleBar
android:id="@+id/title_bar"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="40dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/tv_hide_go_room"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="15dp"
android:layout_marginTop="8dp"
android:text="隐身进房"
android:textColor="@color/white"
android:textSize="14sp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/title_bar" />
<com.yizhuan.xchat_android_library.widget.IOSSwitchView
android:id="@+id/switch_hide_go_room"
android:layout_width="32dp"
android:layout_height="16dp"
android:layout_marginEnd="15dp"
app:layout_constraintBottom_toBottomOf="@id/tv_hide_go_room"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="@id/tv_hide_go_room" />
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@@ -833,12 +833,11 @@ public final class IMNetEaseManager {
}
} else if (second == CUSTOM_MSG_UPDATE_ROOM_INFO_NOTICE) {
addMessages(msg);
}
else if (second == CUSTOM_MSG_UPDATE_ROOM_INFO_CLEAN_SCREEN) {
noticeRoomEvent(msg,RoomEvent.ROOM_CLEAN_SCREEN);
} else if (second == CUSTOM_MSG_UPDATE_ROOM_INFO_CLEAN_SCREEN) {
noticeRoomEvent(msg, RoomEvent.ROOM_CLEAN_SCREEN);
AvRoomDataManager.get().chatRoomDataRelease(true);
addMessages(msg);
}else {
} else {
noticeUpdateRoomInfo((CustomAttachment) attachment);
}
break;
@@ -1471,6 +1470,11 @@ public final class IMNetEaseManager {
if (extensionDataMap.containsKey("experLevelSeq")) {
experLevelSeq = (int) extensionDataMap.get("experLevelSeq");
}
String enterRoomEffects = "";
if (extensionDataMap.containsKey(UserInfo.ENTER_ROOM_EFFECTS)) {
enterRoomEffects = (String) extensionDataMap.get(UserInfo.ENTER_ROOM_EFFECTS);
}
Map<String, Object> remoteExtension = msg.getRemoteExtension();
if (remoteExtension == null) {
remoteExtension = new HashMap<>();
@@ -1479,8 +1483,8 @@ public final class IMNetEaseManager {
remoteExtension.put("fromType", fromType);
remoteExtension.put("fromNick", fromNick);
remoteExtension.put("fromUid", fromUid);
remoteExtension.put("experLevelSeq", experLevelSeq);
remoteExtension.put(UserInfo.ENTER_ROOM_EFFECTS, enterRoomEffects);
msg.setRemoteExtension(remoteExtension);
}
}

View File

@@ -14,6 +14,7 @@ import com.yizhuan.xchat_android_core.decoration.car.bean.CarInfo;
import com.yizhuan.xchat_android_core.decoration.headwear.bean.HeadWearInfo;
import com.yizhuan.xchat_android_core.level.UserLevelVo;
import com.yizhuan.xchat_android_core.noble.NobleInfo;
import com.yizhuan.xchat_android_core.noble.NobleResourceType;
import com.yizhuan.xchat_android_core.utils.StarUtils;
import com.yizhuan.xchat_android_core.vip.UserVipInfo;
@@ -48,6 +49,7 @@ public class UserInfo implements Serializable {
public static String NAMEPLATE_WORD = "inRoomNameplateWord";
public static String NAMEPLATE_PIC = "inRoomNameplatePic";
public static String VIP_ICON = "vipIcon";
public static String ENTER_ROOM_EFFECTS = "enterRoomEffects";
public static String BUBBLE_URL_ANDROID = "androidBubbleUrl";
public static String BUBBLE_URL_IOS = "iosBubbleUrl";
public static String AT_UIDS = "atUids";
@@ -592,6 +594,10 @@ public class UserInfo implements Serializable {
UserVipInfo userVipInfo = userInfo.getUserVipInfoVO();
if (userVipInfo != null && !TextUtils.isEmpty(userVipInfo.getVipIcon())) {
map.put(VIP_ICON, userVipInfo.getVipIcon());
map.put(NobleResourceType.KEY_ENTER_HIDE, userVipInfo.getEnterHide() ? 1 : 0);
if (!TextUtils.isEmpty(userVipInfo.getEnterRoomEffects())) {
map.put(ENTER_ROOM_EFFECTS, userVipInfo.getEnterRoomEffects());
}
}
if (!TextUtils.isEmpty(androidBubbleUrl)) {

View File

@@ -6,4 +6,7 @@ data class UserVipInfo(
val vipIcon: String = "",
val vipLevel: Int = 0,
val friendNickColour: String = "",
val preventKick: Boolean = false,
val enterHide: Boolean = false,
val enterRoomEffects: String = ""
) : Serializable