Commit 21228e69 authored by jianglx's avatar jianglx

上传im添加好友功能 2019-12-16

parent 79bd3ca0
......@@ -56,7 +56,9 @@
android:name=".CustomerListActivity"
android:launchMode="singleTask"
android:screenOrientation="portrait" />
<activity android:name=".AddressListActivity"></activity>
<activity android:name=".AddressListActivity" />
<activity android:name=".AddFriendActivity" />
<activity android:name=".NewFriendActivity"></activity>
</application>
</manifest>
\ No newline at end of file
package com.rv.im;
import android.content.Intent;
import android.os.Bundle;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.text.TextUtils;
import android.widget.Button;
import android.widget.EditText;
import android.widget.LinearLayout;
import com.ruiwenliu.wrapper.base.BaseBean;
import com.ruiwenliu.wrapper.base.BaseStatusActivity;
import com.ruiwenliu.wrapper.weight.TitleView;
import com.rv.im.adapter.FriendSearchListAdapter;
import com.rv.im.bean.AddResultBean;
import com.rv.im.bean.FriendSearchBean;
import com.rv.im.db.service.FriendServiceImp;
import com.rv.im.db.table.ChatMessage;
import com.rv.im.presenter.AddFriendPresenter;
import com.rv.im.xmpp.listener.NewFriendListener;
/*******
*
* 添加好友功能
*
*/
public class AddFriendActivity extends BaseStatusActivity<AddFriendPresenter> implements NewFriendListener {
private EditText edtSearch;
private Button btnSearch;
private RecyclerView recyclerview;
private FriendSearchListAdapter adapter;
private String mKeyWord;
private String userId;
private String userName;
private String addhaoyouid = null;
@Override
protected int setLayout() {
return R.layout.activity_add_friend;
}
@Override
protected void initView(Bundle savedInstanceState, TitleView titleView, Intent intent) {
titleView.setTitle("添加好友");
btnSearch = findViewById(R.id.btn_search);
edtSearch = findViewById(R.id.edt_search);
recyclerview = findViewById(R.id.recyclerview);
recyclerview.setLayoutManager(new LinearLayoutManager(this, LinearLayout.VERTICAL, false));
adapter = new FriendSearchListAdapter(null);
adapter.setListener(new FriendSearchListAdapter.FriendItemClickListener() {
@Override
public void showDetail(FriendSearchBean.FriendSearItemBean item) {
}
@Override
public void add(FriendSearchBean.FriendSearItemBean item) {
userId = item.getUserId();
userName = item.getNickname();
int fromAddType;
if (!TextUtils.isEmpty(userName) && userName.contains(mKeyWord)) {
fromAddType = 5;
} else {
// 昵称不包含关键字的话就是通过手机号搜索出来的,
fromAddType = 4;
}
mPresenter.addFriend(userId, fromAddType);
}
});
recyclerview.setAdapter(adapter);
btnSearch.setOnClickListener(v -> {
mKeyWord = edtSearch.getText().toString().trim();
mPresenter.search(mKeyWord);
});
}
private int isyanzheng = 0;// 该好友是否需要验证
@Override
public void onShowResult(int requestType, BaseBean result) {
switch (requestType) {
case 0:
FriendSearchBean searchBean = (FriendSearchBean) result;
if (searchBean != null && searchBean.resultCode == 1 && searchBean.getData() != null && searchBean.getData().size() > 0) {
adapter.setNewData(searchBean.getData());
}
break;
case 1:
AddResultBean addResultBean = (AddResultBean) result;
if (addResultBean.resultCode == 1 && addResultBean.getData() != null) {
if (addResultBean.getData().getType() == 1 || addResultBean.getData().getType() == 3) {
isyanzheng = 0;// 需要验证
// 需要验证就发送打招呼的消息,
showToast("打招呼成功,静候回音");
mPresenter.doSayHello(null, userName, userId);
} else if (addResultBean.getData().getType() == 2 || addResultBean.getData().getType() == 4) {// 已经是好友了
isyanzheng = 1;// 不需要验证
// 在会员列表添加一条会员,里面内容为成功添加好友。
// NewFriendMessage message = NewFriendMessage.createWillSendMessage(
// coreManager.getSelf(), XmppMessage.TYPE_FRIEND, null, mUser);
// NewFriendDao.getInstance().createOrUpdateNewFriend(message);
// // 不需要验证的话直接加上,就发个xmpp消息,
// // 这里最终调用smack的方法发送xmpp消息,
// coreManager.sendNewFriendMessage(mUser.getUserId(), message);
// 数据库中添加好友
new FriendServiceImp(this).addMessage(mPresenter.buildAddFriendMessage(userId, userName, 2));
ChatMessage message = mPresenter.doSayAddFriend(userName, userId);
addhaoyouid = message != null ? message.getPackId() : "";
showToast("好友添加成功");
} else if (addResultBean.getData().getType() == 5) {
showToast(getString(R.string.add_attention_failed));
}
}
break;
}
}
@Override
public void onNewFriendSendStateChange(String toUserId, ChatMessage message, int messageState) {
}
@Override
public boolean onNewFriend(ChatMessage message) {
return false;
}
}
......@@ -55,6 +55,20 @@ public class AddressListActivity extends BaseStatusActivity<AddressPresenter> {
super.loadData(savedInstanceState, intent);
mPresenter.initAddress(lists);
adapter = new AddressListAdapter(lists);
adapter.setListener((AddressListAdapter.OnItemClickListener<ContactsBean.ContactItemBean>) (position, bean) -> {
Intent in;
if (position == 0) {
in = new Intent(AddressListActivity.this, CustomerListActivity.class);
startActivityForResult(in, 1000);
} else if (position == 1) {
} else if (position == 2) {
in = new Intent(AddressListActivity.this,NewFriendActivity.class) ;
startActivity(in);
} else {
}
});
recyclerView.setAdapter(adapter);
}
......@@ -71,6 +85,7 @@ public class AddressListActivity extends BaseStatusActivity<AddressPresenter> {
lists.clear();
lists.addAll(bean.getData());
Collections.sort(lists);
mPresenter.addTopDatas(lists);
adapter.setNewData(lists);
adapter.notifyDataSetChanged();
}
......
package com.rv.im;
import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.LinearLayout;
import com.ruiwenliu.wrapper.base.BaseBean;
import com.ruiwenliu.wrapper.base.BaseStatusActivity;
import com.ruiwenliu.wrapper.weight.TitleView;
import com.rv.im.presenter.NewFriendPresenter;
/*********
*
* 新朋友activity
*
*/
public class NewFriendActivity extends BaseStatusActivity<NewFriendPresenter> {
private LinearLayout llSearch;
@Override
public void onShowResult(int requestType, BaseBean result) {
}
@Override
protected int setLayout() {
return R.layout.activity_new_friend;
}
@Override
protected void initView(Bundle savedInstanceState, TitleView titleView, Intent intent) {
titleView.setTitle("新的朋友");
llSearch = findViewById(R.id.ll_search);
llSearch.setOnClickListener(v -> {
Intent in = new Intent(NewFriendActivity.this, AddFriendActivity.class);
startActivityForResult(in, 1);
});
}
}
......@@ -24,6 +24,12 @@ public class AddressListAdapter extends BaseQuickAdapter<ContactsBean.ContactIte
super(R.layout.item_address_list, data);
}
public OnItemClickListener listener;
public void setListener(OnItemClickListener listener) {
this.listener = listener;
}
@Override
protected void convert(BaseViewHolder helper, ContactsBean.ContactItemBean item) {
helper.setText(R.id.tv_name, item.getToNickname());
......@@ -44,5 +50,16 @@ public class AddressListAdapter extends BaseQuickAdapter<ContactsBean.ContactIte
// GlideManager.getInstance(mContext).loadImage(item.getHeadUrl(), imageView);
// }
}
helper.itemView.setOnClickListener(v -> {
if (listener != null) {
listener.onItemclick(getData().indexOf(item), item);
}
});
}
public interface OnItemClickListener<T> {
void onItemclick(int position, T t);
}
}
package com.rv.im.adapter;
import android.support.annotation.Nullable;
import android.text.TextUtils;
import android.view.View;
import android.widget.TextView;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.rv.im.R;
import com.rv.im.bean.ContactsBean;
import com.rv.im.bean.FriendSearchBean;
import com.rv.im.util.NetworkUtil;
import java.util.List;
public class FriendSearchListAdapter extends BaseQuickAdapter<FriendSearchBean.FriendSearItemBean, BaseViewHolder> {
private FriendItemClickListener listener;
public FriendSearchListAdapter(@Nullable List<FriendSearchBean.FriendSearItemBean> data) {
super(R.layout.item_friend_view, data);
}
public void setListener(FriendItemClickListener listener) {
this.listener = listener;
}
@Override
protected void convert(BaseViewHolder helper, FriendSearchBean.FriendSearItemBean item) {
helper.setImageResource(R.id.img_header, R.drawable.icon_lion);
helper.setText(R.id.tv_name, TextUtils.isEmpty(item.getNickname()) ? " " : item.getNickname());
helper.itemView.setOnClickListener(v -> {
// 显示
if (listener != null) {
listener.showDetail(item);
}
});
helper.setOnClickListener(R.id.btn_add, v -> {
if (listener != null) {
listener.add(item);
}
});
}
public interface FriendItemClickListener {
void showDetail(FriendSearchBean.FriendSearItemBean item);
void add(FriendSearchBean.FriendSearItemBean item);
}
}
package com.rv.im.bean;
public class AddResultBean extends ImBaseBean {
private AddAttentionResult data;
public class AddAttentionResult {
private int type;
public int getType() {
return type;
}
public void setType(int type) {
this.type = type;
}
}
public AddAttentionResult getData() {
return data;
}
public void setData(AddAttentionResult data) {
this.data = data;
}
}
package com.rv.im.bean;
import java.util.List;
public class FriendSearchBean extends ImBaseBean {
private long currentTime ;
private List<FriendSearItemBean> data ;
public long getCurrentTime() {
return currentTime;
}
public void setCurrentTime(long currentTime) {
this.currentTime = currentTime;
}
public List<FriendSearItemBean> getData() {
return data;
}
public void setData(List<FriendSearItemBean> data) {
this.data = data;
}
public class FriendSearItemBean {
private String account ;
private int active ;
private int attCount ;
private double balance ;
private long createTime ;
private int fansCount ;
private int friendsCount ;
private int isAuth ;
private int isPasuse ;
private Location loc ;
private int msgNum ;
private String nickname ;
private boolean notLetSeeHim ;
private boolean notSeeHim ;
private int num ;
private int offlineNoPushMsg ;
private int onlinestate ;
private int setAccountCount ;
private int sex ;
private long showLastLoginTime ;
private int status ;
private double totalConsume ;
private double totalRecharge ;
private String userId ;
private int userType ;
public String getAccount() {
return account;
}
public void setAccount(String account) {
this.account = account;
}
public int getActive() {
return active;
}
public void setActive(int active) {
this.active = active;
}
public int getAttCount() {
return attCount;
}
public void setAttCount(int attCount) {
this.attCount = attCount;
}
public double getBalance() {
return balance;
}
public void setBalance(double balance) {
this.balance = balance;
}
public long getCreateTime() {
return createTime;
}
public void setCreateTime(long createTime) {
this.createTime = createTime;
}
public int getFansCount() {
return fansCount;
}
public void setFansCount(int fansCount) {
this.fansCount = fansCount;
}
public int getFriendsCount() {
return friendsCount;
}
public void setFriendsCount(int friendsCount) {
this.friendsCount = friendsCount;
}
public int getIsAuth() {
return isAuth;
}
public void setIsAuth(int isAuth) {
this.isAuth = isAuth;
}
public int getIsPasuse() {
return isPasuse;
}
public void setIsPasuse(int isPasuse) {
this.isPasuse = isPasuse;
}
public Location getLoc() {
return loc;
}
public void setLoc(Location loc) {
this.loc = loc;
}
public int getMsgNum() {
return msgNum;
}
public void setMsgNum(int msgNum) {
this.msgNum = msgNum;
}
public String getNickname() {
return nickname;
}
public void setNickname(String nickname) {
this.nickname = nickname;
}
public boolean isNotLetSeeHim() {
return notLetSeeHim;
}
public void setNotLetSeeHim(boolean notLetSeeHim) {
this.notLetSeeHim = notLetSeeHim;
}
public boolean isNotSeeHim() {
return notSeeHim;
}
public void setNotSeeHim(boolean notSeeHim) {
this.notSeeHim = notSeeHim;
}
public int getNum() {
return num;
}
public void setNum(int num) {
this.num = num;
}
public int getOfflineNoPushMsg() {
return offlineNoPushMsg;
}
public void setOfflineNoPushMsg(int offlineNoPushMsg) {
this.offlineNoPushMsg = offlineNoPushMsg;
}
public int getOnlinestate() {
return onlinestate;
}
public void setOnlinestate(int onlinestate) {
this.onlinestate = onlinestate;
}
public int getSetAccountCount() {
return setAccountCount;
}
public void setSetAccountCount(int setAccountCount) {
this.setAccountCount = setAccountCount;
}
public int getSex() {
return sex;
}
public void setSex(int sex) {
this.sex = sex;
}
public long getShowLastLoginTime() {
return showLastLoginTime;
}
public void setShowLastLoginTime(long showLastLoginTime) {
this.showLastLoginTime = showLastLoginTime;
}
public int getStatus() {
return status;
}
public void setStatus(int status) {
this.status = status;
}
public double getTotalConsume() {
return totalConsume;
}
public void setTotalConsume(double totalConsume) {
this.totalConsume = totalConsume;
}
public double getTotalRecharge() {
return totalRecharge;
}
public void setTotalRecharge(double totalRecharge) {
this.totalRecharge = totalRecharge;
}
public String getUserId() {
return userId;
}
public void setUserId(String userId) {
this.userId = userId;
}
public int getUserType() {
return userType;
}
public void setUserType(int userType) {
this.userType = userType;
}
}
public class Location{
double lat ;
double lng ;
}
}
......@@ -11,6 +11,7 @@ import com.rv.im.db.table.ChatConversation;
import com.rv.im.db.table.ChatMessage;
import com.rv.im.db.table.Customer;
import com.rv.im.db.table.DownBean;
import com.rv.im.db.table.Friend;
import com.rv.im.log.LogUtil;
import java.sql.SQLException;
......@@ -19,7 +20,7 @@ import java.sql.SQLException;
public class SQLiteHelper extends OrmLiteSqliteOpenHelper {
public static final String DATABASE_NAME = "rv_im.db";
private static final int DATABASE_VERSION = 1;
private static final int DATABASE_VERSION = 2;
private static SQLiteHelper instance = null;
......@@ -42,6 +43,13 @@ public class SQLiteHelper extends OrmLiteSqliteOpenHelper {
@Override
public void onUpgrade(SQLiteDatabase db, ConnectionSource connSource, int oldVersion, int newVersion) {
if(oldVersion == 1){
try {
TableUtils.createTableIfNotExists(connSource, Friend.class);
} catch (SQLException e) {
e.printStackTrace();
}
}
}
private void createTables(ConnectionSource connSource) {
......@@ -50,6 +58,7 @@ public class SQLiteHelper extends OrmLiteSqliteOpenHelper {
TableUtils.createTableIfNotExists(connSource, Customer.class);
TableUtils.createTableIfNotExists(connSource, DownBean.class);
TableUtils.createTableIfNotExists(connSource, ChatConversation.class);
TableUtils.createTableIfNotExists(connSource, Friend.class);
} catch (SQLException e) {
e.printStackTrace();
}
......
package com.rv.im.db.dao;
import android.content.Context;
import android.util.Log;
import com.j256.ormlite.android.apptools.OpenHelperManager;
import com.j256.ormlite.dao.Dao;
import com.j256.ormlite.dao.DaoManager;
import com.rv.im.db.SQLiteHelper;
import com.rv.im.db.table.Customer;
import com.rv.im.db.table.Friend;
import com.rv.im.log.LogUtil;
import java.sql.SQLException;
import java.util.List;
public class FriendDao {
private static final String TAG = ConversationDao.class.getSimpleName();
private static FriendDao instance = null;
public Dao<Friend, Integer> dao;
private Context mContext;
private FriendDao(Context context) {
try {
this.mContext = context;
dao = DaoManager.createDao(SQLiteHelper.getInstance(context).getConnectionSource(), Friend.class);
} catch (SQLException e) {
e.printStackTrace();
}
}
public static final FriendDao getInstance(Context context) {
if (instance == null) {
synchronized (FriendDao.class) {
if (instance == null) {
instance = new FriendDao(context);
}
}
}
return instance;
}
public void clear() {
instance = null;
}
@Override
protected void finalize() throws Throwable {
super.finalize();
OpenHelperManager.releaseHelper();
}
public void makeMessageRead(Friend friend) {
if (dao == null) {
LogUtil.e(TAG, "dao is null");
return;
}
if (friend == null) {
LogUtil.e(TAG, "friend is null");
return;
}
try {
dao.update(friend);
} catch (SQLException e) {
e.printStackTrace();
}
}
/******
* 添加一条添加好友的记录
* @param friend
*/
public void addMessage(Friend friend) {
if (dao == null) {
LogUtil.e(TAG, "dao is null");
return;
}
if (friend == null) {
LogUtil.e(TAG, "friend is null");
return;
}
Log.d(TAG, friend.toString());
if (isExit(friend)) {
updateFriend(friend);
return;
}
try {
int result = dao.create(friend);
LogUtil.d(TAG, "插入结果 " + result);
} catch (SQLException e) {
e.printStackTrace();
LogUtil.d(TAG, "插入失败 " + e.getMessage());
}
}
/*****
* 更新消息
* @param friend
*/
public void updateFriend(Friend friend) {
if (dao == null) {
LogUtil.e(TAG, "dao is null");
return;
}
if (friend == null) {
LogUtil.e(TAG, "friend is null");
return;
}
try {
dao.update(friend);
} catch (SQLException e) {
e.printStackTrace();
}
}
/*******
* 判断是否存在好友记录
* @param friend
* @return
*/
public boolean isExit(Friend friend) {
if (dao == null) {
LogUtil.e(TAG, "dao is null");
return false;
}
if (friend == null) {
LogUtil.e(TAG, "friend is null");
return false;
}
try {
List<Friend> lists = dao.queryForEq("userId", friend.getUserId());
return lists == null ? false : lists.size() == 0 ? false : true;
} catch (SQLException e) {
e.printStackTrace();
}
return false;
}
}
package com.rv.im.db.service;
import android.content.Context;
import com.rv.im.db.dao.FriendDao;
import com.rv.im.db.table.Friend;
public class FriendServiceImp implements IFriendService {
private FriendDao dao = null;
public FriendServiceImp(Context context) {
dao = FriendDao.getInstance(context);
}
@Override
public void addMessage(Friend friend) {
dao.addMessage(friend);
}
}
package com.rv.im.db.service;
import com.rv.im.db.table.Friend;
/*******
*
* 好友操作服务
*/
public interface IFriendService {
void addMessage(Friend friend) ;
}
package com.rv.im.db.table;
import com.j256.ormlite.field.DataType;
import com.j256.ormlite.field.DatabaseField;
import com.j256.ormlite.table.DatabaseTable;
@DatabaseTable(tableName = "tb_friend")
public class Friend {
@DatabaseField(columnName = "_id", dataType = DataType.INTEGER, generatedId = true)
private int id;
@DatabaseField(columnName = "userId")
private String userId;
@DatabaseField(columnName = "userName")
private String userName;
@DatabaseField(columnName = "sender")
private String sender ; // 添加好友发起者
@DatabaseField(columnName = "timeCreate")
private long timeCreate ; // 发起时间
@DatabaseField
private int status ;// -1:黑名单;0:陌生人;1:单方关注;2:互为好友;8:系统号;9:非显示系统号
@DatabaseField
private String privacy;// 隐私
@DatabaseField
private String remarkName;// 备注
@DatabaseField
private String describe;// 描述,
@DatabaseField
private boolean isRead ;
@DatabaseField
private int version;// 本地表的版本
// 消息免打扰 0:未设置 1:已设置
@DatabaseField(defaultValue = "0")
private int offlineNoPushMsg;
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getUserId() {
return userId;
}
public void setUserId(String userId) {
this.userId = userId;
}
public String getUserName() {
return userName;
}
public void setUserName(String userName) {
this.userName = userName;
}
public String getSender() {
return sender;
}
public void setSender(String sender) {
this.sender = sender;
}
public long getTimeCreate() {
return timeCreate;
}
public void setTimeCreate(long timeCreate) {
this.timeCreate = timeCreate;
}
public int getStatus() {
return status;
}
public void setStatus(int status) {
this.status = status;
}
public String getPrivacy() {
return privacy;
}
public void setPrivacy(String privacy) {
this.privacy = privacy;
}
public String getRemarkName() {
return remarkName;
}
public void setRemarkName(String remarkName) {
this.remarkName = remarkName;
}
public String getDescribe() {
return describe;
}
public void setDescribe(String describe) {
this.describe = describe;
}
public int getVersion() {
return version;
}
public void setVersion(int version) {
this.version = version;
}
public int getOfflineNoPushMsg() {
return offlineNoPushMsg;
}
public void setOfflineNoPushMsg(int offlineNoPushMsg) {
this.offlineNoPushMsg = offlineNoPushMsg;
}
public boolean isRead() {
return isRead;
}
public void setRead(boolean read) {
isRead = read;
}
}
......@@ -12,7 +12,9 @@ public enum MessageTypeEnum {
VIDEO_CALL(6, "视频通话"),
CANCEL(7, "撤销"),
PING(8, "ping");
PING(8, "ping"),
HELLO(9,"hello") ,
ADD_SUCCESS(10,"add_success") ;
private int type;
private String name;
......
package com.rv.im.presenter;
import android.content.Intent;
import android.text.TextUtils;
import android.widget.Toast;
import com.ruiwenliu.wrapper.base.presenter.CommonPresenter;
import com.rv.component.utils.CacheEnum;
import com.rv.component.utils.RvCache;
import com.rv.im.AppConfig;
import com.rv.im.Constants;
import com.rv.im.ImSetting;
import com.rv.im.bean.AddResultBean;
import com.rv.im.bean.FriendSearchBean;
import com.rv.im.db.table.ChatMessage;
import com.rv.im.db.table.Friend;
import com.rv.im.enums.MessageStatusEnum;
import com.rv.im.enums.MessageTypeEnum;
import java.util.HashMap;
import java.util.Map;
import java.util.UUID;
public class AddFriendPresenter extends CommonPresenter {
public void search(String mKeyWord) {
if (TextUtils.isEmpty(mKeyWord)) {
return;
}
AppConfig appConfig = (AppConfig) RvCache.getInstance().get(CacheEnum.IM_CONFIG);
if (appConfig == null) return;
HashMap<String, String> params = new HashMap<>();
params.put("access_token", ImSetting.getImToken());
params.put("pageIndex", String.valueOf(0));
// params.put("pageSize", String.valueOf(AppConfig.PAGE_SIZE));
params.put("pageSize", "20");
params.put("nickname", mKeyWord);
params.put("maxAge", String.valueOf(200));
params.put("active", String.valueOf(0));
getData(0, appConfig.USER_NEAR, FriendSearchBean.class, params, true);
}
public void addFriend(String userId, int fromAddType) {
if (TextUtils.isEmpty(userId)) return;
AppConfig appConfig = (AppConfig) RvCache.getInstance().get(CacheEnum.IM_CONFIG);
if (appConfig == null) return;
Map<String, String> params = new HashMap<>();
params.put("access_token", ImSetting.getImToken());
params.put("toUserId", userId);
params.put("fromAddType", String.valueOf(fromAddType));
getData(1,appConfig.FRIENDS_ATTENTION_ADD,AddResultBean.class,params,true);
}
// 打招呼
public void doSayHello(String text,String toUserName,String toUserId ) {
if (TextUtils.isEmpty(text)) {
text = "HEY-HELLO";
}
ChatMessage message = new ChatMessage();
message.setMessageType(MessageTypeEnum.HELLO);
message.setToUserName(toUserName);
message.setToUserId(toUserId);
message.setContent(text);
sendMessage(message);
}
public ChatMessage doSayAddFriend(String toUserName,String toUserId ){
ChatMessage message = new ChatMessage();
message.setMessageType(MessageTypeEnum.ADD_SUCCESS);
message.setToUserName(toUserName);
message.setToUserId(toUserId);
message.setContent("be friend");
return sendMessage(message);
}
private ChatMessage sendMessage(ChatMessage message) {
message.setFromUserId(message.getFromUserId());
message.setFromUserName(message.getFromUserName());
message.setRead(true);
message.setFromId("android");
message.setPackId(UUID.randomUUID().toString().replaceAll("-", ""));
message.setTimeSend(System.currentTimeMillis());
sendMsgBroad(message);
return message;
}
public void sendMsgBroad(ChatMessage message) {
Intent intent = new Intent();
intent.setAction(Constants.ACTIONS.ACTION_SEND_RECEIVER);
intent.setPackage(getPresenterContext().getPackageName());
intent.putExtra(Constants.KEYS.KEY_MESSAGE_TARGET, message.getToUserId());
intent.putExtra(Constants.KEYS.KEY_MESSAGE_CONTENT, message.toJsonString());
getPresenterContext().sendBroadcast(intent);
}
public Friend buildAddFriendMessage(String userId,String userName,int status){
Friend friend = new Friend();
friend.setUserId(userId);
friend.setUserName(userName);
friend.setSender(ImSetting.getUserId());
friend.setRead(true);
friend.setStatus(status);
friend.setTimeCreate(System.currentTimeMillis());
return friend;
}
}
......@@ -20,10 +20,8 @@ public class AddressPresenter extends CommonPresenter {
* @param lists
*/
public void initAddress(List<ContactsBean.ContactItemBean> lists) {
addTopDatas(lists);
boolean isShowLoading = lists == null || lists.size() == 0;
addCustomerItem(lists);
addGroupItem(lists);
addNewFriendItem(lists);
ContactsBean bean = (ContactsBean) RvCache.getInstance().get(CacheEnum.CONTACTS);
if (bean != null && bean.getData() != null && bean.getData().size() > 0) {
lists.addAll(bean.getData());
......@@ -31,12 +29,18 @@ public class AddressPresenter extends CommonPresenter {
pullFriends(isShowLoading);
}
public void addTopDatas(List<ContactsBean.ContactItemBean> lists){
addCustomerItem(lists);
addGroupItem(lists);
addNewFriendItem(lists);
}
private void addNewFriendItem(List<ContactsBean.ContactItemBean> lists) {
ContactsBean.ContactItemBean bean = new ContactsBean.ContactItemBean();
bean.setType(0);
bean.setToNickname(getPresenterContext().getString(R.string.text_new_friend));
bean.setLocalHead(R.drawable.icon_lion);
lists.add(bean);
lists.add(2,bean);
}
private void addGroupItem(List<ContactsBean.ContactItemBean> lists) {
......@@ -44,7 +48,7 @@ public class AddressPresenter extends CommonPresenter {
bean.setType(0);
bean.setToNickname(getPresenterContext().getString(R.string.text_group));
bean.setLocalHead(R.drawable.icon_lion);
lists.add(bean);
lists.add(1,bean);
}
private void addCustomerItem(List<ContactsBean.ContactItemBean> lists) {
......@@ -52,7 +56,7 @@ public class AddressPresenter extends CommonPresenter {
bean.setType(0);
bean.setToNickname(getPresenterContext().getString(R.string.text_customer_list));
bean.setLocalHead(R.drawable.icon_lion);
lists.add(bean);
lists.add(0,bean);
}
......
package com.rv.im.presenter;
import com.ruiwenliu.wrapper.base.presenter.CommonPresenter;
public class NewFriendPresenter extends CommonPresenter {
}
package com.rv.im.util;//package com.xxfc.rv.util;
//
//import android.content.Context;
//import android.graphics.Bitmap;
//import android.graphics.BitmapFactory;
//import android.graphics.Canvas;
//import android.graphics.drawable.BitmapDrawable;
//import android.graphics.drawable.Drawable;
//import android.media.MediaMetadataRetriever;
//import android.media.ThumbnailUtils;
//import android.net.Uri;
//import android.provider.MediaStore;
//import android.support.annotation.IdRes;
//import android.text.TextUtils;
//import android.util.Log;
//import android.view.View;
//import android.widget.ImageView;
//
//import com.bumptech.glide.Glide;
//
//import com.bumptech.glide.request.target.SimpleTarget;
//
//import java.util.ArrayList;
//import java.util.HashMap;
//import java.util.List;
//import java.util.Map;
//import java.util.Random;
//import java.util.TreeMap;
//
///**
// * 用户头像的上传和获取
// */
//public class AvatarHelper {
// private static final String TAG = "AvatarHelper";
// public static AvatarHelper INSTANCE;
// public Context mContext;
// private BitmapLruCache bitmapCache;
// private Map<String, Bitmap> mVideoThumbMap = new HashMap<>();
//
// private AvatarHelper(Context ctx) {
// this.mContext = ctx;
// bitmapCache = new BitmapLruCache.Builder(ctx)
// .setMemoryCacheEnabled(true)
// .setMemoryCacheMaxSizeUsingHeapSize()
// .setDiskCacheEnabled(true)
// .setDiskCacheLocation(ctx.getCacheDir())
// .build();
// }
//
// public static AvatarHelper getInstance() {
// if (INSTANCE == null) {
// synchronized (AvatarHelper.class) {
// if (INSTANCE == null) {
// INSTANCE = new AvatarHelper(MyApplication.getContext());
// }
// }
// }
// return INSTANCE;
// }
//
// /**
// * 更新头像
// */
// public static void updateAvatar(String userId) {
// UserAvatarDao.getInstance().saveUpdateTime(userId);
// }
//
// /**
// * 获取系统号的静态头像资源ID,
// *
// * @return 不是系统号就返回null,
// */
// @IdRes
// public static Integer getStaticAvatar(String userId) {
// Integer ret = null;
// switch (userId) {
// case Friend.ID_SYSTEM_MESSAGE:
// ret = R.drawable.im_notice;
// break;
// case Friend.ID_NEW_FRIEND_MESSAGE:
// ret = R.drawable.im_new_friends;
// break;
// case Friend.ID_SK_PAY:
// ret = R.drawable.my_set_yuer;
// break;
// case "android":
// case "ios":
// ret = R.drawable.fdy;
// break;
// case "pc":
// case "mac":
// case "web":
// ret = R.drawable.feb;
// break;
// }
// return ret;
// }
//
// public static String getAvatarUrl(String userId, boolean isThumb) {
// if (TextUtils.isEmpty(userId) || userId.length() > 8) {
// return null;
// }
// int userIdInt = -1;
// try {
// userIdInt = Integer.parseInt(userId);
// } catch (NumberFormatException e) {
// e.printStackTrace();
// }
// if (userIdInt == -1 || userIdInt == 0) {
// return null;
// }
//
// int dirName = userIdInt % 10000;
// String url = null;
// if (isThumb) {
// url = CoreManager.requireConfig(MyApplication.getInstance()).AVATAR_THUMB_PREFIX + "/" + dirName + "/" + userId + ".jpg";
// } else {
// url = CoreManager.requireConfig(MyApplication.getInstance()).AVATAR_ORIGINAL_PREFIX + "/" + dirName + "/" + userId + ".jpg";
// }
// return url;
// }
//
// public static String getGroupAvatarUrl(String userId, boolean isThumb) {
// int jidHashCode = userId.hashCode();
// int oneLevelName = Math.abs(jidHashCode % 10000);
// int twoLevelName = Math.abs(jidHashCode % 20000);
//
// Log.e("zx", "jidHashCode: " + jidHashCode + " oneLevelName: " + oneLevelName);
//
// int dirName = oneLevelName;
// String url = null;
// Random random = new Random();
// int num = random.nextInt(99) % (99 - 10 + 1) + 10;
// if (isThumb) {
// url = CoreManager.requireConfig(MyApplication.getInstance()).AVATAR_THUMB_PREFIX + "/" + dirName + "/" + twoLevelName + "/" + userId + ".jpg?" + num;
// } else {
// url = CoreManager.requireConfig(MyApplication.getInstance()).AVATAR_ORIGINAL_PREFIX + "/" + dirName + "/" + twoLevelName + "/" + userId + ".jpg?" + num;
// }
// Log.e("zx", "getAvatarUrl: " + dirName + " url: " + url);
// return url;
// }
//
// public void displayAvatar(String userId, ImageView imageView) {
// displayAvatar(userId, imageView, true);
// }
//
// public void displayAvatar(String userId, HeadView headView) {
// displayAvatar(userId, headView.getHeadImage(), true);
// }
//
// private boolean handlerSpecialAvatar(String userId, ImageView iv) {
// if (userId.equals(Friend.ID_SYSTEM_MESSAGE)) {
// iv.setImageResource(R.drawable.im_notice);
// return true;
// } else if (userId.equals(Friend.ID_NEW_FRIEND_MESSAGE)) {
// iv.setImageResource(R.drawable.im_new_friends);
// return true;
// } else if (userId.equals(Friend.ID_SK_PAY)) {
// iv.setImageResource(R.drawable.my_set_yuer);
// return true;
// } else if (userId.equals("android") || userId.equals("ios")) {// 我的手机
// iv.setImageResource(R.drawable.fdy);
// return true;
// } else if (userId.equals("pc") || userId.equals("mac") || userId.equals("web")) {// 我的电脑
// iv.setImageResource(R.drawable.feb);
// return true;
// }
// return false;
// }
//
// /**
// * 显示头像
// *
// * @param userId
// * @param imageView
// * @param isThumb
// */
// public void displayAvatar(String userId, final ImageView imageView, final boolean isThumb) {
// if (handlerSpecialAvatar(userId, imageView)) {
// return;
// }
//
// String url = getAvatarUrl(userId, isThumb);
// if (TextUtils.isEmpty(url)) {
// return;
// }
//
// Friend friend = FriendDao.getInstance().getFriend(CoreManager.requireSelf(mContext).getUserId(), userId);
// if (friend != null) {
// String name = TextUtils.isEmpty(friend.getRemarkName()) ? friend.getNickName() : friend.getRemarkName();
// displayAvatar(name, userId, imageView, isThumb);
// } else if (CoreManager.requireSelf(mContext).getUserId().equals(userId)) {
// displayAvatar(CoreManager.requireSelf(mContext).getNickName(), CoreManager.requireSelf(mContext).getUserId(), imageView, isThumb);
// } else {
// Log.e("zq", "friend==null,直接调用下面传nickName的display方法");
// }
//
// }
//
// /**
// * 显示头像
// *
// * @param userId
// * @param imageView
// * @param isThumb
// */
// public void displayAvatar(String nickName, String userId, final ImageView imageView, final boolean isThumb) {
// if (handlerSpecialAvatar(userId, imageView)) {
// return;
// }
//
// String url = getAvatarUrl(userId, isThumb);
// if (TextUtils.isEmpty(url)) {
// return;
// }
// String time = UserAvatarDao.getInstance().getUpdateTime(userId);
// imageView.setTag(R.id.key_avatar, url);
//
// Glide.with(MyApplication.getContext())
// .load(url)
// .placeholder(R.drawable.avatar_normal)
// .signature(new StringSignature(time))
// .dontAnimate()
// .into(new SimpleTarget<GlideDrawable>() {
// @Override
// public void onResourceReady(GlideDrawable resource, GlideAnimation<? super GlideDrawable> glideAnimation) {
// if (imageView.getTag(R.id.key_avatar) != url) {
// return;
// }
// imageView.setImageDrawable(resource);
// }
//
// @Override
// public void onLoadFailed(Exception e, Drawable errorDrawable) {
// if (imageView.getTag(R.id.key_avatar) != url) {
// return;
// }
// super.onLoadFailed(e, errorDrawable);
// List<Object> bitmapList = new ArrayList();
// bitmapList.add(nickName);
// Bitmap avatar = AvatarUtil.getBuilder(mContext)
// .setShape(AvatarUtil.Shape.CIRCLE)
// .setList(bitmapList)
// .setTextSize(DisplayUtil.dip2px(mContext, 40))
// .setTextColor(R.color.white)
// .setTextBgColor(SkinUtils.getSkin(mContext).getAccentColor())
// .setBitmapSize(DisplayUtil.dip2px(mContext, 120), DisplayUtil.dip2px(mContext, 120))
// .create();
// BitmapDrawable bitmapDrawable = new BitmapDrawable(avatar);
// bitmapDrawable.setAntiAlias(true);
// imageView.setImageDrawable(bitmapDrawable);
//
// }
// });
// }
//
import android.graphics.Bitmap;
import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.Drawable;
import android.text.TextUtils;
import android.widget.ImageView;
import com.bumptech.glide.Glide;
import com.bumptech.glide.request.target.SimpleTarget;
import com.rv.component.utils.CacheEnum;
import com.rv.component.utils.RvCache;
import com.rv.im.AppConfig;
import com.rv.im.R;
import java.util.ArrayList;
import java.util.List;
/**
* 用户头像的上传和获取
*/
public class AvatarHelper {
public static final String ID_SYSTEM_MESSAGE = "10000";// 系统消息ID
public static final String ID_NEW_FRIEND_MESSAGE = "10001";// 新朋友消息 ID
public static final String ID_SK_PAY = "1100";// 支付公众号,
public static final String ID_BLOG_MESSAGE = "10002";// 商务圈消息ID
public static final String ID_INTERVIEW_MESSAGE = "10004";// 面试中心ID(用于职位、初试、面试的推送)
public static final String ID_SYSTEM_NOTIFICATION = "10005";// 系统号,用于各种控制消息通知,
private static final String TAG = "AvatarHelper";
public static String getAvatarUrl(String userId, boolean isThumb) {
if (TextUtils.isEmpty(userId) || userId.length() > 8) {
return null;
}
int userIdInt = -1;
try {
userIdInt = Integer.parseInt(userId);
} catch (NumberFormatException e) {
e.printStackTrace();
}
if (userIdInt == -1 || userIdInt == 0) {
return null;
}
int dirName = userIdInt % 10000;
String url = null;
AppConfig appConfig = (AppConfig) RvCache.getInstance().get(CacheEnum.IM_CONFIG);
if (appConfig == null) return "";
if (isThumb) {
url = appConfig.AVATAR_THUMB_PREFIX + "/" + dirName + "/" + userId + ".jpg";
} else {
url = appConfig.AVATAR_ORIGINAL_PREFIX + "/" + dirName + "/" + userId + ".jpg";
}
return url;
}
// public void displayRoundAvatar(String nickName, String userId, final ImageView imageView, final boolean isThumb) {
// if (handlerSpecialAvatar(userId, imageView)) {
// return;
......@@ -296,312 +100,16 @@ package com.rv.im.util;//package com.xxfc.rv.util;
// }
// });
// }
//
// /**
// * 手机联系人加载头像 无userId
// */
// public void displayAddressAvatar(String nickName, final ImageView imageView) {
// List<Object> bitmapList = new ArrayList();
// bitmapList.add(nickName);
//
// Bitmap avatar = AvatarUtil.getBuilder(mContext)
// .setShape(AvatarUtil.Shape.CIRCLE)
// .setList(bitmapList)
// .setTextSize(DisplayUtil.dip2px(mContext, 40))
// .setTextColor(R.color.white)
// .setTextBgColor(SkinUtils.getSkin(mContext).getAccentColor())
// .setBitmapSize(DisplayUtil.dip2px(mContext, 120), DisplayUtil.dip2px(mContext, 120))
// .create();
// BitmapDrawable bitmapDrawable = new BitmapDrawable(avatar);
// bitmapDrawable.setAntiAlias(true);
// imageView.setImageDrawable(bitmapDrawable);
// }
//
// /**
// * 封装个人头像和群头像的处理,
// * 缓存过期通过UserAvatarDao判断,
// * 群更新成员列表时{@link RoomMemberDao#deleteRoomMemberTable(String)}里调用UserAvatarDao标记过期,
// */
// public void displayAvatar(String selfId, Friend friend, HeadView headView) {
// if (BuildConfig.DEBUG) {
// Log.i(TAG, "displayAvatar: <" + friend.getNickName() + ">");
// }
// headView.setRound(true);
// ImageView view = headView.getHeadImage();
// if (friend.getRoomFlag() == 0) {// 个人
// if (friend.getUserId().equals(Friend.ID_SYSTEM_MESSAGE)) {
// view.setImageResource(R.drawable.im_notice);
// } else if (friend.getUserId().equals(Friend.ID_NEW_FRIEND_MESSAGE)) {
// view.setImageResource(R.drawable.im_new_friends);
// } else if (friend.getUserId().equals(Friend.ID_SK_PAY)) {
// view.setImageResource(R.drawable.my_set_yuer);
// } else if (friend.getIsDevice() == 1) {
// if ("android".equals(friend.getUserId()) || "ios".equals(friend.getUserId())) {
// view.setImageResource(R.drawable.fdy);
// } else if ("pc".equals(friend.getUserId()) || "mac".equals(friend.getUserId()) || "web".equals(friend.getUserId())) {
// view.setImageResource(R.drawable.feb);
// }
// } else {
// displayAvatar(friend.getUserId(), view);
// }
// } else if (friend.getRoomId() != null) { // 群组
// Glide.with(MyApplication.getContext())
// .load(getGroupAvatarUrl(friend.getUserId(), false))
// .placeholder(R.drawable.groupdefault)
// .dontAnimate()
// .into(new SimpleTarget<GlideDrawable>() {
// @Override
// public void onResourceReady(GlideDrawable resource, GlideAnimation<? super GlideDrawable> glideAnimation) {
// view.setImageDrawable(resource);
// }
//
// @Override
// public void onLoadFailed(Exception e, Drawable errorDrawable) {
// super.onLoadFailed(e, errorDrawable);
// // 该群组未上传群头像,使用合成头像
// AsyncUtils.doAsync(this, throwable -> {
// Reporter.post("加载群头像失败,", throwable);
// }, c -> {
// String time = UserAvatarDao.getInstance().getUpdateTime(friend.getRoomId());
// CacheableBitmapDrawable cacheDrawable = bitmapCache.get(friend.getRoomId() + time);
// if (cacheDrawable != null && cacheDrawable.getBitmap() != null) {
// c.uiThread(ref -> {
// view.setImageBitmap(cacheDrawable.getBitmap());
// });
// } else {
// List<String> idList = RoomMemberDao.getInstance().getRoomMemberForAvatar(friend.getRoomId(), selfId);
// if (idList != null) {
// // 可能没有刷过群成员列表,就查出空列表,
// if (idList.size() > 0) {
// c.uiThread(ref -> {
// displayJoined(friend.getRoomId(), idList, headView);
// });
// } else {
// c.uiThread(ref -> {
// view.setImageResource(R.drawable.groupdefault);
// });
// }
// } else {
// c.uiThread(ref -> {
// view.setImageResource(R.drawable.groupdefault);
// });
// }
// }
// });
// }
// });
// } else {
// view.setImageResource(R.drawable.groupdefault);
// }
// }
//
// private void displayJoined(String roomId, List<String> idList, HeadView headView) {
// ImageView view = headView.getHeadImage();
// // 当前item项的头像个数
// int size = idList.size();
// TreeMap<Integer, Bitmap> sortedBitmap = new TreeMap<>();
// // 这里url的顺序是对的
// for (int i = 0; i < idList.size(); i++) {
// final int finalIndex = i;
// String id = idList.get(i);
// Integer avatarId = AvatarHelper.getStaticAvatar(id);
// if (avatarId != null) {
// if (BuildConfig.DEBUG) {
// Log.i(TAG, "load resource: " + avatarId);
// }
// sortedBitmap.put(finalIndex, BitmapFactory.decodeResource(view.getResources(), avatarId));
// if (sortedBitmap.size() == size) {
// displayJoinedBitmap(roomId, new ArrayList<>(sortedBitmap.values()), headView);
// }
// } else {
// String url = AvatarHelper.getAvatarUrl(id, true);
// Glide.with(view.getContext())
// .load(url)
// .asBitmap()
// .placeholder(R.drawable.avatar_normal)
// .error(R.drawable.avatar_normal)
// .dontAnimate()
// .into(new SimpleTarget<Bitmap>() {
// @Override
// public void onResourceReady(Bitmap resource, GlideAnimation<? super Bitmap> glideAnimation) {
// if (BuildConfig.DEBUG) {
// Log.i(TAG, "onResourceReady: " + url);
// }
// sortedBitmap.put(finalIndex, resource);
// if (sortedBitmap.size() == size) {
// displayJoinedBitmap(roomId, new ArrayList<>(sortedBitmap.values()), headView);
// }
// }
//
// @Override
// public void onLoadFailed(Exception e, Drawable errorDrawable) {
// if (BuildConfig.DEBUG) {
// Log.i(TAG, "onLoadFailed: " + url);
// }
// // 使用默认图片
// Bitmap resource = BitmapFactory.decodeResource(view.getResources(), R.drawable.avatar_normal);
// sortedBitmap.put(finalIndex, resource);
// if (sortedBitmap.size() == size) {
// displayJoinedBitmap(roomId, new ArrayList<>(sortedBitmap.values()), headView);
// }
// }
// });
// }
// }
// }
//
// private void displayJoinedBitmap(String roomId, List<Bitmap> bitmaps, HeadView headView) {
// if (BuildConfig.DEBUG) {
// Log.d(TAG, "displayJoinedBitmap: size = " + bitmaps.size());
// }
// ImageView view = headView.getHeadImage();
// if (bitmaps.size() == 1) {
// view.setImageBitmap(bitmaps.get(0));
// return;
// }
// // 群组组合头像不能设置为圆形,否则边角有缺,
// headView.setRound(false);
// int width = view.getWidth();
// if (width > 0) {
// Bitmap bitmap = Bitmap.createBitmap(view.getWidth(), view.getHeight(), Bitmap.Config.ARGB_8888);
// Canvas canvas = new Canvas(bitmap);
// JoinBitmaps.join(canvas, width, bitmaps, 0.15F);
// displayBitmap(roomId, bitmap, headView);
// } else {
// // 加载太快可能布局还没加载出ner确保布局加载完成后再次设置头像,来,
// // 通过addOnLayoutChangeListe
// if (BuildConfig.DEBUG) {
// Log.d(TAG, "displayJoinedBitmap: " + Integer.toHexString(view.hashCode()) + ".width = 0");
// }
// view.addOnLayoutChangeListener(new View.OnLayoutChangeListener() {
// @Override
// public void onLayoutChange(View v, int left, int top, int right, int bottom, int oldLeft, int oldTop, int oldRight, int oldBottom) {
// if (BuildConfig.DEBUG) {
// Log.d(TAG, "onLayoutChange: " + Integer.toHexString(view.hashCode()) + ".width = " + v.getWidth());
// }
// if (v.getWidth() > 0) {
// Bitmap bitmap = Bitmap.createBitmap(view.getWidth(), view.getHeight(), Bitmap.Config.ARGB_8888);
// Canvas canvas = new Canvas(bitmap);
// JoinBitmaps.join(canvas, v.getWidth(), bitmaps, 0.15F);
// displayBitmap(roomId, bitmap, headView);
// v.removeOnLayoutChangeListener(this);
// } else {
// if (BuildConfig.DEBUG) {
// Log.d(TAG, "displayJoinedBitmap: " + Integer.toHexString(view.hashCode()) + ".width = 0");
// }
// }
// }
// });
// }
// }
//
// private void displayBitmap(String roomId, Bitmap bitmap, HeadView headView) {
// AsyncUtils.doAsync(this, c -> {
// String time = UserAvatarDao.getInstance().getUpdateTime(roomId);
// bitmapCache.put(roomId + time, bitmap);
// });
// headView.getHeadImage().setImageBitmap(bitmap);
// }
//
// /**
// * 本地视频缩略图 缓存
// */
// public Bitmap displayVideoThumb(String videoFilePath, ImageView image) {
// if (TextUtils.isEmpty(videoFilePath)) {
// return null;
// }
//
// Bitmap bitmap = MyApplication.getInstance().getBitmapFromMemCache(videoFilePath);
// if (bitmap == null || bitmap.isRecycled()) {
// bitmap = ThumbnailUtils.createVideoThumbnail(videoFilePath, MediaStore.Video.Thumbnails.MINI_KIND);
// // 视频格式不支持可能导致得到缩略图bitmap为空,LruCache不能接受空,
// // 主要是系统相册里的存着的视频不一定都是真实有效的,
// if (bitmap != null) {
// MyApplication.getInstance().addBitmapToMemoryCache(videoFilePath, bitmap);
// }
// }
//
// if (bitmap != null && !bitmap.isRecycled()) {
// image.setImageBitmap(bitmap);
// } else {
// image.setImageBitmap(null);
// }
//
// return bitmap;
// }
//
// /**
// * 在线视频缩略图获取显示 缓存
// */
// public void asyncDisplayOnlineVideoThumb(String url, ImageView image) {
// if (TextUtils.isEmpty(url)) {
// return;
// }
// if (mVideoThumbMap.containsKey(url)) {
// image.setImageBitmap(mVideoThumbMap.get(url));
// return;
// }
//// image.setTag(url);
// AsyncUtils.doAsync(this, t -> {
// Reporter.post("获取在线视频缩略图失败, " + url, t);
// }, c -> {
// MediaMetadataRetriever retr = new MediaMetadataRetriever();
// Uri uri = Uri.parse(url);
// if (TextUtils.equals(uri.getScheme(), "file")) {
// // 本地文件不能使用file://开头的url加载,
// retr.setDataSource(uri.getPath());
// } else {
// retr.setDataSource(url, new HashMap<>());
// }
// Bitmap bitmap = retr.getFrameAtTime();
// mVideoThumbMap.put(url, bitmap);
// c.uiThread(r -> {
// image.setImageBitmap(bitmap);
///*
// if (image.getTag() == url) {
// image.setImageBitmap(bitmap);
// }
//*/
// });
// });
// }
//
// /**
// * 加载网络图片
// */
// public void displayUrl(String url, ImageView imageView, int errid) {
// Glide.with(MyApplication.getContext())
// .load(url)
// .error(errid)
// .into(imageView);
// }
//
// public void displayUrl(String url, ImageView imageView) {
// displayUrl(url, imageView, R.drawable.image_download_fail_icon);
// }
//
// // 根据文件类型填充图片
// public void fillFileView(String type, ImageView v) {
// if (type.equals("mp3")) {
// v.setImageResource(R.drawable.ic_muc_flie_type_y);
// } else if (type.equals("mp4") || type.equals("avi")) {
// v.setImageResource(R.drawable.ic_muc_flie_type_v);
// } else if (type.equals("xls")) {
// v.setImageResource(R.drawable.ic_muc_flie_type_x);
// } else if (type.equals("doc")) {
// v.setImageResource(R.drawable.ic_muc_flie_type_w);
// } else if (type.equals("ppt")) {
// v.setImageResource(R.drawable.ic_muc_flie_type_p);
// } else if (type.equals("pdf")) {
// v.setImageResource(R.drawable.ic_muc_flie_type_f);
// } else if (type.equals("apk")) {
// v.setImageResource(R.drawable.ic_muc_flie_type_a);
// } else if (type.equals("txt")) {
// v.setImageResource(R.drawable.ic_muc_flie_type_t);
// } else if (type.equals("rar") || type.equals("zip")) {
// v.setImageResource(R.drawable.ic_muc_flie_type_z);
// } else {
// v.setImageResource(R.drawable.ic_muc_flie_type_what);
// }
// }
//}
private boolean handlerSpecialAvatar(String userId, ImageView iv) {
if (userId.equals(ID_SYSTEM_MESSAGE)) {
iv.setImageResource(R.drawable.im_notice);
return true;
} else if (userId.equals(ID_NEW_FRIEND_MESSAGE)) {
iv.setImageResource(R.drawable.im_new_friends);
return true;
}
return false;
}
}
......@@ -3,6 +3,7 @@ package com.rv.im.xmpp;
import android.media.MediaPlayer;
import android.os.Handler;
import android.os.Looper;
import android.util.Log;
import com.ruiwenliu.wrapper.util.AppUtils;
import com.rv.im.ImSetting;
......@@ -13,6 +14,7 @@ import com.rv.im.db.table.ChatMessage;
import com.rv.im.util.NotificationMananger;
import com.rv.im.xmpp.listener.AuthStateListener;
import com.rv.im.xmpp.listener.ChatMessageListener;
import com.rv.im.xmpp.listener.NewFriendListener;
import java.util.ArrayList;
import java.util.List;
......@@ -22,6 +24,7 @@ public class ListenerManager {
/* 回调监听 */
private List<AuthStateListener> mAuthStateListeners = new ArrayList<>();
private List<ChatMessageListener> mChatMessageListeners = new ArrayList<>();
private List<NewFriendListener> mNewFriendListeners = new ArrayList<>();
private Handler mHandler = new Handler(Looper.getMainLooper());
......@@ -59,6 +62,14 @@ public class ListenerManager {
mChatMessageListeners.remove(messageListener);
}
public void addNewFriendListener(NewFriendListener newFriendListener) {
mNewFriendListeners.add(newFriendListener);
}
public void removeChatMessageListener(NewFriendListener friendListener) {
mNewFriendListeners.remove(friendListener);
}
/**********************
* 监听回调
**************************/
......@@ -108,7 +119,7 @@ public class ListenerManager {
mHandler.post(() -> {
if (message != null) {
ChatMessageServiceImp.getInstance(ImSetting.getContext()).addMessage(message); // 数据库添加消息
AppUtils.setBadger(ImSetting.getContext(),ChatMessageServiceImp.getInstance(ImSetting.getContext()).getUnReadMsg() );
AppUtils.setBadger(ImSetting.getContext(), ChatMessageServiceImp.getInstance(ImSetting.getContext()).getUnReadMsg());
for (int i = mChatMessageListeners.size() - 1; i >= 0; i--) {
mChatMessageListeners.get(i).onNewMessage(message.getFromUserId(), message, false);
}
......@@ -116,6 +127,32 @@ public class ListenerManager {
});
}
/*********
* 添加好友
* @param message
*/
public void notifyNewFriend(final ChatMessage message) {
if (message == null) return;
mHandler.post(() -> {
boolean hasRead = false;// 是否已经被读了 (如果有类添加)
for (NewFriendListener listener : mNewFriendListeners) {
if (listener.onNewFriend(message)) {
hasRead = true;
}
}
// if (!hasRead) {
// Log.e("msg", "新的朋友刷新");
// int i = NewFriendDao.getInstance().getNewFriendUnRead(message.getOwnerId(), message.getUserId());
// if (i <= 0) {// 当该新的朋友存在一条未读消息时,不在更新
// NewFriendDao.getInstance().markNewFriendUnRead(message.getOwnerId(), message.getUserId());
// FriendDao.getInstance().markUserMessageUnRead(loginUserId, Friend.ID_NEW_FRIEND_MESSAGE);
// }
// MsgBroadcast.broadcastMsgNumUpdateNewFriend(MyApplication.getInstance());
// }
// MsgBroadcast.broadcastMsgUiUpdate(MyApplication.getInstance());
});
}
private void bell() {
MediaPlayer mediaPlayer = MediaPlayer.create(ImSetting.getContext(), R.raw.msg);
mediaPlayer.start();
......
......@@ -23,7 +23,7 @@ public class ReceiptManager {
/**
* 处理消息回执
*/
public static Map<String, ReceiptObj> mReceiptMap = new HashMap<String, ReceiptObj>();
public static Map<String, ReceiptObj> mReceiptMap = new HashMap<>();
private ImService mService;
private XMPPTCPConnection mConnection;
private String mLoginUserId;// 用于切换用户后,判断是否清除回执内容
......@@ -49,6 +49,9 @@ public class ReceiptManager {
if (msg.what == RECEIPT_NO) { // 认为这条消息未发送成功,已超时
ListenerManager.getInstance().notifyMessageSendStateChange(packetId, ChatMessageListener.MESSAGE_SEND_FAILED);
} else if (msg.what == RECEIPT_YES) {// 认为发送成功
ListenerManager.getInstance().notifyMessageSendStateChange(packetId, ChatMessageListener.MESSAGE_SEND_SUCCESS);
}
mReceiptMap.remove(packetId);
......
package com.rv.im.xmpp; import android.os.Handler;import android.os.Looper;import android.text.TextUtils;import android.util.Log; import com.rv.im.ImService;import com.rv.im.call.JitsistateMachine;import com.rv.im.call.event.MessageBusyEvent;import com.rv.im.call.event.MessageEventSipEVent;import com.rv.im.call.event.MessageHangUpPhone;import com.rv.im.db.service.ChatMessageServiceImp;import com.rv.im.db.table.ChatMessage;import com.rv.im.enums.CallTypeEnum;import com.rv.im.enums.MessageTypeEnum; import org.greenrobot.eventbus.EventBus;import org.jivesoftware.smack.chat2.Chat;import org.jivesoftware.smack.chat2.IncomingChatMessageListener;import org.jivesoftware.smack.packet.Message;import org.jxmpp.jid.EntityBareJid; /** * Created by Administrator on 2017/11/24. */ public class XChatMessageListener implements IncomingChatMessageListener { private ImService mService; public XChatMessageListener(ImService service) { mService = service; } @Override public void newIncomingMessage(EntityBareJid fromxx, Message message, Chat chat) { String packetID = message.getPacketID(); String body = message.getBody(); Log.e("xxxxxx",body) ; ChatMessage chatMessage = ChatMessage.json2Message(body); if (TextUtils.isEmpty(chatMessage.getPackId())) { chatMessage.setPackId(packetID); } int type = chatMessage.getMessageType(); if (type == 0) { // 消息过滤 return; } if (type == MessageTypeEnum.TEXT.getType() || type == MessageTypeEnum.PIC.getType() || type == MessageTypeEnum.FILE.getType() || type == MessageTypeEnum.VOICE.getType()) { ListenerManager.getInstance().notifyNewMesssage(chatMessage); } else if (type == MessageTypeEnum.VOLTE_CALL.getType()) { // 发送语音通话 dealVolteCall(chatMessage); } else if (type == MessageTypeEnum.VIDEO_CALL.getType()) { // 发送视频通话 dealVideoCall(chatMessage); } } /********** * 处理视频通话 * @param chatMessage */ private void dealVideoCall(ChatMessage chatMessage) { int callType = chatMessage.getCallType(); if (callType == CallTypeEnum.CONNECT_VIDEO.getType()) { if (JitsistateMachine.isInCalling) { mService.sendBusyMessage(chatMessage.getMessageType(), chatMessage.getFromUserId()); return; } if ((int) System.currentTimeMillis() / 1000 - chatMessage.getTimeSend() <= 30) { // 跳转到语音待接受界面 EventBus.getDefault().post(new MessageEventSipEVent(callType, chatMessage.getFromUserId(), chatMessage)); } } else if (callType == CallTypeEnum.CONNECTED_VIDEO.getType()) { EventBus.getDefault().post(new MessageEventSipEVent(callType, null, chatMessage)); } else if (callType == CallTypeEnum.NO_CONNECT_VIDEO.getType()) { EventBus.getDefault().post(new MessageEventSipEVent(callType, null, chatMessage)); String content; if (chatMessage.getTimeLen() == 0) { content = "对方取消视频通话"; } else { content = "对方无人接听"; } chatMessage.setContent(content); ChatMessageServiceImp.getInstance(mService.getApplicationContext()).addMessage(chatMessage); new Handler(Looper.getMainLooper()).postDelayed(() -> EventBus.getDefault().post(new MessageHangUpPhone(chatMessage)), 1000);// 延迟一秒在发送挂断消息,防止当我们离线时,对方发起 } else if (callType == CallTypeEnum.END_CONNECT_VIDEO.getType()) { ChatMessageServiceImp.getInstance(mService.getApplicationContext()).addMessage(chatMessage); EventBus.getDefault().post(new MessageHangUpPhone(chatMessage)); } } /********** * 处理语音通话 * @param chatMessage */ private void dealVolteCall(ChatMessage chatMessage) { int callType = chatMessage.getCallType(); if (callType == CallTypeEnum.CONNECT_VOICE.getType()) { ChatMessageServiceImp.getInstance(mService.getApplicationContext()).addMessage(chatMessage); if (JitsistateMachine.isInCalling) { // 对方来电 ,本人 正在通话 mService.sendBusyMessage(chatMessage.getMessageType(), chatMessage.getFromUserId()); return; } if ((int) System.currentTimeMillis() / 1000 - chatMessage.getTimeSend() <= 30) { // 跳转到语音待接受界面 EventBus.getDefault().post(new MessageEventSipEVent(callType, chatMessage.getFromUserId(), chatMessage)); } } else if (callType == CallTypeEnum.CONNECTED_VOICE.getType()) { EventBus.getDefault().post(new MessageEventSipEVent(callType, null, chatMessage)); } else if (callType == CallTypeEnum.NO_CONNECT_VOICE.getType()) { EventBus.getDefault().post(new MessageEventSipEVent(callType, null, chatMessage)); ChatMessageServiceImp.getInstance(mService.getApplicationContext()).addMessage(chatMessage); new Handler(Looper.getMainLooper()).postDelayed(() -> EventBus.getDefault().post(new MessageHangUpPhone(chatMessage)), 1000);// 延迟一秒在发送挂断消息,防止当我们离线时,对方发起通话之后又取消了通话,我们30秒内上线,在来点界面拉起时该Event也发送出去了 } else if (callType == CallTypeEnum.END_CONNECT_VOICE.getType()) { // 通知通话界面挂断 ChatMessageServiceImp.getInstance(mService.getApplicationContext()).addMessage(chatMessage); EventBus.getDefault().post(new MessageHangUpPhone(chatMessage)); } else if (callType == CallTypeEnum.CALL_BUSY.getType()) { // 忙线 ChatMessageServiceImp.getInstance(mService.getApplicationContext()).addMessage(chatMessage); EventBus.getDefault().post(new MessageBusyEvent(chatMessage)); } } }
\ No newline at end of file
package com.rv.im.xmpp; import android.os.Handler;import android.os.Looper;import android.text.TextUtils;import android.util.Log; import com.rv.im.ImService;import com.rv.im.ImSetting;import com.rv.im.call.JitsistateMachine;import com.rv.im.call.event.MessageBusyEvent;import com.rv.im.call.event.MessageEventSipEVent;import com.rv.im.call.event.MessageHangUpPhone;import com.rv.im.db.service.ChatMessageServiceImp;import com.rv.im.db.table.ChatMessage;import com.rv.im.enums.CallTypeEnum;import com.rv.im.enums.MessageTypeEnum; import org.greenrobot.eventbus.EventBus;import org.jivesoftware.smack.chat2.Chat;import org.jivesoftware.smack.chat2.IncomingChatMessageListener;import org.jivesoftware.smack.packet.Message;import org.jxmpp.jid.EntityBareJid; /** * Created by Administrator on 2017/11/24. */ public class XChatMessageListener implements IncomingChatMessageListener { private ImService mService; public XChatMessageListener(ImService service) { mService = service; } @Override public void newIncomingMessage(EntityBareJid fromxx, Message message, Chat chat) { String packetID = message.getPacketID(); String body = message.getBody(); Log.e("xxxxxx", body); ChatMessage chatMessage = ChatMessage.json2Message(body); if (TextUtils.isEmpty(chatMessage.getPackId())) { chatMessage.setPackId(packetID); } int type = chatMessage.getMessageType(); if (type == 0) { // 消息过滤 return; } if (type == MessageTypeEnum.TEXT.getType() || type == MessageTypeEnum.PIC.getType() || type == MessageTypeEnum.FILE.getType() || type == MessageTypeEnum.VOICE.getType()) { ListenerManager.getInstance().notifyNewMesssage(chatMessage); } else if (type == MessageTypeEnum.VOLTE_CALL.getType()) { // 发送语音通话 dealVolteCall(chatMessage); } else if (type == MessageTypeEnum.VIDEO_CALL.getType()) { // 发送视频通话 dealVideoCall(chatMessage); } else if (type == MessageTypeEnum.HELLO.getType()) { // 添加好友请求 chatFriend(chatMessage); } else if (type == MessageTypeEnum.ADD_SUCCESS.getType()) { // 添加好友成功 } } /********** * * 与好友相关的逻辑处理 * * @param chatMessage */ private void chatFriend(ChatMessage chatMessage) { if (chatMessage == null) return; if (chatMessage.getFromUserId().equals(ImSetting.getUserId())) { // 我在其他端做的操作,在Android也接收到了 } else { ListenerManager.getInstance().notifyNewFriend(chatMessage); } } /********** * 处理视频通话 * @param chatMessage */ private void dealVideoCall(ChatMessage chatMessage) { int callType = chatMessage.getCallType(); if (callType == CallTypeEnum.CONNECT_VIDEO.getType()) { if (JitsistateMachine.isInCalling) { mService.sendBusyMessage(chatMessage.getMessageType(), chatMessage.getFromUserId()); return; } if ((int) System.currentTimeMillis() / 1000 - chatMessage.getTimeSend() <= 30) { // 跳转到语音待接受界面 EventBus.getDefault().post(new MessageEventSipEVent(callType, chatMessage.getFromUserId(), chatMessage)); } } else if (callType == CallTypeEnum.CONNECTED_VIDEO.getType()) { EventBus.getDefault().post(new MessageEventSipEVent(callType, null, chatMessage)); } else if (callType == CallTypeEnum.NO_CONNECT_VIDEO.getType()) { EventBus.getDefault().post(new MessageEventSipEVent(callType, null, chatMessage)); String content; if (chatMessage.getTimeLen() == 0) { content = "对方取消视频通话"; } else { content = "对方无人接听"; } chatMessage.setContent(content); ChatMessageServiceImp.getInstance(mService.getApplicationContext()).addMessage(chatMessage); new Handler(Looper.getMainLooper()).postDelayed(() -> EventBus.getDefault().post(new MessageHangUpPhone(chatMessage)), 1000);// 延迟一秒在发送挂断消息,防止当我们离线时,对方发起 } else if (callType == CallTypeEnum.END_CONNECT_VIDEO.getType()) { ChatMessageServiceImp.getInstance(mService.getApplicationContext()).addMessage(chatMessage); EventBus.getDefault().post(new MessageHangUpPhone(chatMessage)); } } /********** * 处理语音通话 * @param chatMessage */ private void dealVolteCall(ChatMessage chatMessage) { int callType = chatMessage.getCallType(); if (callType == CallTypeEnum.CONNECT_VOICE.getType()) { ChatMessageServiceImp.getInstance(mService.getApplicationContext()).addMessage(chatMessage); if (JitsistateMachine.isInCalling) { // 对方来电 ,本人 正在通话 mService.sendBusyMessage(chatMessage.getMessageType(), chatMessage.getFromUserId()); return; } if ((int) System.currentTimeMillis() / 1000 - chatMessage.getTimeSend() <= 30) { // 跳转到语音待接受界面 EventBus.getDefault().post(new MessageEventSipEVent(callType, chatMessage.getFromUserId(), chatMessage)); } } else if (callType == CallTypeEnum.CONNECTED_VOICE.getType()) { EventBus.getDefault().post(new MessageEventSipEVent(callType, null, chatMessage)); } else if (callType == CallTypeEnum.NO_CONNECT_VOICE.getType()) { EventBus.getDefault().post(new MessageEventSipEVent(callType, null, chatMessage)); ChatMessageServiceImp.getInstance(mService.getApplicationContext()).addMessage(chatMessage); new Handler(Looper.getMainLooper()).postDelayed(() -> EventBus.getDefault().post(new MessageHangUpPhone(chatMessage)), 1000);// 延迟一秒在发送挂断消息,防止当我们离线时,对方发起通话之后又取消了通话,我们30秒内上线,在来点界面拉起时该Event也发送出去了 } else if (callType == CallTypeEnum.END_CONNECT_VOICE.getType()) { // 通知通话界面挂断 ChatMessageServiceImp.getInstance(mService.getApplicationContext()).addMessage(chatMessage); EventBus.getDefault().post(new MessageHangUpPhone(chatMessage)); } else if (callType == CallTypeEnum.CALL_BUSY.getType()) { // 忙线 ChatMessageServiceImp.getInstance(mService.getApplicationContext()).addMessage(chatMessage); EventBus.getDefault().post(new MessageBusyEvent(chatMessage)); } } }
\ No newline at end of file
......
package com.rv.im.xmpp.listener;
import com.rv.im.db.table.ChatMessage;
public interface NewFriendListener {
// 新朋友消息发送状态的回调
void onNewFriendSendStateChange(String toUserId, ChatMessage message, int messageState);
/**
* 新朋友消息来临时的回调
* public static final int TYPE_SAYHELLO = 500; // 打招呼
* public static final int TYPE_PASS = 501; // 同意加好友
* public static final int TYPE_FEEDBACK = 502; // 回话
* public static final int TYPE_NEWSEE = 503; // 新关注
* public static final int TYPE_DELSEE = 504; // 删除关注
* public static final int TYPE_DELALL = 505; // 彻底删除
* public static final int TYPE_RECOMMEND = 506;// 新推荐好友
* public static final int TYPE_BLACK = 507; // 黑名单
* public static final int TYPE_FRIEND = 508; // 直接成为好友
* public static final int TYPE_REFUSED = 509; // 取消黑名单
*/
boolean onNewFriend(ChatMessage message);
}
<?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:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
tools:context=".AddFriendActivity">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="@dimen/dp50"
android:background="@color/white">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="@dimen/dp40"
android:layout_centerInParent="true"
android:layout_marginLeft="@dimen/dp_10"
android:layout_marginRight="@dimen/dp_10"
android:background="@drawable/bg_chat_search"
android:gravity="center_vertical"
android:orientation="horizontal">
<ImageView
android:layout_width="@dimen/size_25"
android:layout_height="@dimen/size_25"
android:layout_marginLeft="@dimen/dp_10"
android:src="@drawable/rv_common_icon_search" />
<EditText
android:id="@+id/edt_search"
android:layout_width="match_parent"
android:layout_height="@dimen/size_30"
android:layout_marginLeft="@dimen/dp_10"
android:background="@color/Grey_300"
android:hint="请输入昵称或者手机号"
android:textColorHint="@color/gray"
android:textSize="@dimen/sp_12" />
</LinearLayout>
</RelativeLayout>
<android.support.v7.widget.RecyclerView
android:id="@+id/recyclerview"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<Button
android:gravity="center"
android:text="搜索"
android:id="@+id/btn_search"
android:layout_marginTop="@dimen/dp_10"
android:layout_marginLeft="@dimen/dp_10"
android:layout_marginRight="@dimen/dp_10"
android:layout_width="match_parent"
android:layout_height="@dimen/dp50" />
</LinearLayout>
\ No newline at end of file
<?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:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
tools:context=".NewFriendActivity">
<LinearLayout
android:id="@+id/ll_search"
android:layout_width="match_parent"
android:layout_height="@dimen/size_50"
android:layout_centerInParent="true"
android:layout_marginLeft="@dimen/dp_10"
android:layout_marginRight="@dimen/dp_10"
android:background="@drawable/bg_chat_search"
android:gravity="center"
android:orientation="horizontal">
<ImageView
android:layout_width="@dimen/size_25"
android:layout_height="@dimen/size_25"
android:layout_marginLeft="@dimen/dp_10"
android:src="@drawable/rv_common_icon_search" />
<TextView
android:layout_width="wrap_content"
android:layout_height="@dimen/size_30"
android:layout_marginLeft="@dimen/dp_10"
android:background="@color/Grey_300"
android:gravity="center"
android:text="昵称或手机号"
android:textColorHint="@color/gray"
android:textSize="@dimen/sp_12" />
</LinearLayout>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_marginTop="@dimen/dp_10"
android:text="最近添加记录" />
<android.support.v7.widget.RecyclerView
android:id="@+id/recyclerview"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</LinearLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<LinearLayout
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="@dimen/dp50"
android:gravity="center_vertical">
<ImageView
android:layout_marginLeft="@dimen/dp_10"
android:id="@+id/img_header"
android:layout_width="@dimen/dp_40"
android:layout_height="@dimen/dp_40" />
<TextView
android:layout_marginLeft="@dimen/dp_10"
android:id="@+id/tv_name"
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="wrap_content" />
<Button
android:layout_gravity="right"
android:text="添加"
android:id="@+id/btn_add"
android:layout_width="@dimen/size_80"
android:layout_height="@dimen/size_38" />
</LinearLayout>
<View
android:layout_marginLeft="@dimen/size_60"
android:layout_width="match_parent"
android:layout_height="1px"
android:background="@color/colorGray" />
</LinearLayout>
......@@ -177,5 +177,6 @@
<string name="text_customer_list">客服列表</string>
<string name="text_group">群聊</string>
<string name="text_new_friend">新的朋友</string>
<string name="add_attention_failed">加关注失败,你已被对方加入黑名单</string>
</resources>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment