add 分享
add 聊天页面右上角菜单
This commit is contained in:
@@ -123,6 +123,7 @@ import com.yunbao.live.http.ImHttpUtil;
|
||||
import com.yunbao.live.views.LiveRoomPlayViewHolder;
|
||||
import com.yunbao.live.views.LiveRoomViewHolder;
|
||||
import com.yunbao.live.views.PortraitLiveManager;
|
||||
import com.yunbao.share.bean.ShareBean;
|
||||
import com.yunbao.share.ui.SharePopDialog;
|
||||
|
||||
import org.greenrobot.eventbus.EventBus;
|
||||
@@ -865,7 +866,7 @@ public class LiveAudienceActivity extends LiveActivity {
|
||||
if (!TextUtils.isEmpty(event.getMethod())) {
|
||||
if (TextUtils.equals(event.getMethod(), "closeLiveRoom")) {
|
||||
onBackPressed();
|
||||
}else if (TextUtils.equals(event.getMethod(), "androidtoCommunityVideo")) {
|
||||
} else if (TextUtils.equals(event.getMethod(), "androidtoCommunityVideo")) {
|
||||
RouteUtil.forwardCommunityActivity();
|
||||
}
|
||||
}
|
||||
@@ -1460,10 +1461,16 @@ public class LiveAudienceActivity extends LiveActivity {
|
||||
break;
|
||||
case LIVE_SHARE:
|
||||
new SharePopDialog(mContext)
|
||||
.setUid(CommonAppConfig.getInstance().getUid())
|
||||
.setAnchorId(event.getBean().getUid())
|
||||
.setAnchorName(event.getBean().getUserNiceName())
|
||||
.setAnchorAvatar(event.getBean().getAvatar())
|
||||
.setShareType(SharePopDialog.TYPE_LIVE)
|
||||
.setShareData(ShareBean.ShareBuilder.create()
|
||||
.setUid(CommonAppConfig.getInstance().getUid())
|
||||
.setCover(StringUtil.isEmpty(event.getBean().getImg()) ? event.getBean().getAvatar() : event.getBean().getImg())
|
||||
.setTitle(StringUtil.isEmpty(event.getBean().getTitle()) ? event.getBean().getUserNiceName() : event.getBean().getTitle())
|
||||
.setAnchorId(event.getBean().getUid())
|
||||
.setAnchorName(event.getBean().getUserNiceName())
|
||||
.setAnchorAvatar(event.getBean().getAvatar())
|
||||
.build()
|
||||
)
|
||||
.showDialog();
|
||||
break;
|
||||
case WISH_LIST_PROGRESS:
|
||||
|
||||
@@ -13,6 +13,8 @@ import android.widget.PopupWindow;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.yunbao.common.http.HttpClient;
|
||||
import com.yunbao.common.utils.DpUtil;
|
||||
import com.yunbao.common.utils.RouteUtil;
|
||||
import com.yunbao.common.utils.ToastUtil;
|
||||
import com.yunbao.live.R;
|
||||
import com.yunbao.live.activity.EditNameRemarksActivity;
|
||||
@@ -26,15 +28,15 @@ import io.rong.imlib.RongIMClient;
|
||||
public class MenuPopuwWindow implements View.OnClickListener {
|
||||
private Activity mContext;
|
||||
private String userId;
|
||||
private View popupView;
|
||||
private TextView tvBlack, tvBlackMove;
|
||||
private View popupView, ltBlack, ltReport;
|
||||
private TextView tvBlack;
|
||||
private LinearLayout ltRemarks;
|
||||
private PopupWindow popupWindow;
|
||||
private Handler netHandler = new Handler();
|
||||
|
||||
public MenuPopuwWindow(Activity context) {
|
||||
this.mContext = context;
|
||||
popupView = LayoutInflater.from(mContext).inflate(R.layout.popwindow_chat_more, null);
|
||||
popupView = LayoutInflater.from(mContext).inflate(R.layout.popwindow_chat_more_v2, null);
|
||||
initView();
|
||||
}
|
||||
|
||||
@@ -43,19 +45,18 @@ public class MenuPopuwWindow implements View.OnClickListener {
|
||||
|
||||
if (TextUtils.equals(isAdmin, "1")) {
|
||||
tvBlack.setVisibility(View.GONE);
|
||||
tvBlackMove.setVisibility(View.GONE);
|
||||
ltRemarks.setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
ltRemarks.setVisibility(View.GONE);
|
||||
ltRemarks.setVisibility(View.VISIBLE);
|
||||
RongIMClient.getInstance().getBlacklistStatus(userId, new RongIMClient.ResultCallback<RongIMClient.BlacklistStatus>() {
|
||||
@Override
|
||||
public void onSuccess(RongIMClient.BlacklistStatus blacklistStatus) {
|
||||
if (blacklistStatus == RongIMClient.BlacklistStatus.IN_BLACK_LIST) {
|
||||
tvBlackMove.setVisibility(View.VISIBLE);
|
||||
tvBlack.setVisibility(View.GONE);
|
||||
tvBlack.setTag("1");
|
||||
tvBlack.setText(R.string.black_ing);
|
||||
} else {
|
||||
tvBlack.setVisibility(View.VISIBLE);
|
||||
tvBlackMove.setVisibility(View.GONE);
|
||||
tvBlack.setTag(null);
|
||||
tvBlack.setText(R.string.black);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -73,10 +74,11 @@ public class MenuPopuwWindow implements View.OnClickListener {
|
||||
*/
|
||||
private void initView() {
|
||||
tvBlack = popupView.findViewById(R.id.tv_black);
|
||||
tvBlackMove = popupView.findViewById(R.id.tv_black_move);
|
||||
ltBlack = popupView.findViewById(R.id.lt_black);
|
||||
ltReport = popupView.findViewById(R.id.lt_report);
|
||||
ltRemarks = popupView.findViewById(R.id.lt_remarks);
|
||||
tvBlack.setOnClickListener(this);
|
||||
tvBlackMove.setOnClickListener(this);
|
||||
ltBlack.setOnClickListener(this);
|
||||
ltReport.setOnClickListener(this);
|
||||
ltRemarks.setOnClickListener(this);
|
||||
}
|
||||
|
||||
@@ -87,7 +89,7 @@ public class MenuPopuwWindow implements View.OnClickListener {
|
||||
* @return
|
||||
*/
|
||||
public void show(View view) {
|
||||
popupWindow = new PopupWindow(popupView, ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT, true);
|
||||
popupWindow = new PopupWindow(popupView, DpUtil.dp2px(97), ViewGroup.LayoutParams.WRAP_CONTENT, true);
|
||||
popupWindow.showAsDropDown(view);
|
||||
WindowManager.LayoutParams lp = mContext.getWindow().getAttributes();
|
||||
lp.alpha = 0.8f;
|
||||
@@ -105,40 +107,14 @@ public class MenuPopuwWindow implements View.OnClickListener {
|
||||
public void onClick(View v) {
|
||||
int id = v.getId();
|
||||
//拉黑
|
||||
if (id == R.id.tv_black) {
|
||||
RongIMClient.getInstance().addToBlacklist(userId, new RongIMClient.OperationCallback() {
|
||||
@Override
|
||||
public void onSuccess() {
|
||||
ToastUtil.show(mContext.getResources().getString(R.string.black_succer));
|
||||
popupWindow.dismiss();
|
||||
tvBlack.setVisibility(View.VISIBLE);
|
||||
tvBlackMove.setVisibility(View.GONE);
|
||||
netHandler.post(setBlackRunnable);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(RongIMClient.ErrorCode errorCode) {
|
||||
ToastUtil.show(errorCode.msg);
|
||||
popupWindow.dismiss();
|
||||
}
|
||||
});
|
||||
} else if (id == R.id.tv_black_move) {//移出黑名单
|
||||
RongIMClient.getInstance().removeFromBlacklist(userId, new RongIMClient.OperationCallback() {
|
||||
@Override
|
||||
public void onSuccess() {
|
||||
ToastUtil.show(mContext.getResources().getString(R.string.black_succer_more));
|
||||
popupWindow.dismiss();
|
||||
tvBlackMove.setVisibility(View.VISIBLE);
|
||||
tvBlack.setVisibility(View.GONE);
|
||||
netHandler.post(setBlackRunnable);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(RongIMClient.ErrorCode errorCode) {
|
||||
ToastUtil.show(errorCode.msg);
|
||||
popupWindow.dismiss();
|
||||
}
|
||||
});
|
||||
if (id == R.id.lt_black) {
|
||||
if (tvBlack.getTag() == null) {
|
||||
black();
|
||||
} else {
|
||||
unblack();
|
||||
}
|
||||
} else if (id == R.id.lt_report) {//移出黑名单
|
||||
RouteUtil.forwardLiveReportActivity(userId);
|
||||
} else if (id == R.id.lt_remarks) {//添加备注
|
||||
Intent intent = new Intent(mContext, EditNameRemarksActivity.class);
|
||||
intent.putExtra(EditNameRemarksActivity.NAMEREMARK, userId);
|
||||
@@ -147,6 +123,40 @@ public class MenuPopuwWindow implements View.OnClickListener {
|
||||
}
|
||||
}
|
||||
|
||||
private void black() {
|
||||
RongIMClient.getInstance().addToBlacklist(userId, new RongIMClient.OperationCallback() {
|
||||
@Override
|
||||
public void onSuccess() {
|
||||
ToastUtil.show(mContext.getResources().getString(R.string.black_succer));
|
||||
popupWindow.dismiss();
|
||||
netHandler.post(setBlackRunnable);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(RongIMClient.ErrorCode errorCode) {
|
||||
ToastUtil.show(errorCode.msg);
|
||||
popupWindow.dismiss();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void unblack() {
|
||||
RongIMClient.getInstance().removeFromBlacklist(userId, new RongIMClient.OperationCallback() {
|
||||
@Override
|
||||
public void onSuccess() {
|
||||
ToastUtil.show(mContext.getResources().getString(R.string.black_succer_more));
|
||||
popupWindow.dismiss();
|
||||
netHandler.post(setBlackRunnable);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(RongIMClient.ErrorCode errorCode) {
|
||||
ToastUtil.show(errorCode.msg);
|
||||
popupWindow.dismiss();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
//将对方拉黑或者解除拉黑(自己后台)
|
||||
private Runnable setBlackRunnable = new Runnable() {
|
||||
@Override
|
||||
|
||||
103
live/src/main/res/layout/popwindow_chat_more_v2.xml
Normal file
103
live/src/main/res/layout/popwindow_chat_more_v2.xml
Normal file
@@ -0,0 +1,103 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="97dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@drawable/background_d5_white"
|
||||
android:gravity="center"
|
||||
android:orientation="vertical">
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/lt_remarks"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="10dp"
|
||||
android:layout_marginEnd="10dp"
|
||||
android:gravity="start|center"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<ImageView
|
||||
android:layout_width="16dp"
|
||||
android:layout_height="16dp"
|
||||
android:layout_marginEnd="7dp"
|
||||
android:src="@mipmap/ic_chat_remarks" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_remarks"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="40dp"
|
||||
android:gravity="center"
|
||||
android:text="@string/chat_remarks"
|
||||
android:textColor="@color/black1"
|
||||
android:textSize="13sp"
|
||||
android:textStyle="bold"
|
||||
android:visibility="visible" />
|
||||
</LinearLayout>
|
||||
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0.5dp"
|
||||
android:layout_marginLeft="6dp"
|
||||
android:layout_marginRight="6dp"
|
||||
android:background="@color/gray_dcdcdc" />
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/lt_report"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="10dp"
|
||||
android:layout_marginEnd="10dp"
|
||||
android:gravity="start|center"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<ImageView
|
||||
android:layout_width="16dp"
|
||||
android:layout_height="16dp"
|
||||
android:layout_marginEnd="7dp"
|
||||
android:src="@mipmap/ic_chat_report" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_report"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="40dp"
|
||||
android:gravity="center"
|
||||
android:text="@string/chat_report"
|
||||
android:textColor="@color/black1"
|
||||
android:textSize="13sp"
|
||||
android:textStyle="bold" />
|
||||
</LinearLayout>
|
||||
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0.5dp"
|
||||
android:layout_marginLeft="6dp"
|
||||
android:layout_marginRight="6dp"
|
||||
android:background="@color/gray_dcdcdc" />
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/lt_black"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="10dp"
|
||||
android:layout_marginEnd="10dp"
|
||||
android:gravity="start|center"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<ImageView
|
||||
android:layout_width="16dp"
|
||||
android:layout_height="16dp"
|
||||
android:layout_marginEnd="7dp"
|
||||
android:src="@mipmap/ic_chat_black" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_black"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="40dp"
|
||||
android:gravity="center"
|
||||
android:text="@string/black"
|
||||
android:textColor="@color/black1"
|
||||
android:textSize="13sp"
|
||||
android:textStyle="bold" />
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
</LinearLayout>
|
||||
Reference in New Issue
Block a user