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