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
fda5f9f1
Commit
fda5f9f1
authored
May 27, 2022
by
万齐军
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: bug修改
parent
5713bcfa
Hide whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
227 additions
and
46 deletions
+227
-46
WebJavascriptHandler.kt
app/src/main/java/com/ydl/component/service/web/WebJavascriptHandler.kt
+1
-1
ConfideBottomSheetDialogFragment.kt
m-confide/src/main/java/com/ydl/confide/home/ConfideBottomSheetDialogFragment.kt
+20
-1
ConfideHomeActivity.kt
m-confide/src/main/java/com/ydl/confide/home/ConfideHomeActivity.kt
+3
-3
ConfideHomeRecommendView.kt
m-confide/src/main/java/com/ydl/confide/home/widget/ConfideHomeRecommendView.kt
+4
-19
ExpertIntroActivity.kt
m-confide/src/main/java/com/ydl/confide/intro/ExpertIntroActivity.kt
+2
-2
IntroAdapter.kt
m-confide/src/main/java/com/ydl/confide/intro/IntroAdapter.kt
+20
-0
ItemIntroHolder.kt
m-confide/src/main/java/com/ydl/confide/intro/ItemIntroHolder.kt
+3
-7
Route.kt
m-confide/src/main/modular_api/com/ydl/confide/api/Route.kt
+3
-1
confide_recommend_view_new.xml
m-confide/src/main/res/layout/confide_recommend_view_new.xml
+9
-6
item_expert_intro.xml
m-confide/src/main/res/layout/item_expert_intro.xml
+4
-1
ModularServiceManager.kt
ydl-platform/src/main/java/com/ydl/ydlcommon/modular/ModularServiceManager.kt
+9
-2
Loading.kt
ydl-platform/src/main/java/com/ydl/ydlcommon/ui/Loading.kt
+10
-3
LoadingDialogFragment2.kt
ydl-platform/src/main/java/com/ydl/ydlcommon/ui/LoadingDialogFragment2.kt
+103
-0
ic_loading.png
ydl-platform/src/main/res/drawable-xxhdpi/ic_loading.png
+0
-0
platform_fragment_loading_dialog2.xml
ydl-platform/src/main/res/layout/platform_fragment_loading_dialog2.xml
+36
-0
No files found.
app/src/main/java/com/ydl/component/service/web/WebJavascriptHandler.kt
View file @
fda5f9f1
...
...
@@ -397,7 +397,7 @@ class WebJavascriptHandler : IJavascriptHandler{
val
topActivity
=
BaseActivityMgr
.
INST
.
getTopActivity
()
if
(
topActivity
is
FragmentActivity
&&
doctorId
!=
null
&&
confideId
!=
null
)
{
val
url
=
HttpConfig
.
MH5_URL
+
ConfideRoute
.
h5ConfideIntro
(
confideId
)
findRouteService
(
IConfideService
::
class
.
java
)
?
.
showExpertDetailDialog
(
topActivity
,
url
,
doctorId
)
findRouteService
(
IConfideService
::
class
.
java
).
showExpertDetailDialog
(
topActivity
,
url
,
doctorId
)
}
}
}
...
...
m-confide/src/main/java/com/ydl/confide/home/ConfideBottomSheetDialogFragment.kt
View file @
fda5f9f1
...
...
@@ -28,6 +28,8 @@ import com.ydl.webview.TellData
import
com.ydl.webview.WebModularServiceUtils
import
com.ydl.ydlcommon.modular.findRouteService
import
com.ydl.ydlcommon.utils.TimeUtil
import
com.ydl.ydlcommon.utils.actionutil.ActionCountUtils
import
com.ydl.ydlcommon.view.dialog.CommonDialog
import
com.ydl.ydlnet.YDLHttpUtils
import
com.yidianling.common.tools.ToastUtil
import
com.yidianling.im.api.service.IImService
...
...
@@ -94,6 +96,7 @@ class ConfideBottomSheetDialogFragment : BottomSheetDialogFragment() {
override
fun
onViewCreated
(
view
:
View
,
savedInstanceState
:
Bundle
?)
{
super
.
onViewCreated
(
view
,
savedInstanceState
)
ActionCountUtils
.
record
(
"ydl_experts_detail_popupwindows_page"
,
"ydl_experts_detail_popupwindows_page_visit"
)
jumpUrl
=
arguments
?.
getString
(
KEY_JUMP_URL
)
?:
""
doctorId
=
arguments
?.
getString
(
KEY_DOCTOR_ID
)
?:
""
shouldShow
=
arguments
?.
getBoolean
(
KEY_SHOULD_SHOW
)
?:
false
...
...
@@ -144,12 +147,28 @@ class ConfideBottomSheetDialogFragment : BottomSheetDialogFragment() {
tvCall
=
itemView
.
findViewById
<
TextView
>(
R
.
id
.
tvCall
)
tvTime
=
itemView
.
findViewById
<
TextView
>(
R
.
id
.
tvTime
)
first_order
=
itemView
.
findViewById
<
TextView
>(
R
.
id
.
first_order
)
val
isLogin
=
findRouteService
(
IUserService
::
class
.
java
)
?.
isLogin
()
?:
false
val
userService
=
findRouteService
(
IUserService
::
class
.
java
)
val
isLogin
=
userService
.
isLogin
()
first_order
.
visibility
=
if
(
isLogin
)
View
.
GONE
else
View
.
VISIBLE
layoutCall
.
setOnClickListener
{
ActionCountUtils
.
record
(
"ydl_experts_detail_popupwindows_page"
,
"ydl_experts_detail_popupwindows_page_visit"
)
if
(!
PhoneCallIn
.
loginByOneKeyLogin
(
requireContext
(),
true
))
{
return
@setOnClickListener
}
//判断是否绑定手机号
if
(!
userService
.
isBindPhone
())
{
CommonDialog
(
requireContext
())
.
setMessage
(
"为了您的账号安全,请绑定手机号"
)
.
setLeftOnclick
(
"取消"
)
{
}
.
setRightClick
(
"确定"
)
{
//跳转绑定手机号页面
userService
.
wxBindToInputhonePage
(
requireActivity
())
}
.
setCancelAble
(
false
)
.
show
()
return
@setOnClickListener
}
callJsFun
(
wv_content
,
"listenCallClick()"
)
}
layoutChange
.
setOnClickListener
{
...
...
m-confide/src/main/java/com/ydl/confide/home/ConfideHomeActivity.kt
View file @
fda5f9f1
...
...
@@ -218,8 +218,8 @@ class ConfideHomeActivity : BaseLceActivity<IConfideHomeContract.View,IConfideHo
override
fun
onResume
()
{
super
.
onResume
()
//登录了回来之后就不显示了
val
isLogin
=
(
findRouteService
(
IUserService
::
class
.
java
)
?.
isLogin
())
?:
false
findViewById
<
View
>(
R
.
id
.
confide_Free
).
visibility
=
if
(
isLogin
)
View
.
GONE
else
View
.
IN
VISIBLE
val
isLogin
=
(
findRouteService
(
IUserService
::
class
.
java
)
.
isLogin
())
findViewById
<
View
>(
R
.
id
.
confide_Free
).
visibility
=
if
(
isLogin
)
View
.
GONE
else
View
.
VISIBLE
}
...
...
@@ -304,7 +304,7 @@ class ConfideHomeActivity : BaseLceActivity<IConfideHomeContract.View,IConfideHo
findViewById
<
View
>(
R
.
id
.
img_customer
)
?.
setOnClickListener
{
ActionCountUtils
.
record
(
"listen_counselor_list_page"
,
"topright_corner_icon_click"
,
"2"
)
val
imService
=
findRouteService
(
IImService
::
class
.
java
)
imService
?
.
startP2PXiaoYi
(
this
)
imService
.
startP2PXiaoYi
(
this
)
}
findViewById
<
View
>(
R
.
id
.
img_help
)
?.
setOnClickListener
{
ActionCountUtils
.
record
(
"listen_counselor_list_page"
,
"topright_corner_icon_click"
,
"3"
)
...
...
m-confide/src/main/java/com/ydl/confide/home/widget/ConfideHomeRecommendView.kt
View file @
fda5f9f1
package
com.ydl.confide.home.widget
import
android.content.Context
import
android.graphics.Color
import
android.text.TextUtils
import
android.util.TypedValue
import
android.view.Gravity
import
android.view.View
import
android.view.ViewGroup
import
android.widget.FrameLayout
import
android.widget.LinearLayout
import
android.widget.TextView
import
com.blankj.utilcode.util.SpanUtils
import
com.bumptech.glide.Glide
import
com.bumptech.glide.load.engine.DiskCacheStrategy
...
...
@@ -246,11 +241,7 @@ class ConfideHomeRecommendView(var view: IConfideHomeContract.View, context: Con
// tv_price.text = sb.toString()
// }
/**
* 设置标签 todo 待优化
*/
private
fun
setConfideTag
(
bodyBean
:
ConfideHomeBodyBean
)
{
flowlayout_tag
.
removeAllViews
()
if
(
null
==
bodyBean
.
confidedTag
||
bodyBean
.
confidedTag
.
isEmpty
())
{
return
}
...
...
@@ -261,16 +252,10 @@ class ConfideHomeRecommendView(var view: IConfideHomeContract.View, context: Con
sb
.
append
(
tag
).
append
(
" | "
)
i
++
}
sb
.
setLength
(
sb
.
length
-
3
)
val
params
=
LinearLayout
.
LayoutParams
(
ViewGroup
.
LayoutParams
.
WRAP_CONTENT
,
dp16
)
params
.
setMargins
(
0
,
0
,
dp4
,
0
)
val
textView
=
TextView
(
context
)
textView
.
setTextSize
(
TypedValue
.
COMPLEX_UNIT_SP
,
12f
)
textView
.
setTextColor
(
Color
.
parseColor
(
"#9495A0"
))
textView
.
gravity
=
Gravity
.
CENTER
textView
.
layoutParams
=
params
textView
.
text
=
sb
.
toString
()
flowlayout_tag
.
addView
(
textView
)
if
(
sb
.
length
>
3
)
{
sb
.
setLength
(
sb
.
length
-
3
)
}
flowlayout_tag
.
text
=
sb
.
toString
()
}
/**
...
...
m-confide/src/main/java/com/ydl/confide/intro/ExpertIntroActivity.kt
View file @
fda5f9f1
...
...
@@ -73,7 +73,7 @@ class ExpertIntroActivity : AppCompatActivity() {
}
if
(
initData
!=
null
)
{
val
beans
=
JSON
.
parseArray
(
initData
,
ConfideHomeBodyBean
::
class
.
java
)
val
isLogin
=
findRouteService
(
IUserService
::
class
.
java
)
?.
isLogin
()
?:
false
val
isLogin
=
findRouteService
(
IUserService
::
class
.
java
)
.
isLogin
()
val
vms
=
beans
.
map
{
VideoViewModel
().
mapOf
(
it
).
apply
{
showFreeTag
.
set
(!
isLogin
)
}
}
...
...
@@ -122,7 +122,7 @@ class ExpertIntroActivity : AppCompatActivity() {
if
(
resp
.
code
==
"200"
)
{
page
++
val
body
=
resp
.
data
.
body
val
isLogin
=
findRouteService
(
IUserService
::
class
.
java
)
?
.
isLogin
()
?:
false
val
isLogin
=
findRouteService
(
IUserService
::
class
.
java
).
isLogin
()
?:
false
val
map
=
body
?.
map
{
VideoViewModel
().
mapOf
(
it
).
apply
{
showFreeTag
.
set
(!
isLogin
)
}
}
map
?.
let
{
data
.
addAll
(
it
)
...
...
m-confide/src/main/java/com/ydl/confide/intro/IntroAdapter.kt
View file @
fda5f9f1
...
...
@@ -3,6 +3,7 @@ package com.ydl.confide.intro
import
android.app.Activity
import
android.content.Context
import
android.net.Uri
import
android.util.Log
import
android.view.LayoutInflater
import
android.view.ViewGroup
import
androidx.databinding.DataBindingUtil
...
...
@@ -16,6 +17,7 @@ import com.ydl.confide.R
import
com.ydl.confide.databinding.ItemExpertIntroBinding
import
com.ydl.confide.home.http.ConfideHomeApi
import
com.ydl.confide.home.util.ConfideNetworkUtil
import
com.ydl.ydlcommon.ui.Loading
import
com.ydl.ydlcommon.utils.TimeUtil
import
com.ydl.ydlcommon.utils.actionutil.ActionCountUtils
import
com.ydl.ydlcommon.view.dialog.CommonDialog
...
...
@@ -24,6 +26,7 @@ import com.yidianling.common.tools.ToastUtil
import
io.reactivex.android.schedulers.AndroidSchedulers
import
io.reactivex.disposables.Disposable
import
io.reactivex.schedulers.Schedulers
import
tv.danmaku.ijk.media.player.IMediaPlayer
internal
class
IntroAdapter
(
private
val
context
:
Context
,
...
...
@@ -33,6 +36,8 @@ internal class IntroAdapter(
private
val
videoViews
=
hashMapOf
<
Int
,
IjkVideoView
>()
private
val
onInfoListener
=
OnVideoInfo
()
private
var
hasAgreePlayWithoutWiFi
=
false
private
var
curPos
=
0
...
...
@@ -76,6 +81,7 @@ internal class IntroAdapter(
videoView
.
tag
=
playUrl
}
}
videoView
.
setOnInfoListener
(
onInfoListener
)
videoViews
.
put
(
adapterPosition
,
videoView
)
holder
.
onAttach
(
videoView
)
}
...
...
@@ -217,4 +223,17 @@ internal class IntroAdapter(
}
}
private
inner
class
OnVideoInfo
:
IMediaPlayer
.
OnInfoListener
{
override
fun
onInfo
(
mp
:
IMediaPlayer
?,
what
:
Int
,
extra
:
Int
):
Boolean
{
Log
.
d
(
"OnVideoInfo"
,
"OnInfo:${what},${extra},${curPos}"
)
if
(
videoViews
[
curPos
]
?.
mMediaPlayer
==
mp
&&
data
[
curPos
].
isVideo
)
{
if
(
what
==
IMediaPlayer
.
MEDIA_INFO_BUFFERING_START
)
{
Loading
.
show
(
context
)
}
else
if
(
what
==
IMediaPlayer
.
MEDIA_INFO_BUFFERING_END
)
{
Loading
.
close
()
}
}
return
true
}
}
}
\ No newline at end of file
m-confide/src/main/java/com/ydl/confide/intro/ItemIntroHolder.kt
View file @
fda5f9f1
...
...
@@ -69,7 +69,7 @@ internal class ItemIntroHolder(binding: ItemExpertIntroBinding) :
if
(
item
.
isVideo
)
"1"
else
"2"
,
"7"
)
findRouteService
(
IImService
::
class
.
java
)
?
.
startChat
(
aty
,
item
.
uid
!!
,
0
,
0
)
findRouteService
(
IImService
::
class
.
java
).
startChat
(
aty
,
item
.
uid
!!
,
0
,
0
)
}
}
binding
.
btnEvaluate
.
setOnClickListener
{
...
...
@@ -84,7 +84,7 @@ internal class ItemIntroHolder(binding: ItemExpertIntroBinding) :
ConfideBottomSheetDialogFragment
()
.
showBottomSheetDialog
(
itemView
.
context
as
FragmentActivity
,
HttpConfig
.
MH5_URL
+
ConfideRoute
.
h5ExpertEval
(
it
),
HttpConfig
.
MH5_URL
+
ConfideRoute
.
h5ExpertEval
(
it
,
item
.
confideId
?:
""
),
it
)
}
...
...
@@ -227,10 +227,6 @@ internal class ItemIntroHolder(binding: ItemExpertIntroBinding) :
binding
.
seekbar
.
visibility
=
View
.
GONE
}
}
video
?.
setOnInfoListener
{
mp
,
what
,
extra
->
Log
.
d
(
TAG
,
"OnInfo:${what},${extra}"
)
return
@setOnInfoListener
true
}
video
?.
setOnCompletionListener
{
video
?.
seekTo
(
0
)
video
?.
start
()
...
...
@@ -317,7 +313,7 @@ internal fun VideoViewModel.mapOf(bean: ConfideHomeBodyBean): VideoViewModel {
title
.
set
(
bean
.
title
)
val
sb
=
StringBuilder
()
bean
.
confidedTag
?.
forEach
{
sb
.
append
(
it
).
append
(
" | "
)
}
if
(
sb
.
isNotEmpty
()
)
{
if
(
sb
.
length
>
3
)
{
sb
.
setLength
(
sb
.
length
-
3
)
}
tag
.
set
(
sb
.
toString
())
...
...
m-confide/src/main/modular_api/com/ydl/confide/api/Route.kt
View file @
fda5f9f1
...
...
@@ -7,5 +7,6 @@ object ConfideRoute {
fun
h5ConfideIntro
(
id
:
String
)
=
"jy/listenMask?listenerId=${id}"
fun
h5ExpertEval
(
id
:
String
)
=
"comment/evaList/${id}?listenerId=${id}&fromVideo=1"
fun
h5ExpertEval
(
doctorId
:
String
,
confideId
:
String
)
=
"comment/evaList/${doctorId}?listenerId=${confideId}&fromVideo=1"
}
\ No newline at end of file
m-confide/src/main/res/layout/confide_recommend_view_new.xml
View file @
fda5f9f1
...
...
@@ -147,15 +147,18 @@
/>
</LinearLayout>
</LinearLayout>
<LinearLayout
<TextView
android:id=
"@+id/flowlayout_tag"
android:orientation=
"horizontal"
android:layout_width=
"wrap_content"
android:layout_width=
"0dp"
android:layout_height=
"16dp"
app:layout_constraintStart_toEndOf=
"@id/img_bg"
android:layout_marginStart=
"14dp"
app:layout_constraintBottom_toBottomOf=
"@id/img_bg"
/>
android:layout_marginEnd=
"12dp"
android:textColor=
"#9495A0"
android:textSize=
"12sp"
app:layout_constraintBottom_toBottomOf=
"@+id/img_bg"
app:layout_constraintEnd_toStartOf=
"@+id/price_content"
app:layout_constraintStart_toEndOf=
"@+id/img_bg"
/>
<TextView
android:id=
"@+id/price_content"
...
...
m-confide/src/main/res/layout/item_expert_intro.xml
View file @
fda5f9f1
...
...
@@ -66,6 +66,7 @@
android:id=
"@+id/vDisableClick"
android:layout_width=
"0dp"
android:layout_height=
"0dp"
android:background=
"@drawable/bg_expert_video_bottom_cover"
app:layout_constraintBottom_toBottomOf=
"parent"
app:layout_constraintLeft_toLeftOf=
"parent"
app:layout_constraintRight_toRightOf=
"parent"
...
...
@@ -163,6 +164,7 @@
android:layout_marginLeft=
"12dp"
android:layout_marginRight=
"40dp"
android:layout_marginBottom=
"60dp"
android:maxLines=
"1"
android:text=
"@{item.tag}"
android:textColor=
"#99FFFFFF"
android:textSize=
"13sp"
...
...
@@ -177,6 +179,7 @@
android:layout_height=
"wrap_content"
android:layout_marginRight=
"40dp"
android:layout_marginBottom=
"8dp"
android:maxLines=
"3"
android:text=
"@{item.intro}"
android:textColor=
"@color/white"
android:textSize=
"15sp"
...
...
@@ -202,11 +205,11 @@
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginLeft=
"8dp"
android:layout_marginBottom=
"1dp"
android:text=
"@{item.count}"
android:textColor=
"@color/white"
android:textSize=
"13sp"
app:layout_constraintBottom_toBottomOf=
"@+id/tvName"
android:layout_marginBottom=
"1dp"
app:layout_constraintLeft_toRightOf=
"@+id/tvName"
tools:text=
"tag|tag|tag"
/>
...
...
ydl-platform/src/main/java/com/ydl/ydlcommon/modular/ModularServiceManager.kt
View file @
fda5f9f1
...
...
@@ -5,6 +5,7 @@ import android.os.Bundle
import
android.os.Parcelable
import
com.alibaba.android.arouter.facade.template.IProvider
import
com.alibaba.android.arouter.launcher.ARouter
import
com.ydl.ydlcommon.BuildConfig
import
com.ydl.ydlcommon.utils.LogUtil
...
...
@@ -12,8 +13,14 @@ import com.ydl.ydlcommon.utils.LogUtil
* Created by haorui on 2019-09-21 .
* Des:查找 Arouter 服务封装类
*/
fun
<
T
>
findRouteService
(
clz
:
Class
<
T
>):
T
?
=
ARouter
.
getInstance
().
navigation
(
clz
)
fun
<
T
>
findRouteService
(
clz
:
Class
<
T
>):
T
{
val
service
=
ARouter
.
getInstance
().
navigation
(
clz
)
if
(
service
!=
null
)
return
service
if
(
BuildConfig
.
DEBUG
)
{
throw
IllegalStateException
(
"check module dependency by [${clz.simpleName}]"
)
}
return
service
}
fun
route
(
context
:
Context
?,
route
:
String
,
vararg
params
:
Pair
<
String
,
Any
?>)
{
...
...
ydl-platform/src/main/java/com/ydl/ydlcommon/ui/Loading.kt
View file @
fda5f9f1
...
...
@@ -7,18 +7,25 @@ import androidx.fragment.app.FragmentActivity
object
Loading
{
private
var
loadingDialogFragment
:
DialogFragment
?
=
null
fun
show
(
context
:
Context
?)
{
fun
show
(
context
:
Context
?,
msg
:
String
?
=
null
)
{
if
(
context
!
is
FragmentActivity
)
return
if
(
loadingDialogFragment
==
null
)
{
loadingDialogFragment
=
LoadingDialogFragment
.
newInstance
(
null
)
loadingDialogFragment
=
LoadingDialogFragment
2
.
newInstance
(
msg
)
}
if
(
loadingDialogFragment
?.
isAdded
!!
)
{
return
}
loadingDialogFragment
?.
show
(
context
.
supportFragmentManager
,
Loading
::
class
.
java
.
simpleName
)
// if (Looper.myLooper() == Looper.getMainLooper()) {
loadingDialogFragment
?.
show
(
context
.
supportFragmentManager
,
Loading
::
class
.
java
.
simpleName
)
// } else
// context.runOnUiThread {
// loadingDialogFragment?.show(context.supportFragmentManager, Loading::class.java.simpleName)
// }
}
fun
close
()
{
loadingDialogFragment
?.
dismissAllowingStateLoss
()
}
...
...
ydl-platform/src/main/java/com/ydl/ydlcommon/ui/LoadingDialogFragment2.kt
0 → 100644
View file @
fda5f9f1
package
com.ydl.ydlcommon.ui
import
android.animation.ObjectAnimator
import
android.animation.ValueAnimator
import
android.os.Bundle
import
android.text.TextUtils
import
android.view.LayoutInflater
import
android.view.View
import
android.view.ViewGroup
import
android.view.Window
import
androidx.fragment.app.DialogFragment
import
androidx.fragment.app.Fragment
import
androidx.fragment.app.FragmentManager
import
com.ydl.ydlcommon.R
import
kotlinx.android.synthetic.main.platform_fragment_loading_dialog.view.*
/**
* A simple [Fragment] subclass.
* Use the [LoadingDialogFragment2.newInstance] factory method to
* create an instance of this fragment.
*/
class
LoadingDialogFragment2
:
DialogFragment
()
{
private
var
msg
:
String
?
=
null
override
fun
onCreate
(
savedInstanceState
:
Bundle
?)
{
super
.
onCreate
(
savedInstanceState
)
msg
=
arguments
?.
getString
(
ARG_MSG
)
}
override
fun
onCreateView
(
inflater
:
LayoutInflater
,
container
:
ViewGroup
?,
savedInstanceState
:
Bundle
?
):
View
?
{
// Inflate the layout for this fragment
dialog
?.
requestWindowFeature
(
Window
.
FEATURE_NO_TITLE
)
return
inflater
.
inflate
(
R
.
layout
.
platform_fragment_loading_dialog2
,
container
,
false
)
}
override
fun
onViewCreated
(
view
:
View
,
savedInstanceState
:
Bundle
?)
{
super
.
onViewCreated
(
view
,
savedInstanceState
)
startAnim
(
view
)
if
(!
TextUtils
.
isEmpty
(
msg
))
{
view
.
tvMsg
.
text
=
msg
}
else
{
view
.
tvMsg
.
visibility
=
View
.
GONE
}
}
override
fun
onStart
()
{
super
.
onStart
()
dialog
?.
window
?.
setBackgroundDrawable
(
null
)
val
dp100
=
(
resources
.
displayMetrics
.
density
*
100
).
toInt
()
dialog
?.
window
?.
setLayout
(
dp100
,
dp100
)
dialog
?.
window
?.
setDimAmount
(
0F
)
}
private
fun
startAnim
(
view
:
View
)
{
val
ivLoading
=
view
.
findViewById
<
View
>(
R
.
id
.
ivLoading
)
val
anim
=
ObjectAnimator
.
ofFloat
(
ivLoading
,
"rotation"
,
0F
,
360F
)
anim
.
duration
=
1000
anim
.
repeatMode
=
ValueAnimator
.
RESTART
anim
.
repeatCount
=
ValueAnimator
.
INFINITE
anim
.
start
()
}
companion
object
{
private
val
ARG_MSG
=
"arg_msg"
/**
* Use this factory method to create a new instance of
* this fragment using the provided parameters.
*
* @param msg 要显示的信息.
* @return LoadingDialogFragment 实例
*/
fun
newInstance
(
msg
:
String
?):
LoadingDialogFragment2
{
val
fragment
=
LoadingDialogFragment2
()
val
args
=
Bundle
()
args
.
putString
(
ARG_MSG
,
msg
)
fragment
.
arguments
=
args
return
fragment
}
}
override
fun
show
(
manager
:
FragmentManager
,
tag
:
String
?)
{
try
{
//在每个add事务前增加一个remove事务,防止连续的add
manager
.
beginTransaction
().
remove
(
this
).
commitAllowingStateLoss
()
super
.
show
(
manager
,
tag
)
}
catch
(
e
:
Exception
)
{
//同一实例使用不同的tag会异常,这里捕获一下
e
.
printStackTrace
()
}
}
fun
hide
()
{
dismissAllowingStateLoss
()
}
}
ydl-platform/src/main/res/drawable-xxhdpi/ic_loading.png
0 → 100644
View file @
fda5f9f1
1.87 KB
ydl-platform/src/main/res/layout/platform_fragment_loading_dialog2.xml
0 → 100644
View file @
fda5f9f1
<?xml version="1.0" encoding="utf-8" ?>
<androidx.cardview.widget.CardView
xmlns:android=
"http://schemas.android.com/apk/res/android"
xmlns:app=
"http://schemas.android.com/apk/res-auto"
xmlns:tools=
"http://schemas.android.com/tools"
android:layout_width=
"100dp"
android:layout_height=
"100dp"
app:cardBackgroundColor=
"#66000000"
app:cardElevation=
"0dp"
app:contentPadding=
"0dp"
app:cardCornerRadius=
"8dp"
>
<LinearLayout
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_gravity=
"center"
android:gravity=
"center"
android:orientation=
"vertical"
>
<ImageView
android:id=
"@+id/ivLoading"
android:layout_width=
"32dp"
android:layout_height=
"32dp"
android:src=
"@drawable/ic_loading"
/>
<TextView
android:id=
"@+id/tvMsg"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginTop=
"18dp"
android:textColor=
"@color/white"
android:textSize=
"17sp"
tools:text=
"@string/platform_dialog_loading"
/>
</LinearLayout>
</androidx.cardview.widget.CardView>
\ 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