diff --git a/app/proguard-rules.pro b/app/proguard-rules.pro index 97f003353..bedee0d51 100644 --- a/app/proguard-rules.pro +++ b/app/proguard-rules.pro @@ -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.** { *; } + diff --git a/app/src/main/java/com/yizhuan/erban/home/fragment/MeFragment.java b/app/src/main/java/com/yizhuan/erban/home/fragment/MeFragment.java index 3a54c572e..28ed417d3 100644 --- a/app/src/main/java/com/yizhuan/erban/home/fragment/MeFragment.java +++ b/app/src/main/java/com/yizhuan/erban/home/fragment/MeFragment.java @@ -167,16 +167,15 @@ public class MeFragment extends BaseMvpFragment { 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(() -> { diff --git a/app/src/main/java/com/yizhuan/erban/ui/im/chat/MVHChatterBoxInit.java b/app/src/main/java/com/yizhuan/erban/ui/im/chat/MVHChatterBoxInit.java deleted file mode 100644 index d2a1195f2..000000000 --- a/app/src/main/java/com/yizhuan/erban/ui/im/chat/MVHChatterBoxInit.java +++ /dev/null @@ -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 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; - } -} diff --git a/app/src/main/java/com/yizhuan/erban/ui/im/chat/MVHDiceThrow.java b/app/src/main/java/com/yizhuan/erban/ui/im/chat/MVHDiceThrow.java deleted file mode 100644 index f38330755..000000000 --- a/app/src/main/java/com/yizhuan/erban/ui/im/chat/MVHDiceThrow.java +++ /dev/null @@ -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; - - } - } - - } -} diff --git a/app/src/main/java/com/yizhuan/erban/ui/im/chat/MsgViewHolderTip.java b/app/src/main/java/com/yizhuan/erban/ui/im/chat/MsgViewHolderTip.java deleted file mode 100644 index 1cb2ea0c9..000000000 --- a/app/src/main/java/com/yizhuan/erban/ui/im/chat/MsgViewHolderTip.java +++ /dev/null @@ -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()); - } - } - -} diff --git a/app/src/main/java/com/yizhuan/erban/ui/im/chat/MsgViewHolderVoiceBottleSayHi.java b/app/src/main/java/com/yizhuan/erban/ui/im/chat/MsgViewHolderVoiceBottleSayHi.java deleted file mode 100644 index a39bc68ee..000000000 --- a/app/src/main/java/com/yizhuan/erban/ui/im/chat/MsgViewHolderVoiceBottleSayHi.java +++ /dev/null @@ -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 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 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 localExtension = new HashMap<>(); - localExtension.put(VoiceBottleShakeHeartAttachment.KEY_VOICE_BOTTLE_NEED_SHAKE_HEART, true); - shakeHeartMessage.setLocalExtension(localExtension); - IMNetEaseManager.get().sendMessageSingle(shakeHeartMessage) - .subscribe(new SingleObserver() { - @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; - } -} \ No newline at end of file diff --git a/app/src/main/java/com/yizhuan/erban/ui/im/chat/SysMsgVoiceViewHolder.java b/app/src/main/java/com/yizhuan/erban/ui/im/chat/SysMsgVoiceViewHolder.java deleted file mode 100644 index 45735ce4c..000000000 --- a/app/src/main/java/com/yizhuan/erban/ui/im/chat/SysMsgVoiceViewHolder.java +++ /dev/null @@ -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); - }); - } - } -} diff --git a/app/src/main/java/com/yizhuan/erban/ui/im/recent/holder/RecentViewHolder.java b/app/src/main/java/com/yizhuan/erban/ui/im/recent/holder/RecentViewHolder.java index 27d398a5b..ead701493 100644 --- a/app/src/main/java/com/yizhuan/erban/ui/im/recent/holder/RecentViewHolder.java +++ b/app/src/main/java/com/yizhuan/erban/ui/im/recent/holder/RecentViewHolder.java @@ -90,7 +90,7 @@ public abstract class RecentViewHolder extends RecyclerViewHolder - + diff --git a/app/src/main/res/drawable/bg_nim_msg_touch.xml b/app/src/main/res/drawable/bg_nim_msg_touch.xml new file mode 100644 index 000000000..ebc1c37d6 --- /dev/null +++ b/app/src/main/res/drawable/bg_nim_msg_touch.xml @@ -0,0 +1,6 @@ + + + + + + diff --git a/app/src/main/res/layout/activity_p2p_message.xml b/app/src/main/res/layout/activity_p2p_message.xml index 060242689..a04cbf697 100644 --- a/app/src/main/res/layout/activity_p2p_message.xml +++ b/app/src/main/res/layout/activity_p2p_message.xml @@ -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"> - @@ -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" /> @@ -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" diff --git a/app/src/main/res/layout/fragment_game_home.xml b/app/src/main/res/layout/fragment_game_home.xml index 84c6d532e..ef24708c5 100644 --- a/app/src/main/res/layout/fragment_game_home.xml +++ b/app/src/main/res/layout/fragment_game_home.xml @@ -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" diff --git a/app/src/main/res/layout/fragment_me.xml b/app/src/main/res/layout/fragment_me.xml index 9203e3679..a8836ff1f 100644 --- a/app/src/main/res/layout/fragment_me.xml +++ b/app/src/main/res/layout/fragment_me.xml @@ -18,8 +18,8 @@ + android:layout_height="match_parent" + android:background="@color/color_1c1b22"> + android:orientation="horizontal" + android:visibility="gone"> @@ -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" /> + tools:ignore="SmallSp" /> - - - - - - - - - - - - - - - + android:layout_marginStart="15dp" + android:layout_marginTop="15dp" + android:layout_marginEnd="15dp" + android:orientation="horizontal"> + + + + + + + + + + + + + + + + + + + + + + + - - - - - + + + + + - - - - - + - - - - - - - + android:layout_marginEnd="@dimen/dp_me_text_padding_to_icon" + android:background="#353548" /> - - - - - + android:textColor="@color/color_c6c6e9" + android:textSize="13sp" + android:visibility="gone" /> - - + - - + android:paddingBottom="@dimen/dp_15" + android:text="@string/menu_my_union" + android:textColor="@color/color_c6c6e9" + android:textSize="13sp" /> - - + - - - - - - + - - - - - - - - - - - @@ -688,6 +663,31 @@ + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/im_customer_msg_text.xml b/app/src/main/res/layout/im_customer_msg_text.xml index a6f002d0b..3b5d102a5 100644 --- a/app/src/main/res/layout/im_customer_msg_text.xml +++ b/app/src/main/res/layout/im_customer_msg_text.xml @@ -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="恭喜您,获得抽奖机会,点我抽奖>>" /> \ No newline at end of file diff --git a/app/src/main/res/layout/item_home_dynamic.xml b/app/src/main/res/layout/item_home_dynamic.xml index 5665187b3..2e30a13e4 100644 --- a/app/src/main/res/layout/item_home_dynamic.xml +++ b/app/src/main/res/layout/item_home_dynamic.xml @@ -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" diff --git a/app/src/main/res/layout/item_home_tab_map.xml b/app/src/main/res/layout/item_home_tab_map.xml index 67ac1d814..5de658329 100644 --- a/app/src/main/res/layout/item_home_tab_map.xml +++ b/app/src/main/res/layout/item_home_tab_map.xml @@ -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="房间名称房间名称房间名称" /> diff --git a/app/src/main/res/layout/layout_recommend_topic_header.xml b/app/src/main/res/layout/layout_recommend_topic_header.xml index 40c86dc59..96d1c7616 100644 --- a/app/src/main/res/layout/layout_recommend_topic_header.xml +++ b/app/src/main/res/layout/layout_recommend_topic_header.xml @@ -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" /> diff --git a/app/src/main/res/layout/list_item_online_user.xml b/app/src/main/res/layout/list_item_online_user.xml index de1c4f4ef..b23f2a110 100644 --- a/app/src/main/res/layout/list_item_online_user.xml +++ b/app/src/main/res/layout/list_item_online_user.xml @@ -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"> diff --git a/app/src/main/res/layout/nim_recent_contact_list_item_new.xml b/app/src/main/res/layout/nim_recent_contact_list_item_new.xml index c88512734..70bd3dc02 100644 --- a/app/src/main/res/layout/nim_recent_contact_list_item_new.xml +++ b/app/src/main/res/layout/nim_recent_contact_list_item_new.xml @@ -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="我是内容我是内容我是内容我是内容我是内容我是内容我是内容我是内容" /> diff --git a/app/src/main/res/layout/room_invite_list_item_layout.xml b/app/src/main/res/layout/room_invite_list_item_layout.xml index 63e2b2675..9d6b628b7 100644 --- a/app/src/main/res/layout/room_invite_list_item_layout.xml +++ b/app/src/main/res/layout/room_invite_list_item_layout.xml @@ -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" /> diff --git a/app/src/main/res/mipmap-xhdpi/ic_me_collection.png b/app/src/main/res/mipmap-xhdpi/ic_me_collection.png new file mode 100644 index 000000000..2423e0ee7 Binary files /dev/null and b/app/src/main/res/mipmap-xhdpi/ic_me_collection.png differ diff --git a/app/src/main/res/mipmap-xhdpi/ic_me_my_room.png b/app/src/main/res/mipmap-xhdpi/ic_me_my_room.png new file mode 100644 index 000000000..a3fee63a5 Binary files /dev/null and b/app/src/main/res/mipmap-xhdpi/ic_me_my_room.png differ diff --git a/app/src/main/res/mipmap-xxhdpi/icon_union.png b/app/src/main/res/mipmap-xhdpi/icon_union.png similarity index 100% rename from app/src/main/res/mipmap-xxhdpi/icon_union.png rename to app/src/main/res/mipmap-xhdpi/icon_union.png diff --git a/app/src/main/res/values/colors.xml b/app/src/main/res/values/colors.xml index 1c2f5d18f..7156124ae 100644 --- a/app/src/main/res/values/colors.xml +++ b/app/src/main/res/values/colors.xml @@ -551,4 +551,5 @@ #2D93FF #1C1B22 + #c6c6e9 diff --git a/app/src/module_community/res/layout/item_square_dynamic.xml b/app/src/module_community/res/layout/item_square_dynamic.xml index caf4d2b70..32b2dd50d 100644 --- a/app/src/module_community/res/layout/item_square_dynamic.xml +++ b/app/src/module_community/res/layout/item_square_dynamic.xml @@ -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" /> @@ -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" /> diff --git a/app/src/module_mentoring_relationship/java/com/yizhuan/tutu/mentoring_relationship/viewholder/ApprenticeMissionFourViewHolder.java b/app/src/module_mentoring_relationship/java/com/yizhuan/tutu/mentoring_relationship/viewholder/ApprenticeMissionFourViewHolder.java deleted file mode 100644 index f110cceee..000000000 --- a/app/src/module_mentoring_relationship/java/com/yizhuan/tutu/mentoring_relationship/viewholder/ApprenticeMissionFourViewHolder.java +++ /dev/null @@ -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 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)); - } -} diff --git a/app/src/module_mentoring_relationship/java/com/yizhuan/tutu/mentoring_relationship/viewholder/ApprenticeMissionOneViewHolder.java b/app/src/module_mentoring_relationship/java/com/yizhuan/tutu/mentoring_relationship/viewholder/ApprenticeMissionOneViewHolder.java deleted file mode 100644 index effc71797..000000000 --- a/app/src/module_mentoring_relationship/java/com/yizhuan/tutu/mentoring_relationship/viewholder/ApprenticeMissionOneViewHolder.java +++ /dev/null @@ -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 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; - } - } -} diff --git a/app/src/module_mentoring_relationship/java/com/yizhuan/tutu/mentoring_relationship/viewholder/ApprenticeMissionThreeViewHolder.java b/app/src/module_mentoring_relationship/java/com/yizhuan/tutu/mentoring_relationship/viewholder/ApprenticeMissionThreeViewHolder.java deleted file mode 100644 index 59fe520fa..000000000 --- a/app/src/module_mentoring_relationship/java/com/yizhuan/tutu/mentoring_relationship/viewholder/ApprenticeMissionThreeViewHolder.java +++ /dev/null @@ -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 simpleGiftVoMissionVo; - private SimpleGiftVo simpleGiftVo; - private Map 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, - "任务三完成"); - }); - } -} diff --git a/app/src/module_mentoring_relationship/java/com/yizhuan/tutu/mentoring_relationship/viewholder/ApprenticeMissionTwoViewHolder.java b/app/src/module_mentoring_relationship/java/com/yizhuan/tutu/mentoring_relationship/viewholder/ApprenticeMissionTwoViewHolder.java deleted file mode 100644 index 9c3e224fa..000000000 --- a/app/src/module_mentoring_relationship/java/com/yizhuan/tutu/mentoring_relationship/viewholder/ApprenticeMissionTwoViewHolder.java +++ /dev/null @@ -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 simpleGiftVoMissionVo; - private SimpleGiftVo simpleGiftVo; - private TextView thanks; - private TextView rebate; - private transient GiftDialog giftDialog; - private Map 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 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() { - @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(); - } - } - }); - } - -} diff --git a/app/src/module_mentoring_relationship/java/com/yizhuan/tutu/mentoring_relationship/viewholder/MasterMissionFourViewHolder.java b/app/src/module_mentoring_relationship/java/com/yizhuan/tutu/mentoring_relationship/viewholder/MasterMissionFourViewHolder.java deleted file mode 100644 index 838d03b62..000000000 --- a/app/src/module_mentoring_relationship/java/com/yizhuan/tutu/mentoring_relationship/viewholder/MasterMissionFourViewHolder.java +++ /dev/null @@ -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 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; - }); - } -} diff --git a/app/src/module_mentoring_relationship/java/com/yizhuan/tutu/mentoring_relationship/viewholder/MasterMissionOneViewHolder.java b/app/src/module_mentoring_relationship/java/com/yizhuan/tutu/mentoring_relationship/viewholder/MasterMissionOneViewHolder.java deleted file mode 100644 index 766c20956..000000000 --- a/app/src/module_mentoring_relationship/java/com/yizhuan/tutu/mentoring_relationship/viewholder/MasterMissionOneViewHolder.java +++ /dev/null @@ -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 simpleUserVoMissionVo; - private SimpleUserVo simpleUserVo; - private Map 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; - }); - - } -} diff --git a/app/src/module_mentoring_relationship/java/com/yizhuan/tutu/mentoring_relationship/viewholder/MasterMissionThreeViewHolder.java b/app/src/module_mentoring_relationship/java/com/yizhuan/tutu/mentoring_relationship/viewholder/MasterMissionThreeViewHolder.java deleted file mode 100644 index 7401b0d2f..000000000 --- a/app/src/module_mentoring_relationship/java/com/yizhuan/tutu/mentoring_relationship/viewholder/MasterMissionThreeViewHolder.java +++ /dev/null @@ -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 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() { - @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 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); - } -} diff --git a/app/src/module_mentoring_relationship/java/com/yizhuan/tutu/mentoring_relationship/viewholder/MasterMissionTwoViewHolder.java b/app/src/module_mentoring_relationship/java/com/yizhuan/tutu/mentoring_relationship/viewholder/MasterMissionTwoViewHolder.java deleted file mode 100644 index b506b5cfa..000000000 --- a/app/src/module_mentoring_relationship/java/com/yizhuan/tutu/mentoring_relationship/viewholder/MasterMissionTwoViewHolder.java +++ /dev/null @@ -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 simpleGiftVoMissionVo; - private SimpleGiftVo simpleGiftVo; - private Map 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; - }); - } - -} diff --git a/app/src/module_mentoring_relationship/java/com/yizhuan/tutu/mentoring_relationship/viewholder/MentoringSharingRoomViewHolder.java b/app/src/module_mentoring_relationship/java/com/yizhuan/tutu/mentoring_relationship/viewholder/MentoringSharingRoomViewHolder.java deleted file mode 100644 index a2a56e3a3..000000000 --- a/app/src/module_mentoring_relationship/java/com/yizhuan/tutu/mentoring_relationship/viewholder/MentoringSharingRoomViewHolder.java +++ /dev/null @@ -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 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; - } - } -} diff --git a/app/src/module_mentoring_relationship/java/com/yizhuan/tutu/mentoring_relationship/viewholder/MentoringTipsViewHolder.java b/app/src/module_mentoring_relationship/java/com/yizhuan/tutu/mentoring_relationship/viewholder/MentoringTipsViewHolder.java deleted file mode 100644 index 946ed0fce..000000000 --- a/app/src/module_mentoring_relationship/java/com/yizhuan/tutu/mentoring_relationship/viewholder/MentoringTipsViewHolder.java +++ /dev/null @@ -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()); - } -} diff --git a/app/src/module_mentoring_relationship/java/com/yizhuan/tutu/mentoring_relationship/viewholder/MissionViewHolderBase.java b/app/src/module_mentoring_relationship/java/com/yizhuan/tutu/mentoring_relationship/viewholder/MissionViewHolderBase.java deleted file mode 100644 index 96d851f07..000000000 --- a/app/src/module_mentoring_relationship/java/com/yizhuan/tutu/mentoring_relationship/viewholder/MissionViewHolderBase.java +++ /dev/null @@ -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() { - // - } -} diff --git a/app/src/module_music/res/layout/activity_local_music_list.xml b/app/src/module_music/res/layout/activity_local_music_list.xml index 7071961a6..8c537c7ad 100644 --- a/app/src/module_music/res/layout/activity_local_music_list.xml +++ b/app/src/module_music/res/layout/activity_local_music_list.xml @@ -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"/> diff --git a/app/src/module_music/res/layout/fragment_music_list.xml b/app/src/module_music/res/layout/fragment_music_list.xml index ca46e276f..d4e48762b 100644 --- a/app/src/module_music/res/layout/fragment_music_list.xml +++ b/app/src/module_music/res/layout/fragment_music_list.xml @@ -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"> + android:textColor="@color/white" + android:textSize="@dimen/dp_13"/> \ No newline at end of file diff --git a/app/src/module_public_chat_hall/res/layout/nim_msg_fragment.xml b/app/src/module_public_chat_hall/res/layout/nim_msg_fragment.xml index 56555ecd8..502e56129 100644 --- a/app/src/module_public_chat_hall/res/layout/nim_msg_fragment.xml +++ b/app/src/module_public_chat_hall/res/layout/nim_msg_fragment.xml @@ -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"> diff --git a/app/src/module_treasure_box/res/layout/activity_box_help.xml b/app/src/module_treasure_box/res/layout/activity_box_help.xml index 121ab423d..228e09a63 100644 --- a/app/src/module_treasure_box/res/layout/activity_box_help.xml +++ b/app/src/module_treasure_box/res/layout/activity_box_help.xml @@ -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"> - + \ No newline at end of file diff --git a/nim_uikit/res/drawable/bg_nim_water_drop_other.xml b/nim_uikit/res/drawable/bg_nim_water_drop_other.xml index 29ab10fb3..6b1f87bc8 100644 --- a/nim_uikit/res/drawable/bg_nim_water_drop_other.xml +++ b/nim_uikit/res/drawable/bg_nim_water_drop_other.xml @@ -13,6 +13,6 @@ android:topLeftRadius="4dp" android:topRightRadius="20dp"/> - + \ No newline at end of file diff --git a/nim_uikit/res/drawable/bg_nim_water_drop_self.xml b/nim_uikit/res/drawable/bg_nim_water_drop_self.xml index 5be71157f..aa7827887 100644 --- a/nim_uikit/res/drawable/bg_nim_water_drop_self.xml +++ b/nim_uikit/res/drawable/bg_nim_water_drop_self.xml @@ -13,6 +13,6 @@ android:bottomRightRadius="20dp" android:bottomLeftRadius="20dp"/> - + \ No newline at end of file diff --git a/nim_uikit/res/drawable/nim_bg_message_tip.xml b/nim_uikit/res/drawable/nim_bg_message_tip.xml new file mode 100644 index 000000000..57ee44fad --- /dev/null +++ b/nim_uikit/res/drawable/nim_bg_message_tip.xml @@ -0,0 +1,8 @@ + + + + + \ No newline at end of file diff --git a/nim_uikit/res/layout/nim_message_activity_bottom_layout.xml b/nim_uikit/res/layout/nim_message_activity_bottom_layout.xml index d5b13356c..fdf9e0265 100644 --- a/nim_uikit/res/layout/nim_message_activity_bottom_layout.xml +++ b/nim_uikit/res/layout/nim_message_activity_bottom_layout.xml @@ -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"> diff --git a/nim_uikit/res/layout/nim_message_activity_text_layout.xml b/nim_uikit/res/layout/nim_message_activity_text_layout.xml index 9792b3b76..f32e2f686 100644 --- a/nim_uikit/res/layout/nim_message_activity_text_layout.xml +++ b/nim_uikit/res/layout/nim_message_activity_text_layout.xml @@ -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"> diff --git a/nim_uikit/res/layout/nim_message_fragment.xml b/nim_uikit/res/layout/nim_message_fragment.xml index 6d7ee11d1..3a4e20b63 100644 --- a/nim_uikit/res/layout/nim_message_fragment.xml +++ b/nim_uikit/res/layout/nim_message_fragment.xml @@ -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"> - - - - - - - - - - - - - - - - - - diff --git a/nim_uikit/res/layout/nim_message_item.xml b/nim_uikit/res/layout/nim_message_item.xml index f4b9994a8..238daa1d1 100644 --- a/nim_uikit/res/layout/nim_message_item.xml +++ b/nim_uikit/res/layout/nim_message_item.xml @@ -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" /> + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_gravity="center_vertical"> + + android:textColor="@color/white" + android:textSize="13sp" /> \ No newline at end of file diff --git a/nim_uikit/res/values/colors-ptr.xml b/nim_uikit/res/values/colors-ptr.xml index fcd16ad5a..7a1e5529d 100644 --- a/nim_uikit/res/values/colors-ptr.xml +++ b/nim_uikit/res/values/colors-ptr.xml @@ -2,5 +2,6 @@ #7f01020a #7f01020b - #2A2A39 + #dbdbdb + #2A2A39 \ No newline at end of file diff --git a/nim_uikit/src/com/netease/nim/uikit/api/wrapper/NimToolBarOptions.java b/nim_uikit/src/com/netease/nim/uikit/api/wrapper/NimToolBarOptions.java index 86e949ed4..b81c92f4a 100644 --- a/nim_uikit/src/com/netease/nim/uikit/api/wrapper/NimToolBarOptions.java +++ b/nim_uikit/src/com/netease/nim/uikit/api/wrapper/NimToolBarOptions.java @@ -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; } diff --git a/nim_uikit/src/com/netease/nim/uikit/business/session/viewholder/MsgViewHolderText.java b/nim_uikit/src/com/netease/nim/uikit/business/session/viewholder/MsgViewHolderText.java index e0f112fcf..faee7426d 100644 --- a/nim_uikit/src/com/netease/nim/uikit/business/session/viewholder/MsgViewHolderText.java +++ b/nim_uikit/src/com/netease/nim/uikit/business/session/viewholder/MsgViewHolderText.java @@ -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(); }