]> git.ktnx.net Git - mobile-ledger.git/commitdiff
CardView!
authorDamyan Ivanov <dam+mobileledger@ktnx.net>
Fri, 21 Dec 2018 20:22:58 +0000 (20:22 +0000)
committerDamyan Ivanov <dam+mobileledger@ktnx.net>
Fri, 21 Dec 2018 20:22:58 +0000 (20:22 +0000)
app/src/main/java/net/ktnx/mobileledger/TransactionListAdapter.java
app/src/main/res/layout/transaction_list_row.xml

index 2e52093d57669744a7ae9fc9e52f8266ca2d3a94..e69aab7bf44ffaf728e226cefd265740a7986a8d 100644 (file)
@@ -125,7 +125,7 @@ class TransactionListAdapter
         ConstraintLayout row;
         public TransactionRowHolder(@NonNull View itemView) {
             super(itemView);
-            this.row = (ConstraintLayout) itemView;
+            this.row = itemView.findViewById(R.id.transaction_row);
             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 a9e6c9b7ca578025f971540d04d76d770bc83381..64b4fe7290baceaf6397467e437fabacf19ba9e9 100644 (file)
   ~ along with Mobile-Ledger. If not, see <https://www.gnu.org/licenses/>.
   -->
 
-<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
+<android.support.v7.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android"
     xmlns:app="http://schemas.android.com/apk/res-auto"
-    xmlns:tools="http://schemas.android.com/tools"
-    android:id="@+id/transaction_row"
     android:layout_width="match_parent"
     android:layout_height="wrap_content"
-    android:gravity="center_vertical"
-    android:minHeight="36dp"
-    android:orientation="horizontal"
-    android:paddingStart="8dp"
-    android:paddingEnd="8dp">
+    android:layout_margin="8dp"
+    app:cardCornerRadius="16dp"
+    app:cardElevation="4dp"
+    app:cardUseCompatPadding="false"
+    app:layout_constraintEnd_toEndOf="parent"
+    app:layout_constraintStart_toStartOf="parent"
+    app:layout_goneMarginBottom="8dp">
 
-    <!--android:button="@drawable/checkbox_star_black"-->
-
-    <LinearLayout
-        android:id="@+id/transaction_row_head"
-        android:layout_width="match_parent"
-        android:layout_height="wrap_content"
-        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_header_border"
+    <android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
+        xmlns:app="http://schemas.android.com/apk/res-auto"
+        xmlns:tools="http://schemas.android.com/tools"
+        android:id="@+id/transaction_row"
         android:layout_width="match_parent"
         android:layout_height="wrap_content"
-        android:background="@drawable/dashed_border_1dp"
-        android:minHeight="2dp"
+        android:gravity="center_vertical"
+        android:minHeight="36dp"
         android:orientation="horizontal"
-        app:layout_constraintEnd_toEndOf="parent"
-        app:layout_constraintStart_toStartOf="parent"
-        app:layout_constraintTop_toBottomOf="@+id/transaction_row_head" />
-
-    <LinearLayout
-        android:id="@+id/transaction_row_acc_amounts"
-        android:layout_width="match_parent"
-        android:layout_height="wrap_content"
-        android:layout_weight="5"
-        android:orientation="vertical"
-        app:layout_constraintEnd_toEndOf="parent"
-        app:layout_constraintStart_toStartOf="parent"
-        app:layout_constraintTop_toBottomOf="@+id/transaction_row_header_border">
+        android:padding="8dp">
 
         <LinearLayout
+            android:id="@+id/transaction_row_head"
             android:layout_width="match_parent"
             android:layout_height="wrap_content"
-            android:gravity="center_vertical"
             android:orientation="horizontal"
-            android:paddingStart="8dp"
-            android:paddingEnd="0dp">
+            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="Account name, a really long one. A very very very long one. It may even spawn on more than two lines -- three, four or more."
-                android:textAlignment="viewStart"
+                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"
-                android:minWidth="60dp"
-                android:text="123,45\n-14 678,90"
-                android:textAlignment="viewEnd"
-                tools:ignore="HardcodedText" />
+                app:layout_constraintEnd_toEndOf="parent" />
         </LinearLayout>
 
         <LinearLayout
+            android:id="@+id/transaction_row_header_border"
             android:layout_width="match_parent"
             android:layout_height="wrap_content"
-            android:gravity="center_vertical"
+            android:background="@drawable/dashed_border_1dp"
+            android:minHeight="2dp"
             android:orientation="horizontal"
-            android:paddingStart="8dp"
-            android:paddingEnd="0dp">
+            app:layout_constraintEnd_toEndOf="parent"
+            app:layout_constraintStart_toStartOf="parent"
+            app:layout_constraintTop_toBottomOf="@+id/transaction_row_head" />
 
-            <TextView
-                android:layout_width="0dp"
+        <LinearLayout
+            android:id="@+id/transaction_row_acc_amounts"
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:layout_weight="5"
+            android:orientation="vertical"
+            app:layout_constraintEnd_toEndOf="parent"
+            app:layout_constraintStart_toStartOf="parent"
+            app:layout_constraintTop_toBottomOf="@+id/transaction_row_header_border">
+
+            <LinearLayout
+                android:layout_width="match_parent"
                 android:layout_height="wrap_content"
-                android:layout_weight="5"
-                android:text="Account name, a really long one. A very very very long one. It may even spawn on more than two lines -- three, four or more."
-                android:textAlignment="viewStart"
-                tools:ignore="HardcodedText" />
+                android:gravity="center_vertical"
+                android:orientation="horizontal"
+                android:paddingStart="8dp"
+                android:paddingEnd="0dp">
 
-            <TextView
-                android:layout_width="wrap_content"
+                <TextView
+                    android:layout_width="0dp"
+                    android:layout_height="wrap_content"
+                    android:layout_weight="5"
+                    android:text="Account name, a really long one. A very very very long one. It may even spawn on more than two lines -- three, four or more."
+                    android:textAlignment="viewStart"
+                    tools:ignore="HardcodedText" />
+
+                <TextView
+                    android:layout_width="wrap_content"
+                    android:layout_height="wrap_content"
+                    android:layout_marginEnd="0dp"
+                    android:minWidth="60dp"
+                    android:text="€ 123,45"
+                    android:textAlignment="viewEnd"
+                    tools:ignore="HardcodedText" />
+            </LinearLayout>
+
+            <LinearLayout
+                android:layout_width="match_parent"
                 android:layout_height="wrap_content"
-                android:layout_marginEnd="0dp"
-                android:minWidth="60dp"
-                android:text="123,45\n-14 678,90"
-                android:textAlignment="viewEnd"
-                tools:ignore="HardcodedText" />
+                android:gravity="center_vertical"
+                android:orientation="horizontal"
+                android:paddingStart="8dp"
+                android:paddingEnd="0dp">
+
+                <TextView
+                    android:layout_width="0dp"
+                    android:layout_height="wrap_content"
+                    android:layout_weight="5"
+                    android:text="Account name, a really long one. A very very very long one. It may even spawn on more than two lines -- three, four or more."
+                    android:textAlignment="viewStart"
+                    tools:ignore="HardcodedText" />
+
+                <TextView
+                    android:layout_width="wrap_content"
+                    android:layout_height="wrap_content"
+                    android:layout_marginEnd="0dp"
+                    android:minWidth="60dp"
+                    android:text="-14 678,90"
+                    android:textAlignment="viewEnd"
+                    tools:ignore="HardcodedText" />
+            </LinearLayout>
         </LinearLayout>
-    </LinearLayout>
-</android.support.constraint.ConstraintLayout>
\ No newline at end of file
+
+    </android.support.constraint.ConstraintLayout>
+</android.support.v7.widget.CardView>