package cn.flightfeather.thirdappmodule.module.inspection
|
|
import android.content.Intent
|
import android.os.Bundle
|
import android.support.design.widget.TabLayout
|
import android.support.v4.app.Fragment
|
import android.support.v4.app.FragmentManager
|
import android.support.v4.view.ViewPager
|
import cn.flightfeather.thirdappmodule.CommonApplication
|
import cn.flightfeather.thirdappmodule.R
|
import cn.flightfeather.thirdappmodule.bean.vo.ProblemlistVo
|
import cn.flightfeather.thirdappmodule.module.base.BaseActivity
|
import cn.flightfeather.thirdappmodule.module.base.TabViewPagerSetInterface
|
import kotlinx.android.synthetic.main.activity_share_problem.*
|
import kotlinx.android.synthetic.main.layout_tab_viewpager.*
|
|
/**
|
* @author riku
|
* Date: 2020/5/13
|
* 一键分享问题图文
|
*/
|
class ShareProblemActivity : BaseActivity(),TabViewPagerSetInterface {
|
|
private var problemVoList: List<ProblemlistVo>? = null
|
|
private var infoList = arrayListOf<ShareProblemPreViewActivity.Problem>()
|
|
override fun getLayoutId(): Int = R.layout.activity_share_problem
|
|
@Suppress("UNCHECKED_CAST")
|
override fun onCreate(savedInstanceState: Bundle?) {
|
super.onCreate(savedInstanceState)
|
problemVoList = intent.getSerializableExtra("problemVoList") as List<ProblemlistVo>
|
problemVoList?.forEach {vo ->
|
val mediaFileList = mutableListOf<Pair<Boolean, String>>()
|
vo.mediafileList.forEach {
|
mediaFileList.add(Pair(it.ischanged, CommonApplication.getInstance().ROOT_URL_RELEASE_IMAGE + it.extension1 + it.guid + ".jpg"))
|
}
|
|
infoList.add(ShareProblemPreViewActivity.Problem(
|
vo.sensename, mediaFileList, "${vo.location}${if(vo.problemname ==null) "" else "," + vo.problemname}",
|
vo.advise, "${if (vo.ischanged) getString(R.string.changed) else getString(R.string.unchanged)}${if (vo.changecatalog == null) "" else "," + vo.changecatalog}", vo.time
|
))
|
}
|
initTab()
|
initViewPager()
|
|
btn_pass.setOnClickListener {
|
val intent = Intent(this, ShareProblemPreViewActivity::class.java)
|
intent.putExtra(ShareProblemPreViewActivity.ARG_MERGE_INFO, infoList)
|
startActivity(intent)
|
}
|
btn_fail.setOnClickListener {
|
onBackPressed()
|
}
|
}
|
|
override fun getTab(): TabLayout = tab
|
|
override fun getViewPager(): ViewPager = view_pager
|
|
override fun getTitles(): List<String> {
|
val list = mutableListOf<String>()
|
for (i in problemVoList?.indices ?: 0..0) {
|
list.add("问题${i+1}")
|
}
|
return list
|
}
|
|
override fun getTabFragments(): List<Fragment> {
|
val list = mutableListOf<Fragment>()
|
for (i in problemVoList?.indices ?: 0..0) {
|
list.add(ShareProblemFragment.newInstance(infoList[i]))
|
}
|
return list
|
}
|
|
override fun getMyFragmentManager(): FragmentManager = supportFragmentManager
|
}
|