我的tab 私聊页面 UI修改

This commit is contained in:
huangjian
2021-03-11 18:47:17 +08:00
parent 4321f3d271
commit 641e3b0bf2
69 changed files with 331 additions and 2483 deletions

View File

@@ -375,3 +375,13 @@
public static ** inflate(***);
}
#Flutter Wrapper
-dontwarn io.flutter.**
-keep class io.flutter.app.** { *; }
-keep class io.flutter.plugin.** { *; }
-keep class io.flutter.util.** { *; }
-keep class io.flutter.view.** { *; }
-keep class io.flutter.embedding.android.** { *; }
-keep class io.flutter.plugins.** { *; }
-keep class com.yuxiaor.flutter.g_faraday.** { *; }

View File

@@ -167,16 +167,15 @@ public class MeFragment extends BaseMvpFragment<IMainFragmentView, MainFragmentP
HallDataManager.get().registerHallExist(this, hallExist -> {
if (hallExist != null && hallExist) {
if (HallDataManager.get().isHasClan()) {
mBinding.tvHallIn.setText("我的家族");
mBinding.meItemUnion.setText("我的家族");
} else {
mBinding.tvHallIn.setText("我的公会");
mBinding.meItemUnion.setText("我的公会");
}
mBinding.llModuleHall.setVisibility(View.VISIBLE);
mBinding.meItemUnion.setVisibility(View.VISIBLE);
return;
}
mBinding.llModuleHall.setVisibility(View.GONE);
mBinding.meItemUnion.setVisibility(View.GONE);
});
// HallDataManager.get().registerName(this, name -> mBinding.tvModuleHall.setText(name));
if (TuTuGuideHelper.isNeedHiGuide(TuTuGuideHelper.KEY_GUIDE_ME_TAB)) {
mBinding.meItemRadish.post(() -> {

View File

@@ -1,94 +0,0 @@
package com.yizhuan.erban.ui.im.chat;
import androidx.core.content.ContextCompat;
import android.view.View;
import android.widget.TextView;
import com.netease.nim.uikit.business.session.viewholder.MsgViewHolderBase;
import com.netease.nim.uikit.common.ui.recyclerview.adapter.BaseMultiItemFetchLoadAdapter;
import com.yizhuan.erban.R;
import com.yizhuan.xchat_android_core.im.chatterbox.ChatterBoxHelper;
import com.yizhuan.xchat_android_core.manager.IMNetEaseManager;
import com.yizhuan.xchat_android_core.statistic.StatisticManager;
import com.yizhuan.xchat_android_core.statistic.protocol.StatisticsProtocol;
import java.util.HashMap;
import java.util.Map;
public class MVHChatterBoxInit extends MsgViewHolderBase implements View.OnClickListener {
private static final String LOCAL_CLICKED = "clicked";
private TextView tvChatterBoxInit;
private Map<String, Object> localExtension;
public MVHChatterBoxInit(BaseMultiItemFetchLoadAdapter adapter) {
super(adapter);
}
@Override
protected int getContentResId() {
return R.layout.layout_chatterbox_init;
}
@Override
protected void inflateContentView() {
tvChatterBoxInit = findViewById(R.id.tv_chatterbox_init);
localExtension = message.getLocalExtension();
}
@Override
protected void bindContentView() {
boolean clicked = false;
if (localExtension != null) {
Object object = localExtension.get(LOCAL_CLICKED);
if (object != null) {
clicked = (boolean) object;
}
}
tvChatterBoxInit.setEnabled(!clicked);
if (!clicked) {
tvChatterBoxInit.setOnClickListener(this);
tvChatterBoxInit.setTextColor(ContextCompat.getColor(context, R.color.appColor));
tvChatterBoxInit.setBackgroundResource(R.drawable.bg_chatterbox_init_valid);
} else {
tvChatterBoxInit.setTextColor(ContextCompat.getColor(context, R.color.color_CCCCCC));
tvChatterBoxInit.setBackgroundResource(R.drawable.bg_chatterbox_init_invalid);
}
}
@Override
public void onClick(View v) {
StatisticManager.Instance().onEvent(StatisticsProtocol.Event.EVENT_MESSAGE_HOME_START_CHATTER_BOX, "首页-私聊-点击话匣子");
if (localExtension == null) {
localExtension = new HashMap<>();
}
localExtension.put(LOCAL_CLICKED, true);
message.setLocalExtension(localExtension);
IMNetEaseManager.get().updateMessageToLocal(message);
adapter.notifyDataSetChanged();
ChatterBoxHelper.topicBoxCanSend();
}
@Override
protected boolean isMiddleItem() {
return true;
}
@Override
protected boolean isShowHeadImage() {
return false;
}
@Override
protected boolean isShowBubble() {
return false;
}
@Override
protected boolean shouldDisplayReceipt() {
return false;
}
}

View File

@@ -1,64 +0,0 @@
package com.yizhuan.erban.ui.im.chat;
import android.widget.ImageView;
import android.widget.TextView;
import com.netease.nim.uikit.business.session.viewholder.MsgViewHolderBase;
import com.netease.nim.uikit.common.ui.recyclerview.adapter.BaseMultiItemFetchLoadAdapter;
import com.yizhuan.erban.R;
import com.yizhuan.xchat_android_core.im.custom.bean.DiceThrowAttachment;
public class MVHDiceThrow extends MsgViewHolderBase {
private ImageView ivDiceCount;
public MVHDiceThrow(BaseMultiItemFetchLoadAdapter adapter) {
super(adapter);
}
@Override
protected int getContentResId() {
return R.layout.layout_dice_throw;
}
@Override
protected void inflateContentView() {
ivDiceCount = findViewById(R.id.iv_dice_count);
}
@Override
protected void bindContentView() {
contentContainer.setBackgroundResource(0);
DiceThrowAttachment attachment = (DiceThrowAttachment) message.getAttachment();
if (attachment != null) {
switch (attachment.pointCount) {
case 1:
ivDiceCount.setImageResource(R.drawable.dice_1);
break;
case 2:
ivDiceCount.setImageResource(R.drawable.dice_2);
break;
case 3:
ivDiceCount.setImageResource(R.drawable.dice_3);
break;
case 4:
ivDiceCount.setImageResource(R.drawable.dice_4);
break;
case 5:
ivDiceCount.setImageResource(R.drawable.dice_5);
break;
case 6:
ivDiceCount.setImageResource(R.drawable.dice_6);
break;
}
}
}
}

View File

@@ -1,47 +0,0 @@
package com.yizhuan.erban.ui.im.chat;
import androidx.databinding.DataBindingUtil;
import com.netease.nim.uikit.business.session.viewholder.MsgViewHolderBase;
import com.netease.nim.uikit.common.ui.recyclerview.adapter.BaseMultiItemFetchLoadAdapter;
import com.yizhuan.erban.R;
import com.yizhuan.erban.databinding.ItemImTipsBinding;
import com.yizhuan.xchat_android_core.im.custom.bean.ImTipAttachment;
public class MsgViewHolderTip extends MsgViewHolderBase {
private ItemImTipsBinding mBinding;
public MsgViewHolderTip(BaseMultiItemFetchLoadAdapter adapter) {
super(adapter);
}
@Override
protected int getContentResId() {
return R.layout.item_im_tips;
}
@Override
protected boolean isMiddleItem() {
return true;
}
@Override
protected void inflateContentView() {
mBinding = DataBindingUtil.bind(findViewById(R.id.root));
}
@Override
protected boolean shouldDisplayReceipt() {
return false;
}
@Override
protected void bindContentView() {
ImTipAttachment attachment = (ImTipAttachment) message.getAttachment();
if (attachment != null) {
mBinding.tvTips.setText(attachment.getMsg());
}
}
}

View File

@@ -1,136 +0,0 @@
package com.yizhuan.erban.ui.im.chat;
import android.view.View;
import android.widget.TextView;
import com.netease.nim.uikit.business.session.helper.MessageListPanelHelper;
import com.netease.nim.uikit.business.session.viewholder.MsgViewHolderBase;
import com.netease.nim.uikit.common.ui.recyclerview.adapter.BaseMultiItemFetchLoadAdapter;
import com.netease.nimlib.sdk.msg.MessageBuilder;
import com.netease.nimlib.sdk.msg.attachment.MsgAttachment;
import com.netease.nimlib.sdk.msg.constant.SessionTypeEnum;
import com.netease.nimlib.sdk.msg.model.IMMessage;
import com.yizhuan.erban.R;
import com.yizhuan.xchat_android_core.audio.bean.VoiceBottleSayHiInfo;
import com.yizhuan.xchat_android_core.auth.AuthModel;
import com.yizhuan.xchat_android_core.im.custom.bean.VoiceBottleSayHiAttachment;
import com.yizhuan.xchat_android_core.im.custom.bean.VoiceBottleShakeHeartAttachment;
import com.yizhuan.xchat_android_core.manager.IMNetEaseManager;
import com.yizhuan.xchat_android_core.statistic.StatisticManager;
import com.yizhuan.xchat_android_core.statistic.protocol.StatisticsProtocol;
import com.yizhuan.xchat_android_library.utils.SingleToastUtil;
import java.util.HashMap;
import java.util.Map;
import io.reactivex.SingleObserver;
import io.reactivex.disposables.Disposable;
/**
* 声音瓶子打招呼提示信息
*/
public class MsgViewHolderVoiceBottleSayHi extends MsgViewHolderBase implements View.OnClickListener {
private TextView tvSayHi;
private Map<String, Object> localExtension;
private VoiceBottleSayHiInfo sayHiInfo;
public MsgViewHolderVoiceBottleSayHi(BaseMultiItemFetchLoadAdapter adapter) {
super(adapter);
}
@Override
protected int getContentResId() {
return R.layout.layout_msg_view_holder_voice_bottle_say_hi;
}
@Override
protected void inflateContentView() {
IMMessage imMessage = IMNetEaseManager.get().queryMessageByUuid(message.getUuid());
if (imMessage != null) {
localExtension = imMessage.getLocalExtension();
}
MsgAttachment attachment = message.getAttachment();
if (attachment instanceof VoiceBottleSayHiAttachment) {
VoiceBottleSayHiAttachment sayHiAttachment = (VoiceBottleSayHiAttachment) attachment;
sayHiInfo = sayHiAttachment.getSayHiInfo();
}
tvSayHi = findViewById(R.id.tv_voice_say_hi);
}
@Override
protected void bindContentView() {
if (localExtension != null && localExtension.containsKey(VoiceBottleSayHiAttachment.KEY_VOICE_BOTTLE_HAVE_SAY_HI)) {
boolean haveSayHi = (boolean) localExtension.get(VoiceBottleSayHiAttachment.KEY_VOICE_BOTTLE_HAVE_SAY_HI);
tvSayHi.setEnabled(!haveSayHi);
} else {
tvSayHi.setEnabled(true);
}
tvSayHi.setOnClickListener(this);
}
@Override
public void onClick(View view) {
int id = view.getId();
if (id == R.id.tv_voice_say_hi) {
StatisticManager.Instance().onEvent(StatisticsProtocol.Event.EVENT_PRIVATE_CHAT_SAY_HELLO, "私聊页-打个招呼");
// 更新当前打招呼消息
Map<String, Object> extension = message.getLocalExtension();
if (extension == null) {
extension = new HashMap<>();
}
extension.put(VoiceBottleSayHiAttachment.KEY_VOICE_BOTTLE_HAVE_SAY_HI, true);
this.localExtension = extension;
message.setLocalExtension(localExtension);
IMNetEaseManager.get().updateMessageToLocal(message);
tvSayHi.setEnabled(false);
// 发消息给对方
IMMessage shakeHeartMessage = MessageBuilder.createCustomMessage(
String.valueOf(message.getSessionId()),
SessionTypeEnum.P2P, new VoiceBottleShakeHeartAttachment(sayHiInfo));
shakeHeartMessage.setFromAccount(String.valueOf(AuthModel.get().getCurrentUid()));
HashMap<String, Object> localExtension = new HashMap<>();
localExtension.put(VoiceBottleShakeHeartAttachment.KEY_VOICE_BOTTLE_NEED_SHAKE_HEART, true);
shakeHeartMessage.setLocalExtension(localExtension);
IMNetEaseManager.get().sendMessageSingle(shakeHeartMessage)
.subscribe(new SingleObserver<IMMessage>() {
@Override
public void onSubscribe(Disposable d) {
}
@Override
public void onSuccess(IMMessage imMessage) {
MessageListPanelHelper.getInstance().notifyAddMessage(imMessage);// 手动刷新 UI
}
@Override
public void onError(Throwable e) {
SingleToastUtil.showToast(e.getMessage());
}
});
}
}
@Override
protected boolean isMiddleItem() {
return true;
}
@Override
protected boolean isShowHeadImage() {
return false;
}
@Override
protected boolean isShowBubble() {
return false;
}
@Override
protected boolean shouldDisplayReceipt() {
return false;
}
}

View File

@@ -1,70 +0,0 @@
package com.yizhuan.erban.ui.im.chat;
import android.app.Activity;
import android.graphics.Color;
import android.text.Spannable;
import android.text.SpannableStringBuilder;
import android.text.TextUtils;
import android.text.style.ForegroundColorSpan;
import android.widget.TextView;
import com.netease.nim.uikit.business.session.viewholder.MsgViewHolderBase;
import com.netease.nim.uikit.common.ui.recyclerview.adapter.BaseMultiItemFetchLoadAdapter;
import com.netease.nimlib.sdk.msg.attachment.MsgAttachment;
import com.yizhuan.erban.R;
import com.yizhuan.erban.ui.im.RouterHandler;
import com.yizhuan.xchat_android_core.audio.bean.SysMsgVoiceInfo;
import com.yizhuan.xchat_android_core.im.custom.bean.SysMsgVoiceAttachment;
import com.yizhuan.xchat_android_core.utils.ActivityUtil;
/**
* 声音瓶子,审核结果的系统消息
*/
public class SysMsgVoiceViewHolder extends MsgViewHolderBase {
private TextView tvContent, button;
public SysMsgVoiceViewHolder(BaseMultiItemFetchLoadAdapter adapter) {
super(adapter);
}
@Override
protected int getContentResId() {
return R.layout.layout_msg_view_holder_voice_sys_msg;
}
@Override
protected void inflateContentView() {
tvContent = findViewById(R.id.tv_msg_view_holder_voice_content);
button = findViewById(R.id.tv_msg_view_holder_voice_button);
}
@Override
protected void bindContentView() {
MsgAttachment attachment = message.getAttachment();
if (attachment instanceof SysMsgVoiceAttachment) {
SysMsgVoiceAttachment voiceAttachment = (SysMsgVoiceAttachment) attachment;
SysMsgVoiceInfo voiceInfo = voiceAttachment.getVoiceInfo();
if (voiceInfo.status == 1) {// 1 审核通过
tvContent.setText(context.getString(R.string.voice_msg_view_holder_voice_content_pass_verification));
button.setText("声音匹配");
} else if (voiceInfo.status == 4) {// 4 审核不通过
// 原因高亮
String reason = TextUtils.isEmpty(voiceInfo.reason) ? "" : "" + voiceInfo.reason + "";
SpannableStringBuilder reasonHighLight = new SpannableStringBuilder(reason);
reasonHighLight.setSpan(new ForegroundColorSpan(Color.parseColor("#FFB606")), 0, reason.length(), Spannable.SPAN_INCLUSIVE_EXCLUSIVE);
// 拼接提示文案
SpannableStringBuilder showContent = new SpannableStringBuilder();
showContent.append("你录制的声音没有通过审核,理由为: ").append(reasonHighLight).append(" 快重新录制一条吧~");
tvContent.setText(showContent);
button.setText("我的声音");
}
button.setOnClickListener(view -> {
if (ActivityUtil.isValidContext(context)) {
((Activity) context).finish();
}
RouterHandler.handle(context, voiceInfo.routerType, voiceInfo.routerValue);
});
}
}
}

View File

@@ -90,7 +90,7 @@ public abstract class RecentViewHolder extends RecyclerViewHolder<BaseQuickAdapt
protected void updateBackground(BaseViewHolder holder, RecentContact recent, int position) {
if ((recent.getTag() & RecentContactsFragment.RECENT_TAG_STICKY) == 0) {
holder.getConvertView().setBackgroundResource(R.drawable.bg_common_touch_while);
holder.getConvertView().setBackgroundResource(R.drawable.bg_nim_msg_touch);
} else {
holder.getConvertView().setBackgroundResource(R.drawable.nim_recent_contact_sticky_selecter);
}

View File

@@ -409,7 +409,7 @@ public class JSInterface {
JSONObject jsonObject = new JSONObject();
jsonObject.put("os", "android");
jsonObject.put("osVersion", Build.VERSION.RELEASE);
jsonObject.put("app", "tutu");
jsonObject.put("app", "yinyou");
jsonObject.put("ispType", String.valueOf(SystemUtils.getIspType(context)));
jsonObject.put("netType", String.valueOf(SystemUtils.getNetworkType(context)));
jsonObject.put("model", SystemUtils.getPhoneModel());

View File

@@ -2,5 +2,5 @@
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@color/item_hover" android:state_pressed="true" />
<item android:drawable="@color/item_hover" android:state_focused="true" />
<item android:drawable="@color/color_1c1b22" />
<item android:drawable="@color/color_white" />
</selector>

View File

@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@color/item_hover_nim" android:state_pressed="true" />
<item android:drawable="@color/item_hover_nim" android:state_focused="true" />
<item android:drawable="@color/color_1c1b22" />
</selector>

View File

@@ -3,11 +3,10 @@
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:background="@color/color_1c1b22"
android:layout_height="match_parent">
<LinearLayout 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"
<LinearLayout
android:id="@+id/message_fragment_container"
android:layout_width="match_parent"
android:layout_height="match_parent"
@@ -24,7 +23,7 @@
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="@color/white"
android:background="@color/color_1c1b22"
app:subtitleTextAppearance="@style/Toolbar.SubTitleText"
app:titleTextAppearance="@style/Toolbar.TitleText">
@@ -49,6 +48,7 @@
android:maxWidth="214dp"
android:maxLines="1"
android:singleLine="true"
android:textColor="@color/white"
android:textAppearance="@style/Toolbar.TitleText"
android:visibility="gone"
tools:text="孙行者123"
@@ -73,7 +73,7 @@
android:layout_gravity="center_horizontal"
android:layout_marginTop="4dp"
android:text="已经加入黑名单"
android:textColor="#999999"
android:textColor="@color/color_c6c6e9"
android:textSize="12dp" />
</LinearLayout>
@@ -84,7 +84,7 @@
android:layout_gravity="right"
android:textSize="@dimen/dp_13"
android:text="举报"
android:textColor="@color/color_333333"
android:textColor="@color/color_c6c6e9"
android:gravity="center"
android:src="@drawable/icon_add_black_list"
android:visibility="gone"

View File

@@ -167,7 +167,7 @@
android:paddingTop="5dp"
android:paddingEnd="15dp"
android:text="更多房间"
android:textColor="#C6C6E9"
android:textColor="@color/color_c6c6e9"
android:textSize="12sp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@id/magic_indicator"

View File

@@ -18,8 +18,8 @@
<FrameLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
tools:layout_width="270dp">
android:layout_height="match_parent"
android:background="@color/color_1c1b22">
<com.yizhuan.erban.ui.widget.ObservableScrollView
android:id="@+id/scroll_view"
@@ -37,7 +37,8 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="end"
android:orientation="horizontal">
android:orientation="horizontal"
android:visibility="gone">
<LinearLayout
android:id="@+id/tv_user_attentions"
@@ -53,7 +54,7 @@
android:layout_height="wrap_content"
android:maxLines="1"
android:text="@{String.valueOf(userInfo.followNum)}"
android:textColor="@color/color_333333"
android:textColor="@color/color_c6c6e9"
android:textSize="@dimen/sp_14"
tools:text="999" />
@@ -83,7 +84,7 @@
android:gravity="center_vertical"
android:maxLines="1"
android:text="@{String.valueOf(userInfo.fansNum)}"
android:textColor="@color/color_333333"
android:textColor="@color/color_c6c6e9"
android:textSize="@dimen/sp_13"
tools:text="999999" />
@@ -154,7 +155,7 @@
android:ellipsize="end"
android:maxLines="1"
android:text="@{userInfo.nick}"
android:textColor="@color/color_333333"
android:textColor="@color/white"
android:textSize="@dimen/sp_16"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0"
@@ -180,7 +181,7 @@
android:drawablePadding="4dp"
android:gravity="center"
android:maxLines="1"
android:textColor="@color/color_666666"
android:textColor="#4F516A"
android:textSize="@dimen/dp_13"
tools:ignore="SpUsage"
tools:text="音游号:123456" />
@@ -215,16 +216,15 @@
android:layout_height="14dp"
android:layout_marginEnd="5dp"
android:visibility="gone"
tools:src="@mipmap/ic_user_level_king"
/>
tools:src="@mipmap/ic_user_level_king" />
<androidx.appcompat.widget.AppCompatImageView
android:id="@+id/iv_user_level"
android:layout_width="wrap_content"
android:layout_height="17dp"
android:layout_marginEnd="@dimen/dp_3"
android:visibility="visible"
android:adjustViewBounds="true"
android:visibility="visible"
tools:src="@mipmap/ic_user_level" />
<androidx.appcompat.widget.AppCompatImageView
@@ -232,8 +232,8 @@
android:layout_width="wrap_content"
android:layout_height="17dp"
android:layout_marginEnd="3dp"
android:visibility="visible"
android:adjustViewBounds="true"
android:visibility="visible"
tools:src="@drawable/ic_user_charm_level" />
<TextView
@@ -247,8 +247,7 @@
android:textColor="#ffffffff"
android:textSize="10sp"
android:visibility="gone"
tools:ignore="SmallSp"
/>
tools:ignore="SmallSp" />
<TextView
android:id="@+id/tv_constellation"
@@ -266,104 +265,192 @@
</androidx.constraintlayout.widget.ConstraintLayout>
<LinearLayout
android:id="@+id/layout_user_info_tab"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:baselineAligned="false"
android:gravity="center_vertical"
android:orientation="horizontal"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toBottomOf="@id/iv_avatar_head_wear"
tools:ignore="UselessParent">
<LinearLayout
android:id="@+id/ll_my_room"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_marginStart="15dp"
android:layout_weight="1"
android:gravity="center"
android:onClick="@{click}"
android:orientation="vertical">
<ImageView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:adjustViewBounds="true"
android:src="@mipmap/icon_my_room" />
</LinearLayout>
<LinearLayout
android:id="@+id/ll_collect_room"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_marginStart="10dp"
android:layout_marginEnd="15dp"
android:layout_weight="1"
android:gravity="center"
android:onClick="@{click}"
android:orientation="vertical">
<ImageView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:adjustViewBounds="true"
android:src="@mipmap/icon_collect_room" />
</LinearLayout>
</LinearLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
<LinearLayout
android:id="@+id/me_item_radish"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:gravity="center_vertical"
android:onClick="@{click}"
android:orientation="horizontal"
android:paddingEnd="15dp"
tools:ignore="UseCompoundDrawables">
android:layout_marginStart="15dp"
android:layout_marginTop="15dp"
android:layout_marginEnd="15dp"
android:orientation="horizontal">
<com.coorchice.library.SuperTextView
android:id="@+id/me_item_radish"
android:layout_width="0dp"
android:layout_height="60dp"
android:layout_weight="1"
android:onClick="@{click}"
android:paddingStart="15dp"
android:paddingTop="15dp"
android:text="我的账户"
android:textColor="#ffffffff"
android:textSize="16sp"
android:textStyle="bold"
app:corner="10dp"
app:shaderEnable="true"
app:shaderEndColor="#4A50DF"
app:shaderMode="leftToRight"
app:shaderStartColor="#218EFF" />
<com.coorchice.library.SuperTextView
android:id="@+id/me_item_invite"
android:layout_width="0dp"
android:layout_height="60dp"
android:layout_marginStart="15dp"
android:layout_weight="1"
android:onClick="@{click}"
android:paddingStart="15dp"
android:paddingTop="15dp"
android:text="推荐给好友"
android:textColor="#ffffffff"
android:textSize="16sp"
app:corner="10dp"
app:shaderEnable="true"
app:shaderEndColor="#7D2BED"
app:shaderMode="leftToRight"
app:shaderStartColor="#611BBD" />
</LinearLayout>
<androidx.gridlayout.widget.GridLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="15dp"
android:layout_marginTop="15dp"
android:layout_marginEnd="15dp"
android:background="@drawable/shape_add_friends_2a2a39"
android:paddingTop="15dp"
android:paddingBottom="15dp"
app:columnCount="3"
app:columnOrderPreserved="false"
app:orientation="horizontal"
app:rowCount="2"
app:rowOrderPreserved="false"
app:useDefaultMargins="false">
<TextView
android:layout_width="0dp"
android:drawableTop="@mipmap/icon_decoration"
android:gravity="center"
android:text="报名记录"
android:textColor="@color/color_c6c6e9"
android:textSize="13sp"
app:layout_columnWeight="1"
app:layout_rowWeight="1" />
<TextView
android:layout_width="0dp"
android:drawableTop="@mipmap/icon_decoration"
android:gravity="center"
android:text="奖金"
android:textColor="@color/color_c6c6e9"
android:textSize="13sp"
app:layout_columnWeight="1"
app:layout_rowWeight="1" />
<TextView
android:layout_width="0dp"
android:drawableTop="@mipmap/icon_decoration"
android:gravity="center"
android:text="战绩"
android:textColor="@color/color_c6c6e9"
android:textSize="13sp"
app:layout_columnWeight="1"
app:layout_rowWeight="1" />
<TextView
android:layout_width="0dp"
android:layout_marginTop="15dp"
android:drawableTop="@mipmap/icon_decoration"
android:gravity="center"
android:text="卡包"
android:textColor="@color/color_c6c6e9"
android:textSize="13sp"
app:layout_columnWeight="1"
app:layout_rowWeight="1" />
<TextView
android:layout_width="0dp"
android:layout_marginTop="15dp"
android:drawableTop="@mipmap/icon_decoration"
android:gravity="center"
android:text="商城"
android:textColor="@color/color_c6c6e9"
android:textSize="13sp"
app:layout_columnWeight="1"
app:layout_rowWeight="1" />
<TextView
android:layout_width="0dp"
android:layout_marginTop="15dp"
android:drawableTop="@mipmap/icon_decoration"
android:gravity="center"
android:text="关联账号"
android:textColor="@color/color_c6c6e9"
android:textSize="13sp"
app:layout_columnWeight="1"
app:layout_rowWeight="1" />
</androidx.gridlayout.widget.GridLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="@dimen/dp_15"
android:background="@drawable/shape_add_friends_2a2a39"
android:orientation="vertical">
<TextView
android:id="@+id/ll_my_room"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/dp_me_text_padding_to_icon"
android:drawableStart="@mipmap/ic_me_radish"
android:drawableStart="@mipmap/ic_me_my_room"
android:drawableEnd="@drawable/arrow_right"
android:drawablePadding="13dp"
android:gravity="center_vertical"
android:onClick="@{click}"
android:paddingTop="@dimen/dp_15"
android:paddingEnd="15dp"
android:paddingBottom="@dimen/dp_15"
android:text="@string/label_my_radish"
android:textColor="@color/color_333333"
android:text="我的房间"
android:textColor="@color/color_c6c6e9"
android:textSize="13sp" />
</LinearLayout>
<View
android:layout_width="match_parent"
android:layout_height="1px"
android:layout_marginStart="@dimen/dp_me_text_padding_to_icon"
android:layout_marginEnd="@dimen/dp_me_text_padding_to_icon"
android:background="#F4F4F4" />
<LinearLayout
android:id="@+id/me_item_decoration_store"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:onClick="@{click}"
android:orientation="horizontal"
android:paddingEnd="15dp"
tools:ignore="UseCompoundDrawables">
<View
android:layout_width="match_parent"
android:layout_height="1px"
android:layout_marginStart="@dimen/dp_me_text_padding_to_icon"
android:layout_marginEnd="@dimen/dp_me_text_padding_to_icon"
android:background="#353548" />
<TextView
android:id="@+id/ll_collect_room"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/dp_me_text_padding_to_icon"
android:drawableStart="@mipmap/ic_me_collection"
android:drawableEnd="@drawable/arrow_right"
android:drawablePadding="13dp"
android:gravity="center_vertical"
android:onClick="@{click}"
android:paddingTop="@dimen/dp_15"
android:paddingEnd="15dp"
android:paddingBottom="@dimen/dp_15"
android:text="我的收藏"
android:textColor="@color/color_c6c6e9"
android:textSize="13sp" />
<View
android:layout_width="match_parent"
android:layout_height="1px"
android:layout_marginStart="@dimen/dp_me_text_padding_to_icon"
android:layout_marginEnd="@dimen/dp_me_text_padding_to_icon"
android:background="#353548" />
<TextView
android:id="@+id/me_item_decoration_store"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/dp_me_text_padding_to_icon"
@@ -371,32 +458,23 @@
android:drawableEnd="@drawable/arrow_right"
android:drawablePadding="13dp"
android:gravity="center_vertical"
android:onClick="@{click}"
android:paddingTop="@dimen/dp_15"
android:paddingEnd="15dp"
android:paddingBottom="@dimen/dp_15"
android:text="@string/menu_my_decoration"
android:textColor="@color/color_333333"
android:textColor="@color/color_c6c6e9"
android:textSize="13sp" />
</LinearLayout>
<View
android:layout_width="match_parent"
android:layout_height="1px"
android:layout_marginStart="@dimen/dp_me_text_padding_to_icon"
android:layout_marginEnd="@dimen/dp_me_text_padding_to_icon"
android:background="#F4F4F4" />
<LinearLayout
android:id="@+id/me_item_level"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:onClick="@{click}"
android:orientation="horizontal"
android:paddingEnd="15dp"
tools:ignore="UseCompoundDrawables">
<View
android:layout_width="match_parent"
android:layout_height="1px"
android:layout_marginStart="@dimen/dp_me_text_padding_to_icon"
android:layout_marginEnd="@dimen/dp_me_text_padding_to_icon"
android:background="#353548" />
<TextView
android:id="@+id/me_item_level"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/dp_me_text_padding_to_icon"
@@ -404,66 +482,24 @@
android:drawableEnd="@drawable/arrow_right"
android:drawablePadding="13dp"
android:gravity="center_vertical"
android:onClick="@{click}"
android:paddingTop="@dimen/dp_15"
android:paddingEnd="15dp"
android:paddingBottom="@dimen/dp_15"
android:text="@string/menu_my_level"
android:textColor="@color/color_333333"
android:textColor="@color/color_c6c6e9"
android:textSize="13sp" />
</LinearLayout>
<View
android:layout_width="match_parent"
android:layout_height="1px"
android:layout_marginStart="@dimen/dp_me_text_padding_to_icon"
android:layout_marginEnd="@dimen/dp_me_text_padding_to_icon"
android:background="#F4F4F4" />
<LinearLayout
android:id="@+id/me_item_invite"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:onClick="@{click}"
android:orientation="horizontal"
android:paddingEnd="15dp"
tools:ignore="UseCompoundDrawables">
<TextView
<View
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_height="1px"
android:layout_marginStart="@dimen/dp_me_text_padding_to_icon"
android:drawableStart="@mipmap/icon_invite"
android:drawableEnd="@drawable/arrow_right"
android:drawablePadding="13dp"
android:gravity="center_vertical"
android:paddingTop="@dimen/dp_15"
android:paddingBottom="@dimen/dp_15"
android:text="@string/menu_my_invite"
android:textColor="@color/color_333333"
android:textSize="13sp" />
android:layout_marginEnd="@dimen/dp_me_text_padding_to_icon"
android:background="#353548" />
</LinearLayout>
<View
android:layout_width="match_parent"
android:layout_height="1px"
android:layout_marginStart="@dimen/dp_me_text_padding_to_icon"
android:layout_marginEnd="@dimen/dp_me_text_padding_to_icon"
android:background="#F4F4F4" />
<LinearLayout
android:id="@+id/me_item_wallet"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:onClick="@{click}"
android:orientation="horizontal"
android:paddingEnd="15dp"
android:visibility="gone"
tools:ignore="UseCompoundDrawables">
<TextView
android:id="@+id/me_item_wallet"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/dp_me_text_padding_to_icon"
@@ -471,75 +507,52 @@
android:drawableEnd="@drawable/arrow_right"
android:drawablePadding="13dp"
android:gravity="center_vertical"
android:onClick="@{click}"
android:paddingTop="@dimen/dp_15"
android:paddingEnd="15dp"
android:paddingBottom="@dimen/dp_15"
android:text="@string/menu_my_income"
android:textColor="@color/color_333333"
android:textSize="13sp" />
android:textColor="@color/color_c6c6e9"
android:textSize="13sp"
android:visibility="gone" />
</LinearLayout>
<View
android:layout_width="match_parent"
android:layout_height="1px"
android:layout_marginStart="@dimen/dp_me_text_padding_to_icon"
android:layout_marginEnd="@dimen/dp_me_text_padding_to_icon"
android:background="#F4F4F4" />
<View
android:layout_width="match_parent"
android:layout_height="1px"
android:layout_marginStart="@dimen/dp_me_text_padding_to_icon"
android:layout_marginEnd="@dimen/dp_me_text_padding_to_icon"
android:background="#353548" />
<LinearLayout
android:id="@+id/ll_module_hall"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:orientation="vertical">
<LinearLayout
<TextView
android:id="@+id/me_item_union"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/dp_me_text_padding_to_icon"
android:drawableStart="@mipmap/icon_union"
android:drawableEnd="@drawable/arrow_right"
android:drawablePadding="13dp"
android:gravity="center_vertical"
android:onClick="@{click}"
android:orientation="horizontal"
android:paddingTop="@dimen/dp_15"
android:paddingEnd="15dp"
tools:ignore="UseCompoundDrawables">
android:paddingBottom="@dimen/dp_15"
android:text="@string/menu_my_union"
android:textColor="@color/color_c6c6e9"
android:textSize="13sp" />
<TextView
android:id="@+id/tv_hall_in"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/dp_me_text_padding_to_icon"
android:drawableStart="@mipmap/icon_union"
android:drawableEnd="@drawable/arrow_right"
android:drawablePadding="13dp"
android:gravity="center_vertical"
android:paddingTop="@dimen/dp_15"
android:paddingBottom="@dimen/dp_15"
android:text="@string/menu_my_union"
android:textColor="@color/color_333333"
android:textSize="13sp" />
</LinearLayout>
<View
android:layout_width="match_parent"
android:layout_height="1px"
android:layout_marginStart="@dimen/dp_me_text_padding_to_icon"
android:layout_marginEnd="@dimen/dp_me_text_padding_to_icon"
android:background="#353548" />
</LinearLayout>
<View
android:layout_width="match_parent"
android:layout_height="1px"
android:layout_marginStart="@dimen/dp_me_text_padding_to_icon"
android:layout_marginEnd="@dimen/dp_me_text_padding_to_icon"
android:background="#F4F4F4" />
<LinearLayout
android:id="@+id/me_item_patriarch"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:onClick="@{click}"
android:orientation="horizontal"
android:paddingEnd="15dp"
tools:ignore="UseCompoundDrawables">
<TextView
android:id="@+id/me_item_patriarch"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/dp_me_text_padding_to_icon"
@@ -547,76 +560,38 @@
android:drawableEnd="@drawable/arrow_right"
android:drawablePadding="13dp"
android:gravity="center_vertical"
android:onClick="@{click}"
android:paddingTop="@dimen/dp_15"
android:paddingEnd="15dp"
android:paddingBottom="@dimen/dp_15"
android:text="@string/patriarch_mode"
android:textColor="@color/color_333333"
android:textColor="@color/color_c6c6e9"
android:textSize="13sp" />
</LinearLayout>
<View
android:layout_width="match_parent"
android:layout_height="1px"
android:layout_marginStart="@dimen/dp_me_text_padding_to_icon"
android:layout_marginEnd="@dimen/dp_me_text_padding_to_icon"
android:background="#353548" />
<View
android:layout_width="match_parent"
android:layout_height="1px"
android:layout_marginStart="@dimen/dp_me_text_padding_to_icon"
android:layout_marginEnd="@dimen/dp_me_text_padding_to_icon"
android:background="#F4F4F4" />
<LinearLayout
android:id="@+id/me_item_certification"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:onClick="@{click}"
android:orientation="horizontal"
android:paddingEnd="15dp"
tools:ignore="UseCompoundDrawables">
<TextView
android:id="@+id/me_item_certification"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/dp_me_text_padding_to_icon"
android:drawableStart="@mipmap/icon_certification"
android:drawableEnd="@drawable/arrow_right"
android:drawablePadding="13dp"
android:gravity="center_vertical"
android:onClick="@{click}"
android:paddingTop="@dimen/dp_15"
android:paddingEnd="15dp"
android:paddingBottom="@dimen/dp_15"
android:text="@string/menu_certification"
android:textColor="@color/color_333333"
android:textSize="13sp" />
</LinearLayout>
<View
android:layout_width="match_parent"
android:layout_height="1px"
android:layout_marginStart="@dimen/dp_me_text_padding_to_icon"
android:layout_marginEnd="@dimen/dp_me_text_padding_to_icon"
android:background="#F4F4F4" />
<LinearLayout
android:id="@+id/me_item_setting"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:onClick="@{click}"
android:orientation="horizontal"
android:paddingEnd="15dp"
tools:ignore="UseCompoundDrawables">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/dp_me_text_padding_to_icon"
android:drawableStart="@mipmap/icon_setting"
android:drawableEnd="@drawable/arrow_right"
android:drawablePadding="13dp"
android:gravity="center_vertical"
android:paddingTop="@dimen/dp_15"
android:paddingBottom="@dimen/dp_15"
android:text="@string/menu_setting"
android:textColor="@color/color_333333"
android:textColor="@color/color_c6c6e9"
android:textSize="13sp" />
</LinearLayout>
@@ -688,6 +663,31 @@
</androidx.constraintlayout.widget.ConstraintLayout>
<LinearLayout
android:id="@+id/me_item_setting"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="end"
android:layout_marginTop="35dp"
android:gravity="center_vertical"
android:onClick="@{click}"
android:orientation="horizontal"
android:paddingEnd="15dp"
tools:ignore="UseCompoundDrawables">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/dp_me_text_padding_to_icon"
android:gravity="center_vertical"
android:src="@mipmap/icon_setting"
android:text="@string/menu_setting"
android:textColor="@color/color_c6c6e9"
android:textSize="13sp" />
</LinearLayout>
</FrameLayout>
</layout>

View File

@@ -8,7 +8,7 @@
android:paddingEnd="@dimen/dp_10"
android:paddingTop="@dimen/dp_10"
android:paddingBottom="@dimen/dp_10"
android:textColor="@color/text_color_primary"
android:textColor="@color/white"
android:textSize="14sp"
android:maxWidth="215dp"
tools:text="恭喜您,获得抽奖机会,点我抽奖>>" />

View File

@@ -69,7 +69,7 @@
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="wrap_content"
android:textColor="@color/color_333333"
android:textColor="@color/color_c6c6e9"
android:textSize="15sp"
android:lines="1"
android:layout_marginStart="@dimen/dp_15"

View File

@@ -85,7 +85,7 @@
android:ellipsize="end"
android:gravity="center_vertical"
android:maxLines="1"
android:textColor="#C6C6E9"
android:textColor="@color/color_c6c6e9"
android:textSize="12sp"
tools:text="房间名称房间名称房间名称" />

View File

@@ -13,7 +13,7 @@
android:layout_marginEnd="@dimen/dp_15"
android:drawableEnd="@drawable/arrow_right_more_room"
android:text="@string/recommend_topic"
android:textColor="#C6C6E9"
android:textColor="@color/color_c6c6e9"
android:textSize="@dimen/sp_13"
app:layout_constraintTop_toTopOf="parent" />

View File

@@ -35,7 +35,6 @@
android:layout_alignTop="@+id/nick"
android:layout_alignBottom="@+id/nick"
android:layout_marginStart="3dp"
android:layout_toStartOf="@+id/iv_more"
android:layout_toEndOf="@+id/nick"
android:gravity="center_vertical"
android:orientation="horizontal">

View File

@@ -120,7 +120,7 @@
android:gravity="center_vertical"
android:lines="1"
android:text=""
android:textColor="#C6C6E9"
android:textColor="@color/color_c6c6e9"
android:textSize="12dp"
tools:ignore="SpUsage"
tools:text="我是内容" />
@@ -146,7 +146,7 @@
android:lines="1"
android:scrollHorizontally="true"
android:text=""
android:textColor="#C6C6E9"
android:textColor="@color/color_c6c6e9"
android:textSize="12dp"
tools:ignore="SpUsage"
tools:text="我是内容我是内容我是内容我是内容我是内容我是内容我是内容我是内容" />

View File

@@ -11,7 +11,6 @@
android:id="@+id/iv_avatar"
android:layout_width="35dp"
android:layout_height="35dp"
android:layout_below="@+id/tv_online_number"
android:layout_centerVertical="true"
android:layout_marginLeft="10dp"
tools:src="@drawable/default_user_head" />

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

View File

Before

Width:  |  Height:  |  Size: 2.5 KiB

After

Width:  |  Height:  |  Size: 2.5 KiB

View File

@@ -551,4 +551,5 @@
<color name="color_2D93FF">#2D93FF</color>
<color name="color_1c1b22">#1C1B22</color>
<color name="color_c6c6e9">#c6c6e9</color>
</resources>

View File

@@ -79,7 +79,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:lineSpacingExtra="4dp"
android:textColor="#C6C6E9"
android:textColor="@color/color_c6c6e9"
android:textSize="15sp" />
<LinearLayout
@@ -155,7 +155,7 @@
android:layout_marginStart="2.5dp"
android:layout_weight="1"
android:gravity="center_vertical"
android:textColor="#C6C6E9"
android:textColor="@color/color_c6c6e9"
android:textSize="@dimen/sp_12"
tools:text="0123" />
</LinearLayout>
@@ -183,7 +183,7 @@
android:layout_height="@dimen/dp_24"
android:layout_marginStart="2.5dp"
android:gravity="center_vertical"
android:textColor="#C6C6E9"
android:textColor="@color/color_c6c6e9"
android:textSize="@dimen/sp_12"
tools:text="0" />
</LinearLayout>

View File

@@ -1,195 +0,0 @@
package com.yizhuan.tutu.mentoring_relationship.viewholder;
import androidx.core.content.ContextCompat;
import android.view.View;
import android.widget.TextView;
import com.netease.nim.uikit.common.ui.recyclerview.adapter.BaseMultiItemFetchLoadAdapter;
import com.netease.nimlib.sdk.msg.model.IMMessage;
import com.yizhuan.erban.R;
import com.yizhuan.xchat_android_core.exception.FailReasonException;
import com.yizhuan.xchat_android_core.manager.IMNetEaseManager;
import com.yizhuan.xchat_android_core.mentoring_relationship.attachment.MentoringMasterMissionFourAttachment;
import com.yizhuan.xchat_android_core.mentoring_relationship.bean.MissionVo;
import com.yizhuan.xchat_android_core.mentoring_relationship.model.MentoringRelationshipModel;
import com.yizhuan.xchat_android_core.statistic.StatisticManager;
import com.yizhuan.xchat_android_core.statistic.protocol.StatisticsProtocol;
import com.yizhuan.xchat_android_library.utils.SingleToastUtil;
import java.util.Map;
import static com.yizhuan.xchat_android_core.msg.sys.ErbanSysMsgInfo.STATE_AGREE;
import static com.yizhuan.xchat_android_core.msg.sys.ErbanSysMsgInfo.STATE_OUT_DATE;
import static com.yizhuan.xchat_android_core.msg.sys.ErbanSysMsgInfo.STATE_REFUSED;
import static com.yizhuan.xchat_android_core.msg.sys.ErbanSysMsgInfo.STATE_UNTREATED;
public class ApprenticeMissionFourViewHolder extends MissionViewHolderBase {
private MissionVo missionVo;
private Map<String, Object> localExtension;
private View viewLine;
private TextView tvState;
private View viewCentreHolder;
private TextView tvAgree;
private TextView tvReject;
ApprenticeMissionFourViewHolder(BaseMultiItemFetchLoadAdapter adapter) {
super(adapter);
}
@Override
protected boolean isMiddleItem() {
return false;
}
@Override
protected boolean isShowHeadImage() {
return true;
}
@Override
protected int getContentResId() {
return R.layout.view_holder_apprentice_mission_four;
}
@Override
protected void inflateContentView() {
super.inflateContentView();
viewLine = findViewById(R.id.view_line);
tvState = findViewById(R.id.tv_state);
viewCentreHolder = findViewById(R.id.view_centre_holder);
tvAgree = findViewById(R.id.tv_agree);
tvReject = findViewById(R.id.tv_reject);
tvAgree.setOnClickListener(this);
tvReject.setOnClickListener(this);
IMMessage imMessage = IMNetEaseManager.get().queryMessageByUuid(message.getUuid());
if (imMessage != null) {
localExtension = imMessage.getLocalExtension();
}
MentoringMasterMissionFourAttachment attachment =
(MentoringMasterMissionFourAttachment) message.getAttachment();
missionVo = attachment.getMissionVo();
}
@Override
protected void bindContentView() {
super.bindContentView();
title.setText((CharSequence) missionVo.getContent().get(0));
content.removeAllViews();
if (localExtension != null) {
int state = (int) localExtension.get(MentoringRelationshipModel.KEY_HAS_APPROVE);
switch (state) {
case STATE_UNTREATED:
displayNormalLayout();
break;
case STATE_AGREE:
displayAgreeOrRejectLayout(true);
break;
case STATE_REFUSED:
displayAgreeOrRejectLayout(false);
break;
case STATE_OUT_DATE:
tvAgree.setEnabled(false);
tvReject.setEnabled(false);
tvReject.setTextColor(ContextCompat.getColor(context, R.color.color_DBDBDB));
break;
}
}
}
@Override
public void onClick(View view) {
super.onClick(view);
switch (view.getId()) {
case R.id.tv_agree:
// 发送请求,同意建立师徒关系
MentoringRelationshipModel.get()
.buildMentoringRelationship(missionVo.getMasterUid(),
missionVo.getApprenticeUid(),
MentoringRelationshipModel.TYPE_AGREE_BUILD_RELATIONSHIP)
.subscribe((s, throwable) -> {
if (throwable == null) {
// 更新 UI
displayAgreeOrRejectLayout(true);
// 更新 localExt
localExtension = MentoringRelationshipModel.get()
.updateApproveState(message, STATE_AGREE);
message.setLocalExtension(localExtension);
IMNetEaseManager.get().updateMessageToLocal(message);
// 任务四完成,打点
StatisticManager.Instance().onEvent(StatisticsProtocol.Event.NEWS_TASK_FOUR_COMPLETE,
"任务四完成");
} else {
SingleToastUtil.showToast(throwable.getMessage());
handleError(throwable);
}
});
break;
case R.id.tv_reject:
// 发送请求,拒绝建立师徒关系
MentoringRelationshipModel.get()
.buildMentoringRelationship(missionVo.getMasterUid(),
missionVo.getApprenticeUid(),
MentoringRelationshipModel.TYPE_REJECT_BUILD_RELATIONSHIP)
.subscribe((s, throwable) -> {
if (throwable == null) {
// 更新 UI
displayAgreeOrRejectLayout(false);
// 更新 localExt
localExtension = MentoringRelationshipModel.get()
.updateApproveState(message, STATE_REFUSED);
message.setLocalExtension(localExtension);
IMNetEaseManager.get().updateMessageToLocal(message);
// 任务四完成,打点
StatisticManager.Instance().onEvent(StatisticsProtocol.Event.NEWS_TASK_FOUR_COMPLETE,
"任务四完成");
} else {
SingleToastUtil.showToast(throwable.getMessage());
handleError(throwable);
}
});
break;
}
}
private void handleError(Throwable throwable) {
if (throwable instanceof FailReasonException) {
FailReasonException failReasonException = (FailReasonException) throwable;
switch (failReasonException.getCode()) {
case MentoringRelationshipModel.CODE_ALREADY_HAS_MASTER:
tvAgree.setEnabled(false);
tvReject.setEnabled(false);
tvReject.setTextColor(ContextCompat.getColor(context, R.color.color_DBDBDB));
// 更新 localExt
localExtension = MentoringRelationshipModel.get()
.updateApproveState(message, STATE_OUT_DATE);
message.setLocalExtension(localExtension);
IMNetEaseManager.get().updateMessageToLocal(message);
break;
}
}
}
private void displayNormalLayout() {
viewLine.setVisibility(View.GONE);
tvState.setVisibility(View.GONE);
viewCentreHolder.setVisibility(View.VISIBLE);
tvAgree.setVisibility(View.VISIBLE);
tvReject.setVisibility(View.VISIBLE);
tvReject.setTextColor(ContextCompat.getColor(context, R.color.appColor));
}
private void displayAgreeOrRejectLayout(boolean agree) {
viewLine.setVisibility(View.VISIBLE);
tvState.setVisibility(View.VISIBLE);
viewCentreHolder.setVisibility(View.GONE);
tvAgree.setVisibility(View.GONE);
tvReject.setVisibility(View.GONE);
tvState.setText(agree ? R.string.btn_status_apprentice_agree : R.string.btn_status_apprentice_reject);
tvState.setTextColor(ContextCompat.getColor(context, agree ? R.color.color_09bb07 : R.color.color_FF3852));
}
}

View File

@@ -1,73 +0,0 @@
package com.yizhuan.tutu.mentoring_relationship.viewholder;
import android.view.View;
import android.widget.TextView;
import com.netease.nim.uikit.common.ui.recyclerview.adapter.BaseMultiItemFetchLoadAdapter;
import com.yizhuan.erban.R;
import com.yizhuan.erban.UIHelper;
import com.yizhuan.erban.ui.user.UserInfoActivity;
import com.yizhuan.erban.ui.utils.ImageLoadUtils;
import com.yizhuan.xchat_android_constants.XChatConstants;
import com.yizhuan.xchat_android_core.mentoring_relationship.attachment.MentoringApprenticeMissionOneAttachment;
import com.yizhuan.xchat_android_core.mentoring_relationship.bean.MissionVo;
import com.yizhuan.xchat_android_core.mentoring_relationship.bean.SimpleUserVo;
import com.yizhuan.xchat_android_core.user.bean.UserInfo;
public class ApprenticeMissionOneViewHolder extends MissionViewHolderBase {
private MissionVo<SimpleUserVo> simpleUserVoMissionVo;
private TextView report;
ApprenticeMissionOneViewHolder(BaseMultiItemFetchLoadAdapter adapter) {
super(adapter);
}
@Override
protected int getContentResId() {
return R.layout.view_holder_apprentice_mission_one;
}
@Override
protected void inflateContentView() {
super.inflateContentView();
MentoringApprenticeMissionOneAttachment attachment =
(MentoringApprenticeMissionOneAttachment) message.getAttachment();
simpleUserVoMissionVo = attachment.getSimpleUserVoMissionVo();
report = findViewById(R.id.tv_report);
}
@Override
protected void bindContentView() {
super.bindContentView();
title.setText(simpleUserVoMissionVo.getTitle());
tips.setText(simpleUserVoMissionVo.getTips());
ImageLoadUtils.loadAvatar(context, simpleUserVoMissionVo.getData().getAvatar(), pic, true);
name.setText(simpleUserVoMissionVo.getData().getNick());
int resId = simpleUserVoMissionVo.getData().getGender() == UserInfo.GENDER_MALE ? R.drawable.ic_gender_male : R.drawable.ic_gender_female;
name.setCompoundDrawablesWithIntrinsicBounds(0, 0, resId, 0);
content.removeAllViews();
for (String s : simpleUserVoMissionVo.getContent()) {
TextView textView = new TextView(context);
textView.setText(s);
textView.setTextSize(14);
content.addView(textView);
}
report.setOnClickListener(this);
pic.setOnClickListener(this);
}
@Override
public void onClick(View view) {
super.onClick(view);
switch (view.getId()) {
case R.id.tv_report:
UIHelper.showReportPage(context, simpleUserVoMissionVo.getMasterUid(), XChatConstants.REPORT_TYPE_MISSION);
break;
case R.id.iv_pic:
UserInfoActivity.Companion.start(context, simpleUserVoMissionVo.getMasterUid());
break;
}
}
}

View File

@@ -1,159 +0,0 @@
package com.yizhuan.tutu.mentoring_relationship.viewholder;
import android.annotation.SuppressLint;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.TextView;
import com.netease.nim.uikit.business.session.helper.MessageListPanelHelper;
import com.netease.nim.uikit.common.ui.recyclerview.adapter.BaseMultiItemFetchLoadAdapter;
import com.netease.nimlib.sdk.msg.MessageBuilder;
import com.netease.nimlib.sdk.msg.constant.SessionTypeEnum;
import com.netease.nimlib.sdk.msg.model.CustomMessageConfig;
import com.netease.nimlib.sdk.msg.model.IMMessage;
import com.yizhuan.erban.R;
import com.yizhuan.erban.ui.utils.ImageLoadUtils;
import com.yizhuan.xchat_android_core.gift.bean.GiftInfo;
import com.yizhuan.xchat_android_core.gift.bean.GiftReceiveInfo;
import com.yizhuan.xchat_android_core.gift.exception.GiftOutOfDateException;
import com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment;
import com.yizhuan.xchat_android_core.im.custom.bean.GiftAttachment;
import com.yizhuan.xchat_android_core.manager.IMNetEaseManager;
import com.yizhuan.xchat_android_core.mentoring_relationship.attachment.MentoringApprenticeMissionThreeAttachment;
import com.yizhuan.xchat_android_core.mentoring_relationship.bean.MissionVo;
import com.yizhuan.xchat_android_core.mentoring_relationship.bean.SimpleGiftVo;
import com.yizhuan.xchat_android_core.mentoring_relationship.model.MentoringRelationshipModel;
import com.yizhuan.xchat_android_core.statistic.StatisticManager;
import com.yizhuan.xchat_android_core.statistic.protocol.StatisticsProtocol;
import com.yizhuan.xchat_android_core.user.UserModel;
import com.yizhuan.xchat_android_core.utils.net.BalanceNotEnoughExeption;
import com.yizhuan.xchat_android_library.utils.SingleToastUtil;
import java.util.Map;
public class ApprenticeMissionThreeViewHolder extends MissionViewHolderBase {
private MissionVo<SimpleGiftVo> simpleGiftVoMissionVo;
private SimpleGiftVo simpleGiftVo;
private Map<String, Object> localExtension;
ApprenticeMissionThreeViewHolder(BaseMultiItemFetchLoadAdapter adapter) {
super(adapter);
}
@Override
protected int getContentResId() {
return R.layout.view_holder_apprentice_mission_three;
}
@Override
protected void inflateContentView() {
super.inflateContentView();
IMMessage imMessage = IMNetEaseManager.get().queryMessageByUuid(message.getUuid());
if (imMessage != null) {
localExtension = imMessage.getLocalExtension();
}
MentoringApprenticeMissionThreeAttachment attachment =
(MentoringApprenticeMissionThreeAttachment) message.getAttachment();
simpleGiftVoMissionVo = attachment.getSimpleGiftVoMissionVo();
simpleGiftVo = simpleGiftVoMissionVo.getData();
}
@Override
protected void bindContentView() {
super.bindContentView();
title.setText(simpleGiftVoMissionVo.getTitle());
tips.setText(simpleGiftVoMissionVo.getTips());
name.setText(simpleGiftVo.getGiftName());
ImageLoadUtils.loadCircleImage(context, simpleGiftVo.getPicUrl(), pic, R.drawable.default_user_head);
content.removeAllViews();
for (Object s : simpleGiftVoMissionVo.getContent()) {
View view = LayoutInflater.from(context).inflate(R.layout.item_mission_content, content);
TextView textView = view.findViewById(R.id.tv_mission_tips);
textView.setText(s.toString());
}
if (localExtension != null) {
boolean isHandsel = (boolean) localExtension
.get(MentoringRelationshipModel.KEY_HAS_HANDSEL_GIFT);
if (isHandsel) {
button.setEnabled(false);
button.setText(R.string.btn_has_handsel);
} else {
button.setEnabled(true);
button.setText(R.string.btn_handsel_now);
}
}
}
@SuppressLint("CheckResult")
@Override
protected void onButtonClick() {
// 拜师礼物
MentoringRelationshipModel.get()
.sendGift(simpleGiftVo.getGiftId(),
simpleGiftVoMissionVo.getMasterUid(),
1, "")
.flatMap(giftReceiveInfoServiceResult -> {
// 发送礼物消息
GiftReceiveInfo temp = giftReceiveInfoServiceResult.getData();
GiftAttachment giftAttachment = new GiftAttachment(CustomAttachment.CUSTOM_MSG_HEADER_TYPE_GIFT,
CustomAttachment.CUSTOM_MSG_SUB_TYPE_SEND_GIFT);
giftAttachment.setUid(String.valueOf(simpleGiftVoMissionVo.getApprenticeUid()));
GiftReceiveInfo giftReceiveInfo = new GiftReceiveInfo();
giftReceiveInfo.setNick(UserModel.get().getCacheLoginUserInfo() != null ?
UserModel.get().getCacheLoginUserInfo().getNick() : "");
giftReceiveInfo.setTargetUid(simpleGiftVoMissionVo.getMasterUid());
giftReceiveInfo.setAvatar(UserModel.get().getCacheLoginUserInfo() != null ?
UserModel.get().getCacheLoginUserInfo().getAvatar() : "");
giftReceiveInfo.setGiftId(simpleGiftVo.getGiftId());
giftReceiveInfo.setUid(simpleGiftVoMissionVo.getApprenticeUid());
giftReceiveInfo.setTargetUid(simpleGiftVoMissionVo.getMasterUid());
giftReceiveInfo.setTargetNick(temp.getTargetNick());
giftReceiveInfo.setGiftNum(1);
giftReceiveInfo.setGift(temp.getGift());
giftAttachment.setGiftReceiveInfo(giftReceiveInfo);
GiftInfo giftInfo = new GiftInfo();
giftInfo.setGiftId(simpleGiftVo.getGiftId());
giftInfo.setGiftName(simpleGiftVo.getGiftName());
giftInfo.setGiftUrl(simpleGiftVo.getPicUrl());
giftReceiveInfo.setGift(giftInfo);
CustomMessageConfig customMessageConfig = new CustomMessageConfig();
customMessageConfig.enablePush = false;
IMMessage imMessage = MessageBuilder.createCustomMessage(
String.valueOf(simpleGiftVoMissionVo.getMasterUid()),
SessionTypeEnum.P2P, "", giftAttachment, customMessageConfig);
return IMNetEaseManager.get().sendMessageSingle(imMessage);
})
.doOnError(throwable -> {
if (throwable instanceof BalanceNotEnoughExeption) {
SingleToastUtil.showToast(throwable.getMessage());
} else if (throwable instanceof GiftOutOfDateException) {
GiftOutOfDateException exception = (GiftOutOfDateException) throwable;
SingleToastUtil.showToast(exception.getMessage());
}
})
.doOnSubscribe(disposable -> {
if (isHandling) {
disposable.dispose();
} else {
isHandling = true;
}
}).subscribe(imMessage -> {
//手动刷新 UI
MessageListPanelHelper.getInstance().notifyAddMessage(imMessage);
// UI 更新
button.setEnabled(false);
button.setText(R.string.btn_has_handsel);
// 更新 localExt
localExtension = MentoringRelationshipModel.get()
.updateHandselState(message);
message.setLocalExtension(localExtension);
IMNetEaseManager.get().updateMessageToLocal(message);
isHandling = false;
// 任务三完成,打点
StatisticManager.Instance().onEvent(StatisticsProtocol.Event.NEWS_TASK_THREE_COMPLETE,
"任务三完成");
});
}
}

View File

@@ -1,209 +0,0 @@
package com.yizhuan.tutu.mentoring_relationship.viewholder;
import android.annotation.SuppressLint;
import androidx.core.content.ContextCompat;
import android.text.Spannable;
import android.text.SpannableStringBuilder;
import android.text.style.ForegroundColorSpan;
import android.view.View;
import android.widget.TextView;
import com.netease.nim.uikit.business.session.helper.MessageListPanelHelper;
import com.netease.nim.uikit.common.ui.recyclerview.adapter.BaseMultiItemFetchLoadAdapter;
import com.netease.nimlib.sdk.msg.MessageBuilder;
import com.netease.nimlib.sdk.msg.constant.SessionTypeEnum;
import com.netease.nimlib.sdk.msg.model.IMMessage;
import com.yizhuan.erban.R;
import com.yizhuan.erban.ui.utils.ImageLoadUtils;
import com.yizhuan.erban.ui.widget.GiftDialog;
import com.yizhuan.erban.ui.widget.dialog.OpenNobleDialog;
import com.yizhuan.xchat_android_core.gift.GiftModel;
import com.yizhuan.xchat_android_core.gift.bean.GiftInfo;
import com.yizhuan.xchat_android_core.gift.toolbox.GiftToolbox;
import com.yizhuan.xchat_android_core.magic.MagicModel;
import com.yizhuan.xchat_android_core.magic.bean.MagicInfo;
import com.yizhuan.xchat_android_core.magic.bean.MagicReceivedInfo;
import com.yizhuan.xchat_android_core.manager.IMNetEaseManager;
import com.yizhuan.xchat_android_core.mentoring_relationship.attachment.MentoringMasterMissionTwoAttachment;
import com.yizhuan.xchat_android_core.mentoring_relationship.bean.MissionVo;
import com.yizhuan.xchat_android_core.mentoring_relationship.bean.SimpleGiftVo;
import com.yizhuan.xchat_android_core.mentoring_relationship.model.MentoringRelationshipModel;
import com.yizhuan.xchat_android_core.pay.PayModel;
import com.yizhuan.xchat_android_core.room.queue.bean.MicMemberInfo;
import com.yizhuan.xchat_android_core.user.UserModel;
import com.yizhuan.xchat_android_core.user.bean.UserInfo;
import com.yizhuan.xchat_android_core.utils.net.BeanObserver;
import com.yizhuan.xchat_android_core.utils.net.RxHelper;
import com.yizhuan.xchat_android_library.utils.SingleToastUtil;
import java.util.List;
import java.util.Map;
public class ApprenticeMissionTwoViewHolder extends MissionViewHolderBase implements GiftDialog.OnGiftDialogBtnClickListener {
private MissionVo<SimpleGiftVo> simpleGiftVoMissionVo;
private SimpleGiftVo simpleGiftVo;
private TextView thanks;
private TextView rebate;
private transient GiftDialog giftDialog;
private Map<String, Object> localExtension;
ApprenticeMissionTwoViewHolder(BaseMultiItemFetchLoadAdapter adapter) {
super(adapter);
}
@Override
protected boolean isMiddleItem() {
return false;
}
@Override
protected boolean isShowHeadImage() {
return true;
}
@Override
protected int getContentResId() {
return R.layout.view_holder_apprentice_mission_two;
}
@Override
protected void inflateContentView() {
super.inflateContentView();
IMMessage imMessage = IMNetEaseManager.get().queryMessageByUuid(message.getUuid());
if (imMessage != null) {
localExtension = imMessage.getLocalExtension();
}
thanks = findViewById(R.id.tv_thanks);
rebate = findViewById(R.id.tv_rebate);
MentoringMasterMissionTwoAttachment attachment =
(MentoringMasterMissionTwoAttachment) message.getAttachment();
simpleGiftVoMissionVo = attachment.getSimpleGiftVoMissionVo();
simpleGiftVo = simpleGiftVoMissionVo.getData();
}
@Override
protected void bindContentView() {
super.bindContentView();
String giftName = simpleGiftVo.getGiftName();
for (String content : simpleGiftVoMissionVo.getContent()) {
int start = content.indexOf(giftName);
SpannableStringBuilder builder = new SpannableStringBuilder(content);
builder.setSpan(new ForegroundColorSpan(ContextCompat.getColor(context, R.color.color_FF3D56)),
start, start + giftName.length(), Spannable.SPAN_INCLUSIVE_EXCLUSIVE);
title.setText(builder);
}
ImageLoadUtils.loadImage(context, simpleGiftVo.getPicUrl(), pic, R.drawable.default_avatar);
thanks.setOnClickListener(this);
rebate.setOnClickListener(this);
if (localExtension != null) {
boolean hasThanks = (boolean) localExtension
.get(MentoringRelationshipModel.KEY_HAS_THANKS);
if (hasThanks) {
thanks.setEnabled(false);
thanks.setTextColor(ContextCompat.getColor(context, R.color.color_DBDBDB));
} else {
thanks.setEnabled(true);
thanks.setTextColor(ContextCompat.getColor(context, R.color.appColor));
}
}
}
@Override
public void onClick(View view) {
super.onClick(view);
switch (view.getId()) {
case R.id.tv_thanks:
// 答谢,发一句普通的聊天消息
IMMessage imMessage = MessageBuilder.createTextMessage(
String.valueOf(simpleGiftVoMissionVo.getMasterUid()),
SessionTypeEnum.P2P, simpleGiftVoMissionVo.getMessage());
IMNetEaseManager.get()
.sendMessage(imMessage)
.subscribe((aBoolean, throwable) -> {
if (throwable == null) {
//手动刷新 UI
MessageListPanelHelper.getInstance().notifyAddMessage(imMessage);
// 更新 UI
thanks.setEnabled(false);
thanks.setTextColor(ContextCompat.getColor(context, R.color.color_DBDBDB));
// 更新 localExt
localExtension = MentoringRelationshipModel.get()
.updateThanksState(message);
message.setLocalExtension(localExtension);
IMNetEaseManager.get().updateMessageToLocal(message);
}
});
break;
case R.id.tv_rebate:
// 回赠,弹起礼物弹窗进行送礼物
if (giftDialog == null) {
giftDialog = new GiftDialog(context, simpleGiftVoMissionVo.getMasterUid(), false, false, true);
giftDialog.setGiftDialogBtnClickListener(this);
giftDialog.setOnDismissListener(dialog -> giftDialog = null);
}
if (!giftDialog.isShowing()) {
giftDialog.show();
}
break;
}
}
@SuppressLint("CheckResult")
@Override
public void onSendGiftBtnClick(GiftInfo giftInfo, List<MicMemberInfo> micMemberInfos, int number,
String msg, boolean isknap, boolean isWholeMic, GiftDialog.SenGiftCallback callback) {
if (giftInfo == null) return;
boolean canUseNobleGiftOrNot = GiftModel.get().canUseNobleGiftOrNot(giftInfo);
if (canUseNobleGiftOrNot) {
GiftModel.get()
.sendPersonalGift(giftInfo.getGiftId(), micMemberInfos.get(0).getAccount(), number, msg, isknap)
.compose(RxHelper.handleSchedulers())
.flatMap(giftReceiveInfoServiceResult ->
GiftToolbox.sendGiftPrivateChatMessage(giftReceiveInfoServiceResult.getData()))
.doOnError(throwable -> {
if (callback != null) {
callback.onFail();
}
})
.subscribe((imMessage, throwable) -> {
if (throwable == null) {
// 手动更新送礼物的消息
MessageListPanelHelper.getInstance().notifyAddMessage(imMessage);
if (callback != null) {
callback.onSuccess();
}
}
});
} else {
UserInfo userInfo = UserModel.get().getCacheLoginUserInfo();
int currentLevel = userInfo == null ? 0 : userInfo.getNobleInfo() == null ? 0 : userInfo.getNobleInfo().getLevel();
new OpenNobleDialog(context, currentLevel, giftInfo.getLevel(), "送该礼物").show();
}
}
@Override
public void onSendMagicBtnClick(MagicInfo magicInfo, long targetUid, GiftDialog.SenGiftCallback callback) {
//赠送魔法的回调
MagicModel.get().sendMagic(magicInfo.getMagicId(), targetUid)
.subscribe(new BeanObserver<MagicReceivedInfo>() {
@Override
public void onErrorMsg(String error) {
SingleToastUtil.showToast(error);
if (callback != null) {
callback.onFail();
}
}
@Override
public void onSuccess(MagicReceivedInfo info) {
PayModel.get().decreaseLocalGold(magicInfo.getPrice());
if (callback != null) {
callback.onSuccess();
}
}
});
}
}

View File

@@ -1,103 +0,0 @@
package com.yizhuan.tutu.mentoring_relationship.viewholder;
import android.annotation.SuppressLint;
import android.widget.TextView;
import com.netease.nim.uikit.common.ui.recyclerview.adapter.BaseMultiItemFetchLoadAdapter;
import com.netease.nimlib.sdk.msg.model.IMMessage;
import com.yizhuan.erban.R;
import com.yizhuan.xchat_android_core.manager.IMNetEaseManager;
import com.yizhuan.xchat_android_core.mentoring_relationship.attachment.MentoringMasterMissionFourAttachment;
import com.yizhuan.xchat_android_core.mentoring_relationship.bean.MissionVo;
import com.yizhuan.xchat_android_core.mentoring_relationship.model.MentoringRelationshipModel;
import com.yizhuan.xchat_android_core.statistic.StatisticManager;
import com.yizhuan.xchat_android_core.statistic.protocol.StatisticsProtocol;
import com.yizhuan.xchat_android_core.utils.net.RxHelper;
import com.yizhuan.xchat_android_library.utils.SingleToastUtil;
import java.util.Map;
public class MasterMissionFourViewHolder extends MissionViewHolderBase {
private MissionVo missionVo;
private Map<String, Object> localExtension;
MasterMissionFourViewHolder(BaseMultiItemFetchLoadAdapter adapter) {
super(adapter);
}
@Override
protected int getContentResId() {
return R.layout.view_holder_master_mission_four;
}
@Override
protected void inflateContentView() {
super.inflateContentView();
IMMessage imMessage = IMNetEaseManager.get().queryMessageByUuid(message.getUuid());
if (imMessage != null) {
localExtension = imMessage.getLocalExtension();
}
MentoringMasterMissionFourAttachment attachment =
(MentoringMasterMissionFourAttachment) message.getAttachment();
missionVo = attachment.getMissionVo();
}
@Override
protected void bindContentView() {
super.bindContentView();
title.setText(missionVo.getTitle());
tips.setText(missionVo.getTips());
content.removeAllViews();
for (Object s : missionVo.getContent()) {
TextView textView = new TextView(context);
textView.setText("·" + s.toString() + "·");
textView.setTextSize(14);
content.addView(textView);
}
if (localExtension != null) {
boolean hasInvited = (boolean) localExtension
.get(MentoringRelationshipModel.KEY_HAS_INVITED);
if (hasInvited) {
button.setEnabled(false);
button.setText(R.string.btn_has_send_invitation);
} else {
button.setEnabled(true);
button.setText(R.string.btn_send_invitation);
}
}
}
@SuppressLint("CheckResult")
@Override
protected void onButtonClick() {
StatisticManager.Instance().onEvent(StatisticsProtocol.Event.NEWS_TASK_FOUR_START,
"任务四开始");
// 发送请求,触发建立师徒关系的消息
MentoringRelationshipModel.get()
.sendInvitation(missionVo.getMasterUid(), missionVo.getApprenticeUid())
.compose(RxHelper.handleSchedulers())
.doOnSubscribe(disposable -> {
if (isHandling) {
disposable.dispose();
} else {
isHandling = true;
}
})
.subscribe((s, throwable) -> {
if (throwable == null) {
// 更新 UI
button.setEnabled(false);
button.setText(R.string.btn_has_send_invitation);
// 更新 localExt
localExtension = MentoringRelationshipModel.get()
.updateInviteState(message);
message.setLocalExtension(localExtension);
IMNetEaseManager.get().updateMessageToLocal(message);
} else {
SingleToastUtil.showToast(throwable.getMessage());
}
isHandling = false;
});
}
}

View File

@@ -1,151 +0,0 @@
package com.yizhuan.tutu.mentoring_relationship.viewholder;
import android.annotation.SuppressLint;
import android.view.View;
import android.widget.TextView;
import com.netease.nim.uikit.business.session.helper.MessageListPanelHelper;
import com.netease.nim.uikit.common.ui.recyclerview.adapter.BaseMultiItemFetchLoadAdapter;
import com.netease.nimlib.sdk.msg.MessageBuilder;
import com.netease.nimlib.sdk.msg.constant.MsgStatusEnum;
import com.netease.nimlib.sdk.msg.constant.SessionTypeEnum;
import com.netease.nimlib.sdk.msg.model.IMMessage;
import com.yizhuan.erban.R;
import com.yizhuan.erban.UIHelper;
import com.yizhuan.erban.ui.user.UserInfoActivity;
import com.yizhuan.erban.ui.utils.ImageLoadUtils;
import com.yizhuan.erban.ui.widget.magicindicator.buildins.UIUtil;
import com.yizhuan.xchat_android_constants.XChatConstants;
import com.yizhuan.xchat_android_core.manager.IMNetEaseManager;
import com.yizhuan.xchat_android_core.mentoring_relationship.attachment.MentoringMasterMissionOneAttachment;
import com.yizhuan.xchat_android_core.mentoring_relationship.bean.MissionVo;
import com.yizhuan.xchat_android_core.mentoring_relationship.bean.SimpleUserVo;
import com.yizhuan.xchat_android_core.mentoring_relationship.model.MentoringRelationshipModel;
import com.yizhuan.xchat_android_core.user.bean.UserInfo;
import com.yizhuan.xchat_android_library.utils.SingleToastUtil;
import java.util.Map;
import io.reactivex.Single;
public class MasterMissionOneViewHolder extends MissionViewHolderBase {
private MissionVo<SimpleUserVo> simpleUserVoMissionVo;
private SimpleUserVo simpleUserVo;
private Map<String, Object> localExtension;
private TextView report;
public MasterMissionOneViewHolder(BaseMultiItemFetchLoadAdapter adapter) {
super(adapter);
}
@Override
protected int getContentResId() {
return R.layout.view_holder_master_mission_one;
}
@Override
protected void inflateContentView() {
super.inflateContentView();
IMMessage imMessage = IMNetEaseManager.get().queryMessageByUuid(message.getUuid());
if (imMessage != null) {
localExtension = imMessage.getLocalExtension();
}
MentoringMasterMissionOneAttachment attachment =
(MentoringMasterMissionOneAttachment) message.getAttachment();
simpleUserVoMissionVo = attachment.getSimpleUserVoMissionVo();
simpleUserVo = simpleUserVoMissionVo.getData();
report = findViewById(R.id.tv_report);
}
@Override
protected void bindContentView() {
super.bindContentView();
title.setText(simpleUserVoMissionVo.getTitle());
tips.setText(simpleUserVoMissionVo.getTips());
ImageLoadUtils.loadAvatar(context, simpleUserVo.getAvatar(), pic, true);
name.setText(simpleUserVo.getNick());
int resId = simpleUserVo.getGender() == UserInfo.GENDER_MALE ? R.drawable.ic_gender_male : R.drawable.ic_gender_female;
name.setCompoundDrawablesWithIntrinsicBounds(0, 0, resId, 0);
content.removeAllViews();
for (String s : simpleUserVoMissionVo.getContent()) {
TextView textView = new TextView(context);
textView.setText(s);
textView.setCompoundDrawablesWithIntrinsicBounds(R.drawable.shape_dot_app_color, 0, 0, 0);
textView.setCompoundDrawablePadding(UIUtil.dip2px(context, 5));
textView.setTextSize(14);
content.addView(textView);
}
if (localExtension != null) {
boolean result = (boolean) localExtension
.get(MentoringRelationshipModel.KEY_HAS_FOLLOWED);
if (result) {
button.setEnabled(false);
button.setText(R.string.btn_has_said_hi);
} else {
button.setEnabled(true);
button.setText(R.string.btn_say_hi);
}
}
report.setOnClickListener(this);
pic.setOnClickListener(this);
}
@Override
public void onClick(View view) {
super.onClick(view);
switch (view.getId()) {
case R.id.tv_report:
UIHelper.showReportPage(context, simpleUserVoMissionVo.getApprenticeUid(), XChatConstants.REPORT_TYPE_MISSION);
break;
case R.id.iv_pic:
UserInfoActivity.Companion.start(context, simpleUserVoMissionVo.getApprenticeUid());
break;
}
}
@SuppressLint("CheckResult")
@Override
protected void onButtonClick() {
message.setStatus(MsgStatusEnum.success);
MentoringRelationshipModel.get()
.sayHi(simpleUserVoMissionVo.getMasterUid(),
simpleUserVoMissionVo.getApprenticeUid())
.doOnSubscribe(disposable -> {
if (isHandling) {
disposable.dispose();
} else {
isHandling = true;
}
})
.flatMap(s -> {
// 更新 UI
button.setEnabled(false);
button.setText(R.string.btn_has_said_hi);
// 更新 localExt
localExtension = MentoringRelationshipModel.get()
.updateFollowState(message);
message.setLocalExtension(localExtension);
IMNetEaseManager.get().updateMessageToLocal(message);
return Single.just(message);
})
.flatMap(imMessage -> {
// 给徒弟打招呼
IMMessage helloMessage = MessageBuilder.createTextMessage(
String.valueOf(simpleUserVoMissionVo.getApprenticeUid()),
SessionTypeEnum.P2P, simpleUserVoMissionVo.getMessage());
return IMNetEaseManager.get().sendMessageSingle(helloMessage);
})
.subscribe((imMessage, throwable) -> {
if (throwable == null) {
//手动刷新 UI
MessageListPanelHelper.getInstance().notifyAddMessage(imMessage);
} else {
SingleToastUtil.showToast(throwable.getMessage());
}
isHandling = false;
});
}
}

View File

@@ -1,376 +0,0 @@
package com.yizhuan.tutu.mentoring_relationship.viewholder;
import android.annotation.SuppressLint;
import androidx.core.content.ContextCompat;
import android.text.Spannable;
import android.text.SpannableStringBuilder;
import android.text.style.ForegroundColorSpan;
import android.widget.TextView;
import com.netease.nim.uikit.business.session.helper.MessageListPanelHelper;
import com.netease.nim.uikit.common.ui.recyclerview.adapter.BaseMultiItemFetchLoadAdapter;
import com.netease.nimlib.sdk.msg.MessageBuilder;
import com.netease.nimlib.sdk.msg.constant.SessionTypeEnum;
import com.netease.nimlib.sdk.msg.model.IMMessage;
import com.yizhuan.erban.R;
import com.yizhuan.erban.avroom.activity.AVRoomActivity;
import com.yizhuan.erban.common.widget.dialog.DialogManager;
import com.yizhuan.erban.home.dialog.CreateRoomDialog;
import com.yizhuan.erban.ui.webview.CommonWebViewActivity;
import com.yizhuan.xchat_android_core.UriProvider;
import com.yizhuan.xchat_android_core.auth.AuthModel;
import com.yizhuan.xchat_android_core.certification.CertificationModel;
import com.yizhuan.xchat_android_core.manager.IMNetEaseManager;
import com.yizhuan.xchat_android_core.mentoring_relationship.attachment.MentoringMasterMissionThreeAttachment;
import com.yizhuan.xchat_android_core.mentoring_relationship.attachment.MentoringSharingRoomAttachment;
import com.yizhuan.xchat_android_core.mentoring_relationship.bean.MentoringSharingRoomInfo;
import com.yizhuan.xchat_android_core.mentoring_relationship.bean.MissionVo;
import com.yizhuan.xchat_android_core.mentoring_relationship.model.MentoringRelationshipModel;
import com.yizhuan.xchat_android_core.miniworld.model.MiniWorldModel;
import com.yizhuan.xchat_android_core.room.bean.RoomInfo;
import com.yizhuan.xchat_android_core.room.model.AvRoomModel;
import com.yizhuan.xchat_android_core.statistic.StatisticManager;
import com.yizhuan.xchat_android_core.statistic.protocol.StatisticsProtocol;
import com.yizhuan.xchat_android_core.user.UserModel;
import com.yizhuan.xchat_android_core.user.bean.UserInfo;
import com.yizhuan.xchat_android_core.utils.net.BeanObserver;
import com.yizhuan.xchat_android_core.utils.net.RxHelper;
import com.yizhuan.xchat_android_library.utils.SingleToastUtil;
import java.util.Map;
import io.reactivex.Single;
import static com.yizhuan.xchat_android_core.certification.CertificationModel.CER_TYPE_FORCE;
import static com.yizhuan.xchat_android_core.certification.CertificationModel.CER_TYPE_GUIDE;
import static com.yizhuan.xchat_android_core.certification.CertificationModel.CER_TYPE_NONE;
public class MasterMissionThreeViewHolder extends MissionViewHolderBase {
private MissionVo missionVo;
private Map<String, Object> localExtension;
private DialogManager dialogManager;
private CreateRoomDialog createRoomDialog;
private int roomType;
MasterMissionThreeViewHolder(BaseMultiItemFetchLoadAdapter adapter) {
super(adapter);
}
@Override
protected int getContentResId() {
return R.layout.view_holder_master_mission_three;
}
@Override
protected void inflateContentView() {
super.inflateContentView();
IMMessage imMessage = IMNetEaseManager.get().queryMessageByUuid(message.getUuid());
if (imMessage != null) {
localExtension = imMessage.getLocalExtension();
}
MentoringMasterMissionThreeAttachment attachment =
(MentoringMasterMissionThreeAttachment) message.getAttachment();
missionVo = attachment.getMissionVo();
dialogManager = new DialogManager(context);
}
@Override
protected void bindContentView() {
super.bindContentView();
title.setText(missionVo.getTitle());
tips.setText(missionVo.getTips());
content.removeAllViews();
for (Object s : missionVo.getContent()) {
TextView textView = new TextView(context);
textView.setText(s.toString());
textView.setCompoundDrawablesWithIntrinsicBounds(R.drawable.shape_dot_app_color, 0, 0, 0);
textView.setCompoundDrawablePadding(5);
textView.setTextSize(14);
content.addView(textView);
}
if (localExtension != null) {
boolean hasInvited = (boolean) localExtension
.get(MentoringRelationshipModel.KEY_HAS_INVITED);
if (hasInvited) {
button.setEnabled(false);
button.setText(R.string.btn_has_invite_entering_room);
} else {
button.setEnabled(true);
button.setText(R.string.btn_invite_entering_room);
}
}
}
@SuppressLint("CheckResult")
@Override
protected void onButtonClick() {
if (isHandling) return;
isHandling = true;
handleInviteRoomEvent();
}
private void handleCertification() {
UserInfo userInfo = UserModel.get().getCacheLoginUserInfo();
if (userInfo != null && !userInfo.isCertified()) {
switch (CertificationModel.get().getCertificationType()) {
default:
case CER_TYPE_NONE:
// do nothing
openCreateRoomDialog();
break;
case CER_TYPE_FORCE:
dialogManager.showTipsDialog(getCertificationTips(),
context.getString(R.string.go_to_certification),
new DialogManager.OkCancelDialogListener() {
@Override
public void onCancel() {
isHandling = false;
}
@Override
public void onOk() {
// 跳去实名认证页面
CommonWebViewActivity.start(context,
UriProvider.getTutuRealNamePage());
isHandling = false;
}
});
break;
case CER_TYPE_GUIDE:
dialogManager.showTipsDialog(getCertificationTips(),
context.getString(R.string.go_to_certification),
new DialogManager.OkCancelDialogListener() {
@Override
public void onCancel() {
openCreateRoomDialog();
}
@Override
public void onOk() {
// 跳去实名认证页面
CommonWebViewActivity.start(context,
UriProvider.getTutuRealNamePage());
isHandling = false;
}
});
break;
}
} else {
openCreateRoomDialog();
}
}
@SuppressLint("CheckResult")
private void handleInviteRoomEvent() {
AvRoomModel.get()
.requestRoomInfo(String.valueOf(AuthModel.get().getCurrentUid()))
.compose(RxHelper.handleSchedulers())
.subscribe((roomInfo, throwable) -> {
if (throwable == null) {
// 先验证是否有已经开好房间
if (roomInfo != null && roomInfo.isValid()) {
// 记录 roomType方便后面埋点
roomType = roomInfo.getType();
changeRoomState(roomInfo.getWorldId(), roomInfo.getUid());
// 已经开好房间了就直接分享出去
// shareRoom();
} else {
// 还没开好房间,需要先检验实名认证弹窗提示选择房间类型然后开房间
handleCertification();
}
} else {
isHandling = false;
// Toast.makeText(context, "发生异常", Toast.LENGTH_SHORT).show();
SingleToastUtil.showToastShort("发生异常");
}
});
}
private void changeRoomState(long worldId, long roomUid) {
if (worldId == 0) {
shareRoom();
} else {
MiniWorldModel.getInstance().roomWorldModeClose(roomUid).subscribe(new BeanObserver<String>() {
@Override
public void onErrorMsg(String error) {
isHandling = false;
// Toast.makeText(context, "发生异常", Toast.LENGTH_SHORT).show();
SingleToastUtil.showToastShort("发生异常");
}
@Override
public void onSuccess(String s) {
shareRoom();
}
});
}
}
private SpannableStringBuilder getCertificationTips() {
String tips = context.getString(R.string.tips_need_to_certification);
SpannableStringBuilder builder = new SpannableStringBuilder(tips);
builder.setSpan(new ForegroundColorSpan(ContextCompat.getColor(context, R.color.appColor)),
tips.length() - 4, tips.length(), Spannable.SPAN_INCLUSIVE_EXCLUSIVE);
return builder;
}
private void openCreateRoomDialog() {
if (createRoomDialog != null && createRoomDialog.isShowing()) return;
createRoomDialog = new CreateRoomDialog(context, new CreateRoomDialog.OpenRoomListener() {
@Override
public void onNormalRoom() {
roomType = RoomInfo.ROOMTYPE_HOME_PARTY;
getRoomInfo(RoomInfo.ROOMTYPE_HOME_PARTY);
}
@Override
public void onCpRoom() {
roomType = RoomInfo.ROOMTYPE_CP;
getRoomInfo(RoomInfo.ROOMTYPE_CP);
}
});
createRoomDialog.setOnCancelListener(dialogInterface -> isHandling = false);
createRoomDialog.openDialog();
}
@SuppressLint("CheckResult")
private void shareRoom() {
MentoringRelationshipModel.get()
.inviteEnable(missionVo.getMasterUid(), missionVo.getApprenticeUid())
.flatMap(roomInfo -> {
// 更新 UI
button.setEnabled(false);
button.setText(R.string.btn_has_invite_entering_room);
// 更新 localExt
localExtension = MentoringRelationshipModel.get()
.updateInviteState(message);
message.setLocalExtension(localExtension);
IMNetEaseManager.get().updateMessageToLocal(message);
return Single.just(roomInfo);
})
.flatMap(roomInfo -> {
// 分享房间邀请链接
return sendSharingRoomMessage(String.valueOf(missionVo.getApprenticeUid()));
})
.subscribe((imMessage, throwable) -> {
if (throwable == null) {
switch (roomType) {
case RoomInfo.ROOMTYPE_HOME_PARTY:
// 任务三邀请进房-普通房,打点
StatisticManager.Instance().onEvent(StatisticsProtocol.Event.NEWS_TASK_THREE_ORDINARY_ROOM,
"任务三邀请进房-普通房");
break;
case RoomInfo.ROOMTYPE_CP:
// 任务三邀请进房-陪伴房,打点
StatisticManager.Instance().onEvent(StatisticsProtocol.Event.NEWS_TASK_THREE_ACCOMPANYING_ROOM,
"任务三邀请进房-陪伴房");
break;
}
isHandling = false;
//手动刷新 UI
MessageListPanelHelper.getInstance().notifyAddMessage(imMessage);
// 跳进去自己的房间
AVRoomActivity.start(context, missionVo.getMasterUid());
} else {
isHandling = false;
// Toast.makeText(context, throwable.getMessage(), Toast.LENGTH_SHORT).show();
SingleToastUtil.showToastShort(throwable.getMessage());
}
});
}
@SuppressLint("CheckResult")
private void getRoomInfo(int roomType) {
AvRoomModel.get()
.requestRoomInfo(String.valueOf(AuthModel.get().getCurrentUid()))
.compose(RxHelper.handleSchedulers())
.subscribe((roomInfo, throwable) -> {
if (throwable == null) {
if (roomInfo != null) {
if (roomInfo.getType() != 0
&& roomInfo.getType() != roomType
&& roomInfo.isValid()) {
// 已选房间类型跟当前开好的房间类型不一致,弹窗提示
String message = roomType == RoomInfo.ROOMTYPE_CP ? "创建陪伴房,将关闭当前房间并解散房间内的用户"
: "创建普通房,将关闭当前房间并解散房间内的用户";
dialogManager.showOkCancelDialog(
message,
"确认",
"取消",
new DialogManager.OkCancelDialogListener() {
@Override
public void onCancel() {
isHandling = false;
}
@Override
public void onOk() {
openRoom(roomType);
}
});
} else {
// 已选房间类型跟当前开好房间类型一致,直接开房间
openRoom(roomType);
}
} else {
// 无房间信息,直接开房间
openRoom(roomType);
}
} else {
isHandling = false;
// Toast.makeText(context, "发生异常", Toast.LENGTH_SHORT).show();
SingleToastUtil.showToastShort("发生异常");
}
});
}
@SuppressLint("CheckResult")
private void openRoom(int roomType) {
AvRoomModel.get().openRoom(
AuthModel.get().getCurrentUid(), roomType, null, null, null, null)
.compose(RxHelper.handleSchedulers())
.subscribe((roomResult, throwable) -> {
if (throwable != null) {
isHandling = false;
// Toast.makeText(context, "发生异常", Toast.LENGTH_SHORT).show();
SingleToastUtil.showToastShort("发生异常");
} else if (roomResult != null && roomResult.isSuccess()) {
shareRoom();
} else if (roomResult != null && !roomResult.isSuccess()) {
if (roomResult.getCode() == 1500) {
// 房间已经开过了,直接分享出去
shareRoom();
} else {
isHandling = false;
// Toast.makeText(context, roomResult.getError(), Toast.LENGTH_SHORT).show();
SingleToastUtil.showToastShort(roomResult.getError());
}
} else {
isHandling = false;
// Toast.makeText(context, "未知错误", Toast.LENGTH_SHORT).show();
SingleToastUtil.showToastShort("未知错误");
}
});
}
private Single<IMMessage> sendSharingRoomMessage(String sessionId) {
MentoringSharingRoomInfo mentoringSharingRoomInfo = new MentoringSharingRoomInfo();
UserInfo userInfo = UserModel.get().getCacheLoginUserInfo();
mentoringSharingRoomInfo.setAvatar(userInfo.getAvatar());
mentoringSharingRoomInfo.setNick(userInfo.getNick());
mentoringSharingRoomInfo.setExpired(false);
mentoringSharingRoomInfo.setRoomUid(Long.toString(userInfo.getUid()));
mentoringSharingRoomInfo.setMasterUid(Long.toString(missionVo.getMasterUid()));
mentoringSharingRoomInfo.setApprenticeUid(Long.toString(missionVo.getApprenticeUid()));
MentoringSharingRoomAttachment attachment = new MentoringSharingRoomAttachment();
attachment.setMentoringSharingRoomInfo(mentoringSharingRoomInfo);
IMMessage message = MessageBuilder.createCustomMessage(sessionId, SessionTypeEnum.P2P, attachment);
return IMNetEaseManager.get()
.sendMessageSingle(message);
}
}

View File

@@ -1,149 +0,0 @@
package com.yizhuan.tutu.mentoring_relationship.viewholder;
import android.annotation.SuppressLint;
import android.widget.TextView;
import com.netease.nim.uikit.business.session.helper.MessageListPanelHelper;
import com.netease.nim.uikit.common.ui.recyclerview.adapter.BaseMultiItemFetchLoadAdapter;
import com.netease.nimlib.sdk.msg.MessageBuilder;
import com.netease.nimlib.sdk.msg.constant.SessionTypeEnum;
import com.netease.nimlib.sdk.msg.model.IMMessage;
import com.yizhuan.erban.R;
import com.yizhuan.erban.ui.utils.ImageLoadUtils;
import com.yizhuan.xchat_android_core.gift.bean.GiftInfo;
import com.yizhuan.xchat_android_core.gift.bean.GiftMultiReceiverInfo;
import com.yizhuan.xchat_android_core.gift.exception.GiftOutOfDateException;
import com.yizhuan.xchat_android_core.gift.toolbox.GiftToolbox;
import com.yizhuan.xchat_android_core.manager.IMNetEaseManager;
import com.yizhuan.xchat_android_core.mentoring_relationship.attachment.MentoringMasterMissionTwoAttachment;
import com.yizhuan.xchat_android_core.mentoring_relationship.bean.MissionVo;
import com.yizhuan.xchat_android_core.mentoring_relationship.bean.SimpleGiftVo;
import com.yizhuan.xchat_android_core.mentoring_relationship.model.MentoringRelationshipModel;
import com.yizhuan.xchat_android_core.utils.net.BalanceNotEnoughExeption;
import com.yizhuan.xchat_android_library.utils.SingleToastUtil;
import java.util.Map;
import io.reactivex.Single;
public class MasterMissionTwoViewHolder extends MissionViewHolderBase {
private MissionVo<SimpleGiftVo> simpleGiftVoMissionVo;
private SimpleGiftVo simpleGiftVo;
private Map<String, Object> localExtension;
MasterMissionTwoViewHolder(BaseMultiItemFetchLoadAdapter adapter) {
super(adapter);
}
@Override
protected int getContentResId() {
return R.layout.view_holder_master_mission_two;
}
@Override
protected void inflateContentView() {
super.inflateContentView();
IMMessage imMessage = IMNetEaseManager.get().queryMessageByUuid(message.getUuid());
if (imMessage != null) {
localExtension = imMessage.getLocalExtension();
}
MentoringMasterMissionTwoAttachment attachment =
(MentoringMasterMissionTwoAttachment) message.getAttachment();
simpleGiftVoMissionVo = attachment.getSimpleGiftVoMissionVo();
simpleGiftVo = simpleGiftVoMissionVo.getData();
}
@Override
protected void bindContentView() {
super.bindContentView();
title.setText(simpleGiftVoMissionVo.getTitle());
tips.setText(simpleGiftVoMissionVo.getTips());
ImageLoadUtils.loadAvatar(context, simpleGiftVo.getPicUrl(), pic, true);
name.setText(simpleGiftVo.getGiftName());
content.removeAllViews();
for (String s : simpleGiftVoMissionVo.getContent()) {
TextView textView = new TextView(context);
textView.setText(s);
textView.setCompoundDrawablesWithIntrinsicBounds(R.drawable.shape_dot_app_color, 0, 0, 0);
textView.setCompoundDrawablePadding(5);
textView.setTextSize(14);
content.addView(textView);
}
if (localExtension != null) {
boolean isHandsel = (boolean) localExtension
.get(MentoringRelationshipModel.KEY_HAS_HANDSEL_GIFT);
if (isHandsel) {
button.setEnabled(false);
button.setText(R.string.btn_has_handsel);
} else {
button.setEnabled(true);
button.setText(R.string.btn_handsel_now);
}
}
}
@SuppressLint("CheckResult")
@Override
protected void onButtonClick() {
MentoringRelationshipModel.get()
.sendGift(simpleGiftVo.getGiftId(),
simpleGiftVoMissionVo.getApprenticeUid(),
1, "")
.flatMap(giftReceiveInfoServiceResult -> {
// 更新 UI
button.setEnabled(false);
button.setText(R.string.btn_has_handsel);
// 更新 localExt
localExtension = MentoringRelationshipModel.get()
.updateHandselState(message);
message.setLocalExtension(localExtension);
IMNetEaseManager.get().updateMessageToLocal(message);
return Single.just(giftReceiveInfoServiceResult);
})
.flatMap(giftReceiveInfoServiceResult -> {
GiftMultiReceiverInfo giftMultiReceiverInfo =
GiftToolbox.transformToGiftMultiReceiverInfo(giftReceiveInfoServiceResult.getData());
GiftInfo giftInfo = new GiftInfo();
giftInfo.setGiftId(simpleGiftVo.getGiftId());
giftInfo.setGiftName(simpleGiftVo.getGiftName());
giftInfo.setGiftUrl(simpleGiftVo.getPicUrl());
giftMultiReceiverInfo.setGift(giftInfo);
giftMultiReceiverInfo.setGiftId(simpleGiftVo.getGiftId());
giftMultiReceiverInfo.setGiftNum(giftReceiveInfoServiceResult.getData().getGiftNum());
return GiftToolbox.sendGiftPrivateChatMessage(giftMultiReceiverInfo);
})
.flatMap(imMessage -> {
//手动刷新 UI
MessageListPanelHelper.getInstance().notifyAddMessage(imMessage);
// 发送送礼物引导信息
IMMessage giftGuideMessage = MessageBuilder.createTextMessage(
String.valueOf(simpleGiftVoMissionVo.getApprenticeUid()),
SessionTypeEnum.P2P, simpleGiftVoMissionVo.getMessage());
return IMNetEaseManager.get().sendMessageSingle(giftGuideMessage);
})
.doOnError(throwable -> {
if (throwable instanceof BalanceNotEnoughExeption) {
SingleToastUtil.showToast(throwable.getMessage());
} else if (throwable instanceof GiftOutOfDateException) {
GiftOutOfDateException exception = (GiftOutOfDateException) throwable;
SingleToastUtil.showToast(exception.getMessage());
}
})
.doOnSubscribe(disposable -> {
if (isHandling) {
disposable.dispose();
} else {
isHandling = true;
}
})
.subscribe((imMessage, throwable) -> {
if (throwable == null) {
//手动刷新 UI
MessageListPanelHelper.getInstance().notifyAddMessage(imMessage);
}
isHandling = false;
});
}
}

View File

@@ -1,160 +0,0 @@
package com.yizhuan.tutu.mentoring_relationship.viewholder;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;
import android.widget.Toast;
import com.netease.nim.uikit.business.session.viewholder.MsgViewHolderBase;
import com.netease.nim.uikit.common.ui.recyclerview.adapter.BaseMultiItemFetchLoadAdapter;
import com.netease.nimlib.sdk.msg.model.IMMessage;
import com.yizhuan.erban.R;
import com.yizhuan.erban.avroom.activity.AVRoomActivity;
import com.yizhuan.erban.ui.user.UserInfoActivity;
import com.yizhuan.erban.ui.utils.ImageLoadUtils;
import com.yizhuan.xchat_android_core.auth.AuthModel;
import com.yizhuan.xchat_android_core.exception.FailReasonException;
import com.yizhuan.xchat_android_core.manager.IMNetEaseManager;
import com.yizhuan.xchat_android_core.mentoring_relationship.attachment.MentoringSharingRoomAttachment;
import com.yizhuan.xchat_android_core.mentoring_relationship.bean.MentoringSharingRoomInfo;
import com.yizhuan.xchat_android_core.mentoring_relationship.model.MentoringRelationshipModel;
import com.yizhuan.xchat_android_library.utils.JavaUtil;
import com.yizhuan.xchat_android_library.utils.SingleToastUtil;
import java.util.Map;
import java.util.Objects;
public class MentoringSharingRoomViewHolder extends MsgViewHolderBase implements View.OnClickListener {
private ImageView avatar;
private TextView nick;
private TextView button;
private MentoringSharingRoomInfo mentoringSharingRoomInfo;
private Map<String, Object> localExtension;
public MentoringSharingRoomViewHolder(BaseMultiItemFetchLoadAdapter adapter) {
super(adapter);
}
@Override
protected boolean isMiddleItem() {
return true;
}
@Override
protected boolean isShowHeadImage() {
return false;
}
@Override
protected boolean shouldDisplayNick() {
return false;
}
@Override
protected int getContentResId() {
return R.layout.view_holder_mentoring_sharing_room;
}
@Override
protected boolean shouldDisplayReceipt() {
return false;
}
@Override
protected void inflateContentView() {
IMMessage imMessage = IMNetEaseManager.get().queryMessageByUuid(message.getUuid());
if (imMessage != null) {
localExtension = imMessage.getLocalExtension();
}
MentoringSharingRoomAttachment attachment =
(MentoringSharingRoomAttachment) message.getAttachment();
mentoringSharingRoomInfo = attachment.getMentoringSharingRoomInfo();
avatar = findViewById(R.id.iv_avatar);
nick = findViewById(R.id.tv_name);
button = findViewById(R.id.btn_action);
button.setOnClickListener(this);
avatar.setOnClickListener(this);
}
@Override
protected void bindContentView() {
ImageLoadUtils.loadAvatar(context, mentoringSharingRoomInfo.getAvatar(), avatar, true);
nick.setText(mentoringSharingRoomInfo.getNick());
if (Objects.equals(mentoringSharingRoomInfo.getMasterUid(),
String.valueOf(AuthModel.get().getCurrentUid()))) {
// 如果是师父,直接置灰并显示已邀请
button.setEnabled(false);
button.setText(R.string.btn_has_invite_entering_room);
} else {
// 如果是徒弟,走以前的逻辑
if (localExtension != null && localExtension
.get(MentoringRelationshipModel.KEY_ROOM_INVITATION_EXPIRED) != null) {
boolean hasInvited = (boolean) localExtension
.get(MentoringRelationshipModel.KEY_ROOM_INVITATION_EXPIRED);
if (hasInvited) {
button.setEnabled(false);
} else {
button.setEnabled(true);
}
}
}
}
@Override
public void onClick(View view) {
switch (view.getId()) {
case R.id.btn_action:
MentoringRelationshipModel.get()
.inviteEnable(JavaUtil.str2long(mentoringSharingRoomInfo.getMasterUid()),
JavaUtil.str2long(mentoringSharingRoomInfo.getApprenticeUid()))
.subscribe((s, throwable) -> {
if (throwable == null) {
if (Objects.equals(mentoringSharingRoomInfo.getApprenticeUid(),
String.valueOf(AuthModel.get().getCurrentUid()))) {
AVRoomActivity.startForMentoring(context, JavaUtil.str2long(mentoringSharingRoomInfo.getMasterUid()));
} else {
AVRoomActivity.start(context, JavaUtil.str2long(mentoringSharingRoomInfo.getMasterUid()));
}
} else {
if (throwable instanceof FailReasonException) {
FailReasonException failReasonException = (FailReasonException) throwable;
switch (failReasonException.getCode()) {
case MentoringRelationshipModel.CODE_ALREADY_HAS_MASTER:
// 更新 UI
button.setEnabled(false);
// 更新 localExt
localExtension = MentoringRelationshipModel.get()
.updateRoomInvitationState(message);
message.setLocalExtension(localExtension);
IMNetEaseManager.get().updateMessageToLocal(message);
// Toast.makeText(context, throwable.getMessage(), Toast.LENGTH_SHORT).show();
SingleToastUtil.showToastShort(throwable.getMessage());
break;
case MentoringRelationshipModel.CODE_MISSION_ALREADY_EXPIRED:
// 更新 UI
button.setEnabled(false);
// 更新 localExt
localExtension = MentoringRelationshipModel.get()
.updateRoomInvitationState(message);
message.setLocalExtension(localExtension);
IMNetEaseManager.get().updateMessageToLocal(message);
// Toast.makeText(context, throwable.getMessage(), Toast.LENGTH_SHORT).show();
SingleToastUtil.showToastShort(throwable.getMessage());
break;
}
} else {
// Toast.makeText(context, "发送异常", Toast.LENGTH_SHORT).show();
SingleToastUtil.showToastShort("发送异常");
}
}
});
break;
case R.id.iv_avatar:
UserInfoActivity.Companion.start(context, JavaUtil.str2long(mentoringSharingRoomInfo.getRoomUid()));
break;
}
}
}

View File

@@ -1,46 +0,0 @@
package com.yizhuan.tutu.mentoring_relationship.viewholder;
import android.widget.TextView;
import com.netease.nim.uikit.business.session.viewholder.MsgViewHolderBase;
import com.netease.nim.uikit.common.ui.recyclerview.adapter.BaseMultiItemFetchLoadAdapter;
import com.yizhuan.erban.R;
public class MentoringTipsViewHolder extends MsgViewHolderBase {
private TextView tips;
public MentoringTipsViewHolder(BaseMultiItemFetchLoadAdapter adapter) {
super(adapter);
}
@Override
protected boolean isMiddleItem() {
return true;
}
@Override
protected boolean isShowBubble() {
return false;
}
@Override
protected boolean shouldDisplayReceipt() {
return false;
}
@Override
protected int getContentResId() {
return R.layout.view_holder_mentoring_tips;
}
@Override
protected void inflateContentView() {
tips = findViewById(R.id.message_tips_label);
}
@Override
protected void bindContentView() {
tips.setText(message.getContent());
}
}

View File

@@ -1,93 +0,0 @@
package com.yizhuan.tutu.mentoring_relationship.viewholder;
import android.view.View;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
import com.netease.nim.uikit.business.session.viewholder.MsgViewHolderBase;
import com.netease.nim.uikit.common.ui.recyclerview.adapter.BaseMultiItemFetchLoadAdapter;
import com.yizhuan.erban.R;
import com.yizhuan.erban.ui.webview.CommonWebViewActivity;
import com.yizhuan.xchat_android_core.UriProvider;
public class MissionViewHolderBase extends MsgViewHolderBase implements View.OnClickListener {
protected TextView title;
protected TextView tips;
protected LinearLayout content;
protected ImageView pic;
protected TextView name;
protected TextView button;
protected volatile boolean isHandling = false;
protected TextView raiders;
MissionViewHolderBase(BaseMultiItemFetchLoadAdapter adapter) {
super(adapter);
}
@Override
protected int getContentResId() {
return 0;
}
@Override
protected void inflateContentView() {
title = findViewById(R.id.tv_title);
tips = findViewById(R.id.tv_tips);
content = findViewById(R.id.ll_mission_steps);
pic = findViewById(R.id.iv_pic);
name = findViewById(R.id.tv_nick);
button = findViewById(R.id.btn_action);
raiders = findViewById(R.id.tv_raiders);
}
@Override
protected void bindContentView() {
button.setOnClickListener(this);
if (raiders != null) {
raiders.setOnClickListener(this);
}
}
@Override
protected boolean isMiddleItem() {
// 居中显示
return true;
}
@Override
protected boolean isShowHeadImage() {
// 不显示头像
return false;
}
@Override
protected boolean isShowBubble() {
// 不显示气泡背景
return false;
}
@Override
protected boolean shouldDisplayReceipt() {
// 不显示已读回执
return false;
}
@Override
public void onClick(View view) {
switch (view.getId()) {
case R.id.btn_action:
onButtonClick();
break;
case R.id.tv_raiders:
CommonWebViewActivity.start(context, UriProvider.getMentoringRelationshipGuide());
break;
}
}
protected void onButtonClick() {
//
}
}

View File

@@ -21,7 +21,6 @@
android:id="@+id/in_empty_bg"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_above="@id/music_box_layout"
android:layout_below="@id/title_layout"
layout="@layout/layout_bg_music_empty"/>

View File

@@ -88,7 +88,6 @@
layout="@layout/layout_bg_music_empty"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="@+id/title_layout"
android:layout_alignParentStart="true"
android:layout_marginTop="0dp" />
@@ -97,7 +96,6 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_above="@id/music_box_layout"
android:layout_below="@+id/title_layout"
android:orientation="vertical">
<TextView

View File

@@ -1,10 +1,11 @@
package com.yizhuan.erban.public_chat_hall.msg.viewholder;
import androidx.core.content.ContextCompat;
import android.text.method.LinkMovementMethod;
import android.text.style.ImageSpan;
import android.widget.TextView;
import androidx.core.content.ContextCompat;
import com.netease.nim.uikit.api.NimUIKit;
import com.netease.nim.uikit.business.session.emoji.MoonUtil;
import com.netease.nim.uikit.common.util.sys.ScreenUtil;

View File

@@ -12,6 +12,6 @@
android:includeFontPadding="false"
android:lineSpacingExtra="3dip"
android:maxWidth="222dp"
android:textColor="@color/color_black_b3000000"
android:textSize="@dimen/dp_14"/>
android:textColor="@color/white"
android:textSize="@dimen/dp_13"/>
</LinearLayout>

View File

@@ -3,7 +3,7 @@
android:id="@+id/messageActivityLayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/color_message_default_bg"
android:background="@color/color_1c1b22"
android:orientation="vertical">
<RelativeLayout
@@ -75,7 +75,6 @@
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/messageListView"
style="@style/recycler_view"
android:background="@color/white"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</LinearLayout>

View File

@@ -56,7 +56,6 @@
android:layout_marginLeft="21dp"
android:layout_marginRight="21dp"
android:layout_marginBottom="16dp"
app:layout_constraintTop_toBottomOf="@id/tv_title"
app:layout_constraintBottom_toBottomOf="parent">
<ImageView

Binary file not shown.

Before

Width:  |  Height:  |  Size: 261 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 407 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.7 KiB

After

Width:  |  Height:  |  Size: 2.9 KiB

View File

@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="#fff4f4f4" />
<solid android:color="#35354B" />
<corners android:radius="15dp" />
</shape>

View File

@@ -13,6 +13,6 @@
android:topLeftRadius="4dp"
android:topRightRadius="20dp"/>
<solid android:color="#EFEBFF"/>
<solid android:color="#2A2A39"/>
</shape>

View File

@@ -13,6 +13,6 @@
android:bottomRightRadius="20dp"
android:bottomLeftRadius="20dp"/>
<solid android:color="#F4F4F4"/>
<solid android:color="#2A2A39"/>
</shape>

View File

@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="#35354B" />
<corners android:topLeftRadius="15dp"
android:topRightRadius="15dp"
android:bottomRightRadius="15dp"
android:bottomLeftRadius="15dp"/>
</shape>

View File

@@ -4,6 +4,7 @@
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/color_2a2a39"
android:orientation="vertical">
<include layout="@layout/nim_message_activity_text_layout"/>

View File

@@ -4,7 +4,6 @@
android:id="@+id/textMessageLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/nim_message_view_bottom"
android:gravity="center_vertical"
android:paddingBottom="@dimen/bottom_component_margin_vertical"
android:paddingTop="@dimen/bottom_component_margin_vertical">

View File

@@ -3,7 +3,6 @@
android:id="@+id/messageActivityLayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/color_message_default_bg"
android:orientation="vertical">
<FrameLayout
@@ -83,24 +82,6 @@
</FrameLayout>
<!--<RelativeLayout-->
<!--android:minHeight="35dp"-->
<!--android:layout_width="match_parent"-->
<!--android:layout_height="wrap_content">-->
<!--<include layout="@layout/nim_message_activity_bottom_layout"-->
<!--android:layout_width="match_parent"-->
<!--android:layout_height="wrap_content"/>-->
<!--<TextView-->
<!--android:text="禁言中,快找管理员解除禁言吧!"-->
<!--android:textColor="@color/white"-->
<!--android:background="@color/gray7"-->
<!--android:textSize="15dp"-->
<!--android:gravity="center"-->
<!--android:layout_alignParentBottom="true"-->
<!--android:layout_alignParentTop="true"-->
<!--android:layout_width="match_parent"-->
<!--android:layout_height="wrap_content" />-->
<!--</RelativeLayout>-->
<include layout="@layout/nim_message_activity_bottom_layout" />

View File

@@ -19,8 +19,7 @@
android:paddingLeft="7dip"
android:paddingRight="7dip"
android:textColor="#ffffff"
android:textSize="12sp"
android:textStyle="bold"
android:textSize="10sp"
android:visibility="gone" />
<com.netease.nim.uikit.common.ui.imageview.HeadImageView

View File

@@ -1,9 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical">
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical">
<TextView
android:id="@+id/nim_message_item_text_body"
android:layout_width="wrap_content"
@@ -15,6 +16,6 @@
android:maxWidth="238dp"
android:minWidth="40dp"
android:minHeight="40dp"
android:textColor="@color/color_black_b3000000"
android:textSize="16sp"/>
android:textColor="@color/white"
android:textSize="13sp" />
</LinearLayout>

View File

@@ -2,5 +2,6 @@
<resources>
<color name="left_ball_color">#7f01020a</color>
<color name="right_ball_color">#7f01020b</color>
<color name="item_hover">#2A2A39</color>
<color name="item_hover">#dbdbdb</color>
<color name="item_hover_nim">#2A2A39</color>
</resources>

View File

@@ -10,7 +10,7 @@ public class NimToolBarOptions extends ToolBarOptions {
public NimToolBarOptions() {
//logoId = R.drawable.nim_actionbar_nest_dark_logo;
navigateId = R.drawable.nim_actionbar_dark_back_icon;
navigateId = R.drawable.arrow_left_white;
titleString = "";
isNeedNavigate = true;
}

View File

@@ -36,40 +36,13 @@ public class MsgViewHolderText extends MsgViewHolderBase {
@Override
protected void bindContentView() {
layoutDirection();
bodyTextView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
onItemClick();
}
});
bodyTextView.setOnClickListener(v -> onItemClick());
MoonUtil.identifyFaceExpression(NimUIKit.getContext(), bodyTextView, getDisplayText(), ImageSpan.ALIGN_BOTTOM);
bodyTextView.setMovementMethod(LinkMovementMethod.getInstance());
bodyTextView.setOnLongClickListener(longClickListener);
bodyTextView.setLinkTextColor(Color.parseColor("#522f0c"));
}
private void layoutDirection() {
if (isReceivedMessage()) {
bodyTextView.setBackgroundResource(NimUIKitImpl.getOptions().messageLeftBackground);
bodyTextView.setTextColor(Color.parseColor("#5F45D6"));
} else {
bodyTextView.setBackgroundResource(NimUIKitImpl.getOptions().messageRightBackground);
bodyTextView.setTextColor(Color.parseColor("#666666"));
}
// bodyTextView.setPadding(ScreenUtil.dip2px(10), ScreenUtil.dip2px(14), ScreenUtil.dip2px(10), ScreenUtil.dip2px(14));
}
@Override
protected int leftBackground() {
return 0;
}
@Override
protected int rightBackground() {
return 0;
}
protected String getDisplayText() {
return message.getContent();
}