Commit 3a7ca863 by konghaorui

Merge branch 'feature/v3' of…

Merge branch 'feature/v3' of ssh://gitlab.yidianling.com:2224/app_android_lib/YDL-Component into feature/v3

# Conflicts:
#	config.gradle
parents 170db0f8 02b29bb7
......@@ -42,18 +42,17 @@ ext {
ydlPublishVersion = [
// -------------- 业务模块 --------------
//第三步 若干
"m-confide" : "0.0.41.3",
"m-consultant" : "0.0.51.14",
"m-fm" : "0.0.23.5",
"m-user" : "0.0.41.3",
"m-home" : "0.0.6.26",
"m-im" : "0.0.3.11",
"m-dynamic" : "0.0.1.7",
"m-muse" : "0.0.20.8",
"m-tests" : "0.0.15.8",
"m-course" : "0.0.34.10",
"m-confide" : "0.0.42",
"m-consultant" : "0.0.52",
"m-fm" : "0.0.24",
"m-user" : "0.0.42",
"m-home" : "0.0.7",
"m-im" : "0.0.4",
"m-dynamic" : "0.0.2",
"m-muse" : "0.0.21",
"m-tests" : "0.0.16",
"m-course" : "0.0.35",
//-------------- 业务模块 API 层 --------------
"m-audioim-api" : "0.0.5",
......@@ -70,13 +69,13 @@ ext {
//-------------- 功能组件 --------------
//第一步
"ydl-platform" : "0.0.29.5",
"ydl-platform" : "0.0.30",
//第二步 若干
"ydl-webview" : "0.0.28.14",
"ydl-media" : "0.0.14.5",
"ydl-pay" : "0.0.11.6",
"m-audioim" : "0.0.40.5",
"ydl-webview" : "0.0.29",
"ydl-media" : "0.0.15",
"ydl-pay" : "0.0.12",
"m-audioim" : "0.0.41",
//以下 几乎不会动
"router" : "0.0.1",
......@@ -100,7 +99,7 @@ ext {
"m-muse" : "0.0.20.7",
"m-tests" : "0.0.15.7",
"m-course" : "0.0.34.7",
"m-course" : "0.0.34.10",
//-------------- 业务模块 API 层 --------------
"m-audioim-api" : "0.0.5",
"m-confide-api" : "0.0.1.1",
......@@ -116,13 +115,13 @@ ext {
//-------------- 功能组件 --------------
//第一步
"ydl-platform" : "0.0.29.5",
"ydl-platform" : "0.0.30",
//第二步 若干
"ydl-webview" : "0.0.28.13",
"ydl-media" : "0.0.14.4",
"ydl-pay" : "0.0.11.6",
"m-audioim" : "0.0.40.5",
"ydl-webview" : "0.0.29",
"ydl-media" : "0.0.15",
"ydl-pay" : "0.0.12",
"m-audioim" : "0.0.41",
//以下 几乎不会动
......@@ -225,7 +224,7 @@ ext {
"systembartint" : "com.readystatesoftware.systembartint:systembartint:1.0.3",
"cube" : "in.srain.cube:cube-sdk:1.0.44@aar",
"support-multidex" : "com.android.support:multidex:1.0.2",
"ydl-ijkplayer-jjdxm" : "com.ydl:jjdxm-ijkplayer:0.0.3",
"ydl-ijkplayer-jjdxm" : "com.ydl:jjdxm-ijkplayer:0.0.4",
"robust" : "com.meituan.robust:robust:0.4.87",
"walle" : "com.meituan.android.walle:library:1.1.5",
"jpush" : "cn.jiguang.sdk:jpush:3.3.6",
......
......@@ -53,6 +53,7 @@ import com.yidianling.consultant.ui.view.AreaPopupWindow
import com.yidianling.consultant.ui.view.CategoryPopupWindow
import com.yidianling.consultant.ui.view.FilterPopupWindow
import com.yidianling.consultant.ui.view.SortPopupWindow
import com.yidianling.consultant.ui.view.topView.RecommendListView
import kotlinx.android.synthetic.main.consultant_activity_expert_search_list.*
import kotlinx.android.synthetic.main.consultant_item_filter_online.view.*
import kotlinx.android.synthetic.main.consultant_layout_search_content.*
......@@ -196,6 +197,13 @@ class ExpertSearchActivity : BaseMvpActivity<IExpertSearchView, ExpertSearchPres
srlContainer.setProgressViewOffset(false, 0, 200)
srlContainer.setOnRefreshListener(this)
recommendListView.addViewPagerScrollStateListener(object : RecommendListView.ViewPagerScrollStateCallback {
override fun viewPagerScroll(isScrolling: Boolean) {
//如果viewpager正在滚动,则禁止下拉刷新
srlContainer.isEnabled = !isScrolling
}
})
appbar_layout.addOnOffsetChangedListener { appbarLayout, i ->
srlContainer.isEnabled = i >= 0
}
......
......@@ -49,6 +49,7 @@ import com.yidianling.consultant.ui.view.AreaPopupWindow
import com.yidianling.consultant.ui.view.CategoryPopupWindow
import com.yidianling.consultant.ui.view.FilterPopupWindow
import com.yidianling.consultant.ui.view.SortPopupWindow
import com.yidianling.consultant.ui.view.topView.RecommendListView
import kotlinx.android.synthetic.main.consultant_activity_expert_search_list.*
import kotlinx.android.synthetic.main.consultant_item_filter_online.view.*
import kotlinx.android.synthetic.main.consultant_layout_search_content.*
......@@ -156,6 +157,13 @@ class ExpertSearchFragment : BaseMvpFragment<IExpertSearchView, ExpertSearchPres
srlContainer.setOnRefreshListener(this)
initNetLossView()
recommendListView.addViewPagerScrollStateListener(object : RecommendListView.ViewPagerScrollStateCallback {
override fun viewPagerScroll(isScrolling: Boolean) {
//如果viewpager正在滚动,则禁止下拉刷新
srlContainer.isEnabled = !isScrolling
}
})
appbar_layout.addOnOffsetChangedListener { appbarLayout, i ->
srlContainer.isEnabled = i >= 0
}
......
package com.yidianling.consultant.ui.view
import android.content.Context
import android.support.v4.widget.SwipeRefreshLayout
import android.util.AttributeSet
import android.view.MotionEvent
// 判断 X 轴的 Y 轴的 移动的距离差 来判断是否 需要拦截事件
class ExpertSearchSwipeRefreshLayout(context: Context, attrs: AttributeSet) :
SwipeRefreshLayout(context, attrs) {
// 上一次触摸时的X坐标
private var mPreDownX: Float = 0.toFloat()
private var mPreDownY: Float = 0.toFloat()
override fun onInterceptTouchEvent(ev: MotionEvent): Boolean {
when (ev.action) {
MotionEvent.ACTION_DOWN -> {
mPreDownX = ev.x
mPreDownY = ev.y
}
MotionEvent.ACTION_MOVE -> {
val eventX = ev.x
val eventY = ev.y
val xAbs = Math.abs(eventX - mPreDownX)
val yAbs = Math.abs(eventY - mPreDownY)
// 如果 X 轴移动的 距离大于 Y 轴移动的距离
// 那么 不拦截 触摸事件 交给 下面的处理
if (xAbs > yAbs) {
return false
}
}
}
return super.onInterceptTouchEvent(ev)
}
}
......@@ -5,20 +5,18 @@ import android.content.Context
import android.support.v4.view.PagerAdapter
import android.support.v4.view.ViewPager
import android.util.AttributeSet
import android.util.Log
import android.view.MotionEvent
import android.view.View
import android.view.ViewGroup
import android.widget.LinearLayout
import com.ydl.ydlcommon.data.http.RxUtils
import com.ydl.ydlcommon.data.http.ThrowableConsumer
import com.ydl.ydlcommon.utils.RxLifecycleUtils
import com.yidianling.common.tools.RxImageTool
import com.yidianling.common.tools.ToastUtil
import com.yidianling.consultant.R
import com.yidianling.consultant.bean.ExpertSearchBigShotBean
import com.yidianling.consultant.bean.ExpertSearchRecommandBean
import com.yidianling.consultant.http.ExpertSearchHttpImpl
import io.reactivex.Scheduler
import io.reactivex.android.schedulers.AndroidSchedulers
import io.reactivex.functions.Consumer
import io.reactivex.schedulers.Schedulers
......@@ -54,8 +52,8 @@ class RecommendListView : LinearLayout {
private var minHeight: Int = 0 // viewPager最小高度
private var maxHeight: Int = 0 // viewPager最大高度
private var dp_15: Int = RxImageTool.dp2px(15f)
private var dp_5: Int = RxImageTool.dp2px(5f)
private var dp_10: Int = RxImageTool.dp2px(10f)
private var dp_4: Int = RxImageTool.dp2px(4f)
private fun initView() {
......@@ -148,14 +146,24 @@ class RecommendListView : LinearLayout {
val item = RecommendItemView(mContext!!)
item.setPadding(RxImageTool.dp2px(15f), RxImageTool.dp2px(9f), RxImageTool.dp2px(15f), RxImageTool.dp2px(11f))
item.setPadding(
RxImageTool.dp2px(15f),
RxImageTool.dp2px(9f),
RxImageTool.dp2px(15f),
RxImageTool.dp2px(11f)
)
item.setData(mSceneSpecialTopicList[index])
ll.addView(item)
if (index + 1 < mSceneSpecialTopicList.size) {
val item1 = RecommendItemView(mContext!!)
item1.setPadding(0, RxImageTool.dp2px(9f), RxImageTool.dp2px(15f), RxImageTool.dp2px(11f))
item1.setPadding(
0,
RxImageTool.dp2px(9f),
RxImageTool.dp2px(15f),
RxImageTool.dp2px(11f)
)
item1.setData(mSceneSpecialTopicList[index + 1])
ll.addView(item1)
......@@ -180,14 +188,24 @@ class RecommendListView : LinearLayout {
val item = RecommendItemView(mContext!!)
item.setPadding(RxImageTool.dp2px(15f), RxImageTool.dp2px(9f), RxImageTool.dp2px(15f), RxImageTool.dp2px(11f))
item.setPadding(
RxImageTool.dp2px(15f),
RxImageTool.dp2px(9f),
RxImageTool.dp2px(15f),
RxImageTool.dp2px(11f)
)
item.setData(mSceneSpecialTopicList[index])
ll.addView(item)
if (index + 1 < mSceneSpecialTopicList.size) {
val item1 = RecommendItemView(mContext!!)
item1.setPadding(0, RxImageTool.dp2px(9f), RxImageTool.dp2px(15f), RxImageTool.dp2px(11f))
item1.setPadding(
0,
RxImageTool.dp2px(9f),
RxImageTool.dp2px(15f),
RxImageTool.dp2px(11f)
)
item1.setData(mSceneSpecialTopicList[index + 1])
ll.addView(item1)
......@@ -212,6 +230,25 @@ class RecommendListView : LinearLayout {
}
private fun addListener() {
recommendViewPager.setOnTouchListener(object : View.OnTouchListener {
override fun onTouch(v: View?, event: MotionEvent?): Boolean {
when (event?.action) {
MotionEvent.ACTION_MOVE -> {
mListener?.viewPagerScroll(true)
}
MotionEvent.ACTION_UP -> {
mListener?.viewPagerScroll(false)
}
MotionEvent.ACTION_CANCEL -> {
mListener?.viewPagerScroll(false)
}
}
return false
}
})
recommendViewPager.addOnPageChangeListener(object : ViewPager.OnPageChangeListener {
override fun onPageScrollStateChanged(state: Int) {
}
......@@ -236,20 +273,20 @@ class RecommendListView : LinearLayout {
private fun setSelectedIndex(position: Int) {
if (position == 0) {
leftIndicator.layoutParams = LayoutParams(dp_15, dp_5)
leftIndicator.layoutParams = LayoutParams(dp_10, dp_4)
val marginParams = leftIndicator.layoutParams as MarginLayoutParams
marginParams.rightMargin = RxImageTool.dp2px(6f)
leftIndicator.layoutParams = marginParams
leftIndicator.setBackgroundResource(R.drawable.consultant_indicator_selected)
rightIndicator.layoutParams = LayoutParams(dp_5, dp_5)
rightIndicator.layoutParams = LayoutParams(dp_4, dp_4)
rightIndicator.setBackgroundResource(R.drawable.consultant_indicator_unselected)
} else {
leftIndicator.layoutParams = LayoutParams(dp_5, dp_5)
leftIndicator.layoutParams = LayoutParams(dp_4, dp_4)
val marginParams = leftIndicator.layoutParams as MarginLayoutParams
marginParams.rightMargin = RxImageTool.dp2px(6f)
leftIndicator.layoutParams = marginParams
leftIndicator.setBackgroundResource(R.drawable.consultant_indicator_unselected)
rightIndicator.layoutParams = LayoutParams(dp_15, dp_5)
rightIndicator.layoutParams = LayoutParams(dp_10, dp_4)
rightIndicator.setBackgroundResource(R.drawable.consultant_indicator_selected)
}
}
......@@ -398,5 +435,18 @@ class RecommendListView : LinearLayout {
}
}
private var mListener: ViewPagerScrollStateCallback? = null
fun addViewPagerScrollStateListener(listener: ViewPagerScrollStateCallback?) {
listener?.let {
mListener = listener
}
}
interface ViewPagerScrollStateCallback {
fun viewPagerScroll(isScrolling: Boolean) //isScrolling
}
}
\ No newline at end of file
......@@ -2,10 +2,10 @@
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<size android:height="5dp"
android:width="15dp" />
<size android:height="4dp"
android:width="10dp" />
<corners android:radius="2.5dp" />
<corners android:radius="2dp" />
<solid android:color="#000000"/>
......
......@@ -2,10 +2,10 @@
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<size android:height="5dp"
android:width="5dp" />
<size android:height="4dp"
android:width="4dp" />
<corners android:radius="2.5dp" />
<corners android:radius="2dp" />
<solid android:color="#dddddd"/>
......
......@@ -11,7 +11,7 @@
layout="@layout/consultant_layout_search_toolbar"
android:layout_width="match_parent"
android:layout_height="48dp" />
<android.support.v4.widget.SwipeRefreshLayout
<com.yidianling.consultant.ui.view.ExpertSearchSwipeRefreshLayout
android:id="@+id/srlContainer"
android:layout_width="match_parent"
android:layout_height="match_parent">
......@@ -63,6 +63,6 @@
</android.support.design.widget.CoordinatorLayout>
</android.support.v4.widget.SwipeRefreshLayout>
</com.yidianling.consultant.ui.view.ExpertSearchSwipeRefreshLayout>
</LinearLayout>
......@@ -9,7 +9,7 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
app:cardElevation="0dp"
app:cardCornerRadius="6dp">
app:cardCornerRadius="4dp">
<ImageView
android:id="@+id/consultant_one_img_1"
android:layout_width="match_parent"
......
......@@ -10,7 +10,7 @@
android:layout_weight="1"
android:layout_height="match_parent"
app:cardElevation="0dp"
app:cardCornerRadius="6dp"
app:cardCornerRadius="4dp"
android:layout_marginRight="5dp">
<ImageView
android:id="@+id/consultant_three_img_1"
......@@ -25,7 +25,7 @@
android:layout_weight="1"
android:layout_height="match_parent"
app:cardElevation="0dp"
app:cardCornerRadius="6dp"
app:cardCornerRadius="4dp"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp">
<ImageView
......@@ -41,7 +41,7 @@
android:layout_weight="1"
android:layout_height="match_parent"
app:cardElevation="0dp"
app:cardCornerRadius="6dp"
app:cardCornerRadius="4dp"
android:layout_marginLeft="5dp">
<ImageView
android:id="@+id/consultant_three_img_3"
......
......@@ -10,7 +10,7 @@
android:layout_weight="1"
android:layout_height="match_parent"
app:cardElevation="0dp"
app:cardCornerRadius="6dp"
app:cardCornerRadius="4dp"
android:layout_marginRight="5dp">
<ImageView
android:id="@+id/consultant_two_img_1"
......@@ -25,7 +25,7 @@
android:layout_weight="1"
android:layout_height="match_parent"
app:cardElevation="0dp"
app:cardCornerRadius="6dp"
app:cardCornerRadius="4dp"
android:layout_marginLeft="5dp">
<ImageView
android:id="@+id/consultant_two_img_2"
......
......@@ -14,20 +14,21 @@
<LinearLayout
android:id="@+id/recommendViewPagerIndicator"
android:layout_width="match_parent"
android:layout_height="15dp"
android:layout_height="14dp"
android:paddingBottom="10dp"
android:orientation="horizontal"
android:background="#FAFAFA"
android:gravity="center">
<View
android:id="@+id/leftIndicator"
android:layout_width="15dp"
android:layout_height="5dp"
android:layout_width="10dp"
android:layout_height="4dp"
android:layout_marginRight="3dp"/>
<View
android:id="@+id/rightIndicator"
android:layout_width="15dp"
android:layout_height="5dp"
android:layout_width="10dp"
android:layout_height="4dp"
android:layout_marginLeft="3dp"/>
</LinearLayout>
......
<?xml version="1.0" encoding="utf-8"?>
<merge xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content"
......@@ -11,6 +12,8 @@
android:layout_height="40dp"
android:background="#eeeeee"
android:layout_marginRight="10dp"
app:cardCornerRadius="2dp"
app:cardElevation="0dp"
>
<ImageView
android:id="@+id/top_item_img"
......@@ -31,16 +34,17 @@
android:layout_weight="1"
android:gravity="left|top"
android:text="标题"
android:textSize="14dp"
android:textSize="13dp"
android:textStyle="bold"
android:maxLines="1"
android:textColor="#242424"
android:textStyle="bold"/>
android:layout_marginTop="1dp"
android:textColor="#242424"/>
<TextView
android:id="@+id/top_item_desc"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="left|top"
android:gravity="left"
android:text="我是描述"
android:maxLines="1"
android:textSize="11dp"
......
......@@ -106,7 +106,8 @@ class CoursePlayItemViewAudio : RelativeLayout, PlayViewInterface {
index: Int,
list: ArrayList<CourseMediaBean>,
courseExtra: CourseExtraBean,
from: Int
from: Int,
isAutoPlay: Boolean
) {
if (list.isEmpty()) return
......@@ -135,10 +136,14 @@ class CoursePlayItemViewAudio : RelativeLayout, PlayViewInterface {
if (TextUtils.equals(playView?.getCurrentUrl(), list[currentIndex].url)) {
playView?.updateView(currentIndex)
} else {
playView?.play(currentIndex)
if (isAutoPlay){
playView?.play(currentIndex)
}
}
} else {
playView?.play(index)
if (isAutoPlay){
playView?.play(currentIndex)
}
}
} else {
if (hasEnsureNetStatus) {
......@@ -146,10 +151,14 @@ class CoursePlayItemViewAudio : RelativeLayout, PlayViewInterface {
if (TextUtils.equals(playView?.getCurrentUrl(), list[currentIndex].url)) {
playView?.updateView(currentIndex)
} else {
playView?.play(currentIndex)
if (isAutoPlay){
playView?.play(currentIndex)
}
}
} else {
playView?.play(currentIndex)
if (isAutoPlay){
playView?.play(currentIndex)
}
}
} else {
playView?.showNetNotice {
......@@ -158,10 +167,14 @@ class CoursePlayItemViewAudio : RelativeLayout, PlayViewInterface {
if (TextUtils.equals(playView?.getCurrentUrl(), list[currentIndex].url)) {
playView?.updateView(currentIndex)
} else {
playView?.play(currentIndex)
if (isAutoPlay){
playView?.play(currentIndex)
}
}
} else {
playView?.play(currentIndex)
if (isAutoPlay){
playView?.play(currentIndex)
}
}
}
}
......
......@@ -18,7 +18,13 @@ interface PlayViewInterface {
fun onDestroy()
//from 1表示通知栏进来,2表示悬浮按钮进来 index:播放下标
fun setData(index: Int, list: ArrayList<CourseMediaBean>, courseExtra: CourseExtraBean, from: Int)
fun setData(
index: Int,
list: ArrayList<CourseMediaBean>,
courseExtra: CourseExtraBean,
from: Int,
isAutoPlay: Boolean = true
)
fun onNewIntent()
......
......@@ -40,7 +40,7 @@ class HPlayView : RelativeLayout, OnPlayerEventListener {
View.inflate(context, R.layout.course_play_music_view, this)
AudioPlayer.get().addOnPlayEventListener(this)
play_icon.setOnClickListener {
course_audio_play_icon.setOnClickListener {
AudioPlayer.get().playPause()
}
img_gif.setOnClickListener {
......@@ -91,9 +91,6 @@ class HPlayView : RelativeLayout, OnPlayerEventListener {
return this
}
/**
* 后台进入前台view
*/
fun updateView(index: Int) {
if (AudioPlayer.get().isPlaying) {
mHandler?.postDelayed({
......@@ -139,7 +136,7 @@ class HPlayView : RelativeLayout, OnPlayerEventListener {
if (mContext != null) {
Glide.with(mContext).asGif().load(R.drawable.course_loading5).into(img_gif)
}
play_icon.setImageResource(R.drawable.course_ico_course_play)
course_audio_play_icon.setImageResource(R.drawable.course_ico_course_play)
pro_progress.progress = 0
text_start_time.text = "00:00"
......@@ -195,13 +192,13 @@ class HPlayView : RelativeLayout, OnPlayerEventListener {
if (mContext != null) {
Glide.with(mContext).asGif().load(R.drawable.course_loading5).into(img_gif)
}
play_icon.setImageResource(R.drawable.course_ico_course_play)
course_audio_play_icon.setImageResource(R.drawable.course_ico_course_play)
}
} else {
if (mContext != null) {
Glide.with(mContext).asGif().load(R.drawable.course_audio_play).into(img_gif)
}
play_icon.setImageResource(R.drawable.course_ico_course_pause)
course_audio_play_icon.setImageResource(R.drawable.course_ico_course_pause)
}
}, 0)
}
......@@ -212,11 +209,11 @@ class HPlayView : RelativeLayout, OnPlayerEventListener {
mHandler?.postDelayed({
if (show) {
Glide.with(mContext).asGif().load(R.drawable.course_audio_play).into(img_gif)
play_icon.setImageResource(R.drawable.course_ico_course_pause)
course_audio_play_icon.setImageResource(R.drawable.course_ico_course_pause)
} else {
Glide.with(mContext).asBitmap().load(R.drawable.course_ico_course_bg_pause)
.into(img_gif)
play_icon.setImageResource(R.drawable.course_ico_course_play)
course_audio_play_icon.setImageResource(R.drawable.course_ico_course_play)
}
}, 0)
}
......
......@@ -37,7 +37,22 @@
android:id="@+id/frame_play"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/transparent" />
android:background="@color/transparent">
<FrameLayout
android:id="@+id/frame_audio_play"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/transparent"
android:visibility="visible" />
<FrameLayout
android:id="@+id/frame_video_play"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/transparent"
android:visibility="visible" />
</FrameLayout>
<RelativeLayout
android:id="@+id/title_bar_layout"
......
......@@ -38,7 +38,7 @@
android:layout_marginBottom="15dp">
<ImageView
android:id="@+id/play_icon"
android:id="@+id/course_audio_play_icon"
android:layout_width="40dp"
android:layout_height="40dp"
android:layout_centerVertical="true"
......@@ -54,7 +54,7 @@
android:layout_centerVertical="true"
android:layout_marginLeft="-3dp"
android:layout_toLeftOf="@+id/text_start_time"
android:layout_toRightOf="@+id/play_icon"
android:layout_toRightOf="@+id/course_audio_play_icon"
android:maxHeight="2dp"
android:minHeight="2dp"
android:progressDrawable="@drawable/course_layer_progress"
......
......@@ -149,7 +149,7 @@
android:layout_height="40dp"
android:layout_centerVertical="true"
android:layout_marginLeft="3dp"
android:padding="1dp"
android:padding="3dp"
android:scaleType="centerCrop"
android:src="@drawable/course_ico_course_play" />
......
......@@ -76,6 +76,11 @@ class YdlHomeFragment : BaseMvpFragment<IHomeContract.View, HomePresenterImpl>()
*/
private var scrollListner: HomeConfideRecyleSuspendListener? = null
/**
* 如果是第一次加载,则调用所有接口进行刷新,否则,只调用咨询和倾诉接口
*/
private var isFromCreate: Boolean = true
override fun layoutResId(): Int {
return R.layout.home_fragment_home_module
}
......@@ -102,7 +107,7 @@ class YdlHomeFragment : BaseMvpFragment<IHomeContract.View, HomePresenterImpl>()
home_swipe_refresh_layout.setColorSchemeColors(
ContextCompat.getColor(
context,
R.color.platform_main_theme_blue
R.color.platform_google_yellow
)
)
home_swipe_refresh_layout.setProgressViewOffset(false, 0, 200)
......@@ -402,9 +407,14 @@ class YdlHomeFragment : BaseMvpFragment<IHomeContract.View, HomePresenterImpl>()
super.onResume()
if (userVisibleHint) {
mPresenter?.getConsultData(consultLastSelectType, consultLastSelectPosition)
mPresenter?.getConfideData(confideLastSelectType, confideLastSelectPosition)
if (isFromCreate) {
isFromCreate = false
mPresenter?.loadHomeData()
}else {
mPresenter?.getConsultData(consultLastSelectType, consultLastSelectPosition)
mPresenter?.getConfideData(confideLastSelectType, confideLastSelectPosition)
}
mPresenter?.prepareCoupon(activity)
//走咨询助理浮层展示逻辑,是否展示由内部条件与接口判断
......
......@@ -86,6 +86,11 @@ class YdlHomeFragment : BaseMvpFragment<IHomeContract.View, HomePresenterImpl>()
private var searchContent: String = "搜索话题、咨询师姓名"
/**
* 如果是第一次加载,则调用所有接口进行刷新,否则,只调用咨询和倾诉接口
*/
private var isFromCreate: Boolean = true
override fun layoutResId(): Int {
return R.layout.home_fragment
}
......@@ -420,8 +425,14 @@ class YdlHomeFragment : BaseMvpFragment<IHomeContract.View, HomePresenterImpl>()
super.onResume()
if (userVisibleHint) {
ActionCountUtils.count(HomeBIConstants.YDL_USER_MAIN_PAGE_VISIT)
mPresenter?.getConsultData(consultLastSelectType, consultLastSelectPosition)
mPresenter?.getConfideData(confideLastSelectType, confideLastSelectPosition)
if (isFromCreate) {
isFromCreate = false
mPresenter?.loadHomeData()
}else {
mPresenter?.getConsultData(consultLastSelectType, consultLastSelectPosition)
mPresenter?.getConfideData(confideLastSelectType, confideLastSelectPosition)
}
showConsultAssistantDialog()
}
......
......@@ -13,6 +13,7 @@ import com.ydl.media.audio.manager.NotifyManager
import com.ydl.media.audio.model.Music
import com.ydl.media.audio.receiver.NoisyAudioStreamReceiver
import com.ydl.media.audio.utils.PlayProgressUtil
import com.ydl.ydlcommon.utils.LogUtil
import com.yidianling.common.tools.ToastUtil
import tv.danmaku.ijk.media.player.IMediaPlayer
import tv.danmaku.ijk.media.player.IjkMediaPlayer
......@@ -45,7 +46,11 @@ class AudioPlayer private constructor() {
var percent = (current * 100 / du).toInt()
//保存进度
if (autoSaveProgress) {
PlayProgressUtil.saveProgress(context, playMusic!!.path, (if (percent == 99 || percent == 100) 0 else current.toInt()))
PlayProgressUtil.saveProgress(
context,
playMusic!!.path,
(if (percent == 99 || percent == 100) 0 else current.toInt())
)
}
for (listener in listeners) {
listener.onPublish(percent, current.toLong())
......@@ -115,6 +120,16 @@ class AudioPlayer private constructor() {
this.context = context.applicationContext
audioFocusManager = AudioFocusManager(context)
mediaPlayer = IjkMediaPlayer()
try {
(mediaPlayer as IjkMediaPlayer).setOption(
IjkMediaPlayer.OPT_CATEGORY_FORMAT,
"dns_cache_clear",
1
)
} catch (e: Exception) {
LogUtil.e(e.message)
}
mediaPlayer!!.setOnPreparedListener { mp ->
if (isPreparing) {
if (autoSaveProgress) {
......@@ -340,7 +355,7 @@ class AudioPlayer private constructor() {
mediaPlayer!!.pause()
state = STATE_PAUSE
handler!!.removeCallbacks(mPublishRunnable)
if(isShowNotify){
if (isShowNotify) {
NotifyManager.get().showPause(playMusic)
MediaSessionManager.get().updatePlaybackState()
}
......@@ -425,7 +440,11 @@ class AudioPlayer private constructor() {
mediaPlayer!!.seekTo(currentPosition)
MediaSessionManager.get().updatePlaybackState()
if (autoSaveProgress) {
PlayProgressUtil.saveProgress(context, musicList[playPosition].coverPath, currentPosition.toInt())
PlayProgressUtil.saveProgress(
context,
musicList[playPosition].coverPath,
currentPosition.toInt()
)
}
for (listener in listeners) {
listener.onPublish(currentPercent, currentPosition)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment