add 分享

add 推送(搜索还没做、卡片还没做)
add 打招呼
This commit is contained in:
zlzw 2024-03-15 16:06:18 +08:00
parent 828c5bd53e
commit 687d6e9bc0
66 changed files with 2225 additions and 31 deletions

View File

@ -0,0 +1,84 @@
package com.yunbao.share.adapters;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.RadioButton;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;
import com.pdlive.shayu.R;
import com.yunbao.common.glide.ImgLoader;
import com.yunbao.common.views.weight.ClipPathCircleImage;
import java.util.ArrayList;
import java.util.List;
import io.rong.imkit.conversationlist.model.SingleConversation;
import io.rong.imlib.model.Conversation;
public class InternalShareAdapter extends RecyclerView.Adapter<InternalShareAdapter.ViewHolder> {
List<SingleConversation> listData = new ArrayList<>();
int selectPosition = -1;
@NonNull
@Override
public ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
return new ViewHolder(LayoutInflater.from(parent.getContext()).inflate(R.layout.item_internal_user, parent, false));
}
@Override
public void onBindViewHolder(@NonNull ViewHolder holder, int position) {
holder.bind(listData.get(position), position);
}
@Override
public int getItemCount() {
return listData.size();
}
public void setList(List<SingleConversation> listData) {
if (listData == null) {
listData = new ArrayList<>();
}
this.listData = listData;
notifyDataSetChanged();
}
public int getSelectPosition() {
return selectPosition;
}
public class ViewHolder extends RecyclerView.ViewHolder {
ClipPathCircleImage mAvatar;
TextView userName;
TextView content;
RadioButton radioButton;
public ViewHolder(@NonNull View itemView) {
super(itemView);
mAvatar = itemView.findViewById(R.id.rc_conversation_portrait);
userName = itemView.findViewById(R.id.rc_conversation_title);
content = itemView.findViewById(R.id.rc_conversation_content);
radioButton = itemView.findViewById(R.id.btn);
}
public void bind(SingleConversation item, int position) {
ImgLoader.display(itemView.getContext(), item.mCore.getPortraitUrl(), mAvatar);
userName.setText(item.mCore.getConversationTitle());
content.setText("");
if (selectPosition == position) {
radioButton.setChecked(true);
} else {
radioButton.setChecked(false);
}
itemView.setOnClickListener(view -> {
selectPosition = position;
notifyDataSetChanged();
});
}
}
}

View File

@ -18,6 +18,7 @@ import com.yunbao.share.ICallback;
import com.yunbao.share.bean.ShareBuilder; import com.yunbao.share.bean.ShareBuilder;
import com.yunbao.share.platform.FacebookShare; import com.yunbao.share.platform.FacebookShare;
import com.yunbao.share.platform.Instagram; import com.yunbao.share.platform.Instagram;
import com.yunbao.share.platform.Internal;
import com.yunbao.share.platform.Line; import com.yunbao.share.platform.Line;
import com.yunbao.share.platform.MessengerShare; import com.yunbao.share.platform.MessengerShare;
import com.yunbao.share.platform.TwitterShare; import com.yunbao.share.platform.TwitterShare;
@ -30,6 +31,7 @@ import java.util.List;
public class ShareAppAdapter extends RecyclerView.Adapter<ShareAppAdapter.AppViewHolder> { public class ShareAppAdapter extends RecyclerView.Adapter<ShareAppAdapter.AppViewHolder> {
private Context mContext; private Context mContext;
private List<ShareBuilder> list; private List<ShareBuilder> list;
ShareCallback shareCallback;
public ShareAppAdapter(Context mContext) { public ShareAppAdapter(Context mContext) {
list = new ArrayList<>(); list = new ArrayList<>();
@ -69,6 +71,9 @@ public class ShareAppAdapter extends RecyclerView.Adapter<ShareAppAdapter.AppVie
case ShareBuilder.APP_INSTAGRAM: case ShareBuilder.APP_INSTAGRAM:
holder.setData(builder, R.mipmap.icon_share_instagram, R.string.dialog_share_app_instagram); holder.setData(builder, R.mipmap.icon_share_instagram, R.string.dialog_share_app_instagram);
break; break;
case ShareBuilder.APP_INTERNAL:
holder.setData(builder, R.mipmap.ic_share_friend, R.string.dialog_share_app_internal);
break;
} }
} }
@ -77,7 +82,14 @@ public class ShareAppAdapter extends RecyclerView.Adapter<ShareAppAdapter.AppVie
return list.size(); return list.size();
} }
public static class AppViewHolder extends RecyclerView.ViewHolder { public void setOnShareStatusListener(ShareCallback shareCallback) {
this.shareCallback = shareCallback;
if (this.shareCallback == null) {
this.shareCallback = new ShareCallback();
}
}
public class AppViewHolder extends RecyclerView.ViewHolder {
ImageView icon; ImageView icon;
TextView title; TextView title;
@ -110,11 +122,16 @@ public class ShareAppAdapter extends RecyclerView.Adapter<ShareAppAdapter.AppVie
case ShareBuilder.APP_INSTAGRAM: case ShareBuilder.APP_INSTAGRAM:
new Instagram(itemView.getContext()).share(bean, new ShareCallback()); new Instagram(itemView.getContext()).share(bean, new ShareCallback());
break; break;
case ShareBuilder.APP_INTERNAL:
new Internal(itemView.getContext()).share(bean, shareCallback);
break;
} }
}); });
} }
private static class ShareCallback implements ICallback {
}
public static class ShareCallback implements ICallback {
@Override @Override
public void onSuccess() { public void onSuccess() {
@ -126,5 +143,4 @@ public class ShareAppAdapter extends RecyclerView.Adapter<ShareAppAdapter.AppVie
} }
} }
}
} }

View File

@ -19,6 +19,7 @@ public class ShareBuilder {
public static final int APP_WHATSAPP = 3; public static final int APP_WHATSAPP = 3;
public static final int APP_MESSENGER = 4; public static final int APP_MESSENGER = 4;
public static final int APP_INSTAGRAM = 5; public static final int APP_INSTAGRAM = 5;
public static final int APP_INTERNAL = 6;
private String text; private String text;
private String link; private String link;

View File

@ -0,0 +1,35 @@
package com.yunbao.share.platform;
import android.content.Context;
import com.yunbao.common.interfaces.OnItemClickListener;
import com.yunbao.common.utils.ToastUtil;
import com.yunbao.share.AbsShareInterface;
import com.yunbao.share.ICallback;
import com.yunbao.share.bean.ShareBuilder;
import com.yunbao.share.ui.AppInternalShareDialog;
import com.yunbao.share.ui.ShareSuccessNotifyDialog;
public class Internal extends AbsShareInterface {
public Internal(Context context) {
super(context);
}
@Override
public void share(ShareBuilder builder, ICallback callback) {
new AppInternalShareDialog(mContext)
.setOnItemClickListener(new OnItemClickListener<String>() {
@Override
public void onItemClick(String toUid, int position) {
if (position == -1) {
callback.onFailure();
return;
}
builder.setUid(toUid);
new ShareSuccessNotifyDialog(mContext, builder)
.showDialog();
callback.onSuccess();
}
}).showDialog();
}
}

View File

@ -0,0 +1,141 @@
package com.yunbao.share.ui;
import android.content.Context;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;
import com.lxj.xpopup.XPopup;
import com.pdlive.shayu.R;
import com.yunbao.common.bean.MessageChatUserBean;
import com.yunbao.common.dialog.AbsDialogFullScreenPopupWindow;
import com.yunbao.common.interfaces.OnItemClickListener;
import com.yunbao.common.utils.ToastUtil;
import com.yunbao.common.utils.ViewUtils;
import com.yunbao.share.adapters.InternalShareAdapter;
import com.yunbao.share.bean.ShareBuilder;
import java.util.ArrayList;
import java.util.List;
import io.rong.imkit.conversationlist.model.SingleConversation;
import io.rong.imkit.userinfo.RongUserInfoManager;
import io.rong.imkit.widget.refresh.SmartRefreshLayout;
import io.rong.imkit.widget.refresh.api.RefreshLayout;
import io.rong.imkit.widget.refresh.listener.OnLoadMoreListener;
import io.rong.imkit.widget.refresh.listener.OnRefreshListener;
import io.rong.imkit.widget.refresh.wrapper.RongRefreshHeader;
import io.rong.imlib.IRongCoreCallback;
import io.rong.imlib.IRongCoreEnum;
import io.rong.imlib.RongCoreClient;
import io.rong.imlib.RongIMClient;
import io.rong.imlib.model.Conversation;
public class AppInternalShareDialog extends AbsDialogFullScreenPopupWindow {
EditText search;
OnItemClickListener<String> onItemClickListener;
InternalShareAdapter adapter;
protected SmartRefreshLayout mRefreshLayout;
protected RecyclerView mList;
long startTime = 0;
List<SingleConversation> listData = new ArrayList<>();
public AppInternalShareDialog(@NonNull Context context) {
super(context);
}
@Override
public void buildDialog(XPopup.Builder builder) {
}
public AppInternalShareDialog setOnItemClickListener(OnItemClickListener<String> onItemClickListener) {
this.onItemClickListener = onItemClickListener;
return this;
}
@Override
public int bindLayoutId() {
return R.layout.dialog_shrea_internal;
}
@Override
protected void onCreate() {
super.onCreate();
findViewById(R.id.btn_back).setOnClickListener(view -> {
if (onItemClickListener != null) {
onItemClickListener.onItemClick(null, -1);
}
dismiss();
});
findViewById(R.id.btn_share).setOnClickListener(view -> {
if (onItemClickListener != null) {
onItemClickListener.onItemClick(listData.get(adapter.getSelectPosition()).mCore.getTargetId(), adapter.getSelectPosition());
}
dismiss();
});
search = findViewById(R.id.search);
mList = findViewById(R.id.recyclerView);
mRefreshLayout = findViewById(R.id.rc_refresh);
adapter = new InternalShareAdapter();
mList.setAdapter(adapter);
initRefreshView();
refreshData();
}
protected void initRefreshView() {
this.mRefreshLayout.setNestedScrollingEnabled(false);
this.mRefreshLayout.setRefreshHeader(new RongRefreshHeader(this.getContext()));
this.mRefreshLayout.setRefreshFooter(new RongRefreshHeader(this.getContext()));
this.mRefreshLayout.setOnRefreshListener(new OnRefreshListener() {
public void onRefresh(@NonNull RefreshLayout refreshLayout) {
onConversationListRefresh(refreshLayout);
}
});
this.mRefreshLayout.setOnLoadMoreListener(new OnLoadMoreListener() {
public void onLoadMore(@NonNull RefreshLayout refreshLayout) {
onConversationListLoadMore();
}
});
}
private void onConversationListLoadMore() {
refreshData();
}
private void onConversationListRefresh(RefreshLayout refreshLayout) {
listData.clear();
startTime = 0;
refreshData();
}
private void refreshData() {
RongCoreClient.getInstance().getConversationListByPage(new IRongCoreCallback.ResultCallback<List<Conversation>>() {
@Override
public void onSuccess(List<Conversation> conversations) {
if (conversations.isEmpty()) {
mRefreshLayout.finishLoadMoreWithNoMoreData();
return;
}
List<SingleConversation> tmp = new ArrayList<>();
for (Conversation conversation : conversations) {
tmp.add(new SingleConversation(getContext(), conversation));
}
startTime = conversations.get(conversations.size() - 1).getSentTime();
listData.addAll(tmp);
adapter.setList(listData);
mRefreshLayout.finishRefresh(true);
}
@Override
public void onError(IRongCoreEnum.CoreErrorCode e) {
ToastUtil.show("出错了:" + e.getMessage());
}
}, startTime, 10, Conversation.ConversationType.PRIVATE);
}
}

View File

@ -12,6 +12,7 @@ import androidx.recyclerview.widget.GridLayoutManager;
import androidx.recyclerview.widget.RecyclerView; import androidx.recyclerview.widget.RecyclerView;
import com.lxj.xpopup.XPopup; import com.lxj.xpopup.XPopup;
import com.lxj.xpopup.util.XPopupUtils;
import com.makeramen.roundedimageview.RoundedImageView; import com.makeramen.roundedimageview.RoundedImageView;
import com.pdlive.shayu.R; import com.pdlive.shayu.R;
import com.yunbao.common.dialog.AbsDialogPopupWindow; import com.yunbao.common.dialog.AbsDialogPopupWindow;
@ -70,7 +71,6 @@ public class SharePopDialog extends AbsDialogPopupWindow {
@Override @Override
public void buildDialog(XPopup.Builder builder) { public void buildDialog(XPopup.Builder builder) {
} }
@Override @Override
@ -89,6 +89,13 @@ public class SharePopDialog extends AbsDialogPopupWindow {
info = findViewById(R.id.share_info); info = findViewById(R.id.share_info);
link = findViewById(R.id.share_link); link = findViewById(R.id.share_link);
adapter = new ShareAppAdapter(getContext()); adapter = new ShareAppAdapter(getContext());
adapter.setOnShareStatusListener(new ShareAppAdapter.ShareCallback(){
@Override
public void onSuccess() {
super.onSuccess();
dismiss();
}
});
list.setLayoutManager(new GridLayoutManager(getContext(), 3)); list.setLayoutManager(new GridLayoutManager(getContext(), 3));
list.setAdapter(adapter); list.setAdapter(adapter);
initData(); initData();
@ -101,7 +108,7 @@ public class SharePopDialog extends AbsDialogPopupWindow {
data.add(builder(ShareBuilder.APP_TWITTER)); data.add(builder(ShareBuilder.APP_TWITTER));
data.add(builder(ShareBuilder.APP_WHATSAPP)); data.add(builder(ShareBuilder.APP_WHATSAPP));
data.add(builder(ShareBuilder.APP_MESSENGER)); data.add(builder(ShareBuilder.APP_MESSENGER));
//data.add(builder(ShareBuilder.APP_INSTAGRAM)); data.add(builder(ShareBuilder.APP_INTERNAL));
adapter.setList(data); adapter.setList(data);
String url; String url;
if (shareLink == null) { if (shareLink == null) {

View File

@ -0,0 +1,87 @@
package com.yunbao.share.ui;
import android.content.Context;
import android.content.DialogInterface;
import android.os.Handler;
import android.os.Looper;
import android.widget.TextView;
import androidx.annotation.NonNull;
import com.lxj.xpopup.XPopup;
import com.lxj.xpopup.enums.PopupAnimation;
import com.pdlive.shayu.R;
import com.yunbao.common.bean.MessageUserInfoBean;
import com.yunbao.common.custom.RatioRoundImageView;
import com.yunbao.common.dialog.AbsDialogPositionPopupWindow;
import com.yunbao.common.glide.ImgLoader;
import com.yunbao.common.utils.DpUtil;
import com.yunbao.common.utils.StringUtil;
import com.yunbao.share.bean.ShareBuilder;
import io.rong.imkit.utils.RouteUtils;
import io.rong.imlib.model.Conversation;
public class ShareSuccessNotifyDialog extends AbsDialogPositionPopupWindow {
private ShareBuilder bean;
private DialogInterface.OnDismissListener onDismissListener;
private TextView anchorName;
private RatioRoundImageView avatar;
public ShareSuccessNotifyDialog(@NonNull Context context) {
super(context);
}
public ShareSuccessNotifyDialog(@NonNull Context context, ShareBuilder bean) {
super(context);
this.bean = bean;
}
public ShareSuccessNotifyDialog setOnDismissListener(DialogInterface.OnDismissListener onDismissListener) {
this.onDismissListener = onDismissListener;
return this;
}
@Override
public void buildDialog(XPopup.Builder builder) {
builder.positionByWindowCenter(true);
builder.moveUpToKeyboard(false);
builder.dismissOnTouchOutside(false);
builder.dismissOnBackPressed(false);
builder.isTouchThrough(true);
builder.isClickThrough(true);
builder.isCenterHorizontal(true);
builder.hasShadowBg(false);
builder.animationDuration(500);
builder.popupAnimation(PopupAnimation.ScaleAlphaFromCenter);
builder.offsetY(DpUtil.dp2px(60));
}
@Override
public int bindLayoutId() {
return R.layout.view_share_success_notify;
}
@Override
protected void onShow() {
super.onShow();
}
@Override
protected void onCreate() {
super.onCreate();
findViewById(R.id.liveGo).setOnClickListener(v -> {
Conversation.ConversationType type = Conversation.ConversationType.PRIVATE;
RouteUtils.routeToConversationActivity(mContext, type, bean.getUid(), null);
});
new Handler(Looper.getMainLooper()).postDelayed(() -> {
dismiss();
if (onDismissListener != null) {
onDismissListener.onDismiss(null);
}
}, 5000);
}
}

View File

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:color="#EB6FFF" android:state_checked="true"/>
<item android:color="#777777" android:state_checked="false"/>
</selector>

View File

@ -0,0 +1,119 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#F7F7F7">
<FrameLayout
android:id="@+id/top"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingTop="34dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
<ImageView
android:id="@+id/btn_back"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="14dp"
android:layout_marginTop="10dp"
android:layout_marginBottom="10dp"
android:onClick="backClick"
android:padding="2dp"
android:src="@mipmap/icon_sud_history_back" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginTop="11dp"
android:text="@string/dialog_share_internal_title"
android:textColor="#333333"
android:textSize="18sp"
android:textStyle="bold" />
</FrameLayout>
<EditText
android:id="@+id/search"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="15dp"
android:layout_marginTop="20dp"
android:layout_marginEnd="15dp"
android:layout_weight="0.7"
android:background="@drawable/bg_msg_list_search"
android:drawableStart="@mipmap/ic_home_game_search"
android:drawablePadding="8dp"
android:gravity="center_vertical"
android:hint="@string/dialog_share_internal_search"
android:lines="1"
android:padding="10dp"
android:visibility="visible"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/top" />
<net.lucode.hackware.magicindicator.MagicIndicator
android:id="@+id/indicator"
android:layout_width="match_parent"
android:layout_height="37dp"
android:layout_marginTop="20dp"
android:visibility="gone"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/search" />
<io.rong.imkit.widget.refresh.SmartRefreshLayout
android:id="@+id/rc_refresh"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_marginStart="16dp"
android:layout_marginEnd="16dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/indicator">
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recyclerView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:overScrollMode="never"
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
app:layout_behavior="@string/appbar_scrolling_view_behavior"
tools:listitem="@layout/item_internal_user" />
</io.rong.imkit.widget.refresh.SmartRefreshLayout>
<LinearLayout
android:id="@+id/btn_share"
android:layout_width="168dp"
android:layout_height="54dp"
android:layout_marginBottom="20dp"
android:background="@drawable/bg_msg_address_book_user_btn_fan"
android:gravity="center"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent">
<ImageView
android:layout_width="20dp"
android:layout_marginEnd="6dp"
android:src="@mipmap/ic_share_btn"
android:layout_height="20dp"/>
<TextView
android:text="@string/dialog_share_internal_list_btn"
android:textColor="#FFFFFF"
android:layout_marginStart="5dp"
android:textSize="13sp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
</LinearLayout>
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@ -0,0 +1,114 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/rc_conversation_item"
android:layout_width="match_parent"
android:layout_height="@dimen/rc_conversation_item_height">
<View
android:id="@+id/itemDecorationTop"
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="#FFE9F6"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<View
android:id="@+id/itemDecorationBottom"
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="#FFE9F6"
android:visibility="gone"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" />
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/constraintLayout5"
android:layout_width="match_parent"
android:layout_height="match_parent">
<RelativeLayout
android:id="@+id/rc_conversation_portrait_rl"
android:layout_width="48dp"
android:layout_height="48dp"
android:layout_marginStart="@dimen/rc_margin_size_12"
android:layout_marginTop="@dimen/rc_margin_size_12"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
<com.yunbao.common.views.weight.ClipPathCircleImage
android:id="@+id/rc_conversation_portrait"
android:layout_width="54dp"
android:layout_height="54dp"
android:scaleType="centerCrop"
android:src="@mipmap/chat_head_mo" />
<RelativeLayout
android:id="@+id/rc_conversation_unread"
android:visibility="gone"
tools:visibility="visible"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_alignParentEnd="true">
<ImageView
android:id="@+id/rc_conversation_unread_bg"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:src="@drawable/rc_unread_count_bg_normal" />
<TextView
android:id="@+id/rc_conversation_unread_count"
style="@style/TextStyle.Alignment"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:text="15"
android:textColor="@color/rc_white_color"
android:textSize="@dimen/rc_font_auxiliary_size" />
</RelativeLayout>
</RelativeLayout>
<TextView
android:id="@+id/rc_conversation_title"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/rc_margin_size_12"
android:text="张三"
android:textColor="@color/rc_text_main_color"
android:textSize="13sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toEndOf="@+id/rc_conversation_portrait_rl"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/rc_conversation_content"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="13dp"
android:text="你好,朋友!"
android:textColor="#777777"
android:textSize="11sp"
app:layout_constraintBottom_toBottomOf="@+id/rc_conversation_title"
app:layout_constraintStart_toEndOf="@+id/rc_conversation_title"
app:layout_constraintTop_toTopOf="@+id/rc_conversation_title" />
<!-- Drawable to use for multiple choice indicators. -->
<RadioButton
android:id="@+id/btn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="16dp"
android:checked="true"
android:buttonTint="@drawable/btn_internal_radio"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@ -0,0 +1,66 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="329dp"
android:layout_height="wrap_content"
android:minHeight="81dp"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:background="@mipmap/bg_share_success">
<com.yunbao.common.custom.RatioRoundImageView
android:id="@+id/avatar"
android:layout_width="20dp"
android:layout_height="0dp"
android:layout_marginStart="28dp"
android:layout_marginTop="15dp"
android:layout_marginBottom="15dp"
android:src="@mipmap/ic_share_success"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:ri_ratio="0.5"
app:riv_oval="true" />
<TextView
android:id="@+id/anchorName"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="6dp"
android:text="@string/dialog_share_success"
android:textColor="#333333"
android:textSize="15sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toEndOf="@+id/avatar"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/description"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="2dp"
android:layout_marginEnd="8dp"
android:text="@string/main_anchor_live_notify_info"
android:textColor="#CCFFFFFF"
android:textSize="11sp"
android:visibility="gone"
app:layout_constraintEnd_toStartOf="@+id/liveGo"
app:layout_constraintStart_toStartOf="@+id/anchorName"
app:layout_constraintTop_toBottomOf="@+id/anchorName"
tools:text="123" />
<Button
android:id="@+id/liveGo"
android:layout_width="68dp"
android:layout_height="37dp"
android:layout_marginEnd="25dp"
android:background="@drawable/bg_view_msg_chat_notify_btn"
android:gravity="center"
android:text="@string/dialog_share_success_btn"
android:textColor="#333333"
android:textSize="13sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>

Binary file not shown.

After

Width:  |  Height:  |  Size: 183 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 37 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.3 KiB

View File

@ -5,4 +5,11 @@
<string name="dialog_invite_title">Invite Friends</string> <string name="dialog_invite_title">Invite Friends</string>
<string name="dialog_invite_info">Come to PDLIVE to discover more and better live streams.</string> <string name="dialog_invite_info">Come to PDLIVE to discover more and better live streams.</string>
<string name="dialog_share_copy">Copy</string> <string name="dialog_share_copy">Copy</string>
<string name="dialog_share_app_internal">Friend</string>
<string name="dialog_share_internal_title">Share To</string>
<string name="dialog_share_internal_cancel">cancel</string>
<string name="dialog_share_internal_search">Search</string>
<string name="dialog_share_internal_list_btn">Share</string>
<string name="dialog_share_success">Success</string>
<string name="dialog_share_success_btn">Chat</string>
</resources> </resources>

View File

@ -10,8 +10,15 @@
<string name="dialog_share_app_whatsapp" translatable="false">WhatsApp</string> <string name="dialog_share_app_whatsapp" translatable="false">WhatsApp</string>
<string name="dialog_share_app_messenger" translatable="false">Messenger</string> <string name="dialog_share_app_messenger" translatable="false">Messenger</string>
<string name="dialog_share_app_instagram" translatable="false">Instagram</string> <string name="dialog_share_app_instagram" translatable="false">Instagram</string>
<string name="dialog_share_app_internal">站內好友</string>
<string name="dialog_invite_title">邀請好友</string> <string name="dialog_invite_title">邀請好友</string>
<string name="dialog_invite_info">快來 PDLIVE觀看直播認識更多有趣的朋友吧</string> <string name="dialog_invite_info">快來 PDLIVE觀看直播認識更多有趣的朋友吧</string>
<string name="dialog_share_copy">複製</string> <string name="dialog_share_copy">複製</string>
<string name="dialog_share_internal_title">分享至</string>
<string name="dialog_share_internal_cancel">取消</string>
<string name="dialog_share_internal_search">搜索昵稱</string>
<string name="dialog_share_internal_list_btn">發送</string>
<string name="dialog_share_success">分享成功</string>
<string name="dialog_share_success_btn">去聊聊</string>
</resources> </resources>

View File

@ -1,8 +1,6 @@
package com.yunbao.share; package com.yunbao.share;
import org.junit.Test;
import static org.junit.Assert.*;
/** /**
* Example local unit test, which will execute on the development machine (host). * Example local unit test, which will execute on the development machine (host).
@ -10,8 +8,6 @@ import static org.junit.Assert.*;
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a> * @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/ */
public class ExampleUnitTest { public class ExampleUnitTest {
@Test
public void addition_isCorrect() { public void addition_isCorrect() {
assertEquals(4, 2 + 2);
} }
} }

View File

@ -50,13 +50,20 @@ import com.yunbao.common.utils.AppManager;
import com.yunbao.common.utils.Bus; import com.yunbao.common.utils.Bus;
import com.yunbao.common.utils.GoogleUtils; import com.yunbao.common.utils.GoogleUtils;
import com.yunbao.common.utils.L; import com.yunbao.common.utils.L;
import com.yunbao.common.utils.MessageChatNotifyManager;
import com.yunbao.common.utils.MessageSayHiNotifyManager;
import com.yunbao.common.utils.SpUtil; import com.yunbao.common.utils.SpUtil;
import com.yunbao.live.activity.LiveActivity;
import com.yunbao.live.activity.SudGameActivity;
import com.yunbao.live.socket.SocketReceiveBean; import com.yunbao.live.socket.SocketReceiveBean;
import com.yunbao.live.socket.SocketRyClient; import com.yunbao.live.socket.SocketRyClient;
import com.yunbao.live.utils.LiveImDeletUtil; import com.yunbao.live.utils.LiveImDeletUtil;
import com.yunbao.live.views.PortraitLiveManager; import com.yunbao.live.views.PortraitLiveManager;
import com.yunbao.live.views.RecommendLiveRoomProvider; import com.yunbao.live.views.RecommendLiveRoomProvider;
import com.yunbao.main.activity.MainActivity;
import com.yunbao.main.activity.MainHomeCommunityActivity;
import com.yunbao.main.activity.MsgSettActivity; import com.yunbao.main.activity.MsgSettActivity;
import com.yunbao.main.activity.PDLiveConversationActivity;
import org.greenrobot.eventbus.EventBus; import org.greenrobot.eventbus.EventBus;
@ -92,6 +99,27 @@ public class AppContext extends CommonAppContext {
private static final class AdjustLifecycleCallbacks implements ActivityLifecycleCallbacks { private static final class AdjustLifecycleCallbacks implements ActivityLifecycleCallbacks {
@Override @Override
public void onActivityResumed(Activity activity) { public void onActivityResumed(Activity activity) {
Log.e("打招呼定时器", "onActivityResumed: " + activity);
if (activity instanceof LiveActivity) {
MessageSayHiNotifyManager.getInstance().stop();
return;
}
if (activity instanceof PDLiveConversationActivity) {
MessageSayHiNotifyManager.getInstance().stop();
return;
}
if(activity instanceof MainHomeCommunityActivity){
MessageSayHiNotifyManager.getInstance().stop();
return;
}
if(activity instanceof SudGameActivity){
MessageSayHiNotifyManager.getInstance().stop();
return;
}
if (activity instanceof MainActivity && !MessageSayHiNotifyManager.getInstance().isInit()) {
return;
}
MessageSayHiNotifyManager.getInstance().reload();
} }
@Override @Override
@ -232,6 +260,10 @@ public class AppContext extends CommonAppContext {
} else if (message.getConversationType() == Conversation.ConversationType.PRIVATE) {//私聊信息 } else if (message.getConversationType() == Conversation.ConversationType.PRIVATE) {//私聊信息
EventBus.getDefault().post(message); EventBus.getDefault().post(message);
MessageChatNotifyManager.getInstance().push(AppManager.getInstance().getLastActivity()
, message.getTargetId(),
content.getContent()
);
} }
} }
} catch (Exception e) { } catch (Exception e) {

View File

@ -0,0 +1,53 @@
package com.yunbao.common.adapter;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;
import com.yunbao.common.R;
import java.util.ArrayList;
import java.util.List;
public class MessageSayHiDialogTagListAdapter extends RecyclerView.Adapter<MessageSayHiDialogTagListAdapter.ViewHolder> {
List<String> urls = new ArrayList<>();
public void setUrls(List<String> urls) {
this.urls = urls;
notifyDataSetChanged();
}
@NonNull
@Override
public MessageSayHiDialogTagListAdapter.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
return new ViewHolder(LayoutInflater.from(parent.getContext()).inflate(R.layout.view_msg_chat_top_tag, parent, false));
}
@Override
public void onBindViewHolder(@NonNull MessageSayHiDialogTagListAdapter.ViewHolder holder, int position) {
holder.show(urls.get(position));
}
@Override
public int getItemCount() {
return urls.size();
}
public static class ViewHolder extends RecyclerView.ViewHolder {
TextView tagView;
public ViewHolder(@NonNull View itemView) {
super(itemView);
tagView = itemView.findViewById(R.id.tag);
}
public void show(String tag) {
tagView.setText(String.format("%s", tag));
}
}
}

View File

@ -0,0 +1,46 @@
package com.yunbao.common.bean;
import com.google.gson.annotations.SerializedName;
public class MessageSayHiBean extends BaseModel{
@SerializedName("user")
private MessageUserInfoBean user;
@SerializedName("model")
private String model;
@SerializedName("nextTime")
private int nextTime;
@SerializedName("status")
private int status;
public MessageUserInfoBean getUser() {
return user;
}
public void setUser(MessageUserInfoBean user) {
this.user = user;
}
public String getModel() {
return model;
}
public void setModel(String model) {
this.model = model;
}
public int getNextTime() {
return nextTime;
}
public void setNextTime(int nextTime) {
this.nextTime = nextTime;
}
public int getStatus() {
return status;
}
public void setStatus(int status) {
this.status = status;
}
}

View File

@ -0,0 +1,16 @@
package com.yunbao.common.bean;
import com.google.gson.annotations.SerializedName;
public class MessageSayHiStartBean extends BaseModel{
@SerializedName("time")
private int nextTime;
public int getNextTime() {
return nextTime;
}
public void setNextTime(int nextTime) {
this.nextTime = nextTime;
}
}

View File

@ -11,8 +11,27 @@ public class MessageUserInfoBean extends BaseModel{
UserLevel level; UserLevel level;
@SerializedName("gift_num") @SerializedName("gift_num")
int giftNum; int giftNum;
@SerializedName("msg")
String sayHiMsg;
int status; //0 需要跳转到 编辑资料页面 int status; //0 需要跳转到 编辑资料页面
String extras;
public String getExtras() {
return extras;
}
public String getSayHiMsg() {
return sayHiMsg;
}
public void setSayHiMsg(String sayHiMsg) {
this.sayHiMsg = sayHiMsg;
}
public void setExtras(String extras) {
this.extras = extras;
}
public int getStatus() { public int getStatus() {
return status; return status;

View File

@ -0,0 +1,96 @@
package com.yunbao.common.dialog;
import android.content.Context;
import android.content.DialogInterface;
import android.os.Handler;
import android.os.Looper;
import android.widget.TextView;
import androidx.annotation.NonNull;
import com.lxj.xpopup.XPopup;
import com.lxj.xpopup.enums.PopupAnimation;
import com.yunbao.common.R;
import com.yunbao.common.bean.MessageUserInfoBean;
import com.yunbao.common.custom.RatioRoundImageView;
import com.yunbao.common.glide.ImgLoader;
import com.yunbao.common.utils.DpUtil;
import com.yunbao.common.utils.StringUtil;
import com.yunbao.common.utils.ToastUtil;
import com.yunbao.common.utils.ViewUtils;
import io.rong.imkit.utils.RouteUtils;
import io.rong.imlib.model.Conversation;
public class MessageChatNotifyDialog extends AbsDialogPositionPopupWindow {
private MessageUserInfoBean liveBean;
private DialogInterface.OnDismissListener onDismissListener;
private TextView anchorName;
private RatioRoundImageView avatar;
public MessageChatNotifyDialog(@NonNull Context context) {
super(context);
}
public MessageChatNotifyDialog(@NonNull Context context, MessageUserInfoBean bean) {
super(context);
this.liveBean = bean;
}
public MessageChatNotifyDialog setOnDismissListener(DialogInterface.OnDismissListener onDismissListener) {
this.onDismissListener = onDismissListener;
return this;
}
@Override
public void buildDialog(XPopup.Builder builder) {
builder.positionByWindowCenter(true);
builder.moveUpToKeyboard(false);
builder.dismissOnTouchOutside(false);
builder.dismissOnBackPressed(false);
builder.isTouchThrough(true);
builder.isClickThrough(true);
builder.isCenterHorizontal(true);
builder.hasShadowBg(false);
builder.animationDuration(500);
builder.popupAnimation(PopupAnimation.ScaleAlphaFromCenter);
builder.offsetY(DpUtil.dp2px(60));
}
@Override
public int bindLayoutId() {
return R.layout.view_message_chat_new_notify;
}
@Override
protected void onShow() {
super.onShow();
}
@Override
protected void onCreate() {
super.onCreate();
findViewById(R.id.liveGo).setOnClickListener(v -> {
Conversation.ConversationType type = Conversation.ConversationType.PRIVATE;
RouteUtils.routeToConversationActivity(mContext, type, liveBean.getUser().getId() + "", null);
});
avatar = findViewById(R.id.avatar);
anchorName = findViewById(R.id.anchorName);
ImgLoader.display(mContext, liveBean.getUser().getAvatar(), avatar);
anchorName.setText(liveBean.getUser().getUserNicename());
if (StringUtil.isEmpty(liveBean.getExtras())) {
((TextView) findViewById(R.id.description)).setText(liveBean.getUser().getSignature());
} else {
((TextView) findViewById(R.id.description)).setText(liveBean.getUser().getSignature());
}
new Handler(Looper.getMainLooper()).postDelayed(() -> {
dismiss();
if (onDismissListener != null) {
onDismissListener.onDismiss(null);
}
}, 3000);
}
}

View File

@ -0,0 +1,154 @@
package com.yunbao.common.dialog;
import android.content.Context;
import android.content.DialogInterface;
import android.os.Handler;
import android.os.Looper;
import android.util.Log;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;
import com.lxj.xpopup.XPopup;
import com.lxj.xpopup.enums.PopupAnimation;
import com.yunbao.common.R;
import com.yunbao.common.adapter.MessageSayHiDialogTagListAdapter;
import com.yunbao.common.bean.MessageSayHiBean;
import com.yunbao.common.bean.MessageUserInfoBean;
import com.yunbao.common.custom.RatioRoundImageView;
import com.yunbao.common.glide.ImgLoader;
import com.yunbao.common.interfaces.OnItemClickListener;
import com.yunbao.common.utils.DpUtil;
import com.yunbao.common.utils.StringUtil;
import com.yunbao.common.utils.ToastUtil;
import com.yunbao.common.utils.ViewUtils;
import com.yunbao.common.utils.WordUtil;
import java.util.ArrayList;
import java.util.List;
import io.rong.imkit.IMCenter;
import io.rong.imkit.utils.RouteUtils;
import io.rong.imlib.IRongCallback;
import io.rong.imlib.RongIMClient;
import io.rong.imlib.model.Conversation;
import io.rong.imlib.model.Message;
import io.rong.message.TextMessage;
public class MessageSayHiNotifyDialog extends AbsDialogCenterPopupWindow {
private MessageUserInfoBean userInfoBean;
private OnItemClickListener<String> onDismissListener;
private TextView anchorName;
private RatioRoundImageView avatar;
public MessageSayHiNotifyDialog(@NonNull Context context) {
super(context);
}
public MessageSayHiNotifyDialog(@NonNull Context context, MessageUserInfoBean bean) {
super(context);
this.userInfoBean = bean;
}
public MessageSayHiNotifyDialog setOnDismissListener(OnItemClickListener<String> onDismissListener) {
this.onDismissListener = onDismissListener;
return this;
}
@Override
public void buildDialog(XPopup.Builder builder) {
}
@Override
public int bindLayoutId() {
return R.layout.view_message_say_hi_now_notify;
}
@Override
protected void onShow() {
super.onShow();
}
@Override
protected void onDismiss() {
super.onDismiss();
if (onDismissListener != null) {
onDismissListener.onItemClick(userInfoBean.getUser().getId() + "", isSayHi ? 2 : 1);
}
}
boolean isSayHi = false;
@Override
protected void onCreate() {
super.onCreate();
findViewById(R.id.liveGo).setOnClickListener(v -> {
isSayHi = true;
Conversation.ConversationType type = Conversation.ConversationType.PRIVATE;
RouteUtils.routeToConversationActivity(mContext, type, userInfoBean.getUser().getId() + "", null);
sendMsg(userInfoBean.getSayHiMsg());
dismiss();
});
avatar = findViewById(R.id.avatar);
anchorName = findViewById(R.id.anchorName);
ImgLoader.display(mContext, userInfoBean.getUser().getAvatar(), avatar);
anchorName.setText(userInfoBean.getUser().getUserNicename());
((TextView) findViewById(R.id.description)).setText(userInfoBean.getUser().getSignature());
ViewUtils.findViewById(findViewById(R.id.age), R.id.tag, TextView.class).setText(String.format("%s%s",
WordUtil.getNewString(R.string.dialog_message_say_hi_age)
, userInfoBean.getInfo().getAge()));
showTag();
}
private void showTag() {
List<String> tags = new ArrayList<>();
tags.add(userInfoBean.getInfo().getSex() == 1 ? WordUtil.getNewString(R.string.sex_male) : WordUtil.getNewString(R.string.sex_female));
if (!StringUtil.isEmpty(userInfoBean.getInfo().getCareer())) {
tags.add(userInfoBean.getInfo().getCareer());
}
if (!StringUtil.isEmpty(userInfoBean.getInfo().getHeight()) && !userInfoBean.getInfo().getHeight().equals("0")) {
tags.add(userInfoBean.getInfo().getHeight());
}
List<String> t;
if (WordUtil.isNewZh()) {
t = userInfoBean.getInfo().getCn_label();
} else {
t = userInfoBean.getInfo().getEn_label();
}
if (t != null) {
for (String tag : t) {
if (!StringUtil.isEmpty(tag)) {
tags.add(tag);
}
}
}
MessageSayHiDialogTagListAdapter adapter = new MessageSayHiDialogTagListAdapter();
RecyclerView avatarList = findViewById(R.id.tag_list);
avatarList.setAdapter(adapter);
adapter.setUrls(tags);
}
private void sendMsg(String msg) {
sendMessage(Conversation.ConversationType.PRIVATE, userInfoBean.getUser().getId() + "", TextMessage.obtain(userInfoBean.getSayHiMsg()));
}
public static void sendMessage(Conversation.ConversationType type, String targetId, TextMessage tipsContent) {
IMCenter.getInstance().insertOutgoingMessage(type, targetId, Message.SentStatus.SENT, tipsContent, System.currentTimeMillis(), new RongIMClient.ResultCallback<Message>() {
@Override
public void onSuccess(Message message) {
}
@Override
public void onError(RongIMClient.ErrorCode e) {
}
});
}
}

View File

@ -47,6 +47,8 @@ import com.yunbao.common.bean.MedalAchievementModel;
import com.yunbao.common.bean.MessageChatIsAnchor; import com.yunbao.common.bean.MessageChatIsAnchor;
import com.yunbao.common.bean.MessageChatUserBean; import com.yunbao.common.bean.MessageChatUserBean;
import com.yunbao.common.bean.MessageHiBean; import com.yunbao.common.bean.MessageHiBean;
import com.yunbao.common.bean.MessageSayHiBean;
import com.yunbao.common.bean.MessageSayHiStartBean;
import com.yunbao.common.bean.MessageUserInfoBean; import com.yunbao.common.bean.MessageUserInfoBean;
import com.yunbao.common.bean.MsgSwitchDetailModel; import com.yunbao.common.bean.MsgSwitchDetailModel;
import com.yunbao.common.bean.NewPeopleInfo; import com.yunbao.common.bean.NewPeopleInfo;
@ -1239,4 +1241,15 @@ public interface PDLiveApi {
Observable<ResponseModel<List<BaseModel>>> setOpenOff( Observable<ResponseModel<List<BaseModel>>> setOpenOff(
@Query("open_off") int status @Query("open_off") int status
); );
@GET("/api/public/?service=Pdlmsg.sendBefore")
Observable<ResponseModel<MessageSayHiBean>> getMessageSayHiTimer(
);
@GET("/api/public/?service=Pdlmsg.sendAfter")
Observable<ResponseModel<List<BaseModel>>> callBackMessageSayHiTimer(
@Query("tuid") String toUid,
@Query("type") int type
);
@GET("/api/public/?service=Pdlmsg.getTips")
Observable<ResponseModel<MessageSayHiStartBean>> getMessageSayHiStartTimer(
);
} }

View File

@ -50,6 +50,8 @@ import com.yunbao.common.bean.MedalAchievementModel;
import com.yunbao.common.bean.MessageChatIsAnchor; import com.yunbao.common.bean.MessageChatIsAnchor;
import com.yunbao.common.bean.MessageChatUserBean; import com.yunbao.common.bean.MessageChatUserBean;
import com.yunbao.common.bean.MessageHiBean; import com.yunbao.common.bean.MessageHiBean;
import com.yunbao.common.bean.MessageSayHiBean;
import com.yunbao.common.bean.MessageSayHiStartBean;
import com.yunbao.common.bean.MessageUserInfoBean; import com.yunbao.common.bean.MessageUserInfoBean;
import com.yunbao.common.bean.NobleRankHideUserListModel; import com.yunbao.common.bean.NobleRankHideUserListModel;
import com.yunbao.common.bean.NobleTrumpetModel; import com.yunbao.common.bean.NobleTrumpetModel;
@ -3174,6 +3176,7 @@ public class LiveNetManager {
} }
}).isDisposed(); }).isDisposed();
} }
public void updateFile(File file, HttpCallback<AvatarBean> callback) { public void updateFile(File file, HttpCallback<AvatarBean> callback) {
MultipartBody.Part uploadFile = createUploadFile(file); MultipartBody.Part uploadFile = createUploadFile(file);
API.get().pdLiveApi(mContext) API.get().pdLiveApi(mContext)
@ -3196,6 +3199,7 @@ public class LiveNetManager {
} }
}).isDisposed(); }).isDisposed();
} }
public void updateFileToMp3(File file, HttpCallback<AvatarBean> callback) { public void updateFileToMp3(File file, HttpCallback<AvatarBean> callback) {
MultipartBody.Part uploadFile = createUploadFile(file); MultipartBody.Part uploadFile = createUploadFile(file);
API.get().pdLiveApi(mContext) API.get().pdLiveApi(mContext)
@ -3218,6 +3222,7 @@ public class LiveNetManager {
} }
}).isDisposed(); }).isDisposed();
} }
public void initUserInfo( public void initUserInfo(
int sex, int sex,
String user_nicename, String user_nicename,
@ -3264,6 +3269,70 @@ public class LiveNetManager {
} }
}).isDisposed(); }).isDisposed();
} }
public void getMessageSayHiTimer(
HttpCallback<MessageSayHiBean> callback) {
API.get().pdLiveApi(mContext)
.getMessageSayHiTimer()
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(roomMicStatusModelResponseModel -> {
if (callback != null) {
callback.onSuccess(roomMicStatusModelResponseModel.getData().getInfo());
}
}, new Consumer<Throwable>() {
@Override
public void accept(Throwable throwable) throws Exception {
throwable.printStackTrace();
if (callback != null) {
callback.onError(mContext.getString(R.string.net_error));
}
}
}).isDisposed();
}
public void getMessageSayHiStartTimer(
HttpCallback<MessageSayHiStartBean> callback) {
API.get().pdLiveApi(mContext)
.getMessageSayHiStartTimer()
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(roomMicStatusModelResponseModel -> {
if (callback != null) {
callback.onSuccess(roomMicStatusModelResponseModel.getData().getInfo());
}
}, new Consumer<Throwable>() {
@Override
public void accept(Throwable throwable) throws Exception {
throwable.printStackTrace();
if (callback != null) {
callback.onError(mContext.getString(R.string.net_error));
}
}
}).isDisposed();
}
public void callBackMessageSayHiTimer(String toUid,
int type,
HttpCallback<List<BaseModel>> callback) {
API.get().pdLiveApi(mContext)
.callBackMessageSayHiTimer(toUid, type)
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(roomMicStatusModelResponseModel -> {
if (callback != null) {
callback.onSuccess(roomMicStatusModelResponseModel.getData().getInfo());
}
}, new Consumer<Throwable>() {
@Override
public void accept(Throwable throwable) throws Exception {
throwable.printStackTrace();
if (callback != null) {
callback.onError(mContext.getString(R.string.net_error));
}
}
}).isDisposed();
}
private MultipartBody.Part createUploadFile(File file) { private MultipartBody.Part createUploadFile(File file) {
RequestBody requestBody = RequestBody.create(MediaType.parse("multipart/form-data"), file); RequestBody requestBody = RequestBody.create(MediaType.parse("multipart/form-data"), file);
return MultipartBody.Part.createFormData("file", file.getName(), requestBody); return MultipartBody.Part.createFormData("file", file.getName(), requestBody);

View File

@ -0,0 +1,282 @@
package com.yunbao.common.message.content;
import android.os.Parcel;
import android.os.Parcelable;
import androidx.annotation.NonNull;
import com.yunbao.common.interfaces.OnSendMessageListener;
import org.json.JSONException;
import org.json.JSONObject;
import java.io.UnsupportedEncodingException;
import io.rong.common.ParcelUtils;
import io.rong.imkit.IMCenter;
import io.rong.imlib.MessageTag;
import io.rong.imlib.RongIMClient;
import io.rong.imlib.model.Conversation;
import io.rong.imlib.model.Message;
import io.rong.imlib.model.MessageContent;
@MessageTag(value = "MessageChatCardContent", flag = MessageTag.ISPERSISTED)
public class MessageChatCardContent extends MessageContent implements Parcelable {
private String cover;
private String title;
private String avatar;
private String userName;
private String uid;
private String type;
private String extraData;
public static <T> void sendMessage(Conversation.ConversationType type, String targetId, MessageChatCardContent tipsContent, OnSendMessageListener<T> listener) {
IMCenter.getInstance().insertOutgoingMessage(type, targetId, Message.SentStatus.SENT, tipsContent, System.currentTimeMillis(), new RongIMClient.ResultCallback<Message>() {
@Override
public void onSuccess(Message message) {
if (listener != null) {
listener.onSuccess(null, null);
}
}
@Override
public void onError(RongIMClient.ErrorCode e) {
if (listener != null) {
listener.onError(e.code, e.msg);
}
}
});
}
private MessageChatCardContent() {
}
public MessageChatCardContent(byte[] data) {
if (data == null) {
return;
}
String jsonStr = null;
try {
jsonStr = new String(data, "UTF-8");
} catch (UnsupportedEncodingException e) {
}
if (jsonStr == null) {
return;
}
try {
JSONObject jsonObj = new JSONObject(jsonStr);
// 消息携带用户信息时, 自定义消息需添加下面代码
if (jsonObj.has("user")) {
setUserInfo(parseJsonToUserInfo(jsonObj.getJSONObject("user")));
}
// 用于群组聊天, 消息携带 @ 人信息时, 自定义消息需添加下面代码
if (jsonObj.has("mentionedInfo")) {
setMentionedInfo(parseJsonToMentionInfo(jsonObj.getJSONObject("mentionedInfo")));
}
// 将所有自定义变量从收到的 json 解析并赋值
if (jsonObj.has("cover")) {
cover = jsonObj.optString("cover");
}
if (jsonObj.has("title")) {
title = jsonObj.optString("title");
}
if (jsonObj.has("avatar")) {
avatar = jsonObj.optString("avatar");
}
if (jsonObj.has("userName")) {
userName = jsonObj.optString("userName");
}
if (jsonObj.has("uid")) {
uid = jsonObj.optString("uid");
}
if (jsonObj.has("type")) {
type = jsonObj.getString("type");
}
if (jsonObj.has("extraData")) {
extraData = jsonObj.optString("extraData");
}
} catch (JSONException e) {
}
}
public String getCover() {
return cover;
}
public MessageChatCardContent setCover(String cover) {
this.cover = cover;
return this;
}
public String getTitle() {
return title;
}
public MessageChatCardContent setTitle(String title) {
this.title = title;
return this;
}
public String getAvatar() {
return avatar;
}
public MessageChatCardContent setAvatar(String avatar) {
this.avatar = avatar;
return this;
}
public String getUserName() {
return userName;
}
public MessageChatCardContent setUserName(String userName) {
this.userName = userName;
return this;
}
public String getUid() {
return uid;
}
public MessageChatCardContent setUid(String uid) {
this.uid = uid;
return this;
}
public String getType() {
return type;
}
public MessageChatCardContent setType(String type) {
this.type = type;
return this;
}
public String getExtraData() {
return extraData;
}
public void setExtraData(String extra) {
this.extraData = extra;
}
/**
* cover 封面地址
* title 标题
* avatar 头像地址
* userName 昵称
* uid 被分享的用户id
* type1 直播间 0社区
* extra 如果是直播间就传直播间id
*/
protected MessageChatCardContent(Parcel in) {
setCover(ParcelUtils.readFromParcel(in));
setTitle(ParcelUtils.readFromParcel(in));
setAvatar(ParcelUtils.readFromParcel(in));
setUserName(ParcelUtils.readFromParcel(in));
setUid(ParcelUtils.readFromParcel(in));
setType(ParcelUtils.readFromParcel(in));
setExtraData(ParcelUtils.readFromParcel(in));
setExtra(ParcelUtils.readFromParcel(in));
}
// 快速构建消息对象方法
public static MessageChatCardContent obtain(
String cover,
String title,
String avatar,
String userName,
String uid,
String type,
String extraData
) {
MessageChatCardContent msg = new MessageChatCardContent();
msg.cover = cover;
msg.title = title;
msg.avatar = avatar;
msg.userName = userName;
msg.uid = uid;
msg.type = type;
msg.extraData = extraData;
return msg;
}
public static final Creator<MessageChatCardContent> CREATOR = new Creator<MessageChatCardContent>() {
@Override
public MessageChatCardContent createFromParcel(Parcel in) {
return new MessageChatCardContent(in);
}
@Override
public MessageChatCardContent[] newArray(int size) {
return new MessageChatCardContent[size];
}
};
/**
* cover 封面地址
* title 标题
* avatar 头像地址
* userName 昵称
* uid 被分享的用户id
* type1 直播间 0社区
* extra 如果是直播间就传直播间id
*/
@Override
public byte[] encode() {
JSONObject jsonObj = new JSONObject();
try {
// 消息携带用户信息时, 自定义消息需添加下面代码
if (getJSONUserInfo() != null) {
jsonObj.putOpt("user", getJSONUserInfo());
}
// 用于群组聊天, 消息携带 @ 人信息时, 自定义消息需添加下面代码
if (getJsonMentionInfo() != null) {
jsonObj.putOpt("mentionedInfo", getJsonMentionInfo());
}
// 将所有自定义消息的内容都序列化至 json 对象中
jsonObj.put("cover", this.cover);
jsonObj.put("title", this.title);
jsonObj.put("avatar", this.avatar);
jsonObj.put("userName", this.userName);
jsonObj.put("uid", this.uid);
jsonObj.put("type", this.type);
jsonObj.put("extraData", this.extraData);
} catch (JSONException e) {
}
try {
return jsonObj.toString().getBytes("UTF-8");
} catch (UnsupportedEncodingException e) {
}
return null;
}
@Override
public int describeContents() {
return 0;
}
/**
* cover 封面地址
* title 标题
* avatar 头像地址
* userName 昵称
* uid 被分享的用户id
* type1 直播间 0社区
* extra 如果是直播间就传直播间id
*/
@Override
public void writeToParcel(@NonNull Parcel dest, int flags) {
ParcelUtils.writeToParcel(dest, cover);
ParcelUtils.writeToParcel(dest, title);
ParcelUtils.writeToParcel(dest, avatar);
ParcelUtils.writeToParcel(dest, userName);
ParcelUtils.writeToParcel(dest, uid);
ParcelUtils.writeToParcel(dest, type);
ParcelUtils.writeToParcel(dest, extraData);
ParcelUtils.writeToParcel(dest, getExtra());
}
}

View File

@ -0,0 +1,54 @@
package com.yunbao.common.provider;
import android.content.Context;
import android.text.Spannable;
import android.view.ViewGroup;
import com.yunbao.common.R;
import com.yunbao.common.message.content.MessageChatCardContent;
import com.yunbao.common.message.content.MessageChatTipsContent;
import java.util.List;
import io.rong.imkit.conversation.messgelist.provider.BaseMessageItemProvider;
import io.rong.imkit.model.UiMessage;
import io.rong.imkit.widget.adapter.IViewProviderListener;
import io.rong.imkit.widget.adapter.ViewHolder;
import io.rong.imlib.model.MessageContent;
public class MessageChatCardItemProvider extends BaseMessageItemProvider<MessageChatCardContent> {
private Context mContext;
public MessageChatCardItemProvider(Context mContext) {
this.mContext = mContext;
mConfig.showPortrait = false;
mConfig.showSummaryWithName = false;
mConfig.showContentBubble = false;
mConfig.centerInHorizontal = true;
}
@Override
protected ViewHolder onCreateMessageContentViewHolder(ViewGroup parent, int viewType) {
return ViewHolder.createViewHolder(mContext, parent, R.layout.view_message_chat_tip);
}
@Override
protected void bindMessageContentViewHolder(ViewHolder holder, ViewHolder parentHolder, MessageChatCardContent content, UiMessage uiMessage, int position, List<UiMessage> list, IViewProviderListener<UiMessage> listener) {
holder.setText(R.id.tips, content.getAvatar());
}
@Override
protected boolean onItemClick(ViewHolder holder, MessageChatCardContent messageChatTipsContent, UiMessage uiMessage, int position, List<UiMessage> list, IViewProviderListener<UiMessage> listener) {
return false;
}
@Override
protected boolean isMessageViewType(MessageContent messageContent) {
return messageContent instanceof MessageChatTipsContent;
}
@Override
public Spannable getSummarySpannable(Context context, MessageChatCardContent content) {
return null;
}
}

View File

@ -58,7 +58,14 @@ public class AppManager {
* 获取当前显示Activity堆栈中最后一个传入的activity * 获取当前显示Activity堆栈中最后一个传入的activity
*/ */
public Activity getLastActivity() { public Activity getLastActivity() {
if(activityStack.isEmpty()){
return null;
}
Activity activity = activityStack.lastElement(); Activity activity = activityStack.lastElement();
if(activity==null||activity.isFinishing()){
activityStack.remove(activity);
return getLastActivity();
}
return activity; return activity;
} }

View File

@ -0,0 +1,62 @@
package com.yunbao.common.utils;
import android.content.Context;
import com.yunbao.common.bean.MessageUserInfoBean;
import com.yunbao.common.dialog.MessageChatNotifyDialog;
import com.yunbao.common.http.base.HttpCallback;
import com.yunbao.common.http.live.LiveNetManager;
import java.util.ArrayList;
import java.util.List;
public class MessageChatNotifyManager {
private static MessageChatNotifyManager instance;
private List<MessageUserInfoBean> startListNotifyList = new ArrayList<>();
public static MessageChatNotifyManager getInstance() {
if (instance == null) {
instance = new MessageChatNotifyManager();
}
return instance;
}
public void push(Context mContext, MessageUserInfoBean userInfo) {
if (startListNotifyList.isEmpty()) {
startListNotifyList.add(userInfo);
notifyLiveFlot(mContext);
} else {
startListNotifyList.add(userInfo);
}
}
private void notifyLiveFlot(Context mContext) {
if (startListNotifyList.iterator().hasNext()) {
MessageUserInfoBean bean = startListNotifyList.iterator().next();
new MessageChatNotifyDialog(AppManager.getInstance().getLastActivity(), bean).setOnDismissListener(dialog -> {
startListNotifyList.remove(bean);
if (startListNotifyList.iterator().hasNext()) {
notifyLiveFlot(mContext);
}
}).showDialog();
} else {
ToastUtil.showDebug("Not Message");
}
}
public synchronized void push(Context mContext, String targetId, String content) {
LiveNetManager.get(mContext)
.getOtherInfo(targetId, new HttpCallback<MessageUserInfoBean>() {
@Override
public void onSuccess(MessageUserInfoBean data) {
data.setExtras(content);
push(mContext, data);
}
@Override
public void onError(String error) {
}
});
}
}

View File

@ -0,0 +1,224 @@
package com.yunbao.common.utils;
import android.app.Activity;
import android.content.Context;
import android.util.Log;
import com.yunbao.common.CommonAppContext;
import com.yunbao.common.bean.BaseModel;
import com.yunbao.common.bean.MessageSayHiBean;
import com.yunbao.common.bean.MessageSayHiStartBean;
import com.yunbao.common.bean.MessageUserInfoBean;
import com.yunbao.common.dialog.MessageChatNotifyDialog;
import com.yunbao.common.dialog.MessageSayHiNotifyDialog;
import com.yunbao.common.http.base.HttpCallback;
import com.yunbao.common.http.live.LiveNetManager;
import com.yunbao.common.interfaces.OnItemClickListener;
import java.util.ArrayList;
import java.util.List;
import java.util.Timer;
import java.util.TimerTask;
public class MessageSayHiNotifyManager {
private static final String TAG = "打招呼定时器";
private static MessageSayHiNotifyManager instance;
private Timer timer = null;
private boolean isInit = false;
private boolean isStopShow = false;
private boolean isShowDialog = false;
private boolean isRun = false;
private MessageSayHiBean hiBean;
private List<MessageUserInfoBean> startListNotifyList = new ArrayList<>();
private String lastActivity;
public static MessageSayHiNotifyManager getInstance() {
if (instance == null) {
instance = new MessageSayHiNotifyManager();
}
return instance;
}
public void start() {
if (isInit) return;
Log.i(TAG, "start: 启动定时器");
isInit = true;
LiveNetManager.get(AppManager.getInstance().getLastActivity())
.getMessageSayHiStartTimer(new HttpCallback<MessageSayHiStartBean>() {
@Override
public void onSuccess(MessageSayHiStartBean data) {
timer = new Timer();
timer.schedule(createTask(), data.getNextTime() * 1000L);
hiBean = new MessageSayHiBean();
hiBean.setModel("init");
hiBean.setNextTime(data.getNextTime());
Log.i(TAG, "onSuccess: 初始化定时器,第一轮时间:" + data.getNextTime());
}
@Override
public void onError(String error) {
}
});
}
public boolean isInit() {
return isInit;
}
public synchronized void next() {
Log.i(TAG, "next: 获取下一轮定时器信息&显示当前弹框");
LiveNetManager.get(AppManager.getInstance().getLastActivity())
.getMessageSayHiTimer(new HttpCallback<MessageSayHiBean>() {
@Override
public void onSuccess(MessageSayHiBean data) {
if (data.getStatus() == 0) {
Log.i(TAG, "onSuccess: 定时器为关,不再轮训");
return;
}
data.setNextTime(RandomUtil.nextInt(30));
hiBean = data;
showDialog(data);
}
@Override
public void onError(String error) {
}
void showDialog(MessageSayHiBean bean) {
if (isShowDialog) {
Log.i(TAG, "showDialog: 展示对话框中");
return;
}
if (isStopShow) {
Log.i(TAG, "showDialog: 非目标页面,停止展示");
lastActivity = null;
isRun = false;
return;
}
String simpleName = AppManager.getInstance().getLastActivity().getClass().getSimpleName();
if (simpleName.equals(lastActivity)) {
Log.i(TAG, "showDialog: 与上次触发是同一个页面,不展示");
isRun = false;
return;
}
isShowDialog = true;
Log.i(TAG, "showDialog: 打开本轮打招呼弹框");
lastActivity = AppManager.getInstance().getLastActivity().getClass().getSimpleName();
new MessageSayHiNotifyDialog(AppManager.getInstance().getLastActivity(), bean.getUser()).setOnDismissListener((userId, position) ->
{
Log.i(TAG, "showDialog: 关闭打招呼弹窗,uid:" + userId + ",是否点击打招呼:" + (position == 2));
isShowDialog = false;
LiveNetManager.get(AppManager.getInstance().getLastActivity())
.callBackMessageSayHiTimer(userId, position, new HttpCallback<List<BaseModel>>() {
@Override
public void onSuccess(List<BaseModel> data) {
}
@Override
public void onError(String error) {
}
});
Log.i(TAG, "onSuccess: 启动定时器,下一轮时间:" + bean.getNextTime() + "");
timer = new Timer();
timer.schedule(createTask(), bean.getNextTime() * 1000L);
}).showDialog();
}
});
}
public void reload() {
if (!isInit) {
Log.i(TAG, "reload: 未初始化");
return;
}
if (hiBean == null) return;
Log.i(TAG, "reload: 重载定时器当前Activity:" + AppManager.getInstance().getLastActivity());
isStopShow = false;
if (timer != null) {
timer.cancel();
}
timer = new Timer();
timer.schedule(createTask(), hiBean.getNextTime() * 1000L);
}
public void resetActivity() {
lastActivity = null;
Log.i(TAG, "resetActivity: 重置Activity记录");
if (!isRun) {
reload();
}
}
public void stop() {
Log.i(TAG, "stop: 停止定时器当前Activity:" + AppManager.getInstance().getLastActivity());
isStopShow = true;
if (timer != null) {
timer.cancel();
timer = null;
}
}
private TimerTask createTask() {
isRun = true;
return new TimerTask() {
@Override
public void run() {
timer.cancel();
cancel();
Log.i(TAG, "run: 定时器到点,启动下一轮");
next();
}
@Override
public boolean cancel() {
isRun = false;
Log.i(TAG, "cancel: 定时器内部取消");
return super.cancel();
}
};
}
public void push(Context mContext, MessageUserInfoBean userInfo) {
if (startListNotifyList.isEmpty()) {
startListNotifyList.add(userInfo);
notifyLiveFlot(mContext);
} else {
startListNotifyList.add(userInfo);
}
}
private void notifyLiveFlot(Context mContext) {
if (startListNotifyList.iterator().hasNext()) {
MessageUserInfoBean bean = startListNotifyList.iterator().next();
new MessageChatNotifyDialog(AppManager.getInstance().getLastActivity(), bean).setOnDismissListener(dialog -> {
startListNotifyList.remove(bean);
if (startListNotifyList.iterator().hasNext()) {
notifyLiveFlot(mContext);
}
}).showDialog();
} else {
ToastUtil.showDebug("Not Message");
}
}
public synchronized void push(Context mContext, String targetId, String content) {
LiveNetManager.get(mContext)
.getOtherInfo(targetId, new HttpCallback<MessageUserInfoBean>() {
@Override
public void onSuccess(MessageUserInfoBean data) {
data.setExtras(content);
push(mContext, data);
}
@Override
public void onError(String error) {
}
});
}
}

View File

@ -54,6 +54,9 @@ public abstract class AbsViewHolder implements LifeCycleListener {
public View getContentView() { public View getContentView() {
return mContentView; return mContentView;
} }
public ViewGroup getRootView(){
return mParentView;
}
protected boolean canClick() { protected boolean canClick() {
return ClickUtil.canClick(); return ClickUtil.canClick();

View File

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:width="68dp" android:height="37dp">
<shape android:shape="rectangle">
<solid android:color="#ffffffff" />
<corners android:topLeftRadius="15dp" android:topRightRadius="15dp" android:bottomLeftRadius="15dp" android:bottomRightRadius="15dp" />
</shape>
</item>
</selector>

View File

@ -0,0 +1,27 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:id="@+id/lt_nodata_msg"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:gravity="center"
android:orientation="vertical"
android:visibility="visible">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@mipmap/ic_addressbook_not_search" />
<TextView
android:id="@+id/textView12"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:text="@string/not_data_message_address_book_list" />
</LinearLayout>
</RelativeLayout>

View File

@ -7,13 +7,21 @@
android:id="@+id/lt_nodata_msg" android:id="@+id/lt_nodata_msg"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:gravity="center"
android:layout_centerVertical="true" android:layout_centerVertical="true"
android:gravity="center"
android:orientation="vertical"
android:visibility="visible"> android:visibility="visible">
<ImageView <ImageView
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:src="@mipmap/img_no_new" /> android:src="@mipmap/ic_message_not_search" />
<TextView
android:id="@+id/textView12"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:text="@string/not_data_message_chat_list_search" />
</LinearLayout> </LinearLayout>
</RelativeLayout> </RelativeLayout>

View File

@ -0,0 +1,28 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:id="@+id/lt_nodata_msg"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:gravity="center"
android:orientation="vertical"
android:visibility="visible">
<ImageView
android:id="@+id/imageView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@mipmap/ic_message_not_chat_list" />
<TextView
android:id="@+id/textView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:text="@string/not_data_message_chat_list" />
</LinearLayout>
</RelativeLayout>

View File

@ -0,0 +1,27 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:id="@+id/lt_nodata_msg"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:gravity="center"
android:orientation="vertical"
android:visibility="visible">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@mipmap/ic_message_not_search" />
<TextView
android:id="@+id/textView12"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:text="@string/not_data_message_chat_list_search" />
</LinearLayout>
</RelativeLayout>

View File

@ -0,0 +1,65 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="329dp"
android:layout_height="wrap_content"
android:minHeight="81dp"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:background="@mipmap/bg_message_push">
<com.yunbao.common.custom.RatioRoundImageView
android:id="@+id/avatar"
android:layout_width="40dp"
android:layout_height="0dp"
android:layout_marginStart="18dp"
android:layout_marginTop="15dp"
android:layout_marginBottom="15dp"
android:src="@mipmap/chat_head_mo"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:ri_ratio="0.5"
app:riv_oval="true" />
<TextView
android:id="@+id/anchorName"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="6dp"
android:layout_marginTop="20dp"
android:text="TextView"
android:textColor="#FFFFFF"
android:textSize="13sp"
app:layout_constraintStart_toEndOf="@+id/avatar"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/description"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="2dp"
android:layout_marginEnd="8dp"
android:text="@string/main_anchor_live_notify_info"
android:textColor="#CCFFFFFF"
android:textSize="11sp"
app:layout_constraintEnd_toStartOf="@+id/liveGo"
app:layout_constraintStart_toStartOf="@+id/anchorName"
app:layout_constraintTop_toBottomOf="@+id/anchorName"
tools:text="123" />
<Button
android:id="@+id/liveGo"
android:layout_width="68dp"
android:layout_height="37dp"
android:layout_marginEnd="15dp"
android:background="@drawable/bg_view_msg_chat_notify_btn"
android:gravity="center"
android:text="@string/dialog_message_chat_notify_btn"
android:textColor="#333333"
android:textSize="13sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@ -0,0 +1,130 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:minHeight="81dp">
<ImageView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:src="@mipmap/bg_dialog_say_hi"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
</ImageView>
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/avatarLayout"
android:layout_width="104dp"
android:layout_height="104dp"
android:layout_marginTop="15dp"
android:background="@mipmap/bg_dialog_say_hi_avatar"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
>
<com.yunbao.common.custom.RatioRoundImageView
android:id="@+id/avatar"
android:layout_width="93dp"
android:layout_height="93dp"
android:src="@mipmap/chat_head_mo"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:ri_ratio="1"
app:riv_oval="true" />
</androidx.constraintlayout.widget.ConstraintLayout>
<TextView
android:id="@+id/anchorName"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:text="TextView"
android:textColor="#333333"
android:textSize="20sp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/avatarLayout" />
<TextView
android:id="@+id/description"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginBottom="20dp"
android:text="@string/main_anchor_live_notify_info"
android:textColor="#777777"
android:gravity="center"
android:textSize="11sp"
app:layout_constraintBottom_toTopOf="@+id/liveGo"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
tools:text="123" />
<include
android:id="@+id/age"
layout="@layout/view_msg_chat_top_tag"
android:layout_width="70dp"
android:layout_height="23dp"
android:layout_marginBottom="10dp"
app:layout_constraintBottom_toTopOf="@+id/tag_list_layout"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" />
<LinearLayout
android:id="@+id/tag_list_layout"
android:layout_width="0dp"
android:layout_height="25dp"
android:layout_marginStart="24dp"
app:layout_constraintBottom_toTopOf="@+id/description"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
android:gravity="center"
android:layout_marginEnd="24dp"
android:orientation="horizontal">
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/tag_list"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="24dp"
android:layout_gravity="center"
android:layout_marginEnd="24dp"
android:orientation="horizontal"
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
tools:itemCount="3"
tools:listitem="@layout/view_msg_chat_top_tag" />
</LinearLayout>
<LinearLayout
android:id="@+id/liveGo"
android:layout_width="168dp"
android:layout_height="54dp"
android:layout_marginBottom="20dp"
android:background="@drawable/bg_msg_address_book_user_btn_fan"
android:gravity="center"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" >
<ImageView
android:layout_width="wrap_content"
android:src="@mipmap/bg_dialog_say_hi_btn"
android:layout_height="wrap_content"/>
<TextView
android:text="@string/dialog_message_say_hi_btn"
android:textColor="#FFFFFF"
android:layout_marginStart="5dp"
android:textSize="13sp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
</LinearLayout>
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" <androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="63dp" android:layout_width="wrap_content"
android:layout_height="23dp" android:layout_height="wrap_content"
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
android:layout_marginEnd="5dp" android:layout_marginEnd="5dp"
xmlns:app="http://schemas.android.com/apk/res-auto"> xmlns:app="http://schemas.android.com/apk/res-auto">
@ -13,7 +13,7 @@
android:textColor="#C38764" android:textColor="#C38764"
android:textSize="11sp" android:textSize="11sp"
android:id="@+id/tag" android:id="@+id/tag"
android:layout_width="match_parent" android:layout_width="wrap_content"
android:layout_height="match_parent" android:layout_height="match_parent"
android:background="@drawable/view_chat_top_tag" android:background="@drawable/view_chat_top_tag"
android:scaleType="centerCrop" android:scaleType="centerCrop"

Binary file not shown.

After

Width:  |  Height:  |  Size: 169 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 34 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 149 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 110 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 151 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 85 KiB

View File

@ -1451,4 +1451,12 @@ Limited ride And limited avatar frame</string>
<string name="back_community_sure">Sure</string> <string name="back_community_sure">Sure</string>
<string name="activity_msg_chat_input_hint">Say something</string> <string name="activity_msg_chat_input_hint">Say something</string>
<string name="not_data_message_chat_list">暫無新消息哦~</string>
<string name="not_data_message_chat_list_search">暫無搜索結果,換個詞試試吧~</string>
<string name="not_data_message_address_book_list">當前列表為空~</string>
<string name="not_data_message_address_book_list_search">暫無搜索結果,換個詞試試吧~</string>
<string name="dialog_message_say_hi_age">Age:</string>
<string name="dialog_message_say_hi_btn">Say Hi</string>
<string name="dialog_message_chat_notify_btn">Reply</string>
</resources> </resources>

View File

@ -1449,4 +1449,12 @@
<string name="back_community_sure">確定</string> <string name="back_community_sure">確定</string>
<string name="activity_msg_chat_input_hint">說點什麼</string> <string name="activity_msg_chat_input_hint">說點什麼</string>
<string name="not_data_message_chat_list">暫無新消息哦~</string>
<string name="not_data_message_chat_list_search">暫無搜索結果,換個詞試試吧~</string>
<string name="not_data_message_address_book_list">當前列表為空~</string>
<string name="not_data_message_address_book_list_search">暫無搜索結果,換個詞試試吧~</string>
<string name="dialog_message_say_hi_age">年齡:</string>
<string name="dialog_message_say_hi_btn">打招呼</string>
<string name="dialog_message_chat_notify_btn">回復</string>
</resources> </resources>

View File

@ -1448,4 +1448,13 @@
<string name="back_community_sure">確定</string> <string name="back_community_sure">確定</string>
<string name="activity_msg_chat_input_hint">說點什麼</string> <string name="activity_msg_chat_input_hint">說點什麼</string>
<string name="not_data_message_chat_list">暫無新消息哦~</string>
<string name="not_data_message_chat_list_search">暫無搜索結果,換個詞試試吧~</string>
<string name="not_data_message_address_book_list">當前列表為空~</string>
<string name="not_data_message_address_book_list_search">暫無搜索結果,換個詞試試吧~</string>
<string name="dialog_message_say_hi_age">年齡:</string>
<string name="dialog_message_say_hi_btn">打招呼</string>
<string name="dialog_message_chat_notify_btn">回復</string>
</resources> </resources>

View File

@ -1445,4 +1445,12 @@
<string name="back_community_sure">確定</string> <string name="back_community_sure">確定</string>
<string name="activity_msg_chat_input_hint">說點什麼</string> <string name="activity_msg_chat_input_hint">說點什麼</string>
<string name="not_data_message_chat_list">暫無新消息哦~</string>
<string name="not_data_message_chat_list_search">暫無搜索結果,換個詞試試吧~</string>
<string name="not_data_message_address_book_list">當前列表為空~</string>
<string name="not_data_message_address_book_list_search">暫無搜索結果,換個詞試試吧~</string>
<string name="dialog_message_say_hi_age">年齡:</string>
<string name="dialog_message_say_hi_btn">打招呼</string>
<string name="dialog_message_chat_notify_btn">回復</string>
</resources> </resources>

View File

@ -1455,4 +1455,12 @@ Limited ride And limited avatar frame</string>
<string name="back_community_sure">Sure</string> <string name="back_community_sure">Sure</string>
<string name="activity_msg_chat_input_hint">Say something</string> <string name="activity_msg_chat_input_hint">Say something</string>
<string name="not_data_message_chat_list">暫無新消息哦~</string>
<string name="not_data_message_chat_list_search">暫無搜索結果,換個詞試試吧~</string>
<string name="not_data_message_address_book_list">當前列表為空~</string>
<string name="not_data_message_address_book_list_search">暫無搜索結果,換個詞試試吧~</string>
<string name="dialog_message_say_hi_age">年齡:</string>
<string name="dialog_message_say_hi_btn">打招呼</string>
<string name="dialog_message_chat_notify_btn">回復</string>
</resources> </resources>

View File

@ -95,6 +95,7 @@ import com.yunbao.common.utils.GiftCacheUtil;
import com.yunbao.common.utils.GoogleUtils; import com.yunbao.common.utils.GoogleUtils;
import com.yunbao.common.utils.LiveRoomCheckLivePresenter; import com.yunbao.common.utils.LiveRoomCheckLivePresenter;
import com.yunbao.common.utils.LocationUtil; import com.yunbao.common.utils.LocationUtil;
import com.yunbao.common.utils.MessageSayHiNotifyManager;
import com.yunbao.common.utils.ProcessResultUtil; import com.yunbao.common.utils.ProcessResultUtil;
import com.yunbao.common.utils.RouteUtil; import com.yunbao.common.utils.RouteUtil;
import com.yunbao.common.utils.SpUtil; import com.yunbao.common.utils.SpUtil;
@ -333,6 +334,7 @@ public class MainActivity extends AbsActivity implements MainAppBarLayoutListene
@Override @Override
public void onPageSelected(int position) { public void onPageSelected(int position) {
MessageSayHiNotifyManager.getInstance().resetActivity();
switch (position) { switch (position) {
case 0: case 0:
//点击埋点 //点击埋点
@ -536,6 +538,7 @@ public class MainActivity extends AbsActivity implements MainAppBarLayoutListene
//获取指导员账号 //获取指导员账号
ConversationIMListManager.get(this).getUserInstructor(this); ConversationIMListManager.get(this).getUserInstructor(this);
checkVersion(); checkVersion();
MessageSayHiNotifyManager.getInstance().start();
} }
/** /**

View File

@ -5,7 +5,9 @@ import android.graphics.Color;
import android.os.Bundle; import android.os.Bundle;
import android.text.Editable; import android.text.Editable;
import android.text.TextWatcher; import android.text.TextWatcher;
import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.view.ViewGroup;
import android.widget.EditText; import android.widget.EditText;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
@ -230,6 +232,7 @@ public class MsgAddressBookActivity extends AbsActivity {
.getPdluserFollow(position, new HttpCallback<List<MessageChatUserBean>>() { .getPdluserFollow(position, new HttpCallback<List<MessageChatUserBean>>() {
@Override @Override
public void onSuccess(List<MessageChatUserBean> data) { public void onSuccess(List<MessageChatUserBean> data) {
System.err.println("关注列表:"+data.size());
for (MessageChatUserBean item : data) { for (MessageChatUserBean item : data) {
item.setType(MyAddressBookFragment.TYPE_FOLLOW); item.setType(MyAddressBookFragment.TYPE_FOLLOW);
} }
@ -251,6 +254,7 @@ public class MsgAddressBookActivity extends AbsActivity {
.getPdluserFans(position, new HttpCallback<List<MessageChatUserBean>>() { .getPdluserFans(position, new HttpCallback<List<MessageChatUserBean>>() {
@Override @Override
public void onSuccess(List<MessageChatUserBean> data) { public void onSuccess(List<MessageChatUserBean> data) {
System.err.println("好友列表:"+data.size());
for (MessageChatUserBean item : data) { for (MessageChatUserBean item : data) {
item.setType(MyAddressBookFragment.TYPE_FAN); item.setType(MyAddressBookFragment.TYPE_FAN);
} }
@ -272,6 +276,7 @@ public class MsgAddressBookActivity extends AbsActivity {
.getPdluserFriend(position, new HttpCallback<List<MessageChatUserBean>>() { .getPdluserFriend(position, new HttpCallback<List<MessageChatUserBean>>() {
@Override @Override
public void onSuccess(List<MessageChatUserBean> data) { public void onSuccess(List<MessageChatUserBean> data) {
System.err.println("互关列表:"+data.size());
for (MessageChatUserBean item : data) { for (MessageChatUserBean item : data) {
item.setType(MyAddressBookFragment.TYPE_MUTUAL); item.setType(MyAddressBookFragment.TYPE_MUTUAL);
} }

View File

@ -51,9 +51,11 @@ public class MainMsgAddressBookListAdapter extends BaseAdapter<MessageChatUserBe
} else if (viewType == TYPE_SEARCH_CHAT) { } else if (viewType == TYPE_SEARCH_CHAT) {
View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.item_main_msg_search_chat, parent, false); View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.item_main_msg_search_chat, parent, false);
holder = ViewHolder.createViewHolder(parent.getContext(), view); holder = ViewHolder.createViewHolder(parent.getContext(), view);
} else { } else if (viewType != -200) {
View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.item_main_msg_search_chat, parent, false); View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.item_main_msg_search_chat, parent, false);
holder = ViewHolder.createViewHolder(parent.getContext(), view); holder = ViewHolder.createViewHolder(parent.getContext(), view);
} else {
holder = super.onCreateViewHolder(parent, viewType);
} }
return holder; return holder;
} }
@ -63,12 +65,17 @@ public class MainMsgAddressBookListAdapter extends BaseAdapter<MessageChatUserBe
int type = super.getItemViewType(position); int type = super.getItemViewType(position);
if (mDataList.size() > position) { if (mDataList.size() > position) {
type = mDataList.get(position).getModelType(); type = mDataList.get(position).getModelType();
} else if (mDataList.isEmpty() || isEmpty()) {
return -200;
} }
return type; return type;
} }
@Override @Override
public void onBindViewHolder(@NonNull ViewHolder holder, int position) { public void onBindViewHolder(@NonNull ViewHolder holder, int position) {
if(isEmpty()|| mDataList.isEmpty()){
return;
}
if (getItemViewType(position) == TYPE_SEARCH_USER) { if (getItemViewType(position) == TYPE_SEARCH_USER) {
bindUser(holder, position); bindUser(holder, position);
} else if (getItemViewType(position) == TYPE_SEARCH_CHAT) { } else if (getItemViewType(position) == TYPE_SEARCH_CHAT) {
@ -80,7 +87,7 @@ public class MainMsgAddressBookListAdapter extends BaseAdapter<MessageChatUserBe
} }
holder.getConvertView().setTag(mDataList.get(position)); holder.getConvertView().setTag(mDataList.get(position));
holder.getConvertView().setOnClickListener(view -> { holder.getConvertView().setOnClickListener(view -> {
MessageChatUserBean userBean= (MessageChatUserBean) view.getTag(); MessageChatUserBean userBean = (MessageChatUserBean) view.getTag();
RouteUtils.routeToConversationActivity(view.getContext(), RouteUtils.routeToConversationActivity(view.getContext(),
Conversation.ConversationType.PRIVATE, Conversation.ConversationType.PRIVATE,
userBean.getId()); userBean.getId());
@ -110,7 +117,7 @@ public class MainMsgAddressBookListAdapter extends BaseAdapter<MessageChatUserBe
holder.getView(R.id.btn).setVisibility(View.VISIBLE); holder.getView(R.id.btn).setVisibility(View.VISIBLE);
holder.setText(R.id.btn, WordUtil.getNewString(R.string.activity_msg_addressbook_tab_follow)); holder.setText(R.id.btn, WordUtil.getNewString(R.string.activity_msg_addressbook_tab_follow));
holder.getView(R.id.btn).setBackgroundResource(R.drawable.bg_msg_address_book_user_btn_follow); holder.getView(R.id.btn).setBackgroundResource(R.drawable.bg_msg_address_book_user_btn_follow);
}else{ } else {
holder.getView(R.id.btn).setVisibility(View.GONE); holder.getView(R.id.btn).setVisibility(View.GONE);
} }
holder.getView(R.id.btn).setOnClickListener(new View.OnClickListener() { holder.getView(R.id.btn).setOnClickListener(new View.OnClickListener() {
@ -165,7 +172,7 @@ public class MainMsgAddressBookListAdapter extends BaseAdapter<MessageChatUserBe
holder.getView(R.id.btn).setVisibility(View.VISIBLE); holder.getView(R.id.btn).setVisibility(View.VISIBLE);
holder.setText(R.id.btn, WordUtil.getNewString(R.string.activity_msg_addressbook_tab_follow)); holder.setText(R.id.btn, WordUtil.getNewString(R.string.activity_msg_addressbook_tab_follow));
holder.getView(R.id.btn).setBackgroundResource(R.drawable.bg_msg_address_book_user_btn_follow); holder.getView(R.id.btn).setBackgroundResource(R.drawable.bg_msg_address_book_user_btn_follow);
}else{ } else {
holder.getView(R.id.btn).setVisibility(View.GONE); holder.getView(R.id.btn).setVisibility(View.GONE);
} }
holder.getView(R.id.btn).setOnClickListener(new View.OnClickListener() { holder.getView(R.id.btn).setOnClickListener(new View.OnClickListener() {

View File

@ -41,6 +41,9 @@ public class MainMessageChatFragment extends ConversationListFragment {
public void setEmptyView(int viewLayoutMsgId) { public void setEmptyView(int viewLayoutMsgId) {
super.setEmptyView(viewLayoutMsgId); super.setEmptyView(viewLayoutMsgId);
} }
public void setEmptyView(View view){
super.setEmptyView(view);
}
public void search(String search) { public void search(String search) {

View File

@ -4,6 +4,8 @@ import android.os.Bundle;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import androidx.annotation.Nullable; import androidx.annotation.Nullable;
@ -16,6 +18,7 @@ import com.yunbao.common.bean.UserBean;
import com.yunbao.common.interfaces.OnGetItemListener; import com.yunbao.common.interfaces.OnGetItemListener;
import com.yunbao.common.interfaces.OnItemClickListener; import com.yunbao.common.interfaces.OnItemClickListener;
import com.yunbao.common.utils.RandomUtil; import com.yunbao.common.utils.RandomUtil;
import com.yunbao.common.utils.ViewUtils;
import com.yunbao.main.R; import com.yunbao.main.R;
import com.yunbao.main.adapter.MainMsgAddressBookListAdapter; import com.yunbao.main.adapter.MainMsgAddressBookListAdapter;
@ -41,6 +44,7 @@ public class MyAddressBookFragment extends Fragment {
List<MessageChatUserBean> list; List<MessageChatUserBean> list;
private OnItemClickListener<OnItemClickListener<List<MessageChatUserBean>>> listener; private OnItemClickListener<OnItemClickListener<List<MessageChatUserBean>>> listener;
int p = 1; int p = 1;
private View emptyView;
public MyAddressBookFragment(int typeMutual, OnItemClickListener<OnItemClickListener<List<MessageChatUserBean>>> listener) { public MyAddressBookFragment(int typeMutual, OnItemClickListener<OnItemClickListener<List<MessageChatUserBean>>> listener) {
this.type = typeMutual; this.type = typeMutual;
@ -50,13 +54,18 @@ public class MyAddressBookFragment extends Fragment {
@Nullable @Nullable
@Override @Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
emptyView = inflater.inflate(R.layout.view_layout_msg,container, false);
ViewUtils.findViewById(emptyView,R.id.imageView, ImageView.class).setImageResource(R.mipmap.ic_addressbook_not_search);
ViewUtils.findViewById(emptyView,R.id.textView, TextView.class).setText(R.string.not_data_message_address_book_list);
return inflater.inflate(R.layout.fragment_msg_addressbook_list, container, false); return inflater.inflate(R.layout.fragment_msg_addressbook_list, container, false);
} }
@Override @Override
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) { public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState); super.onViewCreated(view, savedInstanceState);
mAdapter = new MainMsgAddressBookListAdapter(); mAdapter = new MainMsgAddressBookListAdapter();
if(emptyView!=null){
mAdapter.setEmptyView(emptyView);
}
this.mList = (RecyclerView) view.findViewById(R.id.rc_conversation_list); this.mList = (RecyclerView) view.findViewById(R.id.rc_conversation_list);
this.mRefreshLayout = (SmartRefreshLayout) view.findViewById(R.id.rc_refresh); this.mRefreshLayout = (SmartRefreshLayout) view.findViewById(R.id.rc_refresh);
LinearLayoutManager layoutManager = new LinearLayoutManager(this.getActivity()); LinearLayoutManager layoutManager = new LinearLayoutManager(this.getActivity());
@ -87,6 +96,7 @@ public class MyAddressBookFragment extends Fragment {
@Override @Override
public void onItemClick(List<MessageChatUserBean> bean, int position) { public void onItemClick(List<MessageChatUserBean> bean, int position) {
if(bean.isEmpty()){ if(bean.isEmpty()){
// mAdapter.setDataCollection(list);
mRefreshLayout.finishLoadMoreWithNoMoreData(); mRefreshLayout.finishLoadMoreWithNoMoreData();
return; return;
} }
@ -100,6 +110,8 @@ public class MyAddressBookFragment extends Fragment {
private void onConversationListRefresh(RefreshLayout refreshLayout) { private void onConversationListRefresh(RefreshLayout refreshLayout) {
mAdapter.getData().clear(); mAdapter.getData().clear();
ViewUtils.findViewById(emptyView,R.id.imageView, ImageView.class).setImageResource(R.mipmap.ic_addressbook_not_search);
ViewUtils.findViewById(emptyView,R.id.textView, TextView.class).setText(R.string.not_data_message_address_book_list);
initData(); initData();
} }
@ -128,6 +140,8 @@ public class MyAddressBookFragment extends Fragment {
} }
public void setSearchData(List<MessageChatUserBean> list) { public void setSearchData(List<MessageChatUserBean> list) {
ViewUtils.findViewById(emptyView,R.id.imageView, ImageView.class).setImageResource(R.mipmap.ic_message_not_search);
ViewUtils.findViewById(emptyView,R.id.textView, TextView.class).setText(R.string.not_data_message_address_book_list_search);
mAdapter.setDataCollection(list); mAdapter.setDataCollection(list);
mRefreshLayout.setEnableRefresh(false); mRefreshLayout.setEnableRefresh(false);
mRefreshLayout.setEnableLoadMore(false); mRefreshLayout.setEnableLoadMore(false);

View File

@ -283,7 +283,7 @@ public class ConversationIMListManager {
//非指导员都可以点击 //非指导员都可以点击
UserInfo userInfo = RongUserInfoManager.getInstance().getUserInfo(baseUiConversation.mCore.getTargetId()); UserInfo userInfo = RongUserInfoManager.getInstance().getUserInfo(baseUiConversation.mCore.getTargetId());
String[] list; String[] list;
list = new String[]{WordUtil.getNewString(R.string.copy), WordUtil.getNewString(R.string.top)}; list = new String[]{WordUtil.getNewString(R.string.top),WordUtil.getNewString(R.string.delete)};
if (userInfo != null && !TextUtils.isEmpty(userInfo.getExtra())) { if (userInfo != null && !TextUtils.isEmpty(userInfo.getExtra())) {
IMLoginModel model = new Gson().fromJson(userInfo.getExtra(), IMLoginModel.class); IMLoginModel model = new Gson().fromJson(userInfo.getExtra(), IMLoginModel.class);
if (!TextUtils.equals(model.getIsAdmin(), "1")) { if (!TextUtils.equals(model.getIsAdmin(), "1")) {

View File

@ -9,6 +9,7 @@ import com.umeng.analytics.MobclickAgent;
import com.yunbao.common.activity.AbsActivity; import com.yunbao.common.activity.AbsActivity;
import com.yunbao.common.event.FloatWarOrderEvent; import com.yunbao.common.event.FloatWarOrderEvent;
import com.yunbao.common.glide.ImgLoader; import com.yunbao.common.glide.ImgLoader;
import com.yunbao.common.utils.MessageSayHiNotifyManager;
import com.yunbao.main.R; import com.yunbao.main.R;
import org.greenrobot.eventbus.EventBus; import org.greenrobot.eventbus.EventBus;
@ -63,6 +64,7 @@ public class MainHomeViewHolder extends AbsMainHomeParentViewHolder {
@Override @Override
protected void loadPageData(int position) { protected void loadPageData(int position) {
MessageSayHiNotifyManager.getInstance().resetActivity();
switch (position) { switch (position) {
case 0: case 0:
floatWarOrder = false; floatWarOrder = false;

View File

@ -8,6 +8,7 @@ import android.text.TextUtils;
import android.text.TextWatcher; import android.text.TextWatcher;
import android.util.Log; import android.util.Log;
import android.util.TypedValue; import android.util.TypedValue;
import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.widget.EditText; import android.widget.EditText;
@ -33,6 +34,8 @@ import com.umeng.analytics.MobclickAgent;
import com.yunbao.common.bean.ImUserInfoModel; import com.yunbao.common.bean.ImUserInfoModel;
import com.yunbao.common.bean.LiveBean; import com.yunbao.common.bean.LiveBean;
import com.yunbao.common.bean.MessageChatIsAnchor; import com.yunbao.common.bean.MessageChatIsAnchor;
import com.yunbao.common.bean.MessageUserInfoBean;
import com.yunbao.common.dialog.MessageSayHiNotifyDialog;
import com.yunbao.common.glide.ImgLoader; import com.yunbao.common.glide.ImgLoader;
import com.yunbao.common.http.HttpCallback; import com.yunbao.common.http.HttpCallback;
import com.yunbao.common.http.LiveHttpUtil; import com.yunbao.common.http.LiveHttpUtil;
@ -47,6 +50,7 @@ import com.yunbao.common.utils.RouteUtil;
import com.yunbao.common.utils.SVGAViewUtils; import com.yunbao.common.utils.SVGAViewUtils;
import com.yunbao.common.utils.StringUtil; import com.yunbao.common.utils.StringUtil;
import com.yunbao.common.utils.ToastUtil; import com.yunbao.common.utils.ToastUtil;
import com.yunbao.common.utils.ViewUtils;
import com.yunbao.common.views.AbsMainViewHolder; import com.yunbao.common.views.AbsMainViewHolder;
import com.yunbao.common.views.weight.ViewClicksAntiShake; import com.yunbao.common.views.weight.ViewClicksAntiShake;
import com.yunbao.live.activity.SystemMessageActivity; import com.yunbao.live.activity.SystemMessageActivity;
@ -91,6 +95,7 @@ public class MainMessageViewHolder extends AbsMainViewHolder {
private EditText search; private EditText search;
XPopup.Builder moreXPopup; XPopup.Builder moreXPopup;
private String homeZdyPop; private String homeZdyPop;
private View emptyView;
public MainMessageViewHolder setHomeZdyPop(String homeZdyPop) { public MainMessageViewHolder setHomeZdyPop(String homeZdyPop) {
this.homeZdyPop = homeZdyPop; this.homeZdyPop = homeZdyPop;
@ -136,6 +141,7 @@ public class MainMessageViewHolder extends AbsMainViewHolder {
contacts = findViewById(R.id.news_icon_contacts); contacts = findViewById(R.id.news_icon_contacts);
more = findViewById(R.id.news_icon_more); more = findViewById(R.id.news_icon_more);
search = findViewById(R.id.search); search = findViewById(R.id.search);
emptyView = LayoutInflater.from(getContentView().getContext()).inflate(R.layout.view_layout_msg, getRootView(), false);
contacts.setOnClickListener(view -> { contacts.setOnClickListener(view -> {
//通讯录 //通讯录
RouteUtil.forwardActivity(RouteUtil.PATH_ADDRESSBOOK); RouteUtil.forwardActivity(RouteUtil.PATH_ADDRESSBOOK);
@ -156,8 +162,12 @@ public class MainMessageViewHolder extends AbsMainViewHolder {
public void afterTextChanged(Editable editable) { public void afterTextChanged(Editable editable) {
if (conversationListFragment == null) return; if (conversationListFragment == null) return;
if (StringUtil.isEmpty(editable.toString())) { if (StringUtil.isEmpty(editable.toString())) {
ViewUtils.findViewById(emptyView,R.id.imageView, ImageView.class).setImageResource(R.mipmap.ic_message_not_chat_list);
ViewUtils.findViewById(emptyView,R.id.textView, TextView.class).setText(R.string.not_data_message_chat_list);
conversationListFragment.onChatList(); conversationListFragment.onChatList();
} else { } else {
ViewUtils.findViewById(emptyView,R.id.imageView, ImageView.class).setImageResource(R.mipmap.ic_message_not_search);
ViewUtils.findViewById(emptyView,R.id.textView, TextView.class).setText(R.string.not_data_message_chat_list_search);
conversationListFragment.search(editable.toString()); conversationListFragment.search(editable.toString());
} }
} }
@ -246,7 +256,7 @@ public class MainMessageViewHolder extends AbsMainViewHolder {
transaction.replace(R.id.container, conversationListFragment); transaction.replace(R.id.container, conversationListFragment);
transaction.commit(); transaction.commit();
//自定义空数据背景View //自定义空数据背景View
conversationListFragment.setEmptyView(com.yunbao.live.R.layout.view_layout_msg); conversationListFragment.setEmptyView(emptyView);
//刷新列表内用户信息 //刷新列表内用户信息
ConversationIMListManager.get(mContext).addUserInfoProvider(); ConversationIMListManager.get(mContext).addUserInfoProvider();
} }