直播间UI调整,修改悬浮

This commit is contained in:
18401019693 2022-10-26 15:28:03 +08:00
parent af7a8965a7
commit 787d50c5b4
11 changed files with 52 additions and 89 deletions

View File

@ -1,5 +1,6 @@
package com.yunbao.common.manager; package com.yunbao.common.manager;
import android.app.Activity;
import android.content.Context; import android.content.Context;
import android.os.Handler; import android.os.Handler;
import android.text.TextUtils; import android.text.TextUtils;
@ -7,6 +8,7 @@ import android.text.TextUtils;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import com.google.gson.Gson; import com.google.gson.Gson;
import com.lzf.easyfloat.EasyFloat;
import com.yunbao.common.bean.IMLoginModel; import com.yunbao.common.bean.IMLoginModel;
import com.yunbao.common.event.DataUserInfoEvent; import com.yunbao.common.event.DataUserInfoEvent;
import com.yunbao.common.http.HttpCallback; import com.yunbao.common.http.HttpCallback;
@ -15,6 +17,7 @@ import com.yunbao.common.manager.base.BaseCacheManager;
import com.yunbao.common.manager.imrongcloud.MessageIMManager; import com.yunbao.common.manager.imrongcloud.MessageIMManager;
import com.yunbao.common.manager.imrongcloud.RongcloudIMManager; import com.yunbao.common.manager.imrongcloud.RongcloudIMManager;
import com.yunbao.common.utils.SpUtil; import com.yunbao.common.utils.SpUtil;
import com.yunbao.common.views.floatingview.APPEasyFloat;
import org.greenrobot.eventbus.EventBus; import org.greenrobot.eventbus.EventBus;
@ -287,23 +290,26 @@ public class IMLoginManager extends BaseCacheManager {
/** /**
* 退出登录 * 退出登录
*/ */
public void logout() { public void logout(Activity activity) {
//删除用户登录信息 //删除用户登录信息
deleteByKey(KEY_USER_INFO); deleteByKey(KEY_USER_INFO);
deleteByKey(isNewUserGif); deleteByKey(isNewUserGif);
deleteByKey(isNewUserOne); deleteByKey(isNewUserOne);
//清理指导员信息 //清理指导员信息
NoviceInstructorManager.get(context).deleteOfLogin(); NoviceInstructorManager.get(activity).deleteOfLogin();
//用户对象置空 //用户对象置空
userInfo = null; userInfo = null;
manager = null; manager = null;
//删除私聊对话 //删除私聊对话
// IMCenter.getInstance().clearConversations(null, Conversation.ConversationType.PRIVATE); // IMCenter.getInstance().clearConversations(null, Conversation.ConversationType.PRIVATE);
RongcloudIMManager.logoutIM(); RongcloudIMManager.logoutIM();
MessageIMManager.get(context).logout(); MessageIMManager.get(activity).logout();
put(IS_HINT, 0); put(IS_HINT, 0);
APPEasyFloat.getInstance().dismiss(activity);
if (EasyFloat.isShow("LiveFloatView")) {
EasyFloat.dismiss("LiveFloatView", true);
}
} }
/** /**

Binary file not shown.

Before

Width:  |  Height:  |  Size: 91 KiB

After

Width:  |  Height:  |  Size: 81 KiB

View File

@ -628,22 +628,7 @@ public class LiveRyAnchorActivity extends LiveActivity implements LiveFunctionCl
mLiveRoomViewHolder.initHourRankList(); mLiveRoomViewHolder.initHourRankList();
} }
mLiveRoomViewHolder.startAnchorLight(); mLiveRoomViewHolder.startAnchorLight();
//心愿单
LiveHttpUtil.getWishList(mLiveUid, new HttpCallback() {
@Override
public void onSuccess(int code, String msg, String[] info) {
if (info.length > 0) {
String json = info[0];
WishlistModel model = GsonUtils.fromJson(json, WishlistModel.class);
if (mLiveRoomViewHolder != null && model != null) {
mLiveRoomViewHolder.initWishList(model.getWishlist());
}
}
}
@Override
public void onFinish() {
}
});
} }
if (mLiveAnchorViewHolder == null) { if (mLiveAnchorViewHolder == null) {
mLiveAnchorViewHolder = new LiveRyAnchorViewHolder(mContext, mContainer); mLiveAnchorViewHolder = new LiveRyAnchorViewHolder(mContext, mContainer);

View File

@ -387,32 +387,9 @@ public class LiveAudienceViewHolder extends AbsLiveViewHolder {
LiveRoomViewHolder.insertChat(lvBean2, 1); LiveRoomViewHolder.insertChat(lvBean2, 1);
} }
}, 10000);//3秒后执行Runnable中的run方法 }, 10000);//3秒后执行Runnable中的run方法
getNewPeopleInfo(false);
} }
public void getNewPeopleInfo(boolean show) {
API.get().pdLiveApi(mContext)
.getNewPeopleInfo()
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(stringResponseModel -> {
NewPeopleInfo peopleInfo = stringResponseModel.getData().getInfo();
if (peopleInfo.getIsShow()) {
liveNewPeople.setVisibility(View.VISIBLE);
if (peopleInfo.getLink().startsWith("http")) {
newPeopleUrl = peopleInfo.getLink() + "?";
} else {
newPeopleUrl = CommonAppConfig.HOST + "/" + peopleInfo.getLink();
}
setUserPreferentialRedDot(peopleInfo.getShowRed() == 1);
if (show) {
openNewPeopleDialog();
}
} else {
liveNewPeople.setVisibility(View.GONE);
}
}, Throwable::printStackTrace).isDisposed();
}
@Override @Override
public void onClick(View v) { public void onClick(View v) {
@ -448,7 +425,7 @@ public class LiveAudienceViewHolder extends AbsLiveViewHolder {
*/ */
public void openNewPeopleDialog() { public void openNewPeopleDialog() {
if (newPeopleUrl == null) { if (newPeopleUrl == null) {
getNewPeopleInfo(true); // getNewPeopleInfo(true);
return; return;
} }
Bundle bundle = new Bundle(); Bundle bundle = new Bundle();

View File

@ -1463,16 +1463,19 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
* @param giftCount 礼物数量 * @param giftCount 礼物数量
*/ */
public void updataWishList(String giftId, int giftCount) { public void updataWishList(String giftId, int giftCount) {
for (WishlistItemModel model : wishlist) { if (!(mContext instanceof LiveAudienceActivity)){
if (TextUtils.equals(giftId, model.getLid())) { for (WishlistItemModel model : wishlist) {
int number = Integer.parseInt(model.getWishlistProgress()) + giftCount; if (TextUtils.equals(giftId, model.getLid())) {
model.setWishlistProgress(String.valueOf(number)); int number = Integer.parseInt(model.getWishlistProgress()) + giftCount;
model.setWishlistProgress(String.valueOf(number));
}
} }
if (wishListLayout != null) {
wishListLayout.removeAllViews();
}
initWishList(wishlist);
} }
if (wishListLayout != null) {
wishListLayout.removeAllViews();
}
initWishList(wishlist);
} }
//点击头像 //点击头像

View File

@ -117,7 +117,7 @@
</LinearLayout> </LinearLayout>
<RelativeLayout <LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="45dp" android:layout_height="45dp"
android:layout_alignParentBottom="true"> android:layout_alignParentBottom="true">
@ -237,7 +237,7 @@
android:src="@mipmap/icon_live_red_pack" android:src="@mipmap/icon_live_red_pack"
android:visibility="gone" /> android:visibility="gone" />
<!--聊天-->
<LinearLayout <LinearLayout
android:id="@+id/message_layout" android:id="@+id/message_layout"
android:layout_width="84dp" android:layout_width="84dp"
@ -288,13 +288,12 @@
</LinearLayout> </LinearLayout>
<!--消息中心-->
<RelativeLayout <RelativeLayout
android:id="@+id/msg_view" android:id="@+id/msg_view"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_centerVertical="true" android:layout_marginStart="9dp">
android:layout_toEndOf="@id/message_layout">
<RelativeLayout <RelativeLayout
android:id="@+id/rt_msg" android:id="@+id/rt_msg"
@ -341,42 +340,25 @@
android:visibility="invisible" /> android:visibility="invisible" />
</RelativeLayout> </RelativeLayout>
<!--普通工具合集-->
<ImageView <ImageView
android:id="@+id/total_image" android:id="@+id/total_image"
android:layout_width="40dp" android:layout_width="40dp"
android:layout_height="40dp" android:layout_height="40dp"
android:layout_centerVertical="true" android:layout_marginStart="13dp"
android:layout_toEndOf="@+id/msg_view"
android:padding="5dp" android:padding="5dp"
android:src="@mipmap/live_icon_more" /> android:src="@mipmap/live_icon_more" />
<View
<ImageView android:layout_width="0dp"
android:id="@+id/gift_image" android:layout_height="1dp"
android:layout_width="38dp" android:layout_weight="1" />
android:layout_height="38dp" <!--新人特惠-->
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:layout_marginEnd="10dp"
android:layout_marginBottom="5dp"
android:src="@mipmap/live_lw" />
<ImageView
android:id="@+id/live_new_people1"
android:layout_width="40dp"
android:layout_height="40dp"
android:layout_centerVertical="true"
android:layout_toStartOf="@id/gift_image"
android:padding="4dp"
android:src="@mipmap/live_icon_newpeople_en"
android:visibility="gone" />
<RelativeLayout <RelativeLayout
android:layout_width="40dp" android:layout_width="40dp"
android:layout_height="40dp" android:layout_height="40dp"
android:layout_centerVertical="true" android:layout_marginEnd="13dp"
android:layout_toStartOf="@id/gift_image" android:visibility="gone"
android:padding="4dp"> android:padding="4dp">
<ImageView <ImageView
@ -397,7 +379,17 @@
android:background="@drawable/background_ff5075" android:background="@drawable/background_ff5075"
android:visibility="invisible" /> android:visibility="invisible" />
</RelativeLayout> </RelativeLayout>
</RelativeLayout> <!--礼物-->
<ImageView
android:id="@+id/gift_image"
android:layout_width="38dp"
android:layout_height="38dp"
android:layout_marginEnd="8dp"
android:layout_marginBottom="5dp"
android:src="@mipmap/live_lw" />
</LinearLayout>
<com.opensource.svgaplayer.SVGAImageView <com.opensource.svgaplayer.SVGAImageView

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 9.0 KiB

View File

@ -181,7 +181,7 @@ public class EntryActivity extends AppCompatActivity {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
setContentView(R.layout.activity_entry); setContentView(R.layout.activity_entry);
if (getIntent().getBooleanExtra("forwardEntry", false)) { if (getIntent().getBooleanExtra("forwardEntry", false)) {
IMLoginManager.get(this).logout(); IMLoginManager.get(this).logout(this);
ToastUtil.show(R.string.login_invalid); ToastUtil.show(R.string.login_invalid);
} }
Get_hash_key(); Get_hash_key();

View File

@ -38,7 +38,7 @@ public class LoginInvalidActivity extends AbsActivity implements View.OnClickLis
public void onClick(View v) { public void onClick(View v) {
EventBus.getDefault().post(new LoginInvalidEvent()); EventBus.getDefault().post(new LoginInvalidEvent());
CommonAppConfig.getInstance().clearLoginInfo(); CommonAppConfig.getInstance().clearLoginInfo();
IMLoginManager.get(this).logout(); IMLoginManager.get(this).logout(this);
LoginActivity.forward(); LoginActivity.forward();
finish(); finish();
} }

View File

@ -1191,7 +1191,7 @@ public class MainActivity extends AbsActivity implements MainAppBarLayoutListene
*/ */
@Subscribe(threadMode = ThreadMode.MAIN) @Subscribe(threadMode = ThreadMode.MAIN)
public void userSignOut(RongIMConnectionStatusEvent model) { public void userSignOut(RongIMConnectionStatusEvent model) {
IMLoginManager.get(mContext).logout(); IMLoginManager.get(mContext).logout(this);
CommonAppConfig.getInstance().clearLoginInfo(); CommonAppConfig.getInstance().clearLoginInfo();
LoginActivity.forward(); LoginActivity.forward();
} }

View File

@ -312,7 +312,7 @@ public class SettingActivity extends AbsActivity implements OnItemClickListener<
* 退出登录 * 退出登录
*/ */
private void logout() { private void logout() {
IMLoginManager.get(this).logout(); IMLoginManager.get(this).logout(this);
CommonAppConfig.getInstance().clearLoginInfo(); CommonAppConfig.getInstance().clearLoginInfo();
RCRTCEngine.getInstance().unInit(); RCRTCEngine.getInstance().unInit();
RongIMClient.getInstance().logout(); RongIMClient.getInstance().logout();