Commit 77b1dc52 by YKai

feat:androidx代码提交

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