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
11c8adb3
Commit
11c8adb3
authored
Mar 27, 2020
by
konghaorui
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
私聊列表点击条目接口后置 - 待发布
parent
12fece28
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
142 additions
and
154 deletions
+142
-154
DemoGlobalConfig.java
app/src/main/java/com/ydl/component/base/DemoGlobalConfig.java
+2
-2
P2PCustomActionHandlerImpl.java
m-im/src/main/java/com/yidianling/im/bridge/P2PCustomActionHandlerImpl.java
+20
-1
IMChatUtil.kt
m-im/src/main/java/com/yidianling/im/helper/IMChatUtil.kt
+0
-0
MsgViewHolderRecommendExpertList.java
m-im/src/main/java/com/yidianling/im/session/viewholder/MsgViewHolderRecommendExpertList.java
+4
-0
ChatAdapter.kt
m-im/src/main/java/com/yidianling/im/ui/page/fragment/adapter/ChatAdapter.kt
+6
-5
ChatItemBean.kt
m-im/src/main/java/com/yidianling/im/ui/page/fragment/bean/ChatItemBean.kt
+1
-1
YDLBaseMessageActivity.java
m-im/src/main/java/com/yidianling/uikit/business/session/activity/YDLBaseMessageActivity.java
+0
-126
YDLMessageFragment.java
m-im/src/main/java/com/yidianling/uikit/business/session/fragment/YDLMessageFragment.java
+78
-13
MessageListPanelEx.java
m-im/src/main/java/com/yidianling/uikit/business/session/module/list/MessageListPanelEx.java
+3
-1
IP2PCustomActionHandler.java
m-im/src/main/java/com/yidianling/uikit/custom/bridge/IP2PCustomActionHandler.java
+2
-0
im_ui_message_custom_recommand_expert_list.xml
m-im/src/main/res/layout/im_ui_message_custom_recommand_expert_list.xml
+1
-0
im_nim_message_activity_text_layout.xml
m-im/src/main/res_uikit/layout/im_nim_message_activity_text_layout.xml
+1
-0
im_ydl_nim_message_fragment.xml
m-im/src/main/res_uikit/layout/im_ydl_nim_message_fragment.xml
+0
-0
user_collect_bottom_btn_un_bg.xml
m-user/src/xlzx/res/drawable/user_collect_bottom_btn_un_bg.xml
+3
-2
AnimUtils.kt
ydl-platform/src/main/java/com/ydl/ydlcommon/utils/AnimUtils.kt
+21
-3
No files found.
app/src/main/java/com/ydl/component/base/DemoGlobalConfig.java
View file @
11c8adb3
...
...
@@ -20,8 +20,8 @@ import java.util.List;
public
final
class
DemoGlobalConfig
implements
IConfigModule
{
String
APP_DOMAIN
=
"https://api.github.com/"
;
// public static String appEnv = YDLConstants.ENV_AUTO_TEST;
//
public static String appEnv = YDLConstants.ENV_TEST;
public
static
String
appEnv
=
YDLConstants
.
ENV_PROD
;
public
static
String
appEnv
=
YDLConstants
.
ENV_TEST
;
//
public static String appEnv = YDLConstants.ENV_PROD;
@Override
public
void
injectAppLifecycle
(
@NotNull
Context
context
,
@NotNull
List
<
IAppLifecycles
>
lifecycles
)
{
...
...
m-im/src/main/java/com/yidianling/im/bridge/P2PCustomActionHandlerImpl.java
View file @
11c8adb3
...
...
@@ -61,6 +61,7 @@ import com.yidianling.im.session.extension.CustomAttachmentOrderStatus;
import
com.yidianling.im.session.extension.CustomAttachmentPhoneCallSystemNotice
;
import
com.yidianling.im.session.extension.CustomRecommendExpertListMsg
;
import
com.yidianling.im.session.extension.CustomSystemTips
;
import
com.yidianling.im.ui.page.fragment.bean.ChatItemBean
;
import
com.yidianling.im.ui.widget.ChatTeamHisDialog
;
import
com.yidianling.uikit.business.session.helper.MessageListPanelHelper
;
import
com.yidianling.uikit.custom.bridge.IP2PCustomActionHandler
;
...
...
@@ -85,6 +86,7 @@ import io.reactivex.schedulers.Schedulers;
*/
public
class
P2PCustomActionHandlerImpl
implements
IP2PCustomActionHandler
{
private
boolean
notPrepared
;
private
String
toChatUsername
;
private
DocInfo
docInfo
=
new
DocInfo
();
private
Activity
mActivity
;
...
...
@@ -141,7 +143,7 @@ public class P2PCustomActionHandlerImpl implements IP2PCustomActionHandler {
if
(
expert
.
commentList
!=
null
)
{
docInfo
.
commentList
.
addAll
(
expert
.
commentList
);
}
this
.
notPrepared
=
false
;
}
public
P2PCustomActionHandlerImpl
(
String
toChatUsername
,
...
...
@@ -150,6 +152,17 @@ public class P2PCustomActionHandlerImpl implements IP2PCustomActionHandler {
docInfo
.
toUid
=
toChatUsername
;
docInfo
.
name
=
toName
;
docInfo
.
cover
=
head
;
this
.
notPrepared
=
false
;
}
public
P2PCustomActionHandlerImpl
(
ChatItemBean
chatItemBean
)
{
this
.
toChatUsername
=
String
.
valueOf
(
chatItemBean
.
getToUid
());
this
.
userType
=
chatItemBean
.
getUtype
();
this
.
notPrepared
=
true
;
docInfo
.
toUid
=
String
.
valueOf
(
chatItemBean
.
getToUid
());
docInfo
.
name
=
chatItemBean
.
getTitle
();
docInfo
.
cover
=
chatItemBean
.
getHead
();
}
//聊天室使用
...
...
@@ -223,6 +236,7 @@ public class P2PCustomActionHandlerImpl implements IP2PCustomActionHandler {
//发送专家推荐列表自定义消息
@Override
public
void
sendRecommendExpertListMessage
(
String
sessionId
,
ArrayList
<
RecommendExpertBean
>
recommendExpertList
,
int
type
,
boolean
showExpertList
)
{
CustomRecommendExpertListMsg
customRecommendExpertListMsg
=
new
CustomRecommendExpertListMsg
(
recommendExpertList
,
type
,
showExpertList
);
IMMessage
message
=
MessageBuilder
.
createCustomMessage
(
sessionId
,
SessionTypeEnum
.
P2P
,
customRecommendExpertListMsg
);
message
.
setStatus
(
MsgStatusEnum
.
success
);
...
...
@@ -492,6 +506,11 @@ public class P2PCustomActionHandlerImpl implements IP2PCustomActionHandler {
return
docInfo
==
null
?
new
DocInfo
()
:
docInfo
;
}
@Override
public
Boolean
isNotPrepare
()
{
return
notPrepared
;
}
@Override
public
boolean
deleteMessage
(
IMMessage
message
)
{
...
...
m-im/src/main/java/com/yidianling/im/helper/IMChatUtil.kt
0 → 100644
View file @
11c8adb3
This diff is collapsed.
Click to expand it.
m-im/src/main/java/com/yidianling/im/session/viewholder/MsgViewHolderRecommendExpertList.java
View file @
11c8adb3
...
...
@@ -9,6 +9,7 @@ import android.widget.TextView;
import
com.netease.nimlib.sdk.msg.attachment.MsgAttachment
;
import
com.ydl.ydl_image.module.GlideApp
;
import
com.ydl.ydlcommon.utils.AnimUtils
;
import
com.yidianling.im.R
;
import
com.yidianling.im.bean.DoctorAssistantRespDtoBean
;
import
com.yidianling.im.helper.IMUtil
;
...
...
@@ -38,6 +39,7 @@ public class MsgViewHolderRecommendExpertList extends MsgViewHolderBase {
private
LinearLayout
recommendLlScroll
;
private
TextView
tv_outline_left
;
private
TextView
tv_outline_right
;
private
LinearLayout
ll_recommend_expert
;
private
HorizontalScrollView
recommend_ll_scroll_view
;
private
TextView
recommend_ll_scroll_view_top_text
;
...
...
@@ -53,6 +55,7 @@ public class MsgViewHolderRecommendExpertList extends MsgViewHolderBase {
@Override
protected
void
inflateContentView
()
{
recommend_ll_scroll_view
=
view
.
findViewById
(
R
.
id
.
recommend_ll_scroll_view
);
ll_recommend_expert
=
view
.
findViewById
(
R
.
id
.
ll_recommend_expert
);
recommend_ll_scroll_view_top_text
=
view
.
findViewById
(
R
.
id
.
recommend_ll_scroll_view_top_text
);
recommendLlScroll
=
view
.
findViewById
(
R
.
id
.
recommend_ll_scroll
);
tv_outline_left
=
view
.
findViewById
(
R
.
id
.
tv_outline_left
);
...
...
@@ -146,6 +149,7 @@ public class MsgViewHolderRecommendExpertList extends MsgViewHolderBase {
}
hideHead
();
hideItemBg
();
AnimUtils
.
Companion
.
slideToUp
(
ll_recommend_expert
);
}
@Override
...
...
m-im/src/main/java/com/yidianling/im/ui/page/fragment/adapter/ChatAdapter.kt
View file @
11c8adb3
...
...
@@ -15,14 +15,14 @@ import com.ydl.ydlcommon.data.http.RxUtils
import
com.ydl.ydlcommon.utils.log.LogHelper
import
com.ydl.ydlcommon.utils.remind.ToastHelper
import
com.ydl.ydlcommon.view.ListNoCancelDialog
import
com.yidianling.im.api.param.RmHistoryParam
import
com.yidianling.im.api.param.RmTalkParam
import
com.yidianling.im.api.param.TopMessageParam
import
com.yidianling.im.bridge.P2PCustomActionHandlerImpl
import
com.yidianling.im.event.UpdateTabUnreadNumEvent
import
com.yidianling.im.helper.IMUtil
import
com.yidianling.im.helper.IM
Chat
Util
import
com.yidianling.im.helper.MsgReceiveHelper
import
com.yidianling.im.http.ImHttpImpl
import
com.yidianling.im.api.param.RmHistoryParam
import
com.yidianling.im.api.param.RmTalkParam
import
com.yidianling.im.api.param.TopMessageParam
import
com.yidianling.im.session.SessionHelper
import
com.yidianling.im.ui.page.fragment.bean.ChatItemBean
import
com.yidianling.im.ui.page.fragment.view.ChatItemView
...
...
@@ -62,7 +62,8 @@ class ChatAdapter(var context: Context, private var mList: ArrayList<ChatItemBea
SessionHelper
.
startP2PSession
(
context
,
-
1
,
"4108805"
,
null
,
P2PCustomActionHandlerImpl
(
"4108805"
,
"课程小助手-壹壹"
,
"4108805"
))
}
else
{
IMUtil
.
startChat
(
context
as
AppCompatActivity
,
mList
[
position
].
toUid
.
toString
(),
0
,
0
,
null
,
0
,
true
)
// IMUtil.startChat(context as AppCompatActivity, mList[position].toUid.toString(), 0, 0, null, 0, true)
IMChatUtil
.
startChat
(
context
as
AppCompatActivity
,
mList
[
position
])
}
}
...
...
m-im/src/main/java/com/yidianling/im/ui/page/fragment/bean/ChatItemBean.kt
View file @
11c8adb3
...
...
@@ -8,7 +8,7 @@ class ChatItemBean(
var
unReadNum
:
Int
=
0
,
var
chat_type
:
Int
=
1
,
//1私聊 2群聊
var
content
:
String
=
""
,
var
doctor
_i
d
:
Int
=
0
,
//专家id
var
doctor
I
d
:
Int
=
0
,
//专家id
var
ds
:
Int
=
0
,
//倾诉业务状态
var
head
:
String
=
""
,
var
is_read
:
Int
=
0
,
//是否已读:1未读;2已读
...
...
m-im/src/main/java/com/yidianling/uikit/business/session/activity/YDLBaseMessageActivity.java
View file @
11c8adb3
...
...
@@ -11,9 +11,6 @@ import android.widget.ImageView;
import
android.widget.LinearLayout
;
import
android.widget.RelativeLayout
;
import
com.ydl.ydlcommon.data.http.RxUtils
;
import
com.yidianling.common.tools.LogUtil
;
import
com.yidianling.common.tools.ToastUtil
;
import
com.yidianling.im.R
;
import
com.yidianling.nimbase.api.model.session.SessionCustomization
;
import
com.yidianling.nimbase.business.preference.UserPreferences
;
...
...
@@ -23,16 +20,10 @@ import com.yidianling.nimbase.common.util.sys.ScreenUtil;
import
com.yidianling.uikit.business.session.fragment.YDLMessageFragment
;
import
com.yidianling.uikit.custom.bridge.ActionHandlerStorage
;
import
com.yidianling.uikit.custom.bridge.IP2PCustomActionHandler
;
import
com.yidianling.uikit.custom.http.ServiceImpl
;
import
com.yidianling.uikit.custom.widget.TitleBarBottom
;
import
java.net.URLEncoder
;
import
java.util.List
;
import
io.reactivex.android.schedulers.AndroidSchedulers
;
import
io.reactivex.disposables.Disposable
;
import
io.reactivex.schedulers.Schedulers
;
/**
* Created by zhoujianghua on 2015/9/10.
*/
...
...
@@ -126,132 +117,15 @@ public abstract class YDLBaseMessageActivity extends UI {
if
(
ActionHandlerStorage
.
getL
(
sessionId
)
!=
null
)
{
ActionHandlerStorage
.
getL
(
sessionId
).
setmActivity
(
this
);
}
if
(!
UserPreferences
.
isEarPhoneModeEnable
())
{
tb
.
setTitleRightDraw
(
null
);
}
else
{
tb
.
setTitleRightDraw
(
getResources
().
getDrawable
(
R
.
drawable
.
im_erduoxiaolv
));
}
IP2PCustomActionHandler
actionHandler
=
ActionHandlerStorage
.
getL
(
sessionId
);
//获取私聊对方在线状态
if
(
null
!=
actionHandler
)
{
IP2PCustomActionHandler
.
DocInfo
docInfo
=
actionHandler
.
getInfo
();
if
(
null
!=
docInfo
&&
(
"14"
.
equals
(
docInfo
.
toUid
)
||
"4108805"
.
equals
(
docInfo
.
toUid
)))
{
//小壹客服 不显示是否在线
tb
.
setmMinTitleVisiable
(
View
.
GONE
);
}
else
{
if
(
ActionHandlerStorage
.
getL
(
sessionId
).
getUserType
()
==
2
)
{
// 专家
// 调取接口获取专家状态
Disposable
dis
=
ServiceImpl
.
Companion
.
getInstance
()
.
getDoctorChatStatus
(
Long
.
parseLong
(
ActionHandlerStorage
.
getL
(
sessionId
).
getInfo
().
toUid
))
.
compose
(
RxUtils
.
applySchedulers
())
.
subscribe
(
chatStatusBean
->
{
if
(
ActionHandlerStorage
.
getL
(
sessionId
)
!=
null
)
{
int
status
=
chatStatusBean
.
data
.
getStatus
();
ActionHandlerStorage
.
getL
(
sessionId
).
setDoctorStatus
(
status
);
ActionHandlerStorage
.
getL
(
sessionId
).
setDoctorBusyNum
(
chatStatusBean
.
data
.
getBusyTotal
());
//1.在线,2.离线,3.忙碌 4咨询中, 5倾述中 6咨询前准备
if
(
status
==
2
)
{
//离线
tb
.
setMinTitleText
(
"离线"
);
tb
.
setMinTitleColor
(
getResources
().
getColor
(
R
.
color
.
platform_color_666666
));
tb
.
setMinTitleDrawable
(
getResources
().
getDrawable
(
R
.
drawable
.
im_background_chat_top_status_off_line
));
}
else
if
(
status
==
4
||
status
==
5
)
{
//服务中
tb
.
setMinTitleText
(
"服务中"
);
tb
.
setMinTitleColor
(
getResources
().
getColor
(
R
.
color
.
platform_color_666666
));
tb
.
setMinTitleDrawable
(
getResources
().
getDrawable
(
R
.
drawable
.
im_background_chat_top_status_online_server
));
}
else
{
//在线 1,3,6..
tb
.
setMinTitleText
(
"在线"
);
tb
.
setMinTitleColor
(
getResources
().
getColor
(
R
.
color
.
platform_color_666666
));
tb
.
setMinTitleDrawable
(
getResources
().
getDrawable
(
R
.
drawable
.
im_background_chat_top_status_online
));
}
initSystemMessage
(
chatStatusBean
.
data
.
getPromptRule
(),
status
);
}
},
throwable
->
{
LogUtil
.
i
(
"getDoctorChatStatus throwable:"
+
throwable
);
});
}
else
if
(
ActionHandlerStorage
.
getL
(
sessionId
).
getUserType
()
==
3
)
{
// 助理
// 调取接口获取助理状态
ServiceImpl
.
Companion
.
getInstance
().
getAssistantChatStatus
(
Long
.
parseLong
(
ActionHandlerStorage
.
getL
(
sessionId
).
getInfo
().
toUid
))
.
subscribeOn
(
Schedulers
.
io
())
.
observeOn
(
AndroidSchedulers
.
mainThread
())
.
subscribe
(
res
->
{
if
(
ActionHandlerStorage
.
getL
(
sessionId
)
!=
null
)
{
if
(
res
.
data
==
1
)
{
//在线
tb
.
setMinTitleText
(
"在线"
);
tb
.
setMinTitleColor
(
getResources
().
getColor
(
R
.
color
.
platform_color_666666
));
tb
.
setMinTitleDrawable
(
getResources
().
getDrawable
(
R
.
drawable
.
im_background_chat_top_status_online
));
}
else
{
//离线
tb
.
setMinTitleText
(
"离线"
);
tb
.
setMinTitleColor
(
getResources
().
getColor
(
R
.
color
.
platform_color_666666
));
tb
.
setMinTitleDrawable
(
getResources
().
getDrawable
(
R
.
drawable
.
im_background_chat_top_status_off_line
));
}
}
},
throwable
->
{
});
}
else
{
tb
.
setmMinTitleVisiable
(
View
.
GONE
);
}
}
}
if
(
customization
!=
null
)
{
addRightCustomViewOnActionBar
(
this
,
customization
.
buttons
);
}
}
// promptRule 判断是否推荐专家 4,5直接不走文本提示和推荐逻辑,1,3不走推荐逻辑
//初始化 根据专家在线状态来发送提示消息或者推荐消息
private
void
initSystemMessage
(
int
promptRule
,
int
status
)
{
if
(!(
promptRule
==
4
||
promptRule
==
5
))
{
boolean
showExpertList
=
!(
promptRule
==
1
||
promptRule
==
3
);
if
(
ActionHandlerStorage
.
getL
(
sessionId
).
getUserType
()
==
2
&&
status
==
2
)
{
//当该专家离线时
sendRecommendExpertListMessage
(
1
,
showExpertList
);
}
else
if
(
ActionHandlerStorage
.
getL
(
sessionId
).
getUserType
()
==
2
&&
status
>=
3
)
{
//当该专家忙碌时
sendRecommendExpertListMessage
(
2
,
showExpertList
);
}
}
}
/**
* 发送推荐专家列表
*/
@SuppressLint
(
"CheckResult"
)
public
void
sendRecommendExpertListMessage
(
int
type
,
boolean
showExpertList
)
{
// 调取接口获取推荐专家列表
ServiceImpl
.
Companion
.
getInstance
().
getRecommendExpertList
(
Long
.
parseLong
(
ActionHandlerStorage
.
getL
(
sessionId
).
getInfo
().
toUid
),
URLEncoder
.
encode
(
ActionHandlerStorage
.
getL
(
sessionId
).
getInfo
().
tag1
),
3
)
.
subscribeOn
(
Schedulers
.
io
())
.
observeOn
(
AndroidSchedulers
.
mainThread
())
.
subscribe
(
res
->
{
//发送推荐专家列表消息
if
(
ActionHandlerStorage
.
getL
(
sessionId
)
!=
null
)
{
ActionHandlerStorage
.
getL
(
sessionId
).
sendRecommendExpertListMessage
(
sessionId
,
res
.
data
,
type
,
showExpertList
);
}
},
throwable
->
{
ToastUtil
.
toastShort
(
throwable
.
toString
());
});
}
// 添加action bar的右侧按钮及响应事件
private
void
addRightCustomViewOnActionBar
(
Activity
activity
,
List
<
SessionCustomization
.
OptionsButton
>
buttons
)
{
if
(
buttons
==
null
||
buttons
.
size
()
==
0
)
{
...
...
m-im/src/main/java/com/yidianling/uikit/business/session/fragment/YDLMessageFragment.java
View file @
11c8adb3
This diff is collapsed.
Click to expand it.
m-im/src/main/java/com/yidianling/uikit/business/session/module/list/MessageListPanelEx.java
View file @
11c8adb3
...
...
@@ -124,6 +124,7 @@ public class MessageListPanelEx {
//onPause时语音消息是否停止播放
public
static
boolean
audioIsStop
=
true
;
public
LinearLayoutManager
linearLayoutManager
;
public
MessageListPanelEx
(
Container
container
,
View
rootView
,
boolean
recordOnly
,
boolean
remote
)
{
this
(
container
,
rootView
,
null
,
recordOnly
,
remote
);
...
...
@@ -186,7 +187,8 @@ public class MessageListPanelEx {
// RecyclerView
messageListView
=
rootView
.
findViewById
(
R
.
id
.
messageListView
);
messageListView
.
setLayoutManager
(
new
LinearLayoutManager
(
container
.
activity
));
linearLayoutManager
=
new
LinearLayoutManager
(
container
.
activity
);
messageListView
.
setLayoutManager
(
linearLayoutManager
);
messageListView
.
requestDisallowInterceptTouchEvent
(
true
);
messageListView
.
addOnScrollListener
(
new
RecyclerView
.
OnScrollListener
()
{
@Override
...
...
m-im/src/main/java/com/yidianling/uikit/custom/bridge/IP2PCustomActionHandler.java
View file @
11c8adb3
...
...
@@ -19,6 +19,8 @@ public interface IP2PCustomActionHandler {
DocInfo
getInfo
();
Boolean
isNotPrepare
();
boolean
deleteMessage
(
IMMessage
message
);
//需要筛选的消息
void
setDoctorStatus
(
int
status
);
//更新专家登录状态
...
...
m-im/src/main/res/layout/im_ui_message_custom_recommand_expert_list.xml
View file @
11c8adb3
...
...
@@ -4,6 +4,7 @@
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:orientation=
"vertical"
android:id=
"@+id/ll_recommend_expert"
android:gravity=
"center_horizontal"
>
<LinearLayout
...
...
m-im/src/main/res_uikit/layout/im_nim_message_activity_text_layout.xml
View file @
11c8adb3
...
...
@@ -75,6 +75,7 @@
android:layout_gravity=
"center"
android:layout_marginLeft=
"10dp"
android:layout_marginRight=
"10dp"
android:hint=
"隐私保密,安心咨询"
android:layout_weight=
"1"
android:autoLink=
"all"
android:background=
"#ffffff"
...
...
m-im/src/main/res_uikit/layout/im_ydl_nim_message_fragment.xml
View file @
11c8adb3
This diff is collapsed.
Click to expand it.
m-user/src/xlzx/res/drawable/user_collect_bottom_btn_un_bg.xml
View file @
11c8adb3
...
...
@@ -6,7 +6,7 @@
<gradient
android:angle=
"180"
android:startColor=
"@color/
user_main_theme_66
"
android:endColor=
"@color/
user_main_theme_66
"
/>
android:startColor=
"@color/
platform_main_gradient_start_color_un
"
android:endColor=
"@color/
platform_main_gradient_end_color_un
"
/>
</shape>
\ No newline at end of file
ydl-platform/src/main/java/com/ydl/ydlcommon/utils/AnimUtils.kt
View file @
11c8adb3
package
com.ydl.ydlcommon.utils
import
android.view.View
import
android.view.animation.AccelerateInterpolator
import
android.view.animation.Animation
import
android.view.animation.TranslateAnimation
/**
* @author yuanWai
* @描述:
...
...
@@ -13,10 +15,12 @@ import android.view.animation.TranslateAnimation
*/
class
AnimUtils
{
companion
object
{
fun
slideToUp
(
view
:
View
){
val
slide
=
TranslateAnimation
(
Animation
.
RELATIVE_TO_SELF
,
0.0f
,
fun
slideToUp
(
view
:
View
)
{
val
slide
=
TranslateAnimation
(
Animation
.
RELATIVE_TO_SELF
,
0.0f
,
Animation
.
RELATIVE_TO_SELF
,
0.0f
,
Animation
.
RELATIVE_TO_SELF
,
1.0f
,
Animation
.
RELATIVE_TO_SELF
,
0.0f
)
1.0f
,
Animation
.
RELATIVE_TO_SELF
,
0.0f
)
slide
.
duration
=
400
slide
.
fillAfter
=
true
slide
.
isFillEnabled
=
true
...
...
@@ -35,5 +39,18 @@ class AnimUtils {
}
})
}
fun
slideToDown
(
view
:
View
?)
{
val
animation
=
TranslateAnimation
(
Animation
.
RELATIVE_TO_SELF
,
0F
,
Animation
.
RELATIVE_TO_SELF
,
0f
,
Animation
.
RELATIVE_TO_SELF
,
-
1.0f
,
Animation
.
RELATIVE_TO_SELF
,
0F
)
animation
.
duration
=
400
animation
.
repeatMode
=
Animation
.
REVERSE
animation
.
interpolator
=
AccelerateInterpolator
()
animation
.
fillAfter
=
true
view
?.
startAnimation
(
animation
)
}
}
}
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment