Jelajahi Sumber

解耦详情列表item

ProGo 4 tahun lalu
induk
melakukan
b503145d79

+ 105 - 0
RMA/app/src/main/java/cn/muchinfo/rma/view/autoWidget/DetailItem.kt

@@ -0,0 +1,105 @@
+package cn.muchinfo.rma.view.autoWidget
+
+import android.content.Context
+import android.content.res.TypedArray
+import android.util.AttributeSet
+import android.view.View
+import androidx.annotation.StyleRes
+import androidx.constraintlayout.widget.ConstraintLayout
+import cn.muchinfo.rma.R
+import kotlinx.android.synthetic.main.detail_item.view.*
+
+/**
+ * 详情等页面的item
+ * 才疏学浅,自定义style穿不进来。
+ */
+class DetailItem @JvmOverloads constructor(
+    context: Context, attrs: AttributeSet? = null, defStyleAttr: Int = 0
+): ConstraintLayout(context, attrs, defStyleAttr) {
+    private var leftText: String = "" // 左边的文字
+    private var rightText: String = "" // 右边的文字
+    private var leftPadding: Int = 0 // 距离左边的padding
+    private var showLine: Boolean = false // 是否显示下部的分割线
+
+    init {
+        val typedArray = context.obtainStyledAttributes(attrs, R.styleable.DetailItem)
+        initViews(typedArray)
+        typedArray.recycle()
+    }
+
+    private fun initViews(typedArray: TypedArray) {
+        View.inflate(context, R.layout.detail_item, this)
+        leftText = typedArray.getString(R.styleable.DetailItem_dt_LeftText).toString()
+        rightText = typedArray.getString(R.styleable.DetailItem_dt_rightText).toString()
+        leftPadding = typedArray.getLayoutDimension(R.styleable.DetailItem_dt_leftPadding, 200)
+
+        showLine = typedArray.getBoolean(R.styleable.DetailItem_dt_showLine, false)
+        showLine(showLine)
+
+        if ("null" == leftText) {
+            id_title?.text = ""
+        } else {
+            id_title?.text = leftText
+        }
+        if ("null" == rightText) {
+            id_value?.text = ""
+        } else {
+            id_value?.text = rightText
+        }
+        id_title?.setTextAppearance(R.style.CostTitleTextStyle)
+        id_value?.setTextAppearance(R.style.CostValueTextStyle)
+        id_value?.setPadding(leftPadding,
+            id_value?.paddingTop!!,
+            id_value?.paddingRight!!,
+            id_value?.paddingBottom!!)
+    }
+
+//region publish
+
+    fun setRightText(rightText: String?) {
+        id_value?.text = rightText
+    }
+
+    fun setLeftText(leftText: String?) {
+        id_title?.text = leftText
+    }
+
+    fun setRightValuePadding(leftPadding: Int) {
+        id_value?.setPadding(leftPadding,
+            id_value?.paddingTop!!,
+            id_value?.paddingRight!!,
+            id_value?.paddingBottom!!)
+    }
+
+    fun showLine(show: Boolean) {
+        if (show) id_line?.visibility = View.VISIBLE else id_line?.visibility = GONE
+    }
+
+    /**
+     * 改变左侧的文字样式,参考styles.xml里自定的样式
+     */
+    fun setLeftStyle(@StyleRes style: Int) {
+        id_title?.setTextAppearance(style)
+    }
+
+    /**
+     * 改变右侧的文字样式,参考styles.xml里自定的样式
+     */
+    fun setRightStyle(@StyleRes style: Int) {
+        id_value?.setTextAppearance(style)
+    }
+
+    fun setPaddingLeft(leftPadding: Int?) {
+        this.setPadding(leftPadding!!, this.paddingTop, this.paddingRight, this.paddingBottom)
+    }
+    fun setPaddingTop(topPadding: Int) {
+        this.setPadding(this.leftPadding, topPadding, this.paddingRight, this.paddingBottom)
+    }
+    fun setPaddingRight(rightPadding: Int) {
+        this.setPadding(this.leftPadding, this.paddingTop, rightPadding, this.paddingBottom)
+    }
+    fun setPaddingBottom(BottomPadding: Int) {
+        this.setPadding(this.leftPadding, this.paddingTop, this.paddingRight, BottomPadding)
+    }
+//endregion
+}

+ 4 - 4
RMA/app/src/main/java/cn/muchinfo/rma/view/base/future/costs/CostFragment.kt

@@ -39,7 +39,7 @@ class CostFragment : BaseFragment<CostViewModel>() {
 //region views
     private var _view: View? = null
     private var idEntrustTab: QMUITabSegment? = null // 切换
-    private var idPager: ViewPager? = null
+    private var idCostPager: ViewPager? = null
 //endregion
 
     override fun onCreateView(
@@ -53,7 +53,7 @@ class CostFragment : BaseFragment<CostViewModel>() {
     }
 
     private fun initViews() {
-        idPager = _view?.findViewById(R.id.id_pager)
+        idCostPager = _view?.findViewById(R.id.id_cost_pager)
         idEntrustTab = _view?.findViewById(R.id.id_entrust_tab)
 
         // 设置
@@ -65,7 +65,7 @@ class CostFragment : BaseFragment<CostViewModel>() {
             idEntrustTab?.addTab(item)
         }
 
-        idPager?.adapter = object : FragmentPagerAdapter(
+        idCostPager?.adapter = object : FragmentPagerAdapter(
             childFragmentManager,
             BEHAVIOR_RESUME_ONLY_CURRENT_FRAGMENT
         ) {
@@ -83,7 +83,7 @@ class CostFragment : BaseFragment<CostViewModel>() {
                 return tabs[position]
             }
         }
-        idEntrustTab?.setupWithViewPager(idPager, false)
+        idEntrustTab?.setupWithViewPager(idCostPager, false)
         idEntrustTab?.addOnTabSelectedListener(object : QMUITabSegment.OnTabSelectedListener {
             /**
              * 当某个 Tab 被选中时会触发

+ 43 - 0
RMA/app/src/main/java/cn/muchinfo/rma/view/base/future/costs/CostInfoData.kt

@@ -0,0 +1,43 @@
+package cn.muchinfo.rma.view.base.future.costs
+
+import java.io.Serializable
+
+class CostInfoData : Serializable {
+    private var leftText: String? = null
+    private var rightText: String? = null
+    private var leftStyle: Int = 0
+    private var rightStyle: Int = 0
+    private var leftPadding: Int = 0
+
+    fun getLeftText() : String {
+        return leftText!!
+    }
+    fun getRightText() : String {
+        return rightText!!
+    }
+    fun getLeftStyle() : Int {
+        return leftStyle
+    }
+    fun getRightStyle() : Int {
+        return rightStyle
+    }
+    fun getLeftPadding() : Int {
+        return leftPadding
+    }
+
+    fun setLeftText(leftText: String?) {
+        this.leftText = leftText
+    }
+    fun setRightText(rightText: String?) {
+        this.rightText = rightText
+    }
+    fun setLeftStyle(leftStyle: Int) {
+        this.leftStyle = leftStyle
+    }
+    fun setRightStyle(rightStyle: Int) {
+        this.rightStyle = rightStyle
+    }
+    fun setLeftPadding(leftPadding: Int) {
+        this.leftPadding = leftPadding
+    }
+}

+ 16 - 1
RMA/app/src/main/java/cn/muchinfo/rma/view/base/future/costs/CostInfoFragment.kt

@@ -4,7 +4,11 @@ import android.os.Bundle
 import android.view.LayoutInflater
 import android.view.View
 import android.view.ViewGroup
+import androidx.recyclerview.widget.LinearLayoutManager
+import androidx.recyclerview.widget.RecyclerView
+import cn.muchinfo.rma.R
 import cn.muchinfo.rma.view.base.BaseFragment
+import cn.muchinfo.rma.view.base.future.deals.DealData
 
 /**
  * 资金信息
@@ -17,13 +21,24 @@ class CostInfoFragment(type: String?) : BaseFragment<CostViewModel>() {
     }
 
     private var _view: View? = null
+    private var idCostInfoList: RecyclerView? = null
 
     override fun onCreateView(
         inflater: LayoutInflater,
         container: ViewGroup?,
         savedInstanceState: Bundle?
     ): View? {
-        _view = inflater.inflate(0, container, false)
+        _view = inflater.inflate(R.layout.cost_info, container, false)
+        initViews()
         return _view
     }
+
+    private fun initViews() {
+        idCostInfoList = _view?.findViewById(R.id.id_cost_info_list)
+
+        val layoutManager = LinearLayoutManager(context)
+        idCostInfoList?.layoutManager = layoutManager
+        viewModel.makeCostInfo()
+        idCostInfoList?.adapter = viewModel.getAdapter()
+    }
 }

+ 2 - 1
RMA/app/src/main/java/cn/muchinfo/rma/view/base/future/costs/CostListFragment.kt

@@ -4,6 +4,7 @@ import android.os.Bundle
 import android.view.LayoutInflater
 import android.view.View
 import android.view.ViewGroup
+import cn.muchinfo.rma.R
 import cn.muchinfo.rma.view.base.BaseFragment
 
 /**
@@ -24,7 +25,7 @@ class CostListFragment(type: String?) : BaseFragment<CostViewModel>() {
         container: ViewGroup?,
         savedInstanceState: Bundle?
     ): View? {
-        _view = inflater.inflate(0, container, false)
+        _view = inflater.inflate(R.layout.cost_fragment, container, false)
         return _view
     }
 }

+ 117 - 0
RMA/app/src/main/java/cn/muchinfo/rma/view/base/future/costs/CostViewModel.kt

@@ -1,7 +1,124 @@
 package cn.muchinfo.rma.view.base.future.costs
 
+import android.content.Context
+import android.view.LayoutInflater
+import android.view.View
+import android.view.ViewGroup
+import androidx.recyclerview.widget.RecyclerView
+import cn.muchinfo.rma.R
+import cn.muchinfo.rma.view.autoWidget.DetailItem
 import cn.muchinfo.rma.view.base.BaseViewModel
 
 class CostViewModel : BaseViewModel() {
 
+    var list: ArrayList<CostInfoData>? = ArrayList()
+    var type: String? = null
+
+    /**
+     * 组装数据
+     */
+    fun makeCostInfo() {
+        val paddingLeft = 100 // 右侧的文字,距离左侧的距离
+
+        var m = CostInfoData()
+        m.setLeftText(context?.getString(R.string.str_currency))
+        m.setRightText("USD")
+        m.setLeftPadding(paddingLeft)
+        list?.add(m)
+
+        m = CostInfoData()
+        m.setLeftText(context?.getString(R.string.str_current_equity))
+        m.setRightText("1000.01")
+        m.setLeftPadding(paddingLeft)
+        list?.add(m)
+
+        m = CostInfoData()
+        m.setLeftText(context?.getString(R.string.str_available_am))
+        m.setRightText("55522.02")
+        m.setLeftPadding(paddingLeft)
+        list?.add(m)
+
+        m = CostInfoData()
+        m.setLeftText(context?.getString(R.string.str_occupation_amount))
+        m.setRightText("5522.29")
+        m.setLeftPadding(paddingLeft)
+        list?.add(m)
+
+        m = CostInfoData()
+        m.setLeftText(context?.getString(R.string.str_freezing_of_funds))
+        m.setRightText("599.45")
+        m.setLeftPadding(paddingLeft)
+        list?.add(m)
+
+        m = CostInfoData()
+        m.setLeftText(context?.getString(R.string.str_position_profit_loss))
+        m.setRightText("955.66")
+        m.setLeftPadding(paddingLeft)
+        list?.add(m)
+
+        m = CostInfoData()
+        m.setLeftText(context?.getString(R.string.str_close_profit_loss))
+        m.setRightText("1485.34")
+        m.setLeftPadding(paddingLeft)
+        list?.add(m)
+
+        m = CostInfoData()
+        m.setLeftText(context?.getString(R.string.str_in_am))
+        m.setRightText("72222.1")
+        m.setLeftPadding(paddingLeft)
+        list?.add(m)
+
+        m = CostInfoData()
+        m.setLeftText(context?.getString(R.string.str_out_am))
+        m.setRightText("985.25")
+        m.setLeftPadding(paddingLeft)
+        list?.add(m)
+
+        m = CostInfoData()
+        m.setLeftText(context?.getString(R.string.str_rate_of_use))
+        m.setRightText("10.5%")
+        m.setLeftPadding(paddingLeft)
+        list?.add(m)
+    }
+
+    /**
+     * 获取配置器。
+     */
+    fun getAdapter(): RecyclerView.Adapter<CostInfoAdapter.CostInfoHolder> {
+        return CostInfoAdapter(context, list)
+    }
+
+    /**
+     * 通用的适配器。
+     */
+    class CostInfoAdapter(context: Context?, list: ArrayList<CostInfoData>?) : RecyclerView.Adapter<CostInfoAdapter.CostInfoHolder>() {
+        private var list: ArrayList<CostInfoData>? = null
+        private var inflater: LayoutInflater? = null
+        private var context: Context? = null
+        init {
+            this.list = list
+            this.inflater = LayoutInflater.from(context)
+            this.context = context
+        }
+
+        override fun getItemCount(): Int {
+            return list?.size ?: 0
+        }
+
+        class CostInfoHolder(itemView: View?) : RecyclerView.ViewHolder(itemView!!) {
+            var detailItem = itemView?.findViewById<DetailItem>(R.id.id_item)
+        }
+
+        override fun onBindViewHolder(holder: CostInfoHolder, position: Int) {
+            holder.detailItem?.setLeftText(list?.get(position)?.getLeftText().toString())
+            holder.detailItem?.setRightText(list?.get(position)?.getRightText().toString())
+            list?.get(position)?.getLeftPadding()?.let { holder.detailItem?.setRightValuePadding(it) }
+            holder.detailItem?.showLine(true)
+        }
+
+        override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): CostInfoHolder {
+            return CostInfoHolder(inflater?.inflate(R.layout.cost_info_item, parent, false))
+        }
+
+    }
 }

+ 283 - 39
RMA/app/src/main/res/layout/cost_info.xml

@@ -1,45 +1,289 @@
 <?xml version="1.0" encoding="utf-8"?>
-<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
+<androidx.constraintlayout.widget.ConstraintLayout
+    xmlns:android="http://schemas.android.com/apk/res/android"
+    xmlns:tools="http://schemas.android.com/tools"
     android:layout_width="match_parent"
     xmlns:app="http://schemas.android.com/apk/res-auto"
-    android:padding="15dp"
-    android:layout_height="match_parent">
-<!--币种-->
-    <TextView
-        android:layout_width="wrap_content"
+    android:paddingTop="15dp"
+    android:paddingStart="15dp"
+    android:paddingBottom="15dp"
+    android:layout_height="match_parent"
+    tools:ignore="RtlSymmetry">
+    <androidx.recyclerview.widget.RecyclerView
+        android:layout_width="match_parent"
         app:layout_constraintTop_toTopOf="parent"
-        app:layout_constraintStart_toStartOf="parent"
-        android:id="@+id/id_currency_title"
-        style="@style/CostTitleTextStyle"
-        android:text="@string/str_currency"
-        android:layout_height="wrap_content"/>
-    <TextView
-        android:layout_width="wrap_content"
-        android:text="@string/str_markets"
-        app:layout_constraintTop_toTopOf="@+id/id_currency_title"
-        app:layout_constraintStart_toEndOf="@+id/id_rate_of_use_title"
-        style="@style/CostValueTextStyle"
-        android:layout_height="wrap_content"/>
-
-
-<!--    资金使用率-->
-    <TextView
-        android:layout_width="wrap_content"
-        app:layout_constraintStart_toStartOf="parent"
-        android:id="@+id/id_rate_of_use_title"
-        style="@style/CostTitleTextStyle"
-        android:text="@string/str_rate_of_use"
-        app:layout_constraintBottom_toBottomOf="parent"
-        android:layout_height="wrap_content"/>
-    <TextView
-        android:layout_width="wrap_content"
-        android:text="@string/str_markets"
-        app:layout_constraintTop_toTopOf="@+id/id_rate_of_use_title"
-        android:id="@+id/id_rate_of_use"
-        android:layout_marginStart="20dp"
-        app:layout_constraintStart_toEndOf="@+id/id_rate_of_use_title"
-        style="@style/CostValueTextStyle"
-        app:layout_constraintBottom_toBottomOf="parent"
-        android:layout_height="wrap_content"/>
+        android:id="@+id/id_cost_info_list"
+        android:layout_height="match_parent"/>
+<!--    <cn.muchinfo.rma.view.autoWidget.DetailItem-->
+<!--        android:layout_width="match_parent"-->
+<!--        app:layout_constraintTop_toBottomOf="@+id/line9"-->
+<!--        android:id="@+id/dddd"-->
+<!--        app:dt_rightText="asdasd"-->
+<!--        app:dt_leftPadding="88dp"-->
+<!--        android:layout_height="wrap_content"/>-->
+<!--&lt;!&ndash;币种&ndash;&gt;-->
+<!--    <TextView-->
+<!--        android:layout_width="wrap_content"-->
+<!--        app:layout_constraintStart_toStartOf="parent"-->
+<!--        android:id="@+id/id_currency_title"-->
+<!--        android:layout_marginTop="15dp"-->
+<!--        style="@style/CostTitleTextStyle"-->
+<!--        android:text="@string/str_currency"-->
+<!--        app:layout_constraintTop_toBottomOf="@+id/dddd"-->
+<!--        android:layout_height="wrap_content"/>-->
+<!--    <TextView-->
+<!--        android:layout_width="wrap_content"-->
+<!--        android:text="1000.0"-->
+<!--        android:layout_marginStart="20dp"-->
+<!--        app:layout_constraintTop_toTopOf="@+id/id_currency_title"-->
+<!--        app:layout_constraintStart_toEndOf="@+id/id_rate_of_use_title"-->
+<!--        style="@style/CostValueTextStyle"-->
+<!--        android:layout_height="wrap_content"/>-->
 
+<!--    <include-->
+<!--        layout="@layout/line_view"-->
+<!--        android:id="@+id/line0"-->
+<!--        android:layout_width="match_parent"-->
+<!--        android:layout_height="0.1dp"-->
+<!--        android:layout_marginTop="15dp"-->
+<!--        app:layout_constraintTop_toBottomOf="@+id/id_currency_title"/>-->
+
+
+<!--    &lt;!&ndash;当前权益&ndash;&gt;-->
+<!--    <TextView-->
+<!--        android:layout_width="wrap_content"-->
+<!--        app:layout_constraintStart_toStartOf="parent"-->
+<!--        android:id="@+id/id_current_equity"-->
+<!--        style="@style/CostTitleTextStyle"-->
+<!--        app:layout_constraintTop_toBottomOf="@+id/line0"-->
+<!--        android:layout_marginTop="15dp"-->
+<!--        android:text="@string/str_current_equity"-->
+<!--        android:layout_height="wrap_content"/>-->
+<!--    <TextView-->
+<!--        android:layout_width="wrap_content"-->
+<!--        android:text="1000.0"-->
+<!--        android:layout_marginStart="20dp"-->
+<!--        app:layout_constraintTop_toTopOf="@+id/id_current_equity"-->
+<!--        app:layout_constraintStart_toEndOf="@+id/id_rate_of_use_title"-->
+<!--        style="@style/CostValueTextStyle"-->
+<!--        android:layout_height="wrap_content"/>-->
+
+<!--    <include-->
+<!--        layout="@layout/line_view"-->
+<!--        android:id="@+id/line1"-->
+<!--        android:layout_width="match_parent"-->
+<!--        android:layout_height="0.1dp"-->
+<!--        android:layout_marginTop="15dp"-->
+<!--        app:layout_constraintTop_toBottomOf="@+id/id_current_equity"/>-->
+<!--&lt;!&ndash;可用金额&ndash;&gt;-->
+
+<!--    <TextView-->
+<!--        android:layout_width="wrap_content"-->
+<!--        app:layout_constraintStart_toStartOf="parent"-->
+<!--        android:id="@+id/id_available_am"-->
+<!--        style="@style/CostTitleTextStyle"-->
+<!--        app:layout_constraintTop_toBottomOf="@+id/line1"-->
+<!--        android:layout_marginTop="15dp"-->
+<!--        android:text="@string/str_available_am"-->
+<!--        android:layout_height="wrap_content"/>-->
+<!--    <TextView-->
+<!--        android:layout_width="wrap_content"-->
+<!--        android:text="1000.0"-->
+<!--        android:layout_marginStart="20dp"-->
+<!--        app:layout_constraintTop_toTopOf="@+id/id_available_am"-->
+<!--        app:layout_constraintStart_toEndOf="@+id/id_rate_of_use_title"-->
+<!--        style="@style/CostValueTextStyle"-->
+<!--        android:layout_height="wrap_content"/>-->
+
+<!--    <include-->
+<!--        layout="@layout/line_view"-->
+<!--        android:id="@+id/line2"-->
+<!--        android:layout_width="match_parent"-->
+<!--        android:layout_height="0.1dp"-->
+<!--        android:layout_marginTop="15dp"-->
+<!--        app:layout_constraintTop_toBottomOf="@+id/id_available_am"/>-->
+
+<!--    &lt;!&ndash;占用资金&ndash;&gt;-->
+<!--    <TextView-->
+<!--        android:layout_width="wrap_content"-->
+<!--        app:layout_constraintStart_toStartOf="parent"-->
+<!--        android:id="@+id/id_occupation_amount"-->
+<!--        style="@style/CostTitleTextStyle"-->
+<!--        app:layout_constraintTop_toBottomOf="@+id/line2"-->
+<!--        android:layout_marginTop="15dp"-->
+<!--        android:text="@string/str_occupation_amount"-->
+<!--        android:layout_height="wrap_content"/>-->
+<!--    <TextView-->
+<!--        android:layout_width="wrap_content"-->
+<!--        android:text="1000.0"-->
+<!--        android:layout_marginStart="20dp"-->
+<!--        app:layout_constraintTop_toTopOf="@+id/id_occupation_amount"-->
+<!--        app:layout_constraintStart_toEndOf="@+id/id_rate_of_use_title"-->
+<!--        style="@style/CostValueTextStyle"-->
+<!--        android:layout_height="wrap_content"/>-->
+<!--    <include-->
+<!--        layout="@layout/line_view"-->
+<!--        android:id="@+id/line3"-->
+<!--        android:layout_width="match_parent"-->
+<!--        android:layout_height="0.1dp"-->
+<!--        android:layout_marginTop="15dp"-->
+<!--        app:layout_constraintTop_toBottomOf="@+id/id_occupation_amount"/>-->
+
+<!--    &lt;!&ndash;冻结金额&ndash;&gt;-->
+<!--    <TextView-->
+<!--        android:layout_width="wrap_content"-->
+<!--        app:layout_constraintStart_toStartOf="parent"-->
+<!--        android:id="@+id/id_freezing_of_funds"-->
+<!--        style="@style/CostTitleTextStyle"-->
+<!--        app:layout_constraintTop_toBottomOf="@+id/line3"-->
+<!--        android:layout_marginTop="15dp"-->
+<!--        android:text="@string/str_freezing_of_funds"-->
+<!--        android:layout_height="wrap_content"/>-->
+<!--    <TextView-->
+<!--        android:layout_width="wrap_content"-->
+<!--        android:text="1000.0"-->
+<!--        android:layout_marginStart="20dp"-->
+<!--        app:layout_constraintTop_toTopOf="@+id/id_freezing_of_funds"-->
+<!--        app:layout_constraintStart_toEndOf="@+id/id_rate_of_use_title"-->
+<!--        style="@style/CostValueTextStyle"-->
+<!--        android:layout_height="wrap_content"/>-->
+<!--    <include-->
+<!--        layout="@layout/line_view"-->
+<!--        android:id="@+id/line4"-->
+<!--        android:layout_width="match_parent"-->
+<!--        android:layout_height="0.1dp"-->
+<!--        android:layout_marginTop="15dp"-->
+<!--        app:layout_constraintTop_toBottomOf="@+id/id_freezing_of_funds"/>-->
+
+<!--    &lt;!&ndash;持仓盈亏&ndash;&gt;-->
+<!--    <TextView-->
+<!--        android:layout_width="wrap_content"-->
+<!--        app:layout_constraintStart_toStartOf="parent"-->
+<!--        android:id="@+id/id_position_profit_loss"-->
+<!--        style="@style/CostTitleTextStyle"-->
+<!--        app:layout_constraintTop_toBottomOf="@+id/line4"-->
+<!--        android:layout_marginTop="15dp"-->
+<!--        android:text="@string/str_position_profit_loss"-->
+<!--        android:layout_height="wrap_content"/>-->
+<!--    <TextView-->
+<!--        android:layout_width="wrap_content"-->
+<!--        android:text="1000.0"-->
+<!--        android:layout_marginStart="20dp"-->
+<!--        app:layout_constraintTop_toTopOf="@+id/id_position_profit_loss"-->
+<!--        app:layout_constraintStart_toEndOf="@+id/id_rate_of_use_title"-->
+<!--        style="@style/CostValueTextStyle"-->
+<!--        android:layout_height="wrap_content"/>-->
+<!--    <include-->
+<!--        layout="@layout/line_view"-->
+<!--        android:id="@+id/line5"-->
+<!--        android:layout_width="match_parent"-->
+<!--        android:layout_height="0.1dp"-->
+<!--        android:layout_marginTop="15dp"-->
+<!--        app:layout_constraintTop_toBottomOf="@+id/id_position_profit_loss"/>-->
+
+<!--    &lt;!&ndash;平仓盈亏&ndash;&gt;-->
+<!--    <TextView-->
+<!--        android:layout_width="wrap_content"-->
+<!--        app:layout_constraintStart_toStartOf="parent"-->
+<!--        android:id="@+id/id_close_profit_loss"-->
+<!--        style="@style/CostTitleTextStyle"-->
+<!--        app:layout_constraintTop_toBottomOf="@+id/line5"-->
+<!--        android:layout_marginTop="15dp"-->
+<!--        android:text="@string/str_close_profit_loss"-->
+<!--        android:layout_height="wrap_content"/>-->
+<!--    <TextView-->
+<!--        android:layout_width="wrap_content"-->
+<!--        android:text="1000.0"-->
+<!--        android:layout_marginStart="20dp"-->
+<!--        app:layout_constraintTop_toTopOf="@+id/id_close_profit_loss"-->
+<!--        app:layout_constraintStart_toEndOf="@+id/id_rate_of_use_title"-->
+<!--        style="@style/CostValueTextStyle"-->
+<!--        android:layout_height="wrap_content"/>-->
+<!--    <include-->
+<!--        layout="@layout/line_view"-->
+<!--        android:id="@+id/line6"-->
+<!--        android:layout_width="match_parent"-->
+<!--        android:layout_height="0.1dp"-->
+<!--        android:layout_marginTop="15dp"-->
+<!--        app:layout_constraintTop_toBottomOf="@+id/id_close_profit_loss"/>-->
+
+<!--    &lt;!&ndash;入金&ndash;&gt;-->
+<!--    <TextView-->
+<!--        android:layout_width="wrap_content"-->
+<!--        app:layout_constraintStart_toStartOf="parent"-->
+<!--        android:id="@+id/id_in_am"-->
+<!--        style="@style/CostTitleTextStyle"-->
+<!--        app:layout_constraintTop_toBottomOf="@+id/line6"-->
+<!--        android:layout_marginTop="15dp"-->
+<!--        android:text="@string/str_in_am"-->
+<!--        android:layout_height="wrap_content"/>-->
+<!--    <TextView-->
+<!--        android:layout_width="wrap_content"-->
+<!--        android:text="1000.0"-->
+<!--        android:layout_marginStart="20dp"-->
+<!--        app:layout_constraintTop_toTopOf="@+id/id_in_am"-->
+<!--        app:layout_constraintStart_toEndOf="@+id/id_rate_of_use_title"-->
+<!--        style="@style/CostValueTextStyle"-->
+<!--        android:layout_height="wrap_content"/>-->
+<!--    <include-->
+<!--        layout="@layout/line_view"-->
+<!--        android:id="@+id/line7"-->
+<!--        android:layout_width="match_parent"-->
+<!--        android:layout_height="0.1dp"-->
+<!--        android:layout_marginTop="15dp"-->
+<!--        app:layout_constraintTop_toBottomOf="@+id/id_in_am"/>-->
+
+<!--    &lt;!&ndash;出金&ndash;&gt;-->
+<!--    <TextView-->
+<!--        android:layout_width="wrap_content"-->
+<!--        app:layout_constraintStart_toStartOf="parent"-->
+<!--        android:id="@+id/id_out_am"-->
+<!--        style="@style/CostTitleTextStyle"-->
+<!--        app:layout_constraintTop_toBottomOf="@+id/line7"-->
+<!--        android:layout_marginTop="15dp"-->
+<!--        android:text="@string/str_in_am"-->
+<!--        android:layout_height="wrap_content"/>-->
+<!--    <TextView-->
+<!--        android:layout_width="wrap_content"-->
+<!--        android:text="1000.0"-->
+<!--        android:layout_marginStart="20dp"-->
+<!--        app:layout_constraintTop_toTopOf="@+id/id_out_am"-->
+<!--        app:layout_constraintStart_toEndOf="@+id/id_rate_of_use_title"-->
+<!--        style="@style/CostValueTextStyle"-->
+<!--        android:layout_height="wrap_content"/>-->
+<!--    <include-->
+<!--        layout="@layout/line_view"-->
+<!--        android:id="@+id/line8"-->
+<!--        android:layout_width="match_parent"-->
+<!--        android:layout_height="0.1dp"-->
+<!--        android:layout_marginTop="15dp"-->
+<!--        app:layout_constraintTop_toBottomOf="@+id/id_out_am"/>-->
+
+<!--    &lt;!&ndash;    资金使用率&ndash;&gt;-->
+<!--    <TextView-->
+<!--        android:layout_width="wrap_content"-->
+<!--        app:layout_constraintStart_toStartOf="parent"-->
+<!--        android:id="@+id/id_rate_of_use_title"-->
+<!--        style="@style/CostTitleTextStyle"-->
+<!--        android:layout_marginTop="15dp"-->
+<!--        android:text="@string/str_rate_of_use"-->
+<!--        app:layout_constraintTop_toBottomOf="@+id/line8"-->
+<!--        android:layout_height="wrap_content"/>-->
+<!--    <TextView-->
+<!--        android:layout_width="wrap_content"-->
+<!--        android:text="1000.0"-->
+<!--        app:layout_constraintTop_toTopOf="@+id/id_rate_of_use_title"-->
+<!--        android:id="@+id/id_rate_of_use"-->
+<!--        android:layout_marginStart="20dp"-->
+<!--        app:layout_constraintStart_toEndOf="@+id/id_rate_of_use_title"-->
+<!--        style="@style/CostValueTextStyle"-->
+<!--        android:layout_height="wrap_content"/>-->
+<!--    <include-->
+<!--        layout="@layout/line_view"-->
+<!--        android:id="@+id/line9"-->
+<!--        android:layout_width="match_parent"-->
+<!--        android:layout_height="0.1dp"-->
+<!--        android:layout_marginTop="15dp"-->
+<!--        app:layout_constraintTop_toBottomOf="@+id/id_rate_of_use_title"/>-->
+<!--    -->
 </androidx.constraintlayout.widget.ConstraintLayout>

+ 12 - 0
RMA/app/src/main/res/layout/cost_info_item.xml

@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="utf-8"?>
+<androidx.constraintlayout.widget.ConstraintLayout
+    android:layout_width="match_parent"
+    android:layout_height="wrap_content"
+    xmlns:android="http://schemas.android.com/apk/res/android"
+    xmlns:app="http://schemas.android.com/apk/res-auto">
+    <cn.muchinfo.rma.view.autoWidget.DetailItem
+        android:id="@+id/id_item"
+        app:layout_constraintTop_toTopOf="parent"
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"/>
+</androidx.constraintlayout.widget.ConstraintLayout>

+ 33 - 0
RMA/app/src/main/res/layout/detail_item.xml

@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="utf-8"?>
+<androidx.constraintlayout.widget.ConstraintLayout
+    xmlns:android="http://schemas.android.com/apk/res/android"
+    android:layout_width="match_parent"
+    android:layout_height="match_parent"
+    xmlns:app="http://schemas.android.com/apk/res-auto">
+
+    <TextView
+        android:layout_width="wrap_content"
+        app:layout_constraintTop_toTopOf="parent"
+        app:layout_constraintStart_toStartOf="parent"
+        android:id="@+id/id_title"
+        style="@style/CostTitleTextStyle"
+        android:padding="15dp"
+        android:text="@string/str_currency"
+        android:layout_height="wrap_content"/>
+    <TextView
+        android:layout_width="wrap_content"
+        android:text="@string/str_markets"
+        android:id="@+id/id_value"
+        app:layout_constraintTop_toTopOf="@+id/id_title"
+        app:layout_constraintBottom_toBottomOf="@+id/id_title"
+        app:layout_constraintStart_toStartOf="parent"
+        style="@style/CostValueTextStyle"
+        android:layout_height="wrap_content"/>
+
+    <include
+        layout="@layout/line_view"
+        android:id="@+id/id_line"
+        android:layout_width="match_parent"
+        android:layout_height="0.1dp"
+        app:layout_constraintTop_toBottomOf="@+id/id_title"/>
+</androidx.constraintlayout.widget.ConstraintLayout>

+ 13 - 0
RMA/app/src/main/res/values/attrs.xml

@@ -68,4 +68,17 @@
 <!--        光标宽度-->
         <attr name="cti_IndicatorWidth" format="integer"/>
     </declare-styleable>
+
+<!--    详情的自定义格式的item-->
+    <declare-styleable name="DetailItem">
+        <!-- left text -->
+        <attr name="dt_LeftText" format="string"/>
+        <!-- right text -->
+        <attr name="dt_rightText" format="string"/>
+        <!-- left Padding -->
+        <attr name="dt_leftPadding" format="dimension"/>
+        <!-- show Line -->
+        <attr name="dt_showLine" format="boolean"/>
+
+    </declare-styleable>
 </resources>

+ 8 - 0
RMA/app/src/main/res/values/strings.xml

@@ -88,6 +88,14 @@
     <string name="str_deal_name_type">名称\n类型</string>
     <string name="str_deal_num_price">成交数量\n价格</string>
     <string name="str_currency">币种</string>
+    <string name="str_current_equity">当前权益</string>
+    <string name="str_available_am">可用金额</string>
+    <string name="str_occupation_amount">占用金额</string>
+    <string name="str_freezing_of_funds">冻结金额</string>
+    <string name="str_position_profit_loss">持仓盈亏</string>
+    <string name="str_close_profit_loss">平仓盈亏</string>
+    <string name="str_in_am">入金</string>
+    <string name="str_out_am">出金</string>
     <string name="str_rate_of_use">资金使用率</string>
 
 </resources>