Merge branch 'master' into dev_live_new_user_icon

This commit is contained in:
zlzw 2022-08-23 18:03:46 +08:00
commit 5444b309e0
12 changed files with 172 additions and 70 deletions

View File

@ -32,9 +32,9 @@ import static com.yunbao.common.CommonAppContext.isReady;
*/
public class RongcloudIMManager {
//融云开发者平台注册app唯一识别符
// public static final String RONG_IM_KEY = "uwd1c0sxu1p71";
public static final String RONG_IM_KEY = "uwd1c0sxu1p71";
//测试环境
public static final String RONG_IM_KEY = "pvxdm17jpd3hr";
// public static final String RONG_IM_KEY = "pvxdm17jpd3hr";
private static final String CLASSNAME = "RongcloudIMManager";

View File

@ -29,7 +29,6 @@ import com.yunbao.common.bean.IMLoginModel;
import com.yunbao.common.bean.UserBean;
import com.yunbao.common.dialog.EffectsSettingsDialog;
import com.yunbao.common.dialog.LiveChargeDialogFragment;
import com.yunbao.live.dialog.LiveTotalDialog;
import com.yunbao.common.http.CommonHttpConsts;
import com.yunbao.common.http.CommonHttpUtil;
import com.yunbao.common.http.HttpCallback;
@ -52,6 +51,7 @@ import com.yunbao.live.dialog.LiveGiftDialogFragment;
import com.yunbao.live.dialog.LiveGuardDialogFragment;
import com.yunbao.live.dialog.LiveHDDialogFragment;
import com.yunbao.live.dialog.LiveMicUserDialogFragment;
import com.yunbao.live.dialog.LiveTotalDialog;
import com.yunbao.live.dialog.LiveWishListDialogFragment4Audience;
import com.yunbao.live.dialog.SidebarLiveAudience;
import com.yunbao.live.event.LinkMicTxAccEvent;
@ -63,6 +63,7 @@ import com.yunbao.live.presenter.LiveRoomCheckLivePresenter;
import com.yunbao.live.socket.SocketSendBean;
import com.yunbao.live.utils.LiveImDeletUtil;
import com.yunbao.live.views.LiveRoomPlayViewHolder;
import com.yunbao.live.views.LoadingView;
import com.yunbao.live.views.PortraitLiveManager;
import org.greenrobot.eventbus.Subscribe;
@ -119,6 +120,7 @@ public class LiveAudienceActivity extends LiveActivity {
private int mLastPosition = -1;
private ViewGroup mViewGroup;
private LoadingView loadingView;
@Override
@ -147,7 +149,11 @@ public class LiveAudienceActivity extends LiveActivity {
mLiveBean = intent.getParcelableExtra(Constants.LIVE_BEAN);
mLiveUid = mLiveBean.getUid();
mStream = mLiveBean.getStream();
if (getIntent().getIntExtra("isry", 0) == 1) {
isRy = true;
} else {
isRy = false;
}
setVolumeControlStream(AudioManager.STREAM_MUSIC);
manager = new PortraitLiveManager(this, intent);
initView();
@ -160,7 +166,8 @@ public class LiveAudienceActivity extends LiveActivity {
private void initView() {
// 竖直滑动 ViewPager
verticalViewPager = findViewById(R.id.view_pager);
loadingView = findViewById(R.id.loading);
loadingView.show();
}
public void setBackIndex(int backIndex) {
@ -202,6 +209,7 @@ public class LiveAudienceActivity extends LiveActivity {
}
mPagerAdapter = new VerticalPagerAdapter(itemModelList, mContext);
verticalViewPager.setAdapter(mPagerAdapter);
loadingView.hide();
}
@Override
@ -298,6 +306,7 @@ public class LiveAudienceActivity extends LiveActivity {
mLiveUid = mLiveBean.getUid();
mStream = mLiveBean.getStream();
mAncherName = liveBean.getUserNiceName();
Log.e("收到socket--->", "mLiveUid--------------------------->" + mLiveUid);
//加载当前页面数据
View rootView = manager.getRootView();

View File

@ -3,12 +3,9 @@ package com.yunbao.live.adapter;
import android.annotation.SuppressLint;
import android.content.Context;
import android.os.Bundle;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.GridLayoutManager;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import android.text.Spannable;
import android.text.SpannableStringBuilder;
import android.text.TextUtils;
import android.text.style.ForegroundColorSpan;
import android.view.LayoutInflater;
import android.view.View;
@ -17,6 +14,11 @@ import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.GridLayoutManager;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import com.makeramen.roundedimageview.RoundedImageView;
import com.yunbao.common.CommonAppConfig;
import com.yunbao.common.Constants;
@ -278,23 +280,46 @@ public class LiveChatAdapter extends RecyclerView.Adapter {
mTextView.setText(builder);
} else if (bean.getType() == -10) {
mBg.setBackground(null);
// mTextView.setVisibility(View.GONE);
} else if (bean.getType() == LiveChatBean.SYSTEM) {
boolean isContains = false;
for (LiveChatBean model : mList) {
if (!TextUtils.isEmpty(model.getContent())&&model.getContent().contains("堅決維護青少年群體精神文明健康")) {
isContains = true;
}
}
if (isContains) {
mTextView.setTextColor(0xffffffff);
mBg.setBackground(null);
mTextView.setText(bean.getContent());
}
} else if (bean.getType() == -1) {//自动消息关注
boolean isContains = false;
for (LiveChatBean model : mList) {
if (bean.getType() == -1) {
isContains = true;
}
}
if (isContains) {
mBg.setBackground(null);
mTextView.setVisibility(View.GONE);
view_follow.setVisibility(View.VISIBLE);
ImgLoader.display(mContext, bean.getId(), avatar);
bean.setHeart(position);
}
} else if (bean.getType() == -2) {//自动消息点击发言
boolean isContains = false;
for (LiveChatBean model : mList) {
if (bean.getType() == -2) {
isContains = true;
}
}
if (isContains) {
mBg.setBackgroundResource(R.drawable.bg_chat_automatic_item);
mTextView.setText(R.string.automatic_chat);
bean.setHeart(position);
}
} else {
// LoadDian9TuUtil.loadDian9Tu(mContext, mBg, "https://qny.shayucm.com/huangdi-new-qipao.png");
if (bean.getBubble() != null && !bean.getBubble().equals("")) {
//加载.9图聊天气泡
LoadDian9TuUtil.loadDian9Tu(mContext, mBg, bean.getBubble(), 1);
@ -306,23 +331,7 @@ public class LiveChatAdapter extends RecyclerView.Adapter {
} else {
mTextView.setTextColor(0xffffffff);
}
// Log.e("tag",bean.getContent().length()+"");
// RecyclerView.LayoutParams linearParams = (RecyclerView.LayoutParams) mBg.getLayoutParams();
// linearParams.height = RecyclerView.LayoutParams.WRAP_CONTENT;
// // 控件的宽强制设成40
// mBg.setLayoutParams(linearParams); //使设置好的布局参数应用到控件
// if(bean.getContent().length()<=7) {
// RecyclerView.LayoutParams linearParams1 = (RecyclerView.LayoutParams) mBg.getLayoutParams();
// linearParams1.height = mContext.getResources().getDimensionPixelOffset(R.dimen.live_chat1);
// // 控件的宽强制设成40
// mBg.setLayoutParams(linearParams1); //使设置好的布局参数应用到控件
// }
// else if(bean.getContent().length()<=20){
// RecyclerView.LayoutParams linearParams = (RecyclerView.LayoutParams) mBg.getLayoutParams();
// linearParams.height = mContext.getResources().getDimensionPixelOffset(R.dimen.live_chat2);
// // 控件的宽强制设成40
// mBg.setLayoutParams(linearParams); //使设置好的布局参数应用到控件
// }
LiveTextRender.render(mContext, mTextView, bean);
}
}

View File

@ -5,7 +5,6 @@ import android.os.Parcelable;
import android.text.TextUtils;
import com.alibaba.fastjson.annotation.JSONField;
import com.google.gson.annotations.SerializedName;
import com.yunbao.common.bean.WeekListBean;
import com.yunbao.common.utils.WordUtil;
import com.yunbao.live.R;
@ -203,6 +202,7 @@ public class LiveBean implements Parcelable {
@JSONField(name = "user_nicename")
public String getUserNiceName() {
return userNiceName;
}
@ -328,6 +328,7 @@ public class LiveBean implements Parcelable {
public String getIslive() {
return islive;
}
public void setIslive(String islive) {
this.islive = islive;
}

View File

@ -1,8 +1,10 @@
package com.yunbao.live.dialog;
import android.os.Build;
import android.os.Bundle;
import android.view.Display;
import android.view.Gravity;
import android.view.View;
import android.view.Window;
import android.view.WindowManager;
import android.widget.ImageView;
@ -134,7 +136,12 @@ public class SidebarLiveAudience extends AbsDialogFragment {
@Override
protected void setWindowAttributes(Window window) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
window.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
window.getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN | View.SYSTEM_UI_FLAG_LAYOUT_STABLE | View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR);
window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
window.setStatusBarColor(0);
}
window.setWindowAnimations(com.yunbao.common.R.style.RightLeftToAnim);
WindowManager.LayoutParams params = window.getAttributes();
params.width = DeviceUtils.getScreenWidth(getActivity()) / 3 * 2;
@ -143,6 +150,8 @@ public class SidebarLiveAudience extends AbsDialogFragment {
window.setAttributes(params);
}
/**
* 前往直播间
*/

View File

@ -31,6 +31,8 @@ public class LiveRoomCheckLivePresenter {
private LiveBean mLiveBean;
private ActionListener mActionListener;
private int mLiveSdk;
//搜索页面不提示密码
public static boolean isSearch = false;
public LiveRoomCheckLivePresenter(Context context, ActionListener actionListener) {
mContext = context;
@ -46,7 +48,6 @@ public class LiveRoomCheckLivePresenter {
}
private HttpCallback mCheckLiveCallback = new HttpCallback() {
@Override
public void onSuccess(int code, String msg, String[] info) {
@ -101,6 +102,7 @@ public class LiveRoomCheckLivePresenter {
* 前往密码房间
*/
private void forwardPwdRoom() {
if (!isSearch) {
DialogUitl.showSimpleInputDialog(mContext, WordUtil.getString(R.string.live_input_password), DialogUitl.INPUT_TYPE_NUMBER_PASSWORD, new DialogUitl.SimpleCallback() {
@Override
public void onConfirmClick(Dialog dialog, String content) {
@ -117,6 +119,11 @@ public class LiveRoomCheckLivePresenter {
}
}
});
}else {
enterLiveRoom();
isSearch = false;
}
}
/**

View File

@ -45,7 +45,6 @@ import com.yunbao.common.CommonAppConfig;
import com.yunbao.common.Constants;
import com.yunbao.common.bean.LevelBean;
import com.yunbao.common.bean.UserBean;
import com.yunbao.live.event.LiveAudienceEvent;
import com.yunbao.common.glide.ImgLoader;
import com.yunbao.common.http.CommonHttpConsts;
import com.yunbao.common.http.CommonHttpUtil;
@ -86,6 +85,7 @@ import com.yunbao.live.custom.TopGradual;
import com.yunbao.live.dialog.LiveFansMedalDialogFragment;
import com.yunbao.live.dialog.LiveHDDialogFragment;
import com.yunbao.live.dialog.LiveUserDialogFragment;
import com.yunbao.live.event.LiveAudienceEvent;
import com.yunbao.live.http.LiveHttpConsts;
import com.yunbao.live.http.LiveHttpUtil;
import com.yunbao.live.presenter.LiveDanmuPresenter;
@ -1025,7 +1025,11 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
*/
public void setName(String name) {
if (mName != null) {
mNameText = name;
if (name.length() > 4) {
name = name.substring(0, 4) + "...";
}
mName.setText(name);
EventBus.getDefault().post("name_true");
}

View File

@ -0,0 +1,61 @@
package com.yunbao.live.views;
import android.content.Context;
import android.graphics.drawable.AnimationDrawable;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.FrameLayout;
import android.widget.ImageView;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import com.yunbao.live.R;
public class LoadingView extends FrameLayout {
private Context mContext;
private ImageView mIvLoading;
public LoadingView(@NonNull Context context) {
super(context);
init(context);
}
public LoadingView(@NonNull Context context, @Nullable AttributeSet attrs) {
super(context, attrs);
init(context);
}
public LoadingView(@NonNull Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
init(context);
}
private void init(Context context) {
this.mContext = context;
View view = LayoutInflater.from(mContext).inflate(R.layout.layout_portrait_live_item, this, true);
mIvLoading = view.findViewById(R.id.iv_loading);
}
public void show() {
// 加载动画
ImageView ivLoading = mIvLoading.findViewById(R.id.iv_loading);
AnimationDrawable frameAnimation = (AnimationDrawable) ivLoading.getBackground();
frameAnimation.start();
setVisibility(VISIBLE);
}
public void hide() {
// 加载动画
ImageView ivLoading = mIvLoading.findViewById(R.id.iv_loading);
AnimationDrawable frameAnimation = (AnimationDrawable) ivLoading.getBackground();
frameAnimation.stop();
setVisibility(GONE);
}
}

View File

@ -9,5 +9,10 @@
android:layout_height="match_parent"
android:overScrollMode="never" />
<com.yunbao.live.views.LoadingView
android:id="@+id/loading"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:visibility="visible" />
</RelativeLayout>

View File

@ -27,7 +27,7 @@
android:layout_height="match_parent"
android:orientation="vertical"
android:paddingStart="8dp"
android:paddingTop="56dp"
android:paddingTop="10dp"
android:paddingEnd="8dp">

View File

@ -303,7 +303,7 @@ public class MainActivity extends AbsActivity implements MainAppBarLayoutListene
Log.d(TAG, token);
PushManager.getInstance()
.onReceiveToken(MainActivity.this, PushType.GOOGLE_FCM, token);
Toast.makeText(MainActivity.this, token, Toast.LENGTH_SHORT).show();
// Toast.makeText(MainActivity.this, token, Toast.LENGTH_SHORT).show();
}
});
boolean showInvite = getIntent().getBooleanExtra(Constants.SHOW_INVITE, false);

View File

@ -18,6 +18,7 @@ import androidx.fragment.app.FragmentTransaction;
import com.alibaba.fastjson.JSON;
import com.yunbao.common.activity.AbsActivity;
import com.yunbao.common.event.CloseEvent;
import com.yunbao.common.http.HttpCallback;
import com.yunbao.common.manager.SearchHistoryRecordManager;
import com.yunbao.common.utils.Bus;
@ -27,7 +28,6 @@ import com.yunbao.live.bean.LiveBean;
import com.yunbao.live.http.LiveHttpUtil;
import com.yunbao.live.presenter.LiveRoomCheckLivePresenter;
import com.yunbao.main.R;
import com.yunbao.common.event.CloseEvent;
import com.yunbao.main.event.JumpUserHomeEvent;
import com.yunbao.main.fragment.SearchRecommendFragment;
import com.yunbao.main.fragment.SearchResultsFragment;
@ -175,16 +175,13 @@ public class SearchActivity extends AbsActivity {
if (code == 0 && info.length > 0) {
LiveBean liveBean = JSON.parseObject(info[0], LiveBean.class);
LiveRoomCheckLivePresenter mCheckLivePresenter = new LiveRoomCheckLivePresenter(mContext, new LiveRoomCheckLivePresenter.ActionListener() {
@Override
public void onLiveRoomChanged(LiveBean liveBean, int liveType, int liveTypeVal, int liveSdk) {
if (liveBean == null) {
LiveRoomCheckLivePresenter.isSearch = true;
LiveRoomCheckLivePresenter mCheckLivePresenter = new LiveRoomCheckLivePresenter(mContext, (liveBean1, liveType, liveTypeVal, liveSdk) -> {
if (liveBean1 == null) {
return;
}
LiveAudienceActivity.forward(mContext, liveBean, liveType, liveTypeVal, "", 0, liveSdk);
LiveAudienceActivity.forward(mContext, liveBean1, liveType, liveTypeVal, "", 0, liveSdk);
}
});
mCheckLivePresenter.checkLive(liveBean);