Commit 77b1dc52 by YKai

feat:androidx代码提交

parent bf9e0187
...@@ -170,11 +170,11 @@ android { ...@@ -170,11 +170,11 @@ android {
dependencies { dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar']) implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation 'androidx.appcompat:appcompat:1.0.0' implementation 'androidx.appcompat:appcompat:1.2.0'
testImplementation 'junit:junit:4.12' testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.1' androidTestImplementation 'androidx.test.ext:junit:1.1.2'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.0' androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
kapt rootProject.ext.dependencies["dagger2-compiler"] // kapt rootProject.ext.dependencies["dagger2-compiler"]
api rootProject.ext.dependencies["butterknife"] api rootProject.ext.dependencies["butterknife"]
kapt rootProject.ext.dependencies["butterknife-compiler"] kapt rootProject.ext.dependencies["butterknife-compiler"]
...@@ -194,8 +194,6 @@ dependencies { ...@@ -194,8 +194,6 @@ dependencies {
api project(':m-home') api project(':m-home')
api project(':m-confide') api project(':m-confide')
// api "com.ydl:m-consultant-api:0.0.2"
// api 'com.ydl:m-consultant-module-ydl:0.0.18@aar'
implementation project(':ydl-flutter-base') implementation project(':ydl-flutter-base')
...@@ -214,8 +212,6 @@ dependencies { ...@@ -214,8 +212,6 @@ dependencies {
//文章模块 //文章模块
implementation project(':m-article') implementation project(':m-article')
// api rootProject.ext.dependencies["ydl-m-fm-module-ydl"]
// api rootProject.ext.dependencies["ydl-m-fm-api"]
implementation project(':m-fm') implementation project(':m-fm')
implementation project(':m-course') implementation project(':m-course')
implementation modularPublication('com.ydl:m-fm-api') implementation modularPublication('com.ydl:m-fm-api')
......
...@@ -5,47 +5,47 @@ ext { ...@@ -5,47 +5,47 @@ ext {
ydlPublishVersion = [ ydlPublishVersion = [
// -------------- 业务模块 -------------- // -------------- 业务模块 --------------
//第三步 若干 //第三步 若干
"m-confide" : "0.0.49.02", "m-confide" : "0.0.49.03",
"m-consultant" : "0.0.59.65", "m-consultant" : "0.0.59.66",
"m-fm" : "0.0.30.01", "m-fm" : "0.0.30.02",
"m-user" : "0.0.61.18", "m-user" : "0.0.61.19",
"m-home" : "0.0.22.55", "m-home" : "0.0.22.57",
"m-im" : "0.0.18.40", "m-im" : "0.0.18.42",
"m-dynamic" : "0.0.7.19", "m-dynamic" : "0.0.7.20",
"m-article" : "0.0.0.6", "m-article" : "0.0.0.7",
"m-muse" : "0.0.28.20", "m-muse" : "0.0.28.21",
"m-tests" : "0.0.24.10", "m-tests" : "0.0.24.11",
"m-course" : "0.0.42.20", "m-course" : "0.0.42.21",
//-------------- 业务模块 API 层 -------------- //-------------- 业务模块 API 层 --------------
"m-audioim-api" : "0.0.6", "m-audioim-api" : "0.0.6",
"m-confide-api" : "0.0.2.1", "m-confide-api" : "0.0.2.11",
"m-consultant-api": "0.0.5.6", "m-consultant-api": "0.0.5.61",
"m-course-api" : "0.0.3.6", "m-course-api" : "0.0.3.6",
"m-fm-api" : "0.0.3", "m-fm-api" : "0.0.3",
"m-muse-api" : "0.0.1", "m-muse-api" : "0.0.1",
"m-tests-api" : "0.0.2", "m-tests-api" : "0.0.2",
"m-user-api" : "0.0.10.16", "m-user-api" : "0.0.10.17",
"m-home-api" : "0.0.4.1", "m-home-api" : "0.0.4.2",
"m-im-api" : "0.0.12.21", "m-im-api" : "0.0.12.22",
"m-dynamic-api" : "0.0.3.7", "m-dynamic-api" : "0.0.3.71",
//-------------- 功能组件 -------------- //-------------- 功能组件 --------------
//第一步 //第一步
"ydl-platform" : "0.0.39.89", "ydl-platform" : "0.0.39.92",
//第二步 若干 //第二步 若干
"ydl-webview" : "0.0.38.36", "ydl-webview" : "0.0.38.37",
"ydl-media" : "0.0.21.6", "ydl-media" : "0.0.21.7",
"ydl-pay" : "0.0.18.13", "ydl-pay" : "0.0.18.14",
"m-audioim" : "0.0.49.29.30", "m-audioim" : "0.0.49.29.31",
"ydl-flutter-base": "0.0.14.20", "ydl-flutter-base": "0.0.14.21",
//以下 几乎不会动 //以下 几乎不会动
"router" : "0.0.1", "router" : "0.0.1",
"ydl-net" : "0.0.3.3", "ydl-net" : "0.0.3.4",
"ydl-utils" : "0.0.3.1", "ydl-utils" : "0.0.3.2",
] ]
ydl_app = [ ydl_app = [
appName : "心理咨询壹点灵", appName : "心理咨询壹点灵",
...@@ -88,46 +88,46 @@ ext { ...@@ -88,46 +88,46 @@ ext {
// -------------- 业务模块 -------------- // -------------- 业务模块 --------------
//第三步 若干 //第三步 若干
"m-confide" : "0.0.49.02", "m-confide" : "0.0.49.03",
"m-consultant" : "0.0.59.65", "m-consultant" : "0.0.59.66",
"m-fm" : "0.0.30.01", "m-fm" : "0.0.30.02",
"m-user" : "0.0.61.18", "m-user" : "0.0.61.19",
"m-home" : "0.0.22.54", "m-home" : "0.0.22.57",
"m-im" : "0.0.18.40", "m-im" : "0.0.18.42",
"m-dynamic" : "0.0.7.19", "m-dynamic" : "0.0.7.20",
"m-article" : "0.0.0.6", "m-article" : "0.0.0.7",
"m-muse" : "0.0.20.7", "m-muse" : "0.0.28.21",
"m-tests" : "0.0.24.9", "m-tests" : "0.0.24.11",
"m-course" : "0.0.42.20", "m-course" : "0.0.42.21",
//-------------- 业务模块 API 层 -------------- //-------------- 业务模块 API 层 --------------
"m-audioim-api" : "0.0.6", "m-audioim-api" : "0.0.6",
"m-confide-api" : "0.0.2.1", "m-confide-api" : "0.0.2.11",
"m-consultant-api": "0.0.5.6", "m-consultant-api": "0.0.5.61",
"m-course-api" : "0.0.3.6", "m-course-api" : "0.0.3.6",
"m-fm-api" : "0.0.3", "m-fm-api" : "0.0.3",
"m-muse-api" : "0.0.1", "m-muse-api" : "0.0.1",
"m-tests-api" : "0.0.2", "m-tests-api" : "0.0.2",
"m-user-api" : "0.0.10.16", "m-user-api" : "0.0.10.17",
"m-home-api" : "0.0.4.1", "m-home-api" : "0.0.4.2",
"m-im-api" : "0.0.12.21", "m-im-api" : "0.0.12.22",
"m-dynamic-api" : "0.0.3.7", "m-dynamic-api" : "0.0.3.71",
//-------------- 功能组件 -------------- //-------------- 功能组件 --------------
//第一步 //第一步
"ydl-platform" : "0.0.39.89", "ydl-platform" : "0.0.39.92",
//第二步 若干 //第二步 若干
"ydl-webview" : "0.0.38.36", "ydl-webview" : "0.0.38.37",
"ydl-media" : "0.0.21.6", "ydl-media" : "0.0.21.7",
"ydl-pay" : "0.0.18.11", "ydl-pay" : "0.0.18.14",
"m-audioim" : "0.0.49.29.30", "m-audioim" : "0.0.49.29.31",
"ydl-flutter-base": "0.0.14.20", "ydl-flutter-base": "0.0.14.21",
//以下 几乎不会动 //以下 几乎不会动
"router" : "0.0.1", "router" : "0.0.1",
"ydl-net" : "0.0.3.3", "ydl-net" : "0.0.3.4",
"ydl-utils" : "0.0.3.1", "ydl-utils" : "0.0.3.2",
] ]
dependencies = [ dependencies = [
...@@ -136,8 +136,8 @@ ext { ...@@ -136,8 +136,8 @@ ext {
"design" : 'com.google.android.material:material:1.0.0', "design" : 'com.google.android.material:material:1.0.0',
"support-v4" : 'androidx.legacy:legacy-support-v4:1.0.0', "support-v4" : 'androidx.legacy:legacy-support-v4:1.0.0',
"cardview-v7" : 'androidx.cardview:cardview:1.0.0', "cardview-v7" : 'androidx.cardview:cardview:1.0.0',
"annotations" : "com.android.support:support-annotations:${version["androidSupportSdkVersion"]}", "annotations" : "androidx.annotation:annotation:1.0.0",
"recyclerview-v7" : "com.android.support:recyclerview-v7:${version["androidSupportSdkVersion"]}", "recyclerview-v7" : "androidx.recyclerview:recyclerview:1.0.0",
"constraint-layout" : 'androidx.constraintlayout:constraintlayout:1.1.3', "constraint-layout" : 'androidx.constraintlayout:constraintlayout:1.1.3',
//network //network
...@@ -191,11 +191,11 @@ ext { ...@@ -191,11 +191,11 @@ ext {
"rxerrorhandler2" : "me.jessyan:rxerrorhandler:2.1.1", "rxerrorhandler2" : "me.jessyan:rxerrorhandler:2.1.1",
//tools //tools
"dagger2" : "com.google.dagger:dagger:${version["dagger2SdkVersion"]}", // "dagger2" : "com.google.dagger:dagger:${version["dagger2SdkVersion"]}",
"dagger2-android" : "com.google.dagger:dagger-android:${version["dagger2SdkVersion"]}", // "dagger2-android" : "com.google.dagger:dagger-android:${version["dagger2SdkVersion"]}",
"dagger2-android-support" : "com.google.dagger:dagger-android-support:${version["dagger2SdkVersion"]}", // "dagger2-android-support" : "com.google.dagger:dagger-android-support:${version["dagger2SdkVersion"]}",
"dagger2-compiler" : "com.google.dagger:dagger-compiler:${version["dagger2SdkVersion"]}", // "dagger2-compiler" : "com.google.dagger:dagger-compiler:${version["dagger2SdkVersion"]}",
"dagger2-android-processor" : "com.google.dagger:dagger-android-processor:${version["dagger2SdkVersion"]}", // "dagger2-android-processor" : "com.google.dagger:dagger-android-processor:${version["dagger2SdkVersion"]}",
"androideventbus" : "org.simple:androideventbus:1.0.5.1", "androideventbus" : "org.simple:androideventbus:1.0.5.1",
"otto" : "com.squareup:otto:1.3.8", "otto" : "com.squareup:otto:1.3.8",
"gson" : "com.google.code.gson:gson:2.8.5", "gson" : "com.google.code.gson:gson:2.8.5",
...@@ -207,11 +207,7 @@ ext { ...@@ -207,11 +207,7 @@ ext {
//test //test
"junit" : "junit:junit:4.12", "junit" : "junit:junit:4.12",
"androidJUnitRunner" : "android.support.test.runner.AndroidJUnitRunner", "espresso-core" : "androidx.test.espresso:espresso-core:3.1.0",
"runner" : "com.android.support.test:runner:1.0.1",
"espresso-core" : "com.android.support.test.espresso:espresso-core:${version["espressoSdkVersion"]}",
"espresso-contrib" : "com.android.support.test.espresso:espresso-contrib:${version["espressoSdkVersion"]}",
"espresso-intents" : "com.android.support.test.espresso:espresso-intents:${version["espressoSdkVersion"]}",
"mockito-core" : "org.mockito:mockito-core:1.+", "mockito-core" : "org.mockito:mockito-core:1.+",
"timber" : "com.jakewharton.timber:timber:4.7.1", "timber" : "com.jakewharton.timber:timber:4.7.1",
"logger" : "com.orhanobut:logger:2.2.0", "logger" : "com.orhanobut:logger:2.2.0",
......
...@@ -73,10 +73,10 @@ android { ...@@ -73,10 +73,10 @@ android {
dependencies { dependencies {
api fileTree(dir: 'libs', include: ['*.aar','*.jar']) api fileTree(dir: 'libs', include: ['*.aar','*.jar'])
implementation 'androidx.appcompat:appcompat:1.0.0' implementation 'androidx.appcompat:appcompat:1.2.0'
testImplementation 'junit:junit:4.12' testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.1' androidTestImplementation 'androidx.test.ext:junit:1.1.2'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.0' androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
kapt 'com.alibaba:arouter-compiler:1.2.2' kapt 'com.alibaba:arouter-compiler:1.2.2'
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
......
...@@ -66,10 +66,10 @@ android { ...@@ -66,10 +66,10 @@ android {
dependencies { dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar']) implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation 'androidx.appcompat:appcompat:1.0.0' implementation 'androidx.appcompat:appcompat:1.2.0'
testImplementation 'junit:junit:4.12' testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.1' androidTestImplementation 'androidx.test.ext:junit:1.1.2'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.0' androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
// 注意此处的依赖方式:kotlin中使用和java中使用方式有不同 // 注意此处的依赖方式:kotlin中使用和java中使用方式有不同
kapt "com.alibaba:arouter-compiler:$arouter_compiler" kapt "com.alibaba:arouter-compiler:$arouter_compiler"
......
...@@ -27,6 +27,7 @@ modular { ...@@ -27,6 +27,7 @@ modular {
version = rootProject.ext.ydlPublishVersion["${childProject.getName()}-api"] version = rootProject.ext.ydlPublishVersion["${childProject.getName()}-api"]
// API 层打包时需要引入的依赖 // API 层打包时需要引入的依赖
apiDependencies { apiDependencies {
implementation 'androidx.fragment:fragment-ktx:1.2.4'
implementation "com.google.code.gson:gson:2.8.2" implementation "com.google.code.gson:gson:2.8.2"
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation 'com.alibaba:arouter-api:1.4.1' implementation 'com.alibaba:arouter-api:1.4.1'
......
...@@ -199,7 +199,7 @@ class ConfideHomeActivity : BaseLceActivity<IConfideHomeContract.View,IConfideHo ...@@ -199,7 +199,7 @@ class ConfideHomeActivity : BaseLceActivity<IConfideHomeContract.View,IConfideHo
*/ */
private fun initQuickConsultDialog() { private fun initQuickConsultDialog() {
rv_list.addOnScrollListener(object : RecyclerView.OnScrollListener() { rv_list.addOnScrollListener(object : RecyclerView.OnScrollListener() {
override fun onScrollStateChanged(recyclerView: RecyclerView?, newState: Int) { override fun onScrollStateChanged(recyclerView: RecyclerView, newState: Int) {
super.onScrollStateChanged(recyclerView, newState) super.onScrollStateChanged(recyclerView, newState)
val layoutManager: RecyclerView.LayoutManager = recyclerView?.layoutManager!! val layoutManager: RecyclerView.LayoutManager = recyclerView?.layoutManager!!
val linearManager = layoutManager as LinearLayoutManager val linearManager = layoutManager as LinearLayoutManager
...@@ -240,12 +240,12 @@ class ConfideHomeActivity : BaseLceActivity<IConfideHomeContract.View,IConfideHo ...@@ -240,12 +240,12 @@ class ConfideHomeActivity : BaseLceActivity<IConfideHomeContract.View,IConfideHo
if (null == listScrollListener) { if (null == listScrollListener) {
listScrollListener = ConfideHomeRecycleViewListener() listScrollListener = ConfideHomeRecycleViewListener()
} }
rv_list.addOnScrollListener(listScrollListener) rv_list.addOnScrollListener(listScrollListener!!)
//用于显示筛选悬浮按钮 //用于显示筛选悬浮按钮
if (null == listSuspendListener) { if (null == listSuspendListener) {
listSuspendListener = ConfideHomeRecyleSuspendListener() listSuspendListener = ConfideHomeRecyleSuspendListener()
} }
rv_list.addOnScrollListener(listSuspendListener) rv_list.addOnScrollListener(listSuspendListener!!)
rv_list.addOnScrollListener(YDLImageRecyclerOnScrollListener(ConfideHomeActivity@ this)) rv_list.addOnScrollListener(YDLImageRecyclerOnScrollListener(ConfideHomeActivity@ this))
if (rv_list.itemAnimator is SimpleItemAnimator) { if (rv_list.itemAnimator is SimpleItemAnimator) {
(rv_list.itemAnimator as SimpleItemAnimator).supportsChangeAnimations = false (rv_list.itemAnimator as SimpleItemAnimator).supportsChangeAnimations = false
......
...@@ -22,10 +22,10 @@ class ConfideHomeRecycleViewListener : RecyclerView.OnScrollListener() { ...@@ -22,10 +22,10 @@ class ConfideHomeRecycleViewListener : RecyclerView.OnScrollListener() {
*/ */
private var move = false private var move = false
override fun onScrolled(recyclerView: RecyclerView?, dx: Int, dy: Int) { override fun onScrolled(recyclerView: RecyclerView, dx: Int, dy: Int) {
super.onScrolled(recyclerView, dx, dy) super.onScrolled(recyclerView, dx, dy)
//在这里进行第二次滚动(最后的距离) //在这里进行第二次滚动(最后的距离)
if (move && recyclerView != null) { if (move) {
move = false move = false
//获取要置顶的项在当前屏幕的位置,mIndex是记录的要置顶项在RecyclerView中的位置 //获取要置顶的项在当前屏幕的位置,mIndex是记录的要置顶项在RecyclerView中的位置
var n = mIndex - (recyclerView!!.layoutManager as LinearLayoutManager).findFirstVisibleItemPosition() var n = mIndex - (recyclerView!!.layoutManager as LinearLayoutManager).findFirstVisibleItemPosition()
......
...@@ -34,14 +34,14 @@ class ConfideHomeRecyleSuspendListener : RecyclerView.OnScrollListener() { ...@@ -34,14 +34,14 @@ class ConfideHomeRecyleSuspendListener : RecyclerView.OnScrollListener() {
this.adapter = adapter this.adapter = adapter
} }
override fun onScrollStateChanged(recyclerView: RecyclerView?, newState: Int) { override fun onScrollStateChanged(recyclerView: RecyclerView, newState: Int) {
super.onScrollStateChanged(recyclerView, newState) super.onScrollStateChanged(recyclerView, newState)
if (null != filterView) { if (null != filterView) {
mSuspensionHeight = filterView!!.height mSuspensionHeight = filterView!!.height
} }
} }
override fun onScrolled(recyclerView: RecyclerView?, dx: Int, dy: Int) { override fun onScrolled(recyclerView: RecyclerView, dx: Int, dy: Int) {
super.onScrolled(recyclerView, dx, dy) super.onScrolled(recyclerView, dx, dy)
if (null == adapter) { if (null == adapter) {
return return
......
...@@ -19,8 +19,7 @@ import kotlinx.android.synthetic.main.confide_good_item.view.* ...@@ -19,8 +19,7 @@ import kotlinx.android.synthetic.main.confide_good_item.view.*
*/ */
class ConfideHomeGoodAdapter(private val context: Context, private val goods: ArrayList<ConfideHomeFiterItemBean>, private val selectedGood: ArrayList<ConfideHomeFiterItemBean>) : RecyclerView.Adapter<ConfideHomeGoodAdapter.ViewHolder>() { class ConfideHomeGoodAdapter(private val context: Context, private val goods: ArrayList<ConfideHomeFiterItemBean>, private val selectedGood: ArrayList<ConfideHomeFiterItemBean>) : RecyclerView.Adapter<ConfideHomeGoodAdapter.ViewHolder>() {
override fun onBindViewHolder(holder: ViewHolder?, position: Int) { override fun onBindViewHolder(holder: ViewHolder, position: Int) {
if (holder != null) {
val category = goods[position] val category = goods[position]
holder.tvGoodName.text = goods[position].name holder.tvGoodName.text = goods[position].name
holder.tvGoodName.isSelected = selectedGood.contains(category) holder.tvGoodName.isSelected = selectedGood.contains(category)
...@@ -30,14 +29,13 @@ class ConfideHomeGoodAdapter(private val context: Context, private val goods: Ar ...@@ -30,14 +29,13 @@ class ConfideHomeGoodAdapter(private val context: Context, private val goods: Ar
holder.tvGoodName.setBackgroundResource(R.drawable.confide_filter_select_nor) holder.tvGoodName.setBackgroundResource(R.drawable.confide_filter_select_nor)
} }
} }
}
fun cleanSelectedGoods(){ fun cleanSelectedGoods(){
selectedGood?.clear() selectedGood.clear()
notifyDataSetChanged() notifyDataSetChanged()
} }
override fun onCreateViewHolder(parent: ViewGroup?, viewType: Int): ViewHolder { override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ViewHolder {
val itemView = LayoutInflater.from(context).inflate(R.layout.confide_good_item, parent, false) val itemView = LayoutInflater.from(context).inflate(R.layout.confide_good_item, parent, false)
return ViewHolder(itemView) return ViewHolder(itemView)
} }
......
...@@ -25,14 +25,13 @@ class ConfideHomeSortAdapter(private val context: Context, ...@@ -25,14 +25,13 @@ class ConfideHomeSortAdapter(private val context: Context,
override fun getItemCount(): Int = sortItems.size override fun getItemCount(): Int = sortItems.size
override fun onCreateViewHolder(parent: ViewGroup?, viewType: Int): ViewHolder { override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ViewHolder {
val itemView = LayoutInflater.from(context).inflate(R.layout.confide_sort_item, parent, false) val itemView = LayoutInflater.from(context).inflate(R.layout.confide_sort_item, parent, false)
return ViewHolder(itemView) return ViewHolder(itemView)
} }
override fun onBindViewHolder(holder: ViewHolder?, position: Int) { override fun onBindViewHolder(holder: ViewHolder, position: Int) {
val item = sortItems[position] val item = sortItems[position]
if (holder != null) {
holder.tvSort.text = item.name holder.tvSort.text = item.name
if (item.id == selectedSort.id) { if (item.id == selectedSort.id) {
holder.tvSort.setTextColor(context.resources.getColor(R.color.platform_main_theme)) holder.tvSort.setTextColor(context.resources.getColor(R.color.platform_main_theme))
...@@ -40,7 +39,6 @@ class ConfideHomeSortAdapter(private val context: Context, ...@@ -40,7 +39,6 @@ class ConfideHomeSortAdapter(private val context: Context,
holder.tvSort.setTextColor(ContextCompat.getColor(context, R.color._6)) holder.tvSort.setTextColor(ContextCompat.getColor(context, R.color._6))
} }
} }
}
inner class ViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView) { inner class ViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView) {
......
...@@ -370,13 +370,10 @@ class ConfideHomeUtils { ...@@ -370,13 +370,10 @@ class ConfideHomeUtils {
* 获取滑动的距离 * 获取滑动的距离
*/ */
fun getScollYDistance(recyclerview: RecyclerView): Int { fun getScollYDistance(recyclerview: RecyclerView): Int {
if (null == recyclerview) {
return 0
}
val layoutManager = recyclerview.layoutManager as LinearLayoutManager val layoutManager = recyclerview.layoutManager as LinearLayoutManager
val position = layoutManager.findFirstVisibleItemPosition() val position = layoutManager.findFirstVisibleItemPosition()
val firstVisiableChildView = layoutManager.findViewByPosition(position) val firstVisiableChildView = layoutManager.findViewByPosition(position)
val itemHeight = firstVisiableChildView.height val itemHeight = firstVisiableChildView!!.height
var yDistance = position * itemHeight - firstVisiableChildView.top var yDistance = position * itemHeight - firstVisiableChildView.top
if (yDistance <= 50 && position > 1) { if (yDistance <= 50 && position > 1) {
//position滑动到2和3之间的时候 滑动距离 会变成 小于10的距离 //position滑动到2和3之间的时候 滑动距离 会变成 小于10的距离
......
...@@ -35,7 +35,7 @@ class RecommendExpertAdapter(var mContext : Context,var dataList : List<View>) : ...@@ -35,7 +35,7 @@ class RecommendExpertAdapter(var mContext : Context,var dataList : List<View>) :
notifyDataSetChanged() notifyDataSetChanged()
} }
override fun isViewFromObject(view: View?, `object`: Any?): Boolean { override fun isViewFromObject(view: View, `object`: Any): Boolean {
return view == `object` return view == `object`
} }
...@@ -43,13 +43,13 @@ class RecommendExpertAdapter(var mContext : Context,var dataList : List<View>) : ...@@ -43,13 +43,13 @@ class RecommendExpertAdapter(var mContext : Context,var dataList : List<View>) :
return datas!!.size return datas!!.size
} }
override fun instantiateItem(container: ViewGroup?, position: Int): Any { override fun instantiateItem(container: ViewGroup, position: Int): Any {
var view =datas!![position] var view =datas!![position]
container!!.addView(view) container.addView(view)
return view return view
} }
override fun destroyItem(container: ViewGroup?, position: Int, `object`: Any?) { override fun destroyItem(container: ViewGroup, position: Int, `object`: Any) {
container!!.removeView(datas!![position]) container.removeView(datas!![position])
} }
} }
\ No newline at end of file
...@@ -27,6 +27,8 @@ modular { ...@@ -27,6 +27,8 @@ modular {
version = rootProject.ext.ydlPublishVersion[childProject.getName()+"-api"] version = rootProject.ext.ydlPublishVersion[childProject.getName()+"-api"]
// API 层打包时需要引入的依赖 // API 层打包时需要引入的依赖
apiDependencies { apiDependencies {
implementation 'androidx.fragment:fragment-ktx:1.2.4'
implementation 'androidx.annotation:annotation:1.1.0'
implementation "com.google.code.gson:gson:2.8.2" implementation "com.google.code.gson:gson:2.8.2"
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation 'com.alibaba:arouter-api:1.4.1' implementation 'com.alibaba:arouter-api:1.4.1'
......
...@@ -23,6 +23,7 @@ import android.widget.LinearLayout ...@@ -23,6 +23,7 @@ import android.widget.LinearLayout
import android.widget.TextView import android.widget.TextView
import com.alibaba.android.arouter.facade.annotation.Route import com.alibaba.android.arouter.facade.annotation.Route
import com.alibaba.android.arouter.launcher.ARouter import com.alibaba.android.arouter.launcher.ARouter
import com.google.android.material.appbar.AppBarLayout
import com.ydl.webview.H5Params import com.ydl.webview.H5Params
import com.ydl.webview.NewH5Activity import com.ydl.webview.NewH5Activity
import com.ydl.ydl_image.config.SimpleImageOpConfiger import com.ydl.ydl_image.config.SimpleImageOpConfiger
...@@ -206,10 +207,9 @@ class ExpertSearchActivity : BaseMvpActivity<IExpertSearchView, ExpertSearchPres ...@@ -206,10 +207,9 @@ class ExpertSearchActivity : BaseMvpActivity<IExpertSearchView, ExpertSearchPres
} }
}) })
appbar_layout.addOnOffsetChangedListener { appbarLayout, i -> appbar_layout.addOnOffsetChangedListener(AppBarLayout.OnOffsetChangedListener { _, i ->
srlContainer.isEnabled = i >= 0 srlContainer.isEnabled = i >= 0
} })
initNetLossView() initNetLossView()
...@@ -236,7 +236,7 @@ class ExpertSearchActivity : BaseMvpActivity<IExpertSearchView, ExpertSearchPres ...@@ -236,7 +236,7 @@ class ExpertSearchActivity : BaseMvpActivity<IExpertSearchView, ExpertSearchPres
onScrollListener = object : EndlessRecyclerViewScrollListener(layoutManager) { onScrollListener = object : EndlessRecyclerViewScrollListener(layoutManager) {
private var isBtnShow: Boolean = false private var isBtnShow: Boolean = false
private var sIsScrolling = false private var sIsScrolling = false
override fun onScrollStateChanged(recyclerView: RecyclerView?, newState: Int) { override fun onScrollStateChanged(recyclerView: RecyclerView, newState: Int) {
super.onScrollStateChanged(recyclerView, newState) super.onScrollStateChanged(recyclerView, newState)
hideSoftInput() hideSoftInput()
if (newState == RecyclerView.SCROLL_STATE_DRAGGING || newState == RecyclerView.SCROLL_STATE_SETTLING) { if (newState == RecyclerView.SCROLL_STATE_DRAGGING || newState == RecyclerView.SCROLL_STATE_SETTLING) {
......
...@@ -16,7 +16,7 @@ import kotlinx.android.synthetic.main.consultant_item_subject.view.* ...@@ -16,7 +16,7 @@ import kotlinx.android.synthetic.main.consultant_item_subject.view.*
*/ */
class CategoryRecyclerViewAdapter(private val context: Context, private val categories: ArrayList<CateItem>, private val selectedCategories: ArrayList<CateItem>) : RecyclerView.Adapter<CategoryRecyclerViewAdapter.ViewHolder>() { class CategoryRecyclerViewAdapter(private val context: Context, private val categories: ArrayList<CateItem>, private val selectedCategories: ArrayList<CateItem>) : RecyclerView.Adapter<CategoryRecyclerViewAdapter.ViewHolder>() {
override fun onBindViewHolder(holder: ViewHolder?, position: Int) { override fun onBindViewHolder(holder: ViewHolder, position: Int) {
if (holder != null) { if (holder != null) {
val category = categories[position] val category = categories[position]
holder.tvSubjectName.text = categories[position].cateName holder.tvSubjectName.text = categories[position].cateName
...@@ -24,7 +24,7 @@ class CategoryRecyclerViewAdapter(private val context: Context, private val cate ...@@ -24,7 +24,7 @@ class CategoryRecyclerViewAdapter(private val context: Context, private val cate
} }
} }
override fun onCreateViewHolder(parent: ViewGroup?, viewType: Int): ViewHolder { override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ViewHolder {
val itemView = LayoutInflater.from(context).inflate(R.layout.consultant_item_subject, parent, false) val itemView = LayoutInflater.from(context).inflate(R.layout.consultant_item_subject, parent, false)
return ViewHolder(itemView) return ViewHolder(itemView)
} }
......
...@@ -64,7 +64,7 @@ class ExpertSearchAdapter( ...@@ -64,7 +64,7 @@ class ExpertSearchAdapter(
} }
@SuppressLint("SetTextI18n") @SuppressLint("SetTextI18n")
override fun onBindViewHolder(holder: RecyclerView.ViewHolder?, position: Int) { override fun onBindViewHolder(holder: RecyclerView.ViewHolder, position: Int) {
if (holder is NormalViewHolder) { if (holder is NormalViewHolder) {
val itemBean = listData[position] val itemBean = listData[position]
//头像 //头像
...@@ -317,7 +317,7 @@ class ExpertSearchAdapter( ...@@ -317,7 +317,7 @@ class ExpertSearchAdapter(
listData.size + 1 listData.size + 1
} }
override fun onCreateViewHolder(parent: ViewGroup?, viewType: Int): RecyclerView.ViewHolder = override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): RecyclerView.ViewHolder =
when (viewType) { when (viewType) {
NORMAL_VIEW -> { NORMAL_VIEW -> {
val view = LayoutInflater.from(context) val view = LayoutInflater.from(context)
......
...@@ -20,12 +20,11 @@ class RegionRecyclerViewAdapter(val context: Context, val regionList: ArrayList< ...@@ -20,12 +20,11 @@ class RegionRecyclerViewAdapter(val context: Context, val regionList: ArrayList<
var onItemClickListener: MyBaseAdapter.OnItemClickListener<RegionItem>? = null var onItemClickListener: MyBaseAdapter.OnItemClickListener<RegionItem>? = null
override fun onBindViewHolder(holder: ViewHolder?, position: Int) { override fun onBindViewHolder(holder: ViewHolder, position: Int) {
var region = RegionItem(ArrayList(), "全国", null) var region = RegionItem(ArrayList(), "全国", null)
if (position > 0) { if (position > 0) {
region = regionList[position - 1] region = regionList[position - 1]
} }
if (holder != null) {
holder.itemView.tvRegionName.text = region.value holder.itemView.tvRegionName.text = region.value
if (selectedRegion.key == region.key) { if (selectedRegion.key == region.key) {
//选中状态 //选中状态
...@@ -41,11 +40,10 @@ class RegionRecyclerViewAdapter(val context: Context, val regionList: ArrayList< ...@@ -41,11 +40,10 @@ class RegionRecyclerViewAdapter(val context: Context, val regionList: ArrayList<
holder.itemView.view_select.visibility = View.INVISIBLE holder.itemView.view_select.visibility = View.INVISIBLE
} }
} }
}
override fun getItemCount(): Int = regionList.size + 1 override fun getItemCount(): Int = regionList.size + 1
override fun onCreateViewHolder(parent: ViewGroup?, viewType: Int): ViewHolder { override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ViewHolder {
val view = LayoutInflater.from(context).inflate(R.layout.consultant_item_region, parent, false) val view = LayoutInflater.from(context).inflate(R.layout.consultant_item_region, parent, false)
return ViewHolder(view) return ViewHolder(view)
} }
......
...@@ -22,14 +22,13 @@ class SortRecyclerViewAdapter(private val context: Context, ...@@ -22,14 +22,13 @@ class SortRecyclerViewAdapter(private val context: Context,
override fun getItemCount(): Int = sortItems.size override fun getItemCount(): Int = sortItems.size
override fun onCreateViewHolder(parent: ViewGroup?, viewType: Int): ViewHolder { override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ViewHolder {
val itemView = LayoutInflater.from(context).inflate(R.layout.consultant_item_sort, parent, false) val itemView = LayoutInflater.from(context).inflate(R.layout.consultant_item_sort, parent, false)
return ViewHolder(itemView) return ViewHolder(itemView)
} }
override fun onBindViewHolder(holder: ViewHolder?, position: Int) { override fun onBindViewHolder(holder: ViewHolder, position: Int) {
val item = sortItems[position] val item = sortItems[position]
if (holder != null) {
holder.tvSort.text = item.value holder.tvSort.text = item.value
if (item.key == selectedSort.key) { if (item.key == selectedSort.key) {
holder.tvSort.setTypeface(Typeface.DEFAULT_BOLD) holder.tvSort.setTypeface(Typeface.DEFAULT_BOLD)
...@@ -37,7 +36,6 @@ class SortRecyclerViewAdapter(private val context: Context, ...@@ -37,7 +36,6 @@ class SortRecyclerViewAdapter(private val context: Context,
// holder.ivCheck.visibility = View.VISIBLE // holder.ivCheck.visibility = View.VISIBLE
} }
} }
}
inner class ViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView) { inner class ViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView) {
......
...@@ -20,12 +20,11 @@ class SubRecyclerViewAdapter(val context: Context, val subList: ArrayList<SubIte ...@@ -20,12 +20,11 @@ class SubRecyclerViewAdapter(val context: Context, val subList: ArrayList<SubIte
var onItemClickListener: MyBaseAdapter.OnItemClickListener<SubItem>? = null var onItemClickListener: MyBaseAdapter.OnItemClickListener<SubItem>? = null
override fun onBindViewHolder(holder: ViewHolder?, position: Int) { override fun onBindViewHolder(holder: ViewHolder, position: Int) {
var region = SubItem("不限", null) var region = SubItem("不限", null)
if (position > 0) { if (position > 0) {
region = subList[position - 1] region = subList[position - 1]
} }
if (holder != null) {
holder.itemView.tvConsultTypeName.text = region.value holder.itemView.tvConsultTypeName.text = region.value
if (selectedSub.key == region.key) { if (selectedSub.key == region.key) {
//选中状态 //选中状态
...@@ -39,11 +38,10 @@ class SubRecyclerViewAdapter(val context: Context, val subList: ArrayList<SubIte ...@@ -39,11 +38,10 @@ class SubRecyclerViewAdapter(val context: Context, val subList: ArrayList<SubIte
// holder.itemView.ivCheckCircle.visibility = View.INVISIBLE // holder.itemView.ivCheckCircle.visibility = View.INVISIBLE
} }
} }
}
override fun getItemCount(): Int = subList.size + 1 override fun getItemCount(): Int = subList.size + 1
override fun onCreateViewHolder(parent: ViewGroup?, viewType: Int): ViewHolder { override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ViewHolder {
val view = LayoutInflater.from(context).inflate(R.layout.consultant_item_consult_type, parent, false) val view = LayoutInflater.from(context).inflate(R.layout.consultant_item_consult_type, parent, false)
return ViewHolder(view) return ViewHolder(view)
} }
......
...@@ -19,8 +19,7 @@ class ExpertItemDecoration(val context: Context) : RecyclerView.ItemDecoration() ...@@ -19,8 +19,7 @@ class ExpertItemDecoration(val context: Context) : RecyclerView.ItemDecoration()
var space = RxImageTool.dp2px( 7f) var space = RxImageTool.dp2px( 7f)
override fun onDraw(c: Canvas?, parent: RecyclerView?, state: RecyclerView.State?) { override fun onDraw(c: Canvas, parent: RecyclerView) {
if (parent != null && c != null) {
val view = ColorDrawable(Color.parseColor("#f3f3f3")) val view = ColorDrawable(Color.parseColor("#f3f3f3"))
val left = parent.paddingLeft val left = parent.paddingLeft
val right = parent.width - parent.paddingRight val right = parent.width - parent.paddingRight
...@@ -40,16 +39,13 @@ class ExpertItemDecoration(val context: Context) : RecyclerView.ItemDecoration() ...@@ -40,16 +39,13 @@ class ExpertItemDecoration(val context: Context) : RecyclerView.ItemDecoration()
view.draw(c) view.draw(c)
} }
} }
}
override fun getItemOffsets(outRect: Rect?, view: View?, parent: RecyclerView?, state: RecyclerView.State?) { override fun getItemOffsets(outRect: Rect, view: View, parent: RecyclerView, state: RecyclerView.State) {
if (parent != null && outRect != null) {
if (parent.getChildAdapterPosition(view) == 0) { if (parent.getChildAdapterPosition(view) == 0) {
outRect.top = 1 outRect.top = 1
} }
outRect.bottom = space outRect.bottom = space
}
} }
} }
\ No newline at end of file
...@@ -57,13 +57,13 @@ android { ...@@ -57,13 +57,13 @@ android {
dependencies { dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar','*.aar']) implementation fileTree(dir: 'libs', include: ['*.jar','*.aar'])
implementation 'androidx.appcompat:appcompat:1.0.0' implementation 'androidx.appcompat:appcompat:1.2.0'
testImplementation 'junit:junit:4.12' testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.1' androidTestImplementation 'androidx.test.ext:junit:1.1.2'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.0' androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
kapt 'com.alibaba:arouter-compiler:1.2.2' kapt 'com.alibaba:arouter-compiler:1.2.2'
api 'com.github.princekin-f:EasyFloat:1.1.2' api 'com.github.princekin-f:EasyFloat:1.3.2'
api rootProject.ext.dependencies["ydl-user-router"] api rootProject.ext.dependencies["ydl-user-router"]
api rootProject.ext.dependencies["butterknife"] api rootProject.ext.dependencies["butterknife"]
if (rootProject.ext.dev_mode){ if (rootProject.ext.dev_mode){
......
...@@ -143,7 +143,7 @@ class FlutterCourseHomeFragment : BaseFlutterFragment() { ...@@ -143,7 +143,7 @@ class FlutterCourseHomeFragment : BaseFlutterFragment() {
dialog!!.dismiss() dialog!!.dismiss()
//查看我的卡券 //查看我的卡券
ModularServiceManager.provide(IAppService::class.java).myRedPockIntent(activity) ModularServiceManager.provide(IAppService::class.java).myRedPockIntent(activity!!)
} }
} }
}) })
......
...@@ -20,8 +20,7 @@ import kotlinx.android.synthetic.main.item_course_good_item.view.* ...@@ -20,8 +20,7 @@ import kotlinx.android.synthetic.main.item_course_good_item.view.*
*/ */
class CourseGoodAdapter(private val context: Context, private val goods: ArrayList<CourseCategoryBean>, private val selectedGood: ArrayList<CourseCategoryBean>) : RecyclerView.Adapter<CourseGoodAdapter.ViewHolder>() { class CourseGoodAdapter(private val context: Context, private val goods: ArrayList<CourseCategoryBean>, private val selectedGood: ArrayList<CourseCategoryBean>) : RecyclerView.Adapter<CourseGoodAdapter.ViewHolder>() {
override fun onBindViewHolder(holder: ViewHolder?, position: Int) { override fun onBindViewHolder(holder: ViewHolder, position: Int) {
if (holder != null) {
val category = goods[position] val category = goods[position]
holder.tvGoodName.text = goods[position].name holder.tvGoodName.text = goods[position].name
holder.tvGoodName.isSelected = selectedGood.contains(category) holder.tvGoodName.isSelected = selectedGood.contains(category)
...@@ -33,14 +32,13 @@ class CourseGoodAdapter(private val context: Context, private val goods: ArrayLi ...@@ -33,14 +32,13 @@ class CourseGoodAdapter(private val context: Context, private val goods: ArrayLi
holder.tvGoodName.typeface = Typeface.defaultFromStyle(Typeface.NORMAL) holder.tvGoodName.typeface = Typeface.defaultFromStyle(Typeface.NORMAL)
} }
} }
}
fun cleanSelectedGoods() { fun cleanSelectedGoods() {
selectedGood?.clear() selectedGood?.clear()
notifyDataSetChanged() notifyDataSetChanged()
} }
override fun onCreateViewHolder(parent: ViewGroup?, viewType: Int): ViewHolder { override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ViewHolder {
val itemView = LayoutInflater.from(context).inflate(R.layout.item_course_good_item, parent, false) val itemView = LayoutInflater.from(context).inflate(R.layout.item_course_good_item, parent, false)
return ViewHolder(itemView) return ViewHolder(itemView)
} }
......
...@@ -50,11 +50,11 @@ class CourseSearchAdapterWrapper( ...@@ -50,11 +50,11 @@ class CourseSearchAdapterWrapper(
if (position == mAdapter.itemCount && mAdapter.itemCount < initialPageCount) return TYPE_FOOTER_NOMORE if (position == mAdapter.itemCount && mAdapter.itemCount < initialPageCount) return TYPE_FOOTER_NOMORE
return when (position < mAdapter.itemCount) { return when (position < mAdapter.itemCount) {
true -> mAdapter.getItemViewType(position) true -> mAdapter.getItemViewType(position)
false -> footerType!! false -> footerType
} }
} }
override fun onCreateViewHolder(parent: ViewGroup?, viewType: Int): RecyclerView.ViewHolder { override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): RecyclerView.ViewHolder {
var view:View? = null var view:View? = null
return when (viewType) { return when (viewType) {
TYPE_FOOTER_LOADING -> { TYPE_FOOTER_LOADING -> {
...@@ -69,7 +69,7 @@ class CourseSearchAdapterWrapper( ...@@ -69,7 +69,7 @@ class CourseSearchAdapterWrapper(
} }
} }
override fun onBindViewHolder(holder: RecyclerView.ViewHolder?, position: Int) { override fun onBindViewHolder(holder: RecyclerView.ViewHolder, position: Int) {
when (holder) { when (holder) {
is FooterHolder -> { } is FooterHolder -> { }
else -> { else -> {
...@@ -94,7 +94,7 @@ class CourseSearchAdapterWrapper( ...@@ -94,7 +94,7 @@ class CourseSearchAdapterWrapper(
fun setOnScrollerListener() { fun setOnScrollerListener() {
recycler.addOnScrollListener(object: RecyclerView.OnScrollListener() { recycler.addOnScrollListener(object: RecyclerView.OnScrollListener() {
override fun onScrolled(recyclerView: RecyclerView?, dx: Int, dy: Int) { override fun onScrolled(recyclerView: RecyclerView, dx: Int, dy: Int) {
val layoutManager = recyclerView?.layoutManager val layoutManager = recyclerView?.layoutManager
when (layoutManager) { when (layoutManager) {
...@@ -104,7 +104,7 @@ class CourseSearchAdapterWrapper( ...@@ -104,7 +104,7 @@ class CourseSearchAdapterWrapper(
//这里现在只写了LinearLayoutManager的代码,后续补充 //这里现在只写了LinearLayoutManager的代码,后续补充
} }
} }
override fun onScrollStateChanged(recyclerView: RecyclerView?, newState: Int) { override fun onScrollStateChanged(recyclerView: RecyclerView, newState: Int) {
if (newState == RecyclerView.SCROLL_STATE_IDLE //停止滚动 if (newState == RecyclerView.SCROLL_STATE_IDLE //停止滚动
&& footerType == TYPE_FOOTER_LOADING //footer状态为加载更多 && footerType == TYPE_FOOTER_LOADING //footer状态为加载更多
&& lastVisibleItem >= mAdapter.itemCount //最后一个显示的item序号大于适配器item数量,即显示了footer && lastVisibleItem >= mAdapter.itemCount //最后一个显示的item序号大于适配器item数量,即显示了footer
......
...@@ -113,7 +113,7 @@ class CoursePlugin : MethodChannel.MethodCallHandler { ...@@ -113,7 +113,7 @@ class CoursePlugin : MethodChannel.MethodCallHandler {
val h5Params = H5Params(jumpUrl, "") val h5Params = H5Params(jumpUrl, "")
NewH5Activity.start(mFragment!!.activity, h5Params) NewH5Activity.start(mFragment!!.activity, h5Params)
PlayerFloatHelper.hide() PlayerFloatHelper.hide()
PlayerFloatHelper.removeView(mFragment!!.activity!!) PlayerFloatHelper.removeView(mFragment!!.requireActivity())
AudioPlayer.get().stopPlayer() AudioPlayer.get().stopPlayer()
CourseSendPlugin.sendMsg(false) CourseSendPlugin.sendMsg(false)
return return
...@@ -128,7 +128,7 @@ class CoursePlugin : MethodChannel.MethodCallHandler { ...@@ -128,7 +128,7 @@ class CoursePlugin : MethodChannel.MethodCallHandler {
"0" "0"
) )
) { ) {
CourseIn.loginByOneKeyLogin(mFragment!!.activity!!,true) CourseIn.loginByOneKeyLogin(mFragment!!.requireActivity(),true)
} else { } else {
MyCourseActivity.start(mFragment!!.activity) MyCourseActivity.start(mFragment!!.activity)
} }
...@@ -136,7 +136,7 @@ class CoursePlugin : MethodChannel.MethodCallHandler { ...@@ -136,7 +136,7 @@ class CoursePlugin : MethodChannel.MethodCallHandler {
} }
jumpUrl.contains("course/myCourse") -> MyCourseActivity.start(mFragment!!.activity) jumpUrl.contains("course/myCourse") -> MyCourseActivity.start(mFragment!!.activity)
jumpUrl.contains("course/specialList") -> //跳转专题列表页 jumpUrl.contains("course/specialList") -> //跳转专题列表页
mFragment!!.activity!!.startActivity( mFragment!!.requireActivity().startActivity(
Intent( Intent(
mFragment!!.activity, mFragment!!.activity,
CourseSpecialListActivity::class.java CourseSpecialListActivity::class.java
...@@ -155,7 +155,7 @@ class CoursePlugin : MethodChannel.MethodCallHandler { ...@@ -155,7 +155,7 @@ class CoursePlugin : MethodChannel.MethodCallHandler {
else -> YDLRouterManager.router(jumpUrl) else -> YDLRouterManager.router(jumpUrl)
} }
PlayerFloatHelper.hide() PlayerFloatHelper.hide()
PlayerFloatHelper.removeView(mFragment!!.activity!!) PlayerFloatHelper.removeView(mFragment!!.requireActivity())
AudioPlayer.get().stopPlayer() AudioPlayer.get().stopPlayer()
CourseSendPlugin.sendMsg(false) CourseSendPlugin.sendMsg(false)
} }
...@@ -185,21 +185,21 @@ class CoursePlugin : MethodChannel.MethodCallHandler { ...@@ -185,21 +185,21 @@ class CoursePlugin : MethodChannel.MethodCallHandler {
} }
IOSPOP -> { IOSPOP -> {
PlayerFloatHelper.hide() PlayerFloatHelper.hide()
PlayerFloatHelper.removeView(mFragment!!.activity!!) PlayerFloatHelper.removeView(mFragment!!.requireActivity())
AudioPlayer.get().stopPlayer() AudioPlayer.get().stopPlayer()
CourseSendPlugin.sendMsg(false) CourseSendPlugin.sendMsg(false)
mFragment!!.activity.finish() mFragment!!.activity?.finish()
} }
} }
} }
private fun playMedia(fileInfo: Map<*, *>) { private fun playMedia(fileInfo: Map<*, *>) {
if (PlayerFloatHelper.isShow(mFragment!!.activity!!)) { if (PlayerFloatHelper.isShow(mFragment!!.requireActivity())) {
PlayerFloatHelper.hide() PlayerFloatHelper.hide()
PlayerFloatHelper.removeView(mFragment!!.activity!!) PlayerFloatHelper.removeView(mFragment!!.requireActivity())
AudioPlayer.get().stopPlayer() AudioPlayer.get().stopPlayer()
} else { } else {
PlayerFloatHelper.removeView(mFragment!!.activity!!) PlayerFloatHelper.removeView(mFragment!!.requireActivity())
} }
...@@ -218,12 +218,14 @@ class CoursePlugin : MethodChannel.MethodCallHandler { ...@@ -218,12 +218,14 @@ class CoursePlugin : MethodChannel.MethodCallHandler {
val hashMap = HashMap<String, String>() val hashMap = HashMap<String, String>()
hashMap["course_id"] = fileInfo["courseId"].toString() hashMap["course_id"] = fileInfo["courseId"].toString()
AudioPlayer.get().singlePlay(music) AudioPlayer.get().singlePlay(music)
mFragment!!.activity?.let {
PlayerFloatHelper.show( PlayerFloatHelper.show(
mFragment!!.activity, it,
playTypeEnum = PlayTypeEnum.PLAY_TYPE_COURSE, playTypeEnum = PlayTypeEnum.PLAY_TYPE_COURSE,
playData = hashMap playData = hashMap
) )
VideoFloatHelper.dismissFloat(mFragment!!.activity) VideoFloatHelper.dismissFloat(it)
}
} }
if (demoType == 2) { if (demoType == 2) {
VideoFloatHelper.setVideoInfo( VideoFloatHelper.setVideoInfo(
...@@ -233,9 +235,9 @@ class CoursePlugin : MethodChannel.MethodCallHandler { ...@@ -233,9 +235,9 @@ class CoursePlugin : MethodChannel.MethodCallHandler {
) )
checkPermission() checkPermission()
if (PlayerFloatHelper.isShow(mFragment!!.activity!!)) { if (PlayerFloatHelper.isShow(mFragment!!.requireActivity())) {
PlayerFloatHelper.hide() PlayerFloatHelper.hide()
PlayerFloatHelper.removeView(mFragment!!.activity!!) PlayerFloatHelper.removeView(mFragment!!.requireActivity())
AudioPlayer.get().stopPlayer() AudioPlayer.get().stopPlayer()
} }
} }
...@@ -268,14 +270,14 @@ class CoursePlugin : MethodChannel.MethodCallHandler { ...@@ -268,14 +270,14 @@ class CoursePlugin : MethodChannel.MethodCallHandler {
* 检测浮窗权限是否开启,若没有给与申请提示框(非必须,申请依旧是EasyFloat内部内保进行) * 检测浮窗权限是否开启,若没有给与申请提示框(非必须,申请依旧是EasyFloat内部内保进行)
*/ */
private fun checkPermission() { private fun checkPermission() {
if (PermissionUtils.checkPermission(mFragment!!.activity)) { if (PermissionUtils.checkPermission(mFragment!!.requireActivity())) {
VideoFloatHelper.showVideoFloat(mFragment!!.activity) VideoFloatHelper.showVideoFloat(mFragment!!.requireActivity())
} else { } else {
AlertDialog.Builder(mFragment!!.activity) AlertDialog.Builder(mFragment!!.activity)
.setMessage("使用浮窗功能,需要您授权悬浮窗权限。") .setMessage("使用浮窗功能,需要您授权悬浮窗权限。")
.setPositiveButton("去开启") { _, _ -> .setPositiveButton("去开启") { _, _ ->
VideoFloatHelper.showVideoFloat(mFragment!!.activity) mFragment!!.activity?.let { VideoFloatHelper.showVideoFloat(it) }
} }
.setNegativeButton("取消") { _, _ -> .setNegativeButton("取消") { _, _ ->
ToastUtil.toastLong( ToastUtil.toastLong(
......
...@@ -160,7 +160,7 @@ object VideoFloatHelper { ...@@ -160,7 +160,7 @@ object VideoFloatHelper {
fun dismissFloat(activity: Activity) { fun dismissFloat(activity: Activity) {
CourseSendPlugin.sendMsg(false) CourseSendPlugin.sendMsg(false)
EasyFloat.dismissAppFloat(activity, courseTag) EasyFloat.dismissAppFloat( courseTag)
if (videoView != null) { if (videoView != null) {
videoView!!.stopPlay() videoView!!.stopPlay()
videoView = null videoView = null
......
...@@ -27,6 +27,7 @@ modular { ...@@ -27,6 +27,7 @@ modular {
version = rootProject.ext.ydlPublishVersion[childProject.getName()+"-api"] version = rootProject.ext.ydlPublishVersion[childProject.getName()+"-api"]
// API 层打包时需要引入的依赖 // API 层打包时需要引入的依赖
apiDependencies { apiDependencies {
implementation 'androidx.fragment:fragment-ktx:1.2.4'
implementation "com.google.code.gson:gson:2.8.2" implementation "com.google.code.gson:gson:2.8.2"
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation 'com.alibaba:arouter-api:1.4.1' implementation 'com.alibaba:arouter-api:1.4.1'
......
...@@ -4,6 +4,7 @@ import android.animation.Animator ...@@ -4,6 +4,7 @@ import android.animation.Animator
import android.animation.AnimatorListenerAdapter import android.animation.AnimatorListenerAdapter
import android.animation.AnimatorSet import android.animation.AnimatorSet
import android.animation.ObjectAnimator import android.animation.ObjectAnimator
import android.annotation.SuppressLint
import android.content.Intent import android.content.Intent
import android.os.Bundle import android.os.Bundle
import android.os.Handler import android.os.Handler
...@@ -51,6 +52,7 @@ import java.util.* ...@@ -51,6 +52,7 @@ import java.util.*
class TrendsListFragment : BaseLazyFragment(), ITrendsListView, class TrendsListFragment : BaseLazyFragment(), ITrendsListView,
SwipeRefreshLayout.OnRefreshListener { SwipeRefreshLayout.OnRefreshListener {
private val mActivity =activity
private val REQUEST_CODE = 1001 private val REQUEST_CODE = 1001
private val eachPageDataNum = 20 private val eachPageDataNum = 20
...@@ -141,7 +143,7 @@ class TrendsListFragment : BaseLazyFragment(), ITrendsListView, ...@@ -141,7 +143,7 @@ class TrendsListFragment : BaseLazyFragment(), ITrendsListView,
private//关注 private//关注
val isNeedLogin: Boolean val isNeedLogin: Boolean
get() { get() {
tab = arguments.getInt("tab") tab = arguments?.getInt("tab")?:0
return tab == 3 return tab == 3
} }
...@@ -207,11 +209,13 @@ class TrendsListFragment : BaseLazyFragment(), ITrendsListView, ...@@ -207,11 +209,13 @@ class TrendsListFragment : BaseLazyFragment(), ITrendsListView,
isDoLikeAction = false isDoLikeAction = false
isTrendsListLoading = false isTrendsListLoading = false
mPresenter = TrendsListPresenter(this) mPresenter = TrendsListPresenter(this)
tab = arguments.getInt(KEY_TAB) arguments?.let {
topic_id = arguments.getInt(KEY_TOPIC_ID) tab = it.getInt(KEY_TAB)
trendType = arguments.getString(KEY_TREND_TYPE) topic_id = it.getInt(KEY_TOPIC_ID)
trendType = it.getString(KEY_TREND_TYPE)
userid = it.getString(KEY_USER_ID)
}
trendType = if (TextUtils.isEmpty(trendType)) TREND_TYPE_DEFAULT else trendType trendType = if (TextUtils.isEmpty(trendType)) TREND_TYPE_DEFAULT else trendType
userid = arguments.getString(KEY_USER_ID)
page = 1 page = 1
last_id = 0 last_id = 0
} }
...@@ -283,9 +287,9 @@ class TrendsListFragment : BaseLazyFragment(), ITrendsListView, ...@@ -283,9 +287,9 @@ class TrendsListFragment : BaseLazyFragment(), ITrendsListView,
// LinearLayoutManager layoutManager = new LinearLayoutManager(getActivity()); // LinearLayoutManager layoutManager = new LinearLayoutManager(getActivity());
trends_rcv!!.adapter = mRcvAdapter trends_rcv!!.adapter = mRcvAdapter
trends_rcv!!.layoutManager = layoutManager trends_rcv!!.layoutManager = layoutManager
trends_rcv!!.itemAnimator.changeDuration = 0 //解决局部刷新闪屏 trends_rcv!!.itemAnimator?.changeDuration = 0 //解决局部刷新闪屏
mScrollListener = object : RecyclerView.OnScrollListener() { mScrollListener = object : RecyclerView.OnScrollListener() {
override fun onScrollStateChanged(recyclerView: RecyclerView?, newState: Int) { override fun onScrollStateChanged(recyclerView: RecyclerView, newState: Int) {
super.onScrollStateChanged(recyclerView, newState) super.onScrollStateChanged(recyclerView, newState)
if (RecyclerView.SCROLL_STATE_IDLE == newState) { if (RecyclerView.SCROLL_STATE_IDLE == newState) {
if (totalItemCount <= lastVisibleItem + 1 && totalItemCount > visibleItemCount && visibleItemCount > 0) { if (totalItemCount <= lastVisibleItem + 1 && totalItemCount > visibleItemCount && visibleItemCount > 0) {
...@@ -305,7 +309,7 @@ class TrendsListFragment : BaseLazyFragment(), ITrendsListView, ...@@ -305,7 +309,7 @@ class TrendsListFragment : BaseLazyFragment(), ITrendsListView,
} }
} }
override fun onScrolled(recyclerView: RecyclerView?, dx: Int, dy: Int) { override fun onScrolled(recyclerView: RecyclerView, dx: Int, dy: Int) {
super.onScrolled(recyclerView, dx, dy) super.onScrolled(recyclerView, dx, dy)
try { try {
if (!recyclerView!!.canScrollVertically(-1)) { if (!recyclerView!!.canScrollVertically(-1)) {
...@@ -320,6 +324,7 @@ class TrendsListFragment : BaseLazyFragment(), ITrendsListView, ...@@ -320,6 +324,7 @@ class TrendsListFragment : BaseLazyFragment(), ITrendsListView,
.setListener(object : AnimatorListenerAdapter() { .setListener(object : AnimatorListenerAdapter() {
private var mCancelled: Boolean = false private var mCancelled: Boolean = false
@SuppressLint("RestrictedApi")
override fun onAnimationStart(animation: Animator) { override fun onAnimationStart(animation: Animator) {
if (image_scroll_top != null) { if (image_scroll_top != null) {
image_scroll_top!!.visibility = View.VISIBLE image_scroll_top!!.visibility = View.VISIBLE
...@@ -331,6 +336,7 @@ class TrendsListFragment : BaseLazyFragment(), ITrendsListView, ...@@ -331,6 +336,7 @@ class TrendsListFragment : BaseLazyFragment(), ITrendsListView,
mCancelled = true mCancelled = true
} }
@SuppressLint("RestrictedApi")
override fun onAnimationEnd(animation: Animator) { override fun onAnimationEnd(animation: Animator) {
if (!mCancelled && image_scroll_top != null) { if (!mCancelled && image_scroll_top != null) {
image_scroll_top!!.visibility = View.INVISIBLE image_scroll_top!!.visibility = View.INVISIBLE
...@@ -353,7 +359,7 @@ class TrendsListFragment : BaseLazyFragment(), ITrendsListView, ...@@ -353,7 +359,7 @@ class TrendsListFragment : BaseLazyFragment(), ITrendsListView,
} }
} }
trends_rcv!!.addOnScrollListener(mScrollListener) trends_rcv!!.addOnScrollListener(mScrollListener!!)
mRcvAdapter!!.addFooterView(footerView) mRcvAdapter!!.addFooterView(footerView)
if (headerCount > 0) { if (headerCount > 0) {
for (i in headers!!.indices) { for (i in headers!!.indices) {
...@@ -364,7 +370,7 @@ class TrendsListFragment : BaseLazyFragment(), ITrendsListView, ...@@ -364,7 +370,7 @@ class TrendsListFragment : BaseLazyFragment(), ITrendsListView,
private fun doLikeAction(view: View, position: Int, mDatas: List<TrendsListBean.Trend>) { private fun doLikeAction(view: View, position: Int, mDatas: List<TrendsListBean.Trend>) {
if (DynamicIn.loginByOneKeyLogin(activity,true)) { if (DynamicIn.loginByOneKeyLogin(mActivity!!,true)) {
if (!isDoLikeAction) { if (!isDoLikeAction) {
isDoLikeAction = true isDoLikeAction = true
mPresenter!!.doLikeAction( mPresenter!!.doLikeAction(
...@@ -467,8 +473,8 @@ class TrendsListFragment : BaseLazyFragment(), ITrendsListView, ...@@ -467,8 +473,8 @@ class TrendsListFragment : BaseLazyFragment(), ITrendsListView,
fun initClick() { fun initClick() {
recommend_trend_add_iv.setOnClickListener { recommend_trend_add_iv.setOnClickListener {
if (DynamicIn.loginByOneKeyLogin(activity,true)) { if (DynamicIn.loginByOneKeyLogin(mActivity!!,true)) {
val intent = Intent(activity.applicationContext, PublishTrendActivity::class.java) val intent = Intent(activity?.applicationContext, PublishTrendActivity::class.java)
val bundle = Bundle() val bundle = Bundle()
bundle.putString(DynamicConstants.PUBLISH_TYPE, "default_publish") bundle.putString(DynamicConstants.PUBLISH_TYPE, "default_publish")
intent.putExtra("bundle", bundle) intent.putExtra("bundle", bundle)
......
package com.cxzapp.yidianling.trends.trendsDetail package com.yidianling.dynamic.trendsDetail
import android.content.Context import android.content.Context
import androidx.viewpager.widget.PagerAdapter import androidx.viewpager.widget.PagerAdapter
...@@ -27,11 +27,11 @@ class AdViewPagerAdapter(private val context: Context, private val adList: Mutab ...@@ -27,11 +27,11 @@ class AdViewPagerAdapter(private val context: Context, private val adList: Mutab
var onClickListener: View.OnClickListener? = null var onClickListener: View.OnClickListener? = null
override fun isViewFromObject(view: View?, `object`: Any?): Boolean = view == `object` override fun isViewFromObject(view: View, `object`: Any): Boolean = view == `object`
override fun getCount() = adList.size override fun getCount() = adList.size
override fun instantiateItem(container: ViewGroup?, position: Int): Any? { override fun instantiateItem(container: ViewGroup, position: Int): Any {
val view = LayoutInflater.from(context).inflate(R.layout.dynamic_item_trend_detail_ad, container, false) val view = LayoutInflater.from(context).inflate(R.layout.dynamic_item_trend_detail_ad, container, false)
view.ivAd.layoutParams.height = ScreenUtil.getDisplayWidth() * 19 / 66 view.ivAd.layoutParams.height = ScreenUtil.getDisplayWidth() * 19 / 66
val ad = adList[position] val ad = adList[position]
...@@ -56,14 +56,14 @@ class AdViewPagerAdapter(private val context: Context, private val adList: Mutab ...@@ -56,14 +56,14 @@ class AdViewPagerAdapter(private val context: Context, private val adList: Mutab
.burryPoint("Dynamic_AD_Click") .burryPoint("Dynamic_AD_Click")
} }
} }
container?.addView(view) container.addView(view)
view.ivAd.requestLayout() view.ivAd.requestLayout()
return view return view
} }
override fun destroyItem(container: ViewGroup?, position: Int, `object`: Any?) { override fun destroyItem(container: ViewGroup, position: Int, `object`: Any) {
val view = `object` as View val view = `object` as View
container?.removeView(view) container.removeView(view)
} }
......
...@@ -36,7 +36,6 @@ import android.widget.RelativeLayout; ...@@ -36,7 +36,6 @@ import android.widget.RelativeLayout;
import android.widget.TextView; import android.widget.TextView;
import com.alibaba.android.arouter.facade.annotation.Route; import com.alibaba.android.arouter.facade.annotation.Route;
import com.cxzapp.yidianling.trends.trendsDetail.AdViewPagerAdapter;
import com.google.gson.internal.LinkedTreeMap; import com.google.gson.internal.LinkedTreeMap;
import com.umeng.socialize.UMShareAPI; import com.umeng.socialize.UMShareAPI;
import com.umeng.socialize.bean.SHARE_MEDIA; import com.umeng.socialize.bean.SHARE_MEDIA;
......
...@@ -60,10 +60,10 @@ android { ...@@ -60,10 +60,10 @@ android {
dependencies { dependencies {
api fileTree(dir: 'libs', include: ['*.jar', '*.aar']) api fileTree(dir: 'libs', include: ['*.jar', '*.aar'])
implementation 'androidx.appcompat:appcompat:1.0.0' implementation 'androidx.appcompat:appcompat:1.2.0'
testImplementation 'junit:junit:4.12' testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.1' androidTestImplementation 'androidx.test.ext:junit:1.1.2'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.0' androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
implementation "com.alibaba:arouter-api:$arouter_api" implementation "com.alibaba:arouter-api:$arouter_api"
// 注意此处的依赖方式:kotlin中使用和java中使用方式有不同 // 注意此处的依赖方式:kotlin中使用和java中使用方式有不同
......
...@@ -20,6 +20,11 @@ android { ...@@ -20,6 +20,11 @@ android {
compileSdkVersion rootProject.ext.android["compileSdkVersion"] compileSdkVersion rootProject.ext.android["compileSdkVersion"]
buildToolsVersion rootProject.ext.android["buildToolsVersion"] buildToolsVersion rootProject.ext.android["buildToolsVersion"]
compileOptions {
sourceCompatibility 1.8
targetCompatibility 1.8
}
defaultConfig { defaultConfig {
minSdkVersion rootProject.ext.android["minSdkVersion"] minSdkVersion rootProject.ext.android["minSdkVersion"]
targetSdkVersion rootProject.ext.android["targetSdkVersion"] targetSdkVersion rootProject.ext.android["targetSdkVersion"]
...@@ -50,11 +55,6 @@ android { ...@@ -50,11 +55,6 @@ android {
xlzx {} xlzx {}
} }
compileOptions {
sourceCompatibility 1.8
targetCompatibility 1.8
}
sourceSets { sourceSets {
main { main {
res.srcDirs = ['src/main/res'] res.srcDirs = ['src/main/res']
...@@ -65,13 +65,14 @@ android { ...@@ -65,13 +65,14 @@ android {
dependencies { dependencies {
api fileTree(dir: 'libs', include: ['*.jar', '*.aar']) api fileTree(dir: 'libs', include: ['*.jar', '*.aar'])
implementation 'androidx.appcompat:appcompat:1.0.0' implementation 'androidx.appcompat:appcompat:1.2.0'
implementation 'androidx.fragment:fragment-ktx:1.2.4'
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
testImplementation 'junit:junit:4.12' testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.1' androidTestImplementation 'androidx.test.ext:junit:1.1.2'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.0' androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
api "com.airbnb.android:lottie:2.5.0" api "com.airbnb.android:lottie:3.4.0"
implementation "com.alibaba:arouter-api:$arouter_api" implementation "com.alibaba:arouter-api:$arouter_api"
// 注意此处的依赖方式:kotlin中使用和java中使用方式有不同 // 注意此处的依赖方式:kotlin中使用和java中使用方式有不同
......
...@@ -27,6 +27,8 @@ modular { ...@@ -27,6 +27,8 @@ modular {
version = rootProject.ext.ydlPublishVersion[childProject.getName()+"-api"] version = rootProject.ext.ydlPublishVersion[childProject.getName()+"-api"]
// API 层打包时需要引入的依赖 // API 层打包时需要引入的依赖
apiDependencies { apiDependencies {
implementation 'androidx.appcompat:appcompat:1.2.0'
implementation 'androidx.fragment:fragment-ktx:1.2.4'
implementation "com.google.code.gson:gson:2.8.2" implementation "com.google.code.gson:gson:2.8.2"
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation 'com.alibaba:arouter-api:1.4.1' implementation 'com.alibaba:arouter-api:1.4.1'
......
...@@ -124,9 +124,9 @@ open class HomeBaseImpl : IHomeBaseEvent { ...@@ -124,9 +124,9 @@ open class HomeBaseImpl : IHomeBaseEvent {
override fun onPageScroll(view_rl_top_bg: View): RecyclerView.OnScrollListener? { override fun onPageScroll(view_rl_top_bg: View): RecyclerView.OnScrollListener? {
return object : RecyclerView.OnScrollListener() { return object : RecyclerView.OnScrollListener() {
override fun onScrolled(recyclerView: RecyclerView?, dx: Int, dy: Int) { override fun onScrolled(recyclerView: RecyclerView, dx: Int, dy: Int) {
super.onScrolled(recyclerView, dx, dy) super.onScrolled(recyclerView, dx, dy)
if (headerView == null) headerView = recyclerView?.getChildAt(0) if (headerView == null) headerView = recyclerView.getChildAt(0)
val top = headerView?.top val top = headerView?.top
val height = Math.abs(top!!) val height = Math.abs(top!!)
var per = height.toFloat() / 500 var per = height.toFloat() / 500
...@@ -201,7 +201,11 @@ open class HomeBaseImpl : IHomeBaseEvent { ...@@ -201,7 +201,11 @@ open class HomeBaseImpl : IHomeBaseEvent {
//防止连击 //防止连击
return return
} }
EventBus.getDefault().post(HomeModuleTabEvent(2)) EventBus.getDefault().post(
HomeModuleTabEvent(
2
)
)
ActionCountUtils.count(HomeBIConstants.YDL_USER_CONSULT_MORE_CLICK) ActionCountUtils.count(HomeBIConstants.YDL_USER_CONSULT_MORE_CLICK)
} }
...@@ -268,7 +272,11 @@ open class HomeBaseImpl : IHomeBaseEvent { ...@@ -268,7 +272,11 @@ open class HomeBaseImpl : IHomeBaseEvent {
//防止连击 //防止连击
return return
} }
EventBus.getDefault().post(HomeModuleTabEvent(2)) EventBus.getDefault().post(
HomeModuleTabEvent(
2
)
)
ActionCountUtils.count(HomeBIConstants.YDL_USER_CONSULT_CLICK) ActionCountUtils.count(HomeBIConstants.YDL_USER_CONSULT_CLICK)
} }
......
package com.yidianling.home.modular package com.yidianling.home.modular
import android.content.Context import android.content.Context
import androidx.fragment.app.Fragment
import com.alibaba.android.arouter.facade.annotation.Route import com.alibaba.android.arouter.facade.annotation.Route
import com.yidianling.home.api.service.IHomeService import com.yidianling.home.api.service.IHomeService
import com.yidianling.home.ui.fragment.YdlHomeFragment import com.yidianling.home.ui.fragment.YdlHomeFragment
@Route(path = "/home/HomeService") @Route(path = "/home/HomeService")
class HomeServiceImpl : IHomeService { class HomeServiceImpl :
IHomeService {
override fun init(context: Context?) { override fun init(context: Context?) {
...@@ -16,7 +16,7 @@ class HomeServiceImpl : IHomeService { ...@@ -16,7 +16,7 @@ class HomeServiceImpl : IHomeService {
override fun setDouble11ShowType(mBool: Boolean) { override fun setDouble11ShowType(mBool: Boolean) {
} }
override fun getYDLHomeFragment(): Fragment { override fun getYDLHomeFragment(): YdlHomeFragment {
return YdlHomeFragment() return YdlHomeFragment()
} }
} }
\ No newline at end of file
...@@ -102,7 +102,7 @@ class YdlHomeAdapter( ...@@ -102,7 +102,7 @@ class YdlHomeAdapter(
} }
override fun onCreateViewHolder(parent: ViewGroup?, viewType: Int): RecyclerView.ViewHolder { override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): RecyclerView.ViewHolder {
when (viewType) { when (viewType) {
//顶部图片banner //顶部图片banner
YdlHomeViewHolderConstract.HOME_IMAGE_BANNER -> { YdlHomeViewHolderConstract.HOME_IMAGE_BANNER -> {
......
package com.yidianling.home.ui.fragment package com.yidianling.home.ui.fragment
import android.app.Dialog import android.app.Dialog
import android.os.Build
import com.google.android.material.appbar.CollapsingToolbarLayout
import androidx.coordinatorlayout.widget.CoordinatorLayout
import androidx.core.content.ContextCompat
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout
import androidx.recyclerview.widget.LinearLayoutManager
import android.text.TextUtils import android.text.TextUtils
import android.view.View import android.view.View
import android.widget.RelativeLayout import androidx.core.content.ContextCompat
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout
import com.alibaba.android.arouter.facade.annotation.Route import com.alibaba.android.arouter.facade.annotation.Route
import com.ydl.webview.H5Params import com.ydl.webview.H5Params
import com.ydl.webview.NewH5Activity import com.ydl.webview.NewH5Activity
...@@ -19,9 +15,10 @@ import com.ydl.ydlcommon.base.BaseMvpFragment ...@@ -19,9 +15,10 @@ import com.ydl.ydlcommon.base.BaseMvpFragment
import com.ydl.ydlcommon.bean.StatusBarOptions import com.ydl.ydlcommon.bean.StatusBarOptions
import com.ydl.ydlcommon.data.http.BaseResponse import com.ydl.ydlcommon.data.http.BaseResponse
import com.ydl.ydlcommon.modular.ModularServiceManager import com.ydl.ydlcommon.modular.ModularServiceManager
import com.ydl.ydlcommon.utils.* import com.ydl.ydlcommon.utils.SharedPreferencesEditor
import com.ydl.ydlcommon.utils.StatusBarUtils
import com.ydl.ydlcommon.utils.Utils
import com.ydl.ydlcommon.utils.remind.ToastHelper import com.ydl.ydlcommon.utils.remind.ToastHelper
import com.ydl.ydlcommon.view.banner.GlideImageLoader
import com.yidianling.consultant.api.IConsultantService import com.yidianling.consultant.api.IConsultantService
import com.yidianling.home.R import com.yidianling.home.R
import com.yidianling.home.adapter.YdlHomeAdapter import com.yidianling.home.adapter.YdlHomeAdapter
...@@ -53,6 +50,8 @@ class YdlHomeFragment : BaseMvpFragment<IHomeContract.View, HomePresenterImpl>() ...@@ -53,6 +50,8 @@ class YdlHomeFragment : BaseMvpFragment<IHomeContract.View, HomePresenterImpl>()
IHomeContract.View, IHomeContract.View,
SwipeRefreshLayout.OnRefreshListener { SwipeRefreshLayout.OnRefreshListener {
var mActivity = activity
var mContext = context
private var adapter: YdlHomeAdapter? = null private var adapter: YdlHomeAdapter? = null
private var homeEvent: HomeImpl? = null private var homeEvent: HomeImpl? = null
...@@ -90,21 +89,21 @@ class YdlHomeFragment : BaseMvpFragment<IHomeContract.View, HomePresenterImpl>() ...@@ -90,21 +89,21 @@ class YdlHomeFragment : BaseMvpFragment<IHomeContract.View, HomePresenterImpl>()
} }
override fun initDataAndEvent() { override fun initDataAndEvent() {
homeEvent = HomeImpl(activity, this) homeEvent = HomeImpl(mActivity!!, this)
initView() initView()
initAdapter() initAdapter()
} }
private fun initAdapter() { private fun initAdapter() {
mPresenter?.localHomeData(this.context, "home_data_xlzx.json") mPresenter?.localHomeData(mContext!!, "home_data_xlzx.json")
adapter = YdlHomeAdapter(context, homeEvent!!, ArrayList()) adapter = YdlHomeAdapter(mContext!!, homeEvent!!, ArrayList())
val layoutManager = val layoutManager =
LinearLayoutManager(context) LinearLayoutManager(context)
home_module_fragment_recycler.layoutManager = layoutManager home_module_fragment_recycler.layoutManager = layoutManager
home_module_fragment_recycler.adapter = adapter home_module_fragment_recycler.adapter = adapter
scrollListner = HomeConfideRecyleSuspendListener() scrollListner = HomeConfideRecyleSuspendListener()
home_module_fragment_recycler.addOnScrollListener(scrollListner) home_module_fragment_recycler.addOnScrollListener(scrollListner!!)
} }
private fun initView() { private fun initView() {
...@@ -113,7 +112,7 @@ class YdlHomeFragment : BaseMvpFragment<IHomeContract.View, HomePresenterImpl>() ...@@ -113,7 +112,7 @@ class YdlHomeFragment : BaseMvpFragment<IHomeContract.View, HomePresenterImpl>()
home_swipe_refresh_layout.setOnRefreshListener(this) home_swipe_refresh_layout.setOnRefreshListener(this)
home_swipe_refresh_layout.setColorSchemeColors( home_swipe_refresh_layout.setColorSchemeColors(
ContextCompat.getColor( ContextCompat.getColor(
context, mContext!!,
R.color.platform_main_theme R.color.platform_main_theme
) )
) )
...@@ -123,7 +122,7 @@ class YdlHomeFragment : BaseMvpFragment<IHomeContract.View, HomePresenterImpl>() ...@@ -123,7 +122,7 @@ class YdlHomeFragment : BaseMvpFragment<IHomeContract.View, HomePresenterImpl>()
home_page_xiaoyi.setOnClickListener { home_page_xiaoyi.setOnClickListener {
activity?.let { activity?.let {
ModularServiceManager.provide(IImService::class.java).startP2PXiaoYi(activity) ModularServiceManager.provide(IImService::class.java).startP2PXiaoYi(mActivity!!)
} }
} }
...@@ -249,16 +248,16 @@ class YdlHomeFragment : BaseMvpFragment<IHomeContract.View, HomePresenterImpl>() ...@@ -249,16 +248,16 @@ class YdlHomeFragment : BaseMvpFragment<IHomeContract.View, HomePresenterImpl>()
if (!TextUtils.isEmpty(act.imageBanner)) { if (!TextUtils.isEmpty(act.imageBanner)) {
//展示弹窗 //展示弹窗
if (aa == null) { if (aa == null) {
aa = ActivityDialog(activity, act.imageBanner, act.linkUrl, act.title) aa = ActivityDialog(mActivity!!, act.imageBanner, act.linkUrl, act.title)
aa?.show() aa?.show()
aa?.setOnDismissListener { aa?.setOnDismissListener {
if (!TextUtils.isEmpty(act.title)) { if (!TextUtils.isEmpty(act.title)) {
img_ad.post { img_ad.post {
val heig = StatusBarUtils.getStatusBarHeight(context) val heig = StatusBarUtils.getStatusBarHeight(mContext!!)
var location = IntArray(2) var location = IntArray(2)
img_ad.getLocationInWindow(location) img_ad.getLocationInWindow(location)
ActivityGuideDialog( ActivityGuideDialog(
activity, mActivity!!,
act.imageUrl, act.imageUrl,
act.title, act.title,
location[1] - heig, location[1] - heig,
...@@ -378,7 +377,7 @@ class YdlHomeFragment : BaseMvpFragment<IHomeContract.View, HomePresenterImpl>() ...@@ -378,7 +377,7 @@ class YdlHomeFragment : BaseMvpFragment<IHomeContract.View, HomePresenterImpl>()
private fun showConsultAssistantDialog() { private fun showConsultAssistantDialog() {
ModularServiceManager.provide(IConsultantService::class.java) ModularServiceManager.provide(IConsultantService::class.java)
.showConsultAssistantDialog(activity) .showConsultAssistantDialog(mActivity!!)
} }
private fun hideConsultAssistantDialog() { private fun hideConsultAssistantDialog() {
...@@ -397,7 +396,7 @@ class YdlHomeFragment : BaseMvpFragment<IHomeContract.View, HomePresenterImpl>() ...@@ -397,7 +396,7 @@ class YdlHomeFragment : BaseMvpFragment<IHomeContract.View, HomePresenterImpl>()
mPresenter?.getConfideData(confideLastSelectType, confideLastSelectPosition) mPresenter?.getConfideData(confideLastSelectType, confideLastSelectPosition)
} }
mPresenter?.prepareCoupon(activity) mPresenter?.prepareCoupon(mActivity!!)
//走咨询助理浮层展示逻辑,是否展示由内部条件与接口判断 //走咨询助理浮层展示逻辑,是否展示由内部条件与接口判断
showConsultAssistantDialog() showConsultAssistantDialog()
......
package com.yidianling.home.adapter package com.yidianling.home.adapter
import android.content.Context import android.content.Context
import android.support.v4.view.PagerAdapter
import android.util.Log import android.util.Log
import android.view.View import android.view.View
import android.view.ViewGroup import android.view.ViewGroup
import androidx.viewpager.widget.PagerAdapter
import com.yidianling.home.event.IHomeBaseEvent import com.yidianling.home.event.IHomeBaseEvent
import com.yidianling.home.model.bean.HomeHeaderBean import com.yidianling.home.model.bean.HomeHeaderBean
import com.yidianling.home.ui.view.HomeCategoryContainer import com.yidianling.home.ui.view.HomeCategoryContainer
...@@ -19,7 +19,7 @@ import kotlin.collections.ArrayList ...@@ -19,7 +19,7 @@ import kotlin.collections.ArrayList
* @Company 壹点灵 * @Company 壹点灵
* @date 2019/3/18 * @date 2019/3/18
*/ */
class HomeCategoryAdapter : PagerAdapter{ class HomeCategoryAdapter : PagerAdapter {
private var mContext : Context? = null private var mContext : Context? = null
private var mHomeEvent : IHomeBaseEvent? = null private var mHomeEvent : IHomeBaseEvent? = null
...@@ -50,19 +50,19 @@ class HomeCategoryAdapter : PagerAdapter{ ...@@ -50,19 +50,19 @@ class HomeCategoryAdapter : PagerAdapter{
notifyDataSetChanged() notifyDataSetChanged()
} }
override fun isViewFromObject(view: View?, `object`: Any?): Boolean { override fun isViewFromObject(view: View, `object`: Any): Boolean {
return view === `object` return view === `object`
} }
override fun instantiateItem(container: ViewGroup?, position: Int): Any { override fun instantiateItem(container: ViewGroup, position: Int): Any {
val categoryView = HomePagerBannerCategoryItemView(mContext!!,mHomeEvent!!) val categoryView = HomePagerBannerCategoryItemView(mContext!!,mHomeEvent!!)
categoryView.initData(list!![position]) categoryView.initData(list!![position])
container?.addView(categoryView) container.addView(categoryView)
return categoryView return categoryView
} }
//====================ViewPager 不刷新问题==================== //====================ViewPager 不刷新问题====================
override fun getItemPosition(`object`: Any?): Int { override fun getItemPosition(`object`: Any): Int {
return PagerAdapter.POSITION_NONE return PagerAdapter.POSITION_NONE
} }
......
package com.yidianling.home.adapter package com.yidianling.home.adapter
import android.content.Context import android.content.Context
import android.graphics.Color
import android.support.v7.widget.RecyclerView
import android.view.LayoutInflater import android.view.LayoutInflater
import android.view.View import android.view.View
import android.view.ViewGroup import android.view.ViewGroup
import android.widget.ImageView import android.widget.ImageView
import androidx.recyclerview.widget.RecyclerView
import com.ydl.ydl_image.module.GlideApp import com.ydl.ydl_image.module.GlideApp
import com.yidianling.home.R import com.yidianling.home.R
import com.yidianling.home.constract.HomeViewConfig import com.yidianling.home.constract.HomeViewConfig
...@@ -112,7 +111,7 @@ class YdlHomeAdapter(private val mContext: Context, ...@@ -112,7 +111,7 @@ class YdlHomeAdapter(private val mContext: Context,
} }
override fun onCreateViewHolder(parent: ViewGroup?, viewType: Int): RecyclerView.ViewHolder { override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): RecyclerView.ViewHolder {
when (viewType) { when (viewType) {
//顶部ViewPager与分类模块 //顶部ViewPager与分类模块
HomeViewConfig.getOrder().bannerIndex -> { HomeViewConfig.getOrder().bannerIndex -> {
......
package com.yidianling.home.listener package com.yidianling.home.listener
import android.content.Context import android.content.Context
import android.support.design.widget.TabLayout
import android.support.v7.widget.LinearLayoutManager
import android.support.v7.widget.RecyclerView
import android.util.Log import android.util.Log
import android.view.View import android.view.View
import android.view.ViewGroup import android.view.ViewGroup
import android.widget.ImageView import android.widget.ImageView
import android.widget.LinearLayout import android.widget.LinearLayout
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
import com.google.android.material.tabs.TabLayout
import com.yidianling.common.tools.RxDeviceTool import com.yidianling.common.tools.RxDeviceTool
import com.yidianling.common.tools.RxImageTool import com.yidianling.common.tools.RxImageTool
import com.yidianling.home.adapter.YdlHomeAdapter import com.yidianling.home.adapter.YdlHomeAdapter
...@@ -86,21 +86,21 @@ class HomeConfideRecyleSuspendListener : RecyclerView.OnScrollListener() { ...@@ -86,21 +86,21 @@ class HomeConfideRecyleSuspendListener : RecyclerView.OnScrollListener() {
this.mPhoneCallView = callView this.mPhoneCallView = callView
} }
override fun onScrollStateChanged(recyclerView: RecyclerView?, newState: Int) { override fun onScrollStateChanged(recyclerView: RecyclerView, newState: Int) {
super.onScrollStateChanged(recyclerView, newState) super.onScrollStateChanged(recyclerView, newState)
if (null != confideFilterView) { if (null != confideFilterView) {
mSuspensionHeight = confideFilterView!!.height mSuspensionHeight = confideFilterView!!.height
} }
} }
override fun onScrolled(recyclerView: RecyclerView?, dx: Int, dy: Int) { override fun onScrolled(recyclerView: RecyclerView, dx: Int, dy: Int) {
super.onScrolled(recyclerView, dx, dy) super.onScrolled(recyclerView, dx, dy)
if (null == adapter) { if (null == adapter) {
return return
} }
Log.e("Tag", "-------dy=$dy") Log.e("Tag", "-------dy=$dy")
// moveSearchView(dy) // moveSearchView(dy)
val manager = recyclerView!!.layoutManager as LinearLayoutManager val manager = recyclerView.layoutManager as LinearLayoutManager
if (mCurrentPosition != manager.findFirstVisibleItemPosition() && manager.findFirstVisibleItemPosition() != -1) { if (mCurrentPosition != manager.findFirstVisibleItemPosition() && manager.findFirstVisibleItemPosition() != -1) {
mCurrentPosition = manager.findFirstVisibleItemPosition() mCurrentPosition = manager.findFirstVisibleItemPosition()
} }
......
package com.yidianling.home.ui.view package com.yidianling.home.ui.view
import android.content.Context import android.content.Context
import android.support.v7.widget.RecyclerView
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 androidx.recyclerview.widget.RecyclerView
import com.ydl.ydl_image.manager.YDLImageCacheManager import com.ydl.ydl_image.manager.YDLImageCacheManager
import com.yidianling.home.R import com.yidianling.home.R
import com.yidianling.home.event.IHomeBaseEvent import com.yidianling.home.event.IHomeBaseEvent
import com.yidianling.home.event.IHomeEvent
import com.yidianling.home.model.bean.HomeArticleBean import com.yidianling.home.model.bean.HomeArticleBean
import kotlinx.android.synthetic.ydl.home_article_item_view.view.* import kotlinx.android.synthetic.ydl.home_article_item_view.view.*
......
package com.yidianling.home.ui.view package com.yidianling.home.ui.view
import android.content.Context import android.content.Context
import android.support.v7.widget.RecyclerView
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 androidx.recyclerview.widget.RecyclerView
import com.yidianling.home.R import com.yidianling.home.R
import com.yidianling.home.constract.HomeViewConfig import com.yidianling.home.constract.HomeViewConfig
import com.yidianling.home.event.IHomeBaseEvent import com.yidianling.home.event.IHomeBaseEvent
......
package com.yidianling.home.ui.view package com.yidianling.home.ui.view
import android.content.Context import android.content.Context
import android.support.v7.widget.CardView
import android.view.View import android.view.View
import android.widget.LinearLayout import android.widget.LinearLayout
import androidx.cardview.widget.CardView
import com.yidianling.home.R import com.yidianling.home.R
import com.yidianling.home.event.IHomeBaseEvent import com.yidianling.home.event.IHomeBaseEvent
import com.ydl.ydl_image.manager.YDLImageCacheManager import com.ydl.ydl_image.manager.YDLImageCacheManager
......
...@@ -15,9 +15,7 @@ import com.yidianling.home.event.IHomeBaseEvent ...@@ -15,9 +15,7 @@ import com.yidianling.home.event.IHomeBaseEvent
import com.yidianling.home.model.bean.HomeAskBean import com.yidianling.home.model.bean.HomeAskBean
import com.ydl.ydl_image.config.SimpleImageOpConfiger import com.ydl.ydl_image.config.SimpleImageOpConfiger
import com.ydl.ydl_image.manager.YDLImageCacheManager import com.ydl.ydl_image.manager.YDLImageCacheManager
import com.ydl.ydl_router.manager.YDLRouterManager
import com.ydl.ydlcommon.modular.ModularServiceManager import com.ydl.ydlcommon.modular.ModularServiceManager
import com.ydl.ydlcommon.router.IYDLRouterConstant
import com.ydl.ydlcommon.utils.MoonUtil import com.ydl.ydlcommon.utils.MoonUtil
import com.ydl.ydlcommon.utils.Utils import com.ydl.ydlcommon.utils.Utils
import com.yidianling.common.tools.RxDeviceTool import com.yidianling.common.tools.RxDeviceTool
......
package com.yidianling.home.ui.view package com.yidianling.home.ui.view
import android.content.Context import android.content.Context
import android.support.v7.widget.RecyclerView
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 androidx.recyclerview.widget.RecyclerView
import com.yidianling.home.R import com.yidianling.home.R
import com.yidianling.home.event.IHomeBaseEvent import com.yidianling.home.event.IHomeBaseEvent
import com.yidianling.common.tools.RxDeviceTool import com.yidianling.common.tools.RxDeviceTool
......
package com.yidianling.home.ui.view package com.yidianling.home.ui.view
import android.content.Context import android.content.Context
import android.support.v4.view.ViewPager
import android.view.View import android.view.View
import android.view.ViewGroup import android.view.ViewGroup
import android.widget.ImageView import android.widget.ImageView
import android.widget.LinearLayout import android.widget.LinearLayout
import android.widget.RelativeLayout import android.widget.RelativeLayout
import androidx.viewpager.widget.ViewPager
import com.yidianling.home.R import com.yidianling.home.R
import com.yidianling.home.adapter.HomeCategoryAdapter import com.yidianling.home.adapter.HomeCategoryAdapter
import com.yidianling.home.event.IHomeBaseEvent import com.yidianling.home.event.IHomeBaseEvent
......
...@@ -2,10 +2,10 @@ package com.yidianling.home.ui.view ...@@ -2,10 +2,10 @@ package com.yidianling.home.ui.view
import android.content.Context import android.content.Context
import android.graphics.PointF import android.graphics.PointF
import android.support.v4.view.ViewPager
import android.util.AttributeSet import android.util.AttributeSet
import android.util.Log import android.util.Log
import android.view.MotionEvent import android.view.MotionEvent
import androidx.viewpager.widget.ViewPager
/** /**
......
package com.yidianling.home.ui.view package com.yidianling.home.ui.view
import android.content.Context import android.content.Context
import android.support.constraint.ConstraintLayout
import android.util.AttributeSet import android.util.AttributeSet
import android.view.View import android.view.View
import androidx.constraintlayout.widget.ConstraintLayout
import com.yidianling.home.R import com.yidianling.home.R
import kotlinx.android.synthetic.ydl.home_common_title_view.view.* import kotlinx.android.synthetic.ydl.home_common_title_view.view.*
......
...@@ -3,13 +3,13 @@ package com.yidianling.home.ui.view ...@@ -3,13 +3,13 @@ package com.yidianling.home.ui.view
import android.content.Context import android.content.Context
import android.graphics.Typeface import android.graphics.Typeface
import android.os.Build import android.os.Build
import android.support.design.widget.TabLayout
import android.support.v4.content.ContextCompat
import android.support.v7.widget.RecyclerView
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 android.widget.TextView import android.widget.TextView
import androidx.core.content.ContextCompat
import androidx.recyclerview.widget.RecyclerView
import com.google.android.material.tabs.TabLayout
import com.yidianling.common.tools.LogUtil import com.yidianling.common.tools.LogUtil
import com.yidianling.home.R import com.yidianling.home.R
import com.yidianling.home.constract.HomeViewConfig import com.yidianling.home.constract.HomeViewConfig
...@@ -118,7 +118,7 @@ class HomeConfideView(private val mContext: Context, private var homeEvent: IHom ...@@ -118,7 +118,7 @@ class HomeConfideView(private val mContext: Context, private var homeEvent: IHom
cacheInfoViewList!!.add(homeConfideExpertInfoView) cacheInfoViewList!!.add(homeConfideExpertInfoView)
} }
//设置数据 //设置数据
cacheInfoViewList!![index].setData(list[index]!!, index, index == list!!.size - 1) cacheInfoViewList!![index].setData(list[index], index, index == list!!.size - 1)
//添加到布局 //添加到布局
ll_content.addView(cacheInfoViewList!![index]) ll_content.addView(cacheInfoViewList!![index])
} }
...@@ -157,14 +157,14 @@ class HomeConfideView(private val mContext: Context, private var homeEvent: IHom ...@@ -157,14 +157,14 @@ class HomeConfideView(private val mContext: Context, private var homeEvent: IHom
if (mLastPosition == tab!!.position){ if (mLastPosition == tab!!.position){
return return
} }
var textView = ((tabLayout!!.getChildAt(0) as LinearLayout).getChildAt(tab!!.position) as LinearLayout).getChildAt(1) var textView = ((tabLayout!!.getChildAt(0) as LinearLayout).getChildAt(tab.position) as LinearLayout).getChildAt(1)
if (textView != null && textView is TextView) { if (textView != null && textView is TextView) {
textView.textSize = 17f textView.textSize = 17f
textView.setTextColor(ContextCompat.getColor(mContext, R.color.platform_color_242424)) textView.setTextColor(ContextCompat.getColor(mContext, R.color.platform_color_242424))
textView.typeface = Typeface.defaultFromStyle(Typeface.BOLD) textView.typeface = Typeface.defaultFromStyle(Typeface.BOLD)
} }
homeEvent!!.getConfideData(list!![tab!!.position], tab!!.position) homeEvent!!.getConfideData(list!![tab.position], tab.position)
} }
} }
} }
...@@ -12,7 +12,6 @@ import com.ydl.ydlcommon.modular.ModularServiceManager ...@@ -12,7 +12,6 @@ import com.ydl.ydlcommon.modular.ModularServiceManager
import com.ydl.ydlcommon.utils.StringUtils import com.ydl.ydlcommon.utils.StringUtils
import com.ydl.ydlcommon.utils.URLUtils import com.ydl.ydlcommon.utils.URLUtils
import com.ydl.ydlcommon.utils.actionutil.ActionCountUtils import com.ydl.ydlcommon.utils.actionutil.ActionCountUtils
import com.yidianling.common.tools.LogUtil
import com.yidianling.common.tools.RxImageTool import com.yidianling.common.tools.RxImageTool
import com.yidianling.consultant.api.IConsultantService import com.yidianling.consultant.api.IConsultantService
import com.yidianling.home.R import com.yidianling.home.R
......
...@@ -3,13 +3,13 @@ package com.yidianling.home.ui.view ...@@ -3,13 +3,13 @@ package com.yidianling.home.ui.view
import android.content.Context import android.content.Context
import android.graphics.Typeface import android.graphics.Typeface
import android.os.Build import android.os.Build
import android.support.design.widget.TabLayout
import android.support.v4.content.ContextCompat
import android.support.v7.widget.RecyclerView
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 android.widget.TextView import android.widget.TextView
import androidx.core.content.ContextCompat
import androidx.recyclerview.widget.RecyclerView
import com.google.android.material.tabs.TabLayout
import com.yidianling.common.tools.LogUtil import com.yidianling.common.tools.LogUtil
import com.yidianling.home.R import com.yidianling.home.R
import com.yidianling.home.constract.HomeViewConfig import com.yidianling.home.constract.HomeViewConfig
......
...@@ -2,10 +2,10 @@ package com.yidianling.home.ui.view ...@@ -2,10 +2,10 @@ package com.yidianling.home.ui.view
import android.annotation.SuppressLint import android.annotation.SuppressLint
import android.content.Context import android.content.Context
import android.support.v7.widget.RecyclerView
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 androidx.recyclerview.widget.RecyclerView
import com.google.gson.Gson import com.google.gson.Gson
import com.yidianling.home.R import com.yidianling.home.R
import com.yidianling.home.constract.HomeViewConfig import com.yidianling.home.constract.HomeViewConfig
......
package com.yidianling.home.ui.view package com.yidianling.home.ui.view
import android.graphics.Rect import android.graphics.Rect
import android.support.v7.widget.RecyclerView
import android.support.v7.widget.RecyclerView.ItemDecoration
import android.view.View import android.view.View
import androidx.recyclerview.widget.RecyclerView
import com.yidianling.home.constract.HomeViewConfig import com.yidianling.home.constract.HomeViewConfig
/** /**
* Created by haorui on 2020/3/23. * Created by haorui on 2020/3/23.
* Des: * Des:
*/ */
class HomeSpaceItemDecoration(var mSpace: Int) : ItemDecoration() { class HomeSpaceItemDecoration(var mSpace: Int) : RecyclerView.ItemDecoration() {
override fun getItemOffsets( override fun getItemOffsets(
outRect: Rect, outRect: Rect,
...@@ -20,7 +19,7 @@ class HomeSpaceItemDecoration(var mSpace: Int) : ItemDecoration() { ...@@ -20,7 +19,7 @@ class HomeSpaceItemDecoration(var mSpace: Int) : ItemDecoration() {
) { ) {
super.getItemOffsets(outRect, view, parent, state) super.getItemOffsets(outRect, view, parent, state)
val position = parent.getChildAdapterPosition(view) val position = parent.getChildAdapterPosition(view)
when(val viewType = parent.adapter.getItemViewType(position)){ when(val viewType = parent.adapter!!.getItemViewType(position)){
HomeViewConfig.getOrder().bannerIndex->{ HomeViewConfig.getOrder().bannerIndex->{
//空banner时不设置间距 //空banner时不设置间距
if (viewType!=-1&&HomeViewConfig.getOrder().buttonIndex==null){ if (viewType!=-1&&HomeViewConfig.getOrder().buttonIndex==null){
...@@ -30,8 +29,8 @@ class HomeSpaceItemDecoration(var mSpace: Int) : ItemDecoration() { ...@@ -30,8 +29,8 @@ class HomeSpaceItemDecoration(var mSpace: Int) : ItemDecoration() {
else ->{ else ->{
if (HomeViewConfig.getOrder().footerIndex!=null){ if (HomeViewConfig.getOrder().footerIndex!=null){
//底部footer显示时,倒数第一、二个View不设置间距 //底部footer显示时,倒数第一、二个View不设置间距
if ( position!=parent.adapter.itemCount-1 if ( position!=parent.adapter!!.itemCount-1
&& position!=parent.adapter.itemCount-2){ && position!=parent.adapter!!.itemCount-2){
outRect.bottom = mSpace outRect.bottom = mSpace
} }
}else{ }else{
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
> >
<android.support.v4.view.ViewPager <androidx.viewpager.widget.ViewPager
android:id="@+id/vp_category" android:id="@+id/vp_category"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="153dp" android:layout_height="153dp"
......
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
android:layout_height="wrap_content" /> android:layout_height="wrap_content" />
<android.support.design.widget.TabLayout <com.google.android.material.tabs.TabLayout
android:id="@+id/tab_layout" android:id="@+id/tab_layout"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="40dp" android:layout_height="40dp"
......
...@@ -9,19 +9,19 @@ ...@@ -9,19 +9,19 @@
android:background="@color/platform_white" android:background="@color/platform_white"
android:orientation="vertical"> android:orientation="vertical">
<android.support.v4.widget.SwipeRefreshLayout <androidx.swiperefreshlayout.widget.SwipeRefreshLayout
android:id="@+id/home_swipe_refresh_layout" android:id="@+id/home_swipe_refresh_layout"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent"> android:layout_height="match_parent">
<android.support.v7.widget.RecyclerView <androidx.recyclerview.widget.RecyclerView
android:id="@+id/home_module_fragment_recycler" android:id="@+id/home_module_fragment_recycler"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:background="@color/platform_white" android:background="@color/platform_white"
android:divider="@null" android:divider="@null"
android:overScrollMode="never"/> android:overScrollMode="never"/>
</android.support.v4.widget.SwipeRefreshLayout> </androidx.swiperefreshlayout.widget.SwipeRefreshLayout>
<RelativeLayout <RelativeLayout
android:layout_width="match_parent" android:layout_width="match_parent"
...@@ -202,7 +202,7 @@ ...@@ -202,7 +202,7 @@
android:visibility="gone" android:visibility="gone"
> >
<android.support.design.widget.TabLayout <com.google.android.material.tabs.TabLayout
android:id="@+id/tab_layout" android:id="@+id/tab_layout"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="40dp" android:layout_height="40dp"
...@@ -226,7 +226,7 @@ ...@@ -226,7 +226,7 @@
android:orientation="vertical" android:orientation="vertical"
android:visibility="gone"> android:visibility="gone">
<android.support.design.widget.TabLayout <com.google.android.material.tabs.TabLayout
android:id="@+id/tab_consultLayout" android:id="@+id/tab_consultLayout"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="40dp" android:layout_height="40dp"
......
...@@ -27,6 +27,7 @@ modular { ...@@ -27,6 +27,7 @@ modular {
version = rootProject.ext.ydlPublishVersion[childProject.getName()+"-api"] version = rootProject.ext.ydlPublishVersion[childProject.getName()+"-api"]
// API 层打包时需要引入的依赖 // API 层打包时需要引入的依赖
apiDependencies { apiDependencies {
implementation 'androidx.fragment:fragment-ktx:1.2.4'
implementation "com.google.code.gson:gson:2.8.2" implementation "com.google.code.gson:gson:2.8.2"
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation 'com.alibaba:arouter-api:1.4.1' implementation 'com.alibaba:arouter-api:1.4.1'
......
...@@ -50,6 +50,7 @@ import java.util.concurrent.TimeUnit ...@@ -50,6 +50,7 @@ import java.util.concurrent.TimeUnit
@Route(path = "/im/im") @Route(path = "/im/im")
class NewMultiMessageFragment : BaseFragment() { class NewMultiMessageFragment : BaseFragment() {
private val mContext = context
private var defaultTranslateX: Float? = null private var defaultTranslateX: Float? = null
private var mFragmentsList: ArrayList<Fragment> = ArrayList(3) private var mFragmentsList: ArrayList<Fragment> = ArrayList(3)
private var chatSettingPopupWindow: ChatSettingPopupWindow? = null //右上角弹框 private var chatSettingPopupWindow: ChatSettingPopupWindow? = null //右上角弹框
...@@ -235,9 +236,9 @@ class NewMultiMessageFragment : BaseFragment() { ...@@ -235,9 +236,9 @@ class NewMultiMessageFragment : BaseFragment() {
if (!ImIn.isLogin()) { if (!ImIn.isLogin()) {
ToastUtil.toastShort("请登录后再试") ToastUtil.toastShort("请登录后再试")
} else { } else {
chatSettingPopupWindow = ChatSettingPopupWindow(context!!, object : ChatSettingPopupWindow.OnChatSettingClickListener { chatSettingPopupWindow = ChatSettingPopupWindow(mContext!!, object : ChatSettingPopupWindow.OnChatSettingClickListener {
override fun onAllReadClick() { override fun onAllReadClick() {
messageChatSettingtDialog = MessageChatSettingDialog(context!!, object : MessageChatSettingDialog.OnMessageChatSettingDialog { messageChatSettingtDialog = MessageChatSettingDialog(mContext, object : MessageChatSettingDialog.OnMessageChatSettingDialog {
override fun onSure() { override fun onSure() {
markAllMessageRead() markAllMessageRead()
messageChatSettingtDialog?.dismiss() messageChatSettingtDialog?.dismiss()
...@@ -255,7 +256,7 @@ class NewMultiMessageFragment : BaseFragment() { ...@@ -255,7 +256,7 @@ class NewMultiMessageFragment : BaseFragment() {
} }
override fun onSafeInfoSetting() { override fun onSafeInfoSetting() {
startActivity(ImIn.getUserService().privacyIntent(activity)) startActivity(ImIn.getUserService().privacyIntent(activity!!))
} }
override fun onDismissAction() { override fun onDismissAction() {
......
...@@ -33,7 +33,7 @@ class ChatFragment : BaseFragment(), XRecyclerView.LoadingListener { ...@@ -33,7 +33,7 @@ class ChatFragment : BaseFragment(), XRecyclerView.LoadingListener {
SERVICING, // 服务中 SERVICING, // 服务中
SERVICED // 服务过 SERVICED // 服务过
} }
private val mContext = context
private var chatAdapter: ChatAdapter? = null private var chatAdapter: ChatAdapter? = null
private var allChatData: ChatModelBean = ChatModelBean() //全部数据 private var allChatData: ChatModelBean = ChatModelBean() //全部数据
private var showData: ArrayList<ChatItemBean> = ArrayList() // 最终展示的数据 private var showData: ArrayList<ChatItemBean> = ArrayList() // 最终展示的数据
...@@ -203,7 +203,7 @@ class ChatFragment : BaseFragment(), XRecyclerView.LoadingListener { ...@@ -203,7 +203,7 @@ class ChatFragment : BaseFragment(), XRecyclerView.LoadingListener {
private fun initListData() { private fun initListData() {
chatAdapter = ChatAdapter(context, showData,this) chatAdapter = ChatAdapter(mContext!!, showData,this)
chatAdapter?.setlistener(object : ChatAdapter.ChatRecyclerViewCallback { chatAdapter?.setlistener(object : ChatAdapter.ChatRecyclerViewCallback {
override fun onRefresh() { override fun onRefresh() {
getChatMessageData() getChatMessageData()
...@@ -213,7 +213,7 @@ class ChatFragment : BaseFragment(), XRecyclerView.LoadingListener { ...@@ -213,7 +213,7 @@ class ChatFragment : BaseFragment(), XRecyclerView.LoadingListener {
LinearLayoutManager(context) LinearLayoutManager(context)
chat_recyclerview.adapter = chatAdapter chat_recyclerview.adapter = chatAdapter
chat_recyclerview.setLoadingListener(this) chat_recyclerview.setLoadingListener(this)
chat_recyclerview.setFootView(ChatFooterItemView(context), object : CustomFooterViewCallBack { chat_recyclerview.setFootView(ChatFooterItemView(mContext), object : CustomFooterViewCallBack {
override fun onSetNoMore(p0: View?, p1: Boolean) { override fun onSetNoMore(p0: View?, p1: Boolean) {
} }
...@@ -270,7 +270,7 @@ class ChatFragment : BaseFragment(), XRecyclerView.LoadingListener { ...@@ -270,7 +270,7 @@ class ChatFragment : BaseFragment(), XRecyclerView.LoadingListener {
} }
ll_chat_unusual_view.setListener(object : ChatUnusualView.ChatUnusualListener { ll_chat_unusual_view.setListener(object : ChatUnusualView.ChatUnusualListener {
override fun onButtonClick() { override fun onButtonClick() {
startActivity(ImIn.getConsultService().expertSearchIntent(activity, 0, 0, false)) startActivity(ImIn.getConsultService().expertSearchIntent(activity!!, 0, 0, false))
} }
}) })
} }
...@@ -281,7 +281,7 @@ class ChatFragment : BaseFragment(), XRecyclerView.LoadingListener { ...@@ -281,7 +281,7 @@ class ChatFragment : BaseFragment(), XRecyclerView.LoadingListener {
ll_chat_unusual_view.setUnusualType(ChatUnusualView.TYPE_UNLOGIN) ll_chat_unusual_view.setUnusualType(ChatUnusualView.TYPE_UNLOGIN)
ll_chat_unusual_view.setListener(object : ChatUnusualView.ChatUnusualListener { ll_chat_unusual_view.setListener(object : ChatUnusualView.ChatUnusualListener {
override fun onButtonClick() { override fun onButtonClick() {
ImIn.loginByOneKeyLogin(context,true) ImIn.loginByOneKeyLogin(mContext!!,true)
} }
}) })
} }
......
...@@ -27,6 +27,7 @@ import kotlinx.android.synthetic.main.im_interact_fragment.* ...@@ -27,6 +27,7 @@ import kotlinx.android.synthetic.main.im_interact_fragment.*
*/ */
class InteractFragment : BaseFragment(), XRecyclerView.LoadingListener { class InteractFragment : BaseFragment(), XRecyclerView.LoadingListener {
private val mContext = context
private var interactAdapter: InteractAdapter? = null private var interactAdapter: InteractAdapter? = null
private var interactList: ArrayList<InteractItemBean> = ArrayList() private var interactList: ArrayList<InteractItemBean> = ArrayList()
...@@ -45,12 +46,12 @@ class InteractFragment : BaseFragment(), XRecyclerView.LoadingListener { ...@@ -45,12 +46,12 @@ class InteractFragment : BaseFragment(), XRecyclerView.LoadingListener {
} }
private fun initListData() { private fun initListData() {
interactAdapter = InteractAdapter(context, interactList) interactAdapter = InteractAdapter(mContext!!, interactList)
interact_recyclerview.layoutManager = interact_recyclerview.layoutManager =
LinearLayoutManager(context) LinearLayoutManager(context)
interact_recyclerview.adapter = interactAdapter interact_recyclerview.adapter = interactAdapter
interact_recyclerview.setLoadingListener(this) interact_recyclerview.setLoadingListener(this)
var footerView = InteractFooterItemView(context) var footerView = InteractFooterItemView(mContext)
interact_recyclerview.setFootView(footerView, object : CustomFooterViewCallBack { interact_recyclerview.setFootView(footerView, object : CustomFooterViewCallBack {
override fun onSetNoMore(p0: View?, p1: Boolean) { override fun onSetNoMore(p0: View?, p1: Boolean) {
footerView.setNoMoreText() footerView.setNoMoreText()
...@@ -197,7 +198,7 @@ class InteractFragment : BaseFragment(), XRecyclerView.LoadingListener { ...@@ -197,7 +198,7 @@ class InteractFragment : BaseFragment(), XRecyclerView.LoadingListener {
ll_interact_unusual_view.setUnusualType(ChatUnusualView.TYPE_UNLOGIN) ll_interact_unusual_view.setUnusualType(ChatUnusualView.TYPE_UNLOGIN)
ll_interact_unusual_view.setListener(object : ChatUnusualView.ChatUnusualListener { ll_interact_unusual_view.setListener(object : ChatUnusualView.ChatUnusualListener {
override fun onButtonClick() { override fun onButtonClick() {
ImIn.loginByOneKeyLogin(context,true) ImIn.loginByOneKeyLogin(mContext!!,true)
} }
}) })
} }
......
...@@ -23,6 +23,7 @@ import kotlinx.android.synthetic.main.im_notice_fragment.* ...@@ -23,6 +23,7 @@ import kotlinx.android.synthetic.main.im_notice_fragment.*
*/ */
class NoticeFragment : BaseFragment(), XRecyclerView.LoadingListener { class NoticeFragment : BaseFragment(), XRecyclerView.LoadingListener {
private val mContext = context
private var noticeAdapter: NoticeAdapter? = null private var noticeAdapter: NoticeAdapter? = null
private var noticeList: ArrayList<NoticeItemBean> = ArrayList() private var noticeList: ArrayList<NoticeItemBean> = ArrayList()
...@@ -36,7 +37,7 @@ class NoticeFragment : BaseFragment(), XRecyclerView.LoadingListener { ...@@ -36,7 +37,7 @@ class NoticeFragment : BaseFragment(), XRecyclerView.LoadingListener {
} }
private fun initListData() { private fun initListData() {
noticeAdapter = NoticeAdapter(context, noticeList) noticeAdapter = NoticeAdapter(mContext!!, noticeList)
notice_recyclerview.layoutManager = notice_recyclerview.layoutManager =
LinearLayoutManager(context) LinearLayoutManager(context)
notice_recyclerview.adapter = noticeAdapter notice_recyclerview.adapter = noticeAdapter
...@@ -121,7 +122,7 @@ class NoticeFragment : BaseFragment(), XRecyclerView.LoadingListener { ...@@ -121,7 +122,7 @@ class NoticeFragment : BaseFragment(), XRecyclerView.LoadingListener {
ll_notice_unusual_view.setUnusualType(ChatUnusualView.TYPE_UNLOGIN) ll_notice_unusual_view.setUnusualType(ChatUnusualView.TYPE_UNLOGIN)
ll_notice_unusual_view.setListener(object : ChatUnusualView.ChatUnusualListener { ll_notice_unusual_view.setListener(object : ChatUnusualView.ChatUnusualListener {
override fun onButtonClick() { override fun onButtonClick() {
ImIn.loginByOneKeyLogin(context,true) ImIn.loginByOneKeyLogin(mContext!!,true)
} }
}) })
} }
......
...@@ -52,7 +52,7 @@ class ChatAdapter(var context: Context, private var mList: ArrayList<ChatItemBea ...@@ -52,7 +52,7 @@ class ChatAdapter(var context: Context, private var mList: ArrayList<ChatItemBea
return TYPE_TIME_ITEM return TYPE_TIME_ITEM
} }
override fun onBindViewHolder(holder: RecyclerView.ViewHolder?, position: Int) { override fun onBindViewHolder(holder: RecyclerView.ViewHolder, position: Int) {
when (holder) { when (holder) {
is ChatItemHolder -> { is ChatItemHolder -> {
holder.view.initData(mList[position]) holder.view.initData(mList[position])
...@@ -121,7 +121,7 @@ class ChatAdapter(var context: Context, private var mList: ArrayList<ChatItemBea ...@@ -121,7 +121,7 @@ class ChatAdapter(var context: Context, private var mList: ArrayList<ChatItemBea
} }
} }
override fun onCreateViewHolder(parent: ViewGroup?, viewType: Int): RecyclerView.ViewHolder { override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): RecyclerView.ViewHolder {
return when (viewType) { return when (viewType) {
TYPE_NORMAL_ITEM -> { TYPE_NORMAL_ITEM -> {
ChatItemHolder(ChatItemView(context)) ChatItemHolder(ChatItemView(context))
......
...@@ -38,7 +38,7 @@ class InteractAdapter(var context: Context, private var mList: ArrayList<Interac ...@@ -38,7 +38,7 @@ class InteractAdapter(var context: Context, private var mList: ArrayList<Interac
return TYPE_NORMAL_ITEM return TYPE_NORMAL_ITEM
} }
override fun onBindViewHolder(holder: RecyclerView.ViewHolder?, position: Int) { override fun onBindViewHolder(holder: RecyclerView.ViewHolder, position: Int) {
when (holder) { when (holder) {
is InteractItemHolder -> { is InteractItemHolder -> {
holder.view.initData(mList[position]) holder.view.initData(mList[position])
...@@ -190,7 +190,7 @@ class InteractAdapter(var context: Context, private var mList: ArrayList<Interac ...@@ -190,7 +190,7 @@ class InteractAdapter(var context: Context, private var mList: ArrayList<Interac
return false return false
} }
override fun onCreateViewHolder(parent: ViewGroup?, viewType: Int): RecyclerView.ViewHolder { override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): RecyclerView.ViewHolder {
return when (viewType) { return when (viewType) {
TYPE_NORMAL_ITEM -> { TYPE_NORMAL_ITEM -> {
InteractItemHolder(InteractItemView(context)) InteractItemHolder(InteractItemView(context))
......
...@@ -27,7 +27,7 @@ class NoticeAdapter(var context: Context, private var mList: ArrayList<NoticeIte ...@@ -27,7 +27,7 @@ class NoticeAdapter(var context: Context, private var mList: ArrayList<NoticeIte
return TYPE_NORMAL_ITEM return TYPE_NORMAL_ITEM
} }
override fun onBindViewHolder(holder: RecyclerView.ViewHolder?, position: Int) { override fun onBindViewHolder(holder: RecyclerView.ViewHolder, position: Int) {
when (holder) { when (holder) {
is NoticeItemHolder -> { is NoticeItemHolder -> {
holder.view.initData(mList[position]) holder.view.initData(mList[position])
...@@ -57,7 +57,7 @@ class NoticeAdapter(var context: Context, private var mList: ArrayList<NoticeIte ...@@ -57,7 +57,7 @@ class NoticeAdapter(var context: Context, private var mList: ArrayList<NoticeIte
} }
} }
override fun onCreateViewHolder(parent: ViewGroup?, viewType: Int): RecyclerView.ViewHolder { override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): RecyclerView.ViewHolder {
return when (viewType) { return when (viewType) {
TYPE_NORMAL_ITEM -> { TYPE_NORMAL_ITEM -> {
NoticeItemHolder(NoticeItemView(context)) NoticeItemHolder(NoticeItemView(context))
......
...@@ -16,7 +16,7 @@ import com.yidianling.im.R ...@@ -16,7 +16,7 @@ import com.yidianling.im.R
* @date 2019/12/11 * @date 2019/12/11
*/ */
class CollectInfoStyleAdapter(var list: List<String>, var event: (title: String) -> Unit) : RecyclerView.Adapter<CollectInfoStyleAdapter.InfoStyleHolder>() { class CollectInfoStyleAdapter(var list: List<String>, var event: (title: String) -> Unit) : RecyclerView.Adapter<CollectInfoStyleAdapter.InfoStyleHolder>() {
override fun onCreateViewHolder(parent: ViewGroup?, viewType: Int): InfoStyleHolder { override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): InfoStyleHolder {
return InfoStyleHolder(LayoutInflater.from(parent!!.context).inflate(R.layout.im_item_collect_info_question_style, parent, false)) return InfoStyleHolder(LayoutInflater.from(parent!!.context).inflate(R.layout.im_item_collect_info_question_style, parent, false))
} }
...@@ -24,8 +24,8 @@ class CollectInfoStyleAdapter(var list: List<String>, var event: (title: String) ...@@ -24,8 +24,8 @@ class CollectInfoStyleAdapter(var list: List<String>, var event: (title: String)
return if (list.size > 9) 9 else list.size return if (list.size > 9) 9 else list.size
} }
override fun onBindViewHolder(holder: InfoStyleHolder?, position: Int) { override fun onBindViewHolder(holder: InfoStyleHolder, position: Int) {
holder!!.bindData(list[position]) holder.bindData(list[position])
holder.itemView.setOnClickListener { holder.itemView.setOnClickListener {
if (Utils.isFastClick()) { if (Utils.isFastClick()) {
//防止连击 //防止连击
...@@ -39,7 +39,7 @@ class CollectInfoStyleAdapter(var list: List<String>, var event: (title: String) ...@@ -39,7 +39,7 @@ class CollectInfoStyleAdapter(var list: List<String>, var event: (title: String)
private var textView: TextView = view.findViewById(R.id.tv_title) private var textView: TextView = view.findViewById(R.id.tv_title)
fun bindData(title: String) { fun bindData(title: String) {
textView!!.text = title textView.text = title
} }
} }
} }
\ No newline at end of file
...@@ -14,7 +14,7 @@ import com.yidianling.uikit.custom.http.response.CommonQuestionBean ...@@ -14,7 +14,7 @@ import com.yidianling.uikit.custom.http.response.CommonQuestionBean
*/ */
class CommonQuestionAdapter(var mContext: Context, var list: List<CommonQuestionBean>, var event: (title: String, id: String) -> Unit) : RecyclerView.Adapter<RecyclerView.ViewHolder>() { class CommonQuestionAdapter(var mContext: Context, var list: List<CommonQuestionBean>, var event: (title: String, id: String) -> Unit) : RecyclerView.Adapter<RecyclerView.ViewHolder>() {
override fun onCreateViewHolder(parent: ViewGroup?, viewType: Int): RecyclerView.ViewHolder { override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): RecyclerView.ViewHolder {
return CommonQuestionViewHolder(CommonQuestionItemView(mContext)) return CommonQuestionViewHolder(CommonQuestionItemView(mContext))
} }
...@@ -22,7 +22,7 @@ class CommonQuestionAdapter(var mContext: Context, var list: List<CommonQuestion ...@@ -22,7 +22,7 @@ class CommonQuestionAdapter(var mContext: Context, var list: List<CommonQuestion
return list.size return list.size
} }
override fun onBindViewHolder(holder: RecyclerView.ViewHolder?, position: Int) { override fun onBindViewHolder(holder: RecyclerView.ViewHolder, position: Int) {
((holder as CommonQuestionViewHolder).itemView as CommonQuestionItemView).setData(list[position].title, list[position].keyword, position == list.size - 1) ((holder as CommonQuestionViewHolder).itemView as CommonQuestionItemView).setData(list[position].title, list[position].keyword, position == list.size - 1)
holder.itemView.setOnClickListener { holder.itemView.setOnClickListener {
event(list[position].title, list[position].id) event(list[position].title, list[position].id)
......
...@@ -53,10 +53,10 @@ android { ...@@ -53,10 +53,10 @@ android {
dependencies { dependencies {
api fileTree(dir: 'libs', include: ['*.jar', '*.aar']) api fileTree(dir: 'libs', include: ['*.jar', '*.aar'])
implementation 'androidx.appcompat:appcompat:1.0.0' implementation 'androidx.appcompat:appcompat:1.2.0'
testImplementation 'junit:junit:4.12' testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.1' androidTestImplementation 'androidx.test.ext:junit:1.1.2'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.0' androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
implementation "com.alibaba:arouter-api:$arouter_api" implementation "com.alibaba:arouter-api:$arouter_api"
// 注意此处的依赖方式:kotlin中使用和java中使用方式有不同 // 注意此处的依赖方式:kotlin中使用和java中使用方式有不同
......
...@@ -58,9 +58,9 @@ android { ...@@ -58,9 +58,9 @@ android {
dependencies { dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs') implementation fileTree(include: ['*.jar'], dir: 'libs')
testImplementation 'junit:junit:4.12' testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.1' androidTestImplementation 'androidx.test.ext:junit:1.1.2'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.0' androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
implementation "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version" implementation "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version"
......
...@@ -13,7 +13,7 @@ import io.flutter.view.FlutterView ...@@ -13,7 +13,7 @@ import io.flutter.view.FlutterView
@Route(path = "/tests/home_fragment") @Route(path = "/tests/home_fragment")
class NewTestHomeFragment : BaseFlutterFragment() { class NewTestHomeFragment : BaseFlutterFragment() {
override fun initChannelPlugin(flutterView: FlutterView) { override fun initChannelPlugin(flutterView: FlutterView) {
var statusBarHeight = StatusBarUtils.getStatusBarHeight(context); val statusBarHeight = StatusBarUtils.getStatusBarHeight(context!!);
flutterView.setPadding(0,statusBarHeight,0,0) flutterView.setPadding(0,statusBarHeight,0,0)
TestPlugin.Companion.register(this,flutterView) TestPlugin.Companion.register(this,flutterView)
} }
......
...@@ -50,7 +50,7 @@ class TestPlugin : MethodChannel.MethodCallHandler { ...@@ -50,7 +50,7 @@ class TestPlugin : MethodChannel.MethodCallHandler {
fun register(fragment: BaseFlutterFragment, flutterView: FlutterView) { fun register(fragment: BaseFlutterFragment, flutterView: FlutterView) {
isHideLeftBack = true isHideLeftBack = true
MethodChannel(flutterView, CHANNEL).setMethodCallHandler(TestPlugin(fragment.activity)) MethodChannel(flutterView, CHANNEL).setMethodCallHandler(TestPlugin(fragment.activity!!))
} }
} }
......
...@@ -18,7 +18,7 @@ import com.yidianling.tests.home.config.ITestHomeConfig ...@@ -18,7 +18,7 @@ import com.yidianling.tests.home.config.ITestHomeConfig
class SwipeToLoadHelper(recyclerView: RecyclerView, private val mAdapterWrapper: AdapterWrapper) : RecyclerView.OnScrollListener() ,AdapterWrapper.FooterCallBack{ class SwipeToLoadHelper(recyclerView: RecyclerView, private val mAdapterWrapper: AdapterWrapper) : RecyclerView.OnScrollListener() ,AdapterWrapper.FooterCallBack{
private val mRecyclerView: RecyclerView? = null private val mRecyclerView: RecyclerView? = null
private val mLayoutManager: RecyclerView.LayoutManager private val mLayoutManager: RecyclerView.LayoutManager = recyclerView.layoutManager!!
private var mListener: LoadMoreListener? = null private var mListener: LoadMoreListener? = null
/** 是否正在加载中 */ /** 是否正在加载中 */
private var mLoading = false private var mLoading = false
...@@ -26,7 +26,6 @@ class SwipeToLoadHelper(recyclerView: RecyclerView, private val mAdapterWrapper: ...@@ -26,7 +26,6 @@ class SwipeToLoadHelper(recyclerView: RecyclerView, private val mAdapterWrapper:
private var mIsSwipeToLoadEnabled = true private var mIsSwipeToLoadEnabled = true
init { init {
mLayoutManager = recyclerView.layoutManager
if (mLayoutManager is GridLayoutManager) { if (mLayoutManager is GridLayoutManager) {
mAdapterWrapper.setAdapterType(AdapterWrapper.ADAPTER_TYPE_GRID) mAdapterWrapper.setAdapterType(AdapterWrapper.ADAPTER_TYPE_GRID)
...@@ -39,7 +38,7 @@ class SwipeToLoadHelper(recyclerView: RecyclerView, private val mAdapterWrapper: ...@@ -39,7 +38,7 @@ class SwipeToLoadHelper(recyclerView: RecyclerView, private val mAdapterWrapper:
recyclerView.addOnScrollListener(this) recyclerView.addOnScrollListener(this)
} }
override fun onScrollStateChanged(recyclerView: RecyclerView?, newState: Int) { override fun onScrollStateChanged(recyclerView: RecyclerView, newState: Int) {
if (mIsSwipeToLoadEnabled && SCROLL_STATE_IDLE === newState && !mLoading) { if (mIsSwipeToLoadEnabled && SCROLL_STATE_IDLE === newState && !mLoading) {
if (mLayoutManager is GridLayoutManager) { if (mLayoutManager is GridLayoutManager) {
val gridLayoutManager = mLayoutManager val gridLayoutManager = mLayoutManager
...@@ -84,7 +83,7 @@ class SwipeToLoadHelper(recyclerView: RecyclerView, private val mAdapterWrapper: ...@@ -84,7 +83,7 @@ class SwipeToLoadHelper(recyclerView: RecyclerView, private val mAdapterWrapper:
} }
} }
override fun onScrolled(recyclerView: RecyclerView?, dx: Int, dy: Int) { override fun onScrolled(recyclerView: RecyclerView, dx: Int, dy: Int) {
super.onScrolled(recyclerView, dx, dy) super.onScrolled(recyclerView, dx, dy)
} }
......
...@@ -87,11 +87,11 @@ class TestHomeBannerAdapter( ...@@ -87,11 +87,11 @@ class TestHomeBannerAdapter(
return view === `object` return view === `object`
} }
override fun destroyItem(container: View?, position: Int, `object`: Any?) { override fun destroyItem(container: View, position: Int, `object`: Any) {
} }
override fun instantiateItem(container: View?, position: Int): Any { override fun instantiateItem(container: View, position: Int): Any {
try { try {
(container as ViewPager).addView(mImageViews!!.get(position % mDataList.size), 0) (container as ViewPager).addView(mImageViews!!.get(position % mDataList.size), 0)
} catch (e: Exception) { } catch (e: Exception) {
......
...@@ -64,14 +64,13 @@ class TestListFragment : BaseFragment(), MyBaseAdapter.OnItemClickListener<Test> ...@@ -64,14 +64,13 @@ class TestListFragment : BaseFragment(), MyBaseAdapter.OnItemClickListener<Test>
private lateinit var onScrollListener: EndlessRecyclerViewScrollListener private lateinit var onScrollListener: EndlessRecyclerViewScrollListener
fun initUiAndListener() { fun initUiAndListener() {
if (arguments != null) { arguments?.let {
category = arguments.getString(ARG_CATEGORY) category = it.getString(ARG_CATEGORY)
categoryName = arguments.getString(ARG_NAME) categoryName = it.getString(ARG_NAME)
categoryId = arguments.getString(ARG_ID) categoryId = it.getString(ARG_ID)
} }
EventBus.getDefault().register(this) EventBus.getDefault().register(this)
adapter = TestListRecyclerAdapter(activity, testList, TestListRecyclerAdapter.PAGE_TYPE_CATEGORY) adapter = TestListRecyclerAdapter(activity!!, testList, TestListRecyclerAdapter.PAGE_TYPE_CATEGORY)
adapter.onItemClickListener = this adapter.onItemClickListener = this
rvTestList.adapter = adapter rvTestList.adapter = adapter
val layoutManager = LinearLayoutManager( val layoutManager = LinearLayoutManager(
......
...@@ -23,14 +23,13 @@ class CategoryConditionRecyclerViewAdapter(private val context: Context, ...@@ -23,14 +23,13 @@ class CategoryConditionRecyclerViewAdapter(private val context: Context,
var lastSelectView : TextView ?= null var lastSelectView : TextView ?= null
var lastSelectText : String ?= null var lastSelectText : String ?= null
override fun onCreateViewHolder(parent: ViewGroup?, viewType: Int): ViewHolder { override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ViewHolder {
val itemView = LayoutInflater.from(context).inflate(R.layout.tests_item_tab_pop_sort, parent, false) val itemView = LayoutInflater.from(context).inflate(R.layout.tests_item_tab_pop_sort, parent, false)
return ViewHolder(itemView) return ViewHolder(itemView)
} }
override fun onBindViewHolder(holder: ViewHolder?, position: Int) { override fun onBindViewHolder(holder: ViewHolder, position: Int) {
val item = sortItems[position] val item = sortItems[position]
if (holder != null) {
holder.tvSort.text = item.value holder.tvSort.text = item.value
holder.tvSort.setTextColor(ContextCompat.getColor(context, R.color.platform_color_242424)) holder.tvSort.setTextColor(ContextCompat.getColor(context, R.color.platform_color_242424))
if (!TextUtils.isEmpty(lastSelectText) && item.value.equals(lastSelectText) && position!=0){ if (!TextUtils.isEmpty(lastSelectText) && item.value.equals(lastSelectText) && position!=0){
...@@ -38,7 +37,6 @@ class CategoryConditionRecyclerViewAdapter(private val context: Context, ...@@ -38,7 +37,6 @@ class CategoryConditionRecyclerViewAdapter(private val context: Context,
lastSelectView = holder.tvSort lastSelectView = holder.tvSort
} }
} }
}
inner class ViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView) { inner class ViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView) {
......
...@@ -68,7 +68,7 @@ class TestListRecyclerAdapter(private val context: Context, ...@@ -68,7 +68,7 @@ class TestListRecyclerAdapter(private val context: Context,
override fun getItemCount(): Int = if (testList.size > 0) testList.size + 1 + (if (hasHeader()) 1 else 0) else 0 override fun getItemCount(): Int = if (testList.size > 0) testList.size + 1 + (if (hasHeader()) 1 else 0) else 0
override fun onBindViewHolder(holder: RecyclerView.ViewHolder?, position: Int) { override fun onBindViewHolder(holder: RecyclerView.ViewHolder, position: Int) {
if (holder is NormalViewHolder) { if (holder is NormalViewHolder) {
var newPosition = position - if (hasHeader()) 1 else 0 var newPosition = position - if (hasHeader()) 1 else 0
val test = testList[newPosition] val test = testList[newPosition]
...@@ -128,9 +128,9 @@ class TestListRecyclerAdapter(private val context: Context, ...@@ -128,9 +128,9 @@ class TestListRecyclerAdapter(private val context: Context,
} }
} }
override fun onCreateViewHolder(parent: ViewGroup?, viewType: Int): RecyclerView.ViewHolder { override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): RecyclerView.ViewHolder {
return if (viewType == TYPE_HEADER) { return if (viewType == TYPE_HEADER) {
object : RecyclerView.ViewHolder(headerView) {} object : RecyclerView.ViewHolder(headerView!!) {}
} else if (viewType == TYPE_NORMAL) { } else if (viewType == TYPE_NORMAL) {
var view :View ?=null var view :View ?=null
if (pageType== PAGE_TYPE_CATEGORY){ if (pageType== PAGE_TYPE_CATEGORY){
......
...@@ -22,7 +22,7 @@ class HotTestListAdapter(val hotTestList: MutableList<Test>) : RecyclerView.Adap ...@@ -22,7 +22,7 @@ class HotTestListAdapter(val hotTestList: MutableList<Test>) : RecyclerView.Adap
var onItemClickListener: MyBaseAdapter.OnItemClickListener<Test>? = null var onItemClickListener: MyBaseAdapter.OnItemClickListener<Test>? = null
override fun onBindViewHolder(holder: RecyclerView.ViewHolder?, position: Int) { override fun onBindViewHolder(holder: RecyclerView.ViewHolder, position: Int) {
if (holder is NormalViewHolder) { if (holder is NormalViewHolder) {
holder.tvTestName.text = hotTestList[position - 1].name holder.tvTestName.text = hotTestList[position - 1].name
} }
...@@ -39,7 +39,7 @@ class HotTestListAdapter(val hotTestList: MutableList<Test>) : RecyclerView.Adap ...@@ -39,7 +39,7 @@ class HotTestListAdapter(val hotTestList: MutableList<Test>) : RecyclerView.Adap
override fun getItemCount(): Int = hotTestList.size + 1 override fun getItemCount(): Int = hotTestList.size + 1
override fun onCreateViewHolder(parent: ViewGroup?, viewType: Int): RecyclerView.ViewHolder { override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): RecyclerView.ViewHolder {
return if (viewType == TYPE_NORMAL) { return if (viewType == TYPE_NORMAL) {
val view = LayoutInflater.from(parent!!.context).inflate(R.layout.tests_item_hot_test, parent, false) val view = LayoutInflater.from(parent!!.context).inflate(R.layout.tests_item_hot_test, parent, false)
NormalViewHolder(view) NormalViewHolder(view)
......
...@@ -140,7 +140,7 @@ class TestSearchActivity : BaseMvpActivity<TestSearchView, TestSearchPresenter>( ...@@ -140,7 +140,7 @@ class TestSearchActivity : BaseMvpActivity<TestSearchView, TestSearchPresenter>(
} }
} }
rv_hot_list.addOnScrollListener(object : RecyclerView.OnScrollListener() { rv_hot_list.addOnScrollListener(object : RecyclerView.OnScrollListener() {
override fun onScrolled(recyclerView: RecyclerView?, dx: Int, dy: Int) { override fun onScrolled(recyclerView: RecyclerView, dx: Int, dy: Int) {
if (!isFirstLoad && dx!=0 && dx!=0) { if (!isFirstLoad && dx!=0 && dx!=0) {
hideSoftInput() hideSoftInput()
} }
......
...@@ -74,10 +74,11 @@ android { ...@@ -74,10 +74,11 @@ android {
dependencies { dependencies {
api fileTree(dir: 'libs', include: ['*.aar','*.jar']) api fileTree(dir: 'libs', include: ['*.aar','*.jar'])
implementation 'androidx.appcompat:appcompat:1.0.0' implementation 'androidx.appcompat:appcompat:1.2.0'
testImplementation 'junit:junit:4.12' implementation 'androidx.annotation:annotation:1.1.0'
androidTestImplementation 'androidx.test.ext:junit:1.1.1' testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.0' androidTestImplementation 'androidx.test.ext:junit:1.1.2'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
kapt 'com.alibaba:arouter-compiler:1.2.2' kapt 'com.alibaba:arouter-compiler:1.2.2'
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
......
...@@ -27,6 +27,7 @@ modular { ...@@ -27,6 +27,7 @@ modular {
version = rootProject.ext.ydlPublishVersion[childProject.getName()+"-api"] version = rootProject.ext.ydlPublishVersion[childProject.getName()+"-api"]
// API 层打包时需要引入的依赖 // API 层打包时需要引入的依赖
apiDependencies { apiDependencies {
implementation 'androidx.fragment:fragment-ktx:1.2.4'
implementation "com.google.code.gson:gson:2.8.2" implementation "com.google.code.gson:gson:2.8.2"
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation 'com.alibaba:arouter-api:1.4.1' implementation 'com.alibaba:arouter-api:1.4.1'
......
package com.yidianling.user.ui; package com.yidianling.user.ui;
import android.annotation.SuppressLint;
import android.content.Context; import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.graphics.Color; import android.graphics.Color;
...@@ -73,6 +74,7 @@ public class CountryListActivity extends BaseActivity { ...@@ -73,6 +74,7 @@ public class CountryListActivity extends BaseActivity {
} }
@SuppressLint("CheckResult")
public void getData() { public void getData() {
UserHttp userHttp = UserHttpImpl.Companion.getInstance(); UserHttp userHttp = UserHttpImpl.Companion.getInstance();
userHttp.countryList() userHttp.countryList()
......
...@@ -58,8 +58,8 @@ class CollectFocusView : LinearLayout { ...@@ -58,8 +58,8 @@ class CollectFocusView : LinearLayout {
@SuppressLint("ResourceAsColor") @SuppressLint("ResourceAsColor")
fun setFocus(focus: Boolean) { fun setFocus(focus: Boolean) {
if (focus) { if (focus) {
user_focus_title.setTextColor(ContextCompat.getColor(mContext, R.color.platform_main_theme)) user_focus_title.setTextColor(ContextCompat.getColor(mContext!!, R.color.platform_main_theme))
user_focus_desc.setTextColor(ContextCompat.getColor(mContext, R.color.platform_main_theme)) user_focus_desc.setTextColor(ContextCompat.getColor(mContext!!, R.color.platform_main_theme))
user_focus_title.typeface = Typeface.defaultFromStyle(Typeface.BOLD) user_focus_title.typeface = Typeface.defaultFromStyle(Typeface.BOLD)
setBackgroundResource(R.drawable.user_collect_select_bg) setBackgroundResource(R.drawable.user_collect_select_bg)
} else { } else {
......
...@@ -131,7 +131,7 @@ class BindPhoneActivity : BaseActivity() { ...@@ -131,7 +131,7 @@ class BindPhoneActivity : BaseActivity() {
// 验证码输入监听 // 验证码输入监听
et_code.addTextChangedListener(object : TextWatcher { et_code.addTextChangedListener(object : TextWatcher {
override fun afterTextChanged(s: Editable?) { override fun afterTextChanged(s: Editable?) {
if (s?.length ?: 0 > 0 && et_phone_number.text.isNotEmpty()) { if (s?.length ?: 0 > 0 && et_phone_number.text!!.isNotEmpty()) {
setTvBindPhoneStatus(true, R.drawable.bg_one_click_login) setTvBindPhoneStatus(true, R.drawable.bg_one_click_login)
} else { } else {
setTvBindPhoneStatus() setTvBindPhoneStatus()
......
...@@ -283,7 +283,7 @@ class RegisterAndLoginActivity : BaseMvpActivity<ILoginContract.View, ILoginCont ...@@ -283,7 +283,7 @@ class RegisterAndLoginActivity : BaseMvpActivity<ILoginContract.View, ILoginCont
if (!TextUtils.isEmpty(YDLCacheUtils.getUserPhone())) { if (!TextUtils.isEmpty(YDLCacheUtils.getUserPhone())) {
et_phone_number.setText(YDLCacheUtils.getUserPhone()) et_phone_number.setText(YDLCacheUtils.getUserPhone())
et_phone_number.setSelection(et_phone_number.text.length) et_phone_number.setSelection(et_phone_number.text!!.length)
iv_del.visibility = View.VISIBLE iv_del.visibility = View.VISIBLE
} else { } else {
iv_del.visibility = View.GONE iv_del.visibility = View.GONE
......
include ':app', include ':app',
':ydl-flutter-base', ':ydl-net', ':ydl-utils', ':ydl-media', ':ydl-flutter-base', ':ydl-net', ':ydl-utils', ':ydl-media',
':ydl-platform', ':ydl-webview', ':ydl-pay', ':m-home', ':ydl-platform', ':ydl-webview', ':ydl-pay', ':m-home',
':m-home', ':m-confide', ':m-audioim', ":m-user", ':m-home',
':m-consultant', ':m-muse', ':m-fm', ':m-tests', ":m-course", ':m-consultant', ':m-muse', ':m-fm', ':m-tests', ":m-course",
":m-im",":m-dynamic",":m-article" ":m-im",":m-dynamic","m-article","m-audioim","m-user","m-confide"
...@@ -47,10 +47,10 @@ android { ...@@ -47,10 +47,10 @@ android {
dependencies { dependencies {
api fileTree(dir: 'libs', include: ['*.jar', '*.aar']) api fileTree(dir: 'libs', include: ['*.jar', '*.aar'])
implementation 'androidx.appcompat:appcompat:1.0.0' implementation 'androidx.appcompat:appcompat:1.2.0'
testImplementation 'junit:junit:4.12' testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.1' androidTestImplementation 'androidx.test.ext:junit:1.1.2'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.0' androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
implementation "com.alibaba:arouter-api:$arouter_api" implementation "com.alibaba:arouter-api:$arouter_api"
// 注意此处的依赖方式:kotlin中使用和java中使用方式有不同 // 注意此处的依赖方式:kotlin中使用和java中使用方式有不同
......
...@@ -23,7 +23,7 @@ abstract class BaseFlutterFragment : FlutterFragment() { ...@@ -23,7 +23,7 @@ abstract class BaseFlutterFragment : FlutterFragment() {
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View { override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View {
mFlutterView= Flutter.createView( mFlutterView= Flutter.createView(
activity, activity!!,
lifecycle, lifecycle,
initialRoute()) initialRoute())
YDLCommonPlugin.fragmentRegister(this, mFlutterView!!) YDLCommonPlugin.fragmentRegister(this, mFlutterView!!)
......
...@@ -142,7 +142,7 @@ class PlayerFloatHelper { ...@@ -142,7 +142,7 @@ class PlayerFloatHelper {
private fun addFloatToWm(context: Context) { private fun addFloatToWm(context: Context) {
if (wm != null && !TextUtils.isEmpty(showingPageName)) { if (wm != null && !TextUtils.isEmpty(showingPageName)) {
if (ViewCompat.isAttachedToWindow(mPlayerFloatView)){ if (ViewCompat.isAttachedToWindow(mPlayerFloatView!!)){
// if (context is Activity && !(context.isFinishing)){ // if (context is Activity && !(context.isFinishing)){
// wm?.removeViewImmediate(mPlayerFloatView) // wm?.removeViewImmediate(mPlayerFloatView)
// } // }
......
...@@ -35,10 +35,10 @@ dependencies { ...@@ -35,10 +35,10 @@ dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar']) implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation 'androidx.appcompat:appcompat:1.0.0' implementation 'androidx.appcompat:appcompat:1.2.0'
testImplementation 'junit:junit:4.12' testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.1' androidTestImplementation 'androidx.test.ext:junit:1.1.2'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.0' androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
api rootProject.ext.dependencies["gson"] api rootProject.ext.dependencies["gson"]
api rootProject.ext.dependencies["rxjava2"] api rootProject.ext.dependencies["rxjava2"]
......
...@@ -35,10 +35,10 @@ android { ...@@ -35,10 +35,10 @@ android {
dependencies { dependencies {
api fileTree(dir: 'libs', include: ['*.jar','*.aar']) api fileTree(dir: 'libs', include: ['*.jar','*.aar'])
implementation 'androidx.appcompat:appcompat:1.0.0' implementation 'androidx.appcompat:appcompat:1.2.0'
testImplementation 'junit:junit:4.12' testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.1' androidTestImplementation 'androidx.test.ext:junit:1.1.2'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.0' androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
if (rootProject.ext.dev_mode){ if (rootProject.ext.dev_mode){
......
...@@ -104,7 +104,7 @@ class SelectCouponAdapter(var couponListBean: AllCouponListBean, var context: Co ...@@ -104,7 +104,7 @@ class SelectCouponAdapter(var couponListBean: AllCouponListBean, var context: Co
} }
} }
override fun onCreateViewHolder(parent: ViewGroup?, viewType: Int): RecyclerView.ViewHolder { override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): RecyclerView.ViewHolder {
return when (viewType) { return when (viewType) {
TYPE_HEAD -> { TYPE_HEAD -> {
HeadViewHolder(headView!!) HeadViewHolder(headView!!)
...@@ -140,7 +140,7 @@ class SelectCouponAdapter(var couponListBean: AllCouponListBean, var context: Co ...@@ -140,7 +140,7 @@ class SelectCouponAdapter(var couponListBean: AllCouponListBean, var context: Co
} }
@SuppressLint("SetTextI18n") @SuppressLint("SetTextI18n")
override fun onBindViewHolder(holder: RecyclerView.ViewHolder?, position: Int) { override fun onBindViewHolder(holder: RecyclerView.ViewHolder, position: Int) {
when (getItemViewType(position)) { when (getItemViewType(position)) {
TYPE_HEAD -> { TYPE_HEAD -> {
......
...@@ -68,10 +68,10 @@ dependencies { ...@@ -68,10 +68,10 @@ dependencies {
api fileTree(include: ['*.jar'], dir: 'libs') api fileTree(include: ['*.jar'], dir: 'libs')
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation 'androidx.appcompat:appcompat:1.0.0' implementation 'androidx.appcompat:appcompat:1.2.0'
testImplementation 'junit:junit:4.12' testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.1' androidTestImplementation 'androidx.test.ext:junit:1.1.2'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.0' androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
//====================YDL Repository==================== //====================YDL Repository====================
// api rootProject.ext.dependencies["ydl-pushagent"] // api rootProject.ext.dependencies["ydl-pushagent"]
// api rootProject.ext.dependencies["ydl-hnet"] // api rootProject.ext.dependencies["ydl-hnet"]
......
...@@ -52,9 +52,9 @@ class CommonRecyclerAdapter<T>(recyclerView: RecyclerView?, resLayout: Int) : Re ...@@ -52,9 +52,9 @@ class CommonRecyclerAdapter<T>(recyclerView: RecyclerView?, resLayout: Int) : Re
private fun setOnScrollListener(){ private fun setOnScrollListener(){
recyView?.addOnScrollListener(object : RecyclerView.OnScrollListener(){ recyView?.addOnScrollListener(object : RecyclerView.OnScrollListener(){
override fun onScrolled(recyclerView: RecyclerView?, dx: Int, dy: Int) { override fun onScrolled(recyclerView: RecyclerView, dx: Int, dy: Int) {
super.onScrolled(recyclerView, dx, dy) super.onScrolled(recyclerView, dx, dy)
val layoutManager = recyclerView?.layoutManager val layoutManager = recyclerView.layoutManager
if (layoutManager is LinearLayoutManager) { if (layoutManager is LinearLayoutManager) {
layoutManagerType = layoutManagerType =
......
...@@ -25,16 +25,17 @@ class LoadingDialogFragment : DialogFragment() { ...@@ -25,16 +25,17 @@ class LoadingDialogFragment : DialogFragment() {
override fun onCreate(savedInstanceState: Bundle?) { override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState) super.onCreate(savedInstanceState)
if (arguments != null) { msg = arguments?.getString(ARG_MSG)
msg = arguments.getString(ARG_MSG)
}
} }
override fun onCreateView(inflater: LayoutInflater?, container: ViewGroup?, override fun onCreateView(
savedInstanceState: Bundle?): View? { inflater: LayoutInflater,
container: ViewGroup?,
savedInstanceState: Bundle?
): View? {
// Inflate the layout for this fragment // Inflate the layout for this fragment
dialog.requestWindowFeature(Window.FEATURE_NO_TITLE) dialog?.requestWindowFeature(Window.FEATURE_NO_TITLE)
return inflater!!.inflate(R.layout.platform_fragment_loading_dialog, container, false) return inflater.inflate(R.layout.platform_fragment_loading_dialog, container, false)
} }
override fun onViewCreated(view: View, savedInstanceState: Bundle?) { override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
......
...@@ -101,7 +101,7 @@ class ApkInstallTool { ...@@ -101,7 +101,7 @@ class ApkInstallTool {
intent.flags = Intent.FLAG_ACTIVITY_NEW_TASK intent.flags = Intent.FLAG_ACTIVITY_NEW_TASK
if (Build.VERSION.SDK_INT >= 24) { //判读版本是否在7.0以上 if (Build.VERSION.SDK_INT >= 24) { //判读版本是否在7.0以上
//参数1 上下文, 参数2 Provider主机地址 和配置文件中保持一致 参数3 共享的文件 //参数1 上下文, 参数2 Provider主机地址 和配置文件中保持一致 参数3 共享的文件
val apkUri = FileProvider.getUriForFile(context, "com.cxzapp.yidianling.fileprovider", file) val apkUri = FileProvider.getUriForFile(context!!, "com.cxzapp.yidianling.fileprovider", file)
//添加这一句表示对目标应用临时授权该Uri所代表的文件 //添加这一句表示对目标应用临时授权该Uri所代表的文件
intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION) intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION)
intent.setDataAndType(apkUri, "application/vnd.android.package-archive") intent.setDataAndType(apkUri, "application/vnd.android.package-archive")
......
...@@ -55,7 +55,7 @@ abstract class EndlessRecyclerViewScrollListener : RecyclerView.OnScrollListener ...@@ -55,7 +55,7 @@ abstract class EndlessRecyclerViewScrollListener : RecyclerView.OnScrollListener
// This happens many times a second during a scroll, so be wary of the code you place here. // This happens many times a second during a scroll, so be wary of the code you place here.
// We are given a few useful parameters to help us work out if we need to load some more data, // We are given a few useful parameters to help us work out if we need to load some more data,
// but first we check if we are waiting for the previous load to finish. // but first we check if we are waiting for the previous load to finish.
override fun onScrolled(view: RecyclerView?, dx: Int, dy: Int) { override fun onScrolled(recyclerView: RecyclerView, dx: Int, dy: Int) {
var lastVisibleItemPosition = 0 var lastVisibleItemPosition = 0
val totalItemCount = mLayoutManager.itemCount val totalItemCount = mLayoutManager.itemCount
...@@ -92,12 +92,12 @@ abstract class EndlessRecyclerViewScrollListener : RecyclerView.OnScrollListener ...@@ -92,12 +92,12 @@ abstract class EndlessRecyclerViewScrollListener : RecyclerView.OnScrollListener
// threshold should reflect how many total columns there are too // threshold should reflect how many total columns there are too
if (!loading && lastVisibleItemPosition + visibleThreshold > totalItemCount) { if (!loading && lastVisibleItemPosition + visibleThreshold > totalItemCount) {
currentPage++ currentPage++
onLoadMore(currentPage, totalItemCount, view) onLoadMore(currentPage, totalItemCount, recyclerView)
loading = true loading = true
} }
val isSignificantDelta = Math.abs(dy) > mScrollThreshold val isSignificantDelta = Math.abs(dy) > mScrollThreshold
if (isSignificantDelta){ if (isSignificantDelta){
if (!view!!.canScrollVertically(-1)){ if (!recyclerView.canScrollVertically(-1)){
onScrollTop() onScrollTop()
} else if (dy>0){ } else if (dy>0){
onScrollUp() onScrollUp()
......
...@@ -18,7 +18,7 @@ class YDLSwipeToLoadHelper(recyclerView: RecyclerView, private val mAdapterWrapp ...@@ -18,7 +18,7 @@ class YDLSwipeToLoadHelper(recyclerView: RecyclerView, private val mAdapterWrapp
private val mRecyclerView: RecyclerView? = null private val mRecyclerView: RecyclerView? = null
private val mLayoutManager: RecyclerView.LayoutManager = recyclerView.layoutManager private val mLayoutManager: RecyclerView.LayoutManager? = recyclerView.layoutManager
private var mListener: LoadMoreListener? = null private var mListener: LoadMoreListener? = null
/** 是否正在加载中 */ /** 是否正在加载中 */
private var mLoading = false private var mLoading = false
...@@ -39,7 +39,7 @@ class YDLSwipeToLoadHelper(recyclerView: RecyclerView, private val mAdapterWrapp ...@@ -39,7 +39,7 @@ class YDLSwipeToLoadHelper(recyclerView: RecyclerView, private val mAdapterWrapp
recyclerView.addOnScrollListener(this) recyclerView.addOnScrollListener(this)
} }
override fun onScrollStateChanged(recyclerView: RecyclerView?, newState: Int) { override fun onScrollStateChanged(recyclerView: RecyclerView, newState: Int) {
if (mIsSwipeToLoadEnabled && SCROLL_STATE_IDLE === newState && !mLoading) { if (mIsSwipeToLoadEnabled && SCROLL_STATE_IDLE === newState && !mLoading) {
if (mLayoutManager is GridLayoutManager) { if (mLayoutManager is GridLayoutManager) {
val gridLayoutManager = mLayoutManager val gridLayoutManager = mLayoutManager
...@@ -85,7 +85,7 @@ class YDLSwipeToLoadHelper(recyclerView: RecyclerView, private val mAdapterWrapp ...@@ -85,7 +85,7 @@ class YDLSwipeToLoadHelper(recyclerView: RecyclerView, private val mAdapterWrapp
} }
} }
override fun onScrolled(recyclerView: RecyclerView?, dx: Int, dy: Int) { override fun onScrolled(recyclerView: RecyclerView, dx: Int, dy: Int) {
super.onScrolled(recyclerView, dx, dy) super.onScrolled(recyclerView, dx, dy)
if (mLayoutManager is LinearLayoutManager) { if (mLayoutManager is LinearLayoutManager) {
val linearLayoutManager = mLayoutManager val linearLayoutManager = mLayoutManager
......
...@@ -54,9 +54,9 @@ android { ...@@ -54,9 +54,9 @@ android {
dependencies { dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar', '*.aar']) implementation fileTree(dir: 'libs', include: ['*.jar', '*.aar'])
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
testImplementation 'junit:junit:4.12' testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.1' androidTestImplementation 'androidx.test.ext:junit:1.1.2'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.0' androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
api(rootProject.ext.dependencies["ptr-lib-release"]){transitive=true} api(rootProject.ext.dependencies["ptr-lib-release"]){transitive=true}
api(rootProject.ext.dependencies["support-v4"]) api(rootProject.ext.dependencies["support-v4"])
......
...@@ -54,7 +54,7 @@ dependencies { ...@@ -54,7 +54,7 @@ dependencies {
kapt 'com.alibaba:arouter-compiler:1.2.2' kapt 'com.alibaba:arouter-compiler:1.2.2'
api rootProject.ext.dependencies["ydl-user-router"] api rootProject.ext.dependencies["ydl-user-router"]
api fileTree(include: ['*.jar'], dir: 'libs') api fileTree(include: ['*.jar'], dir: 'libs')
api 'com.tencent.tbs.tbssdk:sdk:43697' api 'com.tencent.tbs.tbssdk:sdk:43903'
if (rootProject.ext.dev_mode) { if (rootProject.ext.dev_mode) {
//开发时使用 //开发时使用
api project(':ydl-platform') api project(':ydl-platform')
......
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