diff --git a/chatapp/build.gradle b/chatapp/build.gradle index 9c9c8f62..185bd5ab 100644 --- a/chatapp/build.gradle +++ b/chatapp/build.gradle @@ -59,17 +59,10 @@ dependencies { compile 'com.github.bumptech.glide:glide:3.6.1' compile 'com.github.w446108264:AndroidEmoji:1.0.0' compile 'com.github.chrisbanes.photoview:library:1.2.4' - compile files('libs/universal-image-loader-1.9.5.jar') - compile files('libs/BaiduLBS_Android.jar') compile 'com.facebook.fresco:fresco:0.8.1' - compile files('libs/pinyin4j-2.5.0.jar') compile 'org.greenrobot:eventbus:3.0.0' compile 'io.reactivex:rxandroid:1.2.1' compile project(':reclib-qq') compile project(':reclib-testemoticons') - compile files('libs/picasso-2.5.2.jar') - compile files('libs/core-3.2.1.jar') - compile files('libs/gson-2.2.1.jar') - compile files('libs/jcore-android-1.1.6-debug-b152.jar') compile 'com.contrarywind:Android-PickerView:3.2.4' } diff --git a/chatapp/libs/arm64-v8a/libjcore116.so b/chatapp/libs/arm64-v8a/libjcore117.so similarity index 99% rename from chatapp/libs/arm64-v8a/libjcore116.so rename to chatapp/libs/arm64-v8a/libjcore117.so index 78f40d73..d1013fc8 100644 Binary files a/chatapp/libs/arm64-v8a/libjcore116.so and b/chatapp/libs/arm64-v8a/libjcore117.so differ diff --git a/chatapp/libs/armeabi-v7a/libjcore116.so b/chatapp/libs/armeabi-v7a/libjcore117.so similarity index 99% rename from chatapp/libs/armeabi-v7a/libjcore116.so rename to chatapp/libs/armeabi-v7a/libjcore117.so index 1c5e5fe3..788edc8c 100644 Binary files a/chatapp/libs/armeabi-v7a/libjcore116.so and b/chatapp/libs/armeabi-v7a/libjcore117.so differ diff --git a/chatapp/libs/armeabi/libjcore116.so b/chatapp/libs/armeabi/libjcore117.so similarity index 99% rename from chatapp/libs/armeabi/libjcore116.so rename to chatapp/libs/armeabi/libjcore117.so index 4e7de1d5..ba9781ab 100644 Binary files a/chatapp/libs/armeabi/libjcore116.so and b/chatapp/libs/armeabi/libjcore117.so differ diff --git a/chatapp/libs/jcore-android-1.1.7.jar b/chatapp/libs/jcore-android-1.1.7.jar new file mode 100644 index 00000000..b6ed35e5 Binary files /dev/null and b/chatapp/libs/jcore-android-1.1.7.jar differ diff --git a/chatapp/libs/jmessage-android_v2.3.0.jar b/chatapp/libs/jmessage-android_v2.3.0.jar new file mode 100644 index 00000000..36b20df2 Binary files /dev/null and b/chatapp/libs/jmessage-android_v2.3.0.jar differ diff --git a/chatapp/libs/mips/libjcore116.so b/chatapp/libs/mips/libjcore117.so similarity index 99% rename from chatapp/libs/mips/libjcore116.so rename to chatapp/libs/mips/libjcore117.so index a3f003c7..d6b43f01 100644 Binary files a/chatapp/libs/mips/libjcore116.so and b/chatapp/libs/mips/libjcore117.so differ diff --git a/chatapp/libs/mips64/libjcore116.so b/chatapp/libs/mips64/libjcore117.so similarity index 99% rename from chatapp/libs/mips64/libjcore116.so rename to chatapp/libs/mips64/libjcore117.so index 6d70bb6a..23bf0271 100644 Binary files a/chatapp/libs/mips64/libjcore116.so and b/chatapp/libs/mips64/libjcore117.so differ diff --git a/chatapp/libs/x86/libjcore116.so b/chatapp/libs/x86/libjcore117.so similarity index 99% rename from chatapp/libs/x86/libjcore116.so rename to chatapp/libs/x86/libjcore117.so index 8e2c5eeb..8ed2290b 100644 Binary files a/chatapp/libs/x86/libjcore116.so and b/chatapp/libs/x86/libjcore117.so differ diff --git a/chatapp/libs/x86_64/libjcore116.so b/chatapp/libs/x86_64/libjcore117.so similarity index 99% rename from chatapp/libs/x86_64/libjcore116.so rename to chatapp/libs/x86_64/libjcore117.so index 40ee1e58..e6e53a36 100644 Binary files a/chatapp/libs/x86_64/libjcore116.so and b/chatapp/libs/x86_64/libjcore117.so differ diff --git a/chatapp/src/main/AndroidManifest.xml b/chatapp/src/main/AndroidManifest.xml index 82f9a712..3c860345 100644 --- a/chatapp/src/main/AndroidManifest.xml +++ b/chatapp/src/main/AndroidManifest.xml @@ -123,6 +123,11 @@ android:name="JPUSH_APPKEY" android:value="4f7aef34fb361292c566a1cd"/> + + singleOfflineMsgList = event.getOfflineMessageList(); + if (singleOfflineMsgList != null && singleOfflineMsgList.size() > 0) { + mChatView.setToBottom(); + mChatAdapter.addMsgListToList(singleOfflineMsgList); + } + } + } else { + long groupId = ((GroupInfo) conv.getTargetInfo()).getGroupID(); + if (groupId == mGroupId) { + List offlineMessageList = event.getOfflineMessageList(); + if (offlineMessageList != null && offlineMessageList.size() > 0) { + mChatView.setToBottom(); + mChatAdapter.addMsgListToList(offlineMessageList); + } + } + } + } + private void refreshGroupNum() { Conversation conv = JMessageClient.getGroupConversation(mGroupId); GroupInfo groupInfo = (GroupInfo) conv.getTargetInfo(); diff --git a/chatapp/src/main/java/jiguang/chat/activity/FriendInfoActivity.java b/chatapp/src/main/java/jiguang/chat/activity/FriendInfoActivity.java index b2e45e1d..16c09f81 100644 --- a/chatapp/src/main/java/jiguang/chat/activity/FriendInfoActivity.java +++ b/chatapp/src/main/java/jiguang/chat/activity/FriendInfoActivity.java @@ -104,10 +104,10 @@ public void gotResult(int responseCode, String responseMessage, UserInfo info) { if (responseCode == 0) { //拉取好友信息时候要更新数据库中的nickName.因为如果对方修改了nickName我们是无法感知的.如果不在拉取信息 //时候更新数据库的话会影响到搜索好友的nickName, 注意要在没有备注名并且有昵称时候去更新.因为备注名优先级更高 - if (TextUtils.isEmpty(info.getNotename()) && !TextUtils.isEmpty(info.getNickname())) { - new Update(FriendEntry.class).set("DisplayName=?", info.getNickname()).where("Username=?", mTargetId).execute(); - new Update(FriendEntry.class).set("NickName=?", info.getNickname()).where("Username=?", mTargetId).execute(); - } + new Update(FriendEntry.class).set("DisplayName=?", info.getDisplayName()).where("Username=?", mTargetId).execute(); + new Update(FriendEntry.class).set("NickName=?", info.getNickname()).where("Username=?", mTargetId).execute(); + new Update(FriendEntry.class).set("NoteName=?", info.getNotename()).where("Username=?", mTargetId).execute(); + if (info.getAvatarFile() != null) { new Update(FriendEntry.class).set("Avatar=?", info.getAvatarFile().getAbsolutePath()).where("Username=?", mTargetId).execute(); } @@ -118,7 +118,7 @@ public void gotResult(int responseCode, String responseMessage, UserInfo info) { mTitle = info.getNickname(); } mFriendInfoView.initInfo(info); - }else { + } else { HandleResponseCode.onHandle(FriendInfoActivity.this, responseCode, false); } } diff --git a/chatapp/src/main/java/jiguang/chat/activity/SearchFriendBusinessActivity.java b/chatapp/src/main/java/jiguang/chat/activity/SearchFriendBusinessActivity.java index 4e7d6b6a..6890901e 100644 --- a/chatapp/src/main/java/jiguang/chat/activity/SearchFriendBusinessActivity.java +++ b/chatapp/src/main/java/jiguang/chat/activity/SearchFriendBusinessActivity.java @@ -43,6 +43,7 @@ import jiguang.chat.model.SearchResult; import jiguang.chat.utils.DialogCreator; import jiguang.chat.utils.HandleResponseCode; +import jiguang.chat.utils.SharePreferenceManager; import jiguang.chat.utils.photochoose.SelectableRoundedImageView; import jiguang.chat.utils.pinyin.CharacterParser; import jiguang.chat.utils.query.TextSearcher; @@ -209,6 +210,7 @@ public void onClick(View v) { @Override public void gotResult(int i, String s) { if (i == 0) { + SharePreferenceManager.setIsOpen(true); Toast.makeText(SearchFriendBusinessActivity.this, "发送成功", Toast.LENGTH_SHORT).show(); finish(); } else { diff --git a/chatapp/src/main/java/jiguang/chat/activity/fragment/ContactsFragment.java b/chatapp/src/main/java/jiguang/chat/activity/fragment/ContactsFragment.java index f319e039..9d1246ee 100644 --- a/chatapp/src/main/java/jiguang/chat/activity/fragment/ContactsFragment.java +++ b/chatapp/src/main/java/jiguang/chat/activity/fragment/ContactsFragment.java @@ -172,6 +172,7 @@ public void run() { entry.save(); //收到好友邀请 } else if (event.getType() == ContactNotifyEvent.Type.invite_received) { + //如果同一个人申请多次,则只会出现一次;当点击进验证消息界面后,同一个人再次申请则可以收到 if (JGApplication.forAddFriend.size() > 0) { for (String forAdd : JGApplication.forAddFriend) { if (forAdd.equals(username)) { @@ -206,6 +207,7 @@ public void gotResult(int status, String desc, UserInfo userInfo) { entry.reason = reason; } entry.save(); + //收到好友请求数字 +1 int showNum = SharePreferenceManager.getCachedNewFriendNum() + 1; mContactsView.showNewFriends(showNum); SharePreferenceManager.setCachedNewFriendNum(showNum); diff --git a/chatapp/src/main/java/jiguang/chat/adapter/ChattingListAdapter.java b/chatapp/src/main/java/jiguang/chat/adapter/ChattingListAdapter.java index 7fb9dfad..c0ef6c34 100644 --- a/chatapp/src/main/java/jiguang/chat/adapter/ChattingListAdapter.java +++ b/chatapp/src/main/java/jiguang/chat/adapter/ChattingListAdapter.java @@ -287,6 +287,11 @@ public void addMsgToList(Message msg) { notifyDataSetChanged(); } + public void addMsgListToList(List singleOfflineMsgList) { + mMsgList.addAll(singleOfflineMsgList); + notifyDataSetChanged(); + } + public void addMsgFromReceiptToList(Message msg) { mMsgList.add(msg); msg.setOnSendCompleteCallback(new BasicCallback() { @@ -295,7 +300,7 @@ public void gotResult(int i, String s) { if (i == 0) { incrementStartPosition(); notifyDataSetChanged(); - }else { + } else { HandleResponseCode.onHandle(mContext, i, false); notifyDataSetChanged(); } diff --git a/chatapp/src/main/java/jiguang/chat/adapter/FriendRecommendAdapter.java b/chatapp/src/main/java/jiguang/chat/adapter/FriendRecommendAdapter.java index d5a7a9e9..954e9624 100644 --- a/chatapp/src/main/java/jiguang/chat/adapter/FriendRecommendAdapter.java +++ b/chatapp/src/main/java/jiguang/chat/adapter/FriendRecommendAdapter.java @@ -27,6 +27,7 @@ import jiguang.chat.activity.GroupNotFriendActivity; import jiguang.chat.activity.SearchFriendDetailActivity; import jiguang.chat.application.JGApplication; +import jiguang.chat.database.FriendEntry; import jiguang.chat.database.FriendRecommendEntry; import jiguang.chat.entity.Event; import jiguang.chat.entity.EventType; @@ -110,7 +111,6 @@ public View getView(final int position, View convertView, ViewGroup parent) { name.setText(item.displayName); reason.setText(item.reason); - JMessageClient.getUserInfo(item.username, new GetUserInfoCallback() { @Override public void gotResult(int i, String s, UserInfo userInfo) { @@ -118,6 +118,12 @@ public void gotResult(int i, String s, UserInfo userInfo) { if (userInfo.isFriend()) { item.state = FriendInvitation.ACCEPTED.getValue(); item.save(); + FriendEntry entry = FriendEntry.getFriend(JGApplication.getUserEntry(), item.username, item.appKey); + if (entry == null) { + EventBus.getDefault().post(new Event.Builder().setType(EventType.addFriend) + .setFriendId(item.getId()).build()); + } + } } } diff --git a/chatapp/src/main/java/jiguang/chat/controller/ChatItemController.java b/chatapp/src/main/java/jiguang/chat/controller/ChatItemController.java index 745b7650..f0a03976 100644 --- a/chatapp/src/main/java/jiguang/chat/controller/ChatItemController.java +++ b/chatapp/src/main/java/jiguang/chat/controller/ChatItemController.java @@ -751,12 +751,10 @@ private void sendingTextOrVoice(final ViewHolder holder, final Message msg) { holder.sendingIv.setVisibility(View.VISIBLE); holder.sendingIv.startAnimation(mSendingAnim); //消息正在发送,重新注册一个监听消息发送完成的Callback - System.out.println("=================" + msg.isSendCompleteCallbackExists()); if (!msg.isSendCompleteCallbackExists()) { msg.setOnSendCompleteCallback(new BasicCallback() { @Override public void gotResult(final int status, final String desc) { - System.out.println("=================" + status + desc); holder.sendingIv.setVisibility(View.GONE); holder.sendingIv.clearAnimation(); if (status == 803008) { diff --git a/chatapp/src/main/java/jiguang/chat/controller/ContactsController.java b/chatapp/src/main/java/jiguang/chat/controller/ContactsController.java index 6bd7b501..203de349 100644 --- a/chatapp/src/main/java/jiguang/chat/controller/ContactsController.java +++ b/chatapp/src/main/java/jiguang/chat/controller/ContactsController.java @@ -22,6 +22,7 @@ import jiguang.chat.activity.SearchContactsActivity; import jiguang.chat.activity.SearchForAddFriendActivity; import jiguang.chat.adapter.StickyListAdapter; +import jiguang.chat.application.JGApplication; import jiguang.chat.database.FriendEntry; import jiguang.chat.database.UserEntry; import jiguang.chat.utils.pinyin.HanziToPinyin; @@ -38,6 +39,7 @@ public class ContactsController implements View.OnClickListener, SideBar.OnTouch private Activity mContext; private List mList = new ArrayList<>(); private StickyListAdapter mAdapter; + private List forDelete = new ArrayList<>(); public ContactsController(ContactsView mContactsView, FragmentActivity context) { @@ -125,7 +127,7 @@ public void gotResult(int responseCode, String responseMessage, List u friend.save(); mList.add(friend); } - + forDelete.add(friend); } ActiveAndroid.setTransactionSuccessful(); } finally { @@ -134,6 +136,13 @@ public void gotResult(int responseCode, String responseMessage, List u } else { mContactsView.showLine(); } + //其他端删除好友后,登陆时把数据库中的也删掉 + List friends = JGApplication.getUserEntry().getFriends(); + friends.removeAll(forDelete); + for (FriendEntry del : friends) { + del.delete(); + mList.remove(del); + } Collections.sort(mList, new PinyinComparator()); mAdapter = new StickyListAdapter(mContext, mList, false); mContactsView.setAdapter(mAdapter); diff --git a/chatapp/src/main/java/jiguang/chat/view/ContactsView.java b/chatapp/src/main/java/jiguang/chat/view/ContactsView.java index 01e2cb46..a4b9d22c 100644 --- a/chatapp/src/main/java/jiguang/chat/view/ContactsView.java +++ b/chatapp/src/main/java/jiguang/chat/view/ContactsView.java @@ -14,6 +14,7 @@ import jiguang.chat.R; import jiguang.chat.adapter.StickyListAdapter; +import jiguang.chat.application.JGApplication; import jiguang.chat.controller.ContactsController; import jiguang.chat.utils.SharePreferenceManager; import jiguang.chat.utils.sidebar.SideBar; @@ -114,6 +115,7 @@ public void showNewFriends(int num) { public void dismissNewFriends() { SharePreferenceManager.setCachedNewFriendNum(0); + JGApplication.forAddFriend.clear(); mNewFriendNum.setVisibility(INVISIBLE); } diff --git a/chatapp/src/main/res/layout/activity_chat_detail.xml b/chatapp/src/main/res/layout/activity_chat_detail.xml index ba4e4478..a0e48554 100644 --- a/chatapp/src/main/res/layout/activity_chat_detail.xml +++ b/chatapp/src/main/res/layout/activity_chat_detail.xml @@ -45,7 +45,7 @@ android:id="@+id/tv_moreGroup" android:layout_width="match_parent" android:layout_height="wrap_content" - android:layout_marginBottom="19dp" + android:paddingBottom="19dp" android:gravity="center_horizontal"> +