[M2] M2 图片+视频轮播opt
This commit is contained in:
@@ -96,9 +96,8 @@ class PM2DrivingModel private constructor() {
|
||||
mLocation = mogoLocation
|
||||
updateSpeed(mogoLocation)
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
private fun updateSpeed(mogoLocation: MogoLocation) {
|
||||
// km/h
|
||||
val speedKM = (abs(mogoLocation.gnssSpeed) * 3.6f).toInt()
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
package com.mogo.och.bus.passenger.ui.widget.video
|
||||
|
||||
import android.content.Context
|
||||
import android.util.AttributeSet
|
||||
import android.widget.ImageView
|
||||
import android.widget.RelativeLayout
|
||||
import com.bumptech.glide.Glide
|
||||
|
||||
/**
|
||||
* @author: wangmingjun
|
||||
* @date: 2023/2/6
|
||||
*/
|
||||
class AdvanceImageView @JvmOverloads constructor(
|
||||
context: Context, attrs: AttributeSet? = null
|
||||
) : RelativeLayout(context, attrs) {
|
||||
private var imageView: ImageView? = null
|
||||
|
||||
init {
|
||||
initView()
|
||||
}
|
||||
|
||||
private fun initView() {
|
||||
imageView = ImageView(context)
|
||||
imageView?.scaleType = ImageView.ScaleType.FIT_XY
|
||||
addView(imageView, LayoutParams(-1,-1))
|
||||
}
|
||||
|
||||
public fun setImagePath(path: String){
|
||||
imageView?.let { Glide.with(context).load(path).into(it) }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
package com.mogo.och.bus.passenger.ui.widget.video
|
||||
|
||||
import android.view.View
|
||||
import androidx.viewpager.widget.PagerAdapter
|
||||
|
||||
/**
|
||||
* @author: wangmingjun
|
||||
* @date: 2023/2/6
|
||||
*/
|
||||
class AdvancePagerAdapter: PagerAdapter() {
|
||||
override fun getCount(): Int {
|
||||
TODO("Not yet implemented")
|
||||
}
|
||||
|
||||
override fun isViewFromObject(view: View, `object`: Any): Boolean {
|
||||
TODO("Not yet implemented")
|
||||
}
|
||||
|
||||
public fun setData(list: MutableList<RotationItem>){
|
||||
|
||||
}
|
||||
|
||||
public fun setPause(){
|
||||
|
||||
}
|
||||
|
||||
public fun setResume(){
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
package com.mogo.och.bus.passenger.ui.widget.video
|
||||
|
||||
import android.content.Context
|
||||
import android.util.AttributeSet
|
||||
import android.widget.RelativeLayout
|
||||
import androidx.viewpager.widget.PagerAdapter
|
||||
import androidx.viewpager.widget.ViewPager
|
||||
|
||||
/**
|
||||
* @author: wangmingjun
|
||||
* @date: 2023/2/6
|
||||
*/
|
||||
class ImageAndVideoRotation @JvmOverloads constructor(
|
||||
context: Context, attrs: AttributeSet? = null
|
||||
) : RelativeLayout(context, attrs) {
|
||||
|
||||
private var viewPager: ViewPager? = null
|
||||
private var pagerAdapter: AdvancePagerAdapter? = null
|
||||
|
||||
init {
|
||||
initView()
|
||||
}
|
||||
|
||||
private fun initView() {
|
||||
viewPager = ViewPager(context)
|
||||
pagerAdapter = AdvancePagerAdapter()
|
||||
viewPager?.adapter = pagerAdapter
|
||||
addView(viewPager, LayoutParams(-1,-1))
|
||||
}
|
||||
|
||||
public fun setData(list: MutableList<RotationItem>){
|
||||
pagerAdapter?.setData(list)
|
||||
}
|
||||
|
||||
public fun setPause(){
|
||||
pagerAdapter?.setPause()
|
||||
}
|
||||
|
||||
public fun setResume(){
|
||||
pagerAdapter?.setResume()
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
package com.mogo.och.bus.passenger.ui.widget.video
|
||||
|
||||
/**
|
||||
* @author: wangmingjun
|
||||
* @date: 2023/2/6
|
||||
*/
|
||||
data class RotationItem(var path: String, var type: String)
|
||||
Reference in New Issue
Block a user