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
50554031
Commit
50554031
authored
Jan 08, 2021
by
jyx
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
每日任务进度条显示逻辑修改
parent
3bef1432
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
1 addition
and
430 deletions
+1
-430
AndroidManifest.xml
GoodMoney/app/src/main/AndroidManifest.xml
+0
-3
XmlyActivity.kt
...ain/java/com/mints/goodmoney/ui/activitys/XmlyActivity.kt
+0
-371
MainMyAdapter.kt
...main/java/com/mints/goodmoney/ui/adapter/MainMyAdapter.kt
+1
-1
activity_xmly_test.xml
GoodMoney/app/src/main/res/layout/activity_xmly_test.xml
+0
-55
No files found.
GoodMoney/app/src/main/AndroidManifest.xml
View file @
50554031
...
...
@@ -217,9 +217,6 @@
<activity
android:name=
".ui.activitys.XmlyPlayActivity"
android:screenOrientation=
"portrait"
/>
<activity
android:name=
".ui.activitys.XmlyActivity"
android:screenOrientation=
"portrait"
/>
<activity
android:name=
".ui.activitys.KylVedioActivity"
android:configChanges=
"orientation|screenSize|keyboardHidden"
...
...
GoodMoney/app/src/main/java/com/mints/goodmoney/ui/activitys/XmlyActivity.kt
deleted
100644 → 0
View file @
3bef1432
package
com.mints.goodmoney.ui.activitys
import
android.os.Bundle
import
android.util.Log
import
android.view.View
import
android.widget.Toast
import
com.fly.scenemodule.util.GsonUtils
import
com.mints.goodmoney.R
import
com.mints.goodmoney.ui.activitys.base.BaseActivity
import
com.mints.goodmoney.ui.adapter.XmlyPlayAdapter
import
com.mints.goodmoney.utils.LogUtil
import
com.ximalaya.ting.android.opensdk.constants.DTransferConstants
import
com.ximalaya.ting.android.opensdk.datatrasfer.CommonRequest
import
com.ximalaya.ting.android.opensdk.datatrasfer.IDataCallBack
import
com.ximalaya.ting.android.opensdk.model.PlayableModel
import
com.ximalaya.ting.android.opensdk.model.advertis.Advertis
import
com.ximalaya.ting.android.opensdk.model.advertis.AdvertisList
import
com.ximalaya.ting.android.opensdk.model.album.AlbumList
import
com.ximalaya.ting.android.opensdk.model.category.CategoryList
import
com.ximalaya.ting.android.opensdk.model.live.radio.Radio
import
com.ximalaya.ting.android.opensdk.model.live.schedule.Schedule
import
com.ximalaya.ting.android.opensdk.model.track.Track
import
com.ximalaya.ting.android.opensdk.model.track.TrackList
import
com.ximalaya.ting.android.opensdk.player.XmPlayerManager
import
com.ximalaya.ting.android.opensdk.player.advertis.IXmAdsStatusListener
import
com.ximalaya.ting.android.opensdk.player.appnotification.XmNotificationCreater
import
com.ximalaya.ting.android.opensdk.player.service.IXmPlayerStatusListener
import
com.ximalaya.ting.android.opensdk.player.service.XmPlayListControl
import
com.ximalaya.ting.android.opensdk.player.service.XmPlayerException
import
kotlinx.android.synthetic.main.activity_xmly_test.*
import
kotlinx.android.synthetic.main.header_layout.*
/**
* 描述:关于我们
* 作者:孟崔广
* 时间:2020/9/23 18:39
*/
class
XmlyActivity
:
BaseActivity
(),
View
.
OnClickListener
{
private
val
TAG
=
XmlyActivity
::
class
.
java
.
simpleName
private
var
mCategoryList
:
CategoryList
?
=
null
private
var
mTrackList
:
TrackList
?
=
null
private
lateinit
var
mPlayerManager
:
XmPlayerManager
private
val
mUpdateProgress
=
true
private
lateinit
var
xmlyPlayAdapter
:
XmlyPlayAdapter
private
var
xmlyData
:
MutableList
<
Track
>
=
mutableListOf
()
// 分页
private
var
xmlyPage
=
1
private
val
PAGE_SIZE
=
10
override
fun
getContentViewLayoutID
()
=
R
.
layout
.
activity_xmly_play
override
fun
isApplyKitKatTranslucency
()
=
false
private
var
mAlbumId
=
0L
companion
object
{
const
val
ALBUM_ID
=
"album_id"
}
override
fun
getBundleExtras
(
extras
:
Bundle
)
{
mAlbumId
=
extras
.
getLong
(
ALBUM_ID
)
}
override
fun
initViewsAndEvents
()
{
tv_title
.
text
=
"喜马拉雅测试"
iv_left_icon
.
visibility
=
View
.
VISIBLE
iv_left_icon
.
setImageResource
(
R
.
mipmap
.
ic_arrow_back
)
mPlayerManager
=
XmPlayerManager
.
getInstance
(
this
)
val
mNotification
=
XmNotificationCreater
.
getInstanse
(
this
)
.
initNotification
(
this
.
applicationContext
,
XmlyActivity
::
class
.
java
)
// 如果之前贵方使用了 `XmPlayerManager.init(int id, Notification notification)` 这个初始化的方式
// 请参考`4.8 播放器通知栏使用`重新添加新的通知栏布局,否则直接升级可能导致在部分手机播放时崩溃
// 如果不想使用sdk内部搞好的notification,或者想自建notification 可以使用下面的 init()函数进行初始化
mPlayerManager
.
init
(
System
.
currentTimeMillis
().
toInt
(),
mNotification
)
mPlayerManager
.
addPlayerStatusListener
(
mPlayerStatusListener
)
mPlayerManager
.
addAdsStatusListener
(
mAdsListener
)
mPlayerManager
.
addOnConnectedListerner
(
object
:
XmPlayerManager
.
IConnectListener
{
override
fun
onConnected
()
{
mPlayerManager
.
removeOnConnectedListerner
(
this
)
mPlayerManager
.
setPlayMode
(
XmPlayListControl
.
PlayMode
.
PLAY_MODEL_LIST_LOOP
)
Toast
.
makeText
(
this
@XmlyActivity
,
"播放器初始化成功"
,
Toast
.
LENGTH_SHORT
).
show
()
}
})
initListener
()
}
override
fun
onClick
(
v
:
View
?)
{
when
(
v
?.
id
)
{
R
.
id
.
iv_left_icon
->
finish
()
R
.
id
.
btn1
->
{
val
vo
=
hashMapOf
<
String
,
String
>()
CommonRequest
.
getCategories
(
vo
,
object
:
IDataCallBack
<
CategoryList
>
{
override
fun
onSuccess
(
p0
:
CategoryList
?)
{
mCategoryList
=
p0
}
override
fun
onError
(
p0
:
Int
,
p1
:
String
?)
{
LogUtil
.
e
(
p1
)
}
})
}
R
.
id
.
btn2
->
{
val
vo
=
hashMapOf
<
String
,
String
>()
vo
[
DTransferConstants
.
CATEGORY_ID
]
=
"12"
vo
[
DTransferConstants
.
CALC_DIMENSION
]
=
"1"
vo
[
DTransferConstants
.
PAGE
]
=
"1"
vo
[
"count"
]
=
"10"
CommonRequest
.
getAlbumList
(
vo
,
object
:
IDataCallBack
<
AlbumList
>
{
override
fun
onSuccess
(
p0
:
AlbumList
?)
{
val
toJson
=
GsonUtils
.
toJson
(
p0
)
LogUtil
.
d
(
toJson
)
}
override
fun
onError
(
p0
:
Int
,
p1
:
String
?)
{
LogUtil
.
e
(
p1
)
}
})
}
R
.
id
.
btn3
->
{
val
vo
=
hashMapOf
<
String
,
String
>()
// vo[DTransferConstants.ALBUM_ID] = "4519297"
// vo[DTransferConstants.SORT] = "asc"
// vo[DTransferConstants.PAGE] = "1"
// vo["count"] = "200"
vo
[
DTransferConstants
.
ALBUM_ID
]
=
mAlbumId
.
toString
()
vo
[
DTransferConstants
.
PAGE
]
=
"1"
vo
[
DTransferConstants
.
PAGE_SIZE
]
=
"20"
CommonRequest
.
getTracks
(
vo
,
object
:
IDataCallBack
<
TrackList
>
{
override
fun
onSuccess
(
p0
:
TrackList
?)
{
val
toJson
=
GsonUtils
.
toJson
(
p0
)
// val fromJson = GsonUtils.fromJson<TrackList>(json, TrackList::class.java)
// mTrackList = fromJson
LogUtil
.
d
(
toJson
)
if
(
p0
!=
null
&&
p0
.
getTracks
()
!=
null
&&
p0
.
getTracks
().
size
!=
0
)
{
if
(
mTrackList
==
null
)
{
mTrackList
=
p0
}
else
{
mTrackList
?.
getTracks
()
?.
addAll
(
p0
.
getTracks
())
}
}
println
(
"MainFragmentActivity.mTrackList === $mTrackList"
)
}
override
fun
onError
(
p0
:
Int
,
p1
:
String
?)
{
LogUtil
.
e
(
p1
)
}
})
}
R
.
id
.
btn4
->
{
mTrackList
?.
let
{
mPlayerManager
.
playList
(
it
.
tracks
,
0
)
val
playList
=
XmPlayerManager
.
getInstance
(
this
).
playList
LogUtil
.
d
(
"MainFragmentActivity.onOptionsItemSelected === $playList"
)
}
}
R
.
id
.
btn5
->
{
// val track = Track()
//
// track.kind = PlayableModel.KIND_TRACK
// track.downloadedSaveFilePath = Environment.getExternalStorageDirectory().absolutePath + File.separator + "a.mp3"
// LogUtil.d("AAAAAAAAAA" + track.downloadedSaveFilePath)
// track.trackTitle = "a.mp3"
// track.dataId = (-1 * track.trackTitle.hashCode()).toLong()
// val tarcks = arrayListOf<Track>()
// tarcks.add(track)
if
(
mTrackList
!=
null
&&
mTrackList
!!
.
tracks
!=
null
)
{
mPlayerManager
.
playList
(
mTrackList
!!
.
tracks
,
1
)
}
// val playList = XmPlayerManager.getInstance(mContext).playList
// println("MainFragmentActivity.onOptionsItemSelected === $playList")
}
}
}
private
val
mAdsListener
:
IXmAdsStatusListener
=
object
:
IXmAdsStatusListener
{
override
fun
onStartPlayAds
(
ad
:
Advertis
,
position
:
Int
)
{
Log
.
i
(
TAG
,
"onStartPlayAds, Ad:"
+
ad
.
name
+
", pos:"
+
position
)
// if (ad != null) {
// x.image().bind(mSoundCover ,ad.getImageUrl());
// }
// mBtnPlay.setEnabled(true)
// mBtnPlay.setImageResource(R.drawable.widget_pause_normal)
}
override
fun
onStartGetAdsInfo
()
{
Log
.
i
(
TAG
,
"onStartGetAdsInfo"
)
// mBtnPlay.setEnabled(false)
// mSeekBar.setEnabled(false)
}
override
fun
onGetAdsInfo
(
ads
:
AdvertisList
)
{
Log
.
i
(
TAG
,
"onError what:${ads.msg}, extra:${ads.msg}"
)
}
override
fun
onError
(
what
:
Int
,
extra
:
Int
)
{
Log
.
i
(
TAG
,
"onError what:$what, extra:$extra"
)
}
override
fun
onCompletePlayAds
()
{
Log
.
i
(
TAG
,
"onCompletePlayAds"
)
// mBtnPlay.setEnabled(true)
// mSeekBar.setEnabled(true)
// val model = mPlayerManager.currSound
// if (model != null && model is Track) {
// x.image().bind(mSoundCover, model.coverUrlLarge)
// }
}
override
fun
onAdsStopBuffering
()
{
Log
.
i
(
TAG
,
"onAdsStopBuffering"
)
}
override
fun
onAdsStartBuffering
()
{
Log
.
i
(
TAG
,
"onAdsStartBuffering"
)
}
}
private
val
mPlayerStatusListener
:
IXmPlayerStatusListener
=
object
:
IXmPlayerStatusListener
{
override
fun
onSoundPrepared
()
{
Log
.
i
(
TAG
,
"onSoundPrepared"
)
// mSeekBar.setEnabled(true)
// mProgress.setVisibility(View.GONE)
}
override
fun
onSoundSwitch
(
laModel
:
PlayableModel
?,
curModel
:
PlayableModel
?)
{
Log
.
i
(
TAG
,
"onSoundSwitch index:$curModel"
)
// val model = mPlayerManager.currSound
// if (model != null) {
// var title: String? = null
// var coverUrl: String? = null
// if (model is Track) {
// val info = model
// title = info.trackTitle
// coverUrl = info.coverUrlLarge
// } else if (model is Schedule) {
// val program = model
// title = program.relatedProgram.programName
// coverUrl = program.relatedProgram.backPicUrl
// } else if (model is Radio) {
// val radio = model
// title = radio.radioName
// coverUrl = radio.coverUrlLarge
// }
// mTextView.setText(title)
// x.image().bind(mSoundCover, coverUrl)
// }
// updateButtonStatus()
}
private
fun
updateButtonStatus
()
{
// if (mPlayerManager.hasPreSound()) {
// mBtnPreSound.setEnabled(true)
// } else {
// mBtnPreSound.setEnabled(false)
// }
// if (mPlayerManager.hasNextSound()) {
// mBtnNextSound.setEnabled(true)
// } else {
// mBtnNextSound.setEnabled(false)
// }
}
override
fun
onPlayStop
()
{
Log
.
i
(
TAG
,
"onPlayStop"
)
// mBtnPlay.setImageResource(R.drawable.widget_play_normal)
}
override
fun
onPlayStart
()
{
Log
.
i
(
TAG
,
"onPlayStart"
)
// mBtnPlay.setImageResource(R.drawable.widget_pause_normal)
}
override
fun
onPlayProgress
(
currPos
:
Int
,
duration
:
Int
)
{
var
title
:
String
?
=
""
val
info
=
mPlayerManager
.
currSound
if
(
info
!=
null
)
{
if
(
info
is
Track
)
{
title
=
info
.
trackTitle
}
else
if
(
info
is
Schedule
)
{
title
=
info
.
relatedProgram
.
programName
}
else
if
(
info
is
Radio
)
{
title
=
info
.
radioName
}
}
// mTextView.setText(title)
// mTime.setText("[" + ToolUtil.formatTime(currPos).toString() + "/" + ToolUtil.formatTime(duration).toString() + "]")
// if (mUpdateProgress && duration != 0) {
// mSeekBar.setProgress((100 * currPos / duration.toFloat()).toInt())
// }
// if (info is Track) {
// println("MainFragmentActivity.onPlayProgress " + currPos + " " + duration + " " + info.duration)
// }
}
override
fun
onPlayPause
()
{
Log
.
i
(
TAG
,
"onPlayPause"
)
// mBtnPlay.setImageResource(R.drawable.widget_play_normal)
}
override
fun
onSoundPlayComplete
()
{
Log
.
i
(
TAG
,
"onSoundPlayComplete"
)
// Toast.makeText(this@MainFragmentActivity, "播放完成", Toast.LENGTH_SHORT).show()
// mBtnPlay.setImageResource(R.drawable.widget_play_normal)
}
override
fun
onError
(
exception
:
XmPlayerException
):
Boolean
{
Log
.
i
(
TAG
,
"XmPlayerException = onError "
+
exception
.
message
+
" "
+
XmPlayerManager
.
getInstance
(
this
@XmlyActivity
).
isPlaying
)
// println("MainFragmentActivity.onError $exception")
// mBtnPlay.setImageResource(R.drawable.widget_play_normal)
// if (!NetworkType.isConnectTONetWork(mContext)) {
// Toast.makeText(this@MainFragmentActivity, "没有网络导致停止播放", Toast.LENGTH_SHORT).show()
// }
return
false
}
override
fun
onBufferProgress
(
position
:
Int
)
{
// mSeekBar.setSecondaryProgress(position)
// println("MainFragmentActivity.onBufferProgress $position")
}
override
fun
onBufferingStart
()
{
Log
.
i
(
TAG
,
"onBufferingStart "
+
XmPlayerManager
.
getInstance
(
this
@XmlyActivity
).
isPlaying
)
// mSeekBar.setEnabled(false)
// mProgress.setVisibility(View.VISIBLE)
}
override
fun
onBufferingStop
()
{
Log
.
i
(
TAG
,
"onBufferingStop"
)
// mSeekBar.setEnabled(true)
// mProgress.setVisibility(View.GONE)
}
}
override
fun
onDestroy
()
{
if
(
mPlayerManager
!=
null
)
{
mPlayerManager
.
removePlayerStatusListener
(
mPlayerStatusListener
)
}
XmPlayerManager
.
release
()
CommonRequest
.
release
()
super
.
onDestroy
()
}
private
fun
initListener
()
{
iv_left_icon
.
setOnClickListener
(
this
)
btn1
.
setOnClickListener
(
this
)
btn2
.
setOnClickListener
(
this
)
btn3
.
setOnClickListener
(
this
)
btn4
.
setOnClickListener
(
this
)
btn5
.
setOnClickListener
(
this
)
}
}
GoodMoney/app/src/main/java/com/mints/goodmoney/ui/adapter/MainMyAdapter.kt
View file @
50554031
...
...
@@ -124,7 +124,7 @@ class MainMyAdapter(context: Context, taskData: MutableList<MyInfo.AutoListBean>
// 进度条
if
(
taskBean
.
otherConfig
!=
null
)
{
if
(
taskBean
.
baseConfig
!=
null
)
{
if
(
taskBean
.
baseConfig
!=
null
&&
taskBean
.
otherConfig
.
max
!=
0
)
{
holder
.
itemTaskPb
.
visibility
=
View
.
VISIBLE
holder
.
itemTaskPb
.
progress
=
taskBean
.
otherConfig
.
complete
holder
.
itemTaskPb
.
max
=
taskBean
.
otherConfig
.
max
...
...
GoodMoney/app/src/main/res/layout/activity_xmly_test.xml
deleted
100644 → 0
View file @
3bef1432
<?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/white"
android:orientation=
"vertical"
>
<include
layout=
"@layout/header_layout"
/>
<com.mints.goodmoney.ui.widgets.ElasticScrollView
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:fillViewport=
"true"
android:overScrollMode=
"never"
>
<LinearLayout
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:orientation=
"vertical"
>
<Button
android:id=
"@+id/btn1"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:text=
"获取分类数据"
/>
<Button
android:id=
"@+id/btn2"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:text=
"获取专辑数据"
/>
<Button
android:id=
"@+id/btn3"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:text=
"获取专辑内容"
/>
<Button
android:id=
"@+id/btn4"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:text=
"播放专辑内容"
/>
<Button
android:id=
"@+id/btn5"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:text=
"播放音频"
/>
</LinearLayout>
</com.mints.goodmoney.ui.widgets.ElasticScrollView>
</LinearLayout>
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