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
fc9d4725
Commit
fc9d4725
authored
Sep 21, 2019
by
jianglx
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改Im的界面
parent
4f8cea18
Changes
28
Hide whitespace changes
Inline
Side-by-side
Showing
28 changed files
with
519 additions
and
327 deletions
+519
-327
HomeFragment.java
...java/com/rv/home/rv/module/ui/main/home/HomeFragment.java
+1
-1
TravelDetailsActivity.java
...main/java/com/rv/tourism/other/TravelDetailsActivity.java
+1
-1
AndroidManifest.xml
plugin_im/src/main/AndroidManifest.xml
+2
-2
ChatActivity.java
plugin_im/src/main/java/com/rv/im/ChatActivity.java
+65
-70
ConversationListActivity.java
..._im/src/main/java/com/rv/im/ConversationListActivity.java
+3
-2
CustomerListActivity.java
plugin_im/src/main/java/com/rv/im/CustomerListActivity.java
+77
-6
ChatContentAdapter.java
...m/src/main/java/com/rv/im/adapter/ChatContentAdapter.java
+68
-103
CustomerListAdapter.java
.../src/main/java/com/rv/im/adapter/CustomerListAdapter.java
+21
-3
ChatMessageServiceImp.java
...main/java/com/rv/im/db/service/ChatMessageServiceImp.java
+2
-4
IChatMessageService.java
...c/main/java/com/rv/im/db/service/IChatMessageService.java
+1
-1
Customer.java
plugin_im/src/main/java/com/rv/im/db/table/Customer.java
+19
-0
ChatPresenterImp.java
...c/main/java/com/rv/im/mvp/presenter/ChatPresenterImp.java
+1
-1
DateUtils.java
plugin_im/src/main/java/com/rv/im/util/DateUtils.java
+122
-12
emoje.png
plugin_im/src/main/res/drawable-xhdpi/emoje.png
+0
-0
icon_keyword.png
plugin_im/src/main/res/drawable-xhdpi/icon_keyword.png
+0
-0
icon_photo.png
plugin_im/src/main/res/drawable-xhdpi/icon_photo.png
+0
-0
icon_voice.png
plugin_im/src/main/res/drawable-xhdpi/icon_voice.png
+0
-0
im_voice_button_normal2.xml
plugin_im/src/main/res/drawable/im_voice_button_normal2.xml
+4
-7
im_voice_button_pressed2.xml
plugin_im/src/main/res/drawable/im_voice_button_pressed2.xml
+2
-5
activity_chat.xml
plugin_im/src/main/res/layout/activity_chat.xml
+28
-28
camera_view.xml
plugin_im/src/main/res/layout/camera_view.xml
+0
-60
chat_from_item_text.xml
plugin_im/src/main/res/layout/chat_from_item_text.xml
+5
-3
chat_to_item_text.xml
plugin_im/src/main/res/layout/chat_to_item_text.xml
+6
-3
dialog_select_media.xml
plugin_im/src/main/res/layout/dialog_select_media.xml
+64
-0
item_customer.xml
plugin_im/src/main/res/layout/item_customer.xml
+23
-11
EasyCameraActivity.java
...n/java/com/xxfc/imcamera/activity/EasyCameraActivity.java
+2
-2
JCameraView.java
...ain/java/com/xxfc/imcamera/cameralibrary/JCameraView.java
+1
-1
activity_easy_camera_lf.xml
..._imcamera/src/main/res/layout/activity_easy_camera_lf.xml
+1
-1
No files found.
module_home/src/main/java/com/rv/home/rv/module/ui/main/home/HomeFragment.java
View file @
fc9d4725
...
@@ -873,7 +873,7 @@ public class HomeFragment extends BaseFragment<HomePresenter> implements Observa
...
@@ -873,7 +873,7 @@ public class HomeFragment extends BaseFragment<HomePresenter> implements Observa
scrollview
.
fullScroll
(
View
.
FOCUS_UP
);
scrollview
.
fullScroll
(
View
.
FOCUS_UP
);
}
else
if
(
id
==
R
.
id
.
iv_home_travel_server_image
)
{
}
else
if
(
id
==
R
.
id
.
iv_home_travel_server_image
)
{
if
(
isLogin
())
{
if
(
isLogin
())
{
ComponentName
name
=
new
ComponentName
(
getActivity
(),
"com.rv.im.C
onversation
ListActivity"
);
ComponentName
name
=
new
ComponentName
(
getActivity
(),
"com.rv.im.C
ustomer
ListActivity"
);
Intent
intent
=
new
Intent
();
Intent
intent
=
new
Intent
();
intent
.
putExtra
(
"login_user_id"
,
Cookie
.
getStringValue
(
getContext
(),
SPConstance
.
USER_JSON_IMUSERID
));
intent
.
putExtra
(
"login_user_id"
,
Cookie
.
getStringValue
(
getContext
(),
SPConstance
.
USER_JSON_IMUSERID
));
intent
.
setComponent
(
name
);
intent
.
setComponent
(
name
);
...
...
module_tourism/src/main/java/com/rv/tourism/other/TravelDetailsActivity.java
View file @
fc9d4725
...
@@ -140,7 +140,7 @@ public class TravelDetailsActivity extends BaseStatusActivity<TourismPresenter>
...
@@ -140,7 +140,7 @@ public class TravelDetailsActivity extends BaseStatusActivity<TourismPresenter>
protected
void
initView
(
Bundle
savedInstanceState
,
TitleView
titleView
,
Intent
intent
)
{
protected
void
initView
(
Bundle
savedInstanceState
,
TitleView
titleView
,
Intent
intent
)
{
showTitle
(
false
);
showTitle
(
false
);
tvTitleCenter
.
setText
(
"旅游详情"
);
tvTitleCenter
.
setText
(
"旅游详情"
);
webUrl
=
TourismApi
.
TRAVEL_DETAILS
+
"?id="
+
id
+
"
?
v=1"
;
webUrl
=
TourismApi
.
TRAVEL_DETAILS
+
"?id="
+
id
+
"
&
v=1"
;
initWeb
();
initWeb
();
initRxbus
();
initRxbus
();
if
(!
TextUtils
.
isEmpty
(
name
)
&&
!
TextUtils
.
isEmpty
(
url
))
{
if
(!
TextUtils
.
isEmpty
(
name
)
&&
!
TextUtils
.
isEmpty
(
url
))
{
...
...
plugin_im/src/main/AndroidManifest.xml
View file @
fc9d4725
...
@@ -7,7 +7,7 @@
...
@@ -7,7 +7,7 @@
<uses-permission
android:name=
"android.permission.RECORD_AUDIO"
/>
<uses-permission
android:name=
"android.permission.RECORD_AUDIO"
/>
<!-- 调用相机权限 -->
<!-- 调用相机权限 -->
<uses-permission
android:name=
"android.permission.CAMERA"
/>
<uses-permission
android:name=
"android.permission.CAMERA"
/>
<uses-permission
android:name=
"android.permission.CALL_PHONE"
/>
<uses-permission
android:name=
"android.permission.CALL_PHONE"
/>
<application>
<application>
<activity
android:name=
"com.rv.im.ChatActivity"
/>
<activity
android:name=
"com.rv.im.ChatActivity"
/>
...
@@ -30,7 +30,7 @@
...
@@ -30,7 +30,7 @@
android:name=
"com.rv.im.ImService"
android:name=
"com.rv.im.ImService"
android:enabled=
"true"
android:enabled=
"true"
android:exported=
"true"
/>
android:exported=
"true"
/>
<!-- android:process=":im_romote"
-->
<!--android:process=":im_romote" />
-->
<service
android:name=
"com.rv.im.call.RecordService"
/>
<service
android:name=
"com.rv.im.call.RecordService"
/>
...
...
plugin_im/src/main/java/com/rv/im/ChatActivity.java
View file @
fc9d4725
package
com
.
rv
.
im
;
package
com
.
rv
.
im
;
import
android.Manifest
;
import
android.Manifest
;
import
android.app.Dialog
;
import
android.content.Context
;
import
android.content.Context
;
import
android.content.Intent
;
import
android.content.Intent
;
import
android.os.Bundle
;
import
android.os.Bundle
;
...
@@ -13,13 +14,16 @@ import android.text.Editable;
...
@@ -13,13 +14,16 @@ import android.text.Editable;
import
android.text.TextUtils
;
import
android.text.TextUtils
;
import
android.text.TextWatcher
;
import
android.text.TextWatcher
;
import
android.util.Log
;
import
android.util.Log
;
import
android.view.Gravity
;
import
android.view.LayoutInflater
;
import
android.view.View
;
import
android.view.View
;
import
android.view.ViewGroup
;
import
android.view.ViewStub
;
import
android.view.ViewStub
;
import
android.view.inputmethod.InputMethodManager
;
import
android.view.inputmethod.InputMethodManager
;
import
android.widget.Button
;
import
android.widget.Button
;
import
android.widget.EditText
;
import
android.widget.EditText
;
import
android.widget.ImageButton
;
import
android.widget.ImageButton
;
import
android.widget.
LinearLayout
;
import
android.widget.
TextView
;
import
android.widget.Toast
;
import
android.widget.Toast
;
import
com.ruiwenliu.wrapper.base.BaseBean
;
import
com.ruiwenliu.wrapper.base.BaseBean
;
...
@@ -57,25 +61,18 @@ import pub.devrel.easypermissions.EasyPermissions;
...
@@ -57,25 +61,18 @@ import pub.devrel.easypermissions.EasyPermissions;
public
class
ChatActivity
extends
BaseStatusActivity
<
CommonPresenter
>
implements
EasyPermissions
.
PermissionCallbacks
,
IChatView
,
ChatMessageListener
,
View
.
OnClickListener
,
RecordListener
{
public
class
ChatActivity
extends
BaseStatusActivity
<
CommonPresenter
>
implements
EasyPermissions
.
PermissionCallbacks
,
IChatView
,
ChatMessageListener
,
View
.
OnClickListener
,
RecordListener
{
private
ImageButton
voiceImgBtn
;
private
ImageButton
voiceImgBtn
;
private
ImageButton
btnCancelReplay
;
private
ImageButton
ibKeyword
;
private
EditText
chatEdit
;
private
EditText
chatEdit
;
private
Button
recordBtn
;
private
TextView
recordBtn
;
private
LinearLayout
leftLayout
;
private
ImageButton
emotionBtn
;
// 表情
private
ImageButton
emotionBtn
;
// 表情
private
ImageButton
moreBtn
;
private
ImageButton
ibPhoto
;
private
Button
sendBtn
;
private
Button
sendBtn
;
private
RecyclerView
recycleContent
;
private
RecyclerView
recycleContent
;
private
ViewStub
chatToolsViewStub
;
private
ViewStub
mChatFaceViewStub
;
private
ViewStub
mChatFaceViewStub
;
private
String
mLoginUserId
;
private
String
mLoginUserId
;
private
List
<
ChatMessage
>
messages
=
new
ArrayList
<>();
private
List
<
ChatMessage
>
messages
=
new
ArrayList
<>();
private
ChatContentAdapter
adapter
;
private
ChatContentAdapter
adapter
;
private
LinearLayout
lLMoreSelect
;
private
IMRecordController
mRecordController
;
private
IMRecordController
mRecordController
;
private
IChatPresenter
presenter
;
private
IChatPresenter
presenter
;
private
ChatFaceView
mChatFaceView
;
private
ChatFaceView
mChatFaceView
;
...
@@ -212,7 +209,6 @@ public class ChatActivity extends BaseStatusActivity<CommonPresenter> implements
...
@@ -212,7 +209,6 @@ public class ChatActivity extends BaseStatusActivity<CommonPresenter> implements
public
static
Intent
getIntent
(
Context
context
,
String
targetUserId
,
String
targetName
)
{
public
static
Intent
getIntent
(
Context
context
,
String
targetUserId
,
String
targetName
)
{
Intent
intent
=
new
Intent
(
context
,
ChatActivity
.
class
);
Intent
intent
=
new
Intent
(
context
,
ChatActivity
.
class
);
// intent.putExtra("targetUserId", "10000028");
intent
.
putExtra
(
"targetUserId"
,
targetUserId
);
intent
.
putExtra
(
"targetUserId"
,
targetUserId
);
intent
.
putExtra
(
"targetName"
,
targetName
);
intent
.
putExtra
(
"targetName"
,
targetName
);
return
intent
;
return
intent
;
...
@@ -257,28 +253,38 @@ public class ChatActivity extends BaseStatusActivity<CommonPresenter> implements
...
@@ -257,28 +253,38 @@ public class ChatActivity extends BaseStatusActivity<CommonPresenter> implements
private
void
initWidget
()
{
private
void
initWidget
()
{
voiceImgBtn
=
findViewById
(
R
.
id
.
voice_img_btn
);
voiceImgBtn
=
findViewById
(
R
.
id
.
voice_img_btn
);
btnCancelReplay
=
findViewById
(
R
.
id
.
btnCancelReplay
);
ibKeyword
=
findViewById
(
R
.
id
.
ib_keyword
);
chatEdit
=
findViewById
(
R
.
id
.
chat_edit
);
chatEdit
=
findViewById
(
R
.
id
.
chat_edit
);
recordBtn
=
findViewById
(
R
.
id
.
record_btn
);
recordBtn
=
findViewById
(
R
.
id
.
record_btn
);
leftLayout
=
findViewById
(
R
.
id
.
left_layout
);
emotionBtn
=
findViewById
(
R
.
id
.
emotion_btn
);
emotionBtn
=
findViewById
(
R
.
id
.
emotion_btn
);
moreBtn
=
findViewById
(
R
.
id
.
more_btn
);
ibPhoto
=
findViewById
(
R
.
id
.
ib_photo
);
sendBtn
=
findViewById
(
R
.
id
.
send_btn
);
sendBtn
=
findViewById
(
R
.
id
.
send_btn
);
chatToolsViewStub
=
findViewById
(
R
.
id
.
chat_tools_view_stub
);
//
chatToolsViewStub = findViewById(R.id.chat_tools_view_stub);
mChatFaceViewStub
=
findViewById
(
R
.
id
.
chat_face_view_stub
);
mChatFaceViewStub
=
findViewById
(
R
.
id
.
chat_face_view_stub
);
recycleContent
=
findViewById
(
R
.
id
.
recycle_content
);
recycleContent
=
findViewById
(
R
.
id
.
recycle_content
);
recycleContent
.
setLayoutManager
(
new
LinearLayoutManager
(
this
,
LinearLayoutManager
.
VERTICAL
,
false
));
recycleContent
.
setLayoutManager
(
new
LinearLayoutManager
(
this
,
LinearLayoutManager
.
VERTICAL
,
false
));
adapter
=
new
ChatContentAdapter
(
getApplicationContext
(),
mLoginUserId
,
messages
,
clickItemListener
);
adapter
=
new
ChatContentAdapter
(
getApplicationContext
(),
mLoginUserId
,
messages
,
clickItemListener
);
recycleContent
.
setAdapter
(
adapter
);
recycleContent
.
setAdapter
(
adapter
);
recycleContent
.
addOnScrollListener
(
new
RecyclerView
.
OnScrollListener
()
{
@Override
public
void
onScrollStateChanged
(
@NonNull
RecyclerView
recyclerView
,
int
newState
)
{
// super.onScrollStateChanged(recyclerView, newState);
}
@Override
public
void
onScrolled
(
@NonNull
RecyclerView
recyclerView
,
int
dx
,
int
dy
)
{
// super.onScrolled(recyclerView, dx, dy);
}
});
}
}
private
void
initListener
()
{
private
void
initListener
()
{
chatEdit
.
addTextChangedListener
(
watcher
);
chatEdit
.
addTextChangedListener
(
watcher
);
sendBtn
.
setOnClickListener
(
this
);
sendBtn
.
setOnClickListener
(
this
);
moreBtn
.
setOnClickListener
(
this
);
ibPhoto
.
setOnClickListener
(
this
);
voiceImgBtn
.
setOnClickListener
(
this
);
voiceImgBtn
.
setOnClickListener
(
this
);
emotionBtn
.
setOnClickListener
(
this
);
emotionBtn
.
setOnClickListener
(
this
);
btnCancelReplay
.
setOnClickListener
(
this
);
ibKeyword
.
setOnClickListener
(
this
);
mRecordController
=
new
IMRecordController
(
this
);
mRecordController
=
new
IMRecordController
(
this
);
mRecordController
.
setRecordListener
(
this
);
mRecordController
.
setRecordListener
(
this
);
recordBtn
.
setOnTouchListener
(
mRecordController
);
recordBtn
.
setOnTouchListener
(
mRecordController
);
...
@@ -294,18 +300,13 @@ public class ChatActivity extends BaseStatusActivity<CommonPresenter> implements
...
@@ -294,18 +300,13 @@ public class ChatActivity extends BaseStatusActivity<CommonPresenter> implements
}
}
presenter
.
sendText
(
chatEdit
.
getText
().
toString
().
trim
());
presenter
.
sendText
(
chatEdit
.
getText
().
toString
().
trim
());
chatEdit
.
getEditableText
().
clear
();
chatEdit
.
getEditableText
().
clear
();
}
else
if
(
id
==
R
.
id
.
more_btn
)
{
}
else
if
(
id
==
R
.
id
.
ib_photo
)
{
// changeChatToolsView();
openPhotoDialog
();
if
(
isToolsShown
())
{
// 表情布局在显示,那么点击则是隐藏表情,显示键盘
closeKeyboard
();
showKeyboard
();
if
(
isFaceShown
())
{
// 表情布局在显示,那么点击则是隐藏表情,显示键盘
changeChatToolsView
(
false
);
}
else
{
// 更多布局没有显示,那么点击则是显示更多,隐藏表情、录音、键盘布局
closeKeyboard
();
closeKeyboard
();
mHandler
.
postDelayed
(()
->
{
mHandler
.
postDelayed
(()
->
{
closeKeyboard
();
changeChatFaceView
(
false
);
changeChatFaceView
(
false
);
changeChatToolsView
(
true
);
changeRecordBtn
(
false
);
},
0
);
},
0
);
}
}
}
else
if
(
id
==
R
.
id
.
tv_pic
)
{
}
else
if
(
id
==
R
.
id
.
tv_pic
)
{
...
@@ -323,13 +324,14 @@ public class ChatActivity extends BaseStatusActivity<CommonPresenter> implements
...
@@ -323,13 +324,14 @@ public class ChatActivity extends BaseStatusActivity<CommonPresenter> implements
changeChatFaceView
(
false
);
changeChatFaceView
(
false
);
chatEdit
.
setVisibility
(
View
.
GONE
);
chatEdit
.
setVisibility
(
View
.
GONE
);
recordBtn
.
setVisibility
(
View
.
VISIBLE
);
recordBtn
.
setVisibility
(
View
.
VISIBLE
);
btnCancelReplay
.
setVisibility
(
View
.
VISIBLE
);
ibKeyword
.
setVisibility
(
View
.
VISIBLE
);
voiceImgBtn
.
setVisibility
(
View
.
GONE
);
voiceImgBtn
.
setVisibility
(
View
.
GONE
);
}
else
if
(
id
==
R
.
id
.
btnCancelReplay
)
{
closeKeyboard
();
}
else
if
(
id
==
R
.
id
.
ib_keyword
)
{
changeChatFaceView
(
false
);
changeChatFaceView
(
false
);
chatEdit
.
setVisibility
(
View
.
VISIBLE
);
chatEdit
.
setVisibility
(
View
.
VISIBLE
);
recordBtn
.
setVisibility
(
View
.
GONE
);
recordBtn
.
setVisibility
(
View
.
GONE
);
btnCancelReplay
.
setVisibility
(
View
.
GONE
);
ibKeyword
.
setVisibility
(
View
.
GONE
);
voiceImgBtn
.
setVisibility
(
View
.
VISIBLE
);
voiceImgBtn
.
setVisibility
(
View
.
VISIBLE
);
}
else
if
(
id
==
R
.
id
.
tv_file
)
{
}
else
if
(
id
==
R
.
id
.
tv_file
)
{
...
@@ -350,14 +352,13 @@ public class ChatActivity extends BaseStatusActivity<CommonPresenter> implements
...
@@ -350,14 +352,13 @@ public class ChatActivity extends BaseStatusActivity<CommonPresenter> implements
presenter
.
realDial
(
callType
,
null
);
presenter
.
realDial
(
callType
,
null
);
}
else
if
(
id
==
R
.
id
.
emotion_btn
)
{
}
else
if
(
id
==
R
.
id
.
emotion_btn
)
{
if
(
isFaceShown
())
{
// 表情布局在显示,那么点击则是隐藏表情,显示键盘
if
(
isFaceShown
())
{
// 表情布局在显示,那么点击则是隐藏表情,显示键盘
showKeyboard
();
//
showKeyboard();
changeChatFaceView
(
false
);
changeChatFaceView
(
false
);
}
else
{
// 表情布局没有显示,那么点击则是显示表情,隐藏键盘、录音、更多布局
}
else
{
// 表情布局没有显示,那么点击则是显示表情,隐藏键盘、录音、更多布局
closeKeyboard
();
closeKeyboard
();
mHandler
.
postDelayed
(()
->
{
mHandler
.
postDelayed
(()
->
{
closeKeyboard
();
closeKeyboard
();
changeChatFaceView
(
true
);
changeChatFaceView
(
true
);
changeChatToolsView
(
false
);
changeRecordBtn
(
false
);
changeRecordBtn
(
false
);
},
0
);
},
0
);
}
}
...
@@ -368,11 +369,6 @@ public class ChatActivity extends BaseStatusActivity<CommonPresenter> implements
...
@@ -368,11 +369,6 @@ public class ChatActivity extends BaseStatusActivity<CommonPresenter> implements
private
int
callType
;
private
int
callType
;
private
void
showKeyboard
()
{
chatEdit
.
requestFocus
();
mInputManager
.
toggleSoftInput
(
0
,
InputMethodManager
.
SHOW_FORCED
);
}
private
boolean
isFaceShown
()
{
private
boolean
isFaceShown
()
{
return
mChatFaceView
!=
null
&&
mChatFaceView
.
getVisibility
()
!=
View
.
GONE
;
return
mChatFaceView
!=
null
&&
mChatFaceView
.
getVisibility
()
!=
View
.
GONE
;
}
}
...
@@ -381,8 +377,31 @@ public class ChatActivity extends BaseStatusActivity<CommonPresenter> implements
...
@@ -381,8 +377,31 @@ public class ChatActivity extends BaseStatusActivity<CommonPresenter> implements
mInputManager
.
hideSoftInputFromWindow
(
chatEdit
.
getApplicationWindowToken
(),
0
);
mInputManager
.
hideSoftInputFromWindow
(
chatEdit
.
getApplicationWindowToken
(),
0
);
}
}
private
boolean
isToolsShown
()
{
private
void
openPhotoDialog
(){
return
lLMoreSelect
!=
null
&&
lLMoreSelect
.
getVisibility
()
!=
View
.
GONE
;
Dialog
bottomDialog
=
new
Dialog
(
this
,
R
.
style
.
BottomDialog
);
View
contentView
=
LayoutInflater
.
from
(
this
).
inflate
(
R
.
layout
.
dialog_select_media
,
null
);
bottomDialog
.
setContentView
(
contentView
);
ViewGroup
.
LayoutParams
layoutParams
=
contentView
.
getLayoutParams
();
layoutParams
.
width
=
getResources
().
getDisplayMetrics
().
widthPixels
;
contentView
.
setLayoutParams
(
layoutParams
);
bottomDialog
.
getWindow
().
setGravity
(
Gravity
.
BOTTOM
);
bottomDialog
.
getWindow
().
setWindowAnimations
(
R
.
style
.
BottomDialog_Animation
);
bottomDialog
.
show
();
TextView
textView
=
contentView
.
findViewById
(
R
.
id
.
dialog_select_voice
);
textView
.
setText
(
"拍照"
);
TextView
textView_02
=
contentView
.
findViewById
(
R
.
id
.
dialog_select_video
);
textView_02
.
setText
(
"手机相册"
);
contentView
.
findViewById
(
R
.
id
.
dialog_select_cancel
).
setOnClickListener
(
v
->
bottomDialog
.
dismiss
());
contentView
.
findViewById
(
R
.
id
.
dialog_select_voice_ll
).
setOnClickListener
(
v
->
{
isCamera
=
true
;
presenter
.
clickPicPicker
(
isCamera
);
bottomDialog
.
dismiss
();
});
contentView
.
findViewById
(
R
.
id
.
dialog_select_video_ll
).
setOnClickListener
(
v
->
{
isCamera
=
false
;
presenter
.
clickPicPicker
(
isCamera
);
bottomDialog
.
dismiss
();
});
}
}
private
void
changeRecordBtn
(
boolean
show
)
{
private
void
changeRecordBtn
(
boolean
show
)
{
...
@@ -405,7 +424,7 @@ public class ChatActivity extends BaseStatusActivity<CommonPresenter> implements
...
@@ -405,7 +424,7 @@ public class ChatActivity extends BaseStatusActivity<CommonPresenter> implements
* 显示或隐藏表情布局
* 显示或隐藏表情布局
*/
*/
private
void
changeChatFaceView
(
boolean
show
)
{
private
void
changeChatFaceView
(
boolean
show
)
{
btnCancelReplay
.
setVisibility
(
View
.
GONE
);
ibKeyword
.
setVisibility
(
View
.
GONE
);
voiceImgBtn
.
setVisibility
(
View
.
VISIBLE
);
voiceImgBtn
.
setVisibility
(
View
.
VISIBLE
);
boolean
isShowing
=
isFaceShown
();
boolean
isShowing
=
isFaceShown
();
if
(
isShowing
==
show
)
{
if
(
isShowing
==
show
)
{
...
@@ -429,10 +448,10 @@ public class ChatActivity extends BaseStatusActivity<CommonPresenter> implements
...
@@ -429,10 +448,10 @@ public class ChatActivity extends BaseStatusActivity<CommonPresenter> implements
});
});
}
}
mChatFaceView
.
setVisibility
(
View
.
VISIBLE
);
mChatFaceView
.
setVisibility
(
View
.
VISIBLE
);
emotionBtn
.
setBackgroundResource
(
R
.
drawable
.
im_btn_keyboard_bg
);
//
emotionBtn.setBackgroundResource(R.drawable.im_btn_keyboard_bg);
}
else
{
}
else
{
mChatFaceView
.
setVisibility
(
View
.
GONE
);
mChatFaceView
.
setVisibility
(
View
.
GONE
);
emotionBtn
.
setBackgroundResource
(
R
.
drawable
.
im_btn_emotion_bg
);
//
emotionBtn.setBackgroundResource(R.drawable.im_btn_emotion_bg);
}
}
}
}
...
@@ -452,7 +471,7 @@ public class ChatActivity extends BaseStatusActivity<CommonPresenter> implements
...
@@ -452,7 +471,7 @@ public class ChatActivity extends BaseStatusActivity<CommonPresenter> implements
}
else
if
(
requestCode
==
REQUEST_PERMISSION_AUDIO
)
{
}
else
if
(
requestCode
==
REQUEST_PERMISSION_AUDIO
)
{
chatEdit
.
setVisibility
(
View
.
GONE
);
chatEdit
.
setVisibility
(
View
.
GONE
);
recordBtn
.
setVisibility
(
View
.
VISIBLE
);
recordBtn
.
setVisibility
(
View
.
VISIBLE
);
btnCancelReplay
.
setVisibility
(
View
.
VISIBLE
);
ibKeyword
.
setVisibility
(
View
.
VISIBLE
);
voiceImgBtn
.
setVisibility
(
View
.
GONE
);
voiceImgBtn
.
setVisibility
(
View
.
GONE
);
}
else
if
(
requestCode
==
REQUEST_PERMISSION_FILE
)
{
}
else
if
(
requestCode
==
REQUEST_PERMISSION_FILE
)
{
presenter
.
clickFile
();
presenter
.
clickFile
();
...
@@ -473,30 +492,6 @@ public class ChatActivity extends BaseStatusActivity<CommonPresenter> implements
...
@@ -473,30 +492,6 @@ public class ChatActivity extends BaseStatusActivity<CommonPresenter> implements
}
}
}
}
private
void
changeChatToolsView
(
boolean
show
)
{
boolean
isShowing
=
isToolsShown
();
if
(
isShowing
==
show
)
{
return
;
}
if
(
show
)
{
if
(
lLMoreSelect
==
null
)
{
lLMoreSelect
=
(
LinearLayout
)
chatToolsViewStub
.
inflate
();
lLMoreSelect
.
findViewById
(
R
.
id
.
tv_photo
).
setOnClickListener
(
this
);
lLMoreSelect
.
findViewById
(
R
.
id
.
tv_pic
).
setOnClickListener
(
this
);
lLMoreSelect
.
findViewById
(
R
.
id
.
tv_file
).
setOnClickListener
(
this
);
lLMoreSelect
.
findViewById
(
R
.
id
.
tv_vilte
).
setOnClickListener
(
this
);
lLMoreSelect
.
findViewById
(
R
.
id
.
tv_video
).
setOnClickListener
(
this
);
}
lLMoreSelect
.
setVisibility
(
View
.
VISIBLE
);
moreBtn
.
setBackgroundResource
(
R
.
drawable
.
im_btn_more_bg
);
}
else
{
lLMoreSelect
.
setVisibility
(
View
.
GONE
);
moreBtn
.
setBackgroundResource
(
R
.
drawable
.
im_btn_more_bg
);
}
}
@Override
@Override
public
void
onDestroy
()
{
public
void
onDestroy
()
{
super
.
onDestroy
();
super
.
onDestroy
();
...
@@ -510,7 +505,7 @@ public class ChatActivity extends BaseStatusActivity<CommonPresenter> implements
...
@@ -510,7 +505,7 @@ public class ChatActivity extends BaseStatusActivity<CommonPresenter> implements
messages
.
addAll
(
lists
);
messages
.
addAll
(
lists
);
adapter
.
notifyDataSetChanged
();
adapter
.
notifyDataSetChanged
();
if
(
messages
.
size
()
>
0
)
{
if
(
messages
.
size
()
>
0
)
{
recycleContent
.
scrollToPosition
(
messages
.
size
()
-
1
);
recycleContent
.
s
moothS
crollToPosition
(
messages
.
size
()
-
1
);
}
}
}
}
}
}
...
@@ -588,7 +583,7 @@ public class ChatActivity extends BaseStatusActivity<CommonPresenter> implements
...
@@ -588,7 +583,7 @@ public class ChatActivity extends BaseStatusActivity<CommonPresenter> implements
public
void
addMessage
(
ChatMessage
message
)
{
public
void
addMessage
(
ChatMessage
message
)
{
messages
.
add
(
message
);
messages
.
add
(
message
);
adapter
.
notifyDataSetChanged
();
adapter
.
notifyDataSetChanged
();
recycleContent
.
s
crollToPosition
(
adapter
.
getItemCount
()
-
1
);
recycleContent
.
s
moothScrollToPosition
(
messages
.
size
()
-
1
);
}
}
@Override
@Override
...
@@ -623,7 +618,7 @@ public class ChatActivity extends BaseStatusActivity<CommonPresenter> implements
...
@@ -623,7 +618,7 @@ public class ChatActivity extends BaseStatusActivity<CommonPresenter> implements
messages
.
add
(
message
);
messages
.
add
(
message
);
adapter
.
notifyDataSetChanged
();
adapter
.
notifyDataSetChanged
();
if
(
messages
.
size
()
>
0
)
{
if
(
messages
.
size
()
>
0
)
{
recycleContent
.
scrollToPosition
(
messages
.
size
()
-
1
);
recycleContent
.
s
moothS
crollToPosition
(
messages
.
size
()
-
1
);
}
}
}
}
}
}
...
...
plugin_im/src/main/java/com/rv/im/ConversationListActivity.java
View file @
fc9d4725
...
@@ -52,6 +52,7 @@ public class ConversationListActivity extends BaseStatusActivity<CommonPresenter
...
@@ -52,6 +52,7 @@ public class ConversationListActivity extends BaseStatusActivity<CommonPresenter
protected
void
initView
(
Bundle
savedInstanceState
,
TitleView
titleView
,
Intent
intent
)
{
protected
void
initView
(
Bundle
savedInstanceState
,
TitleView
titleView
,
Intent
intent
)
{
ListenerManager
.
getInstance
().
addChatMessageListener
(
this
);
ListenerManager
.
getInstance
().
addChatMessageListener
(
this
);
ListenerManager
.
getInstance
().
addAuthStateChangeListener
(
this
);
switch
(
XmppConnectionManager
.
mXMPPCurrentState
)
{
switch
(
XmppConnectionManager
.
mXMPPCurrentState
)
{
case
0
:
case
0
:
case
1
:
case
1
:
...
@@ -89,7 +90,6 @@ public class ConversationListActivity extends BaseStatusActivity<CommonPresenter
...
@@ -89,7 +90,6 @@ public class ConversationListActivity extends BaseStatusActivity<CommonPresenter
}
}
Downloader
.
getInstance
().
init
(
file
.
getAbsolutePath
());
Downloader
.
getInstance
().
init
(
file
.
getAbsolutePath
());
ListenerManager
.
getInstance
().
addAuthStateChangeListener
(
this
);
}
}
...
@@ -105,7 +105,7 @@ public class ConversationListActivity extends BaseStatusActivity<CommonPresenter
...
@@ -105,7 +105,7 @@ public class ConversationListActivity extends BaseStatusActivity<CommonPresenter
Iterator
<
ChatConversation
>
iterator
=
lists
.
iterator
();
Iterator
<
ChatConversation
>
iterator
=
lists
.
iterator
();
while
(
iterator
.
hasNext
())
{
while
(
iterator
.
hasNext
())
{
ChatConversation
conversation
=
iterator
.
next
();
ChatConversation
conversation
=
iterator
.
next
();
ChatMessage
message
=
ChatMessageServiceImp
.
getInstance
(
getApplicationContext
()).
getLastMsg
(
conversation
);
ChatMessage
message
=
ChatMessageServiceImp
.
getInstance
(
getApplicationContext
()).
getLastMsg
(
conversation
.
getUserId
()
);
int
unRead
=
ChatMessageServiceImp
.
getInstance
(
getApplicationContext
()).
getUnReadMsg
(
conversation
.
getUserId
());
int
unRead
=
ChatMessageServiceImp
.
getInstance
(
getApplicationContext
()).
getUnReadMsg
(
conversation
.
getUserId
());
conversation
.
setUnReadMessage
(
unRead
);
conversation
.
setUnReadMessage
(
unRead
);
if
(
message
!=
null
)
{
if
(
message
!=
null
)
{
...
@@ -137,6 +137,7 @@ public class ConversationListActivity extends BaseStatusActivity<CommonPresenter
...
@@ -137,6 +137,7 @@ public class ConversationListActivity extends BaseStatusActivity<CommonPresenter
public
void
onDestroy
()
{
public
void
onDestroy
()
{
super
.
onDestroy
();
super
.
onDestroy
();
ListenerManager
.
getInstance
().
removeAuthStateChangeListener
(
this
);
ListenerManager
.
getInstance
().
removeAuthStateChangeListener
(
this
);
ListenerManager
.
getInstance
().
removeChatMessageListener
(
this
);
}
}
@Override
@Override
...
...
plugin_im/src/main/java/com/rv/im/CustomerListActivity.java
View file @
fc9d4725
package
com
.
rv
.
im
;
package
com
.
rv
.
im
;
import
android.app.ActivityManager
;
import
android.content.Context
;
import
android.content.Intent
;
import
android.content.Intent
;
import
android.os.Build
;
import
android.os.Bundle
;
import
android.os.Bundle
;
import
android.support.annotation.Nullable
;
import
android.support.v7.widget.LinearLayoutManager
;
import
android.support.v7.widget.LinearLayoutManager
;
import
android.support.v7.widget.RecyclerView
;
import
android.support.v7.widget.RecyclerView
;
import
android.text.TextUtils
;
import
android.widget.LinearLayout
;
import
android.widget.LinearLayout
;
import
android.widget.Toast
;
import
com.ruiwenliu.wrapper.base.BaseBean
;
import
com.ruiwenliu.wrapper.base.BaseBean
;
import
com.ruiwenliu.wrapper.base.BaseStatusActivity
;
import
com.ruiwenliu.wrapper.base.BaseStatusActivity
;
...
@@ -14,35 +20,64 @@ import com.ruiwenliu.wrapper.weight.refresh.SimpleRefreshLayout;
...
@@ -14,35 +20,64 @@ import com.ruiwenliu.wrapper.weight.refresh.SimpleRefreshLayout;
import
com.ruiwenliu.wrapper.weight.refresh.SimpleRefreshView
;
import
com.ruiwenliu.wrapper.weight.refresh.SimpleRefreshView
;
import
com.rv.im.adapter.CustomerListAdapter
;
import
com.rv.im.adapter.CustomerListAdapter
;
import
com.rv.im.bean.CustomersBean
;
import
com.rv.im.bean.CustomersBean
;
import
com.rv.im.db.service.ChatConversationServiceImp
;
import
com.rv.im.db.service.ChatMessageServiceImp
;
import
com.rv.im.db.service.CustomerServiceImp
;
import
com.rv.im.db.service.CustomerServiceImp
;
import
com.rv.im.db.service.ICustomerService
;
import
com.rv.im.db.service.ICustomerService
;
import
com.rv.im.db.table.ChatConversation
;
import
com.rv.im.db.table.ChatMessage
;
import
com.rv.im.db.table.Customer
;
import
com.rv.im.db.table.Customer
;
import
com.rv.im.util.ServiceUtils
;
import
com.rv.im.xmpp.ListenerManager
;
import
com.rv.im.xmpp.listener.AuthStateListener
;
import
com.rv.im.xmpp.listener.ChatMessageListener
;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
import
java.util.Collections
;
import
java.util.Iterator
;
import
java.util.List
;
import
java.util.List
;
public
class
CustomerListActivity
extends
BaseStatusActivity
<
CommonPresenter
>
implements
SimpleRefreshLayout
.
OnSimpleRefreshListener
{
public
class
CustomerListActivity
extends
BaseStatusActivity
<
CommonPresenter
>
implements
SimpleRefreshLayout
.
OnSimpleRefreshListener
,
ChatMessageListener
{
private
SimpleRefreshLayout
refreshLayout
;
private
SimpleRefreshLayout
refreshLayout
;
private
RecyclerView
recyclerView
;
private
RecyclerView
recyclerView
;
private
List
<
Customer
>
customers
=
new
ArrayList
<>();
private
List
<
Customer
>
customers
=
new
ArrayList
<>();
private
CustomerListAdapter
adapter
=
null
;
private
CustomerListAdapter
adapter
=
null
;
private
int
testTime
=
0
;
@Override
@Override
protected
int
setLayout
()
{
protected
int
setLayout
()
{
return
R
.
layout
.
activity_customer_list
;
return
R
.
layout
.
activity_customer_list
;
}
}
@Override
@Override
protected
void
initView
(
Bundle
savedInstanceState
,
TitleView
titleView
,
Intent
intent
)
{
protected
void
initView
(
Bundle
savedInstanceState
,
TitleView
titleView
,
Intent
intent
)
{
ListenerManager
.
getInstance
().
addChatMessageListener
(
this
);
titleView
.
setTitle
(
"客服列表"
);
titleView
.
setTitle
(
"客服列表"
);
titleView
.
setImageResource
(
R
.
id
.
iv_title_right
,
R
.
drawable
.
ic_app_add
);
titleView
.
setChildClickListener
(
R
.
id
.
iv_title_right
,
v
->
{
if
(!
BuildConfig
.
DEBUG
)
return
;
testTime
+=
1
;
if
(
testTime
==
5
)
{
testTime
=
0
;
if
(
ServiceUtils
.
isServiceRunning
(
CustomerListActivity
.
this
))
{
Toast
.
makeText
(
getApplicationContext
(),
"im服务正在运行"
,
Toast
.
LENGTH_SHORT
).
show
();
}
else
{
Toast
.
makeText
(
getApplicationContext
(),
"im服务挂掉"
,
Toast
.
LENGTH_SHORT
).
show
();
}
}
});
refreshLayout
=
findViewById
(
R
.
id
.
refresh
);
refreshLayout
=
findViewById
(
R
.
id
.
refresh
);
recyclerView
=
findViewById
(
R
.
id
.
recyclerView
);
recyclerView
=
findViewById
(
R
.
id
.
recyclerView
);
recyclerView
.
setLayoutManager
(
new
LinearLayoutManager
(
this
,
LinearLayout
.
VERTICAL
,
false
));
recyclerView
.
setLayoutManager
(
new
LinearLayoutManager
(
this
,
LinearLayout
.
VERTICAL
,
false
));
adapter
=
new
CustomerListAdapter
(
customers
);
adapter
=
new
CustomerListAdapter
(
getApplicationContext
(),
customers
);
adapter
.
setOnItemClickListener
((
adapter
,
view
,
position
)
->
{
adapter
.
setOnItemClickListener
((
adapter
,
view
,
position
)
->
{
Customer
customer
=
customers
.
get
(
position
);
Customer
customer
=
customers
.
get
(
position
);
startActivity
(
ChatActivity
.
getIntent
(
getApplicationContext
(),
customer
.
getImUserId
(),
customer
.
getName
())
);
startActivity
ForResult
(
ChatActivity
.
getIntent
(
getApplicationContext
(),
customer
.
getImUserId
(),
customer
.
getName
()),
1
);
});
});
refreshLayout
.
setHeaderView
(
new
SimpleRefreshView
(
this
));
refreshLayout
.
setHeaderView
(
new
SimpleRefreshView
(
this
));
refreshLayout
.
setOnSimpleRefreshListener
(
this
);
refreshLayout
.
setOnSimpleRefreshListener
(
this
);
...
@@ -60,11 +95,24 @@ public class CustomerListActivity extends BaseStatusActivity<CommonPresenter> im
...
@@ -60,11 +95,24 @@ public class CustomerListActivity extends BaseStatusActivity<CommonPresenter> im
*/
*/
private
void
getCustomerList
()
{
private
void
getCustomerList
()
{
List
<
Customer
>
lists
=
getCustomService
().
getCustomerLists
();
List
<
Customer
>
lists
=
getCustomService
().
getCustomerLists
();
if
(
lists
==
null
||
lists
.
size
()
==
0
)
{
if
(
lists
!=
null
&&
lists
.
size
()
>
0
)
{
mPresenter
.
getData
(
0
,
ImUrlConfig
.
HTTP_CUSTOMER_LIST_URL
,
CustomersBean
.
class
,
true
);
for
(
Customer
customer
:
lists
)
{
}
else
{
ChatMessage
message
=
ChatMessageServiceImp
.
getInstance
(
getApplicationContext
()).
getLastMsg
(
customer
.
getImUserId
());
if
(
message
!=
null
)
customer
.
setLastMessageInfo
(
message
);
}
Collections
.
sort
(
lists
,
(
o1
,
o2
)
->
{
if
(
o1
.
getLastMsgTimes
()
>
o2
.
getLastMsgTimes
())
{
return
-
1
;
}
else
if
(
o1
.
getLastMsgTimes
()
==
o2
.
getLastMsgTimes
())
{
return
0
;
}
return
1
;
});
customers
.
clear
();
customers
.
addAll
(
lists
);
customers
.
addAll
(
lists
);
adapter
.
notifyDataSetChanged
();
adapter
.
notifyDataSetChanged
();
}
else
{
mPresenter
.
getData
(
0
,
ImUrlConfig
.
HTTP_CUSTOMER_LIST_URL
,
CustomersBean
.
class
,
true
);
}
}
}
}
...
@@ -102,4 +150,27 @@ public class CustomerListActivity extends BaseStatusActivity<CommonPresenter> im
...
@@ -102,4 +150,27 @@ public class CustomerListActivity extends BaseStatusActivity<CommonPresenter> im
return
iCustomerService
;
return
iCustomerService
;
}
}
@Override
public
void
onMessageSendStateChange
(
int
messageState
,
String
msgId
)
{
}
@Override
public
void
onNewMessage
(
String
fromUserId
,
ChatMessage
message
,
boolean
isGroupMsg
)
{
getCustomerList
();
}
@Override
protected
void
onActivityResult
(
int
requestCode
,
int
resultCode
,
@Nullable
Intent
data
)
{
super
.
onActivityResult
(
requestCode
,
resultCode
,
data
);
if
(
requestCode
==
1
)
{
// 刷新UI
getCustomerList
();
}
}
@Override
public
void
onDestroy
()
{
super
.
onDestroy
();
ListenerManager
.
getInstance
().
removeChatMessageListener
(
this
);
}
}
}
plugin_im/src/main/java/com/rv/im/adapter/ChatContentAdapter.java
View file @
fc9d4725
...
@@ -26,6 +26,7 @@ import com.rv.im.util.DateUtils;
...
@@ -26,6 +26,7 @@ import com.rv.im.util.DateUtils;
import
com.rv.im.util.SmileyParser
;
import
com.rv.im.util.SmileyParser
;
import
com.rv.im.view.RoundImageView
;
import
com.rv.im.view.RoundImageView
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.List
;
public
class
ChatContentAdapter
extends
RecyclerView
.
Adapter
<
RecyclerView
.
ViewHolder
>
{
public
class
ChatContentAdapter
extends
RecyclerView
.
Adapter
<
RecyclerView
.
ViewHolder
>
{
...
@@ -36,8 +37,6 @@ public class ChatContentAdapter extends RecyclerView.Adapter<RecyclerView.ViewHo
...
@@ -36,8 +37,6 @@ public class ChatContentAdapter extends RecyclerView.Adapter<RecyclerView.ViewHo
private
SmileyParser
parser
;
private
SmileyParser
parser
;
private
OnClickItemListener
listener
;
private
OnClickItemListener
listener
;
private
long
lastTimes
=
0L
;
public
interface
OnClickItemListener
{
public
interface
OnClickItemListener
{
void
onClick
(
int
resId
,
ChatMessage
message
);
void
onClick
(
int
resId
,
ChatMessage
message
);
...
@@ -123,13 +122,7 @@ public class ChatContentAdapter extends RecyclerView.Adapter<RecyclerView.ViewHo
...
@@ -123,13 +122,7 @@ public class ChatContentAdapter extends RecyclerView.Adapter<RecyclerView.ViewHo
private
void
setFromVolteCallContentView
(
ChatMessage
bean
,
MsgFromVolteCallHolder
holder
)
{
private
void
setFromVolteCallContentView
(
ChatMessage
bean
,
MsgFromVolteCallHolder
holder
)
{
// if (bean.getTimeSend() - lastTimes > 300000) {
showTime
(
holder
.
tvSendTime
,
bean
);
holder
.
tvSendTime
.
setVisibility
(
View
.
VISIBLE
);
holder
.
tvSendTime
.
setText
(
DateUtils
.
timestampToString1
(
bean
.
getTimeSend
()));
// } else {
//// holder.tvSendTime.setVisibility(View.GONE);
// }
lastTimes
=
bean
.
getTimeSend
();
String
content
=
dealMessageContent
(
bean
.
getTimeLen
(),
bean
.
getContent
());
String
content
=
dealMessageContent
(
bean
.
getTimeLen
(),
bean
.
getContent
());
holder
.
chatText
.
setText
(
content
);
holder
.
chatText
.
setText
(
content
);
holder
.
chatText
.
setOnClickListener
(
v
->
{
holder
.
chatText
.
setOnClickListener
(
v
->
{
...
@@ -142,13 +135,7 @@ public class ChatContentAdapter extends RecyclerView.Adapter<RecyclerView.ViewHo
...
@@ -142,13 +135,7 @@ public class ChatContentAdapter extends RecyclerView.Adapter<RecyclerView.ViewHo
private
void
setFromVideoCallContentView
(
ChatMessage
bean
,
MsgFromVideoCallHolder
holder
)
{
private
void
setFromVideoCallContentView
(
ChatMessage
bean
,
MsgFromVideoCallHolder
holder
)
{
// if (bean.getTimeSend() - lastTimes > 300000) {
showTime
(
holder
.
tvSendTime
,
bean
);
holder
.
tvSendTime
.
setVisibility
(
View
.
VISIBLE
);
holder
.
tvSendTime
.
setText
(
DateUtils
.
timestampToString1
(
bean
.
getTimeSend
()));
// } else {
//// holder.tvSendTime.setVisibility(View.GONE);
// }
lastTimes
=
bean
.
getTimeSend
();
String
content
=
dealMessageContent
(
bean
.
getTimeLen
(),
bean
.
getContent
());
String
content
=
dealMessageContent
(
bean
.
getTimeLen
(),
bean
.
getContent
());
// holder.chatText.setText(bean.getContent());
// holder.chatText.setText(bean.getContent());
holder
.
chatText
.
setText
(
content
);
holder
.
chatText
.
setText
(
content
);
...
@@ -163,13 +150,7 @@ public class ChatContentAdapter extends RecyclerView.Adapter<RecyclerView.ViewHo
...
@@ -163,13 +150,7 @@ public class ChatContentAdapter extends RecyclerView.Adapter<RecyclerView.ViewHo
private
void
setToVolteCallContentView
(
ChatMessage
bean
,
MsgToVolteCallHolder
holder
)
{
private
void
setToVolteCallContentView
(
ChatMessage
bean
,
MsgToVolteCallHolder
holder
)
{
// if (bean.getTimeSend() - lastTimes > 300000) {
showTime
(
holder
.
tvSendTime
,
bean
);
holder
.
tvSendTime
.
setVisibility
(
View
.
VISIBLE
);
holder
.
tvSendTime
.
setText
(
DateUtils
.
timestampToString1
(
bean
.
getTimeSend
()));
// } else {
//// holder.tvSendTime.setVisibility(View.GONE);
// }
lastTimes
=
bean
.
getTimeSend
();
String
content
=
dealMessageContent
(
bean
.
getTimeLen
(),
bean
.
getContent
());
String
content
=
dealMessageContent
(
bean
.
getTimeLen
(),
bean
.
getContent
());
holder
.
chatText
.
setText
(
content
);
holder
.
chatText
.
setText
(
content
);
holder
.
chatText
.
setOnClickListener
(
v
->
{
holder
.
chatText
.
setOnClickListener
(
v
->
{
...
@@ -181,13 +162,7 @@ public class ChatContentAdapter extends RecyclerView.Adapter<RecyclerView.ViewHo
...
@@ -181,13 +162,7 @@ public class ChatContentAdapter extends RecyclerView.Adapter<RecyclerView.ViewHo
private
void
setToVideoCallContentView
(
ChatMessage
bean
,
MsgToVideoCallHolder
holder
)
{
private
void
setToVideoCallContentView
(
ChatMessage
bean
,
MsgToVideoCallHolder
holder
)
{
// if (bean.getTimeSend() - lastTimes > 300000) {
showTime
(
holder
.
tvSendTime
,
bean
);
holder
.
tvSendTime
.
setVisibility
(
View
.
VISIBLE
);
holder
.
tvSendTime
.
setText
(
DateUtils
.
timestampToString1
(
bean
.
getTimeSend
()));
// } else {
//// holder.tvSendTime.setVisibility(View.GONE);
// }
lastTimes
=
bean
.
getTimeSend
();
String
content
=
dealMessageContent
(
bean
.
getTimeLen
(),
bean
.
getContent
());
String
content
=
dealMessageContent
(
bean
.
getTimeLen
(),
bean
.
getContent
());
holder
.
chatText
.
setText
(
content
);
holder
.
chatText
.
setText
(
content
);
holder
.
chatText
.
setOnClickListener
(
v
->
{
holder
.
chatText
.
setOnClickListener
(
v
->
{
...
@@ -197,48 +172,33 @@ public class ChatContentAdapter extends RecyclerView.Adapter<RecyclerView.ViewHo
...
@@ -197,48 +172,33 @@ public class ChatContentAdapter extends RecyclerView.Adapter<RecyclerView.ViewHo
});
});
}
}
private
void
setToTextContentView
(
ChatMessage
bean
,
MsgToTextHolder
viewHolder
)
{
private
void
setToTextContentView
(
ChatMessage
bean
,
MsgToTextHolder
holder
)
{
showTime
(
holder
.
tvSendTime
,
bean
);
// if (bean.getTimeSend() - lastTimes > 300000) {
holder
.
chatText
.
setText
(
parser
.
addSmileySpans
(
deleteHtml
(
bean
.
getContent
()),
true
));
viewHolder
.
tvSendTime
.
setVisibility
(
View
.
VISIBLE
);
viewHolder
.
tvSendTime
.
setText
(
DateUtils
.
timestampToString1
(
bean
.
getTimeSend
()));
// } else {
// viewHolder.tvSendTime.setVisibility(View.GONE);
// }
lastTimes
=
bean
.
getTimeSend
();
viewHolder
.
chatText
.
setText
(
parser
.
addSmileySpans
(
deleteHtml
(
bean
.
getContent
()),
true
));
if
(
bean
.
getMessageStatus
()
==
0
)
{
if
(
bean
.
getMessageStatus
()
==
0
)
{
viewH
older
.
progressBar
.
setVisibility
(
View
.
VISIBLE
);
h
older
.
progressBar
.
setVisibility
(
View
.
VISIBLE
);
viewH
older
.
ivFailed
.
setVisibility
(
View
.
GONE
);
h
older
.
ivFailed
.
setVisibility
(
View
.
GONE
);
viewH
older
.
tvRead
.
setVisibility
(
View
.
GONE
);
h
older
.
tvRead
.
setVisibility
(
View
.
GONE
);
}
else
if
(
bean
.
getMessageStatus
()
==
1
)
{
}
else
if
(
bean
.
getMessageStatus
()
==
1
)
{
viewH
older
.
progressBar
.
setVisibility
(
View
.
GONE
);
h
older
.
progressBar
.
setVisibility
(
View
.
GONE
);
viewH
older
.
ivFailed
.
setVisibility
(
View
.
GONE
);
h
older
.
ivFailed
.
setVisibility
(
View
.
GONE
);
viewH
older
.
tvRead
.
setVisibility
(
View
.
VISIBLE
);
h
older
.
tvRead
.
setVisibility
(
View
.
VISIBLE
);
}
else
if
(
bean
.
getMessageStatus
()
==
2
)
{
}
else
if
(
bean
.
getMessageStatus
()
==
2
)
{
viewH
older
.
progressBar
.
setVisibility
(
View
.
GONE
);
h
older
.
progressBar
.
setVisibility
(
View
.
GONE
);
viewH
older
.
ivFailed
.
setVisibility
(
View
.
VISIBLE
);
h
older
.
ivFailed
.
setVisibility
(
View
.
VISIBLE
);
viewH
older
.
tvRead
.
setVisibility
(
View
.
GONE
);
h
older
.
tvRead
.
setVisibility
(
View
.
GONE
);
}
}
viewH
older
.
ivFailed
.
setOnClickListener
(
v
->
listener
.
reSend
(
bean
));
h
older
.
ivFailed
.
setOnClickListener
(
v
->
listener
.
reSend
(
bean
));
}
}
private
void
setFromTextContentView
(
ChatMessage
bean
,
MsgFromTextHolder
holder
)
{
private
void
setFromTextContentView
(
ChatMessage
bean
,
MsgFromTextHolder
holder
)
{
// if (bean.getTimeSend() - lastTimes > 300000) {
holder
.
tvSendTime
.
setVisibility
(
View
.
VISIBLE
);
showTime
(
holder
.
tvSendTime
,
bean
);
holder
.
tvSendTime
.
setText
(
DateUtils
.
timestampToString1
(
bean
.
getTimeSend
()));
// } else {
//// holder.tvSendTime.setVisibility(View.GONE);
// }
lastTimes
=
bean
.
getTimeSend
();
holder
.
chatText
.
setText
(
parser
.
addSmileySpans
(
deleteHtml
(
bean
.
getContent
()),
true
));
holder
.
chatText
.
setText
(
parser
.
addSmileySpans
(
deleteHtml
(
bean
.
getContent
()),
true
));
}
}
private
void
setFromCardContentView
(
ChatMessage
bean
,
MsgFromCardHolder
holder
)
{
private
void
setFromCardContentView
(
ChatMessage
bean
,
MsgFromCardHolder
holder
)
{
// if (bean.getTimeSend() - lastTimes > 300000) {
showTime
(
holder
.
tvSendTime
,
bean
);
holder
.
tvSendTime
.
setText
(
DateUtils
.
timestampToString1
(
bean
.
getTimeSend
()));
// }
lastTimes
=
bean
.
getTimeSend
();
if
(!
TextUtils
.
isEmpty
(
bean
.
getContent
())
&&
bean
.
getContent
().
endsWith
(
"png"
)
if
(!
TextUtils
.
isEmpty
(
bean
.
getContent
())
&&
bean
.
getContent
().
endsWith
(
"png"
)
||
bean
.
getContent
().
endsWith
(
"jpg"
)
||
bean
.
getContent
().
endsWith
(
"gif"
))
{
||
bean
.
getContent
().
endsWith
(
"jpg"
)
||
bean
.
getContent
().
endsWith
(
"gif"
))
{
GlideOptions
options
=
GlideOptions
.
placeholderOf
(
R
.
mipmap
.
default_error
).
GlideOptions
options
=
GlideOptions
.
placeholderOf
(
R
.
mipmap
.
default_error
).
...
@@ -267,13 +227,7 @@ public class ChatContentAdapter extends RecyclerView.Adapter<RecyclerView.ViewHo
...
@@ -267,13 +227,7 @@ public class ChatContentAdapter extends RecyclerView.Adapter<RecyclerView.ViewHo
private
void
setToCardContentView
(
ChatMessage
bean
,
MsgToCardHolder
holder
)
{
private
void
setToCardContentView
(
ChatMessage
bean
,
MsgToCardHolder
holder
)
{
// if (bean.getTimeSend() - lastTimes > 300000) {
showTime
(
holder
.
tvSendTime
,
bean
);
holder
.
tvSendTime
.
setVisibility
(
View
.
VISIBLE
);
holder
.
tvSendTime
.
setText
(
DateUtils
.
timestampToString1
(
bean
.
getTimeSend
()));
// } else {
//// holder.tvSendTime.setVisibility(View.GONE);
// }
lastTimes
=
bean
.
getTimeSend
();
if
(
bean
.
getFilePath
().
endsWith
(
"png"
)
||
bean
.
getFilePath
().
endsWith
(
"jpg"
)
||
bean
.
getFilePath
().
endsWith
(
"gif"
))
{
if
(
bean
.
getFilePath
().
endsWith
(
"png"
)
||
bean
.
getFilePath
().
endsWith
(
"jpg"
)
||
bean
.
getFilePath
().
endsWith
(
"gif"
))
{
GlideOptions
options
=
GlideOptions
.
placeholderOf
(
R
.
mipmap
.
default_error
).
GlideOptions
options
=
GlideOptions
.
placeholderOf
(
R
.
mipmap
.
default_error
).
error
(
R
.
mipmap
.
default_error
).
skipMemoryCache
(
false
);
error
(
R
.
mipmap
.
default_error
).
skipMemoryCache
(
false
);
...
@@ -321,14 +275,7 @@ public class ChatContentAdapter extends RecyclerView.Adapter<RecyclerView.ViewHo
...
@@ -321,14 +275,7 @@ public class ChatContentAdapter extends RecyclerView.Adapter<RecyclerView.ViewHo
}
}
private
void
setToPicContentView
(
ChatMessage
bean
,
MsgToPicHolder
holder
)
{
private
void
setToPicContentView
(
ChatMessage
bean
,
MsgToPicHolder
holder
)
{
showTime
(
holder
.
tvSendTime
,
bean
);
// if (bean.getTimeSend() - lastTimes > 300000) {
holder
.
tvSendTime
.
setVisibility
(
View
.
VISIBLE
);
holder
.
tvSendTime
.
setText
(
DateUtils
.
timestampToString1
(
bean
.
getTimeSend
()));
// } else {
//// holder.tvSendTime.setVisibility(View.GONE);
// }
lastTimes
=
bean
.
getTimeSend
();
if
(!
TextUtils
.
isEmpty
(
bean
.
getFilePath
()))
{
if
(!
TextUtils
.
isEmpty
(
bean
.
getFilePath
()))
{
GlideOptions
options
=
GlideOptions
.
placeholderOf
(
R
.
mipmap
.
default_error
).
GlideOptions
options
=
GlideOptions
.
placeholderOf
(
R
.
mipmap
.
default_error
).
error
(
R
.
mipmap
.
default_error
).
skipMemoryCache
(
false
);
error
(
R
.
mipmap
.
default_error
).
skipMemoryCache
(
false
);
...
@@ -370,14 +317,7 @@ public class ChatContentAdapter extends RecyclerView.Adapter<RecyclerView.ViewHo
...
@@ -370,14 +317,7 @@ public class ChatContentAdapter extends RecyclerView.Adapter<RecyclerView.ViewHo
private
void
setFromPicContentView
(
ChatMessage
bean
,
MsgFromPicHolder
holder
)
{
private
void
setFromPicContentView
(
ChatMessage
bean
,
MsgFromPicHolder
holder
)
{
// if (bean.getTimeSend() - lastTimes > 300000) {
showTime
(
holder
.
tvSendTime
,
bean
);
holder
.
tvSendTime
.
setVisibility
(
View
.
VISIBLE
);
holder
.
tvSendTime
.
setText
(
DateUtils
.
timestampToString1
(
bean
.
getTimeSend
()));
// } else {
//// holder.tvSendTime.setVisibility(View.GONE);
// }
lastTimes
=
bean
.
getTimeSend
();
if
(!
TextUtils
.
isEmpty
(
bean
.
getContent
()))
{
if
(!
TextUtils
.
isEmpty
(
bean
.
getContent
()))
{
GlideOptions
options
=
GlideOptions
.
placeholderOf
(
R
.
mipmap
.
default_error
).
GlideOptions
options
=
GlideOptions
.
placeholderOf
(
R
.
mipmap
.
default_error
).
error
(
R
.
mipmap
.
default_error
).
skipMemoryCache
(
false
);
error
(
R
.
mipmap
.
default_error
).
skipMemoryCache
(
false
);
...
@@ -392,18 +332,7 @@ public class ChatContentAdapter extends RecyclerView.Adapter<RecyclerView.ViewHo
...
@@ -392,18 +332,7 @@ public class ChatContentAdapter extends RecyclerView.Adapter<RecyclerView.ViewHo
}
}
private
void
setFromVoiceContentView
(
ChatMessage
bean
,
MsgFromVoiceHolder
holder
)
{
private
void
setFromVoiceContentView
(
ChatMessage
bean
,
MsgFromVoiceHolder
holder
)
{
// if (bean.getTimeSend() - lastTimes > 300000) {
showTime
(
holder
.
tvSendTime
,
bean
);
holder
.
tvSendTime
.
setVisibility
(
View
.
VISIBLE
);
holder
.
tvSendTime
.
setText
(
DateUtils
.
timestampToString1
(
bean
.
getTimeSend
()));
// } else {
//// holder.tvSendTime.setVisibility(View.GONE);
// }
lastTimes
=
bean
.
getTimeSend
();
if
(
bean
.
getVoiceStatus
()
==
0
)
{
holder
.
imgState
.
setVisibility
(
View
.
VISIBLE
);
}
else
{
holder
.
imgState
.
setVisibility
(
View
.
GONE
);
}
holder
.
chatVoiceAnimView
.
setOnClickListener
(
v
->
{
holder
.
chatVoiceAnimView
.
setOnClickListener
(
v
->
{
VoicePlayer
.
instance
().
playVoice
(
holder
.
chatVoiceAnimView
);
VoicePlayer
.
instance
().
playVoice
(
holder
.
chatVoiceAnimView
);
ChatMessageServiceImp
.
getInstance
(
mContext
).
setVoicePlay
(
bean
.
getPackId
());
ChatMessageServiceImp
.
getInstance
(
mContext
).
setVoicePlay
(
bean
.
getPackId
());
...
@@ -416,13 +345,7 @@ public class ChatContentAdapter extends RecyclerView.Adapter<RecyclerView.ViewHo
...
@@ -416,13 +345,7 @@ public class ChatContentAdapter extends RecyclerView.Adapter<RecyclerView.ViewHo
}
}
private
void
setToVoiceContentView
(
ChatMessage
bean
,
MsgToVoiceHolder
holder
)
{
private
void
setToVoiceContentView
(
ChatMessage
bean
,
MsgToVoiceHolder
holder
)
{
// if (bean.getTimeSend() - lastTimes > 300000) {
showTime
(
holder
.
tvSendTime
,
bean
);
holder
.
tvSendTime
.
setVisibility
(
View
.
VISIBLE
);
holder
.
tvSendTime
.
setText
(
DateUtils
.
timestampToString1
(
bean
.
getTimeSend
()));
// } else {
//// holder.tvSendTime.setVisibility(View.GONE);
// }
lastTimes
=
bean
.
getTimeSend
();
holder
.
chatVoiceAnimView
.
setOnClickListener
(
v
->
holder
.
chatVoiceAnimView
.
setOnClickListener
(
v
->
VoicePlayer
.
instance
().
playVoice
(
holder
.
chatVoiceAnimView
));
VoicePlayer
.
instance
().
playVoice
(
holder
.
chatVoiceAnimView
));
if
(!
TextUtils
.
isEmpty
(
bean
.
getFilePath
()))
{
if
(!
TextUtils
.
isEmpty
(
bean
.
getFilePath
()))
{
...
@@ -790,4 +713,46 @@ public class ChatContentAdapter extends RecyclerView.Adapter<RecyclerView.ViewHo
...
@@ -790,4 +713,46 @@ public class ChatContentAdapter extends RecyclerView.Adapter<RecyclerView.ViewHo
}
}
return
content
;
return
content
;
}
}
private
void
showTime
(
TextView
timeView
,
ChatMessage
message
)
{
if
(
messageList
.
indexOf
(
message
)
==
0
)
{
timeView
.
setVisibility
(
View
.
VISIBLE
);
showTimeForm
(
timeView
,
message
.
getTimeSend
());
// timeView.setText(DateUtils.timestampToString1(message.getTimeSend()));
}
else
{
int
position
=
messageList
.
indexOf
(
message
);
ChatMessage
prev
=
messageList
.
get
(
position
-
1
);
if
(
prev
!=
null
&&
message
.
getTimeSend
()
-
prev
.
getTimeSend
()
>
300000
)
{
timeView
.
setVisibility
(
View
.
VISIBLE
);
// timeView.setText(DateUtils.timestampToString1(message.getTimeSend()));
showTimeForm
(
timeView
,
message
.
getTimeSend
());
}
else
{
timeView
.
setVisibility
(
View
.
GONE
);
}
}
}
/********
* 日期显示的格式
* @param view
* @param time
*/
private
void
showTimeForm
(
TextView
view
,
long
time
)
{
// 判断是否是今天 是今天就显示上午/下午 + 时间
// 判断是否是昨天的 ,是就显示昨天 + 时间
// 判断是否这一周,如果是,就显示周几+时间
// 判断是否这一年,如果是今年,就显示月-日 时:分
// 显示年-月-日 时:分
Date
date
=
new
Date
(
time
);
if
(
DateUtils
.
isToday
(
date
))
{
// 是否今天
view
.
setText
(
DateUtils
.
getTodayTime
(
date
));
}
else
if
(
DateUtils
.
isYesterday
(
time
))
{
view
.
setText
(
DateUtils
.
getYesterdayTime
(
date
));
}
else
if
(
DateUtils
.
isThisYear
(
date
))
{
view
.
setText
(
DateUtils
.
timestampToString6
(
time
));
}
else
{
view
.
setText
(
DateUtils
.
timestampToString1
(
time
));
}
}
}
}
plugin_im/src/main/java/com/rv/im/adapter/CustomerListAdapter.java
View file @
fc9d4725
package
com
.
rv
.
im
.
adapter
;
package
com
.
rv
.
im
.
adapter
;
import
android.content.Context
;
import
android.support.annotation.Nullable
;
import
android.support.annotation.Nullable
;
import
android.text.TextUtils
;
import
com.chad.library.adapter.base.BaseQuickAdapter
;
import
com.chad.library.adapter.base.BaseQuickAdapter
;
import
com.chad.library.adapter.base.BaseViewHolder
;
import
com.chad.library.adapter.base.BaseViewHolder
;
import
com.rv.im.R
;
import
com.rv.im.R
;
import
com.rv.im.db.table.Customer
;
import
com.rv.im.db.table.Customer
;
import
com.rv.im.util.SmileyParser
;
import
java.util.List
;
import
java.util.List
;
public
class
CustomerListAdapter
extends
BaseQuickAdapter
<
Customer
,
BaseViewHolder
>
{
public
class
CustomerListAdapter
extends
BaseQuickAdapter
<
Customer
,
BaseViewHolder
>
{
public
CustomerListAdapter
(
@Nullable
List
<
Customer
>
data
)
{
private
SmileyParser
parser
;
public
CustomerListAdapter
(
Context
context
,
@Nullable
List
<
Customer
>
data
)
{
super
(
R
.
layout
.
item_customer
,
data
);
super
(
R
.
layout
.
item_customer
,
data
);
this
.
parser
=
SmileyParser
.
getInstance
(
context
);
}
}
@Override
@Override
protected
void
convert
(
BaseViewHolder
helper
,
Customer
item
)
{
protected
void
convert
(
BaseViewHolder
helper
,
Customer
item
)
{
helper
.
setText
(
R
.
id
.
tv_name
,
item
.
getName
());
if
(!
TextUtils
.
isEmpty
(
item
.
getName
()))
helper
.
setText
(
R
.
id
.
tv_name
,
item
.
getName
());
helper
.
setText
(
R
.
id
.
tv_state
,
"在线"
);
helper
.
setText
(
R
.
id
.
tv_state
,
"在线"
);
helper
.
setText
(
R
.
id
.
tv_last_msg
,
item
.
getLastMsg
());
if
(!
TextUtils
.
isEmpty
(
item
.
getLastMsg
()))
// helper.setText(R.id.tv_last_msg, item.getLastMsg());
helper
.
setText
(
R
.
id
.
tv_last_msg
,
parser
.
addSmileySpans
(
deleteHtml
(
item
.
getLastMsg
()),
true
));
}
private
static
String
deleteHtml
(
String
msg
)
{
if
(
msg
==
null
)
{
return
""
;
}
msg
=
msg
.
replaceAll
(
"\n"
,
"\r\n"
);
return
msg
;
}
}
}
}
plugin_im/src/main/java/com/rv/im/db/service/ChatMessageServiceImp.java
View file @
fc9d4725
...
@@ -71,10 +71,8 @@ public class ChatMessageServiceImp implements IChatMessageService {
...
@@ -71,10 +71,8 @@ public class ChatMessageServiceImp implements IChatMessageService {
}
}
@Override
@Override
public
ChatMessage
getLastMsg
(
ChatConversation
conversation
)
{
public
ChatMessage
getLastMsg
(
String
userId
)
{
if
(
conversation
!=
null
)
return
dao
.
getLastMsgByUserId
(
userId
);
return
dao
.
getLastMsgByUserId
(
conversation
.
getUserId
());
return
null
;
}
}
@Override
@Override
...
...
plugin_im/src/main/java/com/rv/im/db/service/IChatMessageService.java
View file @
fc9d4725
...
@@ -21,7 +21,7 @@ public interface IChatMessageService {
...
@@ -21,7 +21,7 @@ public interface IChatMessageService {
void
setUpSuccess
(
String
packId
,
String
url
);
void
setUpSuccess
(
String
packId
,
String
url
);
ChatMessage
getLastMsg
(
ChatConversation
conversation
)
;
ChatMessage
getLastMsg
(
String
userId
)
;
int
getUnReadMsg
(
String
targetUserId
);
int
getUnReadMsg
(
String
targetUserId
);
...
...
plugin_im/src/main/java/com/rv/im/db/table/Customer.java
View file @
fc9d4725
...
@@ -2,6 +2,7 @@ package com.rv.im.db.table;
...
@@ -2,6 +2,7 @@ package com.rv.im.db.table;
import
com.j256.ormlite.field.DatabaseField
;
import
com.j256.ormlite.field.DatabaseField
;
import
com.j256.ormlite.table.DatabaseTable
;
import
com.j256.ormlite.table.DatabaseTable
;
import
com.rv.im.enums.MessageTypeEnum
;
@DatabaseTable
(
tableName
=
"tb_customer"
)
@DatabaseTable
(
tableName
=
"tb_customer"
)
public
class
Customer
{
public
class
Customer
{
...
@@ -85,4 +86,22 @@ public class Customer {
...
@@ -85,4 +86,22 @@ public class Customer {
public
void
setLastMsgTimes
(
long
lastMsgTimes
)
{
public
void
setLastMsgTimes
(
long
lastMsgTimes
)
{
this
.
lastMsgTimes
=
lastMsgTimes
;
this
.
lastMsgTimes
=
lastMsgTimes
;
}
}
public
void
setLastMessageInfo
(
ChatMessage
lastMessageInfo
)
{
if
(
lastMessageInfo
.
getMessageType
()
==
MessageTypeEnum
.
TEXT
.
getType
())
{
setLastMsg
(
lastMessageInfo
.
getContent
());
}
else
if
(
lastMessageInfo
.
getMessageType
()
==
MessageTypeEnum
.
PIC
.
getType
())
{
setLastMsg
(
"[图片]"
);
}
else
if
(
lastMessageInfo
.
getMessageType
()
==
MessageTypeEnum
.
FILE
.
getType
())
{
setLastMsg
(
"[文件]"
);
}
else
if
(
lastMessageInfo
.
getMessageType
()
==
MessageTypeEnum
.
VOICE
.
getType
())
{
setLastMsg
(
"[语音]"
);
}
else
if
(
lastMessageInfo
.
getMessageType
()
==
MessageTypeEnum
.
VOLTE_CALL
.
getType
())
{
setLastMsg
(
"[语音通话]"
);
}
else
if
(
lastMessageInfo
.
getMessageType
()
==
MessageTypeEnum
.
VIDEO_CALL
.
getType
())
{
setLastMsg
(
"[视频]"
);
}
setLastMsgTimes
(
lastMessageInfo
.
getTimeSend
());
}
}
}
plugin_im/src/main/java/com/rv/im/mvp/presenter/ChatPresenterImp.java
View file @
fc9d4725
...
@@ -116,7 +116,7 @@ public class ChatPresenterImp implements IChatPresenter {
...
@@ -116,7 +116,7 @@ public class ChatPresenterImp implements IChatPresenter {
Uri
uri
=
null
;
Uri
uri
=
null
;
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
N
)
{
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
N
)
{
//第二个参数为 包名.fileprovider
//第二个参数为 包名.fileprovider
uri
=
FileProvider
.
getUriForFile
(
weakReference
.
get
(),
weakReference
.
get
().
getPackageName
()
+
".fileprovider"
,
cameraSavePath
);
uri
=
FileProvider
.
getUriForFile
(
weakReference
.
get
(),
weakReference
.
get
().
getPackageName
()
+
".fileprovider"
,
cameraSavePath
);
intent
.
addFlags
(
Intent
.
FLAG_GRANT_READ_URI_PERMISSION
);
intent
.
addFlags
(
Intent
.
FLAG_GRANT_READ_URI_PERMISSION
);
}
else
{
}
else
{
uri
=
Uri
.
fromFile
(
cameraSavePath
);
uri
=
Uri
.
fromFile
(
cameraSavePath
);
...
...
plugin_im/src/main/java/com/rv/im/util/DateUtils.java
View file @
fc9d4725
...
@@ -168,6 +168,11 @@ public class DateUtils {
...
@@ -168,6 +168,11 @@ public class DateUtils {
return
sdf
.
format
(
new
Date
(
time
));
return
sdf
.
format
(
new
Date
(
time
));
}
}
public
static
String
timestampToString6
(
long
time
)
{
return
sdf6
.
format
(
new
Date
(
time
));
}
/**
/**
* 将时间戳转换成yyyy-MM-dd HH:mm字符串
* 将时间戳转换成yyyy-MM-dd HH:mm字符串
*
*
...
@@ -228,9 +233,9 @@ public class DateUtils {
...
@@ -228,9 +233,9 @@ public class DateUtils {
* @return 失败返回-1 ,所以尽量是datetime1大于datetime2
* @return 失败返回-1 ,所以尽量是datetime1大于datetime2
*/
*/
public
static
long
compareDateSecond2
(
String
datetime1
,
String
datetime2
)
{
public
static
long
compareDateSecond2
(
String
datetime1
,
String
datetime2
)
{
String
date1
=
formatDate7
(
datetime1
);
String
date1
=
formatDate7
(
datetime1
);
String
date2
=
formatDate7
(
datetime2
);
String
date2
=
formatDate7
(
datetime2
);
return
compareDateSecond
(
date1
,
date2
);
return
compareDateSecond
(
date1
,
date2
);
}
}
/**
/**
...
@@ -417,8 +422,9 @@ public class DateUtils {
...
@@ -417,8 +422,9 @@ public class DateUtils {
/**
/**
* yyyy-MM 转化成 yyyy年MM月
* yyyy-MM 转化成 yyyy年MM月
*
* @param dateStr yyyy-MM
* @param dateStr yyyy-MM
* @return
yyyy年MM月
* @return yyyy年MM月
*/
*/
public
static
String
formatDate8To9
(
String
dateStr
)
{
public
static
String
formatDate8To9
(
String
dateStr
)
{
String
day
=
""
;
String
day
=
""
;
...
@@ -562,7 +568,7 @@ public class DateUtils {
...
@@ -562,7 +568,7 @@ public class DateUtils {
String
day
=
""
;
String
day
=
""
;
try
{
try
{
long
time
=
sdf12
.
parse
(
dateStr
).
getTime
();
long
time
=
sdf12
.
parse
(
dateStr
).
getTime
();
time
+=
30
*
60
*
1000
;
time
+=
30
*
60
*
1000
;
Date
da
=
new
Date
(
time
);
Date
da
=
new
Date
(
time
);
day
=
sdf12
.
format
(
da
);
day
=
sdf12
.
format
(
da
);
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
...
@@ -576,9 +582,9 @@ public class DateUtils {
...
@@ -576,9 +582,9 @@ public class DateUtils {
* 把时分转成毫秒
* 把时分转成毫秒
*/
*/
public
static
long
formatDate20
(
String
dateStr
)
{
public
static
long
formatDate20
(
String
dateStr
)
{
long
time
=
0
;
long
time
=
0
;
try
{
try
{
time
=
sdf12
.
parse
(
dateStr
).
getTime
();
time
=
sdf12
.
parse
(
dateStr
).
getTime
();
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
e
.
printStackTrace
();
}
}
...
@@ -758,7 +764,6 @@ public class DateUtils {
...
@@ -758,7 +764,6 @@ public class DateUtils {
}
}
/**
/**
* 获取网络时间
* 获取网络时间
*
*
...
@@ -786,18 +791,123 @@ public class DateUtils {
...
@@ -786,18 +791,123 @@ public class DateUtils {
/**
/**
* 获取手机当前时间yyMMddHHmmss
* 获取手机当前时间yyMMddHHmmss
*
* @return
* @return
*/
*/
public
static
String
getPhoneCurTime
(){
public
static
String
getPhoneCurTime
()
{
String
timeStr
=
""
;
String
timeStr
=
""
;
try
{
try
{
Date
date
=
new
Date
(
System
.
currentTimeMillis
());
Date
date
=
new
Date
(
System
.
currentTimeMillis
());
timeStr
=
sdf3
.
format
(
date
);
timeStr
=
sdf3
.
format
(
date
);
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
e
.
printStackTrace
();
}
}
return
timeStr
;
return
timeStr
;
}
}
/**
* @param inputJudgeDate 要判断是否在当天24h内的时间
* @return boolean
* @Description 是否为当天24h内
* @author 刘鹏博
*/
public
static
boolean
isToday
(
Date
inputJudgeDate
)
{
boolean
flag
=
false
;
//获取当前系统时间
long
longDate
=
System
.
currentTimeMillis
();
Date
nowDate
=
new
Date
(
longDate
);
SimpleDateFormat
dateFormat
=
new
SimpleDateFormat
(
"yyyy-MM-dd HH:mm:ss"
);
String
format
=
dateFormat
.
format
(
nowDate
);
String
subDate
=
format
.
substring
(
0
,
10
);
//定义每天的24h时间范围
String
beginTime
=
subDate
+
" 00:00:00"
;
String
endTime
=
subDate
+
" 23:59:59"
;
Date
paseBeginTime
=
null
;
Date
paseEndTime
=
null
;
try
{
paseBeginTime
=
dateFormat
.
parse
(
beginTime
);
paseEndTime
=
dateFormat
.
parse
(
endTime
);
}
catch
(
ParseException
e
)
{
}
if
(
inputJudgeDate
.
after
(
paseBeginTime
)
&&
inputJudgeDate
.
before
(
paseEndTime
))
{
flag
=
true
;
}
return
flag
;
}
/********
* 是否昨天
* @param timestamp
* @return
*/
public
static
boolean
isYesterday
(
long
timestamp
)
{
Calendar
c
=
Calendar
.
getInstance
();
clearCalendar
(
c
,
Calendar
.
HOUR_OF_DAY
,
Calendar
.
MINUTE
,
Calendar
.
SECOND
,
Calendar
.
MILLISECOND
);
c
.
add
(
Calendar
.
DAY_OF_MONTH
,
-
1
);
long
firstOfDay
=
c
.
getTimeInMillis
();
// 昨天最早时间
c
.
setTimeInMillis
(
timestamp
);
clearCalendar
(
c
,
Calendar
.
HOUR_OF_DAY
,
Calendar
.
MINUTE
,
Calendar
.
SECOND
,
Calendar
.
MILLISECOND
);
// 指定时间戳当天最早时间
return
firstOfDay
==
c
.
getTimeInMillis
();
}
private
static
void
clearCalendar
(
Calendar
c
,
int
...
fields
)
{
for
(
int
f
:
fields
)
{
c
.
set
(
f
,
0
);
}
}
/********
* 是否昨天
* @param date
* @return
*/
public
static
boolean
isThisWeek
(
Date
date
)
{
return
false
;
}
/********
* 是否昨天
* @param date
* @return
*/
public
static
boolean
isThisYear
(
Date
date
)
{
Calendar
c
=
Calendar
.
getInstance
();
c
.
setTime
(
date
);
Calendar
c1
=
Calendar
.
getInstance
();
c1
.
setTime
(
new
Date
(
System
.
currentTimeMillis
()));
return
c
.
get
(
Calendar
.
YEAR
)
==
c1
.
get
(
Calendar
.
YEAR
);
}
public
static
String
getTodayTime
(
Date
date
)
{
Calendar
c
=
Calendar
.
getInstance
();
c
.
setTime
(
date
);
int
hour
=
c
.
get
(
Calendar
.
HOUR_OF_DAY
);
int
minute
=
c
.
get
(
Calendar
.
MINUTE
);
StringBuilder
builder
=
new
StringBuilder
();
builder
.
append
(
hour
>=
12
?
"下午"
:
"上午"
);
builder
.
append
(
hour
>=
12
?
(
hour
-
12
)
:
hour
);
builder
.
append
(
":"
);
builder
.
append
((
minute
>
10
?
minute
:
"0"
+
minute
));
return
builder
.
toString
();
}
public
static
String
getYesterdayTime
(
Date
date
)
{
Calendar
c
=
Calendar
.
getInstance
();
c
.
setTime
(
date
);
int
hour
=
c
.
get
(
Calendar
.
HOUR_OF_DAY
);
int
minute
=
c
.
get
(
Calendar
.
MINUTE
);
StringBuilder
builder
=
new
StringBuilder
();
builder
.
append
(
"昨天"
);
builder
.
append
(
hour
);
builder
.
append
(
":"
);
builder
.
append
((
minute
>
10
?
minute
:
"0"
+
minute
));
return
builder
.
toString
();
}
}
}
plugin_im/src/main/res/drawable-xhdpi/emoje.png
0 → 100644
View file @
fc9d4725
4.04 KB
plugin_im/src/main/res/drawable-xhdpi/icon_keyword.png
0 → 100644
View file @
fc9d4725
2.77 KB
plugin_im/src/main/res/drawable-xhdpi/icon_photo.png
0 → 100644
View file @
fc9d4725
2.04 KB
plugin_im/src/main/res/drawable-xhdpi/icon_voice.png
0 → 100644
View file @
fc9d4725
2.95 KB
plugin_im/src/main/res/drawable/im_voice_button_normal2.xml
View file @
fc9d4725
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<shape
xmlns:android=
"http://schemas.android.com/apk/res/android"
>
<shape
xmlns:android=
"http://schemas.android.com/apk/res/android"
<corners
android:radius=
"3dp"
/>
android:shape=
"rectangle"
>
<corners
android:radius=
"@dimen/dp20"
/>
<solid
android:color=
"@color/white"
/>
<solid
android:color=
"#fff2f2f2"
/>
<stroke
android:width=
"0.1dp"
android:color=
"@color/Grey_500"
/>
</shape>
</shape>
\ No newline at end of file
plugin_im/src/main/res/drawable/im_voice_button_pressed2.xml
View file @
fc9d4725
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<shape
xmlns:android=
"http://schemas.android.com/apk/res/android"
>
<shape
xmlns:android=
"http://schemas.android.com/apk/res/android"
>
<corners
android:radius=
"3dp"
/>
<
solid
android:color=
"@color/Grey_20
0"
/>
<
corners
android:radius=
"@dimen/size_3
0"
/>
<stroke
<solid
android:color=
"#fff2eeee"
/>
android:width=
"0.1dp"
android:color=
"@color/Grey_500"
/>
</shape>
</shape>
\ No newline at end of file
plugin_im/src/main/res/layout/activity_chat.xml
View file @
fc9d4725
...
@@ -20,18 +20,15 @@
...
@@ -20,18 +20,15 @@
<RelativeLayout
<RelativeLayout
android:layout_width=
"fill_parent"
android:layout_width=
"fill_parent"
android:layout_height=
"wrap_content"
android:layout_height=
"@dimen/size_60"
android:layout_alignParentBottom=
"true"
android:background=
"#ffffff"
>
android:layout_gravity=
"center_vertical"
android:background=
"#F3F3F3"
android:padding=
"3dp"
>
<FrameLayout
<FrameLayout
android:id=
"@+id/right_layout"
android:id=
"@+id/right_layout"
android:layout_width=
"40dp"
android:layout_width=
"40dp"
android:layout_height=
"30dp"
android:layout_height=
"30dp"
android:layout_centerVertical=
"true"
android:layout_centerVertical=
"true"
android:layout_marginLeft=
"
5
dp"
android:layout_marginLeft=
"
10
dp"
android:gravity=
"center_vertical"
android:gravity=
"center_vertical"
android:orientation=
"horizontal"
>
android:orientation=
"horizontal"
>
...
@@ -39,15 +36,15 @@
...
@@ -39,15 +36,15 @@
android:id=
"@+id/voice_img_btn"
android:id=
"@+id/voice_img_btn"
android:layout_width=
"30dp"
android:layout_width=
"30dp"
android:layout_height=
"30dp"
android:layout_height=
"30dp"
android:background=
"@drawable/i
m
_voice"
android:background=
"@drawable/i
con
_voice"
android:contentDescription=
"@string/app_name"
android:contentDescription=
"@string/app_name"
android:padding=
"3dp"
/>
android:padding=
"3dp"
/>
<ImageButton
<ImageButton
android:id=
"@+id/
btnCancelReplay
"
android:id=
"@+id/
ib_keyword
"
android:layout_width=
"30dp"
android:layout_width=
"30dp"
android:layout_height=
"30dp"
android:layout_height=
"30dp"
android:background=
"@drawable/ic
_chat_menu
"
android:background=
"@drawable/ic
on_keyword
"
android:contentDescription=
"@string/app_name"
android:contentDescription=
"@string/app_name"
android:padding=
"3dp"
android:padding=
"3dp"
android:visibility=
"gone"
/>
android:visibility=
"gone"
/>
...
@@ -67,24 +64,27 @@
...
@@ -67,24 +64,27 @@
<EditText
<EditText
android:id=
"@+id/chat_edit"
android:id=
"@+id/chat_edit"
android:layout_width=
"match_parent"
android:layout_width=
"match_parent"
android:layout_height=
"
35dp
"
android:layout_height=
"
@dimen/size_40
"
android:layout_gravity=
"center_vertical"
android:layout_gravity=
"center_vertical"
android:background=
"@drawable/im_
input_button
"
android:background=
"@drawable/im_
voice_button_normal2
"
android:inputType=
"textMultiLine"
android:inputType=
"textMultiLine"
android:maxLines=
"3"
android:maxLines=
"3"
android:padding=
"6dp"
android:paddingLeft=
"@dimen/dp_10"
android:paddingRight=
"@dimen/dp_10"
android:paddingTop=
"6dp"
android:paddingBottom=
"6dp"
android:textSize=
"@dimen/one_level_title"
/>
android:textSize=
"@dimen/one_level_title"
/>
<
Button
<
TextView
android:id=
"@+id/record_btn"
android:id=
"@+id/record_btn"
android:layout_width=
"match_parent"
android:layout_width=
"match_parent"
android:layout_height=
"
35dp
"
android:layout_height=
"
@dimen/size_40
"
android:layout_gravity=
"center_vertical"
android:layout_gravity=
"center_vertical"
android:background=
"@drawable/im_voice_button_normal2"
android:background=
"@drawable/im_voice_button_normal2"
android:gravity=
"center"
android:gravity=
"center"
android:text=
"@string/motalk_voice_chat_tip_1"
android:text=
"@string/motalk_voice_chat_tip_1"
android:textColor=
"@color/
black_trans_99
"
android:textColor=
"@color/
light_grey
"
android:textSize=
"@dimen/sp_1
6_text_size
"
android:textSize=
"@dimen/sp_1
4
"
android:visibility=
"gone"
/>
android:visibility=
"gone"
/>
</FrameLayout>
</FrameLayout>
...
@@ -100,29 +100,30 @@
...
@@ -100,29 +100,30 @@
<ImageButton
<ImageButton
android:id=
"@+id/emotion_btn"
android:id=
"@+id/emotion_btn"
android:layout_width=
"
30dp
"
android:layout_width=
"
@dimen/size_30
"
android:layout_height=
"
30dp
"
android:layout_height=
"
@dimen/size_30
"
android:layout_marginLeft=
"5dp"
android:layout_marginLeft=
"5dp"
android:layout_marginRight=
"5dp"
android:layout_marginRight=
"5dp"
android:background=
"@drawable/
im_btn_emotion_bg
"
android:background=
"@drawable/
emoje
"
android:contentDescription=
"@string/app_name"
/>
android:contentDescription=
"@string/app_name"
/>
<FrameLayout
<FrameLayout
android:layout_width=
"wrap_content"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
>
android:layout_height=
"wrap_content"
android:layout_marginRight=
"@dimen/dp_10"
>
<ImageButton
<ImageButton
android:id=
"@+id/more_btn"
android:id=
"@+id/ib_photo"
android:layout_width=
"30dp"
android:layout_width=
"@dimen/size_30"
android:layout_height=
"30dp"
android:layout_height=
"27dp"
android:layout_marginRight=
"5dp"
android:background=
"@drawable/icon_photo"
android:background=
"@drawable/im_btn_more_bg"
android:contentDescription=
"@string/app_name"
/>
android:contentDescription=
"@string/app_name"
/>
<Button
<Button
android:id=
"@+id/send_btn"
android:id=
"@+id/send_btn"
android:layout_width=
"
40dp
"
android:layout_width=
"
@dimen/dp40
"
android:layout_height=
"
30dp
"
android:layout_height=
"
@dimen/size_30
"
android:layout_gravity=
"center_vertical"
android:layout_gravity=
"center_vertical"
android:background=
"@drawable/a_bg_for_send_msg"
android:background=
"@drawable/a_bg_for_send_msg"
android:gravity=
"center"
android:gravity=
"center"
...
@@ -149,7 +150,6 @@
...
@@ -149,7 +150,6 @@
android:id=
"@+id/chat_face_view_stub"
android:id=
"@+id/chat_face_view_stub"
android:layout_width=
"match_parent"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_height=
"wrap_content"
android:inflatedId=
"@+id/chat_face_view"
android:layout=
"@layout/chat_bottom_face"
/>
android:layout=
"@layout/chat_bottom_face"
/>
<ViewStub
<ViewStub
...
...
plugin_im/src/main/res/layout/camera_view.xml
deleted
100644 → 0
View file @
4f8cea18
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout
xmlns:android=
"http://schemas.android.com/apk/res/android"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:background=
"#000000"
android:orientation=
"vertical"
>
<FrameLayout
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
>
<VideoView
android:id=
"@+id/video_preview"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
/>
<ImageView
android:id=
"@+id/image_photo"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:background=
"#000"
android:visibility=
"invisible"
/>
</FrameLayout>
<LinearLayout
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_gravity=
"right"
android:orientation=
"horizontal"
>
<ImageView
android:id=
"@+id/image_flash"
android:layout_width=
"50dp"
android:layout_height=
"50dp"
android:padding=
"10dp"
android:src=
"@drawable/ic_flash_on"
/>
<ImageView
android:id=
"@+id/image_switch"
android:layout_width=
"50dp"
android:layout_height=
"50dp"
android:padding=
"10dp"
android:src=
"@drawable/ic_camera"
/>
</LinearLayout>
<com.cjt2325.cameralibrary.CaptureLayout
android:id=
"@+id/capture_layout"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_gravity=
"bottom"
/>
<com.cjt2325.cameralibrary.FoucsView
android:id=
"@+id/fouce_view"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_gravity=
"center"
android:visibility=
"invisible"
/>
</FrameLayout>
\ No newline at end of file
plugin_im/src/main/res/layout/chat_from_item_text.xml
View file @
fc9d4725
...
@@ -34,19 +34,21 @@
...
@@ -34,19 +34,21 @@
<TextView
<TextView
android:gravity=
"left|center_vertical"
android:gravity=
"left|center_vertical"
android:textColor=
"@color/black"
android:id=
"@+id/chat_text"
android:id=
"@+id/chat_text"
android:layout_width=
"wrap_content"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_centerInParent=
"true"
android:layout_centerInParent=
"true"
android:layout_marginLeft=
"@dimen/dp5"
android:layout_marginLeft=
"@dimen/dp5"
android:layout_marginTop=
"@dimen/chat_head_top"
android:layout_marginTop=
"@dimen/chat_head_top"
android:background=
"@drawable/
chat_to_warp_b
g"
android:background=
"@drawable/
shape_from_chat_ms
g"
android:clickable=
"true"
android:clickable=
"true"
android:focusable=
"true"
android:focusable=
"true"
android:maxWidth=
"210dp"
android:maxWidth=
"210dp"
android:minHeight=
"30dp"
android:minHeight=
"30dp"
android:textSize=
"13sp"
android:paddingLeft=
"@dimen/dp_10"
android:paddingRight=
"@dimen/dp_10"
android:textColor=
"@color/colorMain"
android:textSize=
"@dimen/sp_14"
tools:text=
"sdfsdfsdfs"
/>
tools:text=
"sdfsdfsdfs"
/>
<ImageView
<ImageView
...
...
plugin_im/src/main/res/layout/chat_to_item_text.xml
View file @
fc9d4725
...
@@ -72,13 +72,16 @@
...
@@ -72,13 +72,16 @@
android:layout_centerInParent=
"true"
android:layout_centerInParent=
"true"
android:layout_marginLeft=
"@dimen/dp5"
android:layout_marginLeft=
"@dimen/dp5"
android:layout_marginTop=
"@dimen/chat_head_top"
android:layout_marginTop=
"@dimen/chat_head_top"
android:background=
"@drawable/
chat_from_warp_b
g"
android:background=
"@drawable/
shape_to_chat_ms
g"
android:clickable=
"true"
android:clickable=
"true"
android:focusable=
"true"
android:focusable=
"true"
android:gravity=
"right|center_vertical"
android:gravity=
"right|center_vertical"
android:maxWidth=
"210dp"
android:maxWidth=
"210dp"
android:minHeight=
"@dimen/chat_head_size"
android:minHeight=
"@dimen/size_30"
android:textSize=
"13sp"
android:paddingLeft=
"@dimen/dp_10"
android:paddingRight=
"@dimen/dp_10"
android:textColor=
"@color/colorMain"
android:textSize=
"@dimen/sp_14"
tools:text=
"sdfsdfsdfs"
/>
tools:text=
"sdfsdfsdfs"
/>
<com.rv.im.view.RoundImageView
<com.rv.im.view.RoundImageView
...
...
plugin_im/src/main/res/layout/dialog_select_media.xml
0 → 100644
View file @
fc9d4725
<?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=
"match_parent"
android:background=
"@color/transparent"
android:orientation=
"vertical"
>
<LinearLayout
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:background=
"@color/white"
android:gravity=
"center"
android:orientation=
"vertical"
>
<LinearLayout
android:id=
"@+id/dialog_select_video_ll"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:gravity=
"center"
>
<TextView
android:id=
"@+id/dialog_select_video"
android:layout_width=
"wrap_content"
android:layout_height=
"52dp"
android:drawablePadding=
"8dp"
android:gravity=
"center"
android:textColor=
"@color/dialog_normal"
/>
</LinearLayout>
<View
android:layout_width=
"match_parent"
android:layout_height=
"1dp"
android:background=
"@color/Grey_400"
/>
<LinearLayout
android:id=
"@+id/dialog_select_voice_ll"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:gravity=
"center"
>
<TextView
android:id=
"@+id/dialog_select_voice"
android:layout_width=
"wrap_content"
android:layout_height=
"52dp"
android:drawablePadding=
"8dp"
android:gravity=
"center"
android:textColor=
"@color/dialog_normal"
/>
</LinearLayout>
</LinearLayout>
<TextView
android:id=
"@+id/dialog_select_cancel"
android:layout_width=
"match_parent"
android:layout_height=
"52dp"
android:layout_marginTop=
"@dimen/dialog_bottom_cancel_margin"
android:background=
"@color/white"
android:gravity=
"center"
android:text=
"@string/cancel"
android:textColor=
"@color/dialog_normal"
android:textStyle=
"bold"
/>
</LinearLayout>
\ No newline at end of file
plugin_im/src/main/res/layout/item_customer.xml
View file @
fc9d4725
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android=
"http://schemas.android.com/apk/res/android"
<LinearLayout
xmlns:android=
"http://schemas.android.com/apk/res/android"
android:layout_width=
"match_parent"
android:layout_width=
"match_parent"
android:layout_height=
"@dimen/size_
55
"
android:layout_height=
"@dimen/size_
60
"
android:background=
"@color/white"
android:background=
"@color/white"
android:gravity=
"center_vertical"
android:gravity=
"center_vertical"
android:orientation=
"vertical"
>
android:orientation=
"vertical"
>
<include
layout=
"@layout/common_line"
/>
<LinearLayout
<LinearLayout
android:layout_width=
"match_parent"
android:layout_width=
"match_parent"
android:layout_height=
"0dp"
android:layout_height=
"0dp"
...
@@ -22,8 +20,8 @@
...
@@ -22,8 +20,8 @@
android:background=
"@drawable/bg_circle_yellow"
>
android:background=
"@drawable/bg_circle_yellow"
>
<ImageView
<ImageView
android:layout_width=
"
wrap_content
"
android:layout_width=
"
26dp
"
android:layout_height=
"
wrap_content
"
android:layout_height=
"
26dp
"
android:layout_centerInParent=
"true"
android:layout_centerInParent=
"true"
android:src=
"@drawable/icon_logo_white"
/>
android:src=
"@drawable/icon_logo_white"
/>
...
@@ -31,9 +29,10 @@
...
@@ -31,9 +29,10 @@
<LinearLayout
<LinearLayout
android:layout_width=
"
wrap_content
"
android:layout_width=
"
0dp
"
android:layout_height=
"match_parent"
android:layout_height=
"match_parent"
android:layout_marginLeft=
"@dimen/dp_10"
android:layout_marginLeft=
"@dimen/dp_10"
android:layout_weight=
"1"
android:gravity=
"left|center_vertical"
android:gravity=
"left|center_vertical"
android:orientation=
"vertical"
>
android:orientation=
"vertical"
>
...
@@ -42,7 +41,8 @@
...
@@ -42,7 +41,8 @@
android:layout_width=
"wrap_content"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_height=
"wrap_content"
android:text=
"牧之"
android:text=
"牧之"
android:textSize=
"@dimen/sp_14"
/>
android:textColor=
"@color/black"
android:textSize=
"@dimen/sp_16"
/>
<TextView
<TextView
android:id=
"@+id/tv_last_msg"
android:id=
"@+id/tv_last_msg"
...
@@ -50,22 +50,34 @@
...
@@ -50,22 +50,34 @@
android:layout_height=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginTop=
"@dimen/size_3"
android:layout_marginTop=
"@dimen/size_3"
android:ellipsize=
"end"
android:ellipsize=
"end"
android:maxLength=
"10"
android:focusable=
"true"
android:text=
"感谢您"
/>
android:maxLength=
"30"
android:singleLine=
"true"
android:textColor=
"@color/gray"
android:textSize=
"@dimen/text_12"
/>
</LinearLayout>
</LinearLayout>
<TextView
<TextView
android:id=
"@+id/tv_state"
android:id=
"@+id/tv_state"
android:layout_width=
"
0dp
"
android:layout_width=
"
@dimen/size_50
"
android:layout_height=
"match_parent"
android:layout_height=
"match_parent"
android:layout_marginTop=
"@dimen/dp_10"
android:layout_marginTop=
"@dimen/dp_10"
android:layout_marginRight=
"@dimen/dp_10"
android:layout_marginRight=
"@dimen/dp_10"
android:layout_weight=
"1"
android:gravity=
"right|top"
android:gravity=
"right|top"
android:text=
"在线"
android:text=
"在线"
android:textColor=
"@color/gray"
android:textColor=
"@color/gray"
android:textSize=
"@dimen/text_12"
/>
android:textSize=
"@dimen/text_12"
/>
</LinearLayout>
</LinearLayout>
<LinearLayout
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_marginLeft=
"@dimen/dp_10"
android:layout_marginRight=
"@dimen/dp_10"
>
<include
layout=
"@layout/common_line"
/>
</LinearLayout>
</LinearLayout>
</LinearLayout>
plugin_imcamera/src/main/java/com/xxfc/imcamera/activity/EasyCameraActivity.java
View file @
fc9d4725
...
@@ -38,7 +38,7 @@ public class EasyCameraActivity extends Activity {
...
@@ -38,7 +38,7 @@ public class EasyCameraActivity extends Activity {
@Override
@Override
protected
void
onCreate
(
Bundle
savedInstanceState
)
{
protected
void
onCreate
(
Bundle
savedInstanceState
)
{
super
.
onCreate
(
savedInstanceState
);
super
.
onCreate
(
savedInstanceState
);
setContentView
(
R
.
layout
.
activity_easy_camera
);
setContentView
(
R
.
layout
.
activity_easy_camera
_lf
);
// 全屏显示
// 全屏显示
if
(
Build
.
VERSION
.
SDK_INT
>=
19
)
{
if
(
Build
.
VERSION
.
SDK_INT
>=
19
)
{
...
@@ -60,7 +60,7 @@ public class EasyCameraActivity extends Activity {
...
@@ -60,7 +60,7 @@ public class EasyCameraActivity extends Activity {
}
}
private
void
initView
()
{
private
void
initView
()
{
jCameraView
=
findViewById
(
R
.
id
.
jcameraview
);
jCameraView
=
findViewById
(
R
.
id
.
imdescovery_
jcameraview
);
// 设置只能录像或只能拍照或两种都可以(默认两种都可以)
// 设置只能录像或只能拍照或两种都可以(默认两种都可以)
jCameraView
.
setFeatures
(
JCameraView
.
BUTTON_STATE_ONLY_CAPTURE
);
jCameraView
.
setFeatures
(
JCameraView
.
BUTTON_STATE_ONLY_CAPTURE
);
...
...
plugin_imcamera/src/main/java/com/xxfc/imcamera/cameralibrary/JCameraView.java
View file @
fc9d4725
...
@@ -151,7 +151,7 @@ public class JCameraView extends FrameLayout implements CameraInterface.CameraOp
...
@@ -151,7 +151,7 @@ public class JCameraView extends FrameLayout implements CameraInterface.CameraOp
setFlashRes
();
setFlashRes
();
}
}
});
});
mCaptureLayout
=
(
CaptureLayout
)
view
.
findViewById
(
R
.
id
.
capture_layout
);
mCaptureLayout
=
view
.
findViewById
(
R
.
id
.
capture_layout
);
mCaptureLayout
.
setDuration
(
duration
);
mCaptureLayout
.
setDuration
(
duration
);
mCaptureLayout
.
setIconSrc
(
iconLeft
,
iconRight
);
mCaptureLayout
.
setIconSrc
(
iconLeft
,
iconRight
);
mFoucsView
=
(
FoucsView
)
view
.
findViewById
(
R
.
id
.
fouce_view
);
mFoucsView
=
(
FoucsView
)
view
.
findViewById
(
R
.
id
.
fouce_view
);
...
...
plugin_imcamera/src/main/res/layout/activity_easy_camera.xml
→
plugin_imcamera/src/main/res/layout/activity_easy_camera
_lf
.xml
View file @
fc9d4725
...
@@ -13,7 +13,7 @@
...
@@ -13,7 +13,7 @@
iconRight 右边按钮图片资源(1.1.9+)
iconRight 右边按钮图片资源(1.1.9+)
duration_max 设置最长录像时间(毫秒)-->
duration_max 设置最长录像时间(毫秒)-->
<com.xxfc.imcamera.cameralibrary.JCameraView
<com.xxfc.imcamera.cameralibrary.JCameraView
android:id=
"@+id/jcameraview"
android:id=
"@+id/
imdescovery_
jcameraview"
android:layout_width=
"match_parent"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
/>
android:layout_height=
"match_parent"
/>
...
...
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