Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
R
RvApp
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lify
RvApp
Commits
b303a9d6
Commit
b303a9d6
authored
Dec 19, 2019
by
jianglx
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Im添加好友的继续开发。
parent
21228e69
Changes
52
Hide whitespace changes
Inline
Side-by-side
Showing
52 changed files
with
2127 additions
and
261 deletions
+2127
-261
AndroidManifest.xml
plugin_im/src/main/AndroidManifest.xml
+3
-2
AddressListActivity.java
plugin_im/src/main/java/com/rv/im/AddressListActivity.java
+26
-4
ChatHolderFactory.java
plugin_im/src/main/java/com/rv/im/ChatHolderFactory.java
+2
-0
ChatHolderTypeEnum.java
plugin_im/src/main/java/com/rv/im/ChatHolderTypeEnum.java
+6
-1
ImService.java
plugin_im/src/main/java/com/rv/im/ImService.java
+2
-6
NewFriendActivity.java
plugin_im/src/main/java/com/rv/im/NewFriendActivity.java
+0
-43
UserDetailActivity.java
plugin_im/src/main/java/com/rv/im/UserDetailActivity.java
+103
-0
AddRecordListAdapter.java
...src/main/java/com/rv/im/adapter/AddRecordListAdapter.java
+84
-0
AddressListAdapter.java
...m/src/main/java/com/rv/im/adapter/AddressListAdapter.java
+14
-3
ChatContentAdapter.java
...m/src/main/java/com/rv/im/adapter/ChatContentAdapter.java
+17
-0
FriendSearchListAdapter.java
.../main/java/com/rv/im/adapter/FriendSearchListAdapter.java
+5
-2
BaseActivity.java
plugin_im/src/main/java/com/rv/im/base/BaseActivity.java
+0
-63
AttentionUser.java
plugin_im/src/main/java/com/rv/im/bean/AttentionUser.java
+153
-0
ImBaseBean.java
plugin_im/src/main/java/com/rv/im/bean/ImBaseBean.java
+1
-0
UserDetailBean.java
plugin_im/src/main/java/com/rv/im/bean/UserDetailBean.java
+454
-0
FriendDao.java
plugin_im/src/main/java/com/rv/im/db/dao/FriendDao.java
+26
-0
FriendServiceImp.java
.../src/main/java/com/rv/im/db/service/FriendServiceImp.java
+25
-1
IFriendService.java
...im/src/main/java/com/rv/im/db/service/IFriendService.java
+10
-2
Friend.java
plugin_im/src/main/java/com/rv/im/db/table/Friend.java
+33
-7
MessageTypeEnum.java
plugin_im/src/main/java/com/rv/im/enums/MessageTypeEnum.java
+7
-2
AddFriendActivity.java
..._im/src/main/java/com/rv/im/friend/AddFriendActivity.java
+257
-0
NewFriendActivity.java
..._im/src/main/java/com/rv/im/friend/NewFriendActivity.java
+132
-0
AddFriendPresenter.java
...src/main/java/com/rv/im/presenter/AddFriendPresenter.java
+13
-7
NewFriendPresenter.java
...src/main/java/com/rv/im/presenter/NewFriendPresenter.java
+103
-0
UserDetailPresenter.java
...rc/main/java/com/rv/im/presenter/UserDetailPresenter.java
+28
-0
MessageReceiver.java
..._im/src/main/java/com/rv/im/receiver/MessageReceiver.java
+1
-1
NetWorkReceiver.java
..._im/src/main/java/com/rv/im/receiver/NetWorkReceiver.java
+65
-0
RemoteReceiver.java
...n_im/src/main/java/com/rv/im/receiver/RemoteReceiver.java
+1
-1
NotificationMananger.java
...im/src/main/java/com/rv/im/util/NotificationMananger.java
+35
-0
LoadingDialog.java
plugin_im/src/main/java/com/rv/im/view/LoadingDialog.java
+0
-103
ListenerManager.java
plugin_im/src/main/java/com/rv/im/xmpp/ListenerManager.java
+52
-2
ReceiptManager.java
plugin_im/src/main/java/com/rv/im/xmpp/ReceiptManager.java
+10
-4
XChatMessageListener.java
...im/src/main/java/com/rv/im/xmpp/XChatMessageListener.java
+1
-1
resume_empty_icon.png
plugin_im/src/main/res/drawable-hdpi/resume_empty_icon.png
+0
-0
ic_qr_code.png
plugin_im/src/main/res/drawable-xhdpi/ic_qr_code.png
+0
-0
loadering_data.png
plugin_im/src/main/res/drawable-xhdpi/loadering_data.png
+0
-0
me_chevron_right.png
plugin_im/src/main/res/drawable-xhdpi/me_chevron_right.png
+0
-0
set_list_down_press.9.png
..._im/src/main/res/drawable-xhdpi/set_list_down_press.9.png
+0
-0
set_list_up.9.png
plugin_im/src/main/res/drawable-xhdpi/set_list_up.9.png
+0
-0
set_list_up_press.9.png
...in_im/src/main/res/drawable-xhdpi/set_list_up_press.9.png
+0
-0
set_list_down_bg.xml
plugin_im/src/main/res/drawable/set_list_down_bg.xml
+7
-0
set_list_up_bg.xml
plugin_im/src/main/res/drawable/set_list_up_bg.xml
+7
-0
activity_add_friend.xml
plugin_im/src/main/res/layout/activity_add_friend.xml
+1
-1
activity_new_friend.xml
plugin_im/src/main/res/layout/activity_new_friend.xml
+3
-2
activity_user_detail.xml
plugin_im/src/main/res/layout/activity_user_detail.xml
+270
-0
chat_be_friend.xml
plugin_im/src/main/res/layout/chat_be_friend.xml
+31
-0
common_empty.xml
plugin_im/src/main/res/layout/common_empty.xml
+28
-0
item_add_record.xml
plugin_im/src/main/res/layout/item_add_record.xml
+48
-0
item_address_list.xml
plugin_im/src/main/res/layout/item_address_list.xml
+3
-2
item_friend_view.xml
plugin_im/src/main/res/layout/item_friend_view.xml
+1
-0
strings.xml
plugin_im/src/main/res/values/strings.xml
+10
-1
styles.xml
plugin_im/src/main/res/values/styles.xml
+49
-0
No files found.
plugin_im/src/main/AndroidManifest.xml
View file @
b303a9d6
...
...
@@ -57,8 +57,9 @@
android:launchMode=
"singleTask"
android:screenOrientation=
"portrait"
/>
<activity
android:name=
".AddressListActivity"
/>
<activity
android:name=
".AddFriendActivity"
/>
<activity
android:name=
".NewFriendActivity"
></activity>
<activity
android:name=
".friend.AddFriendActivity"
/>
<activity
android:name=
".friend.NewFriendActivity"
/>
<activity
android:name=
".UserDetailActivity"
></activity>
</application>
</manifest>
\ No newline at end of file
plugin_im/src/main/java/com/rv/im/AddressListActivity.java
View file @
b303a9d6
...
...
@@ -13,7 +13,11 @@ import com.rv.component.utils.CacheEnum;
import
com.rv.component.utils.RvCache
;
import
com.rv.im.adapter.AddressListAdapter
;
import
com.rv.im.bean.ContactsBean
;
import
com.rv.im.db.table.ChatMessage
;
import
com.rv.im.friend.NewFriendActivity
;
import
com.rv.im.presenter.AddressPresenter
;
import
com.rv.im.xmpp.ListenerManager
;
import
com.rv.im.xmpp.listener.NewFriendListener
;
import
java.util.ArrayList
;
import
java.util.Collections
;
...
...
@@ -24,7 +28,7 @@ import java.util.List;
* 通讯录
*
*/
public
class
AddressListActivity
extends
BaseStatusActivity
<
AddressPresenter
>
{
public
class
AddressListActivity
extends
BaseStatusActivity
<
AddressPresenter
>
implements
NewFriendListener
{
private
RecyclerView
recyclerView
;
...
...
@@ -36,6 +40,13 @@ public class AddressListActivity extends BaseStatusActivity<AddressPresenter> {
@Override
protected
void
onCreate
(
Bundle
savedInstanceState
)
{
super
.
onCreate
(
savedInstanceState
);
ListenerManager
.
getInstance
().
addNewFriendListener
(
this
);
}
@Override
public
void
onDestroy
()
{
super
.
onDestroy
();
ListenerManager
.
getInstance
().
removeNewFriendListener
(
this
);
}
@Override
...
...
@@ -63,10 +74,11 @@ public class AddressListActivity extends BaseStatusActivity<AddressPresenter> {
}
else
if
(
position
==
1
)
{
}
else
if
(
position
==
2
)
{
in
=
new
Intent
(
AddressListActivity
.
this
,
NewFriendActivity
.
class
)
;
startActivity
(
in
);
in
=
new
Intent
(
AddressListActivity
.
this
,
NewFriendActivity
.
class
)
;
startActivity
(
in
);
}
else
{
in
=
ChatActivity
.
getIntent
(
this
,
bean
.
getToUserId
(),
bean
.
getToNickname
(),
0
);
startActivity
(
in
);
}
});
recyclerView
.
setAdapter
(
adapter
);
...
...
@@ -96,4 +108,14 @@ public class AddressListActivity extends BaseStatusActivity<AddressPresenter> {
break
;
}
}
@Override
public
void
onNewFriendSendStateChange
(
String
toUserId
,
ChatMessage
message
,
int
messageState
)
{
//
}
@Override
public
boolean
onNewFriend
(
ChatMessage
message
)
{
return
false
;
}
}
plugin_im/src/main/java/com/rv/im/ChatHolderFactory.java
View file @
b303a9d6
...
...
@@ -46,6 +46,8 @@ public class ChatHolderFactory {
}
else
{
type
=
ChatHolderTypeEnum
.
VIEW_FROM_VIDEO
;
}
}
else
if
(
message
.
getMessageType
()
==
MessageTypeEnum
.
PASS
.
getType
()){
type
=
ChatHolderTypeEnum
.
VIEW_ADD_FRIEND_SUCCESS
;
}
}
if
(
type
!=
null
)
...
...
plugin_im/src/main/java/com/rv/im/ChatHolderTypeEnum.java
View file @
b303a9d6
...
...
@@ -23,7 +23,12 @@ public enum ChatHolderTypeEnum {
// 视频消息
VIEW_FROM_VIDEO
(
60
),
VIEW_TO_VIDEO
(
61
);
VIEW_TO_VIDEO
(
61
),
// 添加好友 这一块
VIEW_ADD_FRIEND_SUCCESS
(
70
)
;
private
int
id
;
...
...
plugin_im/src/main/java/com/rv/im/ImService.java
View file @
b303a9d6
...
...
@@ -8,16 +8,13 @@ import android.os.IBinder;
import
android.text.TextUtils
;
import
android.util.Log
;
import
com.google.gson.Gson
;
import
com.lzy.okgo.callback.StringCallback
;
import
com.lzy.okgo.model.Response
;
import
com.lzy.okgo.utils.HttpUtils
;
import
com.ruiwenliu.wrapper.MessageEventRemoteLogin
;
import
com.rv.component.utils.AppCookie
;
import
com.rv.component.utils.CacheEnum
;
import
com.rv.component.utils.RvCache
;
import
com.rv.im.bean.LastChatHistoryListBean
;
import
com.rv.im.broadcast.MessageReceiver
;
import
com.rv.im.receiver.MessageReceiver
;
import
com.rv.im.db.table.ChatMessage
;
import
com.rv.im.enums.CallTypeEnum
;
import
com.rv.im.listener.AbstractMsgListener
;
...
...
@@ -36,7 +33,6 @@ import org.greenrobot.eventbus.EventBus;
import
org.jivesoftware.smack.XMPPConnection
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.UUID
;
...
...
@@ -316,7 +312,7 @@ public class ImService extends Service {
* 先添加一个等待接收回执的消息
* 然后再发送这条消息
*/
mReceiptManager
.
addWillSendMessage
(
toUserId
,
chatMessage
,
ReceiptManager
.
SendType
.
NORMAL
,
chatMessage
.
getContent
());
mReceiptManager
.
addWillSendMessage
(
toUserId
,
chatMessage
,
chatMessage
.
getContent
());
mXChatManager
.
sendMessage
(
toUserId
,
chatMessage
);
}
}
...
...
plugin_im/src/main/java/com/rv/im/NewFriendActivity.java
deleted
100644 → 0
View file @
21228e69
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
);
});
}
}
plugin_im/src/main/java/com/rv/im/UserDetailActivity.java
0 → 100644
View file @
b303a9d6
package
com
.
rv
.
im
;
import
android.content.Context
;
import
android.content.Intent
;
import
android.support.v7.app.AppCompatActivity
;
import
android.os.Bundle
;
import
android.text.TextUtils
;
import
android.widget.Button
;
import
android.widget.TextView
;
import
com.ruiwenliu.wrapper.base.BaseBean
;
import
com.ruiwenliu.wrapper.base.BaseStatusActivity
;
import
com.ruiwenliu.wrapper.weight.TitleView
;
import
com.rv.im.bean.UserDetailBean
;
import
com.rv.im.db.service.FriendServiceImp
;
import
com.rv.im.presenter.UserDetailPresenter
;
import
com.rv.im.view.RoundImageView
;
public
class
UserDetailActivity
extends
BaseStatusActivity
<
UserDetailPresenter
>
{
private
static
final
String
KEY_USER_ID
=
"userId"
;
private
String
userId
;
private
String
mLoginUserId
;
private
RoundImageView
avatarImg
;
private
TextView
nameTv
;
private
TextView
renameTv
;
private
TextView
sexTv
;
private
TextView
birthdayTv
;
private
TextView
cityText
;
private
TextView
phoneTv
;
private
TextView
onlineTv
;
private
Button
btnNextStep
;
public
static
void
start
(
Context
ctx
,
String
userId
)
{
Intent
intent
=
new
Intent
(
ctx
,
UserDetailActivity
.
class
);
Bundle
bundle
=
new
Bundle
();
bundle
.
putString
(
KEY_USER_ID
,
userId
);
intent
.
putExtras
(
bundle
);
ctx
.
startActivity
(
intent
);
}
@Override
protected
void
onCreate
(
Bundle
savedInstanceState
)
{
super
.
onCreate
(
savedInstanceState
);
}
@Override
protected
int
setLayout
()
{
return
R
.
layout
.
activity_user_detail
;
}
@Override
protected
void
initView
(
Bundle
savedInstanceState
,
TitleView
titleView
,
Intent
intent
)
{
titleView
.
setTitle
(
"基本信息"
);
initWeight
();
}
@Override
protected
void
loadData
(
Bundle
savedInstanceState
,
Intent
intent
)
{
super
.
loadData
(
savedInstanceState
,
intent
);
if
(
intent
!=
null
)
{
userId
=
intent
.
getStringExtra
(
KEY_USER_ID
);
}
mLoginUserId
=
ImSetting
.
getUserId
();
if
(
TextUtils
.
isEmpty
(
userId
))
{
userId
=
mLoginUserId
;
}
mPresenter
.
loadOtherInfoFromNet
(
userId
);
}
private
void
initWeight
()
{
nameTv
=
findViewById
(
R
.
id
.
name_tv
);
avatarImg
=
findViewById
(
R
.
id
.
avatar_img
);
renameTv
=
findViewById
(
R
.
id
.
rename_tv
);
sexTv
=
findViewById
(
R
.
id
.
sex_tv
);
birthdayTv
=
findViewById
(
R
.
id
.
birthday_tv
);
cityText
=
findViewById
(
R
.
id
.
city_text
);
phoneTv
=
findViewById
(
R
.
id
.
phone_tv
);
onlineTv
=
findViewById
(
R
.
id
.
online_tv
);
btnNextStep
=
findViewById
(
R
.
id
.
next_step_btn
);
}
@Override
public
void
onShowResult
(
int
requestType
,
BaseBean
result
)
{
switch
(
requestType
)
{
case
0
:
if
(
result
!=
null
&&
result
.
resultCode
==
1
)
{
UserDetailBean
userDetailBean
=
(
UserDetailBean
)
result
;
updateUi
();
}
break
;
}
}
private
void
updateUi
()
{
}
}
plugin_im/src/main/java/com/rv/im/adapter/AddRecordListAdapter.java
0 → 100644
View file @
b303a9d6
package
com
.
rv
.
im
.
adapter
;
import
android.support.annotation.Nullable
;
import
android.text.TextUtils
;
import
android.view.View
;
import
com.chad.library.adapter.base.BaseQuickAdapter
;
import
com.chad.library.adapter.base.BaseViewHolder
;
import
com.rv.im.R
;
import
com.rv.im.db.table.Friend
;
import
java.util.List
;
public
class
AddRecordListAdapter
extends
BaseQuickAdapter
<
Friend
,
BaseViewHolder
>
{
private
FriendItemClickListener
listener
;
public
AddRecordListAdapter
(
@Nullable
List
<
Friend
>
data
)
{
super
(
R
.
layout
.
item_add_record
,
data
);
}
public
void
setListener
(
FriendItemClickListener
listener
)
{
this
.
listener
=
listener
;
}
@Override
protected
void
convert
(
BaseViewHolder
helper
,
Friend
item
)
{
if
(
item
==
null
)
return
;
/********
* 1 等待验证 ,添加成功
* 2 同意,已同意,已拒绝
*/
helper
.
setImageResource
(
R
.
id
.
img_header
,
R
.
drawable
.
icon_lion
);
helper
.
setText
(
R
.
id
.
tv_name
,
TextUtils
.
isEmpty
(
item
.
getUserName
())
?
" "
:
item
.
getUserName
());
helper
.
setOnClickListener
(
R
.
id
.
ll_content
,
v
->
{
if
(
listener
!=
null
)
{
listener
.
showDetail
(
item
);
}
});
if
(
item
.
getStatus
()
==
Friend
.
STATUS_10
)
{
helper
.
itemView
.
findViewById
(
R
.
id
.
btn_add
).
setVisibility
(
View
.
GONE
);
helper
.
itemView
.
findViewById
(
R
.
id
.
text_add_status
).
setVisibility
(
View
.
VISIBLE
);
if
(!
TextUtils
.
isEmpty
(
item
.
getAction
()))
{
helper
.
setText
(
R
.
id
.
text_add_status
,
item
.
getAction
());
}
}
else
if
(
item
.
getStatus
()
==
Friend
.
STATUS_11
){
helper
.
itemView
.
findViewById
(
R
.
id
.
btn_add
).
setVisibility
(
View
.
VISIBLE
);
helper
.
itemView
.
findViewById
(
R
.
id
.
text_add_status
).
setVisibility
(
View
.
GONE
);
if
(!
TextUtils
.
isEmpty
(
item
.
getAction
()))
{
helper
.
setText
(
R
.
id
.
btn_add
,
item
.
getAction
());
}
}
else
if
(
item
.
getStatus
()
==
Friend
.
STATUS_12
){
helper
.
itemView
.
findViewById
(
R
.
id
.
btn_add
).
setVisibility
(
View
.
GONE
);
helper
.
itemView
.
findViewById
(
R
.
id
.
text_add_status
).
setVisibility
(
View
.
VISIBLE
);
if
(!
TextUtils
.
isEmpty
(
item
.
getAction
()))
{
helper
.
setText
(
R
.
id
.
text_add_status
,
item
.
getAction
());
}
}
else
if
(
item
.
getStatus
()
==
Friend
.
STATUS_13
){
helper
.
itemView
.
findViewById
(
R
.
id
.
btn_add
).
setVisibility
(
View
.
GONE
);
helper
.
itemView
.
findViewById
(
R
.
id
.
text_add_status
).
setVisibility
(
View
.
VISIBLE
);
if
(!
TextUtils
.
isEmpty
(
item
.
getAction
()))
{
helper
.
setText
(
R
.
id
.
text_add_status
,
item
.
getAction
());
}
}
helper
.
setOnClickListener
(
R
.
id
.
btn_add
,
v
->
{
if
(
listener
!=
null
)
{
listener
.
agree
(
item
);
}
});
}
public
interface
FriendItemClickListener
{
void
showDetail
(
Friend
item
);
void
agree
(
Friend
item
);
}
}
plugin_im/src/main/java/com/rv/im/adapter/AddressListAdapter.java
View file @
b303a9d6
...
...
@@ -3,13 +3,13 @@ package com.rv.im.adapter;
import
android.support.annotation.Nullable
;
import
android.text.TextUtils
;
import
android.view.View
;
import
android.widget.ImageView
;
import
com.chad.library.adapter.base.BaseQuickAdapter
;
import
com.chad.library.adapter.base.BaseViewHolder
;
import
com.ruiwenliu.wrapper.util.glide.GlideManager
;
import
com.rv.im.R
;
import
com.rv.im.bean.ContactsBean
;
import
com.rv.im.util.sortlist.PingYinUtil
;
import
java.util.List
;
...
...
@@ -18,7 +18,7 @@ public class AddressListAdapter extends BaseQuickAdapter<ContactsBean.ContactIte
private
boolean
needShowNavigation
=
true
;
private
char
lastNavigation
;
private
char
lastNavigation
=
'A'
;
public
AddressListAdapter
(
@Nullable
List
<
ContactsBean
.
ContactItemBean
>
data
)
{
super
(
R
.
layout
.
item_address_list
,
data
);
...
...
@@ -40,8 +40,19 @@ public class AddressListAdapter extends BaseQuickAdapter<ContactsBean.ContactIte
helper
.
setImageResource
(
R
.
id
.
img_header
,
item
.
getLocalHead
());
}
}
else
{
String
navigation
=
PingYinUtil
.
getPingYin
(
item
.
getToNickname
());
if
(!
TextUtils
.
isEmpty
(
navigation
)
&&
navigation
.
charAt
(
0
)
==
lastNavigation
)
{
needShowNavigation
=
false
;
}
else
{
if
(!
TextUtils
.
isEmpty
(
navigation
))
{
lastNavigation
=
navigation
.
charAt
(
0
);
}
needShowNavigation
=
true
;
}
if
(
needShowNavigation
)
{
helper
.
itemView
.
findViewById
(
R
.
id
.
ll_navigation
).
setVisibility
(
View
.
VISIBLE
);
helper
.
setText
(
R
.
id
.
tv_character
,
TextUtils
.
isEmpty
(
navigation
)
?
""
:
String
.
valueOf
(
navigation
.
charAt
(
0
)));
}
else
{
helper
.
itemView
.
findViewById
(
R
.
id
.
ll_navigation
).
setVisibility
(
View
.
GONE
);
}
...
...
plugin_im/src/main/java/com/rv/im/adapter/ChatContentAdapter.java
View file @
b303a9d6
...
...
@@ -103,6 +103,8 @@ public class ChatContentAdapter extends RecyclerView.Adapter<RecyclerView.ViewHo
return
new
MsgFromVideoCallHolder
(
LayoutInflater
.
from
(
mContext
).
inflate
(
R
.
layout
.
chat_from_item_video_call
,
viewGroup
,
false
));
case
61
:
return
new
MsgToVideoCallHolder
(
LayoutInflater
.
from
(
mContext
).
inflate
(
R
.
layout
.
chat_to_item_video_call
,
viewGroup
,
false
));
case
70
:
return
new
MsgBeFriendHolder
(
LayoutInflater
.
from
(
mContext
).
inflate
(
R
.
layout
.
chat_be_friend
,
viewGroup
,
false
))
;
}
return
null
;
}
...
...
@@ -135,6 +137,8 @@ public class ChatContentAdapter extends RecyclerView.Adapter<RecyclerView.ViewHo
setFromVideoCallContentView
(
bean
,
(
MsgFromVideoCallHolder
)
viewHolder
);
}
else
if
(
viewHolder
instanceof
MsgToVideoCallHolder
)
{
setToVideoCallContentView
(
bean
,
(
MsgToVideoCallHolder
)
viewHolder
);
}
else
if
(
viewHolder
instanceof
MsgBeFriendHolder
){
setBeFriendContentView
(
bean
,
(
MsgBeFriendHolder
)
viewHolder
);
}
}
}
...
...
@@ -198,6 +202,10 @@ public class ChatContentAdapter extends RecyclerView.Adapter<RecyclerView.ViewHo
}
}
private
void
setBeFriendContentView
(
ChatMessage
bean
,
MsgBeFriendHolder
holder
){
showTime
(
holder
.
tvTime
,
bean
);
}
private
void
setToTextContentView
(
ChatMessage
bean
,
MsgToTextHolder
holder
)
{
showTime
(
holder
.
tvSendTime
,
bean
);
holder
.
chatText
.
setText
(
parser
.
addSmileySpans
(
deleteHtml
(
bean
.
getContent
()),
true
));
...
...
@@ -508,6 +516,15 @@ public class ChatContentAdapter extends RecyclerView.Adapter<RecyclerView.ViewHo
}
}
class
MsgBeFriendHolder
extends
RecyclerView
.
ViewHolder
{
TextView
tvTime
;
public
MsgBeFriendHolder
(
@NonNull
View
itemView
)
{
super
(
itemView
);
tvTime
=
itemView
.
findViewById
(
R
.
id
.
tv_time
);
}
}
class
MsgFromTextHolder
extends
RecyclerView
.
ViewHolder
{
TextView
tvSendTime
;
RoundImageView
ivHeader
;
...
...
plugin_im/src/main/java/com/rv/im/adapter/FriendSearchListAdapter.java
View file @
b303a9d6
...
...
@@ -3,6 +3,8 @@ package com.rv.im.adapter;
import
android.support.annotation.Nullable
;
import
android.text.TextUtils
;
import
android.view.View
;
import
android.widget.CompoundButton
;
import
android.widget.LinearLayout
;
import
android.widget.TextView
;
import
com.chad.library.adapter.base.BaseQuickAdapter
;
...
...
@@ -32,8 +34,9 @@ public class FriendSearchListAdapter extends BaseQuickAdapter<FriendSearchBean.F
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
->
{
// 显示
LinearLayout
llContent
=
helper
.
itemView
.
findViewById
(
R
.
id
.
ll_content
)
;
llContent
.
setOnClickListener
(
v
->
{
if
(
listener
!=
null
)
{
listener
.
showDetail
(
item
);
}
...
...
plugin_im/src/main/java/com/rv/im/base/BaseActivity.java
deleted
100644 → 0
View file @
21228e69
package
com
.
rv
.
im
.
base
;
import
android.graphics.Color
;
import
android.graphics.drawable.ColorDrawable
;
import
android.os.Build
;
import
android.os.Bundle
;
import
android.support.annotation.Nullable
;
import
android.support.v7.app.AppCompatActivity
;
import
android.view.View
;
import
android.view.Window
;
import
android.view.WindowManager
;
import
com.rv.im.util.SkinUtils
;
public
abstract
class
BaseActivity
extends
AppCompatActivity
implements
View
.
OnClickListener
{
@Override
protected
void
onCreate
(
@Nullable
Bundle
savedInstanceState
)
{
setStatusBarColor
();
super
.
onCreate
(
savedInstanceState
);
setContentView
(
getLayout
());
initView
();
getData
();
setActionBar
();
}
public
abstract
int
getLayout
();
public
abstract
void
initView
();
public
abstract
void
getData
();
protected
void
setActionBar
()
{
if
(
getSupportActionBar
()
!=
null
)
{
// 因为有的activity没有actionBar,所以加个判断
SkinUtils
.
Skin
skin
=
SkinUtils
.
getSkin
(
this
);
getSupportActionBar
().
setBackgroundDrawable
(
new
ColorDrawable
(
skin
.
getPrimaryColor
()));
if
(
Build
.
VERSION
.
SDK_INT
>=
21
)
{
//兼容5.0 去除actionbar阴影
getSupportActionBar
().
setElevation
(
0
);
}
}
}
/**
* 沉浸式状态栏
*/
private
void
setStatusBarColor
()
{
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
LOLLIPOP
)
{
// >=5.0 背景为全透明
/* >=5.0,this method(getWindow().addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS));
in some phone is half-transparent like vivo、nexus6p..
in some phone is full-transparent
so ...*/
Window
window
=
getWindow
();
window
.
clearFlags
(
WindowManager
.
LayoutParams
.
FLAG_TRANSLUCENT_STATUS
);
window
.
getDecorView
().
setSystemUiVisibility
(
View
.
SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
|
View
.
SYSTEM_UI_FLAG_LAYOUT_STABLE
);
window
.
addFlags
(
WindowManager
.
LayoutParams
.
FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS
);
window
.
setStatusBarColor
(
Color
.
TRANSPARENT
);
}
else
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
KITKAT
)
{
// 4.4背景为渐变半透明
getWindow
().
addFlags
(
WindowManager
.
LayoutParams
.
FLAG_TRANSLUCENT_STATUS
);
}
}
}
plugin_im/src/main/java/com/rv/im/bean/AttentionUser.java
0 → 100644
View file @
b303a9d6
package
com
.
rv
.
im
.
bean
;
import
com.google.gson.annotations.SerializedName
;
public
class
AttentionUser
{
private
int
blacklist
;
// 0 表示不是黑名单,1表示是在黑名单
private
int
isBeenBlack
;
// 1表示对方将我拉入黑名单
private
int
status
;
private
String
userId
;
// 发起关注的人
private
String
toUserId
;
// 被关注的人
private
int
toUserType
;
// 2 公众号
@SerializedName
(
"toNickname"
)
private
String
toNickName
;
private
String
remarkName
;
private
String
describe
;
private
int
offlineNoPushMsg
;
// 消息免打扰
private
double
chatRecordTimeOut
;
//0 || -1 消息永久保存 单位:day
private
int
createTime
;
private
int
modifyTime
;
// 修改时间
private
int
groupId
;
// 分组Id
private
String
groupName
;
// 分组名称
private
int
companyId
;
public
int
getBlacklist
()
{
return
blacklist
;
}
public
void
setBlacklist
(
int
blacklist
)
{
this
.
blacklist
=
blacklist
;
}
public
int
getIsBeenBlack
()
{
return
isBeenBlack
;
}
public
void
setIsBeenBlack
(
int
isBeenBlack
)
{
this
.
isBeenBlack
=
isBeenBlack
;
}
public
int
getStatus
()
{
return
status
;
}
public
void
setStatus
(
int
status
)
{
this
.
status
=
status
;
}
public
String
getUserId
()
{
return
userId
;
}
public
void
setUserId
(
String
userId
)
{
this
.
userId
=
userId
;
}
public
String
getToUserId
()
{
return
toUserId
;
}
public
void
setToUserId
(
String
toUserId
)
{
this
.
toUserId
=
toUserId
;
}
public
int
getToUserType
()
{
return
toUserType
;
}
public
void
setToUserType
(
int
toUserType
)
{
this
.
toUserType
=
toUserType
;
}
public
String
getToNickName
()
{
return
toNickName
;
}
public
void
setToNickName
(
String
toNickName
)
{
this
.
toNickName
=
toNickName
;
}
public
String
getRemarkName
()
{
return
remarkName
;
}
public
void
setRemarkName
(
String
remarkName
)
{
this
.
remarkName
=
remarkName
;
}
public
int
getOfflineNoPushMsg
()
{
return
offlineNoPushMsg
;
}
public
void
setOfflineNoPushMsg
(
int
offlineNoPushMsg
)
{
this
.
offlineNoPushMsg
=
offlineNoPushMsg
;
}
public
double
getChatRecordTimeOut
()
{
return
chatRecordTimeOut
;
}
public
void
setChatRecordTimeOut
(
double
chatRecordTimeOut
)
{
this
.
chatRecordTimeOut
=
chatRecordTimeOut
;
}
public
int
getCreateTime
()
{
return
createTime
;
}
public
void
setCreateTime
(
int
createTime
)
{
this
.
createTime
=
createTime
;
}
public
int
getModifyTime
()
{
return
modifyTime
;
}
public
void
setModifyTime
(
int
modifyTime
)
{
this
.
modifyTime
=
modifyTime
;
}
public
int
getGroupId
()
{
return
groupId
;
}
public
void
setGroupId
(
int
groupId
)
{
this
.
groupId
=
groupId
;
}
public
String
getGroupName
()
{
return
groupName
;
}
public
void
setGroupName
(
String
groupName
)
{
this
.
groupName
=
groupName
;
}
public
int
getCompanyId
()
{
return
companyId
;
}
public
void
setCompanyId
(
int
companyId
)
{
this
.
companyId
=
companyId
;
}
public
String
getDescribe
()
{
return
describe
;
}
public
void
setDescribe
(
String
describe
)
{
this
.
describe
=
describe
;
}
}
plugin_im/src/main/java/com/rv/im/bean/ImBaseBean.java
View file @
b303a9d6
...
...
@@ -6,4 +6,5 @@ public class ImBaseBean extends BaseBean {
public
transient
int
status
;
public
transient
String
message
;
public
String
resultMsg
;
}
plugin_im/src/main/java/com/rv/im/bean/UserDetailBean.java
0 → 100644
View file @
b303a9d6
package
com
.
rv
.
im
.
bean
;
import
com.google.gson.annotations.SerializedName
;
import
java.util.List
;
public
class
UserDetailBean
extends
ImBaseBean
{
private
long
currentTime
;
private
UserDetail
data
;
public
long
getCurrentTime
()
{
return
currentTime
;
}
public
void
setCurrentTime
(
long
currentTime
)
{
this
.
currentTime
=
currentTime
;
}
public
UserDetail
getData
()
{
return
data
;
}
public
void
setData
(
UserDetail
data
)
{
this
.
data
=
data
;
}
public
class
UserDetail
{
private
int
userType
;
// 用户类型
@SerializedName
(
"nickname"
)
private
String
nickName
;
// 昵称
private
String
telephone
;
// 手机号码,带区号,
private
String
phone
;
// 手机号码,不带区号,
private
String
password
;
private
String
description
;
// 签名
private
long
birthday
;
// 公历生日
private
long
showLastLoginTime
;
// 上次登录时间,
private
int
sex
=
0
;
// 性别 0表示女,1表示男
private
int
countryId
;
// 国家编号
private
int
provinceId
;
// 省份编号
private
int
cityId
;
// 城市编号
private
int
areaId
;
// 地区编号
private
int
integral
;
// 积分
private
int
integralTotal
;
// 积分总数
private
int
level
;
// 等级
private
float
money
;
// 金钱
private
float
moneyTotal
;
// 金钱总数
private
int
vip
;
// vip等级
private
int
friendsCount
;
// 朋友总数
private
int
fansCount
;
// 粉丝总数
private
int
attCount
;
// 关注总数
private
int
isAuth
;
// 是否认证
private
int
status
;
// 状态(未知)
private
long
offlineTime
;
private
String
account
;
private
int
setAccountCount
;
private
AttentionUser
friends
;
private
LoginLog
loginLog
;
private
Loc
loc
;
private
String
myInviteCode
;
private
double
balance
;
// 余额
// 1=游客(用于后台浏览数据);2=公众号 ;3=机器账号,由系统自动生成;4=客服账号;5=管理员;6=超级管理员;7=财务;
private
List
<
Integer
>
role
;
// 身份,
private
int
offlineNoPushMsg
;
private
int
onlinestate
;
// 好友是否在线
private
int
createTime
;
// 注册日期,
public
int
getUserType
()
{
return
userType
;
}
public
void
setUserType
(
int
userType
)
{
this
.
userType
=
userType
;
}
public
String
getNickName
()
{
return
nickName
;
}
public
void
setNickName
(
String
nickName
)
{
this
.
nickName
=
nickName
;
}
public
String
getTelephone
()
{
return
telephone
;
}
public
void
setTelephone
(
String
telephone
)
{
this
.
telephone
=
telephone
;
}
public
String
getPhone
()
{
return
phone
;
}
public
void
setPhone
(
String
phone
)
{
this
.
phone
=
phone
;
}
public
String
getPassword
()
{
return
password
;
}
public
void
setPassword
(
String
password
)
{
this
.
password
=
password
;
}
public
String
getDescription
()
{
return
description
;
}
public
void
setDescription
(
String
description
)
{
this
.
description
=
description
;
}
public
long
getBirthday
()
{
return
birthday
;
}
public
void
setBirthday
(
long
birthday
)
{
this
.
birthday
=
birthday
;
}
public
long
getShowLastLoginTime
()
{
return
showLastLoginTime
;
}
public
void
setShowLastLoginTime
(
long
showLastLoginTime
)
{
this
.
showLastLoginTime
=
showLastLoginTime
;
}
public
int
getSex
()
{
return
sex
;
}
public
void
setSex
(
int
sex
)
{
this
.
sex
=
sex
;
}
public
int
getCountryId
()
{
return
countryId
;
}
public
void
setCountryId
(
int
countryId
)
{
this
.
countryId
=
countryId
;
}
public
int
getProvinceId
()
{
return
provinceId
;
}
public
void
setProvinceId
(
int
provinceId
)
{
this
.
provinceId
=
provinceId
;
}
public
int
getCityId
()
{
return
cityId
;
}
public
void
setCityId
(
int
cityId
)
{
this
.
cityId
=
cityId
;
}
public
int
getAreaId
()
{
return
areaId
;
}
public
void
setAreaId
(
int
areaId
)
{
this
.
areaId
=
areaId
;
}
public
int
getIntegral
()
{
return
integral
;
}
public
void
setIntegral
(
int
integral
)
{
this
.
integral
=
integral
;
}
public
int
getIntegralTotal
()
{
return
integralTotal
;
}
public
void
setIntegralTotal
(
int
integralTotal
)
{
this
.
integralTotal
=
integralTotal
;
}
public
int
getLevel
()
{
return
level
;
}
public
void
setLevel
(
int
level
)
{
this
.
level
=
level
;
}
public
float
getMoney
()
{
return
money
;
}
public
void
setMoney
(
float
money
)
{
this
.
money
=
money
;
}
public
float
getMoneyTotal
()
{
return
moneyTotal
;
}
public
void
setMoneyTotal
(
float
moneyTotal
)
{
this
.
moneyTotal
=
moneyTotal
;
}
public
int
getVip
()
{
return
vip
;
}
public
void
setVip
(
int
vip
)
{
this
.
vip
=
vip
;
}
public
int
getFriendsCount
()
{
return
friendsCount
;
}
public
void
setFriendsCount
(
int
friendsCount
)
{
this
.
friendsCount
=
friendsCount
;
}
public
int
getFansCount
()
{
return
fansCount
;
}
public
void
setFansCount
(
int
fansCount
)
{
this
.
fansCount
=
fansCount
;
}
public
int
getAttCount
()
{
return
attCount
;
}
public
void
setAttCount
(
int
attCount
)
{
this
.
attCount
=
attCount
;
}
public
int
getIsAuth
()
{
return
isAuth
;
}
public
void
setIsAuth
(
int
isAuth
)
{
this
.
isAuth
=
isAuth
;
}
public
int
getStatus
()
{
return
status
;
}
public
void
setStatus
(
int
status
)
{
this
.
status
=
status
;
}
public
long
getOfflineTime
()
{
return
offlineTime
;
}
public
void
setOfflineTime
(
long
offlineTime
)
{
this
.
offlineTime
=
offlineTime
;
}
public
String
getAccount
()
{
return
account
;
}
public
void
setAccount
(
String
account
)
{
this
.
account
=
account
;
}
public
int
getSetAccountCount
()
{
return
setAccountCount
;
}
public
void
setSetAccountCount
(
int
setAccountCount
)
{
this
.
setAccountCount
=
setAccountCount
;
}
public
AttentionUser
getFriends
()
{
return
friends
;
}
public
void
setFriends
(
AttentionUser
friends
)
{
this
.
friends
=
friends
;
}
public
LoginLog
getLoginLog
()
{
return
loginLog
;
}
public
void
setLoginLog
(
LoginLog
loginLog
)
{
this
.
loginLog
=
loginLog
;
}
public
Loc
getLoc
()
{
return
loc
;
}
public
void
setLoc
(
Loc
loc
)
{
this
.
loc
=
loc
;
}
public
String
getMyInviteCode
()
{
return
myInviteCode
;
}
public
void
setMyInviteCode
(
String
myInviteCode
)
{
this
.
myInviteCode
=
myInviteCode
;
}
public
double
getBalance
()
{
return
balance
;
}
public
void
setBalance
(
double
balance
)
{
this
.
balance
=
balance
;
}
public
List
<
Integer
>
getRole
()
{
return
role
;
}
public
void
setRole
(
List
<
Integer
>
role
)
{
this
.
role
=
role
;
}
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
getCreateTime
()
{
return
createTime
;
}
public
void
setCreateTime
(
int
createTime
)
{
this
.
createTime
=
createTime
;
}
}
public
static
class
LoginLog
{
private
int
isFirstLogin
;
private
double
latitude
;
private
double
longitude
;
private
int
loginTime
;
private
String
model
;
private
String
osVersion
;
private
String
serial
;
private
int
offlineTime
;
public
int
getIsFirstLogin
()
{
return
isFirstLogin
;
}
public
void
setIsFirstLogin
(
int
isFirstLogin
)
{
this
.
isFirstLogin
=
isFirstLogin
;
}
public
double
getLatitude
()
{
return
latitude
;
}
public
void
setLatitude
(
double
latitude
)
{
this
.
latitude
=
latitude
;
}
public
double
getLongitude
()
{
return
longitude
;
}
public
void
setLongitude
(
double
longitude
)
{
this
.
longitude
=
longitude
;
}
public
int
getLoginTime
()
{
return
loginTime
;
}
public
void
setLoginTime
(
int
loginTime
)
{
this
.
loginTime
=
loginTime
;
}
public
String
getModel
()
{
return
model
;
}
public
void
setModel
(
String
model
)
{
this
.
model
=
model
;
}
public
String
getOsVersion
()
{
return
osVersion
;
}
public
void
setOsVersion
(
String
osVersion
)
{
this
.
osVersion
=
osVersion
;
}
public
String
getSerial
()
{
return
serial
;
}
public
void
setSerial
(
String
serial
)
{
this
.
serial
=
serial
;
}
public
int
getOfflineTime
()
{
return
offlineTime
;
}
public
void
setOfflineTime
(
int
offlineTime
)
{
this
.
offlineTime
=
offlineTime
;
}
}
public
static
class
Loc
{
private
double
lat
;
private
double
lng
;
public
double
getLat
()
{
return
lat
;
}
public
void
setLat
(
double
lat
)
{
this
.
lat
=
lat
;
}
public
double
getLng
()
{
return
lng
;
}
public
void
setLng
(
double
lng
)
{
this
.
lng
=
lng
;
}
}
}
plugin_im/src/main/java/com/rv/im/db/dao/FriendDao.java
View file @
b303a9d6
...
...
@@ -94,6 +94,32 @@ public class FriendDao {
}
}
/*******
*
* 查询好友列表
*
* @return
*/
public
List
<
Friend
>
getFriendList
()
{
if
(
dao
==
null
)
{
LogUtil
.
e
(
TAG
,
"dao is null"
);
return
null
;
}
List
<
Friend
>
friendList
=
null
;
try
{
friendList
=
dao
.
queryBuilder
().
where
().
eq
(
"status"
,
Friend
.
STATUS_10
)
.
or
().
eq
(
"status"
,
Friend
.
STATUS_11
)
.
or
().
eq
(
"status"
,
Friend
.
STATUS_12
)
.
or
().
eq
(
"status"
,
Friend
.
STATUS_13
)
.
or
().
eq
(
"status"
,
Friend
.
STATUS_21
)
.
or
().
eq
(
"status"
,
Friend
.
STATUS_22
)
.
query
();
}
catch
(
SQLException
e
)
{
e
.
printStackTrace
();
}
return
friendList
;
}
/*****
* 更新消息
* @param friend
...
...
plugin_im/src/main/java/com/rv/im/db/service/FriendServiceImp.java
View file @
b303a9d6
...
...
@@ -2,20 +2,44 @@ package com.rv.im.db.service;
import
android.content.Context
;
import
com.rv.im.db.dao.ConversationDao
;
import
com.rv.im.db.dao.FriendDao
;
import
com.rv.im.db.dao.MessageDao
;
import
com.rv.im.db.table.Friend
;
import
java.util.List
;
public
class
FriendServiceImp
implements
IFriendService
{
private
FriendDao
dao
=
null
;
public
FriendServiceImp
(
Context
context
)
{
private
static
FriendServiceImp
instance
=
null
;
private
FriendServiceImp
(
Context
context
)
{
dao
=
FriendDao
.
getInstance
(
context
);
}
public
static
FriendServiceImp
getInstance
(
Context
context
)
{
if
(
instance
==
null
)
{
instance
=
new
FriendServiceImp
(
context
.
getApplicationContext
());
}
return
instance
;
}
@Override
public
void
addMessage
(
Friend
friend
)
{
dao
.
addMessage
(
friend
);
}
@Override
public
List
<
Friend
>
getAllFriends
()
{
return
dao
.
getFriendList
();
}
@Override
public
Friend
getFriend
(
String
user
)
{
return
null
;
}
}
plugin_im/src/main/java/com/rv/im/db/service/IFriendService.java
View file @
b303a9d6
...
...
@@ -2,14 +2,22 @@ package com.rv.im.db.service;
import
com.rv.im.db.table.Friend
;
import
java.util.List
;
/*******
*
* 好友操作服务
*/
public
interface
IFriendService
{
void
addMessage
(
Friend
friend
)
;
List
<
Friend
>
getAllFriends
();
/*****
* 根据userId 获取朋友信息
* @param user
* @return
*/
Friend
getFriend
(
String
user
)
;
}
plugin_im/src/main/java/com/rv/im/db/table/Friend.java
View file @
b303a9d6
...
...
@@ -7,18 +7,44 @@ import com.j256.ormlite.table.DatabaseTable;
@DatabaseTable
(
tableName
=
"tb_friend"
)
public
class
Friend
{
// -1:黑名单;0:陌生人;1:单方关注;2:互为好友;8:显示系统号;9:非显示系统号
public
static
final
int
STATUS_BLACKLIST
=
-
1
;
// 黑名单
public
static
final
int
STATUS_UNKNOW
=
0
;
// 陌生人(不可能出现在好友表,只可能在新朋友消息表)
public
static
final
int
STATUS_ATTENTION
=
1
;
// 关注
public
static
final
int
STATUS_FRIEND
=
2
;
// 好友
public
static
final
int
STATUS_SYSTEM
=
8
;
// 显示系统号
// 需要验证的
public
static
final
int
STATUS_10
=
10
;
//显示 等待验证
public
static
final
int
STATUS_11
=
11
;
//您好
public
static
final
int
STATUS_12
=
12
;
//已通过验证
public
static
final
int
STATUS_13
=
13
;
//验证被通过了
public
static
final
int
STATUS_14
=
14
;
//别人回话
public
static
final
int
STATUS_15
=
15
;
//回话
public
static
final
int
STATUS_16
=
16
;
//已删除了XXX
public
static
final
int
STATUS_17
=
17
;
//XXX删除了我
public
static
final
int
STATUS_18
=
18
;
//已拉黑了XXX
public
static
final
int
STATUS_19
=
19
;
//XXX拉黑了我
public
static
final
int
STATUS_20
=
20
;
//默认值什么都不显示
// 不需要验证的
public
static
final
int
STATUS_21
=
21
;
//XXX 添加你为好友
public
static
final
int
STATUS_22
=
22
;
//你添加好友 XXX
public
static
final
int
STATUS_24
=
24
;
//XXX 已经取消了黑名单
public
static
final
int
STATUS_23
=
23
;
//对方把我加入了黑名单
public
static
final
int
STATUS_25
=
25
;
//通过手机联系人添加
public
static
final
int
STATUS_26
=
26
;
//被后台删除的好友,仅用于新的朋友页面显示,
@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
=
"
action
"
)
private
String
action
;
@DatabaseField
(
columnName
=
"timeCreate"
)
private
long
timeCreate
;
// 发起时间
@DatabaseField
private
int
status
;
// -1:黑名单;0:陌生人;1:
单方关注;2:互为好友
;8:系统号;9:非显示系统号
private
int
status
;
// -1:黑名单;0:陌生人;1:
发卡了i;2:互为好友;3 拒绝
;8:系统号;9:非显示系统号
@DatabaseField
private
String
privacy
;
// 隐私
...
...
@@ -63,12 +89,12 @@ public class Friend {
this
.
userName
=
userName
;
}
public
String
get
Sender
()
{
return
sender
;
public
String
get
Action
()
{
return
action
;
}
public
void
set
Sender
(
String
sender
)
{
this
.
sender
=
sender
;
public
void
set
Action
(
String
action
)
{
this
.
action
=
action
;
}
public
long
getTimeCreate
()
{
...
...
plugin_im/src/main/java/com/rv/im/enums/MessageTypeEnum.java
View file @
b303a9d6
...
...
@@ -13,9 +13,14 @@ public enum MessageTypeEnum {
CANCEL
(
7
,
"撤销"
),
PING
(
8
,
"ping"
),
HELLO
(
9
,
"hello"
)
,
ADD_SUCCESS
(
10
,
"add_success"
)
;
HELLO
(
500
,
"打招呼"
)
,
PASS
(
501
,
"同意加好友"
)
,
FEEBACK
(
502
,
"回话"
),
DELETE_FRIEND
(
505
,
"删除好友"
),
BE_BLACK
(
507
,
"黑名单"
),
BE_FRIEND
(
508
,
"直接成为好友"
)
,
BLACK_REFUSED
(
509
,
"取消黑名单"
);
private
int
type
;
private
String
name
;
...
...
plugin_im/src/main/java/com/rv/im/AddFriendActivity.java
→
plugin_im/src/main/java/com/rv/im/
friend/
AddFriendActivity.java
View file @
b303a9d6
package
com
.
rv
.
im
;
package
com
.
rv
.
im
.
friend
;
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.view.View
;
import
android.widget.Button
;
import
android.widget.EditText
;
import
android.widget.LinearLayout
;
import
android.widget.Toast
;
import
com.ruiwenliu.wrapper.base.BaseBean
;
import
com.ruiwenliu.wrapper.base.BaseStatusActivity
;
import
com.ruiwenliu.wrapper.weight.TitleView
;
import
com.rv.im.ImSetting
;
import
com.rv.im.R
;
import
com.rv.im.UserDetailActivity
;
import
com.rv.im.adapter.FriendSearchListAdapter
;
import
com.rv.im.bean.AddResultBean
;
import
com.rv.im.bean.FriendSearchBean
;
import
com.rv.im.db.service.ChatMessageServiceImp
;
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.ListenerManager
;
import
com.rv.im.xmpp.listener.ChatMessageListener
;
import
com.rv.im.xmpp.listener.NewFriendListener
;
...
...
@@ -42,6 +50,19 @@ public class AddFriendActivity extends BaseStatusActivity<AddFriendPresenter> im
private
String
addhaoyouid
=
null
;
@Override
protected
void
onCreate
(
Bundle
savedInstanceState
)
{
super
.
onCreate
(
savedInstanceState
);
ListenerManager
.
getInstance
().
addNewFriendListener
(
this
);
}
@Override
public
void
onDestroy
()
{
super
.
onDestroy
();
ListenerManager
.
getInstance
().
removeNewFriendListener
(
this
);
setResult
(
RESULT_OK
);
}
@Override
protected
int
setLayout
()
{
return
R
.
layout
.
activity_add_friend
;
...
...
@@ -58,7 +79,8 @@ public class AddFriendActivity extends BaseStatusActivity<AddFriendPresenter> im
adapter
.
setListener
(
new
FriendSearchListAdapter
.
FriendItemClickListener
()
{
@Override
public
void
showDetail
(
FriendSearchBean
.
FriendSearItemBean
item
)
{
if
(
item
!=
null
)
UserDetailActivity
.
start
(
getApplicationContext
(),
item
.
getUserId
());
}
@Override
...
...
@@ -101,25 +123,12 @@ public class AddFriendActivity extends BaseStatusActivity<AddFriendPresenter> im
if
(
addResultBean
.
getData
().
getType
()
==
1
||
addResultBean
.
getData
().
getType
()
==
3
)
{
isyanzheng
=
0
;
// 需要验证
// 需要验证就发送打招呼的消息,
showToast
(
"打招呼成功,静候回音"
);
mPresenter
.
doSayHello
(
null
,
userName
,
userId
)
;
ChatMessage
message
=
mPresenter
.
doSayHello
(
null
,
userName
,
userId
);
addhaoyouid
=
message
!=
null
?
message
.
getPackId
()
:
""
;
}
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
));
...
...
@@ -131,11 +140,118 @@ public class AddFriendActivity extends BaseStatusActivity<AddFriendPresenter> im
@Override
public
void
onNewFriendSendStateChange
(
String
toUserId
,
ChatMessage
message
,
int
messageState
)
{
if
(
messageState
==
ChatMessageListener
.
MESSAGE_SEND_SUCCESS
)
{
msgSendSuccess
(
message
,
message
.
getPackId
());
}
else
if
(
messageState
==
ChatMessageListener
.
MESSAGE_SEND_FAILED
)
{
// msgSendFailed(message.getPacketId());
}
}
// xmpp消息发送成功最终回调到这,
// 在这里调整ui,
// 还有存本地数据库,
public
void
msgSendSuccess
(
ChatMessage
message
,
String
packet
)
{
if
(
addhaoyouid
!=
null
&&
addhaoyouid
.
equals
(
packet
))
{
if
(
isyanzheng
==
0
)
{
// 需要验证
showToast
(
"打招呼成功,静候回音"
);
FriendServiceImp
.
getInstance
(
this
).
addMessage
(
mPresenter
.
buildAddFriendMessage
(
userId
,
userName
,
message
.
getMessageType
()));
// ListenerManager.getInstance().notifyNewFriend(mLoginUserId, message, true);
}
else
if
(
isyanzheng
==
1
)
{
showToast
(
"好友添加成功"
);
// 数据库中添加好友
FriendServiceImp
.
getInstance
(
this
).
addMessage
(
mPresenter
.
buildAddFriendMessage
(
userId
,
userName
,
message
.
getMessageType
()));
ChatMessageServiceImp
.
getInstance
(
this
).
addMessage
(
message
);
// FriendDao.getInstance().updateFriendContent(mLoginUserId, mUser.getUserId(), InternationalizationHelper.getString("JXMessageObject_BeFriendAndChat"), XmppMessage.TYPE_TEXT, TimeUtils.sk_time_current_time());
// ListenerManager.getInstance().notifyNewFriend(mLoginUserId, message, true);
// loadOthersInfoFromNet();
// CardcastUiUpdateUtil.broadcastUpdateUi(mContext);
}
// 已经是好友了,mFriend不能为空,
// mFriend = FriendDao.getInstance().getFriend(mLoginUserId, mUserId);
}
// else if (addblackid != null && addblackid.equals(packet)) {
// Toast.makeText(getApplicationContext(), getString(R.string.add_blacklist_succ), Toast.LENGTH_SHORT).show();
// findViewById(R.id.look_bussic_cicle_rl).setVisibility(View.GONE);
// mNextStepBtn.setText(InternationalizationHelper.getString("REMOVE"));
// mNextStepBtn.setOnClickListener(new RemoveBlacklistListener());
//
// // 更新当前持有的Friend对象,
// mFriend.setStatus(Friend.STATUS_BLACKLIST);
// FriendDao.getInstance().updateFriendStatus(message.getOwnerId(), message.getUserId(), mFriend.getStatus());
// FriendHelper.addBlacklistExtraOperation(message.getOwnerId(), message.getUserId());
//
// ChatMessage addBlackChatMessage = new ChatMessage();
// addBlackChatMessage.setContent(InternationalizationHelper.getString("JXFriendObject_AddedBlackList") + " " + mUser.getNickName());
// addBlackChatMessage.setTimeSend(TimeUtils.sk_time_current_time());
// FriendDao.getInstance().updateLastChatMessage(mLoginUserId, Friend.ID_NEW_FRIEND_MESSAGE, addBlackChatMessage);
//
// NewFriendDao.getInstance().createOrUpdateNewFriend(message);
// NewFriendDao.getInstance().changeNewFriendState(mUser.getUserId(), Friend.STATUS_18);
// ListenerManager.getInstance().notifyNewFriend(mLoginUserId, message, true);
//
// CardcastUiUpdateUtil.broadcastUpdateUi(mContext);
//
// Intent intent = new Intent(this, MainActivity.class);
// startActivity(intent);
// finish();
// } else if (removeblack != null && removeblack.equals(packet)) {
// Toast.makeText(getApplicationContext(), InternationalizationHelper.getString("REMOVE_BLACKLIST"), Toast.LENGTH_SHORT).show();
// findViewById(R.id.look_bussic_cicle_rl).setVisibility(View.VISIBLE);
// mNextStepBtn.setText(InternationalizationHelper.getString("JXUserInfoVC_SendMseeage"));
// mNextStepBtn.setOnClickListener(new SendMsgListener());
//
// // 更新当前持有的Friend对象,
// if (mFriend != null) {
// mFriend.setStatus(Friend.STATUS_FRIEND);
// }
// NewFriendDao.getInstance().ascensionNewFriend(message, Friend.STATUS_FRIEND);
// FriendHelper.beAddFriendExtraOperation(message.getOwnerId(), message.getUserId());
//
// ChatMessage removeChatMessage = new ChatMessage();
// removeChatMessage.setContent(coreManager.getSelf().getNickName() + InternationalizationHelper.getString("REMOVE"));
// removeChatMessage.setTimeSend(TimeUtils.sk_time_current_time());
// FriendDao.getInstance().updateLastChatMessage(mLoginUserId, Friend.ID_NEW_FRIEND_MESSAGE, removeChatMessage);
// /* FriendDao.getInstance().updateFriendContent(mLoginUserId, message.getUserId(),
// InternationalizationHelper.getString("JXMessageObject_BeFriendAndChat"), XmppMessage.TYPE_TEXT, TimeUtils.sk_time_current_time());*/
//
// NewFriendDao.getInstance().createOrUpdateNewFriend(message);
// NewFriendDao.getInstance().changeNewFriendState(message.getUserId(), Friend.STATUS_24);
// ListenerManager.getInstance().notifyNewFriend(mLoginUserId, message, true);
//
// CardcastUiUpdateUtil.broadcastUpdateUi(mContext);
//
// loadOthersInfoFromNet();
// } else if (deletehaoyou != null && deletehaoyou.equals(packet)) {
// Toast.makeText(getApplicationContext(), InternationalizationHelper.getString("JXAlert_DeleteOK"), Toast.LENGTH_SHORT).show();
//
// FriendHelper.removeAttentionOrFriend(mLoginUserId, message.getUserId());
//
// ChatMessage deleteChatMessage = new ChatMessage();
// deleteChatMessage.setContent(InternationalizationHelper.getString("JXAlert_DeleteFirend") + " " + mUser.getNickName());
// deleteChatMessage.setTimeSend(TimeUtils.sk_time_current_time());
// FriendDao.getInstance().updateLastChatMessage(mLoginUserId, Friend.ID_NEW_FRIEND_MESSAGE, deleteChatMessage);
//
// NewFriendDao.getInstance().createOrUpdateNewFriend(message);
// NewFriendDao.getInstance().changeNewFriendState(mUser.getUserId(), Friend.STATUS_16);
// ListenerManager.getInstance().notifyNewFriend(mLoginUserId, message, true);
//
// CardcastUiUpdateUtil.broadcastUpdateUi(mContext);
//
// Intent intent = new Intent(this, MainActivity.class);
// startActivity(intent);
// finish();
// }
}
@Override
public
boolean
onNewFriend
(
ChatMessage
message
)
{
// if(message.getMessageType() == MessageTypeEnum)
return
false
;
}
}
plugin_im/src/main/java/com/rv/im/friend/NewFriendActivity.java
0 → 100644
View file @
b303a9d6
package
com
.
rv
.
im
.
friend
;
import
android.content.Intent
;
import
android.os.Bundle
;
import
android.support.annotation.Nullable
;
import
android.support.v7.widget.LinearLayoutManager
;
import
android.support.v7.widget.RecyclerView
;
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.R
;
import
com.rv.im.adapter.AddRecordListAdapter
;
import
com.rv.im.db.service.FriendServiceImp
;
import
com.rv.im.db.table.ChatMessage
;
import
com.rv.im.db.table.Friend
;
import
com.rv.im.presenter.NewFriendPresenter
;
import
com.rv.im.xmpp.ListenerManager
;
import
com.rv.im.xmpp.listener.NewFriendListener
;
import
java.util.Collections
;
import
java.util.List
;
/*********
*
* 新朋友activity
*
*/
public
class
NewFriendActivity
extends
BaseStatusActivity
<
NewFriendPresenter
>
implements
NewFriendListener
{
private
static
final
int
REQUEST_CODE_SEARCH_FRIEND
=
10000
;
private
LinearLayout
llSearch
;
private
RecyclerView
recyclerView
;
private
AddRecordListAdapter
listAdapter
;
private
List
<
Friend
>
addFriendRecords
;
@Override
protected
void
onCreate
(
Bundle
savedInstanceState
)
{
super
.
onCreate
(
savedInstanceState
);
ListenerManager
.
getInstance
().
addNewFriendListener
(
this
);
}
@Override
public
void
onShowResult
(
int
requestType
,
BaseBean
result
)
{
}
@Override
public
void
onShowError
(
String
errorMsg
,
int
errorType
)
{
super
.
onShowError
(
errorMsg
,
errorType
);
}
@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
,
REQUEST_CODE_SEARCH_FRIEND
);
});
recyclerView
=
findViewById
(
R
.
id
.
recyclerview
);
recyclerView
.
setLayoutManager
(
new
LinearLayoutManager
(
this
,
LinearLayout
.
VERTICAL
,
false
));
listAdapter
=
new
AddRecordListAdapter
(
null
);
listAdapter
.
setListener
(
listener
);
recyclerView
.
setAdapter
(
listAdapter
);
}
@Override
protected
void
loadData
(
Bundle
savedInstanceState
,
Intent
intent
)
{
super
.
loadData
(
savedInstanceState
,
intent
);
getAddRecord
();
}
private
void
getAddRecord
()
{
addFriendRecords
=
FriendServiceImp
.
getInstance
(
this
).
getAllFriends
();
Collections
.
sort
(
addFriendRecords
,
(
o1
,
o2
)
->
(
int
)
(-
o1
.
getTimeCreate
()
+
o2
.
getTimeCreate
()));
if
(
addFriendRecords
!=
null
)
{
listAdapter
.
setNewData
(
addFriendRecords
);
}
}
@Override
public
void
onNewFriendSendStateChange
(
String
toUserId
,
ChatMessage
message
,
int
messageState
)
{
}
@Override
public
boolean
onNewFriend
(
ChatMessage
message
)
{
getAddRecord
();
return
false
;
}
@Override
public
void
onDestroy
()
{
super
.
onDestroy
();
ListenerManager
.
getInstance
().
removeNewFriendListener
(
this
);
}
@Override
protected
void
onActivityResult
(
int
requestCode
,
int
resultCode
,
@Nullable
Intent
data
)
{
super
.
onActivityResult
(
requestCode
,
resultCode
,
data
);
if
(
requestCode
==
REQUEST_CODE_SEARCH_FRIEND
)
{
getAddRecord
();
}
}
private
Friend
agreeFriend
;
private
AddRecordListAdapter
.
FriendItemClickListener
listener
=
new
AddRecordListAdapter
.
FriendItemClickListener
()
{
@Override
public
void
showDetail
(
Friend
item
)
{
}
@Override
public
void
agree
(
Friend
item
)
{
agreeFriend
=
item
;
mPresenter
.
doAgreeOrAttention
(
agreeFriend
);
}
};
}
plugin_im/src/main/java/com/rv/im/presenter/AddFriendPresenter.java
View file @
b303a9d6
...
...
@@ -14,7 +14,6 @@ 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
;
...
...
@@ -59,7 +58,7 @@ public class AddFriendPresenter extends CommonPresenter {
}
// 打招呼
public
void
doSayHello
(
String
text
,
String
toUserName
,
String
toUserId
)
{
public
ChatMessage
doSayHello
(
String
text
,
String
toUserName
,
String
toUserId
)
{
if
(
TextUtils
.
isEmpty
(
text
))
{
text
=
"HEY-HELLO"
;
}
...
...
@@ -68,13 +67,13 @@ public class AddFriendPresenter extends CommonPresenter {
message
.
setToUserName
(
toUserName
);
message
.
setToUserId
(
toUserId
);
message
.
setContent
(
text
);
sendMessage
(
message
);
return
sendMessage
(
message
);
}
public
ChatMessage
doSayAddFriend
(
String
toUserName
,
String
toUserId
){
ChatMessage
message
=
new
ChatMessage
();
message
.
setMessageType
(
MessageTypeEnum
.
ADD_SUCCESS
);
message
.
setMessageType
(
MessageTypeEnum
.
BE_FRIEND
);
message
.
setToUserName
(
toUserName
);
message
.
setToUserId
(
toUserId
);
message
.
setContent
(
"be friend"
);
...
...
@@ -84,8 +83,8 @@ public class AddFriendPresenter extends CommonPresenter {
private
ChatMessage
sendMessage
(
ChatMessage
message
)
{
message
.
setFromUserId
(
message
.
getFrom
UserId
());
message
.
setFromUserName
(
message
.
getFrom
UserName
());
message
.
setFromUserId
(
ImSetting
.
get
UserId
());
message
.
setFromUserName
(
ImSetting
.
get
UserName
());
message
.
setRead
(
true
);
message
.
setFromId
(
"android"
);
message
.
setPackId
(
UUID
.
randomUUID
().
toString
().
replaceAll
(
"-"
,
""
));
...
...
@@ -108,7 +107,14 @@ public class AddFriendPresenter extends CommonPresenter {
Friend
friend
=
new
Friend
();
friend
.
setUserId
(
userId
);
friend
.
setUserName
(
userName
);
friend
.
setSender
(
ImSetting
.
getUserId
());
if
(
status
==
MessageTypeEnum
.
HELLO
.
getType
()){
friend
.
setAction
(
"等待验证"
);
friend
.
setStatus
(
Friend
.
STATUS_10
);
}
else
if
(
status
==
MessageTypeEnum
.
BE_FRIEND
.
getType
()){
friend
.
setAction
(
"添加成功"
);
friend
.
setStatus
(
Friend
.
STATUS_22
);
}
friend
.
setRead
(
true
);
friend
.
setStatus
(
status
);
friend
.
setTimeCreate
(
System
.
currentTimeMillis
());
...
...
plugin_im/src/main/java/com/rv/im/presenter/NewFriendPresenter.java
View file @
b303a9d6
package
com
.
rv
.
im
.
presenter
;
import
android.content.Intent
;
import
android.text.TextUtils
;
import
com.google.gson.Gson
;
import
com.lzy.okgo.OkGo
;
import
com.lzy.okgo.callback.AbsCallback
;
import
com.lzy.okgo.model.Response
;
import
com.ruiwenliu.wrapper.base.BaseBean
;
import
com.ruiwenliu.wrapper.base.BaseStatusActivity
;
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.ImBaseBean
;
import
com.rv.im.db.service.FriendServiceImp
;
import
com.rv.im.db.table.ChatMessage
;
import
com.rv.im.db.table.Friend
;
import
com.rv.im.enums.MessageTypeEnum
;
import
java.io.IOException
;
import
java.util.HashMap
;
import
java.util.UUID
;
import
okhttp3.OkHttpClient
;
import
okhttp3.ResponseBody
;
public
class
NewFriendPresenter
extends
CommonPresenter
{
// 同意添加好友的请求
public
ChatMessage
doAgree
(
String
toUserName
,
String
toUserId
)
{
ChatMessage
message
=
new
ChatMessage
();
message
.
setMessageType
(
MessageTypeEnum
.
PASS
);
message
.
setToUserName
(
toUserName
);
message
.
setToUserId
(
toUserId
);
message
.
setContent
(
"同意"
);
return
sendMessage
(
message
);
}
private
ChatMessage
sendMessage
(
ChatMessage
message
)
{
message
.
setFromUserId
(
ImSetting
.
getUserId
());
message
.
setFromUserName
(
ImSetting
.
getUserName
());
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
void
doAgreeOrAttention
(
final
Friend
item
)
{
AppConfig
appConfig
=
(
AppConfig
)
RvCache
.
getInstance
().
get
(
CacheEnum
.
IM_CONFIG
);
if
(
appConfig
==
null
)
return
;
StringBuffer
buffer
=
new
StringBuffer
();
buffer
.
append
(
appConfig
.
Add_friends
).
append
(
"?"
).
append
(
"access_token="
).
append
(
ImSetting
.
getImToken
()).
append
(
"&toUserId="
).
append
(
item
.
getUserId
());
OkGo
.<
String
>
get
(
buffer
.
toString
())
.
execute
(
new
AbsCallback
<
String
>()
{
@Override
public
void
onSuccess
(
Response
<
String
>
response
)
{
okhttp3
.
Response
rawResponse
=
response
.
getRawResponse
();
ResponseBody
responseBody
=
rawResponse
.
body
();
String
data
=
null
;
try
{
data
=
responseBody
.
string
();
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
}
if
(!
TextUtils
.
isEmpty
(
data
))
{
ImBaseBean
bean
=
new
Gson
().
fromJson
(
data
,
ImBaseBean
.
class
);
if
(
bean
!=
null
&&
bean
.
resultCode
==
1
)
{
((
BaseStatusActivity
)
getPresenterContext
()).
showToast
(
"已同意"
);
doAgree
(
item
.
getUserName
(),
item
.
getUserId
());
item
.
setStatus
(
Friend
.
STATUS_12
);
FriendServiceImp
.
getInstance
(
getPresenterContext
()).
addMessage
(
item
);
}
else
if
(
bean
!=
null
)
{
((
BaseStatusActivity
)
getPresenterContext
()).
showToast
(
bean
.
resultMsg
);
if
(
bean
.
resultCode
==
100512
){
item
.
setStatus
(
2
);
FriendServiceImp
.
getInstance
(
getPresenterContext
()).
addMessage
(
item
);
}
}
}
}
@Override
public
String
convertResponse
(
okhttp3
.
Response
response
)
{
return
null
;
}
});
}
}
plugin_im/src/main/java/com/rv/im/presenter/UserDetailPresenter.java
0 → 100644
View file @
b303a9d6
package
com
.
rv
.
im
.
presenter
;
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.ImSetting
;
import
com.rv.im.bean.ImBaseBean
;
import
com.rv.im.bean.UserDetailBean
;
import
java.util.HashMap
;
import
java.util.Map
;
public
class
UserDetailPresenter
extends
CommonPresenter
{
public
void
loadOtherInfoFromNet
(
String
mUserId
){
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
(
"userId"
,
mUserId
);
getData
(
0
,
appConfig
.
USER_GET_URL
,
UserDetailBean
.
class
,
params
,
true
);
}
}
plugin_im/src/main/java/com/rv/im/
broadcast
/MessageReceiver.java
→
plugin_im/src/main/java/com/rv/im/
receiver
/MessageReceiver.java
View file @
b303a9d6
package
com
.
rv
.
im
.
broadcast
;
package
com
.
rv
.
im
.
receiver
;
import
android.content.BroadcastReceiver
;
import
android.content.Context
;
...
...
plugin_im/src/main/java/com/rv/im/receiver/NetWorkReceiver.java
0 → 100644
View file @
b303a9d6
package
com
.
rv
.
im
.
receiver
;
import
android.content.BroadcastReceiver
;
import
android.content.Context
;
import
android.content.Intent
;
import
android.net.ConnectivityManager
;
import
android.widget.Toast
;
import
com.rv.im.util.NetworkUtil
;
import
java.util.ArrayList
;
import
java.util.List
;
public
class
NetWorkReceiver
extends
BroadcastReceiver
{
private
List
<
NetChangListener
>
listeners
=
new
ArrayList
<>();
private
static
NetWorkReceiver
instance
=
null
;
private
NetWorkReceiver
()
{
}
public
static
NetWorkReceiver
getInstance
()
{
if
(
instance
==
null
)
{
instance
=
new
NetWorkReceiver
();
}
return
instance
;
}
public
void
register
(
NetChangListener
listener
)
{
listeners
.
add
(
listener
);
}
public
void
unRegister
(
NetChangListener
listener
)
{
if
(
listeners
.
contains
(
listener
))
{
listeners
.
remove
(
listener
);
}
}
@Override
public
void
onReceive
(
Context
context
,
Intent
intent
)
{
String
action
=
intent
.
getAction
();
if
(
action
.
equals
(
ConnectivityManager
.
CONNECTIVITY_ACTION
))
{
if
(
NetworkUtil
.
isNetworkAvailable
(
context
))
{
if
(!
listeners
.
isEmpty
())
{
for
(
NetChangListener
listener
:
listeners
)
{
listener
.
netAvailable
();
}
}
}
else
{
Toast
.
makeText
(
context
,
"网络已断开!"
,
Toast
.
LENGTH_SHORT
).
show
();
}
}
}
public
interface
NetChangListener
{
// 网络可用
void
netAvailable
();
// 网络不可用或者无网络
void
netUnAvailable
();
}
}
plugin_im/src/main/java/com/rv/im/
broadcast
/RemoteReceiver.java
→
plugin_im/src/main/java/com/rv/im/
receiver
/RemoteReceiver.java
View file @
b303a9d6
package
com
.
rv
.
im
.
broadcast
;
package
com
.
rv
.
im
.
receiver
;
import
android.content.BroadcastReceiver
;
import
android.content.Context
;
...
...
plugin_im/src/main/java/com/rv/im/util/NotificationMananger.java
View file @
b303a9d6
...
...
@@ -10,6 +10,7 @@ import android.content.Intent;
import
android.os.Build
;
import
android.support.v4.app.NotificationCompat
;
import
com.rv.im.ConversationListActivity
;
import
com.rv.im.CustomerListActivity
;
import
com.rv.im.R
;
...
...
@@ -51,4 +52,38 @@ public class NotificationMananger {
manager
.
notify
(
0
,
notification
);
}
public
static
void
showNewsFriendNotification
(
Context
context
,
String
fromId
)
{
NotificationManager
manager
=
(
NotificationManager
)
context
.
getSystemService
(
Context
.
NOTIFICATION_SERVICE
);
NotificationCompat
.
Builder
builder
;
//判断是否是8.0Android.O
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
O
)
{
NotificationChannel
chan1
=
new
NotificationChannel
(
"1"
,
"newChannel"
,
NotificationManager
.
IMPORTANCE_HIGH
);
manager
.
createNotificationChannel
(
chan1
);
builder
=
new
NotificationCompat
.
Builder
(
context
,
"1"
);
}
else
{
builder
=
new
NotificationCompat
.
Builder
(
context
);
}
//
// Intent intent = new Intent();
// intent.setComponent(new ComponentName(context, "com.xxfc.rv."));
// intent.putExtra("to","chat") ;
// intent.putExtra("fromId",fromId) ;
//
Intent
intent
=
new
Intent
(
context
,
ConversationListActivity
.
class
);
PendingIntent
pendingIntent
=
PendingIntent
.
getActivity
(
context
,
0
,
intent
,
0
);
Notification
notification
=
builder
.
setTicker
(
"您有新的消息"
)
.
setSmallIcon
(
R
.
mipmap
.
logo
)
.
setWhen
(
System
.
currentTimeMillis
())
.
setContentIntent
(
pendingIntent
)
.
setContentTitle
(
"滴房车"
)
.
setContentText
(
"好友添加请求"
)
.
setAutoCancel
(
true
)
.
setPriority
(
Notification
.
PRIORITY_DEFAULT
)
.
build
();
manager
.
notify
(
0
,
notification
);
}
}
plugin_im/src/main/java/com/rv/im/view/LoadingDialog.java
deleted
100644 → 0
View file @
21228e69
package
com
.
rv
.
im
.
view
;
import
android.app.AlertDialog
;
import
android.content.Context
;
import
android.view.LayoutInflater
;
import
android.view.View
;
import
android.view.WindowManager
;
import
com.rv.im.R
;
/**
* Created by Administrator on 2017/6/19.
*/
public
class
LoadingDialog
{
/*
*dialog_loading.xml
* ----------------------兼容性更好的方案-------------------------------
*
* */
AlertDialog
alertDialog
;
Context
context
;
public
LoadingDialog
(
Context
context
)
{
this
.
context
=
context
;
LayoutInflater
inflater
=
LayoutInflater
.
from
(
context
);
View
layout
=
inflater
.
inflate
(
R
.
layout
.
dialog_loading
,
null
);
AlertDialog
.
Builder
builder
=
new
AlertDialog
.
Builder
(
context
).
setView
(
layout
);
alertDialog
=
builder
.
create
();
}
/**
* dip-->px
*/
public
int
dip2Px
(
int
dip
)
{
// px/dip = density;
float
density
=
context
.
getResources
().
getDisplayMetrics
().
density
;
int
px
=
(
int
)
(
dip
*
density
+
.
5
f
);
return
px
;
}
public
void
show
()
{
alertDialog
.
show
();
WindowManager
.
LayoutParams
lp
=
alertDialog
.
getWindow
().
getAttributes
();
lp
.
width
=
dip2Px
(
120
);
//定义宽度
lp
.
height
=
dip2Px
(
120
);
alertDialog
.
getWindow
().
setAttributes
(
lp
);
alertDialog
.
getWindow
().
setDimAmount
(
0
);
alertDialog
.
setCancelable
(
true
);
alertDialog
.
setCanceledOnTouchOutside
(
false
);
}
public
void
dismiss
()
{
if
(
alertDialog
!=
null
&&
alertDialog
.
isShowing
())
{
alertDialog
.
dismiss
();
}
}
/*
* ----------------------普通方案-------------------------------
private int height;
public LoadingDialog(Context context) {
this(context, R.style.alert_dialog);
}
public LoadingDialog(Context context, int themeResId) {
super(context, themeResId);
setCancelable(true);
setCanceledOnTouchOutside(false);
float density = context.getResources().getDisplayMetrics().density;
width = (int) (140 * density + .5f);
height = (int) (105 * density + .5f);
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.dialog_loading);
}
@Override
public void show() {
super.show();
Window window = getWindow();
WindowManager.LayoutParams lp = window.getAttributes();
lp.width = width;
lp.height = height;
window.setAttributes(lp);
// 去掉周围的颜色
getWindow().setDimAmount(0);
} */
}
plugin_im/src/main/java/com/rv/im/xmpp/ListenerManager.java
View file @
b303a9d6
...
...
@@ -9,8 +9,12 @@ import com.ruiwenliu.wrapper.util.AppUtils;
import
com.rv.im.ImSetting
;
import
com.rv.im.R
;
import
com.rv.im.db.service.ChatMessageServiceImp
;
import
com.rv.im.db.service.FriendServiceImp
;
import
com.rv.im.db.service.IChatMessageService
;
import
com.rv.im.db.table.ChatMessage
;
import
com.rv.im.db.table.Friend
;
import
com.rv.im.enums.MessageTypeEnum
;
import
com.rv.im.presenter.AddFriendPresenter
;
import
com.rv.im.util.NotificationMananger
;
import
com.rv.im.xmpp.listener.AuthStateListener
;
import
com.rv.im.xmpp.listener.ChatMessageListener
;
...
...
@@ -66,7 +70,7 @@ public class ListenerManager {
mNewFriendListeners
.
add
(
newFriendListener
);
}
public
void
remove
ChatMessage
Listener
(
NewFriendListener
friendListener
)
{
public
void
remove
NewFriend
Listener
(
NewFriendListener
friendListener
)
{
mNewFriendListeners
.
remove
(
friendListener
);
}
...
...
@@ -127,13 +131,32 @@ public class ListenerManager {
});
}
/**
* 新朋友发送消息的状态变化
*/
public
void
notifyNewFriendSendStateChange
(
final
String
toUserId
,
final
ChatMessage
message
,
final
int
messageState
)
{
if
(
mNewFriendListeners
.
size
()
<=
0
)
{
return
;
}
mHandler
.
post
(()
->
{
for
(
NewFriendListener
listener
:
mNewFriendListeners
)
{
listener
.
onNewFriendSendStateChange
(
toUserId
,
message
,
messageState
);
}
});
}
/*********
* 添加好友
*
收到
添加好友
* @param message
*/
public
void
notifyNewFriend
(
final
ChatMessage
message
)
{
if
(
message
==
null
)
return
;
NotificationMananger
.
showNewsFriendNotification
(
ImSetting
.
getContext
(),
message
.
getFromId
());
bell
();
mHandler
.
post
(()
->
{
FriendServiceImp
.
getInstance
(
ImSetting
.
getContext
()).
addMessage
(
buildAddFriendMessage
(
message
.
getFromUserId
(),
message
.
getFromUserName
(),
message
.
getContent
(),
message
.
getMessageType
()));
boolean
hasRead
=
false
;
// 是否已经被读了 (如果有类添加)
for
(
NewFriendListener
listener
:
mNewFriendListeners
)
{
if
(
listener
.
onNewFriend
(
message
))
{
...
...
@@ -172,4 +195,31 @@ public class ListenerManager {
mediaPlayer
.
release
();
}
}
/********
* 收到好友添加请求
* @param userId
* @param userName
* @param status
* @return
*/
private
Friend
buildAddFriendMessage
(
String
userId
,
String
userName
,
String
content
,
int
status
)
{
Friend
friend
=
new
Friend
();
friend
.
setUserId
(
userId
);
friend
.
setUserName
(
userName
);
if
(
status
==
MessageTypeEnum
.
HELLO
.
getType
())
{
friend
.
setAction
(
"同意"
);
friend
.
setDescribe
(
content
);
friend
.
setStatus
(
Friend
.
STATUS_11
);
}
else
if
(
status
==
MessageTypeEnum
.
PASS
.
getType
())
{
friend
.
setAction
(
"添加成功"
);
friend
.
setStatus
(
Friend
.
STATUS_13
);
}
else
if
(
status
==
MessageTypeEnum
.
BE_FRIEND
.
getType
())
{
friend
.
setAction
(
"成为好友"
);
friend
.
setStatus
(
Friend
.
STATUS_21
);
}
friend
.
setRead
(
true
);
friend
.
setTimeCreate
(
System
.
currentTimeMillis
());
return
friend
;
}
}
plugin_im/src/main/java/com/rv/im/xmpp/ReceiptManager.java
View file @
b303a9d6
...
...
@@ -6,6 +6,7 @@ import android.text.TextUtils;
import
com.rv.im.ImService
;
import
com.rv.im.db.table.ChatMessage
;
import
com.rv.im.enums.MessageTypeEnum
;
import
com.rv.im.log.LogUtil
;
import
com.rv.im.xmpp.listener.ChatMessageListener
;
...
...
@@ -50,9 +51,13 @@ public class ReceiptManager {
ListenerManager
.
getInstance
().
notifyMessageSendStateChange
(
packetId
,
ChatMessageListener
.
MESSAGE_SEND_FAILED
);
}
else
if
(
msg
.
what
==
RECEIPT_YES
)
{
// 认为发送成功
if
(
obj
!=
null
&&
obj
.
sendType
==
SendType
.
PUSH_NEW_FRIEND
){
ListenerManager
.
getInstance
().
notifyNewFriendSendStateChange
(
obj
.
toUserId
,
obj
.
msg
,
ChatMessageListener
.
MESSAGE_SEND_SUCCESS
);
}
else
{
ListenerManager
.
getInstance
().
notifyMessageSendStateChange
(
packetId
,
ChatMessageListener
.
MESSAGE_SEND_SUCCESS
);
}
ListenerManager
.
getInstance
().
notifyMessageSendStateChange
(
packetId
,
ChatMessageListener
.
MESSAGE_SEND_SUCCESS
);
}
mReceiptMap
.
remove
(
packetId
);
}
...
...
@@ -69,7 +74,7 @@ public class ReceiptManager {
public
void
addWillSendMessage
(
final
String
toUserId
,
final
ChatMessage
xmppMessage
,
S
endType
sendType
,
S
tring
content
)
{
,
final
ChatMessage
xmppMessage
,
String
content
)
{
// 将之前可能存在的回执缓存清除掉
if
(
mReceiptMap
.
containsKey
(
xmppMessage
.
getPackId
()))
{
...
...
@@ -82,7 +87,8 @@ public class ReceiptManager {
ReceiptObj
obj
=
new
ReceiptObj
();
obj
.
toUserId
=
toUserId
;
obj
.
msg
=
xmppMessage
;
obj
.
sendType
=
sendType
;
obj
.
sendType
=
(
xmppMessage
.
getMessageType
()
>=
MessageTypeEnum
.
HELLO
.
getType
()
&&
xmppMessage
.
getMessageType
()
<=
MessageTypeEnum
.
BLACK_REFUSED
.
getType
())
?
SendType
.
PUSH_NEW_FRIEND
:
SendType
.
NORMAL
;
obj
.
Read_msg_pid
=
content
;
mReceiptMap
.
put
(
xmppMessage
.
getPackId
(),
obj
);
// 记录一条新发送出去的消息(还没有接收到回执)
...
...
plugin_im/src/main/java/com/rv/im/xmpp/XChatMessageListener.java
View file @
b303a9d6
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
;
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() && type <= MessageTypeEnum.BLACK_REFUSED.getType()) { // 添加好友请求 chatFriend(chatMessage); } } /********** * * 与好友相关的逻辑处理 * * @param chatMessage */ private void chatFriend(ChatMessage chatMessage) { if (chatMessage == null) return; if (chatMessage.getFromUserId().equals(ImSetting.getUserId())) { // 我在其他端做的操作,在Android也接收到了 } else { chatFriendForMe(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)); } } /** * 对方发送过来的新朋友消息,处理逻辑不变 */ private void chatFriendForMe(ChatMessage chatMessage) { if (chatMessage.getMessageType() == MessageTypeEnum.HELLO.getType()) { } else if (chatMessage.getMessageType() == MessageTypeEnum.PASS.getType()) { // 对方同意加我为好友 ChatMessageServiceImp.getInstance(ImSetting.getContext()).addMessage(chatMessage); } else if (chatMessage.getMessageType() == MessageTypeEnum.FEEBACK.getType()) { // 对方的回话 } else if (chatMessage.getMessageType() == MessageTypeEnum.BE_FRIEND.getType()) { // 我未开启好友验证,对方直接添加我为好友 ChatMessageServiceImp.getInstance(ImSetting.getContext()).addMessage(chatMessage); } else if (chatMessage.getMessageType() == MessageTypeEnum.BE_BLACK.getType()) { // 对方将我拉黑 } else if (chatMessage.getMessageType() == MessageTypeEnum.BLACK_REFUSED.getType()) { // 对方将我移出了黑名单 } // 对方发过来的打招呼消息 ListenerManager.getInstance().notifyNewFriend(chatMessage); } }
\ No newline at end of file
...
...
plugin_im/src/main/res/drawable-hdpi/resume_empty_icon.png
0 → 100644
View file @
b303a9d6
201 Bytes
plugin_im/src/main/res/drawable-xhdpi/ic_qr_code.png
0 → 100644
View file @
b303a9d6
16.4 KB
plugin_im/src/main/res/drawable-xhdpi/loadering_data.png
0 → 100644
View file @
b303a9d6
24.8 KB
plugin_im/src/main/res/drawable-xhdpi/me_chevron_right.png
0 → 100644
View file @
b303a9d6
375 Bytes
plugin_im/src/main/res/drawable-xhdpi/set_list_down_press.9.png
0 → 100644
View file @
b303a9d6
1.01 KB
plugin_im/src/main/res/drawable-xhdpi/set_list_up.9.png
0 → 100644
View file @
b303a9d6
1 KB
plugin_im/src/main/res/drawable-xhdpi/set_list_up_press.9.png
0 → 100644
View file @
b303a9d6
1 KB
plugin_im/src/main/res/drawable/set_list_down_bg.xml
0 → 100644
View file @
b303a9d6
<?xml version="1.0" encoding="utf-8"?>
<selector
xmlns:android=
"http://schemas.android.com/apk/res/android"
>
<item
android:drawable=
"@drawable/set_list_down_press"
android:state_focused=
"true"
/>
<item
android:drawable=
"@drawable/set_list_down_press"
android:state_selected=
"true"
/>
<item
android:drawable=
"@drawable/set_list_down_press"
android:state_pressed=
"true"
/>
<item
android:drawable=
"@drawable/set_list_down"
/>
</selector>
\ No newline at end of file
plugin_im/src/main/res/drawable/set_list_up_bg.xml
0 → 100644
View file @
b303a9d6
<?xml version="1.0" encoding="utf-8"?>
<selector
xmlns:android=
"http://schemas.android.com/apk/res/android"
>
<item
android:drawable=
"@drawable/set_list_up_press"
android:state_focused=
"true"
/>
<item
android:drawable=
"@drawable/set_list_up_press"
android:state_selected=
"true"
/>
<item
android:drawable=
"@drawable/set_list_up_press"
android:state_pressed=
"true"
/>
<item
android:drawable=
"@drawable/set_list_up"
/>
</selector>
\ No newline at end of file
plugin_im/src/main/res/layout/activity_add_friend.xml
View file @
b303a9d6
...
...
@@ -5,7 +5,7 @@
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:orientation=
"vertical"
tools:context=
".AddFriendActivity"
>
tools:context=
".
friend.
AddFriendActivity"
>
<RelativeLayout
android:layout_width=
"match_parent"
...
...
plugin_im/src/main/res/layout/activity_new_friend.xml
View file @
b303a9d6
...
...
@@ -5,14 +5,15 @@
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:orientation=
"vertical"
tools:context=
".NewFriendActivity"
>
tools:context=
".
friend.
NewFriendActivity"
>
<LinearLayout
android:id=
"@+id/ll_search"
android:layout_width=
"match_parent"
android:layout_height=
"@dimen/
size_5
0"
android:layout_height=
"@dimen/
dp_4
0"
android:layout_centerInParent=
"true"
android:layout_marginTop=
"@dimen/dp5"
android:layout_marginLeft=
"@dimen/dp_10"
android:layout_marginRight=
"@dimen/dp_10"
android:background=
"@drawable/bg_chat_search"
...
...
plugin_im/src/main/res/layout/activity_user_detail.xml
0 → 100644
View file @
b303a9d6
<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:background=
"@color/normal_bg"
android:orientation=
"vertical"
>
<FrameLayout
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
>
<ScrollView
android:id=
"@+id/part_2"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:visibility=
"visible"
>
<LinearLayout
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:orientation=
"vertical"
>
<com.rv.im.view.RoundImageView
android:id=
"@+id/avatar_img"
android:layout_width=
"100dp"
android:layout_height=
"100dp"
android:layout_gravity=
"center_horizontal"
android:layout_marginTop=
"2dp"
android:layout_marginBottom=
"2dp"
android:scaleType=
"centerCrop"
android:src=
"@drawable/common_icon_avatar_default"
android:visibility=
"visible"
/>
<RelativeLayout
style=
"@style/IMTbleLine_UP"
>
<TextView
android:id=
"@+id/name_text"
style=
"@style/IMTbleLine_TextKey"
android:drawableLeft=
"@drawable/resume_empty_icon"
android:text=
"@string/name_align"
/>
<TextView
android:id=
"@+id/name_tv"
style=
"@style/IMTbleLine_TextValue"
android:layout_toLeftOf=
"@+id/name_arrow_img"
android:layout_toRightOf=
"@+id/name_text"
/>
<ImageView
android:id=
"@+id/name_arrow_img"
style=
"@style/IMTbleLine_ArrowImg"
android:contentDescription=
"@string/app_name"
android:visibility=
"invisible"
/>
</RelativeLayout>
<RelativeLayout
android:id=
"@+id/rn_rl"
style=
"@style/IMTbleLine_UP"
>
<TextView
android:id=
"@+id/rename_text"
style=
"@style/IMTbleLine_TextKey"
android:drawableLeft=
"@drawable/resume_empty_icon"
android:text=
"@string/remark_name"
/>
<TextView
android:id=
"@+id/rename_tv"
style=
"@style/IMTbleLine_TextValue"
android:layout_toLeftOf=
"@+id/rename_arrow_img"
android:layout_toRightOf=
"@+id/rename_text"
/>
<ImageView
android:id=
"@+id/rename_arrow_img"
style=
"@style/IMTbleLine_ArrowImg"
android:contentDescription=
"@string/app_name"
android:visibility=
"invisible"
/>
</RelativeLayout>
<RelativeLayout
android:id=
"@+id/sex_rl"
style=
"@style/IMTbleLine_UP"
>
<TextView
android:id=
"@+id/sex_text"
style=
"@style/IMTbleLine_TextKey"
android:drawableLeft=
"@drawable/resume_empty_icon"
android:text=
"@string/sex_align"
/>
<TextView
android:id=
"@+id/sex_tv"
style=
"@style/IMTbleLine_TextValue"
android:layout_toLeftOf=
"@+id/sex_arrow_img"
android:layout_toRightOf=
"@+id/sex_text"
/>
<ImageView
android:id=
"@+id/sex_arrow_img"
style=
"@style/IMTbleLine_ArrowImg"
android:contentDescription=
"@string/app_name"
android:visibility=
"invisible"
/>
</RelativeLayout>
<RelativeLayout
android:id=
"@+id/birthday_rl"
style=
"@style/IMTbleLine_UP"
>
<TextView
android:id=
"@+id/birthday_text"
style=
"@style/IMTbleLine_TextKey"
android:drawableLeft=
"@drawable/resume_empty_icon"
android:text=
"@string/birthday"
/>
<TextView
android:id=
"@+id/birthday_tv"
style=
"@style/IMTbleLine_TextValue"
android:layout_toLeftOf=
"@+id/birthday_arrow_img"
android:layout_toRightOf=
"@+id/birthday_text"
/>
<ImageView
android:id=
"@+id/birthday_arrow_img"
style=
"@style/IMTbleLine_ArrowImg"
android:contentDescription=
"@string/app_name"
android:visibility=
"invisible"
/>
</RelativeLayout>
<RelativeLayout
android:id=
"@+id/city_rl"
style=
"@style/IMTbleLine_UP"
>
<TextView
android:id=
"@+id/city_text"
style=
"@style/IMTbleLine_TextKey"
android:drawableLeft=
"@drawable/resume_empty_icon"
android:text=
"@string/residence_align"
/>
<TextView
android:id=
"@+id/city_tv"
style=
"@style/IMTbleLine_TextValue"
android:layout_toLeftOf=
"@+id/city_arrow_img"
android:layout_toRightOf=
"@+id/city_text"
/>
<ImageView
android:id=
"@+id/city_arrow_img"
style=
"@style/IMTbleLine_ArrowImg"
android:contentDescription=
"@string/app_name"
android:visibility=
"invisible"
/>
</RelativeLayout>
<RelativeLayout
android:id=
"@+id/phone_rl"
style=
"@style/IMTbleLine_UP"
android:visibility=
"gone"
tools:visibility=
"visible"
>
<TextView
android:id=
"@+id/phone_text"
style=
"@style/IMTbleLine_TextKey"
android:drawableLeft=
"@drawable/resume_empty_icon"
android:text=
"@string/phone_number"
/>
<TextView
android:id=
"@+id/phone_tv"
style=
"@style/IMTbleLine_TextValue"
android:layout_toLeftOf=
"@+id/phone_arrow_img"
android:layout_toRightOf=
"@+id/phone_text"
/>
<ImageView
android:id=
"@+id/phone_arrow_img"
style=
"@style/IMTbleLine_ArrowImg"
android:contentDescription=
"@string/app_name"
android:visibility=
"invisible"
/>
</RelativeLayout>
<RelativeLayout
android:id=
"@+id/online_rl"
style=
"@style/IMTbleLine"
android:visibility=
"gone"
tools:visibility=
"visible"
>
<TextView
android:id=
"@+id/online_text"
style=
"@style/IMTbleLine_TextKey"
android:drawableLeft=
"@drawable/resume_empty_icon"
android:text=
"@string/label_online_time"
/>
<TextView
android:id=
"@+id/online_tv"
style=
"@style/IMTbleLine_TextValue"
android:layout_toLeftOf=
"@+id/online_arrow_img"
android:layout_toRightOf=
"@+id/online_text"
/>
<ImageView
android:id=
"@+id/online_arrow_img"
style=
"@style/IMTbleLine_ArrowImg"
android:contentDescription=
"@string/app_name"
android:visibility=
"invisible"
/>
</RelativeLayout>
<RelativeLayout
android:id=
"@+id/erweima"
style=
"@style/IMTbleLine_UP"
android:layout_marginTop=
"9dp"
>
<TextView
android:id=
"@+id/look_location_tv_02"
style=
"@style/IMTbleLine_TextKey"
android:drawableLeft=
"@drawable/resume_empty_icon"
android:text=
"@string/qrcode"
/>
<TextView
style=
"@style/IMTbleLine_TextValue"
android:layout_toLeftOf=
"@+id/look_location_imgs_02"
android:layout_toRightOf=
"@+id/look_location_tv_02"
/>
<ImageView
android:layout_width=
"20dp"
android:layout_height=
"20dp"
android:layout_alignParentRight=
"true"
android:layout_centerVertical=
"true"
android:layout_marginRight=
"30dp"
android:src=
"@drawable/ic_qr_code"
/>
<ImageView
android:id=
"@+id/look_location_imgs_02"
style=
"@style/IMTbleLine_ArrowImg"
android:contentDescription=
"@string/app_name"
android:visibility=
"visible"
/>
</RelativeLayout>
<RelativeLayout
android:id=
"@+id/look_location_rl"
style=
"@style/IMTbleLine"
>
<TextView
android:id=
"@+id/look_location_tv"
style=
"@style/IMTbleLine_TextKey"
android:drawableLeft=
"@drawable/resume_empty_icon"
android:text=
"@string/now_location"
/>
<TextView
android:id=
"@+id/look_location_tvs"
style=
"@style/IMTbleLine_TextValue"
android:layout_toLeftOf=
"@+id/look_location_imgs"
android:layout_toRightOf=
"@+id/look_location_tv"
/>
<ImageView
android:id=
"@+id/look_location_imgs"
style=
"@style/IMTbleLine_ArrowImg"
android:contentDescription=
"@string/app_name"
android:visibility=
"visible"
/>
</RelativeLayout>
<Button
android:id=
"@+id/next_step_btn"
style=
"@style/BossGreenBtn"
android:layout_width=
"fill_parent"
android:layout_height=
"48dp"
android:layout_marginLeft=
"9dp"
android:layout_marginTop=
"9dp"
android:layout_marginRight=
"9dp"
android:gravity=
"center"
/>
</LinearLayout>
</ScrollView>
</FrameLayout>
</LinearLayout>
\ No newline at end of file
plugin_im/src/main/res/layout/chat_be_friend.xml
0 → 100644
View file @
b303a9d6
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android=
"http://schemas.android.com/apk/res/android"
xmlns:tools=
"http://schemas.android.com/tools"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:gravity=
"center"
android:orientation=
"vertical"
android:paddingLeft=
"@dimen/chat_item_padding_left"
android:paddingTop=
"@dimen/chat_item_padding_top"
android:paddingRight=
"@dimen/chat_item_padding_right"
android:paddingBottom=
"@dimen/chat_item_padding_bottom"
>
<TextView
android:id=
"@+id/tv_time"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:gravity=
"center"
android:text=
"2019-08-19 16:36"
android:textColor=
"@color/gray"
android:textSize=
"@dimen/dp10"
/>
<TextView
android:textSize=
"@dimen/sp_12"
android:textColor=
"@color/textGray"
android:layout_marginTop=
"@dimen/size_3"
android:text=
"成功建立好友关系!"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
/>
</LinearLayout>
\ No newline at end of file
plugin_im/src/main/res/layout/common_empty.xml
0 → 100644
View file @
b303a9d6
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android=
"http://schemas.android.com/apk/res/android"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:gravity=
"center_horizontal"
android:id=
"@+id/linear_empty"
android:background=
"@color/colorWrite"
android:orientation=
"vertical"
>
<ImageView
android:id=
"@+id/iv_flag"
android:layout_width=
"345px"
android:layout_height=
"345px"
android:layout_centerInParent=
"true"
android:src=
"@drawable/gift_bill_list_empty"
/>
<TextView
android:layout_below=
"@id/iv_flag"
android:id=
"@+id/tv_tip"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_centerHorizontal=
"true"
android:text=
"@string/empty_no_data"
android:textColor=
"#ffcd00"
android:textSize=
"@dimen/sp_14"
/>
</RelativeLayout>
\ No newline at end of file
plugin_im/src/main/res/layout/item_add_record.xml
0 → 100644
View file @
b303a9d6
<?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:id=
"@+id/ll_content"
android:layout_width=
"match_parent"
android:layout_height=
"@dimen/dp50"
android:gravity=
"center_vertical"
android:orientation=
"horizontal"
>
<ImageView
android:id=
"@+id/img_header"
android:layout_width=
"@dimen/dp_40"
android:layout_height=
"@dimen/dp_40"
android:layout_marginLeft=
"@dimen/dp_10"
/>
<TextView
android:id=
"@+id/tv_name"
android:layout_width=
"0dp"
android:layout_height=
"wrap_content"
android:layout_marginLeft=
"@dimen/dp_10"
android:layout_weight=
"1"
/>
<Button
android:id=
"@+id/btn_add"
android:layout_width=
"@dimen/size_80"
android:layout_height=
"@dimen/size_38"
android:layout_gravity=
"right"
android:text=
"同意"
/>
<TextView
android:gravity=
"center"
android:id=
"@+id/text_add_status"
android:layout_width=
"@dimen/size_80"
android:layout_height=
"@dimen/size_38"
android:layout_gravity=
"right"
/>
</LinearLayout>
<View
android:layout_width=
"match_parent"
android:layout_height=
"1px"
android:layout_marginLeft=
"@dimen/size_60"
android:background=
"@color/colorGray"
/>
</LinearLayout>
plugin_im/src/main/res/layout/item_address_list.xml
View file @
b303a9d6
...
...
@@ -10,13 +10,14 @@
<LinearLayout
android:id=
"@+id/ll_navigation"
android:layout_width=
"match_parent"
android:layout_height=
"@dimen/size_3
8
"
android:background=
"@color/colorGray"
android:layout_height=
"@dimen/size_3
0
"
android:background=
"@color/colorGray
Bg
"
android:orientation=
"vertical"
>
<include
layout=
"@layout/common_line"
/>
<TextView
android:gravity=
"center_vertical"
android:id=
"@+id/tv_character"
android:layout_width=
"match_parent"
android:layout_height=
"0dp"
...
...
plugin_im/src/main/res/layout/item_friend_view.xml
View file @
b303a9d6
...
...
@@ -2,6 +2,7 @@
<LinearLayout
xmlns:android=
"http://schemas.android.com/apk/res/android"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:id=
"@+id/ll_content"
android:orientation=
"vertical"
>
<LinearLayout
...
...
plugin_im/src/main/res/values/strings.xml
View file @
b303a9d6
...
...
@@ -178,5 +178,14 @@
<string
name=
"text_group"
>
群聊
</string>
<string
name=
"text_new_friend"
>
新的朋友
</string>
<string
name=
"add_attention_failed"
>
加关注失败,你已被对方加入黑名单
</string>
<string
name=
"name_align"
>
昵
        
称
</string>
<string
name=
"remark_name"
>
备注名
</string>
<string
name=
"describe"
>
描述
</string>
<string
name=
"sex_align"
>
性
        
别
</string>
<string
name=
"birthday"
>
出生日期
</string>
<string
name=
"residence_align"
>
居
  
住
  
地
</string>
<string
name=
"phone_number"
>
手机号
</string>
<string
name=
"label_online_time"
>
上次在线时间
</string>
<string
name=
"qrcode"
>
二维码
</string>
<string
name=
"now_location"
>
所在位置
</string>
</resources>
\ No newline at end of file
plugin_im/src/main/res/values/styles.xml
View file @
b303a9d6
...
...
@@ -171,4 +171,53 @@
<item
name=
"android:backgroundDimEnabled"
>
true
</item>
<item
name=
"android:backgroundDimAmount"
>
0.6
</item>
</style>
<style
name=
"IMTbleLine_UP"
>
<item
name=
"android:background"
>
@drawable/set_list_up_bg
</item>
<item
name=
"android:layout_width"
>
match_parent
</item>
<item
name=
"android:layout_height"
>
wrap_content
</item>
<item
name=
"android:minHeight"
>
50dp
</item>
<item
name=
"android:paddingLeft"
>
20dp
</item>
<item
name=
"android:paddingRight"
>
27dp
</item>
</style>
<style
name=
"IMTbleLine_TextKey"
>
<item
name=
"android:textSize"
>
@dimen/one_level_title
</item>
<item
name=
"android:textColor"
>
#8b8a8a
</item>
<item
name=
"android:gravity"
>
center
</item>
<item
name=
"android:layout_width"
>
wrap_content
</item>
<item
name=
"android:layout_height"
>
wrap_content
</item>
<item
name=
"android:singleLine"
>
true
</item>
<item
name=
"android:layout_centerVertical"
>
true
</item>
</style>
<style
name=
"IMTbleLine_TextValue"
>
<item
name=
"android:textSize"
>
@dimen/one_level_title
</item>
<item
name=
"android:textColorHint"
>
@color/grey
</item>
<item
name=
"android:textColor"
>
@color/black
</item>
<item
name=
"android:gravity"
>
right
</item>
<item
name=
"android:layout_width"
>
fill_parent
</item>
<item
name=
"android:layout_height"
>
wrap_content
</item>
<item
name=
"android:layout_marginLeft"
>
5dp
</item>
<item
name=
"android:layout_marginRight"
>
5dp
</item>
<item
name=
"android:singleLine"
>
true
</item>
<item
name=
"android:layout_centerVertical"
>
true
</item>
</style>
<style
name=
"IMTbleLine_ArrowImg"
>
<item
name=
"android:layout_width"
>
8dp
</item>
<item
name=
"android:layout_height"
>
14dp
</item>
<item
name=
"android:layout_alignParentRight"
>
true
</item>
<item
name=
"android:layout_centerVertical"
>
true
</item>
<item
name=
"android:background"
>
@drawable/me_chevron_right
</item>
</style>
<style
name=
"IMTbleLine"
>
<item
name=
"android:background"
>
@drawable/set_list_down_bg
</item>
<item
name=
"android:layout_width"
>
match_parent
</item>
<item
name=
"android:layout_height"
>
wrap_content
</item>
<item
name=
"android:minHeight"
>
50dp
</item>
<item
name=
"android:paddingLeft"
>
20dp
</item>
<item
name=
"android:paddingRight"
>
27dp
</item>
</style>
</resources>
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment