Преглед на файлове

风险管理4月13日提交代码-liu.bolan

Liu.bolan преди 4 години
родител
ревизия
043703d016
променени са 21 файла, в които са добавени 1526 реда и са изтрити 10 реда
  1. 2 0
      RMA/app/src/main/AndroidManifest.xml
  2. 9 10
      RMA/app/src/main/java/cn/muchinfo/rma/view/base/home/HomeFragment.kt
  3. 34 0
      RMA/app/src/main/java/cn/muchinfo/rma/view/base/home/commodity/newcommodity/BrandViewHolder.kt
  4. 18 0
      RMA/app/src/main/java/cn/muchinfo/rma/view/base/home/commodity/newcommodity/DemoData.kt
  5. 236 0
      RMA/app/src/main/java/cn/muchinfo/rma/view/base/home/commodity/newcommodity/DemoViewHolder.kt
  6. 272 0
      RMA/app/src/main/java/cn/muchinfo/rma/view/base/home/commodity/newcommodity/NewCommodityInformationActivity.kt
  7. 200 0
      RMA/app/src/main/java/cn/muchinfo/rma/view/base/home/commodity/newcommodity/NewCommodityInformationViewModel.kt
  8. 50 0
      RMA/app/src/main/java/cn/muchinfo/rma/view/base/home/commodity/newcommodity/SpotCategoryViewHolder.kt
  9. 50 0
      RMA/app/src/main/java/cn/muchinfo/rma/view/base/home/commodity/newcommodity/SpotFutureViewHolder.kt
  10. 112 0
      RMA/app/src/main/java/cn/muchinfo/rma/view/base/home/commodity/newcommodity/SpotHedgeViewHolder.kt
  11. 58 0
      RMA/app/src/main/java/cn/muchinfo/rma/view/base/home/commodity/newcommodity/newhedge/HedgeFutureContractViewHolder.kt
  12. 115 0
      RMA/app/src/main/java/cn/muchinfo/rma/view/base/home/commodity/newcommodity/newhedge/HedgeFutureViewHolder.kt
  13. 23 0
      RMA/app/src/main/java/cn/muchinfo/rma/view/base/home/commodity/newcommodity/newhedge/HedgeSpeciesData.kt
  14. 58 0
      RMA/app/src/main/java/cn/muchinfo/rma/view/base/home/commodity/newcommodity/newhedge/HedgeSpotCagetoryViewHolder.kt
  15. 114 0
      RMA/app/src/main/java/cn/muchinfo/rma/view/base/home/commodity/newcommodity/newhedge/HedgeSpotViewHolder.kt
  16. 166 0
      RMA/app/src/main/java/cn/muchinfo/rma/view/base/home/commodity/newcommodity/newhedge/NewHedgeSpeciesViewHolder.kt
  17. 8 0
      RMA/app/src/main/res/drawable/rma_list_item_bg.xml
  18. BIN
      RMA/app/src/main/res/mipmap-xhdpi/list_folding.png
  19. BIN
      RMA/app/src/main/res/mipmap-xhdpi/second_list_floding.png
  20. BIN
      RMA/app/src/main/res/mipmap-xhdpi/spot_market_price.png
  21. 1 0
      RMA/app/src/main/res/values/colors.xml

+ 2 - 0
RMA/app/src/main/AndroidManifest.xml

@@ -229,6 +229,8 @@
 
         <activity android:name=".view.base.home.contract.AddSpotMarketPriceActivity"/>
 
+        <activity android:name=".view.base.home.commodity.newcommodity.NewCommodityInformationActivity"/>
+
     </application>
 
 </manifest>

+ 9 - 10
RMA/app/src/main/java/cn/muchinfo/rma/view/base/home/HomeFragment.kt

@@ -25,6 +25,7 @@ import cn.muchinfo.rma.view.base.BaseFragment
 import cn.muchinfo.rma.view.base.future.trade.GoodsTradeActivity
 import cn.muchinfo.rma.view.base.home.business.BusinessManagementActivity
 import cn.muchinfo.rma.view.base.home.commodity.CommodityInformationActivity
+import cn.muchinfo.rma.view.base.home.commodity.newcommodity.NewCommodityInformationActivity
 import cn.muchinfo.rma.view.base.home.contract.ContractActivity
 import cn.muchinfo.rma.view.base.home.contract.emptyView
 import cn.muchinfo.rma.view.base.home.customerdata.CustomerDataActivity
@@ -595,7 +596,7 @@ class FirstTabUI(private val baseFragment: Fragment, private val viewModel: Home
                             val intent = Intent()
                             intent.setClass(
                                 context,
-                                CommodityInformationActivity::class.java
+                                NewCommodityInformationActivity::class.java
                             )
                             ActivityUtils.startActivity(intent)
                         }
@@ -1133,25 +1134,20 @@ class SecondTabUI(private val baseFragment: Fragment, private val viewModel: Hom
                 }
 
                 linearLayout {
-                    visibility = View.GONE
                     relativeLayout {
+
                         verticalLayout {
                             onThrottleFirstClick {
-                                val intent = Intent()
-                                intent.setClass(
-                                    context,
-                                    BusinessManagementActivity::class.java
-                                )
-                                ActivityUtils.startActivity(intent)
+
                             }
                             imageView {
-                                imageResource = R.mipmap.main_business_5
+                                imageResource = R.mipmap.spot_market_price
                             }.lparams(autoSize(72), autoSize(72)) {
                                 gravity = Gravity.CENTER_HORIZONTAL
                             }
 
                             textView {
-                                text = "业务审核"
+                                text = "现货市价"
                                 textColorInt = R.color.black
                                 textSizeAuto = 26
                             }.lparams(wrapContent, wrapContent) {
@@ -1192,6 +1188,7 @@ class SecondTabUI(private val baseFragment: Fragment, private val viewModel: Hom
                     }.lparams(0, matchParent, 1f)
 
                     relativeLayout {
+                        visibility = View.INVISIBLE
                         verticalLayout {
                             onThrottleFirstClick {
                                 val intent = Intent()
@@ -1249,6 +1246,7 @@ class SecondTabUI(private val baseFragment: Fragment, private val viewModel: Hom
                     }.lparams(0, matchParent, 1f)
 
                     verticalLayout {
+                        visibility = View.INVISIBLE
                         onThrottleFirstClick {
                             val intent = Intent()
                             intent.setClass(
@@ -1273,6 +1271,7 @@ class SecondTabUI(private val baseFragment: Fragment, private val viewModel: Hom
                         }
                     }.lparams(0, matchParent, 1f)
                     verticalLayout {
+                        visibility = View.INVISIBLE
                         onThrottleFirstClick {
                             val intent = Intent()
                             intent.setClass(

+ 34 - 0
RMA/app/src/main/java/cn/muchinfo/rma/view/base/home/commodity/newcommodity/BrandViewHolder.kt

@@ -0,0 +1,34 @@
+package cn.muchinfo.rma.view.base.home.commodity.newcommodity
+
+import android.view.Gravity
+import androidx.appcompat.app.AppCompatActivity
+import cn.muchinfo.rma.R
+import cn.muchinfo.rma.view.autoWidget.autoSize
+import cn.muchinfo.rma.view.autoWidget.textColorInt
+import cn.muchinfo.rma.view.autoWidget.textSizeAuto
+import cn.muchinfo.rma.view.base.home.contract.emptyView
+import mtp.polymer.com.autowidget.adapter.BaseViewHolder
+import org.jetbrains.anko.*
+
+class BrandViewHolder(private val activity : AppCompatActivity,private val viewModel: NewCommodityInformationViewModel): BaseViewHolder<String>(activity){
+    override val itemSize: IntArray = intArrayOf(matchParent, wrapContent)
+
+    override fun _FrameLayout.createContentView() {
+        linearLayout {
+            backgroundResource = R.drawable.rma_list_item_bg
+            gravity = Gravity.CENTER_VERTICAL
+            textView {
+                text = "江铜"
+                textSizeAuto = 31
+                textColorInt = R.color.rma_black_33
+            }.lparams(wrapContent, wrapContent){
+                marginStart = autoSize(20)
+            }
+        }.lparams(matchParent, autoSize(96)){
+            marginStart = autoSize(102)
+            marginEnd = autoSize(78)
+            bottomMargin = autoSize(10)
+        }
+    }
+
+}

+ 18 - 0
RMA/app/src/main/java/cn/muchinfo/rma/view/base/home/commodity/newcommodity/DemoData.kt

@@ -0,0 +1,18 @@
+package cn.muchinfo.rma.view.base.home.commodity.newcommodity
+
+data class DemoData(
+    val id : String = "",
+    var isSelectAll : Int = 0,//是否全部展开
+    val categoryList : List<String> = arrayListOf(),
+    var categoryIsSelect : Int = 1,//品类是否展开
+    val brandList : List<String> = arrayListOf(),
+    var brandIsSelect : Int = 1,//品牌是否展开
+    var hedgeList : List<HedgeDetails> = arrayListOf(),
+    var hedgeIsSelect : Int = 1//套保是否展开
+)
+
+data class HedgeDetails(
+    val id : String = "",
+    val detailsList : List<String> = arrayListOf(),
+    var isSelect : Int = 0//套保内的期货品种是否展开
+)

+ 236 - 0
RMA/app/src/main/java/cn/muchinfo/rma/view/base/home/commodity/newcommodity/DemoViewHolder.kt

@@ -0,0 +1,236 @@
+package cn.muchinfo.rma.view.base.home.commodity.newcommodity
+
+import android.view.Gravity
+import android.view.View
+import androidx.appcompat.app.AppCompatActivity
+import cn.muchinfo.rma.R
+import cn.muchinfo.rma.global.data.MiddleGoodsData
+import cn.muchinfo.rma.global.utils.VIewUtils
+import cn.muchinfo.rma.lifecycle.bindOptional
+import cn.muchinfo.rma.view.autoWidget.*
+import cn.muchinfo.rma.view.base.home.commodity.CommodityMiddleViewHolder
+import cn.muchinfo.rma.view.base.home.contract.emptyView
+import mtp.polymer.com.autowidget.adapter.BaseAdapter
+import mtp.polymer.com.autowidget.adapter.BaseViewHolder
+import org.jetbrains.anko.*
+
+class DemoViewHolder(
+    private val activity: AppCompatActivity,
+    private val viewModel: NewCommodityInformationViewModel
+) : BaseViewHolder<DemoData>(activity) {
+
+    override val itemSize: IntArray = intArrayOf(matchParent, wrapContent)
+
+    //品类adapter
+    private val spotCategoryAdapter: BaseAdapter<String, SpotCategoryViewHolder> =
+        BaseAdapter { _, _ -> SpotCategoryViewHolder(activity, viewModel) }
+
+    //品牌adapter
+    private val brandAdapter: BaseAdapter<String, BrandViewHolder> =
+        BaseAdapter { _, _ -> BrandViewHolder(activity, viewModel) }
+
+    //套保品种adapter
+    private val hedgeAdapter: BaseAdapter<HedgeDetails, SpotHedgeViewHolder> =
+        BaseAdapter { _, _ -> SpotHedgeViewHolder(activity, viewModel, dataIndex) }
+
+    override fun _FrameLayout.createContentView() {
+        verticalLayout {
+            linearLayout {
+                backgroundDrawable = resources.getDrawable(R.color.rma_item_bg)
+                onThrottleFirstClick {
+                    viewModel.setOnAllClick(dataIndex)
+                }
+                gravity = Gravity.CENTER_VERTICAL
+                imageView {
+                    imageResource = R.mipmap.list_folding
+                }.lparams(autoSize(43), autoSize(43)) {
+                    marginStart = autoSize(36)
+                }
+
+                textView {
+                    text = "铜杆(吨)"
+                    textSizeAuto = 36
+                    textColorInt = R.color.rma_black_33
+                }.lparams(wrapContent, wrapContent) {
+                    marginStart = autoSize(19)
+                }
+
+                textView {
+                    text = "正常"
+                    textSizeAuto = 36
+                    textColorInt = R.color.rma_green_color
+                }.lparams(wrapContent, wrapContent) {
+                    marginStart = autoSize(20)
+                }
+            }.lparams(matchParent, autoSize(84))
+
+            verticalLayout {
+                data.bindOptional(context) {
+                    if (it?.isSelectAll == 0) {
+                        visibility = View.GONE
+                    } else {
+                        visibility = View.VISIBLE
+                    }
+                }
+                linearLayout {
+                    gravity = Gravity.CENTER_VERTICAL
+                    linearLayout {
+                        gravity = Gravity.CENTER_VERTICAL
+                        imageView {
+                            onThrottleFirstClick {
+                                viewModel.setOnCategoryClick(dataIndex)
+                            }
+                            imageResource = R.mipmap.second_list_floding
+                        }.lparams(autoSize(43), autoSize(43)) {
+                            marginStart = autoSize(44)
+                        }
+
+                        textView {
+                            text = "品类"
+                            textSizeAuto = autoSize(31)
+                            textColorInt = R.color.rma_black_33
+                        }.lparams(wrapContent, wrapContent) {
+                            marginStart = autoSize(20)
+                        }
+                    }.lparams(autoSize(350), autoSize(108))
+                    linearLayout {
+                        gravity = Gravity.CENTER
+                        textView {
+                            text = "单位"
+                            textSizeAuto = 31
+                            textColorInt = R.color.rma_hint_text_color_ccc
+                        }.lparams(wrapContent, wrapContent)
+                    }.lparams(autoSize(200), autoSize(108))
+                    linearLayout {
+                        gravity = Gravity.CENTER_VERTICAL
+                        emptyView()
+                        textView {
+                            text = "标仓系数"
+                            textSizeAuto = 31
+                            textColorInt = R.color.rma_hint_text_color_ccc
+                        }.lparams(wrapContent, wrapContent) {
+                            marginEnd = autoSize(79)
+                        }
+                    }.lparams(autoSize(350), autoSize(108))
+                }.lparams(matchParent, autoSize(108))
+
+                //品类
+                recyclerView {
+                    data.bindOptional(context) {
+                        if (it?.categoryIsSelect == 0) {
+                            visibility = View.GONE
+                        } else {
+                            visibility = View.VISIBLE
+                        }
+                    }
+                    background = resources.getDrawable(R.color.white)
+                    adapter = spotCategoryAdapter
+                }.lparams(matchParent, wrapContent)
+
+                data.bindOptional(context) {
+                    spotCategoryAdapter.setNewData(it?.categoryList)
+                }
+
+                linearLayout {
+                    gravity = Gravity.CENTER_VERTICAL
+                    imageView {
+                        onThrottleFirstClick {
+                            viewModel.setOnBrandClick(dataIndex)
+                        }
+                        imageResource = R.mipmap.second_list_floding
+                    }.lparams(autoSize(43), autoSize(43)) {
+                        marginStart = autoSize(44)
+                    }
+
+                    textView {
+                        text = "品牌"
+                        textSizeAuto = autoSize(31)
+                        textColorInt = R.color.rma_black_33
+                    }.lparams(wrapContent, wrapContent) {
+                        marginStart = autoSize(20)
+                    }
+                }.lparams(matchParent, autoSize(108))
+
+                //品牌
+                recyclerView {
+                    data.bindOptional(context) {
+                        if (it?.brandIsSelect == 0) {
+                            visibility = View.GONE
+                        } else {
+                            visibility = View.VISIBLE
+                        }
+                    }
+                    background = resources.getDrawable(R.color.white)
+                    adapter = brandAdapter
+                }.lparams(matchParent, wrapContent)
+
+                data.bindOptional(context) {
+                    brandAdapter.setNewData(it?.brandList)
+                }
+
+                linearLayout {
+                    gravity = Gravity.CENTER_VERTICAL
+                    linearLayout {
+                        gravity = Gravity.CENTER_VERTICAL
+                        imageView {
+                            onThrottleFirstClick {
+                                viewModel.setOnHedgeClick(dataIndex)
+                            }
+                            imageResource = R.mipmap.second_list_floding
+                        }.lparams(autoSize(43), autoSize(43)) {
+                            marginStart = autoSize(44)
+                        }
+
+                        textView {
+                            text = "套保品种"
+                            textSizeAuto = autoSize(31)
+                            textColorInt = R.color.rma_black_33
+                        }.lparams(wrapContent, wrapContent) {
+                            marginStart = autoSize(20)
+                        }
+                    }.lparams(autoSize(350), autoSize(108))
+                    linearLayout {
+                        gravity = Gravity.CENTER
+                        textView {
+                            text = "单位"
+                            textSizeAuto = 31
+                            textColorInt = R.color.rma_hint_text_color_ccc
+                        }.lparams(wrapContent, wrapContent)
+                    }.lparams(autoSize(200), autoSize(108))
+                    linearLayout {
+                        gravity = Gravity.CENTER_VERTICAL
+                        emptyView()
+                        textView {
+                            text = "套保系数"
+                            textSizeAuto = 31
+                            textColorInt = R.color.rma_hint_text_color_ccc
+                        }.lparams(wrapContent, wrapContent) {
+                            marginEnd = autoSize(79)
+                        }
+                    }.lparams(autoSize(350), autoSize(108))
+                }.lparams(matchParent, autoSize(108))
+
+                //套保系数
+                recyclerView {
+                    data.bindOptional(context) {
+                        if (it?.hedgeIsSelect == 0) {
+                            visibility = View.GONE
+                        } else {
+                            visibility = View.VISIBLE
+                        }
+                    }
+                    background = resources.getDrawable(R.color.white)
+                    adapter = hedgeAdapter
+                }.lparams(matchParent, wrapContent)
+                data.bindOptional(context) {
+                    hedgeAdapter.setNewData(it?.hedgeList)
+                }
+
+            }.lparams(matchParent, wrapContent)
+
+        }.lparams(matchParent, wrapContent) {
+            bottomMargin = autoSize(10)
+        }
+    }
+
+}

+ 272 - 0
RMA/app/src/main/java/cn/muchinfo/rma/view/base/home/commodity/newcommodity/NewCommodityInformationActivity.kt

@@ -0,0 +1,272 @@
+package cn.muchinfo.rma.view.base.home.commodity.newcommodity
+
+import android.content.Intent
+import android.os.Bundle
+import android.view.View
+import android.view.ViewGroup
+import androidx.appcompat.app.AppCompatActivity
+import androidx.viewpager.widget.PagerAdapter
+import androidx.viewpager.widget.ViewPager
+import cn.muchinfo.rma.R
+import cn.muchinfo.rma.global.data.MiddleGoodsData
+import cn.muchinfo.rma.lifecycle.bindOptional
+import cn.muchinfo.rma.view.autoWidget.*
+import cn.muchinfo.rma.view.base.BaseActivity
+import cn.muchinfo.rma.view.base.home.commodity.AddHedgeGoodsActivity
+import cn.muchinfo.rma.view.base.home.commodity.AddSpotGoodsActivity
+import cn.muchinfo.rma.view.base.home.commodity.CommodityMiddleViewHolder
+import cn.muchinfo.rma.view.base.home.commodity.newcommodity.newhedge.HedgeSpeciesData
+import cn.muchinfo.rma.view.base.home.commodity.newcommodity.newhedge.NewHedgeSpeciesViewHolder
+import com.blankj.utilcode.util.ActivityUtils
+import com.blankj.utilcode.util.ConvertUtils
+import com.qmuiteam.qmui.util.QMUIDisplayHelper
+import com.qmuiteam.qmui.widget.tab.QMUITabIndicator
+import com.qmuiteam.qmui.widget.tab.QMUITabSegment
+import mtp.polymer.com.autowidget.adapter.BaseAdapter
+import org.jetbrains.anko._FrameLayout
+import org.jetbrains.anko.matchParent
+import org.jetbrains.anko.support.v4.viewPager
+import org.jetbrains.anko.verticalLayout
+import org.jetbrains.anko.view
+
+class NewCommodityInformationActivity : BaseActivity<NewCommodityInformationViewModel>() {
+
+
+    lateinit var segment: QMUITabSegment
+    var selectedTabIndex: Int = 0
+    private lateinit var viewPager: ViewPager
+
+    private val tabsArray: List<String> by lazy {
+        arrayListOf(
+            "现货品种", "套保品种"
+        )
+    }
+
+    /**
+     * 新版现货品种UI
+     */
+    private val newSpotVarietiesUI by lazy { NewSpotVarietiesUI(this, viewModel) }
+
+    /**
+     * 新版套保品种UI
+     */
+    private val newHedgeSpeciesUI by lazy { NewHedgeSpeciesUI(this, viewModel) }
+
+    private val pagerAdapter: PagerAdapter by lazy {
+        object : PagerAdapter() {
+
+            override fun getPageTitle(position: Int): CharSequence? = tabsArray[position]
+
+            override fun instantiateItem(container: ViewGroup, position: Int): Any {
+                when (position) {
+                    0 -> {
+                        return newSpotVarietiesUI.root.apply {
+                            container.addView(
+                                this,
+                                ViewGroup.LayoutParams(matchParent, matchParent)
+                            )
+                        }
+                    }
+                    1 -> {
+                        return newHedgeSpeciesUI.root.apply {
+                            container.addView(
+                                this,
+                                ViewGroup.LayoutParams(matchParent, matchParent)
+                            )
+                        }
+                    }
+                    else -> return super.instantiateItem(container, position)
+                }
+            }
+
+            override fun destroyItem(container: ViewGroup, position: Int, `object`: Any) {
+                (`object` as? View)?.let { container.removeView(it) }
+            }
+
+            override fun isViewFromObject(view: View, `object`: Any): Boolean = view == `object`
+
+            override fun getCount(): Int = tabsArray.size
+
+        }
+    }
+
+
+    override fun onCreate(savedInstanceState: Bundle?) {
+        super.onCreate(savedInstanceState)
+        verticalLayout {
+            topBar {
+                commonLeftButton()
+                commonTitle {
+                    text = "商品信息"
+                }
+                commonMenuButton(R.mipmap.add_new) {
+                    if (selectedTabIndex == 0){
+                        val intent = Intent()
+                        intent.putExtra("type","1")
+                        intent.setClass(context, AddSpotGoodsActivity::class.java)
+                        ActivityUtils.startActivity(intent)
+                    }else if (selectedTabIndex == 1){
+                        val intent = Intent()
+                        intent.putExtra("type","1")
+                        intent.setClass(context, AddHedgeGoodsActivity::class.java)
+                        ActivityUtils.startActivity(intent)
+                    }
+                }
+            }
+
+            tabSegment {
+                segment = this
+                background = resources.getDrawable(R.color.segtabment_bg_color)
+                addOnTabSelectedListener(object :
+                    QMUITabSegment.OnTabSelectedListener {
+                    override fun onDoubleTap(index: Int) {}
+                    override fun onTabReselected(index: Int) {}
+                    override fun onTabUnselected(index: Int) {}
+                    override fun onTabSelected(index: Int) {
+                        selectedTabIndex = index
+                    }
+                })
+                setIndicator(
+                    QMUITabIndicator(
+                        QMUIDisplayHelper.dp2px(context, 2),
+                        false,
+                        true
+                    )
+                )
+                setDefaultTextSize(ConvertUtils.sp2px(16f), ConvertUtils.sp2px(16f))
+            }.lparams(matchParent, autoSize(80))
+
+            view {
+                background = resources.getDrawable(R.color.main_hit_bg_color)
+            }.lparams(matchParent, autoSize(1)) {
+                marginStart = autoSize(32)
+                marginEnd = autoSize(32)
+            }
+            viewPager {
+                background = resources.getDrawable(R.color.white)
+                viewPager = this
+                adapter = pagerAdapter
+            }.lparams(matchParent, matchParent)
+
+            segment.setupWithViewPager(viewPager)
+            segment.selectTab(selectedTabIndex)
+        }
+    }
+
+}
+
+/**
+ * 新版现货品种UI
+ * @property activity AppCompatActivity
+ * @property viewModel NewCommodityInformationViewModel
+ * @constructor
+ */
+class NewSpotVarietiesUI(
+    private val activity: AppCompatActivity,
+    private val viewModel: NewCommodityInformationViewModel
+) {
+
+    private lateinit var swipeToLayout: SwipeToLoadLayout
+    private lateinit var statusLayout: StatusLayout
+
+    private val spotVarietiesNormalAdapter: BaseAdapter<DemoData, DemoViewHolder> = BaseAdapter { _, _ -> DemoViewHolder(activity, viewModel) }
+
+    init {
+        viewModel.setDemoDataList()
+    }
+
+    val root = _FrameLayout(activity).apply {
+        verticalLayout {
+            statusLayout(contentBlock = {
+                statusLayout = this
+//                bindTaskStatus(viewModule.status)
+                swipeToLoadLayout {
+                    swipeToLayout = this
+                    setEnableRefresh(true)
+                    setEnableLoadMore(false)
+                    setOnRefreshListener {
+
+                    }
+                    setEnableScrollContentWhenLoaded(false)
+                    setEnableLoadMoreWhenContentNotFull(false)
+                    recyclerView {
+                        background = resources.getDrawable(R.color.white)
+                        adapter = spotVarietiesNormalAdapter
+                    }.lparams(matchParent, matchParent)
+                }
+            }, emptyBlock = {
+                emptyView(hint = resources.getString(R.string.now_no_data))
+            }).lparams(matchParent, matchParent)
+
+            viewModel.demoDataList.bindOptional(context){
+                if (it?.isEmpty() == true || it?.size == 0){
+                    statusLayout.showEmpty()
+                }else {
+                    if (swipeToLayout.getIsRefreshing()){
+                        swipeToLayout.finishRefresh()
+                    }
+                    statusLayout.showSuccess()
+                    spotVarietiesNormalAdapter.setNewData(it)
+                }
+            }
+        }
+    }
+}
+
+/**
+ * 新版套保品种UI
+ * @property activity AppCompatActivity
+ * @property viewModel NewCommodityInformationViewModel
+ * @property root _FrameLayout
+ * @constructor
+ */
+class NewHedgeSpeciesUI(
+    private val activity: AppCompatActivity,
+    private val viewModel: NewCommodityInformationViewModel
+) {
+    private lateinit var swipeToLayout: SwipeToLoadLayout
+    private lateinit var statusLayout: StatusLayout
+
+    private val hedgeSpeciesAdapter: BaseAdapter<HedgeSpeciesData, NewHedgeSpeciesViewHolder> = BaseAdapter { _, _ -> NewHedgeSpeciesViewHolder(activity, viewModel) }
+
+    init {
+        viewModel.setDemoDataList()
+    }
+
+    val root = _FrameLayout(activity).apply {
+        verticalLayout {
+            statusLayout(contentBlock = {
+                statusLayout = this
+//                bindTaskStatus(viewModule.status)
+                swipeToLoadLayout {
+                    swipeToLayout = this
+                    setEnableRefresh(true)
+                    setEnableLoadMore(false)
+                    setOnRefreshListener {
+
+                    }
+                    setEnableScrollContentWhenLoaded(false)
+                    setEnableLoadMoreWhenContentNotFull(false)
+                    recyclerView {
+                        background = resources.getDrawable(R.color.white)
+                        adapter = hedgeSpeciesAdapter
+                    }.lparams(matchParent, matchParent)
+                }
+            }, emptyBlock = {
+                emptyView(hint = resources.getString(R.string.now_no_data))
+            }).lparams(matchParent, matchParent)
+
+            viewModel.hedgeSpeciesList.bindOptional(context){
+                if (it?.isEmpty() == true || it?.size == 0){
+                    statusLayout.showEmpty()
+                }else {
+                    if (swipeToLayout.getIsRefreshing()){
+                        swipeToLayout.finishRefresh()
+                    }
+                    statusLayout.showSuccess()
+                    hedgeSpeciesAdapter.setNewData(it)
+                }
+            }
+        }
+    }
+}

+ 200 - 0
RMA/app/src/main/java/cn/muchinfo/rma/view/base/home/commodity/newcommodity/NewCommodityInformationViewModel.kt

@@ -0,0 +1,200 @@
+package cn.muchinfo.rma.view.base.home.commodity.newcommodity
+
+import androidx.lifecycle.MutableLiveData
+import androidx.viewpager.widget.ViewPager
+import cn.muchinfo.rma.global.data.ContractData
+import cn.muchinfo.rma.view.base.BaseViewModel
+import cn.muchinfo.rma.view.base.home.commodity.newcommodity.newhedge.HedgeFutureData
+import cn.muchinfo.rma.view.base.home.commodity.newcommodity.newhedge.HedgeSpeciesData
+import cn.muchinfo.rma.view.base.home.commodity.newcommodity.newhedge.HedgeSpotData
+import com.qmuiteam.qmui.widget.tab.QMUITabSegment
+
+class NewCommodityInformationViewModel : BaseViewModel() {
+
+    /**
+     * 现货品种的数据
+     */
+    val demoDataList: MutableLiveData<List<DemoData>> = MutableLiveData()
+
+    /**
+     * 套保品种的数据
+     */
+    val hedgeSpeciesList: MutableLiveData<List<HedgeSpeciesData>> = MutableLiveData()
+
+    fun getHedgeSpeciesList() {
+        val newhedgeSpeciesList = arrayListOf<HedgeSpeciesData>()
+        newhedgeSpeciesList.add(
+            HedgeSpeciesData(
+                id = "1",
+                futureTyeList = arrayListOf(
+                    HedgeFutureData(
+                        id = "1",
+                        futureContractList = arrayListOf("1", "2", "3")
+                    ), HedgeFutureData(
+                        id = "2",
+                        futureContractList = arrayListOf("1", "2", "3")
+                    )
+                ),
+                spotTypeList = arrayListOf(
+                    HedgeSpotData(
+                        id = "1",
+                        spotCategoryList = arrayListOf("1", "2", "3")
+                    ), HedgeSpotData(
+                        id = "2",
+                        spotCategoryList = arrayListOf("1", "2", "3")
+                    )
+                )
+            )
+        )
+
+        hedgeSpeciesList.postValue(newhedgeSpeciesList)
+    }
+
+    fun setDemoDataList() {
+        val demoList = arrayListOf<DemoData>()
+        demoList.add(
+            DemoData(
+                id = "1",
+                categoryList = arrayListOf("1", "2", "3"),
+                brandList = arrayListOf("1", "2", "3"),
+                hedgeList = arrayListOf(
+                    HedgeDetails(id = "1", detailsList = arrayListOf("1", "2", "3")),
+                    HedgeDetails(id = "2", detailsList = arrayListOf("1", "2"))
+                )
+            )
+        )
+        demoList.add(
+            DemoData(
+                id = "2",
+                categoryList = arrayListOf("1", "2", "3"),
+                brandList = arrayListOf("1", "2", "3"),
+                hedgeList = arrayListOf(
+                    HedgeDetails(id = "1", detailsList = arrayListOf("1", "2", "3")),
+                    HedgeDetails(id = "2", detailsList = arrayListOf("1", "2"))
+                )
+            )
+        )
+        demoList.add(
+            DemoData(
+                id = "3",
+                categoryList = arrayListOf("1", "2", "3"),
+                brandList = arrayListOf("1", "2", "3"),
+                hedgeList = arrayListOf(
+                    HedgeDetails(id = "1", detailsList = arrayListOf("1", "2", "3")),
+                    HedgeDetails(id = "2", detailsList = arrayListOf("1", "2"))
+                )
+            )
+        )
+        demoList.add(
+            DemoData(
+                id = "4",
+                categoryList = arrayListOf("1", "2", "3"),
+                brandList = arrayListOf("1", "2", "3"),
+                hedgeList = arrayListOf(
+                    HedgeDetails(id = "1", detailsList = arrayListOf("1", "2", "3")),
+                    HedgeDetails(id = "2", detailsList = arrayListOf("1", "2"))
+                )
+            )
+        )
+        demoDataList.postValue(demoList)
+    }
+
+
+    /**
+     * 现货合同item点击事件
+     * @param index Int
+     */
+    fun setOnAllClick(index: Int) {
+        val datanewlist = arrayListOf<DemoData>()
+        demoDataList.value?.forEach {
+            if (index == demoDataList.value?.indexOf(it)) {
+                if (it.isSelectAll == 0) {
+                    datanewlist.add(it.copy(isSelectAll = 1))
+                } else {
+                    datanewlist.add(it.copy(isSelectAll = 0))
+                }
+            } else {
+                datanewlist.add(it)
+            }
+        }
+        demoDataList.postValue(datanewlist)
+    }
+
+    //现货品种-品类的展开隐藏点击事件
+    fun setOnCategoryClick(index: Int) {
+        val datanewlist = arrayListOf<DemoData>()
+        demoDataList.value?.forEach {
+            if (index == demoDataList.value?.indexOf(it)) {
+                if (it.categoryIsSelect == 0) {
+                    datanewlist.add(it.copy(categoryIsSelect = 1))
+                } else {
+                    datanewlist.add(it.copy(categoryIsSelect = 0))
+                }
+            } else {
+                datanewlist.add(it)
+            }
+        }
+        demoDataList.postValue(datanewlist)
+    }
+
+    //现货品种-品牌的展开隐藏点击事件
+    fun setOnBrandClick(index: Int) {
+        val datanewlist = arrayListOf<DemoData>()
+        demoDataList.value?.forEach {
+            if (index == demoDataList.value?.indexOf(it)) {
+                if (it.brandIsSelect == 0) {
+                    datanewlist.add(it.copy(brandIsSelect = 1))
+                } else {
+                    datanewlist.add(it.copy(brandIsSelect = 0))
+                }
+            } else {
+                datanewlist.add(it)
+            }
+        }
+        demoDataList.postValue(datanewlist)
+    }
+
+    //现货品种-套保品种的展开隐藏点击事件
+    fun setOnHedgeClick(index: Int) {
+        val datanewlist = arrayListOf<DemoData>()
+        demoDataList.value?.forEach {
+            if (index == demoDataList.value?.indexOf(it)) {
+                if (it.hedgeIsSelect == 0) {
+                    datanewlist.add(it.copy(hedgeIsSelect = 1))
+                } else {
+                    datanewlist.add(it.copy(hedgeIsSelect = 0))
+                }
+            } else {
+                datanewlist.add(it)
+            }
+        }
+        demoDataList.postValue(datanewlist)
+    }
+
+    //现货品种-套保品种-现货品种的展开隐藏点击事件
+    fun setOnFutureClick(index: Int, sonIndex: Int) {
+        val datanewlist = arrayListOf<DemoData>()
+        val oldList = demoDataList.value
+        demoDataList.value?.forEach {
+            if (index == oldList?.indexOf(it)) {
+                val newHedgeList = arrayListOf<HedgeDetails>()
+                oldList.get(index).hedgeList.forEach { data ->
+                    if (sonIndex == oldList.get(index).hedgeList.indexOf(data)) {
+                        if (data.isSelect == 0) {
+                            newHedgeList.add(data.copy(isSelect = 1))
+                        } else {
+                            newHedgeList.add(data.copy(isSelect = 0))
+                        }
+                    } else {
+                        newHedgeList.add(data)
+                    }
+                }
+                datanewlist.add(it.copy(hedgeList = newHedgeList))
+            } else {
+                datanewlist.add(it)
+            }
+        }
+        demoDataList.postValue(datanewlist)
+    }
+
+}

+ 50 - 0
RMA/app/src/main/java/cn/muchinfo/rma/view/base/home/commodity/newcommodity/SpotCategoryViewHolder.kt

@@ -0,0 +1,50 @@
+package cn.muchinfo.rma.view.base.home.commodity.newcommodity
+
+import android.view.Gravity
+import androidx.appcompat.app.AppCompatActivity
+import cn.muchinfo.rma.R
+import cn.muchinfo.rma.view.autoWidget.autoSize
+import cn.muchinfo.rma.view.autoWidget.textColorInt
+import cn.muchinfo.rma.view.autoWidget.textSizeAuto
+import cn.muchinfo.rma.view.base.home.contract.emptyView
+import mtp.polymer.com.autowidget.adapter.BaseViewHolder
+import org.jetbrains.anko.*
+
+class SpotCategoryViewHolder(private val activity : AppCompatActivity,private val viewModel: NewCommodityInformationViewModel) : BaseViewHolder<String>(activity){
+    override val itemSize: IntArray = intArrayOf(matchParent, wrapContent)
+
+    override fun _FrameLayout.createContentView() {
+        linearLayout {
+            backgroundResource = R.drawable.rma_list_item_bg
+            gravity = Gravity.CENTER_VERTICAL
+            textView {
+                text = "10mm"
+                textSizeAuto = 31
+                textColorInt = R.color.rma_black_33
+            }.lparams(wrapContent, wrapContent){
+                marginStart = autoSize(20)
+            }
+
+            emptyView()
+
+            textView {
+                text = "吨"
+                textColorInt = R.color.rma_black_33
+                textSizeAuto = 31
+            }.lparams(wrapContent, wrapContent)
+            emptyView()
+            textView {
+                text = "1.2"
+                textSizeAuto = 31
+                textColorInt = R.color.rma_black_33
+            }.lparams(wrapContent, wrapContent){
+                marginEnd = autoSize(20)
+            }
+        }.lparams(matchParent, autoSize(96)){
+            marginStart = autoSize(102)
+            marginEnd = autoSize(78)
+            bottomMargin = autoSize(10)
+        }
+    }
+
+}

+ 50 - 0
RMA/app/src/main/java/cn/muchinfo/rma/view/base/home/commodity/newcommodity/SpotFutureViewHolder.kt

@@ -0,0 +1,50 @@
+package cn.muchinfo.rma.view.base.home.commodity.newcommodity
+
+import android.view.Gravity
+import androidx.appcompat.app.AppCompatActivity
+import cn.muchinfo.rma.R
+import cn.muchinfo.rma.view.autoWidget.autoSize
+import cn.muchinfo.rma.view.autoWidget.textColorInt
+import cn.muchinfo.rma.view.autoWidget.textSizeAuto
+import cn.muchinfo.rma.view.base.home.contract.emptyView
+import mtp.polymer.com.autowidget.adapter.BaseViewHolder
+import org.jetbrains.anko.*
+
+class SpotFutureViewHolder(private val activity : AppCompatActivity,private val viewModel: NewCommodityInformationViewModel): BaseViewHolder<String>(activity){
+    override val itemSize: IntArray = intArrayOf(matchParent, wrapContent)
+
+    override fun _FrameLayout.createContentView() {
+        linearLayout {
+            backgroundResource = R.drawable.rma_list_item_bg
+            gravity = Gravity.CENTER_VERTICAL
+            textView {
+                text = "10mm"
+                textSizeAuto = 31
+                textColorInt = R.color.rma_black_33
+            }.lparams(wrapContent, wrapContent){
+                marginStart = autoSize(20)
+            }
+
+            emptyView()
+
+            textView {
+                text = "吨"
+                textColorInt = R.color.rma_black_33
+                textSizeAuto = 31
+            }.lparams(wrapContent, wrapContent)
+            emptyView()
+            textView {
+                text = "1.2"
+                textSizeAuto = 31
+                textColorInt = R.color.rma_black_33
+            }.lparams(wrapContent, wrapContent){
+                marginEnd = autoSize(20)
+            }
+        }.lparams(matchParent, autoSize(96)){
+            marginStart = autoSize(157)
+            marginEnd = autoSize(78)
+            bottomMargin = autoSize(10)
+        }
+    }
+
+}

+ 112 - 0
RMA/app/src/main/java/cn/muchinfo/rma/view/base/home/commodity/newcommodity/SpotHedgeViewHolder.kt

@@ -0,0 +1,112 @@
+package cn.muchinfo.rma.view.base.home.commodity.newcommodity
+
+import android.view.Gravity
+import android.view.View
+import androidx.appcompat.app.AppCompatActivity
+import cn.muchinfo.rma.R
+import cn.muchinfo.rma.lifecycle.bindOptional
+import cn.muchinfo.rma.view.autoWidget.*
+import cn.muchinfo.rma.view.base.home.contract.emptyView
+import mtp.polymer.com.autowidget.adapter.BaseAdapter
+import mtp.polymer.com.autowidget.adapter.BaseViewHolder
+import org.jetbrains.anko.*
+
+class SpotHedgeViewHolder(private val activity : AppCompatActivity,private val viewModel: NewCommodityInformationViewModel,private val index : Int) : BaseViewHolder<HedgeDetails>(activity){
+    override val itemSize: IntArray = intArrayOf(matchParent, wrapContent)
+
+    //期货品种
+    private val spotFutureAdapter: BaseAdapter<String, SpotFutureViewHolder> =
+        BaseAdapter { _, _ -> SpotFutureViewHolder(activity, viewModel) }
+
+    override fun _FrameLayout.createContentView() {
+        verticalLayout {
+            linearLayout {
+                backgroundResource = R.drawable.rma_list_item_bg
+                gravity = Gravity.CENTER_VERTICAL
+                textView {
+                    text = "沪铜"
+                    textSizeAuto = 31
+                    textColorInt = R.color.rma_black_33
+                }.lparams(wrapContent, wrapContent){
+                    marginStart = autoSize(20)
+                }
+
+                emptyView()
+
+                textView {
+                    text = "吨"
+                    textColorInt = R.color.rma_black_33
+                    textSizeAuto = 31
+                }.lparams(wrapContent, wrapContent)
+                emptyView()
+                textView {
+                    text = "1.2"
+                    textSizeAuto = 31
+                    textColorInt = R.color.rma_black_33
+                }.lparams(wrapContent, wrapContent){
+                    marginEnd = autoSize(20)
+                }
+            }.lparams(matchParent, autoSize(96)){
+                marginStart = autoSize(102)
+                marginEnd = autoSize(78)
+            }
+            linearLayout {
+                gravity = Gravity.CENTER_VERTICAL
+                linearLayout {
+
+                    gravity = Gravity.CENTER_VERTICAL
+                    imageView {
+                        onThrottleFirstClick {
+                            viewModel.setOnFutureClick(index,dataIndex)
+                        }
+                        imageResource = R.mipmap.second_list_floding
+                    }.lparams(autoSize(43), autoSize(43))
+
+                    textView {
+                        text = "期货品种"
+                        textSizeAuto = 31
+                        textColorInt = R.color.rma_black_33
+                    }.lparams(wrapContent, wrapContent) {
+                        marginStart = autoSize(20)
+                    }
+                }.lparams(autoSize(290), autoSize(108))
+                linearLayout {
+                    gravity = Gravity.CENTER
+                    textView {
+                        text = "单位"
+                        textSizeAuto = 31
+                        textColorInt = R.color.rma_hint_text_color_ccc
+                    }.lparams(wrapContent, wrapContent)
+                }.lparams(autoSize(140), autoSize(108))
+                linearLayout {
+                    gravity = Gravity.CENTER_VERTICAL
+                    emptyView()
+                    textView {
+                        text = "品种系数"
+                        textSizeAuto = 31
+                        textColorInt = R.color.rma_hint_text_color_ccc
+                    }.lparams(wrapContent, wrapContent)
+                }.lparams(autoSize(290), autoSize(108))
+            }.lparams(matchParent, autoSize(108)){
+                marginStart = autoSize(102)
+            }
+
+            recyclerView {
+                data.bindOptional(context){
+                    if (it?.isSelect == 0){
+                        visibility = View.GONE
+                    }else{
+                        visibility = View.VISIBLE
+                    }
+                }
+                background = resources.getDrawable(R.color.white)
+                adapter = spotFutureAdapter
+            }.lparams(matchParent, wrapContent)
+
+            data.bindOptional(context){
+                spotFutureAdapter.setNewData(it?.detailsList)
+            }
+        }.lparams(matchParent, wrapContent)
+    }
+
+}

+ 58 - 0
RMA/app/src/main/java/cn/muchinfo/rma/view/base/home/commodity/newcommodity/newhedge/HedgeFutureContractViewHolder.kt

@@ -0,0 +1,58 @@
+package cn.muchinfo.rma.view.base.home.commodity.newcommodity.newhedge
+
+import android.view.Gravity
+import androidx.appcompat.app.AppCompatActivity
+import cn.muchinfo.rma.R
+import cn.muchinfo.rma.view.autoWidget.autoSize
+import cn.muchinfo.rma.view.autoWidget.textColorInt
+import cn.muchinfo.rma.view.autoWidget.textSizeAuto
+import cn.muchinfo.rma.view.base.home.commodity.newcommodity.NewCommodityInformationViewModel
+import cn.muchinfo.rma.view.base.home.contract.emptyView
+import mtp.polymer.com.autowidget.adapter.BaseViewHolder
+import org.jetbrains.anko.*
+
+/**
+ * 套保品种-期货品种-期货合约
+ * @property activity AppCompatActivity
+ * @property viewModel NewCommodityInformationViewModel
+ * @property itemSize IntArray
+ * @constructor
+ */
+class HedgeFutureContractViewHolder(private val activity : AppCompatActivity, private val viewModel: NewCommodityInformationViewModel): BaseViewHolder<String>(activity){
+    override val itemSize: IntArray = intArrayOf(matchParent, wrapContent)
+
+    override fun _FrameLayout.createContentView() {
+        linearLayout {
+            backgroundResource = R.drawable.rma_list_item_bg
+            gravity = Gravity.CENTER_VERTICAL
+            textView {
+                text = "10mm"
+                textSizeAuto = 31
+                textColorInt = R.color.rma_black_33
+            }.lparams(wrapContent, wrapContent){
+                marginStart = autoSize(20)
+            }
+
+            emptyView()
+
+            textView {
+                text = "吨"
+                textColorInt = R.color.rma_black_33
+                textSizeAuto = 31
+            }.lparams(wrapContent, wrapContent)
+            emptyView()
+            textView {
+                text = "1.2"
+                textSizeAuto = 31
+                textColorInt = R.color.rma_black_33
+            }.lparams(wrapContent, wrapContent){
+                marginEnd = autoSize(20)
+            }
+        }.lparams(matchParent, autoSize(96)){
+            marginStart = autoSize(157)
+            marginEnd = autoSize(78)
+            bottomMargin = autoSize(10)
+        }
+    }
+
+}

+ 115 - 0
RMA/app/src/main/java/cn/muchinfo/rma/view/base/home/commodity/newcommodity/newhedge/HedgeFutureViewHolder.kt

@@ -0,0 +1,115 @@
+package cn.muchinfo.rma.view.base.home.commodity.newcommodity.newhedge
+
+import android.view.Gravity
+import androidx.appcompat.app.AppCompatActivity
+import cn.muchinfo.rma.R
+import cn.muchinfo.rma.view.autoWidget.*
+import cn.muchinfo.rma.view.base.home.commodity.newcommodity.NewCommodityInformationViewModel
+import cn.muchinfo.rma.view.base.home.contract.emptyView
+import mtp.polymer.com.autowidget.adapter.BaseAdapter
+import mtp.polymer.com.autowidget.adapter.BaseViewHolder
+import org.jetbrains.anko.*
+
+/**
+ * 套保品种-期货品种viewholder
+ * @property activity AppCompatActivity
+ * @property viewModel NewCommodityInformationViewModel
+ * @property itemSize IntArray
+ * @constructor
+ */
+class HedgeFutureViewHolder(
+    private val activity: AppCompatActivity,
+    private val viewModel: NewCommodityInformationViewModel,
+    private val index : Int//选择item的下标
+) : BaseViewHolder<HedgeFutureData>(activity) {
+    override val itemSize: IntArray = intArrayOf(matchParent, wrapContent)
+
+    //期货合约
+    private val hedgeFutureContractAdapter: BaseAdapter<String, HedgeFutureContractViewHolder> =
+        BaseAdapter { _, _ -> HedgeFutureContractViewHolder(activity, viewModel) }
+
+    override fun _FrameLayout.createContentView() {
+        verticalLayout {
+            linearLayout {
+                backgroundResource = R.drawable.rma_list_item_bg
+                gravity = Gravity.CENTER_VERTICAL
+                textView {
+                    text = "沪铜"
+                    textSizeAuto = 31
+                    textColorInt = R.color.rma_black_33
+                }.lparams(wrapContent, wrapContent) {
+                    marginStart = autoSize(20)
+                }
+
+                emptyView()
+
+                textView {
+                    text = "吨"
+                    textColorInt = R.color.rma_black_33
+                    textSizeAuto = 31
+                }.lparams(wrapContent, wrapContent)
+                emptyView()
+                textView {
+                    text = "1.2"
+                    textSizeAuto = 31
+                    textColorInt = R.color.rma_black_33
+                }.lparams(wrapContent, wrapContent) {
+                    marginEnd = autoSize(20)
+                }
+            }.lparams(matchParent, autoSize(96)) {
+                marginStart = autoSize(102)
+                marginEnd = autoSize(78)
+            }
+
+            linearLayout {
+                gravity = Gravity.CENTER_VERTICAL
+                linearLayout {
+
+                    gravity = Gravity.CENTER_VERTICAL
+                    imageView {
+                        onThrottleFirstClick {
+
+                        }
+                        imageResource = R.mipmap.second_list_floding
+                    }.lparams(autoSize(43), autoSize(43))
+
+                    textView {
+                        text = "期货合约"
+                        textSizeAuto = 31
+                        textColorInt = R.color.rma_black_33
+                    }.lparams(wrapContent, wrapContent) {
+                        marginStart = autoSize(20)
+                    }
+                }.lparams(autoSize(290), autoSize(108))
+                linearLayout {
+                    gravity = Gravity.CENTER
+                    textView {
+                        text = "单位"
+                        textSizeAuto = 31
+                        textColorInt = R.color.rma_hint_text_color_ccc
+                    }.lparams(wrapContent, wrapContent)
+                }.lparams(autoSize(140), autoSize(108))
+                linearLayout {
+                    gravity = Gravity.CENTER_VERTICAL
+                    emptyView()
+                    textView {
+                        text = "合约乘数"
+                        textSizeAuto = 31
+                        textColorInt = R.color.rma_hint_text_color_ccc
+                    }.lparams(wrapContent, wrapContent)
+                }.lparams(autoSize(290), autoSize(108))
+            }.lparams(matchParent, autoSize(108)) {
+                marginStart = autoSize(102)
+            }
+
+            recyclerView {
+                background = resources.getDrawable(R.color.white)
+                adapter = hedgeFutureContractAdapter
+            }.lparams(matchParent, wrapContent)
+
+
+        }
+    }
+
+
+}

+ 23 - 0
RMA/app/src/main/java/cn/muchinfo/rma/view/base/home/commodity/newcommodity/newhedge/HedgeSpeciesData.kt

@@ -0,0 +1,23 @@
+package cn.muchinfo.rma.view.base.home.commodity.newcommodity.newhedge
+
+data class HedgeSpeciesData(
+    val id : String = "",
+    var isAllSelect : Int = 0,//是否全部展开
+    var futureTyeList : List<HedgeFutureData> = arrayListOf(),//套保期货品种
+    var isFutureTypeSelect : Int = 1,//期货品种是否展开
+    var spotTypeList : List<HedgeSpotData> = arrayListOf(),//套保现货品种
+    var isSpotTypeSelect : Int = 1//现货品种是否展开
+)
+
+//套保品种的期货品种
+data class HedgeFutureData(
+    val id : String = "",
+    var futureContractList : List<String> = arrayListOf(),
+    var isFutureSelect : Int = 0//期货合约是否展开
+)
+
+data class HedgeSpotData(
+    val id : String = "",
+    var spotCategoryList : List<String> = arrayListOf(),
+    var isSpotSelect : Int = 0//品类是否展开
+)

+ 58 - 0
RMA/app/src/main/java/cn/muchinfo/rma/view/base/home/commodity/newcommodity/newhedge/HedgeSpotCagetoryViewHolder.kt

@@ -0,0 +1,58 @@
+package cn.muchinfo.rma.view.base.home.commodity.newcommodity.newhedge
+
+import android.view.Gravity
+import androidx.appcompat.app.AppCompatActivity
+import cn.muchinfo.rma.R
+import cn.muchinfo.rma.view.autoWidget.autoSize
+import cn.muchinfo.rma.view.autoWidget.textColorInt
+import cn.muchinfo.rma.view.autoWidget.textSizeAuto
+import cn.muchinfo.rma.view.base.home.commodity.newcommodity.NewCommodityInformationViewModel
+import cn.muchinfo.rma.view.base.home.contract.emptyView
+import mtp.polymer.com.autowidget.adapter.BaseViewHolder
+import org.jetbrains.anko.*
+
+/**
+ * 套保品种-现货品种-品类
+ * @property activity AppCompatActivity
+ * @property viewModel NewCommodityInformationViewModel
+ * @property itemSize IntArray
+ * @constructor
+ */
+class HedgeSpotCategoryViewHolder(private val activity : AppCompatActivity, private val viewModel: NewCommodityInformationViewModel): BaseViewHolder<String>(activity){
+    override val itemSize: IntArray = intArrayOf(matchParent, wrapContent)
+
+    override fun _FrameLayout.createContentView() {
+        linearLayout {
+            backgroundResource = R.drawable.rma_list_item_bg
+            gravity = Gravity.CENTER_VERTICAL
+            textView {
+                text = "10mm"
+                textSizeAuto = 31
+                textColorInt = R.color.rma_black_33
+            }.lparams(wrapContent, wrapContent){
+                marginStart = autoSize(20)
+            }
+
+            emptyView()
+
+            textView {
+                text = "吨"
+                textColorInt = R.color.rma_black_33
+                textSizeAuto = 31
+            }.lparams(wrapContent, wrapContent)
+            emptyView()
+            textView {
+                text = "1.2"
+                textSizeAuto = 31
+                textColorInt = R.color.rma_black_33
+            }.lparams(wrapContent, wrapContent){
+                marginEnd = autoSize(20)
+            }
+        }.lparams(matchParent, autoSize(96)){
+            marginStart = autoSize(157)
+            marginEnd = autoSize(78)
+            bottomMargin = autoSize(10)
+        }
+    }
+
+}

+ 114 - 0
RMA/app/src/main/java/cn/muchinfo/rma/view/base/home/commodity/newcommodity/newhedge/HedgeSpotViewHolder.kt

@@ -0,0 +1,114 @@
+package cn.muchinfo.rma.view.base.home.commodity.newcommodity.newhedge
+
+import android.view.Gravity
+import androidx.appcompat.app.AppCompatActivity
+import cn.muchinfo.rma.R
+import cn.muchinfo.rma.view.autoWidget.*
+import cn.muchinfo.rma.view.base.home.commodity.newcommodity.NewCommodityInformationViewModel
+import cn.muchinfo.rma.view.base.home.contract.emptyView
+import mtp.polymer.com.autowidget.adapter.BaseAdapter
+import mtp.polymer.com.autowidget.adapter.BaseViewHolder
+import org.jetbrains.anko.*
+
+/**
+ * 套保品种-现货品种viewholder
+ * @property activity AppCompatActivity
+ * @property viewModel NewCommodityInformationViewModel
+ * @property itemSize IntArray
+ * @constructor
+ */
+class HedgeSpotViewHolder(
+    private val activity: AppCompatActivity,
+    private val viewModel: NewCommodityInformationViewModel,
+    private val index : Int//选择item的下标
+) : BaseViewHolder<HedgeSpotData>(activity) {
+    override val itemSize: IntArray = intArrayOf(matchParent, wrapContent)
+
+    //期货合约
+    private val hedgeSpotCategoryAdapter: BaseAdapter<String, HedgeSpotCategoryViewHolder> =
+        BaseAdapter { _, _ -> HedgeSpotCategoryViewHolder(activity, viewModel) }
+
+    override fun _FrameLayout.createContentView() {
+        verticalLayout {
+            linearLayout {
+                backgroundResource = R.drawable.rma_list_item_bg
+                gravity = Gravity.CENTER_VERTICAL
+                textView {
+                    text = "沪铜"
+                    textSizeAuto = 31
+                    textColorInt = R.color.rma_black_33
+                }.lparams(wrapContent, wrapContent) {
+                    marginStart = autoSize(20)
+                }
+
+                emptyView()
+
+                textView {
+                    text = "吨"
+                    textColorInt = R.color.rma_black_33
+                    textSizeAuto = 31
+                }.lparams(wrapContent, wrapContent)
+                emptyView()
+                textView {
+                    text = "1.2"
+                    textSizeAuto = 31
+                    textColorInt = R.color.rma_black_33
+                }.lparams(wrapContent, wrapContent) {
+                    marginEnd = autoSize(20)
+                }
+            }.lparams(matchParent, autoSize(96)) {
+                marginStart = autoSize(102)
+                marginEnd = autoSize(78)
+            }
+
+            linearLayout {
+                gravity = Gravity.CENTER_VERTICAL
+                linearLayout {
+
+                    gravity = Gravity.CENTER_VERTICAL
+                    imageView {
+                        onThrottleFirstClick {
+
+                        }
+                        imageResource = R.mipmap.second_list_floding
+                    }.lparams(autoSize(43), autoSize(43))
+
+                    textView {
+                        text = "品类(2)"
+                        textSizeAuto = 31
+                        textColorInt = R.color.rma_black_33
+                    }.lparams(wrapContent, wrapContent) {
+                        marginStart = autoSize(20)
+                    }
+                }.lparams(autoSize(290), autoSize(108))
+                linearLayout {
+                    gravity = Gravity.CENTER
+                    textView {
+                        text = "单位"
+                        textSizeAuto = 31
+                        textColorInt = R.color.rma_hint_text_color_ccc
+                    }.lparams(wrapContent, wrapContent)
+                }.lparams(autoSize(140), autoSize(108))
+                linearLayout {
+                    gravity = Gravity.CENTER_VERTICAL
+                    emptyView()
+                    textView {
+                        text = "标仓系数"
+                        textSizeAuto = 31
+                        textColorInt = R.color.rma_hint_text_color_ccc
+                    }.lparams(wrapContent, wrapContent)
+                }.lparams(autoSize(290), autoSize(108))
+            }.lparams(matchParent, autoSize(108)) {
+                marginStart = autoSize(102)
+            }
+
+            recyclerView {
+                background = resources.getDrawable(R.color.white)
+                adapter = hedgeSpotCategoryAdapter
+            }.lparams(matchParent, wrapContent)
+
+        }
+    }
+
+
+}

+ 166 - 0
RMA/app/src/main/java/cn/muchinfo/rma/view/base/home/commodity/newcommodity/newhedge/NewHedgeSpeciesViewHolder.kt

@@ -0,0 +1,166 @@
+package cn.muchinfo.rma.view.base.home.commodity.newcommodity.newhedge
+
+import android.view.Gravity
+import androidx.appcompat.app.AppCompatActivity
+import cn.muchinfo.rma.R
+import cn.muchinfo.rma.view.autoWidget.*
+import cn.muchinfo.rma.view.base.home.commodity.newcommodity.NewCommodityInformationViewModel
+import cn.muchinfo.rma.view.base.home.contract.emptyView
+import mtp.polymer.com.autowidget.adapter.BaseAdapter
+import mtp.polymer.com.autowidget.adapter.BaseViewHolder
+import org.jetbrains.anko.*
+
+/**
+ * 用于新版商品信息中套保品种的viewholder
+ * @property activity AppCompatActivity
+ * @property viewModel NewCommodityInformationViewModel
+ * @constructor
+ */
+class NewHedgeSpeciesViewHolder(
+    private val activity: AppCompatActivity,
+    private val viewModel: NewCommodityInformationViewModel
+) : BaseViewHolder<HedgeSpeciesData>(activity) {
+    override val itemSize: IntArray = intArrayOf(matchParent, wrapContent)
+
+    //期货品种adapter
+    private val hedgeFutureAdapter: BaseAdapter<HedgeFutureData, HedgeFutureViewHolder> =
+        BaseAdapter { _, _ -> HedgeFutureViewHolder(activity, viewModel, dataIndex) }
+
+    //现货品种adapter
+    private val hedgeSpotAdapter: BaseAdapter<HedgeSpotData, HedgeSpotViewHolder> =
+        BaseAdapter { _, _ -> HedgeSpotViewHolder(activity, viewModel, dataIndex) }
+
+    override fun _FrameLayout.createContentView() {
+        verticalLayout {
+            linearLayout {
+                onThrottleFirstClick {
+                    viewModel.setOnAllClick(dataIndex)
+                }
+                gravity = Gravity.CENTER_VERTICAL
+                imageView {
+                    imageResource = R.mipmap.list_folding
+                }.lparams(autoSize(43), autoSize(43)) {
+                    marginStart = autoSize(36)
+                }
+
+                textView {
+                    text = "铜杆(吨)"
+                    textSizeAuto = 36
+                    textColorInt = R.color.rma_black_33
+                }.lparams(wrapContent, wrapContent) {
+                    marginStart = autoSize(19)
+                }
+
+                textView {
+                    text = "正常"
+                    textSizeAuto = 36
+                    textColorInt = R.color.rma_green_color
+                }.lparams(wrapContent, wrapContent) {
+                    marginStart = autoSize(20)
+                }
+            }.lparams(matchParent, autoSize(84))
+
+            verticalLayout {
+                linearLayout {
+                    gravity = Gravity.CENTER_VERTICAL
+                    linearLayout {
+                        gravity = Gravity.CENTER_VERTICAL
+                        imageView {
+                            onThrottleFirstClick {
+
+                            }
+                            imageResource = R.mipmap.second_list_floding
+                        }.lparams(autoSize(43), autoSize(43)) {
+                            marginStart = autoSize(44)
+                        }
+
+                        textView {
+                            text = "期货品种"
+                            textSizeAuto = autoSize(31)
+                            textColorInt = R.color.rma_black_33
+                        }.lparams(wrapContent, wrapContent) {
+                            marginStart = autoSize(20)
+                        }
+                    }.lparams(autoSize(350), autoSize(108))
+                    linearLayout {
+                        gravity = Gravity.CENTER
+                        textView {
+                            text = "单位"
+                            textSizeAuto = 31
+                            textColorInt = R.color.rma_hint_text_color_ccc
+                        }.lparams(wrapContent, wrapContent)
+                    }.lparams(autoSize(200), autoSize(108))
+                    linearLayout {
+                        gravity = Gravity.CENTER_VERTICAL
+                        emptyView()
+                        textView {
+                            text = "品种系数"
+                            textSizeAuto = 31
+                            textColorInt = R.color.rma_hint_text_color_ccc
+                        }.lparams(wrapContent, wrapContent) {
+                            marginEnd = autoSize(79)
+                        }
+                    }.lparams(autoSize(350), autoSize(108))
+                }.lparams(matchParent, autoSize(108))
+
+                //套保品种-期货品种-期货合约
+                recyclerView {
+                    background = resources.getDrawable(R.color.white)
+                    adapter = hedgeFutureAdapter
+                }.lparams(matchParent, wrapContent)
+
+                linearLayout {
+                    gravity = Gravity.CENTER_VERTICAL
+                    linearLayout {
+                        gravity = Gravity.CENTER_VERTICAL
+                        imageView {
+                            onThrottleFirstClick {
+
+                            }
+                            imageResource = R.mipmap.second_list_floding
+                        }.lparams(autoSize(43), autoSize(43)) {
+                            marginStart = autoSize(44)
+                        }
+
+                        textView {
+                            text = "现货品种"
+                            textSizeAuto = autoSize(31)
+                            textColorInt = R.color.rma_black_33
+                        }.lparams(wrapContent, wrapContent) {
+                            marginStart = autoSize(20)
+                        }
+                    }.lparams(autoSize(350), autoSize(108))
+                    linearLayout {
+                        gravity = Gravity.CENTER
+                        textView {
+                            text = "单位"
+                            textSizeAuto = 31
+                            textColorInt = R.color.rma_hint_text_color_ccc
+                        }.lparams(wrapContent, wrapContent)
+                    }.lparams(autoSize(200), autoSize(108))
+                    linearLayout {
+                        gravity = Gravity.CENTER_VERTICAL
+                        emptyView()
+                        textView {
+                            text = "品种系数"
+                            textSizeAuto = 31
+                            textColorInt = R.color.rma_hint_text_color_ccc
+                        }.lparams(wrapContent, wrapContent) {
+                            marginEnd = autoSize(79)
+                        }
+                    }.lparams(autoSize(350), autoSize(108))
+                }.lparams(matchParent, autoSize(108))
+
+                //套保品种-现货品种
+                recyclerView {
+                    background = resources.getDrawable(R.color.white)
+                    adapter = hedgeSpotAdapter
+                }.lparams(matchParent, wrapContent)
+
+            }.lparams(matchParent, wrapContent)
+        }.lparams(matchParent, wrapContent) {
+            bottomMargin = autoSize(10)
+        }
+    }
+
+}

+ 8 - 0
RMA/app/src/main/res/drawable/rma_list_item_bg.xml

@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="utf-8"?>
+<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle">
+    <stroke
+        android:color="#90D7FF"
+        android:width="1dp" />
+    <solid android:color="#E8F3F6"/>
+    <corners android:radius="5dp"/>
+</shape>

BIN
RMA/app/src/main/res/mipmap-xhdpi/list_folding.png


BIN
RMA/app/src/main/res/mipmap-xhdpi/second_list_floding.png


BIN
RMA/app/src/main/res/mipmap-xhdpi/spot_market_price.png


+ 1 - 0
RMA/app/src/main/res/values/colors.xml

@@ -39,6 +39,7 @@
     <color name="rma_report_title_color">#2F8C97</color>
     <color name="rma_account_name_bgcolor">#F38989</color>
     <color name="rma_red_color">#FF2F2C</color>
+    <color name="rma_item_bg">#F6F6F8</color>
 
 
     <color name="pickerview_timebtn_nor">#057dff</color>