Merge branch 'refs/heads/新潘多拉6.8.1' into 新潘多拉_6.8.2
# Conflicts: # common/src/main/res/values-en-rUS/strings.xml # common/src/main/res/values-zh/strings.xml # common/src/main/res/values/strings.xml # config.gradle
This commit is contained in:
@@ -25,7 +25,7 @@
|
||||
|
||||
<provider
|
||||
android:name="androidx.core.content.FileProvider"
|
||||
android:authorities="com.pandora.sy.fileprovider"
|
||||
android:authorities="${applicationId}.fileprovider"
|
||||
android:exported="false"
|
||||
android:grantUriPermissions="true">
|
||||
<meta-data
|
||||
|
||||
@@ -12,8 +12,10 @@ import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.core.content.ContextCompat;
|
||||
|
||||
import com.blankj.utilcode.util.LogUtils;
|
||||
import com.google.android.exoplayer2.C;
|
||||
import com.yunbao.common.R;
|
||||
import com.yunbao.common.glide.ImgLoader;
|
||||
import com.yunbao.common.interfaces.OnRecyclerListRefreshListener;
|
||||
@@ -23,16 +25,21 @@ import com.yunbao.common.utils.AppManager;
|
||||
import com.yunbao.common.utils.ChatMsgTypeUtils;
|
||||
import com.yunbao.common.utils.DateFormatUtil;
|
||||
import com.yunbao.common.utils.StringUtil;
|
||||
import com.yunbao.common.utils.UiConversationCodeUtil;
|
||||
import com.yunbao.common.utils.ViewUtils;
|
||||
import com.yunbao.common.utils.WordUtil;
|
||||
import com.yunbao.common.views.weight.ViewClicksAntiShake;
|
||||
|
||||
import org.spongycastle.jcajce.provider.asymmetric.rsa.ISOSignatureSpi;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
|
||||
import io.rong.imkit.IMCenter;
|
||||
import io.rong.imkit.RongIM;
|
||||
import io.rong.imkit.conversationlist.ConversationListAdapter;
|
||||
import io.rong.imkit.conversationlist.model.BaseUiConversation;
|
||||
import io.rong.imkit.conversationlist.model.SingleConversation;
|
||||
@@ -52,18 +59,43 @@ public class MainConversationListAdapter extends ConversationListAdapter {
|
||||
public static final int TYPE_SEARCH_USER = 510;
|
||||
public static final int TYPE_SEARCH_CHAT = 520;
|
||||
private List<BaseUiConversation> srcList;
|
||||
private List<BaseUiConversation> allDataList;
|
||||
private Context mContext;
|
||||
private boolean isChat = true;
|
||||
private OnRecyclerListRefreshListener<List<BaseUiConversation>> onRefreshListener;
|
||||
private Map<String, Integer> timerMap = new HashMap<>();
|
||||
|
||||
|
||||
public static final int FILTER_OFFLINE = 0;
|
||||
public static final int FILTER_ONLINE = 1;
|
||||
public static final int FILTER_UNREAD = 2;
|
||||
public static final int FILTER_READ = 4;
|
||||
public static final int FILTER_ALL = 7;
|
||||
private int mFilter = FILTER_ALL;
|
||||
|
||||
public int getFilter() {
|
||||
return mFilter;
|
||||
}
|
||||
|
||||
public void setFilter(int mFilter) {
|
||||
if (this.mFilter == mFilter)
|
||||
return;
|
||||
this.mFilter = mFilter;
|
||||
|
||||
}
|
||||
|
||||
|
||||
public MainConversationListAdapter(Context mContext) {
|
||||
this.mContext = mContext;
|
||||
}
|
||||
|
||||
public void setSrcList(List<BaseUiConversation> srcList) {
|
||||
this.srcList = srcList;
|
||||
notifyDataSetChanged();
|
||||
if (mFilter== FILTER_OFFLINE || mFilter == FILTER_ONLINE) {
|
||||
super.setDataCollection(UiConversationCodeUtil.FilterData(mFilter, allDataList));
|
||||
}else {
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
}
|
||||
|
||||
public void setOnRefreshListener(OnRecyclerListRefreshListener<List<BaseUiConversation>> onRefreshListener) {
|
||||
@@ -87,7 +119,7 @@ public class MainConversationListAdapter extends ConversationListAdapter {
|
||||
View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.item_main_msg_search_chat, parent, false);
|
||||
holder = ViewHolder.createViewHolder(parent.getContext(), view);
|
||||
} else if (viewType != -200) {
|
||||
View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.rc_conversationlist_item, parent, false);
|
||||
View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.rc_conversationlist_item2, parent, false);
|
||||
holder = ViewHolder.createViewHolder(parent.getContext(), view);
|
||||
} else {
|
||||
holder = super.onCreateViewHolder(parent, viewType);
|
||||
@@ -100,11 +132,13 @@ public class MainConversationListAdapter extends ConversationListAdapter {
|
||||
int type = super.getItemViewType(position);
|
||||
if (mDataList.size() > position) {
|
||||
String objectName = mDataList.get(position).mCore.getObjectName();
|
||||
Log.i("聊天数据源发现","objectName::"+objectName);
|
||||
if (!StringUtil.isEmpty(objectName) && objectName.startsWith("SEARCH_USER")) {
|
||||
type = TYPE_SEARCH_USER;
|
||||
} else if (!StringUtil.isEmpty(objectName) && objectName.startsWith("SEARCH_CHAT")) {
|
||||
type = TYPE_SEARCH_CHAT;
|
||||
} else if (!StringUtil.isEmpty(objectName) && objectName.startsWith("SEARCH_TITLE")) {
|
||||
Log.i("聊天数据源发现 ","getItemViewTypeSEARCH_TITLE");
|
||||
type = TYPE_SEARCH_TITLE;
|
||||
}
|
||||
} else if (mDataList.isEmpty() || isEmpty() || srcList.isEmpty()) {
|
||||
@@ -124,15 +158,76 @@ public class MainConversationListAdapter extends ConversationListAdapter {
|
||||
} else if (getItemViewType(position) == TYPE_SEARCH_CHAT) {
|
||||
bindChat(holder, position);
|
||||
} else if (getItemViewType(position) == TYPE_SEARCH_TITLE) {
|
||||
Log.i("聊天数据源设置标题头","SEARCH_TITLE::"+position);
|
||||
bindTitle(holder, position);
|
||||
return;
|
||||
} else if (getItemViewType(position) != -200) {
|
||||
bindChatNew(holder, position);
|
||||
super.onBindViewHolder(holder, position);
|
||||
return;
|
||||
}
|
||||
if (getItemViewType(position) != -200) {
|
||||
bindDefault(holder, position);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void bindChatNew(ViewHolder holder, int position) {
|
||||
BaseUiConversation conversation = mDataList.get(position);
|
||||
ImgLoader.display(holder.getContext(), conversation.mCore.getPortraitUrl(), holder.getView(R.id.rc_conversation_portrait));
|
||||
holder.setText(R.id.rc_conversation_title, conversation.mCore.getConversationTitle());
|
||||
((TextView) holder.getView(R.id.rc_conversation_content)).setText(ChatMsgTypeUtils.getMsg(conversation.mConversationContent.toString()));
|
||||
if (conversation.mCore.getSentTime() != -1 && holder.getView(R.id.rc_conversation_date) != null) {
|
||||
holder.setText(R.id.rc_conversation_date, DateFormatUtil.getDateTimeString(conversation.mCore.getSentTime(), true, holder.getContext()));
|
||||
holder.getView(R.id.rc_conversation_date).setVisibility(View.VISIBLE);
|
||||
} else if (holder.getView(R.id.rc_conversation_date) != null) {
|
||||
holder.getView(R.id.rc_conversation_date).setVisibility(View.GONE);
|
||||
}
|
||||
holder.setVisible(R.id.rc_conversation_live_online, "0".equals(conversation.mCore.getDraft()));
|
||||
int unReadCount = conversation.mCore.getUnreadMessageCount();
|
||||
|
||||
if (unReadCount > 0) {
|
||||
holder.setVisible(R.id.rc_conversation_unread_count, true);
|
||||
holder.setText(R.id.rc_conversation_unread_count, String.valueOf(unReadCount));
|
||||
} else {
|
||||
holder.setVisible(R.id.rc_conversation_unread_count, false);
|
||||
}
|
||||
|
||||
|
||||
Message message = conversation.mCore.getMessage();
|
||||
if (message != null && message.getMessageDirection() == Message.MessageDirection.SEND) {
|
||||
holder.setVisible(R.id.rc_conversation_unread_tv, true);
|
||||
if (conversation.mCore.getSentStatus() == Message.SentStatus.READ) {
|
||||
holder.setTextColor(R.id.rc_conversation_unread_tv, ContextCompat.getColor(holder.itemView.getContext(), R.color.rc_secondary_color));
|
||||
holder.setText(R.id.rc_conversation_unread_tv, WordUtil.getNewString(R.string.message_chat_msg_read_tip));
|
||||
} else {
|
||||
holder.setTextColor(R.id.rc_conversation_unread_tv, ContextCompat.getColor(holder.itemView.getContext(), R.color.red));
|
||||
holder.setText(R.id.rc_conversation_unread_tv, WordUtil.getNewString(R.string.message_chat_msg_unread_tip));
|
||||
}
|
||||
} else {
|
||||
holder.setVisible(R.id.rc_conversation_unread_tv, false);
|
||||
}
|
||||
|
||||
|
||||
if (holder.getView(R.id.rc_conversation_live_status) == null || IMLoginManager.get(holder.getContext()).getAnchorB() != 1) {
|
||||
return;
|
||||
}
|
||||
Integer timer = timerMap.get(mDataList.get(position).mCore.getTargetId());
|
||||
if (timer == null) {
|
||||
holder.getView(R.id.rc_conversation_live_status).setVisibility(View.GONE);
|
||||
return;
|
||||
}
|
||||
if (timer >= 10) {
|
||||
holder.setText(R.id.rc_conversation_live_status,
|
||||
String.format(WordUtil.getNewString(R.string.message_chat_msg_look_live), timer)
|
||||
);
|
||||
holder.getView(R.id.rc_conversation_live_status).setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
holder.getView(R.id.rc_conversation_live_status).setVisibility(View.GONE);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void bindDefault(ViewHolder holder, int position) {
|
||||
BaseUiConversation conversation = mDataList.get(position);
|
||||
Log.i("列表", "bindDefault: 用户头像:" + conversation.mCore.getPortraitUrl());
|
||||
@@ -171,7 +266,9 @@ public class MainConversationListAdapter extends ConversationListAdapter {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void bindEmpty(ViewHolder holder, int position) {
|
||||
Log.i("聊天数据源", "bindEmpty: ");
|
||||
if (isChat) {
|
||||
ViewUtils.findViewById(holder.itemView, R.id.imageView, ImageView.class).setImageResource(R.mipmap.ic_message_not_chat_list);
|
||||
ViewUtils.findViewById(holder.itemView, R.id.textView, TextView.class).setText(R.string.not_data_message_chat_list);
|
||||
@@ -183,18 +280,19 @@ public class MainConversationListAdapter extends ConversationListAdapter {
|
||||
|
||||
public void onFinish() {
|
||||
if (onRefreshListener != null) {
|
||||
Log.i("聊天数据源", "设置数据源: " + mDataList.size());
|
||||
onRefreshListener.onFinish(mDataList);
|
||||
Log.i("聊天数据源", "设置数据源: " + allDataList.size());
|
||||
onRefreshListener.onFinish(allDataList);
|
||||
}
|
||||
}
|
||||
|
||||
private int listHashCode = 0;
|
||||
@Override
|
||||
public synchronized void setDataCollection(List<BaseUiConversation> data) {
|
||||
|
||||
public synchronized void setDataCollectionV2(List<BaseUiConversation> data, boolean isSearch) {
|
||||
if (data.hashCode() == listHashCode) return;
|
||||
listHashCode = data.hashCode();
|
||||
List<BaseUiConversation> tmp = new ArrayList<>();
|
||||
Log.i("聊天数据源", "setDataCollection: " + data.hashCode());
|
||||
Log.i("聊天数据源", "size()" + data.size() + " setDataCollection: " + data.hashCode());
|
||||
|
||||
List<String> urls = new ArrayList<>();
|
||||
if (srcList == null) {
|
||||
srcList = new ArrayList<>();
|
||||
@@ -203,7 +301,8 @@ public class MainConversationListAdapter extends ConversationListAdapter {
|
||||
if (mContext == null)
|
||||
mContext = AppManager.getInstance().getLastActivity();
|
||||
for (BaseUiConversation item : data) {
|
||||
if (urls.contains(item.mCore.getTargetId())) continue;
|
||||
if (urls.contains(item.mCore.getTargetId()) && item.mCore.getTargetId()!=null) continue;
|
||||
// if ( item.mCore.getConversationTitle()==null || item.mCore.getTargetId()==null) continue;
|
||||
if (item.mConversationContent != null && item.mConversationContent.toString().contains("_method_")) {
|
||||
IMCenter.getInstance().deleteMessages(Conversation.ConversationType.PRIVATE,
|
||||
item.mCore.getTargetId(),
|
||||
@@ -222,7 +321,8 @@ public class MainConversationListAdapter extends ConversationListAdapter {
|
||||
IMCenter.getInstance().clearMessagesUnreadStatus(Conversation.ConversationType.PRIVATE, item.mCore.getTargetId(), null);
|
||||
}
|
||||
urls.add(item.mCore.getTargetId());
|
||||
Log.i("聊天数据源", item.mCore.getConversationTitle() + "|" + item.mCore.getPortraitUrl() + "|" + item.mCore.getTargetId());
|
||||
Log.i("聊天数据源", item.mCore.getConversationTitle() + "|" + item.mCore.getPortraitUrl() + "|" + item.mCore.getTargetId() +"|"+item.mCore.getObjectName());
|
||||
|
||||
if (!tmpUids.contains(item.mCore.getTargetId())) {
|
||||
BaseUiConversation cn = new SingleConversation(mContext, item.mCore);
|
||||
srcList.add(cn);
|
||||
@@ -236,13 +336,37 @@ public class MainConversationListAdapter extends ConversationListAdapter {
|
||||
}
|
||||
tmp.add(item);
|
||||
}
|
||||
// ToastUtil.showDebug("消息数:"+data.size());
|
||||
super.setDataCollection(tmp);
|
||||
List<BaseUiConversation> showData = null;
|
||||
if (isSearch) {
|
||||
// Log.i("聊天数据源", "FilterData isSearch");
|
||||
showData = tmp ;//UiConversationCodeUtil.FilterData(mFilter, tmp, allDataList);
|
||||
} else {
|
||||
allDataList = tmp;
|
||||
if (mFilter != FILTER_OFFLINE && mFilter != FILTER_ONLINE )
|
||||
{
|
||||
// Log.i("聊天数据源", "FilterData notSearch");
|
||||
showData = UiConversationCodeUtil.FilterData(mFilter, allDataList);
|
||||
}
|
||||
}
|
||||
if (showData != null && !UiConversationCodeUtil.checkIsSame(showData, mDataList)) {
|
||||
// Log.i("聊天数据源", "数据源有变化" + showData.size());
|
||||
super.setDataCollection(showData);
|
||||
} else {
|
||||
// Log.i("聊天数据源", "数据源无变化");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void setDataCollection(List<BaseUiConversation> data) {
|
||||
setDataCollectionV2(data, false);
|
||||
}
|
||||
|
||||
|
||||
private List<String> tmpUids = new ArrayList<>();
|
||||
|
||||
public void clear() {
|
||||
Log.i("聊天数据源", "clear: " + mDataList.size());
|
||||
mDataList.clear();
|
||||
if (srcList != null) {
|
||||
srcList.clear();
|
||||
@@ -349,15 +473,15 @@ public class MainConversationListAdapter extends ConversationListAdapter {
|
||||
BaseUiConversation conversation = mDataList.get(id);
|
||||
conversation.mCore.setSentTime(bean.getSentTime());
|
||||
conversation.mCore.setUnreadMessageCount(integer);
|
||||
if(bean.getContent() instanceof SightMessage){
|
||||
conversation.mConversationContent = new SpannableString(WordUtil.isNewZh()?"[小視頻]":"[Video]");
|
||||
}else if(bean.getContent() instanceof HQVoiceMessage){
|
||||
conversation.mConversationContent = new SpannableString(WordUtil.isNewZh()?"[語音]":"[Voice]");
|
||||
} else if(bean.getContent() instanceof ImageMessage){
|
||||
conversation.mConversationContent = new SpannableString(WordUtil.isNewZh()?"[圖片]":"[picture]");
|
||||
}else if(bean.getContent() instanceof MessageChatCardContent){
|
||||
conversation.mConversationContent = new SpannableString(WordUtil.isNewZh()?"[站內分享]":"[In-app sharing]");
|
||||
} else{
|
||||
if (bean.getContent() instanceof SightMessage) {
|
||||
conversation.mConversationContent = new SpannableString(WordUtil.isNewZh() ? "[小視頻]" : "[Video]");
|
||||
} else if (bean.getContent() instanceof HQVoiceMessage) {
|
||||
conversation.mConversationContent = new SpannableString(WordUtil.isNewZh() ? "[語音]" : "[Voice]");
|
||||
} else if (bean.getContent() instanceof ImageMessage) {
|
||||
conversation.mConversationContent = new SpannableString(WordUtil.isNewZh() ? "[圖片]" : "[picture]");
|
||||
} else if (bean.getContent() instanceof MessageChatCardContent) {
|
||||
conversation.mConversationContent = new SpannableString(WordUtil.isNewZh() ? "[站內分享]" : "[In-app sharing]");
|
||||
} else {
|
||||
conversation.mConversationContent = new SpannableString(((TextMessage) bean.getContent()).getContent());
|
||||
}
|
||||
mDataList.set(id, conversation);
|
||||
@@ -375,4 +499,6 @@ public class MainConversationListAdapter extends ConversationListAdapter {
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -56,7 +56,7 @@ public class SudGameSearchDialogPopup extends AbsDialogPopupWindow {
|
||||
|
||||
@Override
|
||||
public void dismiss() {
|
||||
Bus.getOff(this);
|
||||
// Bus.getOff(this);
|
||||
super.dismiss();
|
||||
}
|
||||
|
||||
@@ -78,7 +78,7 @@ public class SudGameSearchDialogPopup extends AbsDialogPopupWindow {
|
||||
@Override
|
||||
protected void onCreate() {
|
||||
super.onCreate();
|
||||
Bus.getOn(this);
|
||||
// Bus.getOn(this);
|
||||
editSearch = findViewById(R.id.edit_search);
|
||||
// listHistory = findViewById(R.id.list_history);
|
||||
listRoom = findViewById(R.id.list_room);
|
||||
|
||||
@@ -0,0 +1,57 @@
|
||||
package com.yunbao.common.fragment;
|
||||
|
||||
import android.app.Application;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import androidx.lifecycle.ViewModel;
|
||||
|
||||
import com.facebook.all.All;
|
||||
import com.yunbao.common.R;
|
||||
import com.yunbao.common.utils.UiConversationCodeUtil;
|
||||
|
||||
public class ChatViewModel extends ViewModel {
|
||||
|
||||
private int mChatFilter = UiConversationCodeUtil.FILTER_ALL;
|
||||
|
||||
public int getChatFilter() {
|
||||
return mChatFilter;
|
||||
}
|
||||
|
||||
public void setChatFilter(int mChatFilter) {
|
||||
this.mChatFilter = mChatFilter;
|
||||
}
|
||||
|
||||
// public static final int FILTER_OFFLINE = 0;
|
||||
// public static final int FILTER_ONLINE = 1;
|
||||
// public static final int FILTER_UNREAD = 2;
|
||||
// public static final int FILTER_READ = 4;
|
||||
// public static final int FILTER_ALL = 7;
|
||||
// <string name="all_chats">All Chats</string>
|
||||
// <string name="online_only">Show Online </string>
|
||||
// <string name="offline_only">Show Offline </string>
|
||||
// <string name="read_only">Show Read </string>
|
||||
// <string name="unread_only">Show Unread </string>
|
||||
|
||||
public int getTitleTextId() {
|
||||
int id = R.string.all_chats;
|
||||
switch (mChatFilter) {
|
||||
case UiConversationCodeUtil.FILTER_ALL:
|
||||
id = R.string.all_chats;
|
||||
break;
|
||||
case UiConversationCodeUtil.FILTER_ONLINE:
|
||||
id = R.string.online_only;
|
||||
break;
|
||||
case UiConversationCodeUtil.FILTER_OFFLINE:
|
||||
id = R.string.offline_only;
|
||||
break;
|
||||
case UiConversationCodeUtil.FILTER_READ:
|
||||
id = R.string.read_only;
|
||||
break;
|
||||
case UiConversationCodeUtil.FILTER_UNREAD:
|
||||
id = R.string.unread_only;
|
||||
break;
|
||||
}
|
||||
return id;
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,8 @@
|
||||
package com.yunbao.common.fragment;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.os.Parcel;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
@@ -9,11 +11,13 @@ import android.view.ViewGroup;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.lifecycle.Observer;
|
||||
import androidx.lifecycle.ViewModelProvider;
|
||||
|
||||
import com.yunbao.common.R;
|
||||
import com.yunbao.common.adapter.MainConversationListAdapter;
|
||||
import com.yunbao.common.utils.StringUtil;
|
||||
import com.yunbao.common.utils.ToastUtil;
|
||||
import com.yunbao.common.utils.UiConversationCodeUtil;
|
||||
import com.yunbao.common.utils.WordUtil;
|
||||
|
||||
import java.util.ArrayList;
|
||||
@@ -26,16 +30,20 @@ import io.rong.imkit.conversationlist.model.SingleConversation;
|
||||
import io.rong.imkit.event.Event;
|
||||
import io.rong.imlib.RongIMClient;
|
||||
import io.rong.imlib.model.Conversation;
|
||||
import io.rong.imlib.model.Message;
|
||||
import io.rong.imlib.model.MessageContent;
|
||||
import io.rong.imlib.model.SearchConversationResult;
|
||||
|
||||
public class MainMessageChatFragment extends ConversationListFragment {
|
||||
|
||||
private static final String TAG = "融云列表";
|
||||
int listHashCode = 0;
|
||||
// ChatViewModel chatViewModel;
|
||||
|
||||
@Nullable
|
||||
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
||||
Log.i(TAG, "onCreateView: 创建融云");
|
||||
// chatViewModel = (ChatViewModel)(new ViewModelProvider(requireActivity())).get(ChatViewModel.class);
|
||||
return inflater.inflate(R.layout.rc_conversationlist_fragment, container, false);
|
||||
}
|
||||
|
||||
@@ -46,10 +54,13 @@ public class MainMessageChatFragment extends ConversationListFragment {
|
||||
mConversationListViewModel.getConversationListLiveData().observe(this.getViewLifecycleOwner(), new Observer<List<BaseUiConversation>>() {
|
||||
@Override
|
||||
public void onChanged(List<BaseUiConversation> uiConversations) {
|
||||
if (listHashCode != uiConversations.hashCode()) {
|
||||
listHashCode = uiConversations.hashCode();
|
||||
int hashCode = UiConversationCodeUtil.getListHasCode(uiConversations);
|
||||
if (listHashCode != hashCode) {
|
||||
Log.i("nwq", "刷新数据");
|
||||
listHashCode = hashCode;
|
||||
((MainConversationListAdapter) mAdapter).onFinish();
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
mConversationListViewModel.getRefreshEventLiveData().observe(this.getViewLifecycleOwner(), new Observer<Event.RefreshEvent>() {
|
||||
@@ -58,7 +69,6 @@ public class MainMessageChatFragment extends ConversationListFragment {
|
||||
listHashCode = 0;
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
public void setEmptyView(int viewLayoutMsgId) {
|
||||
@@ -70,7 +80,16 @@ public class MainMessageChatFragment extends ConversationListFragment {
|
||||
}
|
||||
|
||||
|
||||
public void refreshData() {
|
||||
mRefreshLayout.autoRefresh();
|
||||
//onConversationListRefresh(mRefreshLayout)
|
||||
}
|
||||
|
||||
public void search(String search) {
|
||||
if (TextUtils.isEmpty(search)){
|
||||
mRefreshLayout.autoRefresh();
|
||||
return;
|
||||
}
|
||||
((MainConversationListAdapter) mAdapter).setSearch();
|
||||
getContactsList(search);
|
||||
}
|
||||
@@ -84,10 +103,11 @@ public class MainMessageChatFragment extends ConversationListFragment {
|
||||
List<String> uidList = new ArrayList<>();
|
||||
|
||||
BaseUiConversation conversation = new SingleConversation(getContext(), new Conversation());
|
||||
conversation.mCore.setMessage(new Message());
|
||||
conversation.mCore.setObjectName("SEARCH_TITLE" + WordUtil.getNewString(R.string.activity_msg_list_title_contacts));
|
||||
Log.i("聊天数据源设置数据", "聊天数据源: " + conversation.mCore.getObjectName());
|
||||
conversation.mCore.setConversationType(Conversation.ConversationType.PRIVATE);
|
||||
list.add(conversation);
|
||||
|
||||
List<BaseUiConversation> data = new ArrayList<>();
|
||||
System.err.println(" ----------------------->" + mAdapter.getData().size());
|
||||
for (BaseUiConversation cn : ((MainConversationListAdapter) mAdapter).getSrcList()) {
|
||||
@@ -126,7 +146,9 @@ public class MainMessageChatFragment extends ConversationListFragment {
|
||||
@Override
|
||||
public void onSuccess(List<SearchConversationResult> searchConversationResults) {
|
||||
BaseUiConversation conversation = new SingleConversation(getContext(), new Conversation());
|
||||
conversation.mCore.setMessage(new Message());
|
||||
conversation.mCore.setObjectName("SEARCH_TITLE" + WordUtil.getNewString(R.string.activity_msg_list_title_chat_records));
|
||||
Log.i("聊天数据源设置数据", "聊天数据源: " + conversation.mCore.getObjectName());
|
||||
conversation.mCore.setConversationType(Conversation.ConversationType.PRIVATE);
|
||||
list.add(conversation);
|
||||
List<BaseUiConversation> data = new ArrayList<>();
|
||||
@@ -144,7 +166,10 @@ public class MainMessageChatFragment extends ConversationListFragment {
|
||||
list.remove(list.size() - 1);
|
||||
}
|
||||
list.addAll(data);
|
||||
mAdapter.setDataCollection(list);
|
||||
for (BaseUiConversation cn : list){
|
||||
Log.i("聊天数据源搜索前的", cn.mCore.getConversationTitle() + "|" + cn.mCore.getPortraitUrl() + "|" + cn.mCore.getTargetId());
|
||||
}
|
||||
((MainConversationListAdapter) mAdapter).setDataCollectionV2(list,true);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -156,17 +181,19 @@ public class MainMessageChatFragment extends ConversationListFragment {
|
||||
}
|
||||
|
||||
public void onChatList() {
|
||||
if(mConversationListViewModel==null)return;
|
||||
if (mConversationListViewModel == null) return;
|
||||
((MainConversationListAdapter) mAdapter).setChat();
|
||||
((MainConversationListAdapter) mAdapter).clear();
|
||||
System.out.println(">!>!>!>!!>"+mConversationListViewModel);
|
||||
System.out.println(">!>!>!>!!>" + mConversationListViewModel);
|
||||
subscribeUi();
|
||||
|
||||
mRefreshLayout.autoRefresh();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ConversationListAdapter onResolveAdapter() {
|
||||
this.mAdapter = new MainConversationListAdapter(getContext());
|
||||
MainConversationListAdapter adapter = new MainConversationListAdapter(getContext());
|
||||
// adapter.setFilter(chatViewModel.getChatFilter());
|
||||
this.mAdapter = adapter;
|
||||
return this.mAdapter;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,6 +13,7 @@ import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.fragment.app.FragmentManager;
|
||||
import androidx.fragment.app.FragmentTransaction;
|
||||
import androidx.lifecycle.ViewModelProvider;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
|
||||
import com.yunbao.common.R;
|
||||
@@ -49,7 +50,7 @@ public class MainMessageChatListFragment extends AbsMainMessageChatListFragment
|
||||
public MainMessageChatListFragment(Context mContext) {
|
||||
this.mContext =mContext;
|
||||
}
|
||||
|
||||
ChatViewModel chatViewModel;
|
||||
@Nullable
|
||||
@Override
|
||||
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
||||
@@ -62,8 +63,10 @@ public class MainMessageChatListFragment extends AbsMainMessageChatListFragment
|
||||
@Override
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
chatViewModel = (new ViewModelProvider(requireActivity())).get(ChatViewModel.class);
|
||||
conversationListFragment = new MainMessageChatFragment();
|
||||
setAdapter(conversationListFragment.getAdapter());
|
||||
mAdapter.setFilter(chatViewModel.getChatFilter());
|
||||
FragmentManager manager = getChildFragmentManager();
|
||||
FragmentTransaction transaction = manager.beginTransaction();
|
||||
transaction.replace(R.id.container, conversationListFragment);
|
||||
@@ -165,6 +168,16 @@ public class MainMessageChatListFragment extends AbsMainMessageChatListFragment
|
||||
|
||||
}
|
||||
|
||||
public int getFilter() {
|
||||
return mAdapter.getFilter();
|
||||
}
|
||||
|
||||
public void setFilter(int mFilter) {
|
||||
mAdapter.setFilter(mFilter);
|
||||
chatViewModel.setChatFilter(mFilter);
|
||||
conversationListFragment.refreshData();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
|
||||
|
||||
@@ -20,7 +20,7 @@ public class CommonHttpConsts {
|
||||
public static final String DOWNLOAD_GIF = "downloadGif";
|
||||
public static final String GET_BALANCE = "getBalance";
|
||||
public static final String CHECK_TOKEN_INVALID = "checkTokenInvalid";
|
||||
public static final String NOTIFY_GOOGLE = "Charge.google_pay";
|
||||
public static final String NOTIFY_GOOGLE = "Charge.goole_validate_panduola";
|
||||
public static final String COMMUNITY_SETREPORT = "Community.setReport";
|
||||
|
||||
public static final String GET_USER_HOME = "getUserHome";
|
||||
|
||||
@@ -417,18 +417,15 @@ public class CommonHttpUtil {
|
||||
.params("purchaseToken", purchaseToken)
|
||||
.params("productId", productId)
|
||||
.params("orderno", orderno)
|
||||
.params("package_name", "com.pandora.sy")
|
||||
.params("package_name", CommonAppContext.sInstance.getPackageName())
|
||||
.execute(callback);
|
||||
}
|
||||
|
||||
public static void notifyGoogle(String purchaseToken, String orderNo, String tradeNo, String allData, String gps_adid, HttpCallback callback) {
|
||||
public static void notifyGoogle(String purchaseToken, String productId, HttpCallback callback) {
|
||||
HttpClient.getInstance().get(CommonHttpConsts.NOTIFY_GOOGLE, CommonHttpConsts.NOTIFY_GOOGLE)
|
||||
.params("purchaseToken", purchaseToken)
|
||||
.params("orderno", orderNo)
|
||||
.params("trade_no", tradeNo)
|
||||
.params("allData", allData)
|
||||
.params("gps_adid", gps_adid)
|
||||
.params("package_name", "com.pandora.sy")
|
||||
.params("productId", productId)
|
||||
.params("package_name", CommonAppContext.sInstance.getPackageName())
|
||||
.execute(callback);
|
||||
}
|
||||
|
||||
@@ -437,7 +434,7 @@ public class CommonHttpUtil {
|
||||
.params("purchaseToken", purchaseToken)
|
||||
.params("orderno", orderNo)
|
||||
.params("trade_no", tradeNo)
|
||||
.params("package_name", "com.pandora.sy")
|
||||
.params("package_name", CommonAppContext.sInstance.getPackageName())
|
||||
.execute(callback);
|
||||
}
|
||||
|
||||
|
||||
@@ -1198,7 +1198,7 @@ public interface PDLiveApi {
|
||||
@Query("open_off") int status
|
||||
);
|
||||
|
||||
@GET("/api/public/?service=Pdlmsg.sendBefore")
|
||||
@GET("/api/public/?service=Pdlmsg.sendBefore&new_pop=1")
|
||||
Observable<ResponseModel<MessageSayHiBean>> getMessageSayHiTimer(
|
||||
);
|
||||
|
||||
|
||||
@@ -0,0 +1,297 @@
|
||||
package com.yunbao.common.pay.google;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.util.Log;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import com.android.billingclient.api.BillingClient;
|
||||
import com.android.billingclient.api.BillingClientStateListener;
|
||||
import com.android.billingclient.api.BillingFlowParams;
|
||||
import com.android.billingclient.api.BillingResult;
|
||||
import com.android.billingclient.api.ConsumeParams;
|
||||
import com.android.billingclient.api.ProductDetails;
|
||||
import com.android.billingclient.api.Purchase;
|
||||
import com.android.billingclient.api.PurchasesUpdatedListener;
|
||||
import com.android.billingclient.api.QueryProductDetailsParams;
|
||||
import com.android.billingclient.api.QueryPurchasesParams;
|
||||
import com.google.android.gms.ads.identifier.AdvertisingIdClient;
|
||||
import com.google.android.gms.common.ConnectionResult;
|
||||
import com.google.android.gms.common.GoogleApiAvailability;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.yunbao.common.CommonAppContext;
|
||||
import com.yunbao.common.R;
|
||||
import com.yunbao.common.http.CommonHttpUtil;
|
||||
import com.yunbao.common.http.HttpCallback;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
//谷歌支付
|
||||
public class GooglePlay implements PurchasesUpdatedListener {
|
||||
|
||||
private String TAG = "mLog";
|
||||
private BillingClient billingClient;
|
||||
private GoogleBillingListener billingListener;
|
||||
|
||||
private GooglePlay() {
|
||||
init();
|
||||
}
|
||||
|
||||
private boolean init() {
|
||||
if (getGoogleService() && billingClient == null) {
|
||||
billingClient = BillingClient.newBuilder(CommonAppContext.sInstance)
|
||||
.setListener(this)
|
||||
.enablePendingPurchases()
|
||||
.build();
|
||||
startConnection();
|
||||
return true;
|
||||
}
|
||||
if (billingClient != null && !billingClient.isReady()) {//没有连接的话去连接
|
||||
startConnection();
|
||||
}
|
||||
if (billingClient == null)
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
private void startConnection() {
|
||||
if (!billingClient.isReady()) {
|
||||
//请求连接到GooglePay
|
||||
billingClient.startConnection(new BillingClientStateListener() {
|
||||
@Override
|
||||
public void onBillingSetupFinished(@NonNull BillingResult billingResult) {
|
||||
int code = billingResult.getResponseCode();
|
||||
if (code != BillingClient.BillingResponseCode.OK) {
|
||||
String msg = billingResult.getDebugMessage();
|
||||
Log.e(TAG, "连接到GooglePay失败 code = " + code + " msg = " + msg);
|
||||
return;
|
||||
}
|
||||
Log.e(TAG, "连接到GooglePay成功");
|
||||
}
|
||||
|
||||
//连接失败
|
||||
@Override
|
||||
public void onBillingServiceDisconnected() {
|
||||
Log.e(TAG, "连接到GooglePay失败,请重试");
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//点击商品,先查询商品 然后出来支付界面,调用下单
|
||||
public void purchase(Activity activity, String orderNumber, String id) {
|
||||
if (!init()) {
|
||||
return;
|
||||
}
|
||||
ImmutableList<QueryProductDetailsParams.Product> productList = ImmutableList.of(QueryProductDetailsParams.Product.newBuilder()
|
||||
.setProductId(id)
|
||||
.setProductType(BillingClient.ProductType.INAPP)
|
||||
.build());
|
||||
QueryProductDetailsParams queryProductDetailsParams =
|
||||
QueryProductDetailsParams.newBuilder()
|
||||
.setProductList(productList)
|
||||
.build();
|
||||
billingClient.queryProductDetailsAsync(
|
||||
queryProductDetailsParams,
|
||||
(billingResult, list) -> {
|
||||
//查询商品成功
|
||||
int code = billingResult.getResponseCode();
|
||||
if (code != BillingClient.BillingResponseCode.OK || list == null || list.isEmpty()) {
|
||||
String msg = billingResult.getDebugMessage();
|
||||
Log.e(TAG, "查询商品失败 code = " + code + " msg = " + msg);
|
||||
return;
|
||||
}
|
||||
Log.e(TAG, "查询商品成功");
|
||||
buyIt(activity, orderNumber, list.get(0));
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
//开始下单,准备生成订单了
|
||||
private void buyIt(Activity activity, String orderNumber, ProductDetails productDetails) {
|
||||
List<BillingFlowParams.ProductDetailsParams> productDetailsParamsList = new ArrayList<>();
|
||||
productDetailsParamsList.add(BillingFlowParams.ProductDetailsParams.newBuilder()
|
||||
// retrieve a value for "productDetails" by calling queryProductDetailsAsync()
|
||||
.setProductDetails(productDetails)
|
||||
// For one-time products, "setOfferToken" method shouldn't be called.
|
||||
// For subscriptions, to get an offer token, call
|
||||
// ProductDetails.subscriptionOfferDetails() for a list of offers
|
||||
// that are available to the user.
|
||||
//一次性商品不需要传token
|
||||
// .setOfferToken(selectedOfferToken)
|
||||
.build());
|
||||
|
||||
BillingFlowParams billingFlowParams = BillingFlowParams.newBuilder()
|
||||
.setProductDetailsParamsList(productDetailsParamsList)
|
||||
.setObfuscatedAccountId(orderNumber)//好像是账号id
|
||||
.build();
|
||||
|
||||
BillingResult billingResult = billingClient.launchBillingFlow(activity, billingFlowParams);
|
||||
int code = billingResult.getResponseCode();
|
||||
if (code != BillingClient.BillingResponseCode.OK) {
|
||||
String msg = billingResult.getDebugMessage();
|
||||
Log.e(TAG, "购买商品失败 code = " + code + " msg = " + msg);
|
||||
// ToastUtil.show(getString(R.string.pay_suc));
|
||||
return;
|
||||
}
|
||||
Log.e(TAG, "购买商品 " + productDetails.toString());
|
||||
}
|
||||
|
||||
//消耗商品 支付成功之后,调用我们后台下发商品成功之后,调用消耗
|
||||
public void consume(List<Purchase> list) {
|
||||
if (!init()) {
|
||||
return;
|
||||
}
|
||||
for (Purchase purchase : list) {
|
||||
getConsumeGoods(purchase);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 消耗所有商品
|
||||
*/
|
||||
public void consumeAll() {
|
||||
if (!init()) {
|
||||
return;
|
||||
}
|
||||
//以下示例展示了如何提取用户的订阅购买交易。请注意,queryPurchasesAsync() 仅返回有效订阅和非消耗型一次性购买交易。
|
||||
QueryPurchasesParams inAppPurchasesQuery = QueryPurchasesParams.newBuilder().setProductType(BillingClient.ProductType.INAPP).build();
|
||||
billingClient.queryPurchasesAsync(inAppPurchasesQuery, (billingResult, list) -> {
|
||||
if (BillingClient.BillingResponseCode.OK == billingResult.getResponseCode()) {
|
||||
for (Purchase purchase : list) {
|
||||
//0:PurchaseState.UNSPECIFIED_STATE:未知状态
|
||||
//1:PurchaseState.PURCHASED:付款完成
|
||||
//2:PurchaseState.PENDING:购买正在等待付款完成。
|
||||
if (Purchase.PurchaseState.PURCHASED == purchase.getPurchaseState()) {
|
||||
//调用google去消费
|
||||
//如果之后还出现谷歌掉单的行为在来处理
|
||||
CommonHttpUtil.notifyGoogle(purchase.getPurchaseToken(),
|
||||
purchase.getProducts().get(0), new HttpCallback() {
|
||||
@Override
|
||||
public void onSuccess(int code, String msg, String[] info) {
|
||||
if (code == 0) {
|
||||
getConsumeGoods(purchase);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 公共消费商品接口
|
||||
*/
|
||||
private void getConsumeGoods(Purchase purchase) {
|
||||
if (purchase != null) {
|
||||
Log.i(TAG, "-----开始消耗商品:" + purchase.toString());
|
||||
ConsumeParams.Builder consumeParams = ConsumeParams.newBuilder();
|
||||
consumeParams.setPurchaseToken(purchase.getPurchaseToken());
|
||||
//调用消耗商品方法
|
||||
consumeAsync(consumeParams.build(), purchase);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 消耗商品
|
||||
* int SERVICE_TIMEOUT = -3; //服务超时
|
||||
* int FEATURE_NOT_SUPPORTED = -2; //不支持功能
|
||||
* int SERVICE_DISCONNECTED = -1; //服务单元已断开
|
||||
* int OK = 0; //成功
|
||||
* int USER_CANCELED = 1; //用户按上一步或取消对话框
|
||||
* int SERVICE_UNAVAILABLE = 2; //网络连接断开
|
||||
* int BILLING_UNAVAILABLE = 3; //所请求的类型不支持 Google Play 结算服务 AIDL 版本
|
||||
* int ITEM_UNAVAILABLE = 4; //请求的商品已不再出售。
|
||||
* int DEVELOPER_ERROR = 5; //提供给 API 的参数无效。此错误也可能说明应用未针对结算服务正确签名或设置,或者在其清单中缺少必要的权限。
|
||||
* int ERROR = 6; //API 操作期间出现严重错误
|
||||
* int ITEM_ALREADY_OWNED = 7; //未能购买,因为已经拥有此商品
|
||||
* int ITEM_NOT_OWNED = 8; //未能消费,因为尚未拥有此商品
|
||||
*/
|
||||
private void consumeAsync(ConsumeParams consumeParams, Purchase purchase) {
|
||||
if (!init()) {
|
||||
return;
|
||||
}
|
||||
billingClient.consumeAsync(consumeParams, (billingResult, purchaseToken) -> {
|
||||
if (billingResult.getResponseCode() == BillingClient.BillingResponseCode.OK) {
|
||||
Log.i(TAG, "-----消耗商品成功");
|
||||
} else {
|
||||
Log.i(TAG, "-----消耗商品失败" + billingResult.toString() + "---" + purchaseToken + "--code:" + billingResult.getResponseCode());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPurchasesUpdated(@NonNull BillingResult billingResult, @Nullable List<Purchase> purchases) {
|
||||
if (billingResult.getResponseCode() == BillingClient.BillingResponseCode.OK
|
||||
&& purchases != null) {
|
||||
//支付成功
|
||||
if (billingListener != null)//消耗掉商品放到外面调用我们服务器成功的时候去消耗 todo 暂时注释掉 这样可以模拟掉单的问题
|
||||
billingListener.onPaySuccess(purchases);
|
||||
/*
|
||||
* 一旦您验证了购买交易,您的应用就可以向用户授予使用权了。若要确认与购买交易相关联的用户账号,
|
||||
* 您可以使用 Purchases.products:get 返回的 ProductPurchase.obfuscatedExternalAccountId(适用于应用内商品的购买交易)
|
||||
* 和 Purchases.subscriptions:get 返回的 SubscriptionPurchase.obfuscatedExternalAccountId(适用于服务器端的订阅),
|
||||
* 或者 Purchase.getAccountIdentifiers() 在客户端返回的 obfuscatedAccountId(如果在交易时已使用 setObfuscatedAccountId 设置该 ID)。
|
||||
* */
|
||||
// purchases.get(0).getAccountIdentifiers()
|
||||
for (Purchase purchase : purchases) {
|
||||
Log.d("mLog", "谷歌支付的回调 " + purchase);
|
||||
}
|
||||
} else if (billingResult.getResponseCode() == BillingClient.BillingResponseCode.USER_CANCELED) {
|
||||
//取消支付了
|
||||
if (billingListener != null)
|
||||
billingListener.onPayFailed(CommonAppContext.sInstance.getString(R.string.pay_cancel));
|
||||
} else {
|
||||
//支付失败
|
||||
if (billingListener != null)
|
||||
billingListener.onPayFailed(CommonAppContext.sInstance.getString(R.string.pay_fail));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 检测GooglePlay服务是否可用(需要导入包api "com.google.android.gms:play-services-location:11.8.0",也可以不检查,跳过这个代码)
|
||||
*/
|
||||
public boolean getGoogleService() {
|
||||
GoogleApiAvailability googleApiAvailability = GoogleApiAvailability.getInstance();
|
||||
if (googleApiAvailability != null) {
|
||||
int resultCode = googleApiAvailability.isGooglePlayServicesAvailable(CommonAppContext.sInstance);
|
||||
return resultCode == ConnectionResult.SUCCESS;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public String getAdId() {
|
||||
try {
|
||||
return AdvertisingIdClient.getAdvertisingIdInfo(CommonAppContext.sInstance).getId();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
Log.e("GooglePlay", "获取谷歌的id错误了");
|
||||
}
|
||||
return "google_default_id";
|
||||
}
|
||||
|
||||
public void setBillingListener(GoogleBillingListener listener) {
|
||||
billingListener = listener;
|
||||
}
|
||||
|
||||
/**
|
||||
* 定义接口返回支付结果
|
||||
*/
|
||||
public interface GoogleBillingListener {
|
||||
void onPaySuccess(List<Purchase> purchases);
|
||||
|
||||
void onPayFailed(String msg);
|
||||
}
|
||||
|
||||
public static class GooglePlayHelper {
|
||||
static GooglePlay googlePlay = new GooglePlay();
|
||||
}
|
||||
|
||||
public static GooglePlay getInstance() {
|
||||
return GooglePlayHelper.googlePlay;
|
||||
}
|
||||
}
|
||||
@@ -83,7 +83,7 @@ public class ProcessImageUtil extends ProcessResultUtil {
|
||||
if (mNeedCrop) {
|
||||
Uri uri = null;
|
||||
if (Build.VERSION.SDK_INT >= 24) {
|
||||
uri = FileProvider.getUriForFile(mContext, "com.pandora.sy.fileprovider", mCameraResult);
|
||||
uri = FileProvider.getUriForFile(mContext, mContext.getPackageName() +".fileprovider", mCameraResult);
|
||||
} else {
|
||||
uri = Uri.fromFile(mCameraResult);
|
||||
}
|
||||
@@ -195,7 +195,7 @@ public class ProcessImageUtil extends ProcessResultUtil {
|
||||
mCameraResult = getNewFile();
|
||||
Uri uri = null;
|
||||
if (Build.VERSION.SDK_INT >= 24) {
|
||||
uri = FileProvider.getUriForFile(mContext, "com.pandora.sy.fileprovider", mCameraResult);
|
||||
uri = FileProvider.getUriForFile(mContext, mContext.getPackageName()+".fileprovider", mCameraResult);
|
||||
intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION | Intent.FLAG_GRANT_WRITE_URI_PERMISSION);
|
||||
} else {
|
||||
uri = Uri.fromFile(mCameraResult);
|
||||
@@ -255,7 +255,7 @@ public class ProcessImageUtil extends ProcessResultUtil {
|
||||
startActivityForResult(intent, mCropResultCallback);
|
||||
} catch (Exception e) {
|
||||
try {
|
||||
Uri resultUri = FileProvider.getUriForFile(mContext, "com.pandora.sy.fileprovider", mCorpResult);
|
||||
Uri resultUri = FileProvider.getUriForFile(mContext, mContext.getPackageName()+".fileprovider", mCorpResult);
|
||||
if (resultUri == null || mFragment == null || mContext == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,198 @@
|
||||
package com.yunbao.common.utils;
|
||||
|
||||
import android.util.Log;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import io.rong.imkit.conversationlist.model.BaseUiConversation;
|
||||
import io.rong.imlib.model.Conversation;
|
||||
import io.rong.imlib.model.Message;
|
||||
|
||||
public class UiConversationCodeUtil {
|
||||
|
||||
|
||||
public static final int FILTER_OFFLINE = 0;
|
||||
public static final int FILTER_ONLINE = 1;
|
||||
public static final int FILTER_UNREAD = 2;
|
||||
public static final int FILTER_READ = 4;
|
||||
public static final int FILTER_ALL = 7;
|
||||
|
||||
|
||||
public static boolean checkIsSame(List<BaseUiConversation> list1, List<BaseUiConversation> list2) {
|
||||
if (list1.isEmpty()){
|
||||
return false;
|
||||
}
|
||||
if (list1.size() != list2.size()) return false;
|
||||
int hashCode1 = getListHasCode(list1);
|
||||
int hashCode2 = getListHasCode(list2);
|
||||
return hashCode1 == hashCode2;
|
||||
}
|
||||
|
||||
public static boolean checkIsSame(int hashCode1, List<BaseUiConversation> list2) {
|
||||
int hashCode2 = getListHasCode(list2);
|
||||
return hashCode1 == hashCode2;
|
||||
}
|
||||
|
||||
public static int getListHasCode(List<BaseUiConversation> list) {
|
||||
int hashCodeValue = 1;
|
||||
if (list == null || list.isEmpty())
|
||||
return 1;
|
||||
for (BaseUiConversation conversation : list) {
|
||||
if (conversation != null) {
|
||||
hashCodeValue = 31 * hashCodeValue + getBaseUiConversationHashCode(conversation);
|
||||
}
|
||||
}
|
||||
return hashCodeValue;
|
||||
}
|
||||
|
||||
|
||||
//根据BaseUiConversation对象的属性计算hashCode
|
||||
private static int getBaseUiConversationHashCode(BaseUiConversation item) {
|
||||
final int prime = 31;
|
||||
int result = 1;
|
||||
Conversation mCore = item.mCore;
|
||||
result = prime * result + ((mCore.getPortraitUrl() == null) ? 0 : mCore.getPortraitUrl().hashCode());
|
||||
result = prime * result + ((mCore.getConversationTitle() == null) ? 0 : mCore.getConversationTitle().hashCode());
|
||||
// result = prime * result + ((item.mConversationContent == null) ? 0 : item.mConversationContent.hashCode());
|
||||
result = prime * result + (int) (mCore.getSentTime() ^ (mCore.getSentTime() >>> 32));
|
||||
result = prime * result + ((mCore.getDraft() == null) ? 0 : mCore.getDraft().hashCode());
|
||||
result = prime * result + mCore.getUnreadMessageCount();
|
||||
|
||||
Message message = mCore.getMessage();
|
||||
if (message != null) {
|
||||
Message.MessageDirection direction = message.getMessageDirection();
|
||||
if (direction != null) {
|
||||
result = prime * result + direction.hashCode();
|
||||
}
|
||||
}
|
||||
|
||||
result = prime * result + ((mCore.getSentStatus() == null) ? 0 : mCore.getSentStatus().hashCode());
|
||||
result = prime * result + ((mCore.getReceivedStatus() == null) ? 0 : mCore.getReceivedStatus().hashCode());
|
||||
result = prime * result + ((mCore.getTargetId() == null) ? 0 : mCore.getTargetId().hashCode());
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
private static boolean isContains(List<BaseUiConversation> list, BaseUiConversation item) {
|
||||
// 根据 item.mCore.getChannelId() 判断 list 是否包含
|
||||
if (list == null || list.isEmpty() || item == null || item.mCore == null) {
|
||||
return false;
|
||||
}
|
||||
for (BaseUiConversation conversation : list) {
|
||||
// 增加空值检查
|
||||
if (conversation != null && conversation.mCore != null
|
||||
&& conversation.mCore.getTargetId() != null
|
||||
&& conversation.mCore.getTargetId().equals(item.mCore.getTargetId())) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public static List<BaseUiConversation> FilterData(int filterType, List<BaseUiConversation> keyList,List<BaseUiConversation> srcList) {
|
||||
List<BaseUiConversation> showData = new ArrayList<>();
|
||||
if (keyList == null || keyList.isEmpty())
|
||||
return showData;
|
||||
Log.i("MainConversationListAdapter", "FilterData: 源" + keyList.size());
|
||||
switch (filterType) {
|
||||
case FILTER_ALL:
|
||||
showData = keyList;
|
||||
break;
|
||||
case FILTER_ONLINE:
|
||||
for (BaseUiConversation conversation : srcList) {
|
||||
if ("0".equals(conversation.mCore.getDraft()) && isContains(keyList, conversation)) {
|
||||
showData.add(conversation);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case FILTER_OFFLINE:
|
||||
for (BaseUiConversation conversation : keyList) {
|
||||
if (!"0".equals(conversation.mCore.getDraft())) {
|
||||
showData.add(conversation);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case FILTER_READ:
|
||||
for (BaseUiConversation conversation : keyList)
|
||||
if (conversation.mCore.getMessage() != null && conversation.mCore.getMessage().getMessageDirection() != null) {
|
||||
if (conversation.mCore.getMessage().getMessageDirection() == Message.MessageDirection.SEND) {
|
||||
if (conversation.mCore.getSentStatus() == Message.SentStatus.READ) {
|
||||
showData.add(conversation);
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
case FILTER_UNREAD:
|
||||
for (BaseUiConversation conversation : keyList) {
|
||||
boolean isRead;
|
||||
if (conversation.mCore.getMessage() != null && conversation.mCore.getMessage().getMessageDirection() != null) {
|
||||
if (conversation.mCore.getMessage().getMessageDirection() == Message.MessageDirection.SEND) {
|
||||
if (conversation.mCore.getSentStatus() != Message.SentStatus.READ) {
|
||||
showData.add(conversation);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
Log.i("MainConversationListAdapter", "FilterData: 结果" + showData.size());
|
||||
return showData;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
public static List<BaseUiConversation> FilterData(int filterType, List<BaseUiConversation> data) {
|
||||
List<BaseUiConversation> showData = new ArrayList<>();
|
||||
if (data == null || data.isEmpty())
|
||||
return showData;
|
||||
Log.i("MainConversationListAdapter", "设置数据源 FilterData: 源" + data.size());
|
||||
switch (filterType) {
|
||||
case FILTER_ALL:
|
||||
showData = data;
|
||||
break;
|
||||
case FILTER_ONLINE:
|
||||
for (BaseUiConversation conversation : data) {
|
||||
if ("0".equals(conversation.mCore.getDraft())) {
|
||||
showData.add(conversation);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case FILTER_OFFLINE:
|
||||
for (BaseUiConversation conversation : data) {
|
||||
if (!"0".equals(conversation.mCore.getDraft())) {
|
||||
showData.add(conversation);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case FILTER_READ:
|
||||
for (BaseUiConversation conversation : data)
|
||||
if (conversation.mCore.getMessage() != null && conversation.mCore.getMessage().getMessageDirection() != null) {
|
||||
if (conversation.mCore.getMessage().getMessageDirection() == Message.MessageDirection.SEND) {
|
||||
if (conversation.mCore.getSentStatus() == Message.SentStatus.READ) {
|
||||
showData.add(conversation);
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
case FILTER_UNREAD:
|
||||
for (BaseUiConversation conversation : data) {
|
||||
if (conversation.mCore.getMessage() != null && conversation.mCore.getMessage().getMessageDirection() != null) {
|
||||
if (conversation.mCore.getMessage().getMessageDirection() == Message.MessageDirection.SEND) {
|
||||
if (conversation.mCore.getSentStatus() != Message.SentStatus.READ) {
|
||||
showData.add(conversation);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
Log.i("MainConversationListAdapter", " 设置数据源 FilterData: 结果" + showData.size());
|
||||
return showData;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -63,7 +63,7 @@ public class VersionUtil {
|
||||
@Override
|
||||
public void onConfirmClick(Dialog dialog, String content) {
|
||||
Intent i = new Intent(android.content.Intent.ACTION_VIEW);
|
||||
i.setData(Uri.parse("https://play.google.com/store/apps/details?id=com.pandora.sy"));
|
||||
i.setData(Uri.parse("https://play.google.com/store/apps/details?id="+context.getPackageName()));
|
||||
context.startActivity(i);
|
||||
context.finish();
|
||||
}
|
||||
@@ -85,7 +85,7 @@ public class VersionUtil {
|
||||
@Override
|
||||
public void onConfirmClick(Dialog dialog, String content) {
|
||||
Intent i = new Intent(android.content.Intent.ACTION_VIEW);
|
||||
i.setData(Uri.parse("https://play.google.com/store/apps/details?id=com.pandora.sy"));
|
||||
i.setData(Uri.parse("https://play.google.com/store/apps/details?id="+context.getPackageName()));
|
||||
context.startActivity(i);
|
||||
context.finish();
|
||||
}
|
||||
|
||||
@@ -128,7 +128,7 @@ public class APKUpdateCustomPopup extends CenterPopupView {
|
||||
public void onViewClicks() {
|
||||
if (CommonAppConfig.IS_GOOGLE_PLAY == 1) {
|
||||
Intent i = new Intent(android.content.Intent.ACTION_VIEW);
|
||||
i.setData(Uri.parse("https://play.google.com/store/apps/details?id=com.pandora.sy"));
|
||||
i.setData(Uri.parse("https://play.google.com/store/apps/details?id="+mContext.getPackageName()));
|
||||
mContext.startActivity(i);
|
||||
mContext.finish();
|
||||
} else if (CommonAppConfig.IS_GOOGLE_PLAY == 2) {
|
||||
|
||||
@@ -0,0 +1,122 @@
|
||||
package com.yunbao.common.views;
|
||||
|
||||
import static io.rong.imlib.publicservice.model.PublicServiceMenu.PublicServiceMenuItemType.View;
|
||||
|
||||
import android.content.Context;
|
||||
import android.util.DisplayMetrics;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.core.content.ContextCompat;
|
||||
|
||||
import com.lxj.xpopup.core.AttachPopupView;
|
||||
import com.yunbao.common.R;
|
||||
import com.yunbao.common.adapter.MainConversationListAdapter;
|
||||
import com.yunbao.common.utils.DpUtil;
|
||||
import com.yunbao.common.views.weight.ViewClicksAntiShake;
|
||||
|
||||
import org.repackage.com.zui.opendeviceidlibrary.OpenDeviceId;
|
||||
|
||||
public class MsgChatTypeSelectPoPupView extends AttachPopupView implements android.view.View.OnClickListener {
|
||||
|
||||
private TextView chatTypeTv1, chatTypeTv2, chatTypeTv3, chatTypeTv4, chatTypeTv5;
|
||||
private ImageView chatTypeImg1, chatTypeImg2, chatTypeImg3, chatTypeImg4, chatTypeImg5;
|
||||
|
||||
private ResultCallBack mResultCallBack;
|
||||
private int lastType;
|
||||
|
||||
public MsgChatTypeSelectPoPupView(@NonNull Context context, int type, ResultCallBack itemDelListener) {
|
||||
super(context);
|
||||
mResultCallBack = itemDelListener;
|
||||
lastType = type;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected int getImplLayoutId() {
|
||||
return R.layout.view_msg_select_chat_type;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onCreate() {
|
||||
|
||||
// 获取屏幕宽度
|
||||
DisplayMetrics displayMetrics = getContext().getResources().getDisplayMetrics();
|
||||
int screenWidth = displayMetrics.widthPixels;
|
||||
|
||||
// 设置弹窗宽度为屏幕宽度的 3/4
|
||||
View view = findViewById(R.id.root);
|
||||
ViewGroup.LayoutParams layoutParams = view.getLayoutParams();
|
||||
layoutParams.width = screenWidth*3/4;
|
||||
view.setLayoutParams(layoutParams);
|
||||
|
||||
chatTypeTv1 = findViewById(R.id.chatTypeTv1);
|
||||
chatTypeImg1 = findViewById(R.id.chatTypeImg1);
|
||||
chatTypeTv2 = findViewById(R.id.chatTypeTv2);
|
||||
chatTypeImg2 = findViewById(R.id.chatTypeImg2);
|
||||
chatTypeTv3 = findViewById(R.id.chatTypeTv3);
|
||||
chatTypeImg3 = findViewById(R.id.chatTypeImg3);
|
||||
chatTypeTv4 = findViewById(R.id.chatTypeTv4);
|
||||
chatTypeImg4 = findViewById(R.id.chatTypeImg4);
|
||||
chatTypeTv5 = findViewById(R.id.chatTypeTv5);
|
||||
chatTypeImg5 = findViewById(R.id.chatTypeImg5);
|
||||
|
||||
chatTypeImg1.setOnClickListener(this);
|
||||
chatTypeImg2.setOnClickListener(this);
|
||||
chatTypeImg3.setOnClickListener(this);
|
||||
chatTypeImg4.setOnClickListener(this);
|
||||
chatTypeImg5.setOnClickListener(this);
|
||||
|
||||
handleChatTypeClick(lastType);
|
||||
}
|
||||
|
||||
|
||||
private void handleChatTypeClick(int type) {
|
||||
switch (type) {
|
||||
case MainConversationListAdapter.FILTER_ALL:
|
||||
chatTypeImg1.setImageResource(R.mipmap.ic_chat_type_select);
|
||||
chatTypeTv1.setTextColor(ContextCompat.getColor(chatTypeTv1.getContext(), R.color.colorMainTab));
|
||||
break;
|
||||
case MainConversationListAdapter.FILTER_ONLINE:
|
||||
chatTypeImg2.setImageResource(R.mipmap.ic_chat_type_select);
|
||||
chatTypeTv2.setTextColor(ContextCompat.getColor(chatTypeTv2.getContext(), R.color.colorMainTab));
|
||||
break;
|
||||
case MainConversationListAdapter.FILTER_OFFLINE:
|
||||
chatTypeImg3.setImageResource(R.mipmap.ic_chat_type_select);
|
||||
chatTypeTv3.setTextColor(ContextCompat.getColor(chatTypeTv3.getContext(), R.color.colorMainTab));
|
||||
break;
|
||||
case MainConversationListAdapter.FILTER_READ:
|
||||
chatTypeImg4.setImageResource(R.mipmap.ic_chat_type_select);
|
||||
chatTypeTv4.setTextColor(ContextCompat.getColor(chatTypeTv4.getContext(), R.color.colorMainTab));
|
||||
break;
|
||||
case MainConversationListAdapter.FILTER_UNREAD:
|
||||
chatTypeImg5.setImageResource(R.mipmap.ic_chat_type_select);
|
||||
chatTypeTv5.setTextColor(ContextCompat.getColor(chatTypeTv5.getContext(), R.color.colorMainTab));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClick(android.view.View v) {
|
||||
if (v.getId() == R.id.chatTypeImg1) {
|
||||
mResultCallBack.callBack(MainConversationListAdapter.FILTER_ALL, chatTypeTv1.getText().toString());
|
||||
} else if (v.getId() == R.id.chatTypeImg2) {
|
||||
mResultCallBack.callBack(MainConversationListAdapter.FILTER_ONLINE, chatTypeTv2.getText().toString());
|
||||
} else if (v.getId() == R.id.chatTypeImg3) {
|
||||
mResultCallBack.callBack(MainConversationListAdapter.FILTER_OFFLINE, chatTypeTv3.getText().toString());
|
||||
} else if (v.getId() == R.id.chatTypeImg4) {
|
||||
mResultCallBack.callBack(MainConversationListAdapter.FILTER_READ, chatTypeTv4.getText().toString());
|
||||
} else if (v.getId() == R.id.chatTypeImg5) {
|
||||
mResultCallBack.callBack(MainConversationListAdapter.FILTER_UNREAD, chatTypeTv5.getText().toString());
|
||||
}
|
||||
dismiss();
|
||||
}
|
||||
|
||||
|
||||
public interface ResultCallBack {
|
||||
void callBack(int i, String string);
|
||||
}
|
||||
}
|
||||
11
common/src/main/res/drawable/green_dot.xml
Normal file
11
common/src/main/res/drawable/green_dot.xml
Normal file
@@ -0,0 +1,11 @@
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="oval"> <!-- 设置形状为圆形 -->
|
||||
|
||||
<solid android:color="#6DFF7C" /> <!-- 设置填充颜色 -->
|
||||
|
||||
<!-- 可以添加额外的属性如边框等 -->
|
||||
<!-- <stroke
|
||||
android:width="2dp"
|
||||
android:color="#000000" /> -->
|
||||
|
||||
</shape>
|
||||
10
common/src/main/res/drawable/red_dot.xml
Normal file
10
common/src/main/res/drawable/red_dot.xml
Normal file
@@ -0,0 +1,10 @@
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="oval"> <!-- 设置形状为圆形 -->
|
||||
|
||||
<solid android:color="#ffff4874" /> <!-- 设置填充颜色 -->
|
||||
|
||||
<stroke
|
||||
android:width="2dp"
|
||||
android:color="#30ff4874" /> <!-- 设置边框颜色为黑色并带有 70% 的不透明度 (BB 是 alpha 值) -->
|
||||
|
||||
</shape>
|
||||
6
common/src/main/res/drawable/shape_white.xml
Normal file
6
common/src/main/res/drawable/shape_white.xml
Normal file
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<corners android:radius="20dp"/>
|
||||
<solid android:color="@color/white"/>
|
||||
|
||||
</shape>
|
||||
29
common/src/main/res/layout/rc_conversation_type_item.xml
Normal file
29
common/src/main/res/layout/rc_conversation_type_item.xml
Normal file
@@ -0,0 +1,29 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:id="@+id/rc_conversation_item"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/chatTypeTv"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="20dp"
|
||||
android:layout_marginTop="10dp"
|
||||
android:layout_marginBottom="10dp"
|
||||
android:layout_weight="1"
|
||||
android:textColor="@color/colorMainTab"
|
||||
tools:text="全部聊天" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/chatTypeImg"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_marginEnd="20dp"
|
||||
android:src="@mipmap/ic_chat_type_select" />
|
||||
|
||||
</LinearLayout>
|
||||
@@ -14,7 +14,6 @@
|
||||
android:id="@+id/rc_conversation_portrait_rl"
|
||||
android:layout_width="48dp"
|
||||
android:layout_height="48dp"
|
||||
|
||||
android:layout_marginTop="@dimen/rc_margin_size_12"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
@@ -180,6 +179,7 @@
|
||||
android:layout_marginBottom="@dimen/rc_margin_size_12"
|
||||
android:src="@drawable/rc_read_receipt"
|
||||
android:visibility="gone"
|
||||
tools:visibility="visible"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toStartOf="@+id/rc_conversation_no_disturb"
|
||||
app:layout_goneMarginRight="@dimen/rc_margin_size_12" />
|
||||
|
||||
159
common/src/main/res/layout/rc_conversationlist_item2.xml
Normal file
159
common/src/main/res/layout/rc_conversationlist_item2.xml
Normal file
@@ -0,0 +1,159 @@
|
||||
<?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">
|
||||
|
||||
<com.yunbao.common.views.weight.ClipPathCircleImage
|
||||
android:id="@+id/rc_conversation_portrait"
|
||||
android:layout_width="54dp"
|
||||
android:layout_height="54dp"
|
||||
android:layout_marginTop="12dp"
|
||||
android:scaleType="centerCrop"
|
||||
android:src="@mipmap/beauty_jingbai"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/rc_conversation_live_online"
|
||||
android:layout_width="12dp"
|
||||
android:layout_height="12dp"
|
||||
android:layout_marginTop="1dp"
|
||||
android:layout_marginEnd="1dp"
|
||||
android:layout_centerInParent="true"
|
||||
android:src="@drawable/green_dot"
|
||||
app:layout_constraintEnd_toEndOf="@+id/rc_conversation_portrait"
|
||||
app:layout_constraintTop_toTopOf="@+id/rc_conversation_portrait" />
|
||||
|
||||
|
||||
<TextView
|
||||
android:id="@+id/rc_conversation_title"
|
||||
style="@style/TextStyle.Alignment"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="12dp"
|
||||
android:layout_marginTop="4dp"
|
||||
android:ellipsize="end"
|
||||
android:maxWidth="120dp"
|
||||
android:maxLines="1"
|
||||
android:textColor="@color/rc_text_main_color"
|
||||
android:textSize="13dp"
|
||||
app:layout_constraintStart_toEndOf="@+id/rc_conversation_portrait"
|
||||
app:layout_constraintTop_toTopOf="@+id/rc_conversation_portrait"
|
||||
tools:text="张三11111111111111111111111" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/rc_conversation_live_status"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@drawable/bg_main_message_chat_list_live_timer"
|
||||
android:paddingStart="5dp"
|
||||
android:paddingTop="2dp"
|
||||
android:paddingEnd="3dp"
|
||||
android:paddingBottom="3dp"
|
||||
android:singleLine="true"
|
||||
android:textColor="#EC70FD"
|
||||
android:layout_marginStart="12dp"
|
||||
android:textSize="10sp"
|
||||
app:layout_constraintTop_toTopOf="@+id/rc_conversation_title"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/rc_conversation_title"
|
||||
app:layout_constraintStart_toEndOf="@+id/rc_conversation_title"
|
||||
android:visibility="gone"
|
||||
tools:text="看直播10min"
|
||||
tools:visibility="visible" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/rc_conversation_date"
|
||||
style="@style/TextStyle.Alignment"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="3 月 22 日"
|
||||
android:layout_marginEnd="12dp"
|
||||
app:layout_constraintTop_toTopOf="@+id/rc_conversation_title"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/rc_conversation_title"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
android:textColor="@color/rc_auxiliary_color"
|
||||
android:textSize="@dimen/rc_font_nav_or_date_size"
|
||||
|
||||
/>
|
||||
|
||||
|
||||
<TextView
|
||||
android:id="@+id/rc_conversation_unread_tv"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_marginBottom="4dp"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/rc_conversation_portrait"
|
||||
android:layout_height="wrap_content"
|
||||
app:layout_constraintStart_toStartOf="@+id/rc_conversation_title"
|
||||
android:ellipsize="end"
|
||||
android:maxLines="1"
|
||||
tools:text="[已读]"
|
||||
app:layout_constraintEnd_toStartOf="@id/rc_conversation_content"
|
||||
android:layout_marginEnd="6dp"
|
||||
android:visibility="gone"
|
||||
tools:visibility="visible"
|
||||
android:textColor="@color/rc_secondary_color"
|
||||
android:textSize="13dp" />
|
||||
|
||||
|
||||
<TextView
|
||||
android:id="@+id/rc_conversation_content"
|
||||
style="@style/TextStyle.Alignment"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingEnd="6dp"
|
||||
android:ellipsize="end"
|
||||
android:maxLines="1"
|
||||
android:textColor="@color/rc_secondary_color"
|
||||
android:textSize="13dp"
|
||||
app:layout_constraintEnd_toStartOf="@+id/rc_conversation_read_receipt"
|
||||
app:layout_constraintHorizontal_bias="0.0"
|
||||
app:layout_constraintStart_toEndOf="@+id/rc_conversation_unread_tv"
|
||||
android:layout_marginBottom="4dp"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/rc_conversation_portrait"
|
||||
tools:text="你好,朋友!111111111111111111111" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/rc_conversation_unread_count"
|
||||
app:layout_constraintTop_toTopOf="@+id/rc_conversation_content"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/rc_conversation_content"
|
||||
app:layout_constraintEnd_toEndOf="@+id/rc_conversation_date"
|
||||
style="@style/TextStyle.Alignment"
|
||||
app:layout_constraintDimensionRatio="1"
|
||||
android:layout_width="18dp"
|
||||
android:gravity="center"
|
||||
android:layout_height="18dp"
|
||||
android:background="@drawable/red_dot"
|
||||
android:text="15"
|
||||
android:textColor="@color/rc_white_color"
|
||||
android:textSize="10sp" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/rc_conversation_no_disturb"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_marginEnd="@dimen/rc_margin_size_2"
|
||||
android:layout_height="wrap_content"
|
||||
app:layout_constraintTop_toTopOf="@+id/rc_conversation_unread_count"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/rc_conversation_unread_count"
|
||||
app:layout_constraintEnd_toStartOf="@+id/rc_conversation_unread_count"
|
||||
android:src="@drawable/rc_no_disturb"
|
||||
android:visibility="gone"
|
||||
tools:visibility="visible" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/rc_conversation_read_receipt"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="@dimen/rc_margin_size_2"
|
||||
android:src="@drawable/rc_read_receipt"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/rc_conversation_no_disturb"
|
||||
app:layout_constraintEnd_toStartOf="@+id/rc_conversation_no_disturb"
|
||||
app:layout_constraintTop_toTopOf="@+id/rc_conversation_no_disturb"
|
||||
app:layout_constraintVertical_bias="1.0"
|
||||
tools:visibility="visible" />
|
||||
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
139
common/src/main/res/layout/view_msg_select_chat_type.xml
Normal file
139
common/src/main/res/layout/view_msg_select_chat_type.xml
Normal file
@@ -0,0 +1,139 @@
|
||||
<?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/root"
|
||||
android:layout_width="200dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@drawable/shape_white">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/chatTypeTv1"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="24dp"
|
||||
android:layout_marginTop="22dp"
|
||||
android:layout_weight="1"
|
||||
android:text="@string/all_chats"
|
||||
android:textColor="#777777"
|
||||
android:textSize="15sp"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
tools:textColor="@color/colorMainTab" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/chatTypeImg1"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_marginEnd="20dp"
|
||||
android:padding="5dp"
|
||||
android:src="@mipmap/ic_chat_type_unselect"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/chatTypeTv1"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="@+id/chatTypeTv1"
|
||||
tools:src="@mipmap/ic_chat_type_select" />
|
||||
|
||||
|
||||
<TextView
|
||||
android:id="@+id/chatTypeTv2"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="24dp"
|
||||
android:layout_marginTop="22dp"
|
||||
android:layout_weight="1"
|
||||
android:text="@string/online_only"
|
||||
android:textColor="#777777"
|
||||
android:textSize="15sp"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/chatTypeTv1" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/chatTypeImg2"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:padding="5dp"
|
||||
android:src="@mipmap/ic_chat_type_unselect"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/chatTypeTv2"
|
||||
app:layout_constraintEnd_toEndOf="@+id/chatTypeImg1"
|
||||
app:layout_constraintTop_toTopOf="@+id/chatTypeTv2" />
|
||||
|
||||
|
||||
<TextView
|
||||
android:id="@+id/chatTypeTv3"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="24dp"
|
||||
android:layout_marginTop="22dp"
|
||||
android:layout_weight="1"
|
||||
android:text="@string/offline_only"
|
||||
android:textColor="#777777"
|
||||
android:textSize="15sp"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/chatTypeTv2" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/chatTypeImg3"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:padding="5dp"
|
||||
android:src="@mipmap/ic_chat_type_unselect"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/chatTypeTv3"
|
||||
app:layout_constraintEnd_toEndOf="@+id/chatTypeImg1"
|
||||
app:layout_constraintTop_toTopOf="@+id/chatTypeTv3" />
|
||||
|
||||
|
||||
<TextView
|
||||
android:id="@+id/chatTypeTv4"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="24dp"
|
||||
android:layout_marginTop="22dp"
|
||||
android:layout_weight="1"
|
||||
android:text="@string/read_only"
|
||||
android:textColor="#777777"
|
||||
android:textSize="15sp"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/chatTypeTv3" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/chatTypeImg4"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:padding="5dp"
|
||||
android:src="@mipmap/ic_chat_type_unselect"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/chatTypeTv4"
|
||||
app:layout_constraintEnd_toEndOf="@+id/chatTypeImg1"
|
||||
app:layout_constraintTop_toTopOf="@+id/chatTypeTv4" />
|
||||
|
||||
|
||||
<TextView
|
||||
android:id="@+id/chatTypeTv5"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="24dp"
|
||||
android:layout_marginTop="22dp"
|
||||
android:layout_marginBottom="20dp"
|
||||
android:layout_weight="1"
|
||||
android:text="@string/unread_only"
|
||||
android:textColor="#777777"
|
||||
android:textSize="15sp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/chatTypeTv4" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/chatTypeImg5"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:padding="5dp"
|
||||
android:src="@mipmap/ic_chat_type_unselect"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/chatTypeTv5"
|
||||
app:layout_constraintEnd_toEndOf="@+id/chatTypeImg1"
|
||||
app:layout_constraintTop_toTopOf="@+id/chatTypeTv5" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
BIN
common/src/main/res/mipmap-mdpi/ic_chat_type_select.png
Normal file
BIN
common/src/main/res/mipmap-mdpi/ic_chat_type_select.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 642 B |
BIN
common/src/main/res/mipmap-mdpi/ic_chat_type_unselect.png
Normal file
BIN
common/src/main/res/mipmap-mdpi/ic_chat_type_unselect.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 542 B |
BIN
common/src/main/res/mipmap-xxhdpi/ic_chat_type_select.png
Normal file
BIN
common/src/main/res/mipmap-xxhdpi/ic_chat_type_select.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 2.6 KiB |
BIN
common/src/main/res/mipmap-xxhdpi/ic_chat_type_unselect.png
Normal file
BIN
common/src/main/res/mipmap-xxhdpi/ic_chat_type_unselect.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 2.1 KiB |
BIN
common/src/main/res/mipmap-xxxhdpi/ic_chat_type_select.png
Normal file
BIN
common/src/main/res/mipmap-xxxhdpi/ic_chat_type_select.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 2.0 KiB |
BIN
common/src/main/res/mipmap-xxxhdpi/ic_chat_type_unselect.png
Normal file
BIN
common/src/main/res/mipmap-xxxhdpi/ic_chat_type_unselect.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.7 KiB |
@@ -1489,4 +1489,11 @@ Limited ride And limited avatar frame</string>
|
||||
<string name="live_data_tip">* Non-real-time calculation of data</string>
|
||||
<string name="live_data_msg2">Historical data can be viewed in the anchor center</string>
|
||||
<string name="live_data_msg1">This live information</string>
|
||||
<string name="message_chat_msg_read_tip">[Read]</string>
|
||||
<string name="message_chat_msg_unread_tip">[Unread]</string>
|
||||
<string name="all_chats">All Chats</string>
|
||||
<string name="online_only">Show Online </string>
|
||||
<string name="offline_only">Show Offline </string>
|
||||
<string name="read_only">Show Read </string>
|
||||
<string name="unread_only">Show Unread </string>
|
||||
</resources>
|
||||
|
||||
@@ -1619,4 +1619,11 @@
|
||||
<string name="live_data_msg2">歷史數據可在主播中心查看</string>
|
||||
<string name="live_data_msg1">本場直播信息</string>
|
||||
|
||||
<string name="message_chat_msg_read_tip">[已讀]</string>
|
||||
<string name="message_chat_msg_unread_tip">[未讀]</string>
|
||||
<string name="all_chats">全部聊天</string>
|
||||
<string name="online_only">僅展示在線</string>
|
||||
<string name="offline_only">僅展示離線</string>
|
||||
<string name="read_only">展示對方已讀</string>
|
||||
<string name="unread_only">展示對方未讀</string>
|
||||
</resources>
|
||||
|
||||
@@ -1427,4 +1427,11 @@ Limited ride And limited avatar frame</string>
|
||||
<string name="live_data_tip">* Non-real-time calculation of data</string>
|
||||
<string name="live_data_msg2">Historical data can be viewed in the anchor center</string>
|
||||
<string name="live_data_msg1">This live information</string>
|
||||
<string name="message_chat_msg_read_tip">[Read]</string>
|
||||
<string name="message_chat_msg_unread_tip">[Unread]</string>
|
||||
<string name="all_chats">All Chats</string>
|
||||
<string name="online_only">Show Online </string>
|
||||
<string name="offline_only">Show Offline </string>
|
||||
<string name="read_only">Show Read </string>
|
||||
<string name="unread_only">Show Unread </string>
|
||||
</resources>
|
||||
|
||||
Reference in New Issue
Block a user