]> git.ktnx.net Git - mobile-ledger.git/commitdiff
improve account list with Flow helper widget
authorDamyan Ivanov <dam+mobileledger@ktnx.net>
Sat, 8 May 2021 19:33:11 +0000 (22:33 +0300)
committerDamyan Ivanov <dam+mobileledger@ktnx.net>
Sat, 8 May 2021 19:33:11 +0000 (22:33 +0300)
makes a difference with very deep account trees and/or long commodities
or big amounts and small screen or big font

app/src/main/java/net/ktnx/mobileledger/ui/account_summary/AccountSummaryAdapter.java
app/src/main/res/layout/account_list_row.xml

index 6b8d0930f4920d10edfd62f7ec2e9df70a4faac2..2887058f23abc8ecd235461789e52d01e5a4621d 100644 (file)
@@ -322,7 +322,7 @@ public class AccountSummaryAdapter extends RecyclerView.Adapter<AccountSummaryAd
 
             if (changes.has(Change.LEVEL)) {
                 ConstraintLayout.LayoutParams lp =
-                        (ConstraintLayout.LayoutParams) b.accountNameLayout.getLayoutParams();
+                        (ConstraintLayout.LayoutParams) b.flowWrapper.getLayoutParams();
                 lp.setMarginStart(
                         acc.getLevel() * rm.getDimensionPixelSize(R.dimen.thumb_row_height) / 3);
             }
index 2add4b7c3a5ffbdeff451aec0b2432207b7badc0..a11d39b832b5010e20d04fad15adab5c40898f91 100644 (file)
     android:layout_height="wrap_content"
     android:animateLayoutChanges="true"
     android:longClickable="true"
+    android:minHeight="@dimen/default_account_row_height"
     >
     <androidx.constraintlayout.widget.ConstraintLayout
         android:id="@+id/account_name_layout"
-        android:layout_width="0dp"
+        android:layout_width="wrap_content"
         android:layout_height="wrap_content"
-        app:layout_constraintEnd_toStartOf="@+id/account_row_acc_amounts"
         app:layout_constraintHorizontal_chainStyle="spread_inside"
-        app:layout_constraintHorizontal_weight="3"
-        app:layout_constraintStart_toStartOf="parent"
-        app:layout_constraintTop_toTopOf="parent"
+
         >
         <TextView
             android:id="@+id/account_row_acc_name"
             android:layout_marginStart="8dp"
             android:gravity="center_vertical"
             android:longClickable="true"
-            android:minHeight="@dimen/default_account_row_height"
             android:paddingStart="8dp"
             android:text="AccountName"
             android:textAppearance="@android:style/TextAppearance.Material.Medium"
             app:layout_constrainedWidth="true"
+            app:layout_constraintBottom_toBottomOf="parent"
             app:layout_constraintEnd_toStartOf="@id/account_expander_container"
             app:layout_constraintHorizontal_bias="0.0"
             app:layout_constraintHorizontal_chainStyle="packed"
             app:layout_constraintStart_toStartOf="parent"
             app:layout_constraintTop_toTopOf="parent"
-            app:layout_constraintWidth_max="wrap"
-            app:layout_constraintWidth_percent=".67"
             tools:ignore="HardcodedText"
             />
 
     <TextView
         android:id="@+id/account_row_acc_amounts"
         style="@style/account_summary_amounts"
-        android:layout_width="0dp"
+        android:layout_width="wrap_content"
         android:layout_height="wrap_content"
         android:layout_marginStart="12dp"
         android:layout_marginEnd="8dp"
         android:gravity="center_vertical"
-        android:minHeight="@dimen/default_account_row_height"
         android:text="USD 123,45\n678,90\nIRAUSD -17 000.00"
         android:textAppearance="@style/TextAppearance.AppCompat.Medium"
         app:layout_constrainedWidth="true"
-        app:layout_constraintBottom_toBottomOf="parent"
-        app:layout_constraintEnd_toEndOf="parent"
-        app:layout_constraintHorizontal_weight="2"
-        app:layout_constraintStart_toEndOf="@id/account_name_layout"
-        app:layout_constraintTop_toTopOf="parent"
         app:layout_constraintWidth_min="90sp"
         tools:ignore="HardcodedText"
         />
         app:layout_constraintBottom_toBottomOf="@id/account_row_acc_amounts"
         app:layout_constraintEnd_toEndOf="@id/account_row_acc_amounts"
         app:layout_constraintStart_toStartOf="@id/account_row_acc_amounts"
-        >
-
-    </FrameLayout>
+        />
+    <androidx.constraintlayout.helper.widget.Flow
+        android:id="@+id/flow_wrapper"
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:minHeight="@dimen/default_account_row_height"
+        app:constraint_referenced_ids="account_name_layout,account_row_acc_amounts"
+        app:flow_firstHorizontalBias="0"
+        app:flow_firstHorizontalStyle="spread_inside"
+        app:flow_horizontalBias="1"
+        app:flow_verticalStyle="spread_inside"
+        app:flow_wrapMode="chain"
+        app:layout_constraintBottom_toBottomOf="parent"
+        app:layout_constraintStart_toStartOf="parent"
+        app:layout_constraintTop_toTopOf="parent"
+        />
 </androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file