改版直播准备间UI

修复心愿单多出一个的BUG
This commit is contained in:
zlzw 2022-09-15 11:20:20 +08:00
parent 18069a726d
commit 7ef6c95c63
47 changed files with 2234 additions and 50 deletions

View File

@ -11,6 +11,7 @@ import androidx.annotation.Nullable;
import com.bumptech.glide.Glide; import com.bumptech.glide.Glide;
import com.bumptech.glide.request.RequestOptions; import com.bumptech.glide.request.RequestOptions;
import com.bumptech.glide.request.target.CustomTarget;
import com.bumptech.glide.request.target.SimpleTarget; import com.bumptech.glide.request.target.SimpleTarget;
import com.bumptech.glide.request.transition.Transition; import com.bumptech.glide.request.transition.Transition;
import com.yunbao.common.R; import com.yunbao.common.R;
@ -128,7 +129,8 @@ public class ImgLoader {
if (!contextIsExist(context)) { if (!contextIsExist(context)) {
return; return;
} }
Glide.with(context).asDrawable().load(url).skipMemoryCache(SKIP_MEMORY_CACHE).into(new SimpleTarget<Drawable>() { Glide.with(context).asDrawable().load(url).skipMemoryCache(SKIP_MEMORY_CACHE).into(new CustomTarget<Drawable>() {
@Override @Override
public void onResourceReady(@NonNull Drawable resource, @Nullable Transition<? super Drawable> transition) { public void onResourceReady(@NonNull Drawable resource, @Nullable Transition<? super Drawable> transition) {
if (callback != null) { if (callback != null) {
@ -137,12 +139,29 @@ public class ImgLoader {
} }
@Override @Override
public void onLoadFailed(@Nullable Drawable errorDrawable) { public void onLoadCleared(@Nullable Drawable placeholder) {
}
});
}
public static void displayFileDrawable(Context context, File file, final DrawableCallback callback) {
if (!contextIsExist(context)) {
return;
}
Glide.with(context).asDrawable().load(file).skipMemoryCache(SKIP_MEMORY_CACHE).into(new CustomTarget<Drawable>() {
@Override
public void onResourceReady(@NonNull Drawable resource, @Nullable Transition<? super Drawable> transition) {
if (callback != null) { if (callback != null) {
callback.onLoadFailed(); callback.onLoadSuccess(resource);
} }
} }
@Override
public void onLoadCleared(@Nullable Drawable placeholder) {
}
}); });
} }

View File

@ -35,9 +35,9 @@ import static com.yunbao.common.CommonAppContext.isReady;
*/ */
public class RongcloudIMManager { public class RongcloudIMManager {
//融云开发者平台注册app唯一识别符 //融云开发者平台注册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"; private static final String CLASSNAME = "RongcloudIMManager";

View File

@ -264,7 +264,7 @@
<string name="live_title_hint">Write a title for the live broadcast</string> <string name="live_title_hint">Write a title for the live broadcast</string>
<string name="live_class">channel</string> <string name="live_class">channel</string>
<string name="live_class_choose">Select live channel</string> <string name="live_class_choose">Select live channel</string>
<string name="live_class_tip">Pay attention to the channel that suits you. During the live broadcast, if the operator finds that the selected channel does not match the live content, he / she will adjust your live channel.</string> <string name="live_class_tip">During the live broadcast, if the operator finds that the selected channel does not match the live content, he / she will adjust your live channel.</string>
<string name="live_set_pwd">Please set room password</string> <string name="live_set_pwd">Please set room password</string>
<string name="live_set_fee">Please set the charge amount (the revenue is subject to the end of live broadcast)</string> <string name="live_set_fee">Please set the charge amount (the revenue is subject to the end of live broadcast)</string>
<string name="live_set_pwd_empty">Please set room password</string> <string name="live_set_pwd_empty">Please set room password</string>
@ -872,4 +872,5 @@ Limited ride And limited avatar frame</string>
<string name="current_live_room">You are in the current live room</string> <string name="current_live_room">You are in the current live room</string>
<string name="live_room_air_ticket">has recommended an anchor to you!</string> <string name="live_room_air_ticket">has recommended an anchor to you!</string>
<string name="bonus_message">has sent you a reward, come and get it!</string> <string name="bonus_message">has sent you a reward, come and get it!</string>
<string name="live_class_tip_title">Pay attention to the channel that suits you.</string>
</resources> </resources>

View File

@ -214,7 +214,8 @@
<string name="live_title_hint">給直播寫個標題吧</string> <string name="live_title_hint">給直播寫個標題吧</string>
<string name="live_class">頻道</string> <string name="live_class">頻道</string>
<string name="live_class_choose">選擇直播頻道</string> <string name="live_class_choose">選擇直播頻道</string>
<string name="live_class_tip">注意選擇適合自己的頻道。直播過程中,若運營人員發現選擇的頻道和直播內容不相符的情况,會調整您的直播頻道。</string> <string name="live_class_tip_title">注意選擇適合自己的頻道。</string>
<string name="live_class_tip">直播過程中,若運營人員發現選擇的頻道和直播內容不相符的情况,會調整您的直播頻道。</string>
<string name="live_set_pwd">請設定房間密碼</string> <string name="live_set_pwd">請設定房間密碼</string>
<string name="live_set_fee">請設定收費金額\n收益以直播結束顯示為准</string> <string name="live_set_fee">請設定收費金額\n收益以直播結束顯示為准</string>
<string name="live_set_pwd_empty">請設定房間密碼</string> <string name="live_set_pwd_empty">請設定房間密碼</string>

View File

@ -479,7 +479,9 @@ public class LiveAnchorActivity extends LiveActivity implements LiveFunctionClic
mLiveRoomViewHolder.setName(u.getUserNiceName()); mLiveRoomViewHolder.setName(u.getUserNiceName());
mLiveRoomViewHolder.setAvatar(u.getAvatar()); mLiveRoomViewHolder.setAvatar(u.getAvatar());
mLiveRoomViewHolder.setAnchorLevel(u.getLevelAnchor()); mLiveRoomViewHolder.setAnchorLevel(u.getLevelAnchor());
mLiveRoomViewHolder.setLiveUid(u.getId());
} }
mLiveRoomViewHolder.initHourRankList();
mLiveRoomViewHolder.startAnchorLight(); mLiveRoomViewHolder.startAnchorLight();
} }
if (mLiveAnchorViewHolder == null) { if (mLiveAnchorViewHolder == null) {

View File

@ -47,6 +47,7 @@ import com.yunbao.live.dialog.LiveBeautyDialogFragment;
import com.yunbao.live.dialog.LiveFunctionDialogFragment; import com.yunbao.live.dialog.LiveFunctionDialogFragment;
import com.yunbao.live.dialog.LiveLinkMicListDialogFragment; import com.yunbao.live.dialog.LiveLinkMicListDialogFragment;
import com.yunbao.live.dialog.LiveMicUserDialogFragment; import com.yunbao.live.dialog.LiveMicUserDialogFragment;
import com.yunbao.live.dialog.LiveNewWishListDialogFragment;
import com.yunbao.live.dialog.LiveWishListDialogFragment; import com.yunbao.live.dialog.LiveWishListDialogFragment;
import com.yunbao.live.event.LinkMicTxMixStreamEvent; import com.yunbao.live.event.LinkMicTxMixStreamEvent;
import com.yunbao.live.http.LiveHttpConsts; import com.yunbao.live.http.LiveHttpConsts;
@ -64,8 +65,8 @@ import com.yunbao.live.socket.SocketSendBean;
import com.yunbao.live.views.AbsRyLivePushViewHolder; import com.yunbao.live.views.AbsRyLivePushViewHolder;
import com.yunbao.live.views.LiveEndViewHolder; import com.yunbao.live.views.LiveEndViewHolder;
import com.yunbao.live.views.LiveMusicViewHolder; import com.yunbao.live.views.LiveMusicViewHolder;
import com.yunbao.live.views.LiveNewReadyRyViewHolder;
import com.yunbao.live.views.LivePushRyViewHolder; import com.yunbao.live.views.LivePushRyViewHolder;
import com.yunbao.live.views.LiveReadyRyViewHolder;
import com.yunbao.live.views.LiveRoomViewHolder; import com.yunbao.live.views.LiveRoomViewHolder;
import com.yunbao.live.views.LiveRyAnchorViewHolder; import com.yunbao.live.views.LiveRyAnchorViewHolder;
@ -117,7 +118,7 @@ public class LiveRyAnchorActivity extends LiveActivity implements LiveFunctionCl
private ViewGroup mRoot; private ViewGroup mRoot;
private ViewGroup mContainerWrap; private ViewGroup mContainerWrap;
public static AbsRyLivePushViewHolder mLivePushViewHolder; public static AbsRyLivePushViewHolder mLivePushViewHolder;
public static LiveReadyRyViewHolder mLiveReadyViewHolder; public static LiveNewReadyRyViewHolder mLiveReadyViewHolder;
public static LiveRyAnchorViewHolder mLiveAnchorViewHolder; public static LiveRyAnchorViewHolder mLiveAnchorViewHolder;
private LiveMusicViewHolder mLiveMusicViewHolder; private LiveMusicViewHolder mLiveMusicViewHolder;
private boolean mStartPreview;//是否开始预览 private boolean mStartPreview;//是否开始预览
@ -172,7 +173,7 @@ public class LiveRyAnchorActivity extends LiveActivity implements LiveFunctionCl
mLiveRyLinkMicPkPresenter = new LiveRyLinkMicPkPresenter(mContext, mLivePushViewHolder, true, mContainer); mLiveRyLinkMicPkPresenter = new LiveRyLinkMicPkPresenter(mContext, mLivePushViewHolder, true, mContainer);
//添加开播前设置控件 //添加开播前设置控件
mLiveReadyViewHolder = new LiveReadyRyViewHolder(mContext, mContainer, mLiveSDK); mLiveReadyViewHolder = new LiveNewReadyRyViewHolder(mContext, mContainer, mLiveSDK);
mLiveReadyViewHolder.addToParent(); mLiveReadyViewHolder.addToParent();
mLiveReadyViewHolder.subscribeActivityLifeCycle(); mLiveReadyViewHolder.subscribeActivityLifeCycle();
mLiveLinkMicPresenter = new LiveLinkMicPresenter(mContext, mLivePushViewHolder, true, mLiveSDK, mContainer); mLiveLinkMicPresenter = new LiveLinkMicPresenter(mContext, mLivePushViewHolder, true, mLiveSDK, mContainer);
@ -429,7 +430,7 @@ public class LiveRyAnchorActivity extends LiveActivity implements LiveFunctionCl
* 打开心愿单窗口 * 打开心愿单窗口
*/ */
public void openWishListWindow() { public void openWishListWindow() {
LiveWishListDialogFragment fragment = new LiveWishListDialogFragment(); LiveNewWishListDialogFragment fragment = new LiveNewWishListDialogFragment();
if (mContext instanceof LiveRyAnchorActivity) { if (mContext instanceof LiveRyAnchorActivity) {
fragment.show(((LiveRyAnchorActivity) mContext).getSupportFragmentManager(), "LiveWishListDialogFragment"); fragment.show(((LiveRyAnchorActivity) mContext).getSupportFragmentManager(), "LiveWishListDialogFragment");
} }

View File

@ -0,0 +1,254 @@
package com.yunbao.live.adapter;
import android.app.Dialog;
import android.content.Context;
import android.text.TextUtils;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.ProgressBar;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;
import com.yunbao.common.glide.ImgLoader;
import com.yunbao.common.interfaces.OnItemClickListener;
import com.yunbao.common.utils.DialogUitl;
import com.yunbao.common.utils.StringUtil;
import com.yunbao.common.utils.ToastUtil;
import com.yunbao.live.R;
import com.yunbao.live.bean.LiveWishlistBean;
import java.util.List;
/**
* 直播 心愿单
*/
public class LiveNewWishListAdapter extends RecyclerView.Adapter<LiveNewWishListAdapter.Vh> {
private List<LiveWishlistBean> mWishList;
private LayoutInflater mInflater;
private View.OnClickListener mOnClickListener;
private OnItemClickListener<LiveWishlistBean> mOnItemClickListener;
private Context mContext;
public LiveNewWishListAdapter(Context context, boolean noLink) {
mContext = context;
mInflater = LayoutInflater.from(context);
mOnClickListener = new View.OnClickListener() {
@Override
public void onClick(View v) {
Object tag = v.getTag();
if (tag != null) {
if (mOnItemClickListener != null) {
mOnItemClickListener.onItemClick((LiveWishlistBean) tag, 0);
}
}
}
};
}
public void setData(List<LiveWishlistBean> list) {
mWishList = list;
}
public void setOnItemClickListener(OnItemClickListener<LiveWishlistBean> onItemClickListener) {
mOnItemClickListener = onItemClickListener;
}
@NonNull
@Override
public Vh onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
return new Vh(mInflater.inflate(R.layout.item_new_live_wish_list, parent, false));
}
@Override
public void onBindViewHolder(@NonNull Vh vh, int position) {
vh.setData(mWishList.get(position), position);
}
@Override
public int getItemCount() {
return mWishList.size();
}
class Vh extends RecyclerView.ViewHolder {
ImageView mIcon;
TextView mName;
TextView mNum;
TextView mIncrease;
TextView mDecrease;
View mRlDelete;
ProgressBar pb_wishlist;
TextView tvProgress;
TextView tvWishIndex;
public Vh(View itemView) {
super(itemView);
mIcon = (ImageView) itemView.findViewById(R.id.icon);
mName = (TextView) itemView.findViewById(R.id.name);
mNum = (TextView) itemView.findViewById(R.id.tv_num);
mIncrease = (TextView) itemView.findViewById(R.id.tv_increase);
mDecrease = (TextView) itemView.findViewById(R.id.tv_decrease);
mRlDelete = itemView.findViewById(R.id.iv_delete);
pb_wishlist = itemView.findViewById(R.id.pb_wishlist);
tvProgress = itemView.findViewById(R.id.tvProgress);
tvWishIndex = itemView.findViewById(R.id.tvWishIndex);
itemView.setOnClickListener(mOnClickListener);
}
void setData(LiveWishlistBean bean, int pos) {
itemView.setTag(bean);
ImgLoader.display(mContext, bean.getWishlist_icon(), mIcon);
mName.setText(bean.getWishlist_name());
mNum.setText(bean.getWishlist_num());
int pro = 0;
try {
int num1 = Integer.parseInt(bean.getWishlist_progress());
int num2 = Integer.parseInt(bean.getWishlist_num());
pro = num1 * 100 / num2;
//如果进度大于0则不允许删除该礼物
if (num1 > 0) {
mRlDelete.setVisibility(View.INVISIBLE);
} else {
mRlDelete.setVisibility(View.VISIBLE);
}
} catch (Exception e) {
e.printStackTrace();
}
pb_wishlist.setProgress(pro);
if (bean.getWishlist_num().isEmpty() || bean.getWishlist_progress().isEmpty()) {
tvProgress.setText("");
} else {
tvProgress.setText(bean.getWishlist_progress() + "/" + bean.getWishlist_num());
}
if (pro >= 100) {
tvWishIndex.setText("已达成");
} else {
tvWishIndex.setText("心愿" + getNameByIndex(pos));
}
// tvWishIndex.setText("心愿"+getNameByIndex(pos+1));
decreaseClick(bean);
increaseClick(bean);
numTextClick(bean);
mRlDeleteClick(pos);
}
private String getNameByIndex(int pos) {
String ret = "";
String arr[] = {"", "", "", "", "", "", "", "", "", ""};
try {
ret = arr[pos];
} catch (Exception e) {
e.printStackTrace();
}
return ret;
}
private void mRlDeleteClick(final int pos) {
mRlDelete.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
ToastUtil.show("删除" + mWishList.get(pos).getWishlist_name() + "成功");
mWishList.remove(pos);
notifyDataSetChanged();
}
});
}
private void numTextClick(final LiveWishlistBean bean) {
mNum.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
DialogUitl.showSimpleInputDialog(mContext,
"请输入" + bean.getWishlist_name() + "的数量",
DialogUitl.INPUT_TYPE_NUMBER, 5,
new DialogUitl.SimpleCallback() {
@Override
public void onConfirmClick(Dialog dialog, String content) {
if (TextUtils.isEmpty(content)) {
ToastUtil.show(R.string.live_set_wishlist_num);
} else {
int num;
if (StringUtil.isInt(content)) {
num = Integer.parseInt(content);
if (num <= 0) {
ToastUtil.show("数字必须大于0");
} else {
mNum.setText(num + "");
bean.setWishlist_num(num + "");
}
}
dialog.dismiss();
}
}
});
}
});
}
private void increaseClick(final LiveWishlistBean bean) {
mIncrease.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
try {
int num = Integer.parseInt(mNum.getText().toString());
num++;
mNum.setText("x"+num );
bean.setWishlist_num(num + "");
} catch (Exception e) {
e.printStackTrace();
}
}
});
}
private void decreaseClick(final LiveWishlistBean bean) {
mDecrease.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
try {
int num = Integer.parseInt(mNum.getText().toString());
if (num > 1) {
num--;
mNum.setText("x"+num );
bean.setWishlist_num(num + "");
}
} catch (Exception e) {
e.printStackTrace();
}
}
});
}
}
}

View File

@ -1,12 +1,15 @@
package com.yunbao.live.adapter; package com.yunbao.live.adapter;
import android.content.Context; import android.content.Context;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView; import androidx.recyclerview.widget.RecyclerView;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.widget.ImageView; import android.widget.ImageView;
import android.widget.RadioButton;
import android.widget.TextView; import android.widget.TextView;
import com.yunbao.common.bean.LiveClassBean; import com.yunbao.common.bean.LiveClassBean;
@ -26,32 +29,27 @@ public class LiveReadyClassAdapter extends RecyclerView.Adapter<LiveReadyClassAd
private Context mContext; private Context mContext;
private List<LiveClassBean> mList; private List<LiveClassBean> mList;
private LayoutInflater mInflater; private LayoutInflater mInflater;
private View.OnClickListener mOnClickListener;
private OnItemClickListener<LiveClassBean> mOnItemClickListener; private OnItemClickListener<LiveClassBean> mOnItemClickListener;
public LiveReadyClassAdapter(Context context, List<LiveClassBean> list) { public LiveReadyClassAdapter(Context context, List<LiveClassBean> list) {
mContext=context; mContext = context;
mList = list; mList = list;
mInflater = LayoutInflater.from(context); mInflater = LayoutInflater.from(context);
mOnClickListener = new View.OnClickListener() {
@Override
public void onClick(View v) {
Object tag = v.getTag();
if (tag != null && mOnItemClickListener != null) {
mOnItemClickListener.onItemClick((LiveClassBean) tag, 0);
}
}
};
} }
public void setOnItemClickListener(OnItemClickListener<LiveClassBean> onItemClickListener) { public void setOnItemClickListener(OnItemClickListener<LiveClassBean> onItemClickListener) {
mOnItemClickListener = onItemClickListener; mOnItemClickListener = onItemClickListener;
} }
public void setList(List<LiveClassBean> mList) {
this.mList = mList;
notifyDataSetChanged();
}
@NonNull @NonNull
@Override @Override
public Vh onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { public Vh onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
return new Vh(mInflater.inflate(R.layout.item_live_ready_class, parent, false)); return new Vh(mInflater.inflate(R.layout.item_new_live_ready_class, parent, false));
} }
@Override @Override
@ -70,23 +68,38 @@ public class LiveReadyClassAdapter extends RecyclerView.Adapter<LiveReadyClassAd
ImageView mThumb; ImageView mThumb;
TextView mName; TextView mName;
TextView mDes; TextView mDes;
MyRadioButton mRadioButton; RadioButton mRadioButton;
public Vh(View itemView) { public Vh(View itemView) {
super(itemView); super(itemView);
mThumb = (ImageView) itemView.findViewById(R.id.thumb); mThumb = itemView.findViewById(R.id.thumb);
mName = (TextView) itemView.findViewById(R.id.name); mName = itemView.findViewById(R.id.name);
mDes = (TextView) itemView.findViewById(R.id.des); mDes = itemView.findViewById(R.id.des);
mRadioButton = (MyRadioButton) itemView.findViewById(R.id.radioButton); mRadioButton = itemView.findViewById(R.id.radioButton);
itemView.setOnClickListener(mOnClickListener); itemView.setOnClickListener(view -> {
Object tag = view.getTag();
if (tag != null && mOnItemClickListener != null) {
mOnItemClickListener.onItemClick((LiveClassBean) tag, 0);
}
});
} }
void setData(LiveClassBean bean) { void setData(LiveClassBean bean) {
itemView.setTag(bean); itemView.setTag(bean);
ImgLoader.display(mContext,bean.getThumb(), mThumb);
mName.setText(bean.getName()); mName.setText(bean.getName());
mDes.setText(bean.getDes()); mDes.setText(bean.getDes());
mRadioButton.doChecked(bean.isChecked()); mRadioButton.setChecked(bean.isChecked());
if (bean.isChecked()) {
itemView.setBackgroundResource(R.drawable.bg_new_live_room_type_select);
} else {
itemView.setBackgroundResource(R.drawable.bg_new_live_room_type_uncheck);
}
try {
ImgLoader.display(mContext, bean.getThumb(), mThumb);
} catch (Exception e) {
e.printStackTrace();
}
} }
} }
} }

View File

@ -0,0 +1,107 @@
package com.yunbao.live.dialog;
import android.os.Bundle;
import android.view.Gravity;
import android.view.Window;
import android.view.WindowManager;
import androidx.annotation.Nullable;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import com.yunbao.common.CommonAppConfig;
import com.yunbao.common.Constants;
import com.yunbao.common.bean.ConfigBean;
import com.yunbao.common.bean.LiveClassBean;
import com.yunbao.common.dialog.AbsDialogFragment;
import com.yunbao.common.interfaces.CommonCallback;
import com.yunbao.common.interfaces.OnItemClickListener;
import com.yunbao.live.R;
import com.yunbao.live.adapter.LiveReadyClassAdapter;
import com.yunbao.live.bean.LiveRoomTypeBean;
import java.util.ArrayList;
import java.util.List;
public class LiveNewRoomClassDialogFragment extends AbsDialogFragment implements OnItemClickListener<LiveClassBean> {
private RecyclerView mRecyclerView;
private LiveReadyClassAdapter adapter;
private List<LiveClassBean> list = new ArrayList<>();
private CommonCallback<LiveClassBean> mCallback;
@Override
protected int getLayoutId() {
return R.layout.dialog_new_live_room_class;
}
@Override
protected int getDialogStyle() {
return R.style.dialog2;
}
@Override
protected boolean canCancel() {
return true;
}
public void setCallback(CommonCallback<LiveClassBean> callback) {
mCallback = callback;
}
@Override
public void onActivityCreated(@Nullable Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
mRecyclerView = (RecyclerView) findViewById(R.id.recyclerView);
mRecyclerView.setHasFixedSize(true);
mRecyclerView.setLayoutManager(new LinearLayoutManager(mContext, LinearLayoutManager.VERTICAL, false));
Bundle bundle = getArguments();
if (bundle == null) {
return;
}
final int checkedClassId = bundle.getInt(Constants.CLASS_ID, 0);
CommonAppConfig.getInstance().getConfig(new CommonCallback<ConfigBean>() {
@Override
public void callback(ConfigBean configBean) {
if (configBean != null) {
List<LiveClassBean> list1 = configBean.getLiveClass();
for (int i = 0; i < list1.size(); i++) {
if (!list1.get(i).getName().equals("New") && !list1.get(i).getName().equals("Hot") && !list1.get(i).getName().equals("熱門") && !list1.get(i).getName().equals("新秀")) {
list.add(list1.get(i));
}
}
for (int i = 0, size = list.size(); i < size; i++) {
LiveClassBean bean = list.get(i);
if (bean.getId() == checkedClassId) {
bean.setChecked(true);
} else {
bean.setChecked(false);
}
}
adapter = new LiveReadyClassAdapter(mContext, list);
adapter.setOnItemClickListener(LiveNewRoomClassDialogFragment.this);
mRecyclerView.setAdapter(adapter);
}
}
});
}
@Override
protected void setWindowAttributes(Window window) {
window.setWindowAnimations(R.style.bottomToTopAnim);
WindowManager.LayoutParams params = window.getAttributes();
params.width = WindowManager.LayoutParams.MATCH_PARENT;
params.height = WindowManager.LayoutParams.WRAP_CONTENT;
params.gravity = Gravity.BOTTOM;
window.setAttributes(params);
}
@Override
public void onItemClick(LiveClassBean bean, int position) {
System.out.println("bean = " + bean + ", position = " + position);
bean.setChecked(true);
if(mCallback!=null){
mCallback.callback(bean);
}
dismiss();
}
}

View File

@ -0,0 +1,145 @@
package com.yunbao.live.dialog;
import android.os.Bundle;
import android.util.Log;
import android.view.Gravity;
import android.view.View;
import android.view.Window;
import android.view.WindowManager;
import android.widget.ImageView;
import androidx.constraintlayout.widget.ConstraintLayout;
import com.yunbao.common.CommonAppConfig;
import com.yunbao.common.Constants;
import com.yunbao.common.bean.ConfigBean;
import com.yunbao.common.dialog.AbsDialogFragment;
import com.yunbao.common.interfaces.CommonCallback;
import com.yunbao.common.interfaces.OnItemClickListener;
import com.yunbao.common.utils.DpUtil;
import com.yunbao.common.utils.WordUtil;
import com.yunbao.live.R;
import com.yunbao.live.bean.LiveRoomTypeBean;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
/**
* 新直播准备间
*/
public class LiveNewRoomTypeDialogFragment extends AbsDialogFragment implements OnItemClickListener<LiveRoomTypeBean> {
private CommonCallback<LiveRoomTypeBean> mCallback;
private List<LiveRoomTypeBean> mList;
private ConstraintLayout pub, pwd;
private ImageView pubBtn, pwdBtn;
private boolean isSelectPublic = true;
@Override
protected int getLayoutId() {
return R.layout.dialog_new_live_room_type;
}
@Override
protected int getDialogStyle() {
return R.style.dialog2;
}
@Override
protected boolean canCancel() {
return true;
}
@Override
protected void setWindowAttributes(Window window) {
window.setWindowAnimations(R.style.bottomToTopAnim);
WindowManager.LayoutParams params = window.getAttributes();
params.width = WindowManager.LayoutParams.MATCH_PARENT;
params.height = DpUtil.dp2px(236);
params.gravity = Gravity.BOTTOM;
window.setAttributes(params);
}
@Override
public void onActivityCreated(Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
pub = mRootView.findViewById(R.id.public_room);
pwd = mRootView.findViewById(R.id.private_room);
View submit = mRootView.findViewById(R.id.submit);
pubBtn = pub.findViewById(R.id.public_select);
pwdBtn = pwd.findViewById(R.id.private_select);
Bundle bundle = getArguments();
if (bundle == null) {
return;
}
int checkedId = bundle.getInt(Constants.CHECKED_ID, Constants.LIVE_TYPE_NORMAL);
select(checkedId == Constants.LIVE_TYPE_NORMAL);
pub.setOnClickListener(view -> select(true));
pwd.setOnClickListener(view -> select(false));
submit.setOnClickListener(view -> {
if (isSelectPublic) {
LiveRoomTypeBean bean = new LiveRoomTypeBean(0, WordUtil.getString(R.string.live_room_public));
mCallback.callback(bean);
} else {
for (LiveRoomTypeBean bean : mList) {
if (bean.getId() == Constants.LIVE_TYPE_PWD) {
bean.setChecked(true);
mCallback.callback(bean);
break;
}
}
}
dismiss();
});
initData();
}
private void initData() {
mList = new ArrayList<>();
ConfigBean configBean = CommonAppConfig.getInstance().getConfig();
Log.i("tag", configBean.toString());
String[][] liveType = configBean.getLiveType();
if (liveType != null) {
Log.i("tag", Arrays.toString(liveType));
List<LiveRoomTypeBean> list = LiveRoomTypeBean.getLiveTypeList(liveType);
mList.addAll(list);
}
}
private void select(boolean isSelectPublic) {
this.isSelectPublic = isSelectPublic;
if (isSelectPublic) {
pub.setBackgroundResource(R.drawable.bg_new_live_room_type_select);
pwd.setBackgroundResource(R.drawable.bg_new_live_room_type_uncheck);
pubBtn.setImageResource(R.mipmap.icon_selected);
pwdBtn.setImageResource(R.mipmap.icon_uncheck);
} else {
pub.setBackgroundResource(R.drawable.bg_new_live_room_type_uncheck);
pwd.setBackgroundResource(R.drawable.bg_new_live_room_type_select);
pubBtn.setImageResource(R.mipmap.icon_uncheck);
pwdBtn.setImageResource(R.mipmap.icon_selected);
}
}
@Override
public void onItemClick(LiveRoomTypeBean bean, int position) {
dismiss();
if (mCallback != null) {
mCallback.callback(bean);
}
}
public void setCallback(CommonCallback<LiveRoomTypeBean> callback) {
mCallback = callback;
}
@Override
public void onDestroy() {
mCallback = null;
super.onDestroy();
}
}

View File

@ -0,0 +1,248 @@
package com.yunbao.live.dialog;
import android.os.Bundle;
import android.util.Log;
import android.view.Gravity;
import android.view.View;
import android.view.Window;
import android.view.WindowManager;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.google.gson.Gson;
import com.yunbao.common.bean.LiveGiftBean;
import com.yunbao.common.dialog.AbsDialogFragment;
import com.yunbao.common.http.HttpCallback;
import com.yunbao.common.interfaces.OnItemClickListener;
import com.yunbao.common.utils.DpUtil;
import com.yunbao.common.utils.ToastUtil;
import com.yunbao.live.R;
import com.yunbao.live.activity.LiveAnchorActivity;
import com.yunbao.live.activity.LiveRyAnchorActivity;
import com.yunbao.live.adapter.LiveNewWishListAdapter;
import com.yunbao.live.adapter.LiveWishListAdapter;
import com.yunbao.live.bean.LiveWishlistBean;
import com.yunbao.live.http.LiveHttpConsts;
import com.yunbao.live.http.LiveHttpUtil;
import org.greenrobot.eventbus.EventBus;
import org.greenrobot.eventbus.Subscribe;
import org.greenrobot.eventbus.ThreadMode;
import java.util.List;
/**
* Created by cxf on 2018/10/19.
* 主播直播开播时 心愿单弹窗
*/
public class LiveNewWishListDialogFragment extends AbsDialogFragment implements OnItemClickListener<LiveWishlistBean> {
private RecyclerView mRecyclerView;
private ActionListener mActionListener;
private boolean mNoLink;
private View mrlAdd, tvDone;
LiveNewWishListAdapter mAdapter;
List<LiveWishlistBean> mWishlist;
@Override
protected int getLayoutId() {
return R.layout.dialog_new_live_wishlist;
}
@Override
protected int getDialogStyle() {
return R.style.dialog;
}
@Override
protected boolean canCancel() {
return true;
}
@Override
protected void setWindowAttributes(Window window) {
window.setWindowAnimations(R.style.bottomToTopAnim);
WindowManager.LayoutParams params = window.getAttributes();
params.width = WindowManager.LayoutParams.MATCH_PARENT;
params.height = DpUtil.dp2px(580);
params.gravity = Gravity.BOTTOM;
window.setAttributes(params);
}
@Override
public void onActivityCreated(Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
mRecyclerView = (RecyclerView) mRootView.findViewById(R.id.recyclerView);
mRecyclerView.setHasFixedSize(true);
mRecyclerView.setLayoutManager(new LinearLayoutManager(mContext, LinearLayoutManager.VERTICAL, false));
mrlAdd = findViewById(R.id.rl_add);
tvDone = findViewById(R.id.tvDone);
mrlAddClick();
tvDoneClick();
loadData();
EventBus.getDefault().register(this);
}
private void tvDoneClick() {
tvDone.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
modifyWishlist();
}
});
}
//修改心愿单列表
private void modifyWishlist() {
if (mWishlist != null && mWishlist.size() > 0) {
Gson gson = new Gson();
int size = mWishlist.size();
String params;
if (size > 0) {
Log.i("tos", gson.toJson(mWishlist));
params = gson.toJson(mWishlist);
} else {
params = "";
}
LiveHttpUtil.modifyWishList(params, new HttpCallback() {
@Override
public void onSuccess(int code, String msg, String[] info) {
if (code == 0 && info.length > 0) {
ToastUtil.show("修改成功");
dismiss();
} else {
ToastUtil.show("修改失败" + (msg.isEmpty() ? "" : msg));
}
}
@Override
public void onFinish() {
}
});
}
}
//获取心愿单列表
private void loadData() {
LiveHttpUtil.getWishList(new HttpCallback() {
@Override
public void onSuccess(int code, String msg, String[] info) {
if (code == 0 && info.length > 0) {
try {
JSONObject obj = JSON.parseObject(info[0]);
String giftJson = obj.getString("wishlist");
mWishlist = JSON.parseArray(giftJson, LiveWishlistBean.class);
mAdapter = new LiveNewWishListAdapter(mContext, mNoLink);
mAdapter.setData(mWishlist);
mRecyclerView.setAdapter(mAdapter);
mAdapter.setOnItemClickListener(new OnItemClickListener<LiveWishlistBean>() {
@Override
public void onItemClick(LiveWishlistBean bean, int position) {
}
});
} catch (Exception e) {
e.printStackTrace();
}
}
}
@Override
public void onFinish() {
}
});
}
//点击 + ,弹出礼物列表
private void mrlAddClick() {
mrlAdd.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
openGiftWindow();
}
});
}
/**
* 心愿单打开礼物窗口
*/
public void openGiftWindow() {
LiveGiftDialogFragment4Wishlist fragment = new LiveGiftDialogFragment4Wishlist();
Log.e("ry",getTag());
if(getTag().equals("TX")) {
fragment.show(((LiveAnchorActivity) mContext).getSupportFragmentManager(), "LiveGiftDialogFragment");
}else{
fragment.show(((LiveRyAnchorActivity) mContext).getSupportFragmentManager(), "LiveGiftDialogFragment");
}
}
@Override
public void onItemClick(LiveWishlistBean bean, int position) {
}
public interface ActionListener {
void onItemClick(String type);
}
public void setActionListener(ActionListener actionListener) {
mActionListener = actionListener;
}
public void setNoLink(boolean noLink) {
mNoLink = noLink;
}
@Subscribe(threadMode = ThreadMode.MAIN)
public void onChooseGift(LiveGiftBean bean) {
//选择礼物回调
if (bean != null) {
LiveWishlistBean wishlistBean = new LiveWishlistBean();
wishlistBean.setWishlist_num(bean.getNum());
wishlistBean.setWishlist_name(bean.getName());
wishlistBean.setWishlist_icon(bean.getIcon());
wishlistBean.setLid(bean.getId() + "");
wishlistBean.setWishlist_progress("0");
boolean isSame = false;
int size = mWishlist.size();
for (int i = 0; i < size; i++) {
if ((mWishlist.get(i).getLid()).equals("" + bean.getId())) {
ToastUtil.show(bean.getName() + "礼物重复");
isSame = true;
break;
}
}
if (size < 10) {
if (!isSame) {
mWishlist.add(0, wishlistBean);
mAdapter.notifyDataSetChanged();
}
} else {
ToastUtil.show("最多添加10个心愿");
}
}
}
@Override
public void onDestroy() {
super.onDestroy();
mActionListener = null;
mContext = null;
LiveHttpUtil.cancel(LiveHttpConsts.GET_WISH_LIST);
LiveHttpUtil.cancel(LiveHttpConsts.SET_WISH_LIST);
EventBus.getDefault().unregister(this);
}
}

View File

@ -0,0 +1,528 @@
package com.yunbao.live.views;
import android.app.Dialog;
import android.content.Context;
import android.content.Intent;
import android.graphics.drawable.Drawable;
import android.os.Bundle;
import android.text.TextUtils;
import android.util.Log;
import android.view.View;
import android.view.ViewGroup;
import android.view.inputmethod.InputMethodManager;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.RelativeLayout;
import android.widget.TextView;
import androidx.constraintlayout.widget.ConstraintLayout;
import androidx.core.content.ContextCompat;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import com.tencent.imsdk.v2.V2TIMManager;
import com.tencent.imsdk.v2.V2TIMSendCallback;
import com.yunbao.common.CommonAppConfig;
import com.yunbao.common.Constants;
import com.yunbao.common.bean.LiveClassBean;
import com.yunbao.common.bean.UserBean;
import com.yunbao.common.glide.ImgLoader;
import com.yunbao.common.http.HttpCallback;
import com.yunbao.common.interfaces.ActivityResultCallback;
import com.yunbao.common.interfaces.CommonCallback;
import com.yunbao.common.interfaces.ImageResultCallback;
import com.yunbao.common.utils.DialogUitl;
import com.yunbao.common.utils.L;
import com.yunbao.common.utils.ProcessImageUtil;
import com.yunbao.common.utils.StringUtil;
import com.yunbao.common.utils.ToastUtil;
import com.yunbao.common.utils.WordUtil;
import com.yunbao.common.views.AbsViewHolder;
import com.yunbao.live.R;
import com.yunbao.live.activity.LiveActivity;
import com.yunbao.live.activity.LiveAnchorActivity;
import com.yunbao.live.activity.LiveChooseClassActivity;
import com.yunbao.live.activity.LiveRyAnchorActivity;
import com.yunbao.live.adapter.LiveReadyShareAdapter;
import com.yunbao.live.bean.LiveRoomTypeBean;
import com.yunbao.live.dialog.LiveNewRoomClassDialogFragment;
import com.yunbao.live.dialog.LiveNewRoomTypeDialogFragment;
import com.yunbao.live.dialog.LiveNewWishListDialogFragment;
import com.yunbao.live.dialog.LiveRoomTypeDialogFragment;
import com.yunbao.live.dialog.LiveTimeDialogFragment;
import com.yunbao.live.dialog.LiveWishListDialogFragment;
import com.yunbao.live.http.LiveHttpConsts;
import com.yunbao.live.http.LiveHttpUtil;
import java.io.File;
import cn.rongcloud.rtc.api.RCRTCEngine;
import cn.rongcloud.rtc.api.stream.RCRTCCameraOutputStream;
public class LiveNewReadyRyViewHolder extends AbsViewHolder implements View.OnClickListener {
private ConstraintLayout mAvatar;
private TextView mCoverText;
private EditText mEditTitle;
private ProcessImageUtil mImageUtil;
private File mAvatarFile;
private TextView mLiveClass;
private TextView mLiveTypeTextView;//房间类型TextView
private TextView mLiveWishListTextView;//心愿单TextView
private int mLiveClassID;//直播频道id
private int mLiveType;//房间类型
private int mLiveTypeVal;//房间密码门票收费金额
private int mLiveTimeCoin;//计时收费金额
private ActivityResultCallback mActivityResultCallback;
private CommonCallback<LiveRoomTypeBean> mLiveTypeCallback;
private boolean mOpenLocation = true;
private int mLiveSdk;
private LiveClassBean classBean;
public LiveNewReadyRyViewHolder(Context context, ViewGroup parentView, int liveSdk) {
super(context, parentView, liveSdk);
}
@Override
protected void processArguments(Object... args) {
if (args.length > 0) {
mLiveSdk = (int) args[0];
}
}
@Override
protected int getLayoutId() {
return R.layout.view_new_live_ready;
}
@Override
public void init() {
ConstraintLayout traceroute_rootview = (ConstraintLayout)findViewById(R.id.traceroute_rootview);
traceroute_rootview.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
InputMethodManager imm = (InputMethodManager)
mContext.getSystemService(Context.INPUT_METHOD_SERVICE);
imm.hideSoftInputFromWindow(view.getWindowToken(), 0);
}
});
mAvatar = (ConstraintLayout) findViewById(R.id.avatar);
mAvatar.setOnClickListener(this);
UserBean u = CommonAppConfig.getInstance().getUserBean();
ImgLoader.displayDrawable(mContext, u.getAvatar(), new ImgLoader.DrawableCallback() {
@Override
public void onLoadSuccess(Drawable drawable) {
mAvatar.setBackground(drawable);
}
@Override
public void onLoadFailed() {
}
});
mCoverText = (TextView) findViewById(R.id.cover_text);
mEditTitle = (EditText) findViewById(R.id.edit_title);
findViewById(R.id.btn_room_type).setOnClickListener(this);
mOpenLocation = true;
mLiveClass = (TextView) findViewById(R.id.live_class);
mLiveTypeTextView = (TextView) findViewById(R.id.text_room_type);
mLiveWishListTextView= (TextView) findViewById(R.id.text_wishlist);
mImageUtil = ((LiveActivity) mContext).getProcessImageUtil();
mImageUtil.setImageResultCallback(new ImageResultCallback() {
@Override
public void beforeCamera() {
((LiveRyAnchorActivity) mContext).beforeCamera();
}
@Override
public void onSuccess(File file) {
if (file != null) {
ImgLoader.displayFileDrawable(mContext, file, new ImgLoader.DrawableCallback() {
@Override
public void onLoadSuccess(Drawable drawable) {
mAvatar.setBackground(drawable);
}
@Override
public void onLoadFailed() {
}
});
if (mAvatarFile == null) {
mCoverText.setText(WordUtil.getString(R.string.live_cover_2));
mCoverText.setBackground(ContextCompat.getDrawable(mContext, R.drawable.bg_live_cover));
}
mAvatarFile = file;
}
}
@Override
public void onFailure() {
}
});
findViewById(R.id.btn_camera).setOnClickListener(this);
findViewById(R.id.btn_live_class).setOnClickListener(this);
findViewById(R.id.btn_close).setOnClickListener(this);
findViewById(R.id.btn_beauty).setOnClickListener(this);
findViewById(R.id.btn_start_live).setOnClickListener(this);
findViewById(R.id.btn_wishlist).setOnClickListener(this);
findViewById(R.id.btn_horizontally).setOnClickListener(this);
mActivityResultCallback = new ActivityResultCallback() {
@Override
public void onSuccess(Intent intent) {
mLiveClassID = intent.getIntExtra(Constants.CLASS_ID, 0);
mLiveClass.setText(intent.getStringExtra(Constants.CLASS_NAME));
}
};
mLiveTypeCallback = new CommonCallback<LiveRoomTypeBean>() {
@Override
public void callback(LiveRoomTypeBean bean) {
switch (bean.getId()) {
case Constants.LIVE_TYPE_NORMAL:
onLiveTypeNormal(bean);
break;
case Constants.LIVE_TYPE_PWD:
onLiveTypePwd(bean);
break;
case Constants.LIVE_TYPE_PAY:
onLiveTypePay(bean);
break;
case Constants.LIVE_TYPE_TIME:
onLiveTypeTime(bean);
break;
}
}
};
}
@Override
public void onClick(View v) {
if (!canClick()) {
return;
}
int i = v.getId();
if (i == R.id.avatar) {
setAvatar();
} else if (i == R.id.btn_camera) {
toggleCamera();
} else if (i == R.id.btn_close) {
close();
} else if (i == R.id.btn_live_class) {
chooseLiveClass();
} else if (i == R.id.btn_beauty) {
beauty();
}else if (i == R.id.btn_wishlist) {
//点击心愿单
openWishListWindow();
} else if (i == R.id.btn_room_type) {
chooseLiveType();
} else if (i == R.id.btn_start_live) {
startLive();
} else if (i == R.id.btn_locaiton) {
switchLocation();
}else if(i == R.id.btn_horizontally){
RCRTCCameraOutputStream cameraStream = RCRTCEngine.getInstance().getDefaultVideoStream();
cameraStream.setPreviewMirror(!cameraStream.isPreviewMirror());
}
}
/**
* 打开心愿单窗口
*/
public void openWishListWindow() {
LiveNewWishListDialogFragment fragment = new LiveNewWishListDialogFragment();
if (mContext instanceof LiveRyAnchorActivity){
fragment.show(((LiveRyAnchorActivity) mContext).getSupportFragmentManager(), "RY");
}
}
/**
* 打开 关闭位置
*/
private void switchLocation() {
if (mOpenLocation) {
new DialogUitl.Builder(mContext)
.setContent(WordUtil.getString(R.string.live_location_close_3))
.setCancelable(true)
.setConfrimString(WordUtil.getString(R.string.live_location_close_2))
.setClickCallback(new DialogUitl.SimpleCallback() {
@Override
public void onConfirmClick(Dialog dialog, String content) {
toggleLocation();
}
})
.build()
.show();
} else {
toggleLocation();
}
}
private void toggleLocation() {
mOpenLocation = !mOpenLocation;
}
/**
* 设置头像
*/
private void setAvatar() {
if (mLiveSdk == Constants.LIVE_SDK_TX) {
mImageUtil.getImageByAlumb();
} else {
DialogUitl.showStringArrayDialog(mContext, new Integer[]{
R.string.camera, R.string.alumb}, new DialogUitl.StringArrayDialogCallback() {
@Override
public void onItemClick(String text, int tag) {
if (tag == R.string.camera) {
mImageUtil.getImageByCamera();
} else {
mImageUtil.getImageByAlumb();
}
}
});
}
}
/**
* 切换镜头
*/
private void toggleCamera() {
((LiveRyAnchorActivity) mContext).toggleCamera();
}
/**
* 关闭
*/
private void close() {
((LiveRyAnchorActivity) mContext).endLives();
}
/**
* 选择直播频道
*/
private void chooseLiveClass() {
/* try {
Intent intent = new Intent(mContext, LiveChooseClassActivity.class);
intent.putExtra(Constants.CLASS_ID, mLiveClassID);
mImageUtil.startActivityForResult(intent, mActivityResultCallback);
}catch (Exception e){
}*/
Bundle bundle = new Bundle();
bundle.putInt(Constants.CLASS_ID, mLiveClassID);
LiveNewRoomClassDialogFragment fragment = new LiveNewRoomClassDialogFragment();
fragment.setArguments(bundle);;
fragment.setCallback(new CommonCallback<LiveClassBean>() {
@Override
public void callback(LiveClassBean bean) {
classBean=bean;
mLiveClassID=classBean.getId();
mLiveClass.setText(bean.getName());
}
});
fragment.show(((LiveRyAnchorActivity) mContext).getSupportFragmentManager(), "LiveRoomTypeDialogFragment");
}
/**
* 设置美颜
*/
private void beauty() {
((LiveRyAnchorActivity) mContext).beauty();
// Intent intent = new Intent(mContext, Beauty360Activity3.class);
// mContext.startActivity(intent);
}
/**
* 选择直播类型
*/
private void chooseLiveType() {
Bundle bundle = new Bundle();
bundle.putInt(Constants.CHECKED_ID, mLiveType);
LiveNewRoomTypeDialogFragment fragment = new LiveNewRoomTypeDialogFragment();
fragment.setArguments(bundle);
fragment.setCallback(mLiveTypeCallback);
fragment.show(((LiveRyAnchorActivity) mContext).getSupportFragmentManager(), "LiveRoomTypeDialogFragment");
}
/**
* 普通房间
*/
private void onLiveTypeNormal(LiveRoomTypeBean bean) {
mLiveType = bean.getId();
mLiveTypeTextView.setText(bean.getName());
mLiveTypeVal = 0;
mLiveTimeCoin = 0;
}
/**
* 密码房间
*/
private void onLiveTypePwd(final LiveRoomTypeBean bean) {
DialogUitl.showSimpleInputDialog(mContext, WordUtil.getString(R.string.live_set_pwd), DialogUitl.INPUT_TYPE_NUMBER_PASSWORD, 8, new DialogUitl.SimpleCallback() {
@Override
public void onConfirmClick(Dialog dialog, String content) {
if (TextUtils.isEmpty(content)) {
ToastUtil.show(R.string.live_set_pwd_empty);
} else {
mLiveType = bean.getId();
mLiveTypeTextView.setText(bean.getName());
if (StringUtil.isInt(content)) {
mLiveTypeVal = Integer.parseInt(content);
}
mLiveTimeCoin = 0;
dialog.dismiss();
}
}
});
}
/**
* 付费房间
*/
private void onLiveTypePay(final LiveRoomTypeBean bean) {
DialogUitl.showSimpleInputDialog(mContext, WordUtil.getString(R.string.live_set_fee), DialogUitl.INPUT_TYPE_NUMBER, 8, new DialogUitl.SimpleCallback() {
@Override
public void onConfirmClick(Dialog dialog, String content) {
if (TextUtils.isEmpty(content)) {
ToastUtil.show(R.string.live_set_fee_empty);
} else {
mLiveType = bean.getId();
mLiveTypeTextView.setText(bean.getName());
if (StringUtil.isInt(content)) {
mLiveTypeVal = Integer.parseInt(content);
}
mLiveTimeCoin = 0;
dialog.dismiss();
}
}
});
}
/**
* 计时房间
*/
private void onLiveTypeTime(final LiveRoomTypeBean bean) {
LiveTimeDialogFragment fragment = new LiveTimeDialogFragment();
Bundle bundle = new Bundle();
bundle.putInt(Constants.CHECKED_COIN, mLiveTimeCoin);
fragment.setArguments(bundle);
fragment.setCommonCallback(new CommonCallback<Integer>() {
@Override
public void callback(Integer coin) {
mLiveType = bean.getId();
mLiveTypeTextView.setText(bean.getName());
mLiveTypeVal = coin;
mLiveTimeCoin = coin;
}
});
fragment.show(((LiveRyAnchorActivity) mContext).getSupportFragmentManager(), "LiveTimeDialogFragment");
}
public void hide() {
if (mContentView != null && mContentView.getVisibility() == View.VISIBLE) {
mContentView.setVisibility(View.INVISIBLE);
}
}
public void show() {
if (mContentView != null && mContentView.getVisibility() != View.VISIBLE) {
mContentView.setVisibility(View.VISIBLE);
}
}
/**
* 点击开始直播按钮
*/
private void startLive() {
boolean startPreview = ((LiveRyAnchorActivity) mContext).isStartPreview();
// if (!startPreview) {
// ToastUtil.show(R.string.please_wait);
// return;
// }
if (mLiveClassID == 0) {
ToastUtil.show(R.string.live_choose_live_class);
return;
}
createRoom();
}
/**
* 请求创建直播间接口开始直播
*/
boolean isHttpBack = false;
private void createRoom() {
if(!isHttpBack) {
isHttpBack = true;
if (mLiveClassID == 0) {
ToastUtil.show(R.string.live_choose_live_class);
return;
}
String title = mEditTitle.getText().toString().trim();
LiveHttpUtil.newcreateRoom(title, mLiveClassID, mLiveType, mLiveTypeVal, mAvatarFile, new HttpCallback() {
@Override
public void onSuccess(int code, String msg, final String[] info) {
if (code == 0 && info.length > 0) {
L.e("开播", "createRoom------->" + info[0]);
isHttpBack = false;
final CommonAppConfig appConfig = CommonAppConfig.getInstance();
UserBean u = appConfig.getUserBean();
V2TIMManager.getInstance().createGroup(V2TIMManager.GROUP_TYPE_AVCHATROOM, "g" + appConfig.getUid(), "直播", new V2TIMSendCallback<String>() {
@Override
public void onProgress(int progress) {
}
@Override
public void onSuccess(String s) {
Log.i("tx", "创建成功");
((LiveAnchorActivity) mContext).startLiveSuccess(info[0], mLiveType, mLiveTypeVal);
}
@Override
public void onError(int code, String desc) {
Log.i("tx", code + "创建失败" + desc);
if (code == 10025) {
((LiveAnchorActivity) mContext).startLiveSuccess(info[0], mLiveType, mLiveTypeVal);
} else {
ToastUtil.show("开播失败,联系客服。");
}
}
});
} else {
ToastUtil.show(msg);
}
}
@Override
public void onError() {
super.onError();
isHttpBack = false;
}
});
}else {
ToastUtil.show("請求中,請勿重複點擊");
}
}
public void release() {
mImageUtil = null;
mActivityResultCallback = null;
mLiveTypeCallback = null;
}
@Override
public void onDestroy() {
LiveHttpUtil.cancel(LiveHttpConsts.CREATE_ROOM);
}
}

View File

@ -17,6 +17,7 @@ import android.widget.ImageView;
import android.widget.RelativeLayout; import android.widget.RelativeLayout;
import android.widget.TextView; import android.widget.TextView;
import com.lzy.okgo.model.Response;
import com.tencent.imsdk.v2.V2TIMManager; import com.tencent.imsdk.v2.V2TIMManager;
import com.tencent.imsdk.v2.V2TIMSendCallback; import com.tencent.imsdk.v2.V2TIMSendCallback;
import com.tencent.trtc.TRTCCloudDef; import com.tencent.trtc.TRTCCloudDef;
@ -25,6 +26,7 @@ import com.yunbao.common.Constants;
import com.yunbao.common.bean.UserBean; import com.yunbao.common.bean.UserBean;
import com.yunbao.common.glide.ImgLoader; import com.yunbao.common.glide.ImgLoader;
import com.yunbao.common.http.HttpCallback; import com.yunbao.common.http.HttpCallback;
import com.yunbao.common.http.JsonBean;
import com.yunbao.common.interfaces.ActivityResultCallback; import com.yunbao.common.interfaces.ActivityResultCallback;
import com.yunbao.common.interfaces.CommonCallback; import com.yunbao.common.interfaces.CommonCallback;
import com.yunbao.common.interfaces.ImageResultCallback; import com.yunbao.common.interfaces.ImageResultCallback;
@ -493,7 +495,7 @@ public class LiveReadyViewHolder extends AbsViewHolder implements View.OnClickLi
@Override @Override
public void onSuccess(int code, String msg, final String[] info) { public void onSuccess(int code, String msg, final String[] info) {
if (code == 0 && info.length > 0) { if (code == 0 && info.length > 0) {
L.e("开播", "createRoom------->" + info[0]); L.e("tx开播", "createRoom------->" + info[0]);
final CommonAppConfig appConfig = CommonAppConfig.getInstance(); final CommonAppConfig appConfig = CommonAppConfig.getInstance();
UserBean u = appConfig.getUserBean(); UserBean u = appConfig.getUserBean();
V2TIMManager.getInstance().createGroup(V2TIMManager.GROUP_TYPE_AVCHATROOM, "g" + appConfig.getUid(), "直播", new V2TIMSendCallback<String>() { V2TIMManager.getInstance().createGroup(V2TIMManager.GROUP_TYPE_AVCHATROOM, "g" + appConfig.getUid(), "直播", new V2TIMSendCallback<String>() {
@ -523,6 +525,18 @@ public class LiveReadyViewHolder extends AbsViewHolder implements View.OnClickLi
ToastUtil.show(msg); ToastUtil.show(msg);
} }
} }
@Override
public void onError() {
super.onError();
System.out.println("tx 开播失败");
}
@Override
public void onError(Response<JsonBean> response) {
super.onError(response);
System.out.println("tx 开播失败 = "+response);
}
}); });
} }

View File

@ -936,9 +936,12 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
// fastMsgRecyclerView.setItemAnimator(new DefaultItemAnimator()); // fastMsgRecyclerView.setItemAnimator(new DefaultItemAnimator());
//主播页面隐藏头部 //主播页面隐藏头部
if (mContext instanceof LiveRyAnchorActivity) { if (mContext instanceof LiveRyAnchorActivity) {
findViewById(R.id.hour_rank_layout).setVisibility(View.GONE); // findViewById(R.id.hour_rank_layout).setVisibility(View.GONE);
findViewById(R.id.live_wks_layout).setVisibility(View.GONE); // findViewById(R.id.live_wks_layout).setVisibility(View.GONE);
findViewById(R.id.wish_list_layout).setVisibility(View.GONE); // findViewById(R.id.wish_list_layout).setVisibility(View.GONE);
// findViewById(R.id.hour_rank_layout).setEnabled(false);
/* findViewById(R.id.live_wks_layout).setEnabled(false);
findViewById(R.id.wish_list_layout).setEnabled(false);*/
findViewById(R.id.open_sidebar).setVisibility(View.GONE); findViewById(R.id.open_sidebar).setVisibility(View.GONE);
findViewById(R.id.btn_follow).setVisibility(View.GONE); findViewById(R.id.btn_follow).setVisibility(View.GONE);
} }
@ -1158,7 +1161,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
/** /**
* 初始化小时榜 * 初始化小时榜
*/ */
protected void initHourRankList() { public void initHourRankList() {
ViewFlipper flipper = (ViewFlipper) findViewById(R.id.hour_rank_list); ViewFlipper flipper = (ViewFlipper) findViewById(R.id.hour_rank_list);
LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(DpUtil.dp2px(44), DpUtil.dp2px(16)); LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(DpUtil.dp2px(44), DpUtil.dp2px(16));
LinearLayout.LayoutParams textParams = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT); LinearLayout.LayoutParams textParams = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);

View File

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:width="339dp" android:height="2dp">
<shape android:shape="rectangle">
<solid android:color="#b3ffffff" />
<stroke android:width="1dp" android:color="#b3ffffff" />
</shape>
</item>
</selector>

View File

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:width="189dp" android:height="42dp">
<shape android:shape="rectangle">
<gradient android:type="linear" android:useLevel="true" android:startColor="#ffffae05" android:endColor="#ffffc621" android:angle="135" />
<corners android:radius="21dp" />
</shape>
</item>
</selector>

View File

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_checked="true" android:drawable="@mipmap/icon_selected"/>
<item android:state_checked="false" android:drawable="@mipmap/icon_uncheck"/>
</selector>

View File

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:width="68dp" android:height="68dp">
<shape android:shape="rectangle">
<solid android:color="#59ffffff" />
<corners android:radius="2dp" />
</shape>
</item>
</selector>

View File

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:width="166dp" android:height="162dp">
<shape android:shape="rectangle">
<stroke android:width="1dp" android:color="#ffffc621" />
<solid android:color="#33ffb2b2" />
<corners android:radius="8dp" />
</shape>
</item>
</selector>

View File

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:width="166dp" android:height="162dp">
<shape android:shape="rectangle">
<solid android:color="#337792d0" />
<corners android:radius="8dp" />
</shape>
</item>
</selector>

Binary file not shown.

After

Width:  |  Height:  |  Size: 607 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 257 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 98 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 214 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 80 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 34 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

View File

@ -1,9 +1,9 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android"> <selector xmlns:android="http://schemas.android.com/apk/res/android">
<item> <item android:width="355dp" android:height="121dp">
<shape android:shape="rectangle"> <shape android:shape="rectangle">
<corners android:radius="30dp" /> <solid android:color="#4d000000" />
<solid android:color="#55000000 " /> <corners android:radius="6dp" />
</shape> </shape>
</item> </item>
</selector> </selector>

View File

@ -0,0 +1,59 @@
<?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="#000000">
<TextView
android:id="@+id/title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="14dp"
android:text="@string/live_class_choose"
android:textColor="#F6F7FB"
android:textSize="17sp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/textView2"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="30dp"
android:layout_marginTop="10dp"
android:text="@string/live_class_tip_title"
android:textColor="#F6F7FB"
android:textSize="14sp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/title" />
<TextView
android:id="@+id/textView3"
android:layout_width="355dp"
android:layout_height="wrap_content"
android:layout_marginStart="10dp"
android:layout_marginTop="8dp"
android:layout_marginEnd="10dp"
android:text="@string/live_class_tip"
android:textColor="#B3F6F7FB"
android:textSize="14sp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/textView2" />
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recyclerView"
android:layout_width="match_parent"
android:layout_height="250dp"
android:layout_marginStart="10dp"
android:layout_marginTop="13dp"
android:layout_marginEnd="10dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/textView3" />
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@ -0,0 +1,147 @@
<?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:id="@+id/recyclerView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#b3000000">
<TextView
android:id="@+id/title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="14dp"
android:text="@string/live_room_title"
android:textColor="#F6F7FB"
android:textSize="17sp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/submit"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:layout_marginEnd="24dp"
android:text="@string/live_room_type_submit"
android:textColor="#FFC621"
android:textSize="14sp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/public_room"
android:layout_width="166dp"
android:layout_height="162dp"
android:layout_marginTop="54dp"
android:layout_marginEnd="24dp"
android:layout_marginBottom="33dp"
android:background="@drawable/bg_new_live_room_type_select"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toStartOf="@+id/private_room"
app:layout_constraintTop_toTopOf="parent">
<ImageView
android:id="@+id/public_icon"
android:layout_width="32dp"
android:layout_height="32dp"
android:layout_marginTop="41dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:srcCompat="@mipmap/icon_public" />
<TextView
android:id="@+id/public_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="4dp"
android:text="@string/live_room_public"
android:textColor="#F6F7FB"
android:textSize="16sp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/public_icon" />
<TextView
android:id="@+id/public_dec"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="4dp"
android:text="@string/live_room_public_des"
android:textColor="#B3F6F7FB"
android:textSize="12sp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/public_title" />
<ImageView
android:id="@+id/public_select"
android:layout_width="14dp"
android:layout_height="14dp"
android:layout_marginTop="10dp"
android:layout_marginEnd="10dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:srcCompat="@mipmap/icon_selected" />
</androidx.constraintlayout.widget.ConstraintLayout>
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/private_room"
android:layout_width="166dp"
android:layout_height="162dp"
android:layout_marginTop="54dp"
android:layout_marginEnd="24dp"
android:layout_marginBottom="33dp"
android:background="@drawable/bg_new_live_room_type_uncheck"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent">
<ImageView
android:id="@+id/private_icon"
android:layout_width="32dp"
android:layout_height="32dp"
android:layout_marginTop="41dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:srcCompat="@mipmap/icon_private" />
<TextView
android:id="@+id/private_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="4dp"
android:text="@string/live_room_private"
android:textColor="#F6F7FB"
android:textSize="16sp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/private_icon" />
<TextView
android:id="@+id/private_dec"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="4dp"
android:text="@string/live_room_private_des"
android:textColor="#B3F6F7FB"
android:textSize="12sp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/private_title" />
<ImageView
android:id="@+id/private_select"
android:layout_width="14dp"
android:layout_height="14dp"
android:layout_marginTop="10dp"
android:layout_marginEnd="10dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:srcCompat="@mipmap/icon_uncheck" />
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@ -0,0 +1,79 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="573dp"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:background="@drawable/bg_xyd"
android:paddingRight="5dp"
android:paddingLeft="5dp"
android:orientation="vertical">
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/rl_add"
android:layout_width="match_parent"
android:layout_height="140dp"
android:layout_marginTop="150dp"
android:layout_marginStart="10dp"
android:layout_marginEnd="10dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
<ImageView
android:id="@+id/imageView2"
android:layout_width="0dp"
android:layout_height="0dp"
android:scaleType="centerInside"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:srcCompat="@drawable/bg_xyd_add_item" />
<TextView
android:id="@+id/name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:layout_gravity="center"
android:layout_marginTop="24dp"
android:layout_marginEnd="90dp"
android:ellipsize="end"
android:singleLine="true"
android:text="@string/live_item_add_gift"
android:textColor="#4223CD"
android:textSize="16sp"
android:textStyle="bold"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recyclerView"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_marginStart="10dp"
android:layout_marginEnd="10dp"
android:layout_marginBottom="18dp"
android:overScrollMode="never"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/rl_add" />
<ImageView
android:id="@+id/tvDone"
android:layout_width="275dp"
android:layout_height="52dp"
android:layout_marginBottom="24dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:srcCompat="@drawable/bg_xyd_button" />
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@ -0,0 +1,49 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="60dp"
android:layout_marginBottom="12dp"
android:background="@drawable/bg_new_live_room_type_uncheck"
android:paddingLeft="35dp"
android:paddingRight="15dp">
<ImageView
android:id="@+id/thumb"
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_centerVertical="true" />
<TextView
android:id="@+id/name"
android:text="123123"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="45dp"
android:layout_marginTop="8dp"
android:textColor="#F6F7FB"
android:textSize="16sp" />
<TextView
android:id="@+id/des"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/name"
android:layout_marginLeft="45dp"
android:layout_marginTop="4dp"
android:layout_marginRight="50dp"
android:ellipsize="end"
android:singleLine="true"
android:textColor="#B3F6F7FB"
android:textSize="13sp" />
<RadioButton
android:id="@+id/radioButton"
android:layout_width="20dp"
android:layout_height="20dp"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:layout_marginRight="5dp"
android:background="@drawable/bg_live_room_class_radio_btn"
android:button="@null" />
</RelativeLayout>

View File

@ -0,0 +1,197 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/btn_system_msg"
android:layout_width="match_parent"
android:layout_height="100dp"
android:layout_marginTop="10dp"
android:background="@drawable/bg_xyd_item">
<LinearLayout
android:id="@+id/llTop"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="1dp">
<TextView
android:id="@+id/tvWishIndex"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:layout_gravity="center"
android:layout_marginLeft="18dp"
android:layout_marginRight="15dp"
android:text="心愿"
android:textColor="@color/white"
android:textSize="12sp" />
<ImageView
android:id="@+id/iv_delete"
android:layout_width="20dp"
android:layout_marginEnd="15dp"
android:layout_height="match_parent"
android:layout_centerInParent="true"
android:src="@drawable/delete_wish_item" />
</LinearLayout>
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/rlTop"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="@id/llTop">
<com.makeramen.roundedimageview.RoundedImageView
android:id="@+id/icon"
android:layout_width="50dp"
android:layout_height="50dp"
android:layout_centerVertical="true"
android:layout_marginLeft="15dp"
android:layout_marginTop="24dp"
android:background="@drawable/bg_xyd_item_icon"
android:scaleType="centerCrop"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:riv_corner_radius="10dp" />
<TextView
android:id="@+id/name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_marginStart="16dp"
android:layout_marginTop="24dp"
android:layout_toRightOf="@id/icon"
android:ellipsize="end"
android:singleLine="true"
android:text="@string/live_item_gift_name"
android:textColor="@color/white"
android:textSize="12sp"
app:layout_constraintStart_toEndOf="@+id/icon"
app:layout_constraintTop_toTopOf="parent" />
<ProgressBar
android:id="@+id/pb_wishlist"
style="?android:attr/progressBarStyleHorizontal"
android:layout_width="100dp"
android:layout_height="10dp"
android:layout_centerVertical="true"
android:layout_gravity="center"
android:layout_marginStart="16dp"
android:layout_marginTop="8dp"
android:layout_toEndOf="@+id/icon"
android:max="100"
android:progress="0"
android:progressDrawable="@drawable/progress_wishlist"
app:layout_constraintStart_toEndOf="@+id/icon"
app:layout_constraintTop_toBottomOf="@+id/name" />
<TextView
android:id="@+id/tvProgress"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginStart="24dp"
android:layout_marginTop="2dp"
android:layout_weight="1"
android:gravity="center"
android:text="1/1"
android:textColor="@color/white"
android:textSize="14sp"
app:layout_constraintStart_toEndOf="@+id/pb_wishlist"
app:layout_constraintTop_toBottomOf="@+id/name" />
<LinearLayout
android:id="@+id/llNum"
android:layout_width="70dp"
android:layout_height="20dp"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:layout_marginTop="16dp"
android:layout_marginEnd="24dp"
android:background="@drawable/bg_xyd_number"
android:orientation="horizontal"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent">
<TextView
android:id="@+id/tv_decrease"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:gravity="center"
android:text="-"
android:textColor="@color/white"
android:textSize="12sp" />
<TextView
android:id="@+id/tv_num"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="2"
android:gravity="center"
android:maxLength="5"
android:text="x1"
android:textColor="#FFFFFF"
android:textSize="12sp" />
<TextView
android:id="@+id/tv_increase"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:gravity="center"
android:text="+"
android:textColor="@color/white"
android:textSize="12sp" />
</LinearLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
<TextView
android:id="@+id/msg"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/rlTop"
android:layout_marginTop="2dp"
android:layout_marginRight="80dp"
android:ellipsize="end"
android:singleLine="true"
android:textColor="@color/white"
android:textSize="14sp" />
<TextView
android:id="@+id/time"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignTop="@id/rlTop"
android:layout_alignParentRight="true"
android:layout_marginTop="3dp"
android:layout_marginRight="15dp"
android:textColor="@color/white"
android:textSize="12sp" />
<TextView
android:id="@+id/red_point"
android:layout_width="wrap_content"
android:layout_height="14dp"
android:layout_below="@id/time"
android:layout_alignParentRight="true"
android:layout_marginTop="5dp"
android:layout_marginRight="20dp"
android:background="@drawable/bg_red_point"
android:gravity="center"
android:includeFontPadding="false"
android:minWidth="14dp"
android:paddingLeft="3dp"
android:paddingRight="3dp"
android:textColor="@color/white"
android:textSize="10sp"
android:visibility="invisible" />
</RelativeLayout>

View File

@ -91,15 +91,14 @@
android:id="@+id/live_class" android:id="@+id/live_class"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:layout_gravity="center_vertical" android:layout_gravity="center_vertical"
android:clickable="false"
android:gravity="center_vertical" android:gravity="center_vertical"
android:includeFontPadding="false" android:includeFontPadding="false"
android:text="@string/live_class" android:text="@string/live_class"
android:clickable="false"
android:textColor="#B6B6B6" android:textColor="#B6B6B6"
android:layout_centerHorizontal="true" android:textSize="12sp" />
android:layout_centerVertical="true"
android:textSize="12sp"/>
<ImageView <ImageView
android:layout_width="25dp" android:layout_width="25dp"
@ -167,8 +166,8 @@
android:layout_marginTop="10dp" android:layout_marginTop="10dp"
android:layout_toRightOf="@id/avatar_group" android:layout_toRightOf="@id/avatar_group"
android:text="@string/live_title" android:text="@string/live_title"
android:textSize="12sp" android:textColor="#B6B6B6"
android:textColor="#B6B6B6" /> android:textSize="12sp" />
<EditText <EditText
android:id="@+id/edit_title" android:id="@+id/edit_title"

View File

@ -110,6 +110,7 @@
app:indicator_width="8dp" /> app:indicator_width="8dp" />
</LinearLayout> </LinearLayout>
<LinearLayout <LinearLayout
android:id="@+id/btn_event" android:id="@+id/btn_event"
android:layout_width="68dp" android:layout_width="68dp"
@ -634,9 +635,9 @@
android:id="@+id/live_time" android:id="@+id/live_time"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="20dp" android:layout_height="20dp"
android:layout_below="@id/hour_rank_layout" android:layout_alignTop="@id/hour_rank_layout"
android:layout_marginLeft="10dp" android:layout_alignParentRight="true"
android:layout_marginTop="5dp" android:layout_marginEnd="10dp"
android:background="@drawable/bg_live_push_time" android:background="@drawable/bg_live_push_time"
android:drawablePadding="5dp" android:drawablePadding="5dp"
android:gravity="center_vertical" android:gravity="center_vertical"

View File

@ -0,0 +1,254 @@
<?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:id="@+id/traceroute_rootview"
android:layout_width="match_parent"
android:layout_height="match_parent">
<ImageView
android:id="@+id/btn_camera"
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_marginStart="10dp"
android:layout_marginTop="54dp"
android:padding="3dp"
android:src="@mipmap/icon_live_ready_camera"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<ImageView
android:id="@+id/btn_horizontally"
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_marginStart="20dp"
android:layout_marginTop="54dp"
android:layout_toRightOf="@+id/btn_camera"
android:padding="3dp"
android:src="@mipmap/icon_horizontally"
app:layout_constraintStart_toEndOf="@+id/btn_camera"
app:layout_constraintTop_toTopOf="parent" />
<ImageView
android:id="@+id/btn_close"
android:layout_width="45dp"
android:layout_height="45dp"
android:layout_alignParentRight="true"
android:layout_marginTop="45dp"
android:layout_marginEnd="10dp"
android:padding="5dp"
android:scaleType="fitCenter"
android:src="@mipmap/icon_cancel"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/traceroute_item"
android:layout_width="0dp"
android:layout_height="140dp"
android:layout_marginStart="10dp"
android:layout_marginTop="98dp"
android:layout_marginEnd="10dp"
android:background="@drawable/border_grey1"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
<LinearLayout
android:id="@+id/btn_room_type"
android:layout_width="wrap_content"
android:layout_height="25dp"
android:layout_marginStart="12dp"
android:layout_marginTop="10dp"
android:gravity="center"
android:orientation="horizontal"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
<ImageView
android:layout_width="18dp"
android:layout_height="18dp"
android:layout_weight="1"
app:srcCompat="@mipmap/icon_public" />
<TextView
android:id="@+id/text_room_type"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="4dp"
android:layout_marginEnd="4dp"
android:layout_weight="1"
android:text="@string/live_room_type"
android:textColor="@color/white"
android:textSize="12sp" />
<ImageView
android:layout_width="5dp"
android:layout_height="10dp"
android:layout_weight="1"
android:scaleType="centerCrop"
android:src="@mipmap/icon_live_more" />
</LinearLayout>
<LinearLayout
android:id="@+id/btn_live_class"
android:layout_width="wrap_content"
android:layout_height="25dp"
android:layout_marginStart="75dp"
android:layout_marginTop="10dp"
android:gravity="center"
android:orientation="horizontal"
app:layout_constraintStart_toEndOf="@+id/btn_room_type"
app:layout_constraintTop_toTopOf="parent">
<TextView
android:id="@+id/live_class"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="4dp"
android:layout_weight="1"
android:text="@string/live_class"
android:textColor="@color/white"
android:textSize="12sp" />
<ImageView
android:layout_width="5dp"
android:layout_height="10dp"
android:layout_weight="1"
android:scaleType="centerCrop"
android:src="@mipmap/icon_live_more" />
</LinearLayout>
<LinearLayout
android:id="@+id/btn_wishlist"
android:layout_width="wrap_content"
android:layout_height="25dp"
android:layout_marginTop="10dp"
android:layout_marginEnd="24dp"
android:gravity="center"
android:orientation="horizontal"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent">
<TextView
android:id="@+id/text_wishlist"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="4dp"
android:layout_weight="1"
android:text="@string/live_wish_list"
android:textColor="@color/white"
android:textSize="12sp" />
<ImageView
android:layout_width="5dp"
android:layout_height="10dp"
android:layout_weight="1"
android:scaleType="centerCrop"
android:src="@mipmap/icon_live_more" />
</LinearLayout>
<View
android:id="@+id/line"
android:layout_width="0dp"
android:layout_height="1.4dp"
android:layout_marginStart="8dp"
android:layout_marginTop="10dp"
android:layout_marginEnd="8dp"
android:background="@drawable/bg_line"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/btn_live_class" />
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/avatar"
android:layout_width="68dp"
android:layout_height="68dp"
android:layout_marginStart="8dp"
android:layout_marginTop="7dp"
android:layout_marginBottom="8dp"
android:background="@drawable/bg_live_upload_cover"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/line">
<ImageView
android:id="@+id/imageView5"
android:layout_width="18dp"
android:layout_height="18dp"
android:layout_marginTop="15dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:srcCompat="@mipmap/icon_live_ready_add" />
<TextView
android:id="@+id/cover_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="12dp"
android:text="@string/live_cover"
android:textColor="#FFFFFF"
android:textSize="12sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
<TextView
android:id="@+id/title_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="14dp"
android:layout_marginTop="25dp"
android:text="@string/live_title"
android:textColor="#C4FFFFFF"
android:textSize="12sp"
app:layout_constraintStart_toEndOf="@+id/avatar"
app:layout_constraintTop_toBottomOf="@+id/line" />
<EditText
android:id="@+id/edit_title"
android:layout_width="0dp"
android:layout_height="22dp"
android:layout_below="@id/title_text"
android:layout_marginStart="14dp"
android:layout_marginTop="8dp"
android:background="@null"
android:hint="@string/live_title_hint"
android:paddingRight="10dp"
android:singleLine="true"
android:textColor="#FFFFFF"
android:textColorHint="#FFFFFF"
android:textSize="15sp"
app:layout_constraintStart_toEndOf="@+id/avatar"
app:layout_constraintTop_toBottomOf="@+id/title_text" />
</androidx.constraintlayout.widget.ConstraintLayout>
<ImageView
android:id="@+id/btn_beauty"
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_marginStart="50dp"
android:layout_marginBottom="53dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:srcCompat="@mipmap/icon_beauty" />
<Button
android:id="@+id/btn_start_live"
android:layout_width="189dp"
android:layout_height="42dp"
android:layout_marginBottom="47dp"
android:background="@drawable/bg_live_ready_btn"
android:text="@string/live_start"
android:textColor="@color/white"
android:textSize="16sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 398 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 679 B

After

Width:  |  Height:  |  Size: 372 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

View File

@ -11,4 +11,10 @@
<string name="gurad_rank">Guard</string> <string name="gurad_rank">Guard</string>
<string name="fans">Fans</string> <string name="fans">Fans</string>
<string name="room_msg">News</string> <string name="room_msg">News</string>
<string name="live_room_title">SelectType</string>
<string name="live_room_public">Public</string>
<string name="live_room_private">PasswordRoom</string>
<string name="live_room_public_des">Everyone can watch</string>
<string name="live_room_private_des">Those who have a room password can watch</string>
<string name="live_room_type_submit">Submit</string>
</resources> </resources>

View File

@ -12,4 +12,10 @@
<string name="gurad_rank">觀眾</string> <string name="gurad_rank">觀眾</string>
<string name="fans">粉絲</string> <string name="fans">粉絲</string>
<string name="room_msg">私信</string> <string name="room_msg">私信</string>
<string name="live_room_title">選擇房間類型</string>
<string name="live_room_public">公開房</string>
<string name="live_room_private">密碼房</string>
<string name="live_room_public_des">所有人可觀看</string>
<string name="live_room_private_des">僅擁有房間密碼的人可觀看</string>
<string name="live_room_type_submit">確認</string>
</resources> </resources>

View File

@ -651,7 +651,7 @@ public class MainActivity extends AbsActivity implements MainAppBarLayoutListene
@Override @Override
public void onError(int code, String desc) { public void onError(int code, String desc) {
Log.i("tx", "登录失败"); Log.i("tx", "登录失败 code = "+code+" desc = "+desc);
} }
}); });
@ -682,7 +682,7 @@ public class MainActivity extends AbsActivity implements MainAppBarLayoutListene
@Override @Override
public void onError(int code, String desc) { public void onError(int code, String desc) {
Log.i("tx", "登录失败"); Log.i("tx", "登录失败 code = "+code+" desc = "+desc);
} }