Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
A
android_goodmoney
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
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
android
android_goodmoney
Commits
7406fb00
Commit
7406fb00
authored
Dec 24, 2020
by
mengcuiguang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
优化xmly
parent
35754964
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
22 additions
and
26 deletions
+22
-26
XmlyActivity.kt
...ain/java/com/mints/goodmoney/ui/activitys/XmlyActivity.kt
+2
-2
XmlyPageAdapter.kt
...in/java/com/mints/goodmoney/ui/adapter/XmlyPageAdapter.kt
+1
-1
XmlyFragment.kt
...main/java/com/mints/goodmoney/ui/fragment/XmlyFragment.kt
+18
-22
XmlyPageFragment.kt
.../java/com/mints/goodmoney/ui/fragment/XmlyPageFragment.kt
+1
-1
No files found.
GoodMoney/app/src/main/java/com/mints/goodmoney/ui/activitys/XmlyActivity.kt
View file @
7406fb00
...
...
@@ -59,8 +59,8 @@ class XmlyActivity : BaseActivity(), View.OnClickListener {
// 如果不想使用sdk内部搞好的notification,或者想自建notification 可以使用下面的 init()函数进行初始化
mPlayerManager
.
init
(
System
.
currentTimeMillis
().
toInt
(),
mNotification
)
//
mPlayerManager.addPlayerStatusListener(mPlayerStatusListener)
//
mPlayerManager.addAdsStatusListener(mAdsListener)
mPlayerManager
.
addPlayerStatusListener
(
mPlayerStatusListener
)
mPlayerManager
.
addAdsStatusListener
(
mAdsListener
)
mPlayerManager
.
addOnConnectedListerner
(
object
:
XmPlayerManager
.
IConnectListener
{
override
fun
onConnected
()
{
mPlayerManager
.
removeOnConnectedListerner
(
this
)
...
...
GoodMoney/app/src/main/java/com/mints/goodmoney/ui/adapter/XmlyPageAdapter.kt
View file @
7406fb00
...
...
@@ -35,7 +35,7 @@ class XmlyPageAdapter(val xmlyPageList: MutableList<Album>) :
val
album
=
xmlyPageList
[
position
]
holder
.
tvXmlyPageContent
.
text
=
album
.
recommendReason
holder
.
tvXmlyPagecount
.
text
=
album
.
playCount
.
toString
()
GlideUtils
.
loadImageView
(
holder
.
itemView
.
context
,
album
.
coverUrl
Middl
e
,
holder
.
ivXmlyPage
)
GlideUtils
.
loadImageView
(
holder
.
itemView
.
context
,
album
.
coverUrl
Larg
e
,
holder
.
ivXmlyPage
)
holder
.
itemView
.
setOnClickListener
{
if
(
::
mOnItemClickListener
.
isInitialized
)
{
...
...
GoodMoney/app/src/main/java/com/mints/goodmoney/ui/fragment/XmlyFragment.kt
View file @
7406fb00
...
...
@@ -13,6 +13,9 @@ import com.ximalaya.ting.android.opensdk.datatrasfer.CommonRequest
import
com.ximalaya.ting.android.opensdk.datatrasfer.IDataCallBack
import
com.ximalaya.ting.android.opensdk.model.category.CategoryList
import
kotlinx.android.synthetic.main.fragment_main_xmly.*
import
java.util.*
import
kotlin.collections.ArrayList
import
kotlin.concurrent.schedule
/**
* 描述:喜马拉雅
...
...
@@ -20,11 +23,6 @@ import kotlinx.android.synthetic.main.fragment_main_xmly.*
*/
class
XmlyFragment
:
LazyLoadBaseFragment
()
{
// 听书分类数据
private
var
mCategoryList
:
CategoryList
?
=
null
private
var
mCurrentIndex
=
0
override
fun
getContentViewLayoutID
()
=
R
.
layout
.
fragment_main_xmly
override
fun
initViewsAndEvents
()
{
...
...
@@ -33,20 +31,17 @@ class XmlyFragment : LazyLoadBaseFragment() {
override
fun
onFragmentFirstVisible
()
{
super
.
onFragmentFirstVisible
()
showLoading
(
"加载中..."
)
loadData
()
}
private
fun
loadData
()
{
showLoading
(
"加载中..."
)
// 获取分类数据
val
vo
=
hashMapOf
<
String
,
String
>()
CommonRequest
.
getCategories
(
vo
,
object
:
IDataCallBack
<
CategoryList
>
{
override
fun
onSuccess
(
p0
:
CategoryList
?)
{
hideLoading
()
mCategoryList
=
p0
initView
()
initViewAndData
(
p0
)
}
override
fun
onError
(
p0
:
Int
,
p1
:
String
?)
{
...
...
@@ -57,22 +52,24 @@ class XmlyFragment : LazyLoadBaseFragment() {
})
}
override
fun
onFragmentResume
()
{
super
.
onFragmentResume
()
if
(
AppConfig
.
fragmentClickFlag
==
Constant
.
FRAGMENT_CLICK_MAIN
)
{
loadData
()
}
}
private
fun
initView
()
{
mCategoryList
?.
let
{
private
fun
initViewAndData
(
categoryList
:
CategoryList
?)
{
categoryList
?.
let
{
val
tabs
:
MutableList
<
String
>
=
ArrayList
()
val
fragments
:
MutableList
<
Fragment
>
=
ArrayList
()
for
(
i
in
0
until
it
.
categories
.
size
)
{
var
tempPageSize
=
8
if
(
it
.
categories
.
size
<
8
)
{
tempPageSize
=
it
.
categories
.
size
}
for
(
i
in
0
until
tempPageSize
)
{
tabs
.
add
(
it
.
categories
[
i
].
categoryName
)
fragments
.
add
(
XmlyPageFragment
(
it
.
categories
[
i
].
id
))
}
Timer
().
schedule
(
600
){
hideLoading
()
}
//去除两侧应阴影
xtFragmentXmly
.
overScrollMode
=
ViewPager
.
OVER_SCROLL_NEVER
vpFragmentXmly
.
offscreenPageLimit
=
tabs
.
size
+
3
...
...
@@ -81,6 +78,5 @@ class XmlyFragment : LazyLoadBaseFragment() {
xtFragmentXmly
.
setxTabDisplayNum
(
tabs
.
size
)
xtFragmentXmly
.
setupWithViewPager
(
vpFragmentXmly
)
}
}
}
\ No newline at end of file
GoodMoney/app/src/main/java/com/mints/goodmoney/ui/fragment/XmlyPageFragment.kt
View file @
7406fb00
...
...
@@ -39,7 +39,6 @@ class XmlyPageFragment(private val categoryId: Long) : LazyLoadBaseFragment(),
override
fun
getContentViewLayoutID
()
=
R
.
layout
.
fragment_main_xmly_page
override
fun
initViewsAndEvents
()
{
loadData
()
}
private
fun
loadData
()
{
...
...
@@ -74,6 +73,7 @@ class XmlyPageFragment(private val categoryId: Long) : LazyLoadBaseFragment(),
super
.
onFragmentFirstVisible
()
initRvView
()
loadData
()
initListener
()
}
...
...
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