ProGo пре 4 година
родитељ
комит
def5ac832b

+ 9 - 14
RMA/app/src/main/java/cn/muchinfo/rma/view/base/future/holds/HoldViewModel.kt

@@ -67,31 +67,26 @@ class HoldViewModel : BaseViewModel() {
         }
 
         inner class HoldHolder(itemView: View?) : RecyclerView.ViewHolder(itemView!!) {
-            var idGoodsName = itemView?.findViewById<TextView>(R.id.id_goods_name)
-            var idTransDirection = itemView?.findViewById<TextView>(R.id.id_trans_direction)
-            var idAvailable = itemView?.findViewById<TextView>(R.id.id_available)
-            var idHoldTotal = itemView?.findViewById<TextView>(R.id.id_hold_total)
-            var idLastPrice = itemView?.findViewById<TextView>(R.id.id_last_price)
-            var idCost = itemView?.findViewById<TextView>(R.id.id_cost)
-            var idPl = itemView?.findViewById<TextView>(R.id.id_pl)
-            var idPlp = itemView?.findViewById<TextView>(R.id.id_plp)
-
+            var idGoodsName = itemView?.findViewById<TextView>(R.id.id_goods_name) // 商品名称
+            var idTransDirection = itemView?.findViewById<TextView>(R.id.id_trans_direction) // 方向
+            var idAvailable = itemView?.findViewById<TextView>(R.id.id_available) // 可用
+            var idHoldTotal = itemView?.findViewById<TextView>(R.id.id_hold_total) // 持仓
+            var idOpenAveragePrice = itemView?.findViewById<TextView>(R.id.id_open_average_price) // 开仓均价
+            var idHoldAveragePrice = itemView?.findViewById<TextView>(R.id.id_hold_average_price) // 持仓均价
+            var idZPl = itemView?.findViewById<TextView>(R.id.id_zpl) // 盯市浮盈
+            var idPlp = itemView?.findViewById<TextView>(R.id.id_plp) // 盈亏比例
+            var idMargin = itemView?.findViewById<TextView>(R.id.id_margin) // 保证金
         }
 
         override fun onBindViewHolder(holder: HoldHolder, position: Int) {
             holder.idGoodsName?.text = list?.get(position)?.goodsname
             holder.idAvailable?.text = list?.get(position)?.enableqty.toString() // 可用(总仓可用)
             holder.idHoldTotal?.text = list?.get(position)?.curpositionqty.toString() // 持仓(总仓数量, 期末头寸)
-            holder.idLastPrice?.text = list?.get(position)?.last.toString() // 现价
-            holder.idCost?.text = list?.get(position)?.positioncost.toString() // 持仓成本
-//            holder.idPl?.text = list?.get(position)?.pl.toString() //
-//            holder.idPlp?.text = list?.get(position)?.plp.toString() // 持仓盈亏比例
             if (list?.get(position)?.buyorsell == 0) {
                 holder.idTransDirection?.text = context?.resources?.getString(R.string.str_buy)
             } else {
                 holder.idTransDirection?.text = context?.resources?.getString(R.string.str_sell)
             }
-
         }
 
         override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): HoldHolder {

+ 13 - 2
RMA/app/src/main/res/layout/hold_fragment.xml

@@ -41,12 +41,23 @@
     <TextView
         android:id="@+id/id_pl_plp"
         android:layout_width="0dp"
-        android:text="@string/str_pl_plp"
+        android:text="@string/str_zpl_plp"
         android:gravity="end"
+        android:paddingEnd="5dp"
         style="@style/HoldHeadTextStyle"
-        android:paddingEnd="15dp"
         app:layout_constraintTop_toTopOf="parent"
         app:layout_constraintStart_toEndOf="@+id/id_last_cost"
+        app:layout_constraintEnd_toStartOf="@+id/id_pl_margin"
+        android:layout_height="wrap_content"/>
+    <TextView
+        android:id="@+id/id_pl_margin"
+        android:layout_width="0dp"
+        android:text="@string/str_pl_margin"
+        android:gravity="end"
+        style="@style/HoldHeadTextStyle"
+        android:paddingEnd="15dp"
+        app:layout_constraintTop_toTopOf="parent"
+        app:layout_constraintStart_toEndOf="@+id/id_pl_plp"
         app:layout_constraintEnd_toEndOf="parent"
         android:layout_height="wrap_content"/>
 

+ 39 - 12
RMA/app/src/main/res/layout/hold_item.xml

@@ -4,6 +4,7 @@
     xmlns:app="http://schemas.android.com/apk/res-auto"
     android:padding="15dp"
     android:layout_height="wrap_content">
+<!--    名称-->
     <TextView
         android:layout_width="0dp"
         android:text="PTA1907"
@@ -13,6 +14,7 @@
         app:layout_constraintEnd_toStartOf="@+id/id_available"
         android:id="@+id/id_goods_name"
         android:layout_height="wrap_content"/>
+<!--    方向-->
     <TextView
         android:layout_width="wrap_content"
         app:layout_constraintTop_toBottomOf="@+id/id_goods_name"
@@ -21,6 +23,7 @@
         android:text="买"
         style="@style/ListSummaryTextStyle"
         android:layout_height="wrap_content"/>
+
 <!--可用-->
     <TextView
         android:layout_width="0dp"
@@ -31,55 +34,79 @@
         android:paddingEnd="20dp"
         app:layout_constraintTop_toTopOf="parent"
         app:layout_constraintStart_toEndOf="@+id/id_goods_name"
-        app:layout_constraintEnd_toStartOf="@+id/id_last_price"
+        app:layout_constraintEnd_toStartOf="@+id/id_open_average_price"
         android:layout_height="wrap_content"/>
 <!--    持仓-->
     <TextView
         android:layout_width="wrap_content"
         android:id="@+id/id_hold_total"
         app:layout_constraintEnd_toEndOf="@+id/id_available"
+        app:layout_constraintTop_toBottomOf="@+id/id_available"
         android:paddingEnd="20dp"
         android:text="50"
         style="@style/ListSummaryTextStyle"
-        app:layout_constraintTop_toBottomOf="@+id/id_available"
         android:layout_height="wrap_content"/>
 
-<!--    价-->
+<!--    开仓均价-->
     <TextView
         android:layout_width="0dp"
-        android:id="@+id/id_last_price"
+        android:id="@+id/id_open_average_price"
         android:paddingEnd="20dp"
         style="@style/ListTextStyle"
         app:layout_constraintTop_toTopOf="parent"
         app:layout_constraintStart_toEndOf="@+id/id_available"
-        app:layout_constraintEnd_toStartOf="@+id/id_pl"
+        app:layout_constraintEnd_toStartOf="@+id/id_zpl"
         android:text="5460"
         android:gravity="end"
         android:layout_height="wrap_content"/>
-<!--成本-->
+<!--持仓均价-->
     <TextView
         android:layout_width="wrap_content"
-        android:id="@+id/id_cost"
+        android:id="@+id/id_hold_average_price"
         android:paddingEnd="20dp"
         style="@style/ListSummaryTextStyle"
         android:text="5400"
-        app:layout_constraintEnd_toEndOf="@+id/id_last_price"
-        app:layout_constraintTop_toBottomOf="@+id/id_last_price"
+        app:layout_constraintEnd_toEndOf="@+id/id_open_average_price"
+        app:layout_constraintTop_toBottomOf="@+id/id_open_average_price"
+        android:layout_height="wrap_content"/>
+
+<!--    盯市浮盈-->
+    <TextView
+        android:layout_width="0dp"
+        app:layout_constraintTop_toTopOf="parent"
+        android:id="@+id/id_zpl"
+        android:text="100.00"
+        android:gravity="end"
+        android:paddingEnd="5dp"
+        app:layout_constraintStart_toEndOf="@+id/id_open_average_price"
+        app:layout_constraintEnd_toStartOf="@+id/id_pl"
+        android:layout_height="wrap_content"/>
+<!--盈亏比例-->
+    <TextView
+        android:layout_width="wrap_content"
+        android:id="@+id/id_plp"
+        style="@style/ListSummaryTextStyle"
+        android:text="5400"
+        android:paddingEnd="5dp"
+        app:layout_constraintEnd_toEndOf="@+id/id_zpl"
+        app:layout_constraintTop_toBottomOf="@+id/id_zpl"
         android:layout_height="wrap_content"/>
-<!--    pl-->
+
+<!--    逐笔浮盈-->
     <TextView
         android:layout_width="0dp"
         app:layout_constraintTop_toTopOf="parent"
         android:id="@+id/id_pl"
         android:text="100.00"
         android:gravity="end"
-        app:layout_constraintStart_toEndOf="@+id/id_last_price"
+        app:layout_constraintStart_toEndOf="@+id/id_zpl"
         app:layout_constraintEnd_toEndOf="parent"
         android:layout_height="wrap_content"/>
+<!--    保证金-->
     <TextView
         android:layout_width="wrap_content"
         android:gravity="end"
-        android:id="@+id/id_plp"
+        android:id="@+id/id_margin"
         app:layout_constraintEnd_toEndOf="parent"
         app:layout_constraintTop_toBottomOf="@+id/id_pl"
         android:text="10.3%"

+ 11 - 9
RMA/app/src/main/res/values/strings.xml

@@ -72,21 +72,21 @@
     <string name="str_list_head_price">价格</string>
     <string name="str_list_head_up_down">涨跌</string>
     <string name="str_list_head_hold_total">持仓量</string>
-    <string name="str_name_direction">名称\n方向</string>
-    <string name="str_available_hold">可用\n持仓</string>
-    <string name="str_last_cost">现价\n成本</string>
-    <string name="str_pl_plp">持仓盈亏\n盈亏比</string>
+    <string name="str_name_direction">名称/\n方向</string>
+    <string name="str_available_hold">可用/\n持仓</string>
+    <string name="str_last_cost">开仓均价/\n持仓均价</string>
+    <string name="str_pl_plp">持仓盈亏/\n盈亏比</string>
     <string name="str_buy">买</string>
     <string name="str_sell">卖</string>
     <string name="str_pl">持仓盈亏</string>
-    <string name="str_status_date">状态\n时间</string>
-    <string name="str_name_type">名称\n类型</string>
-    <string name="str_entrust_num">委托数量\n价格</string>
+    <string name="str_status_date">状态/\n时间</string>
+    <string name="str_name_type">名称/\n类型</string>
+    <string name="str_entrust_num">委托数量/\n价格</string>
     <string name="str_can_cancel_today">今日可撤</string>
     <string name="str_entrust_today">今日委托</string>
 
-    <string name="str_deal_name_type">名称\n类型</string>
-    <string name="str_deal_num_price">成交数量\n价格</string>
+    <string name="str_deal_name_type">名称/\n类型</string>
+    <string name="str_deal_num_price">成交数量/\n价格</string>
     <string name="str_deal_time">成交时间</string>
     <string name="str_currency">币种</string>
     <string name="str_current_equity">当前权益</string>
@@ -106,5 +106,7 @@
     <string name="str_none">无</string>
     <string name="str_close_today">平今</string>
     <string name="str_close_yesterday">平昨</string>
+    <string name="str_pl_margin">逐笔浮盈/\n保证金</string>
+    <string name="str_zpl_plp">盯市浮盈/\n盈亏比例</string>
 
 </resources>