separate view for transaction date, bold description
authorDamyan Ivanov <dam+mobileledger@ktnx.net>
Fri, 21 Dec 2018 18:50:44 +0000 (18:50 +0000)
committerDamyan Ivanov <dam+mobileledger@ktnx.net>
Fri, 21 Dec 2018 18:50:44 +0000 (18:50 +0000)
app/src/main/java/net/ktnx/mobileledger/TransactionListAdapter.java
app/src/main/res/layout/transaction_list_row.xml

index 65ef6db63b7da1fd4d5df2bbfa3b3a9716fa40d3..a6842e27b4f5a5e40e77f4cf69dcceeddb755bd6 100644 (file)
@@ -53,8 +53,8 @@ class TransactionListAdapter
 
         try (SQLiteDatabase db = MLDB.getReadableDatabase(ctx)) {
             tr.loadData(db);
-            holder.tvDescription
-                    .setText(String.format("%s\t%s", tr.getDescription(), tr.getDate()));
+            holder.tvDescription.setText(tr.getDescription());
+            holder.tvDate.setText(tr.getDate());
 
             int rowIndex = 0;
             for (LedgerTransactionAccount acc : tr.getAccounts()) {
@@ -120,13 +120,14 @@ class TransactionListAdapter
         return transactions.size();
     }
     class TransactionRowHolder extends RecyclerView.ViewHolder {
-        TextView tvDescription;
+        TextView tvDescription, tvDate;
         LinearLayout tableAccounts;
         ConstraintLayout row;
         public TransactionRowHolder(@NonNull View itemView) {
             super(itemView);
             this.row = (ConstraintLayout) itemView;
             this.tvDescription = itemView.findViewById(R.id.transaction_row_description);
+            this.tvDate = itemView.findViewById(R.id.transaction_row_date);
             this.tableAccounts = itemView.findViewById(R.id.transaction_row_acc_amounts);
         }
     }
index e35c331ba16276b569c3366c962e2c45bc2ae167..692e554b90772ed14b6b11717428610fc34dd670 100644 (file)
 
     <!--android:button="@drawable/checkbox_star_black"-->
 
-    <TextView
-        android:id="@+id/transaction_row_description"
-        style="@style/account_summary_account_name"
-        android:layout_width="0dp"
+    <LinearLayout
+        android:id="@+id/transaction_row_head"
+        android:layout_width="match_parent"
         android:layout_height="wrap_content"
-        android:layout_weight="5"
-        android:text="Sample description goes here."
-        tools:ignore="HardcodedText" />
+        android:orientation="horizontal"
+        app:layout_constraintEnd_toEndOf="parent"
+        app:layout_constraintStart_toStartOf="parent">
+
+        <TextView
+            android:id="@+id/transaction_row_description"
+            style="@style/account_summary_account_name"
+            android:layout_width="0dp"
+            android:layout_height="wrap_content"
+            android:layout_weight="5"
+            android:text="Sample description goes here."
+            android:textStyle="bold"
+            tools:ignore="HardcodedText" />
+
+        <TextView
+            android:id="@+id/transaction_row_date"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:layout_marginEnd="0dp"
+            app:layout_constraintEnd_toEndOf="parent" />
+    </LinearLayout>
 
     <LinearLayout
         android:id="@+id/transaction_row_acc_amounts"