Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Y
YDL-Component-Medical
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
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
杨凯
YDL-Component-Medical
Commits
79091f26
Commit
79091f26
authored
Mar 11, 2020
by
严久程
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
信息采集
parent
6488b095
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
89 additions
and
3 deletions
+89
-3
YDLMessageFragment.java
m-im/src/main/java/com/yidianling/uikit/business/session/fragment/YDLMessageFragment.java
+46
-3
CollectInfoPopupWindow.kt
m-im/src/main/java/com/yidianling/uikit/business/session/view/CollectInfoPopupWindow.kt
+6
-0
CollectUserInformationView.kt
m-im/src/main/java/com/yidianling/uikit/business/session/view/CollectUserInformationView.kt
+37
-0
No files found.
m-im/src/main/java/com/yidianling/uikit/business/session/fragment/YDLMessageFragment.java
View file @
79091f26
...
...
@@ -47,6 +47,7 @@ import com.ydl.ydlcommon.utils.SharedPreferencesEditor;
import
com.ydl.ydlcommon.utils.YdlBuryPointUtil
;
import
com.ydl.ydlcommon.utils.log.LogHelper
;
import
com.ydl.ydlcommon.view.CircleImageView
;
import
com.ydl.ydlcommon.view.dialog.CommonDialog
;
import
com.yidianling.common.tools.ToastUtil
;
import
com.yidianling.im.R
;
import
com.yidianling.im.router.ImIn
;
...
...
@@ -258,9 +259,10 @@ public class YDLMessageFragment extends TFragment implements ModuleProxy {
if
(
ChatStatusCacheHelper
.
getStatusCache
(
"collectEvent"
))
{
String
time
=
Calendar
.
getInstance
().
get
(
Calendar
.
YEAR
)
+
"-"
+
Calendar
.
getInstance
().
get
(
Calendar
.
MONTH
)
+
Calendar
.
getInstance
().
get
(
Calendar
.
DAY_OF_MONTH
);
// if (!TextUtils.equals(time, SharedPreferencesEditor.getString("skip_time_" + YdlCommonRouterManager.INSTANCE.getYdlCommonRoute().getUid()))) {
if
(!
TextUtils
.
equals
(
time
,
SharedPreferencesEditor
.
getString
(
"skip_time_"
+
ImIn
.
INSTANCE
.
getUserInfo
().
getUid
())))
{
collectInfoPopupWindow
=
new
CollectInfoPopupWindow
(
getActivity
(),
(
content
,
result
)
->
{
collectInfoPopupWindow
=
new
CollectInfoPopupWindow
(
getActivity
(),
new
CollectInfoPopupWindow
.
OnSendMsgListener
()
{
@Override
public
void
sendMsg
(
@NotNull
String
content
,
@NotNull
List
<
UserQuestInfoBean
>
result
)
{
if
(
TextUtils
.
isEmpty
(
content
))
{
//点击跳过后当天不再显示此弹窗
SharedPreferencesEditor
.
putString
(
"skip_time_"
+
ImIn
.
INSTANCE
.
getUserInfo
().
getUid
()
,
time
);
...
...
@@ -271,6 +273,12 @@ public class YDLMessageFragment extends TFragment implements ModuleProxy {
}
submitUserCollect
(
result
);
}
}
@Override
public
void
finishPage
()
{
getActivity
().
finish
();
}
});
getUserInfoCollect
();
if
(!
getActivity
().
isFinishing
())
{
...
...
@@ -380,6 +388,33 @@ public class YDLMessageFragment extends TFragment implements ModuleProxy {
rl_doctor_name
.
setVisibility
(
View
.
GONE
);
});
}
if
(
ActionHandlerStorage
.
getL
(
sessionId
)
!=
null
&&
ModularServiceManager
.
INSTANCE
.
provide
(
IUserService
.
class
).
getUserInfo
().
getUser_type
()
==
1
)
{
if
(
TextUtils
.
isEmpty
(
SharedPreferencesEditor
.
getString
(
"chat_age_ensure_"
+
ImIn
.
INSTANCE
.
getUserInfo
().
getUid
())))
{
ServiceImpl
.
Companion
.
getInstance
().
getNewUserMes
()
.
subscribeOn
(
Schedulers
.
io
())
.
observeOn
(
AndroidSchedulers
.
mainThread
())
.
subscribe
(
hasCollectedInResp
->
{
if
(
hasCollectedInResp
.
data
!=
null
&&
hasCollectedInResp
.
data
.
size
()
>
0
)
{
for
(
UserQuestInfoBean
bean
:
hasCollectedInResp
.
data
)
{
if
(
TextUtils
.
equals
(
bean
.
getUserInfoType
(),
"age"
))
{
try
{
String
year
=
bean
.
getContent
();
if
((
Calendar
.
getInstance
().
get
(
Calendar
.
YEAR
)
-
Integer
.
valueOf
(
year
))
<
16
)
{
if
(!
getActivity
().
isFinishing
())
{
showCheckAgeDialog
();
}
}
}
catch
(
Exception
e
)
{
}
}
}
}
},
throwable
->
{
});
}
}
}
private
void
addScrollListener
()
{
...
...
@@ -1188,7 +1223,7 @@ public class YDLMessageFragment extends TFragment implements ModuleProxy {
.
observeOn
(
AndroidSchedulers
.
mainThread
())
.
subscribe
(
resp
->
{
if
(
resp
.
data
!=
null
&&
resp
.
data
.
size
()
>
0
)
{
ServiceImpl
.
Companion
.
getInstance
().
userCollectList
()
ServiceImpl
.
Companion
.
getInstance
().
getNewUserMes
()
.
subscribeOn
(
Schedulers
.
io
())
.
observeOn
(
AndroidSchedulers
.
mainThread
())
.
subscribe
(
hasCollectedInResp
->
{
...
...
@@ -1219,4 +1254,12 @@ public class YDLMessageFragment extends TFragment implements ModuleProxy {
},
throwable
->
{
});
}
private
void
showCheckAgeDialog
()
{
CommonDialog
.
create
(
getActivity
())
.
setLeftOnclick
(
"返回"
,
v
->
getActivity
().
finish
())
.
setRightClick
(
"继续"
,
v
->
SharedPreferencesEditor
.
putString
(
"chat_age_ensure_"
+
ImIn
.
INSTANCE
.
getUserInfo
().
getUid
(),
"ensure"
))
.
setCancelAble
(
false
)
.
show
();
}
}
m-im/src/main/java/com/yidianling/uikit/business/session/view/CollectInfoPopupWindow.kt
View file @
79091f26
...
...
@@ -31,6 +31,9 @@ class CollectInfoPopupWindow(var mContext: Context, var listener: OnSendMsgListe
listener
.
sendMsg
(
""
,
ArrayList
())
isFromBack
=
false
dismiss
()
},
{
dismiss
()
listener
.
finishPage
()
},
{
_content
,
_list
->
listener
.
sendMsg
(
_content
,
_list
)
isFromBack
=
false
...
...
@@ -79,6 +82,8 @@ class CollectInfoPopupWindow(var mContext: Context, var listener: OnSendMsgListe
interface
OnSendMsgListener
{
fun
sendMsg
(
content
:
String
,
result
:
List
<
UserQuestInfoBean
>)
fun
finishPage
()
}
}
\ No newline at end of file
m-im/src/main/java/com/yidianling/uikit/business/session/view/CollectUserInformationView.kt
View file @
79091f26
...
...
@@ -18,11 +18,13 @@ import android.widget.EditText
import
android.widget.LinearLayout
import
android.widget.ScrollView
import
android.widget.TextView
import
com.ydl.ydlcommon.utils.SharedPreferencesEditor
import
com.ydl.ydlcommon.utils.Utils
import
com.ydl.ydlcommon.view.dialog.CommonDialog
import
com.yidianling.common.tools.RxImageTool
import
com.yidianling.common.tools.ToastUtil
import
com.yidianling.im.R
import
com.yidianling.im.router.ImIn.getUserInfo
import
com.yidianling.uikit.custom.http.response.UserQuestInfoBean
import
kotlinx.android.synthetic.main.im_view_collect_user_infomation.view.*
import
java.util.*
...
...
@@ -40,14 +42,17 @@ import kotlin.collections.ArrayList
class
CollectUserInformationView
(
var
mContext
:
Context
,
var
skipEvent
:
()
->
Unit
,
var
backEvent
:
()
->
Unit
,
var
sendMsgEvent
:
(
content
:
String
,
list
:
List
<
UserQuestInfoBean
>)
->
Unit
)
:
LinearLayout
(
mContext
)
{
private
var
resultInfoList
=
ArrayList
<
UserQuestInfoBean
>()
private
var
hasAge
=
false
private
var
hasGender
=
false
private
var
currentIndex
=
0
private
var
isNeedShowCheckAgeDialog
=
false
private
var
year
=
1994
private
var
dialog
:
CommonDialog
?
=
null
private
var
ensureAgeDialog
:
CommonDialog
?
=
null
private
var
ageStr
=
""
private
var
genderStr
=
""
private
var
questionStr
=
""
...
...
@@ -167,6 +172,9 @@ class CollectUserInformationView(
return
@setOnClickListener
}
ageStr
=
"年龄:${(Calendar.getInstance().get(Calendar.YEAR) - year)}岁"
if
((
Calendar
.
getInstance
().
get
(
Calendar
.
YEAR
)
-
year
)
<
16
)
{
isNeedShowCheckAgeDialog
=
true
}
addContentView
(
"${year}年"
,
false
)
tv_age_ensure
.
postDelayed
({
...
...
@@ -255,9 +263,14 @@ class CollectUserInformationView(
resultList
.
add
(
questionStyleBean
)
resultList
.
add
(
questionBean
)
if
(
isNeedShowCheckAgeDialog
)
{
showCheckAgeEnsure
(
resultContent
,
resultList
)
}
else
{
sendMsgEvent
(
resultContent
,
resultList
)
}
}
}
@SuppressLint
(
"RtlHardcoded"
)
...
...
@@ -325,6 +338,30 @@ class CollectUserInformationView(
imm
.
showSoftInput
(
editTextMessage
,
0
)
}
private
fun
showCheckAgeEnsure
(
content
:
String
,
list
:
List
<
UserQuestInfoBean
>)
{
if
(
ensureAgeDialog
==
null
)
{
ensureAgeDialog
=
CommonDialog
.
create
(
mContext
)
.
setLeftOnclick
(
"返回"
)
{
backEvent
()
ensureAgeDialog
!!
.
dismiss
()
}
.
setRightClick
(
"继续"
)
{
SharedPreferencesEditor
.
putString
(
"chat_age_ensure_${getUserInfo()!!.uid}"
,
"ensure"
)
sendMsgEvent
(
content
,
list
)
ensureAgeDialog
!!
.
dismiss
()
}
.
setMessage
(
"由于您未满16周岁,如需咨询需要在家长陪同下进行"
)
.
setTitle_color
(
R
.
color
.
im_color_242424
)
.
setCancelAble
(
true
)
}
if
(!
ensureAgeDialog
!!
.
isShowing
)
{
ensureAgeDialog
!!
.
show
()
}
}
fun
showSkipDialog
()
{
if
(
dialog
==
null
)
{
dialog
=
CommonDialog
.
create
(
mContext
)
...
...
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