自动打招呼:UI细节完善
This commit is contained in:
@@ -6,6 +6,7 @@ import com.mango.core.im.custom.bean.UserCardAttachment;
|
||||
import com.mango.moshen.ui.im.chat.MsgViewHolderUserCard;
|
||||
import com.netease.nim.uikit.api.NimUIKit;
|
||||
import com.netease.nim.uikit.api.model.contact.ContactEventListener;
|
||||
import com.netease.nim.uikit.api.model.main.OnlineStateContentProvider;
|
||||
import com.netease.nim.uikit.api.model.session.SessionCustomization;
|
||||
import com.netease.nim.uikit.api.model.session.SessionEventListener;
|
||||
import com.netease.nim.uikit.api.wrapper.NimMessageRevokeObserver;
|
||||
|
@@ -24,7 +24,7 @@ class SayHelloListAdapter :
|
||||
helper.setText(R.id.tv_nickname, item.name)
|
||||
helper.setText(R.id.tv_send_text,item.content)
|
||||
helper.setText(R.id.tv_online_desc,item.onlineDesc)
|
||||
|
||||
helper.setVisible(R.id.view_online,item.online)
|
||||
val ivUserCharm = helper.getView<ImageView>(R.id.iv_user_charm)
|
||||
val ivUserLevel = helper.getView<ImageView>(R.id.iv_user_level)
|
||||
ivUserCharm.visibility = View.GONE
|
||||
|
@@ -7,6 +7,7 @@ import androidx.core.view.isVisible
|
||||
import androidx.recyclerview.widget.LinearLayoutManager
|
||||
import com.mango.core.user.UserModel
|
||||
import com.mango.core.user.bean.HelloUserInfo
|
||||
import com.mango.core.user.event.ClickSayHelloEvent
|
||||
import com.mango.core.utils.toast
|
||||
import com.mango.moshen.R
|
||||
import com.mango.moshen.base.BaseViewBindingActivity
|
||||
@@ -20,6 +21,7 @@ import com.mango.moshen.ui.utils.RVDelegate
|
||||
import com.mango.xchat_android_library.annatation.ActLayoutRes
|
||||
import com.mango.xchat_android_library.widget.IOSSwitchView.OnSwitchStateChangeListener
|
||||
import com.netease.nim.uikit.StatusBarUtil
|
||||
import org.greenrobot.eventbus.EventBus
|
||||
import java.util.*
|
||||
|
||||
@ActLayoutRes(R.layout.activity_say_hello_list)
|
||||
@@ -57,7 +59,12 @@ class SayHelloListActivity : BaseViewBindingActivity<ActivitySayHelloListBinding
|
||||
} else if (view.id == R.id.tv_chat) {
|
||||
SendMessageHelper.sendP2PMessage(it.uid.toString(), it.content)
|
||||
NimP2PMessageActivity.start(this, it.uid.toString())
|
||||
UserModel.get().clickSayHelloChat(it.uid).subscribe()
|
||||
UserModel.get().clickSayHelloChat(it.uid)
|
||||
.doOnSuccess {
|
||||
EventBus.getDefault().post(ClickSayHelloEvent())
|
||||
}
|
||||
.subscribe()
|
||||
rvDelegate.adapter.remove(position)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -1,7 +1,9 @@
|
||||
package com.mango.moshen.ui.im.recent
|
||||
|
||||
import android.annotation.SuppressLint
|
||||
import android.text.style.ForegroundColorSpan
|
||||
import android.view.View
|
||||
import androidx.core.graphics.toColorInt
|
||||
import androidx.core.view.isInvisible
|
||||
import androidx.core.view.isVisible
|
||||
import androidx.recyclerview.widget.LinearLayoutManager
|
||||
@@ -14,6 +16,7 @@ import com.mango.core.user.AttentionModel
|
||||
import com.mango.core.user.UserModel
|
||||
import com.mango.core.user.bean.AttentionInfo
|
||||
import com.mango.core.user.bean.UserInfo
|
||||
import com.mango.core.user.event.ClickSayHelloEvent
|
||||
import com.mango.core.user.event.LoadLoginUserInfoEvent
|
||||
import com.mango.core.utils.SharedPreferenceUtils
|
||||
import com.mango.core.utils.net.io2main
|
||||
@@ -27,9 +30,11 @@ import com.mango.moshen.home.activity.RelationListActivity
|
||||
import com.mango.moshen.home.event.ContactTrashEvent
|
||||
import com.mango.moshen.module_hall.HallDataManager
|
||||
import com.mango.moshen.room_chat.activity.RoomNewbieActivity
|
||||
import com.mango.moshen.room_chat.event.SendHelloEvent
|
||||
import com.mango.moshen.ui.im.avtivity.NimP2PMessageActivity
|
||||
import com.mango.moshen.ui.im.avtivity.SayHelloListActivity
|
||||
import com.mango.moshen.ui.im.recent.adapter.AttentionInRoomAdapter
|
||||
import com.mango.moshen.utils.SpannableBuilder
|
||||
import com.mango.xchat_android_library.utils.CommonUtils
|
||||
import com.netease.nim.uikit.business.recent.RecentContactsCallback
|
||||
import com.netease.nimlib.sdk.NIMClient
|
||||
@@ -100,30 +105,45 @@ class RecentListFragment : BaseViewBindingFragment<FragmentRecentListBinding>()
|
||||
)
|
||||
}
|
||||
}
|
||||
val isClicked = SharedPreferenceUtils.get(share_pref_is_newbie_clicked, false) as Boolean
|
||||
binding.tvRedPointFindNew.visibility = if (isClicked) View.GONE else View.VISIBLE
|
||||
// 等级限制
|
||||
setFindNewbieView()
|
||||
|
||||
HallDataManager.get().registerHallExist(this) {
|
||||
if (it == true && HallDataManager.get().roleType != RoleType.OWNER) {
|
||||
binding.llSayHello.isVisible = true
|
||||
UserModel.get().sayHelloInfo
|
||||
.compose(bindToLifecycle())
|
||||
.subscribe({ helloInfo ->
|
||||
binding.tvSayHelloNum.text = "有${helloInfo.helloCount}人想和你认识"
|
||||
}, { throwable ->
|
||||
throwable.printStackTrace()
|
||||
})
|
||||
} else {
|
||||
binding.llSayHello.isVisible = false
|
||||
}
|
||||
}
|
||||
|
||||
binding.llSayHello.setOnClickListener {
|
||||
SayHelloListActivity.start(mContext)
|
||||
}
|
||||
val isClicked = SharedPreferenceUtils.get(share_pref_is_newbie_clicked, false) as Boolean
|
||||
binding.tvRedPointFindNew.visibility = if (isClicked) View.GONE else View.VISIBLE
|
||||
// 等级限制
|
||||
setFindNewbieView()
|
||||
loadSayHello()
|
||||
}
|
||||
|
||||
@SuppressLint("CheckResult")
|
||||
private fun loadSayHello() {
|
||||
UserModel.get().sayHelloCount
|
||||
.compose(bindToLifecycle())
|
||||
.subscribe({
|
||||
binding.llSayHello.isVisible = it.visible
|
||||
binding.viewHelloLine.isVisible = it.visible
|
||||
binding.tvSayHelloNum.isVisible = it.helloCount != 0
|
||||
binding.tvSayHelloNum.text =
|
||||
SpannableBuilder()
|
||||
.append(
|
||||
"有",
|
||||
ForegroundColorSpan("#8A8CAB".toColorInt())
|
||||
)
|
||||
.append(
|
||||
"${it.helloCount}",
|
||||
ForegroundColorSpan("#FFA027".toColorInt())
|
||||
)
|
||||
.append(
|
||||
"人想和你认识",
|
||||
ForegroundColorSpan("#8A8CAB".toColorInt())
|
||||
)
|
||||
.build()
|
||||
}, {
|
||||
binding.llSayHello.isVisible = false
|
||||
binding.viewHelloLine.isVisible = false
|
||||
it.printStackTrace()
|
||||
})
|
||||
}
|
||||
|
||||
@SuppressLint("CheckResult")
|
||||
@@ -241,6 +261,12 @@ class RecentListFragment : BaseViewBindingFragment<FragmentRecentListBinding>()
|
||||
//登录成功刷新消息页萌新
|
||||
setFindNewbieView()
|
||||
loadAttentionList()
|
||||
loadSayHello()
|
||||
}
|
||||
|
||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||
fun onClickSayHelloEvent(event: ClickSayHelloEvent?) {
|
||||
loadSayHello()
|
||||
}
|
||||
|
||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||
|
@@ -114,22 +114,15 @@ public class CommonRecentViewHolder extends RecentViewHolder {
|
||||
if (o instanceof String && o.equals("0")) {
|
||||
imgUnreadExplosion.setImageResource(R.drawable.explosion);
|
||||
imgUnreadExplosion.setVisibility(VISIBLE);
|
||||
new Handler().post(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
((AnimationDrawable) imgUnreadExplosion.getDrawable()).start();
|
||||
// 解决部分手机动画无法播放的问题(例如华为荣耀)
|
||||
getAdapter().notifyItemChanged(getAdapter().getViewHolderPosition(position));
|
||||
}
|
||||
new Handler().post(() -> {
|
||||
((AnimationDrawable) imgUnreadExplosion.getDrawable()).start();
|
||||
// 解决部分手机动画无法播放的问题(例如华为荣耀)
|
||||
getAdapter().notifyItemChanged(getAdapter().getViewHolderPosition(position));
|
||||
});
|
||||
}
|
||||
} else {
|
||||
imgUnreadExplosion.setVisibility(GONE);
|
||||
}
|
||||
|
||||
// if (getAdapter().isLastDataItem(position)) {
|
||||
// topLine.setVisibility(GONE);
|
||||
// }
|
||||
}
|
||||
|
||||
@SuppressLint("CheckResult")
|
||||
@@ -137,16 +130,19 @@ public class CommonRecentViewHolder extends RecentViewHolder {
|
||||
mIvNobleHeadWear.setVisibility(INVISIBLE);
|
||||
mIvNobleLevel.setVisibility(GONE);
|
||||
mIvNobleBadge.setVisibility(GONE);
|
||||
ivUserGender.setVisibility(GONE);
|
||||
ivVipIcon.setVisibility(GONE);
|
||||
if (recent == null) return;
|
||||
String contactId = recent.getContactId();
|
||||
//去除小秘书,系统消息
|
||||
if (SystemUidUtil.isSystemUid(contactId) ) {
|
||||
if (SystemUidUtil.isSystemUid(contactId)) {
|
||||
return;
|
||||
}
|
||||
|
||||
UserModel.get()
|
||||
.getUserInfo(Long.valueOf(contactId))
|
||||
.getUserInfo(Long.parseLong(contactId))
|
||||
.subscribe(userInfo -> {
|
||||
if (userInfo.getUid() != Long.parseLong(contactId)) return;
|
||||
UserLevelVo userLevelVo = userInfo.getUserLevelVo();
|
||||
if (userLevelVo != null && !TextUtils.isEmpty(userLevelVo.getExperUrl())) {
|
||||
mIvNobleLevel.setVisibility(VISIBLE);
|
||||
@@ -156,14 +152,15 @@ public class CommonRecentViewHolder extends RecentViewHolder {
|
||||
ivCharmLevel.setVisibility(VISIBLE);
|
||||
ImageLoadUtils.loadImage(ivCharmLevel.getContext(), userLevelVo.getCharmUrl(), ivCharmLevel);
|
||||
}
|
||||
ivUserGender.setVisibility(VISIBLE);
|
||||
ivVipIcon.setVisibility(VISIBLE);
|
||||
if (userInfo.getGender() == 1) {
|
||||
ivUserGender.setImageResource(R.drawable.ic_gender_male);
|
||||
} else {
|
||||
ivUserGender.setImageResource(R.drawable.ic_gender_female);
|
||||
}
|
||||
|
||||
VipHelper.loadVipIcon(ivVipIcon,userInfo.getUserVipInfoVO());
|
||||
VipHelper.loadVipNickColor(tvNickname, userInfo.getUserVipInfoVO(),"#FF333333");
|
||||
VipHelper.loadVipIcon(ivVipIcon, userInfo.getUserVipInfoVO());
|
||||
VipHelper.loadVipNickColor(tvNickname, userInfo.getUserVipInfoVO(), "#FF333333");
|
||||
});
|
||||
}
|
||||
|
||||
|
8
app/src/main/res/drawable/shape_97ef30_8dp_round.xml
Normal file
8
app/src/main/res/drawable/shape_97ef30_8dp_round.xml
Normal file
@@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="rectangle">
|
||||
|
||||
<solid android:color="#97EF30" />
|
||||
|
||||
<corners android:radius="8dp" />
|
||||
</shape>
|
@@ -214,7 +214,9 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="15dp"
|
||||
android:gravity="center"
|
||||
android:orientation="vertical">
|
||||
android:orientation="vertical"
|
||||
android:visibility="gone"
|
||||
tools:visibility="visible">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
@@ -234,6 +236,15 @@
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<View
|
||||
android:id="@+id/view_hello_line"
|
||||
android:layout_width="1px"
|
||||
android:layout_height="28dp"
|
||||
android:layout_marginStart="12dp"
|
||||
android:layout_marginEnd="5dp"
|
||||
android:background="#D8D8D8"
|
||||
android:visibility="gone" />
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/fl_attention_online"
|
||||
android:layout_width="match_parent"
|
||||
@@ -249,11 +260,6 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingBottom="12dp" />
|
||||
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1px"
|
||||
android:background="#4dd8d8d8" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
@@ -81,6 +81,17 @@
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="@id/iv_avatar" />
|
||||
|
||||
<View
|
||||
android:id="@+id/view_online"
|
||||
android:layout_width="6dp"
|
||||
android:layout_height="6dp"
|
||||
android:layout_marginEnd="4dp"
|
||||
android:background="@drawable/shape_97ef30_8dp_round"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintBottom_toBottomOf="@id/tv_online_desc"
|
||||
app:layout_constraintEnd_toStartOf="@id/tv_online_desc"
|
||||
app:layout_constraintTop_toTopOf="@id/tv_online_desc" />
|
||||
|
||||
<View
|
||||
android:id="@+id/view_text"
|
||||
android:layout_width="0dp"
|
||||
|
@@ -11,6 +11,7 @@ import com.mango.core.user.bean.GiftWallInfo;
|
||||
import com.mango.core.user.bean.HelloUserInfo;
|
||||
import com.mango.core.user.bean.NewUserInfo;
|
||||
import com.mango.core.user.bean.ProtocolInfo;
|
||||
import com.mango.core.user.bean.SayHelloCount;
|
||||
import com.mango.core.user.bean.SayHelloInfo;
|
||||
import com.mango.core.user.bean.UserDetailInfo;
|
||||
import com.mango.core.user.bean.UserGameInfo;
|
||||
@@ -264,4 +265,5 @@ public interface IUserModel extends IModel {
|
||||
*/
|
||||
Single<String> clickSayHelloChat(long toUserUid);
|
||||
|
||||
Single<SayHelloCount> getSayHelloCount();
|
||||
}
|
||||
|
@@ -25,6 +25,7 @@ import com.mango.core.user.bean.GiftWallInfo;
|
||||
import com.mango.core.user.bean.HelloUserInfo;
|
||||
import com.mango.core.user.bean.NewUserInfo;
|
||||
import com.mango.core.user.bean.ProtocolInfo;
|
||||
import com.mango.core.user.bean.SayHelloCount;
|
||||
import com.mango.core.user.bean.SayHelloInfo;
|
||||
import com.mango.core.user.bean.UserDetailInfo;
|
||||
import com.mango.core.user.bean.UserGameInfo;
|
||||
@@ -838,6 +839,14 @@ public final class UserModel extends BaseModel implements IUserModel {
|
||||
.compose(RxHelper.handleSchedulers());
|
||||
}
|
||||
|
||||
@Override
|
||||
public Single<SayHelloCount> getSayHelloCount() {
|
||||
return api.getSayHelloCount()
|
||||
.compose(RxHelper.handleBeanData())
|
||||
.compose(RxHelper.handleSchedulers());
|
||||
}
|
||||
|
||||
|
||||
private interface Api {
|
||||
/**
|
||||
* 获取某个用户的用户信息
|
||||
@@ -1098,6 +1107,14 @@ public final class UserModel extends BaseModel implements IUserModel {
|
||||
@POST("shunt/click_chat")
|
||||
Single<ServiceResult<String>> clickSayHelloChat(@Field("toUserId") long toUserUid);
|
||||
|
||||
/**
|
||||
* 打招呼人数
|
||||
*
|
||||
* @return -
|
||||
*/
|
||||
@POST("shunt/hello_count")
|
||||
Single<ServiceResult<SayHelloCount>> getSayHelloCount();
|
||||
|
||||
}
|
||||
|
||||
private static final class Helper {
|
||||
|
@@ -8,6 +8,7 @@ data class HelloUserInfo(
|
||||
val gender: Int = 0,
|
||||
val name: String = "",
|
||||
val onlineDesc: String = "",
|
||||
val online: Boolean = false,
|
||||
val uid: Long = 0,
|
||||
val userLevelVo: UserLevelVo? = null
|
||||
)
|
@@ -0,0 +1,6 @@
|
||||
package com.mango.core.user.bean
|
||||
|
||||
data class SayHelloCount(
|
||||
val helloCount: Int = 0,
|
||||
val visible: Boolean = false
|
||||
)
|
@@ -1,3 +1,3 @@
|
||||
package com.mango.core.user.event
|
||||
|
||||
class ShowMeEvent
|
||||
class ClickSayHelloEvent
|
@@ -2,7 +2,7 @@
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<item android:drawable="@color/color_f4f4fa" android:state_pressed="true" />
|
||||
<item android:drawable="@color/white" android:state_pressed="false" />
|
||||
<item android:drawable="@color/white" />
|
||||
<item android:drawable="@color/color_E5EFFC" android:state_pressed="false" />
|
||||
<item android:drawable="@color/color_E5EFFC" />
|
||||
|
||||
</selector>
|
@@ -77,5 +77,6 @@
|
||||
<color name="color_C6C6E9">#ff333333</color>
|
||||
<color name="text_hint_555574">#B3333333</color>
|
||||
<color name="color_f4f4fa">#FFF3F5FA</color>
|
||||
<color name="color_E5EFFC">#E5EFFC</color>
|
||||
|
||||
</resources>
|
Reference in New Issue
Block a user