聊天页私聊限制提示
This commit is contained in:
@@ -8,4 +8,6 @@ import lombok.Data;
|
||||
public class PrivateChatLimitInfo implements Serializable {
|
||||
private boolean chat;
|
||||
private String message;
|
||||
private int wealthLevel;
|
||||
private int charmLevel;
|
||||
}
|
||||
|
@@ -3,20 +3,32 @@ package com.yizhuan.erban.ui.im.fragment;
|
||||
import android.Manifest;
|
||||
import android.annotation.SuppressLint;
|
||||
import android.content.Intent;
|
||||
import android.graphics.Color;
|
||||
import android.media.AudioManager;
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.core.content.ContextCompat;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import android.text.SpannableString;
|
||||
import android.text.Spanned;
|
||||
import android.text.TextUtils;
|
||||
import android.text.method.LinkMovementMethod;
|
||||
import android.text.style.ClickableSpan;
|
||||
import android.text.style.ForegroundColorSpan;
|
||||
import android.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.FrameLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
|
||||
import com.alibaba.security.biometrics.build.G;
|
||||
import com.coorchice.library.utils.LogUtils;
|
||||
import com.google.gson.Gson;
|
||||
import com.netease.nim.uikit.api.UIKitOptions;
|
||||
@@ -56,13 +68,16 @@ import com.yizhuan.erban.R;
|
||||
import com.yizhuan.erban.avroom.game.GameSelectDialog;
|
||||
import com.yizhuan.erban.avroom.game.PlayGameActivity;
|
||||
import com.yizhuan.erban.bindadapter.BaseAdapter;
|
||||
import com.yizhuan.erban.common.widget.OriginalDrawStatusClickSpan;
|
||||
import com.yizhuan.erban.event.MessageSizeEvent;
|
||||
import com.yizhuan.erban.ui.im.GreetPresenter;
|
||||
import com.yizhuan.erban.ui.im.MessageListPanelEx;
|
||||
import com.yizhuan.erban.ui.im.avtivity.NimP2PMessageActivity;
|
||||
import com.yizhuan.erban.ui.im.chat.MVHChatterBoxStart;
|
||||
import com.yizhuan.erban.ui.im.model.IMCustomModel;
|
||||
import com.yizhuan.erban.ui.webview.CommonWebViewActivity;
|
||||
import com.yizhuan.erban.utils.PushMessageHandler;
|
||||
import com.yizhuan.xchat_android_core.UriProvider;
|
||||
import com.yizhuan.xchat_android_core.auth.AuthModel;
|
||||
import com.yizhuan.xchat_android_core.im.chatterbox.ChatterBoxHelper;
|
||||
import com.yizhuan.xchat_android_core.im.chatterbox.HideInputEvent;
|
||||
@@ -137,6 +152,7 @@ public class MessageFragment extends TFragment implements ModuleProxy, MessageLi
|
||||
private RecyclerView recyclerView;
|
||||
|
||||
private RxPermissions rxPermissions;
|
||||
private TextView tvChatLimit;
|
||||
|
||||
// private int limitLevel;
|
||||
// private int currentLevel;
|
||||
@@ -160,6 +176,7 @@ public class MessageFragment extends TFragment implements ModuleProxy, MessageLi
|
||||
}
|
||||
|
||||
private void initView() {
|
||||
tvChatLimit = rootView.findViewById(R.id.tv_chat_limit);
|
||||
if (!ImGameMode.gameSwitch || MarketVerifyModel.get().isMarketChecking()) {
|
||||
rootView.findViewById(R.id.iv_game).setVisibility(View.GONE);
|
||||
}
|
||||
@@ -185,6 +202,8 @@ public class MessageFragment extends TFragment implements ModuleProxy, MessageLi
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
private void initUserLikeGame() {
|
||||
boolean aBoolean = getArguments().getBoolean(NimP2PMessageActivity.IS_BY_MATCH, false);
|
||||
if (aBoolean) {
|
||||
@@ -769,6 +788,7 @@ public class MessageFragment extends TFragment implements ModuleProxy, MessageLi
|
||||
public void onReloadInputPanel(MessageSizeEvent event) {
|
||||
if (inputPanel != null) {
|
||||
if (event.getSize() > 0){
|
||||
tvChatLimit.setVisibility(View.GONE);
|
||||
inputPanel.setLimitLevel(true,"");
|
||||
}else {
|
||||
IMCustomModel.get().getPrivateChatLimit().subscribe(((privateChatLimitInfo, throwable) -> {
|
||||
@@ -776,8 +796,42 @@ public class MessageFragment extends TFragment implements ModuleProxy, MessageLi
|
||||
throwable.printStackTrace();
|
||||
} else {
|
||||
isChat = privateChatLimitInfo.isChat();
|
||||
hintText = privateChatLimitInfo.getMessage();
|
||||
hintText = "暂无权利发起私聊";
|
||||
inputPanel.setLimitLevel(privateChatLimitInfo.isChat(), privateChatLimitInfo.getMessage());
|
||||
|
||||
String experLevel = "财富等级≥"+privateChatLimitInfo.getWealthLevel();
|
||||
String charmLevel = "魅力等级≥" + privateChatLimitInfo.getCharmLevel();
|
||||
String privacyAgreementDescTip = getContext().getString(R.string.text_chat_limit, experLevel, charmLevel);
|
||||
SpannableString ss = new SpannableString(privacyAgreementDescTip);
|
||||
int experLevelIndex = privacyAgreementDescTip.indexOf(experLevel);
|
||||
int charmLevelIndex = privacyAgreementDescTip.indexOf(charmLevel);
|
||||
|
||||
|
||||
ss.setSpan(new ForegroundColorSpan(ContextCompat.getColor(getContext(), R.color.appColor)), experLevelIndex, experLevelIndex + experLevel.length(), Spanned.SPAN_INCLUSIVE_EXCLUSIVE);
|
||||
ss.setSpan(new OriginalDrawStatusClickSpan(ContextCompat.getColor(getContext(), R.color.appColor)) {
|
||||
@Override
|
||||
public void onClick(@NonNull View widget) {
|
||||
if (widget instanceof TextView)
|
||||
((TextView) widget).setHighlightColor(getResources().getColor(android.R.color.transparent));
|
||||
|
||||
CommonWebViewActivity.start(getContext(), UriProvider.getUserLevelUrl());
|
||||
}
|
||||
}, experLevelIndex, experLevelIndex + experLevel.length(), Spanned.SPAN_INCLUSIVE_EXCLUSIVE);
|
||||
ss.setSpan(new ForegroundColorSpan(ContextCompat.getColor(getContext(), R.color.appColor)), charmLevelIndex, charmLevelIndex + charmLevel.length(), Spanned.SPAN_INCLUSIVE_EXCLUSIVE);
|
||||
ss.setSpan(new OriginalDrawStatusClickSpan(ContextCompat.getColor(getContext(), R.color.appColor)) {
|
||||
@Override
|
||||
public void onClick(@NonNull View widget) {
|
||||
if (widget instanceof TextView)
|
||||
((TextView) widget).setHighlightColor(getResources().getColor(android.R.color.transparent));
|
||||
|
||||
CommonWebViewActivity.start(getContext(), UriProvider.getUserLevelUrl());
|
||||
}
|
||||
}, charmLevelIndex, charmLevelIndex + experLevel.length(), Spanned.SPAN_INCLUSIVE_EXCLUSIVE);
|
||||
|
||||
tvChatLimit.setText(ss);
|
||||
tvChatLimit.setHighlightColor(Color.TRANSPARENT);
|
||||
tvChatLimit.setMovementMethod(new LinkMovementMethod());
|
||||
tvChatLimit.setVisibility(View.VISIBLE);
|
||||
}
|
||||
}));
|
||||
}
|
||||
|
6
app/src/main/res/drawable/bg_chat_limit.xml
Normal file
6
app/src/main/res/drawable/bg_chat_limit.xml
Normal file
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<solid android:color="@color/color_F4F4F4"
|
||||
/>
|
||||
<corners android:radius="@dimen/dp_15"/>
|
||||
</shape>
|
@@ -100,6 +100,8 @@
|
||||
<string name="menu_setting">设置</string>
|
||||
<string name="menu_certification">实名认证</string>
|
||||
|
||||
<string name="text_chat_limit">仅%s或%s的用于可发起聊天</string>
|
||||
|
||||
<string name="room_offline">房主已下线</string>
|
||||
<string name="root_offline_notice">更多好玩的房间在66星球等您哟!去看看!</string>
|
||||
<string name="home">主页</string>
|
||||
|
@@ -46,6 +46,8 @@
|
||||
android:layout_marginTop="55dp" />
|
||||
</FrameLayout>
|
||||
|
||||
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/message_activity_list_view_container"
|
||||
android:layout_width="match_parent"
|
||||
@@ -113,6 +115,20 @@
|
||||
</LinearLayout>
|
||||
</FrameLayout>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_chat_limit"
|
||||
android:layout_width="180dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_marginTop="@dimen/dp_20"
|
||||
android:text="哈哈哈哈哈"
|
||||
android:paddingStart="@dimen/dp_10"
|
||||
android:paddingEnd="@dimen/dp_10"
|
||||
android:paddingTop="@dimen/dp_2"
|
||||
android:paddingBottom="@dimen/dp_2"
|
||||
android:background="@drawable/bg_chat_limit"
|
||||
android:visibility="gone"
|
||||
/>
|
||||
</RelativeLayout>
|
||||
|
||||
<com.yizhuan.erban.common.widget.DragLayout
|
||||
|
@@ -969,7 +969,7 @@ public class InputPanel implements IEmoticonSelectedListener, IAudioRecordCallba
|
||||
|
||||
private void setEditTextState() {
|
||||
if (!isChat) {
|
||||
messageEditText.setHint(hintText);
|
||||
messageEditText.setHint("暂无权利发起私聊");
|
||||
messageEditText.setFocusable(false);
|
||||
messageEditText.setFocusableInTouchMode(false);
|
||||
messageEditText.setEnabled(false);
|
||||
|
Reference in New Issue
Block a user