]> git.ktnx.net Git - mobile-ledger.git/commitdiff
more material transaction list layout
authorDamyan Ivanov <dam+mobileledger@ktnx.net>
Sun, 14 Jun 2020 11:38:40 +0000 (14:38 +0300)
committerDamyan Ivanov <dam+mobileledger@ktnx.net>
Tue, 16 Jun 2020 05:23:36 +0000 (05:23 +0000)
card views no longer use alternate background color

day/month indicators are less intrusive while still visible enough

app/src/main/java/net/ktnx/mobileledger/ui/transaction_list/TransactionListAdapter.java
app/src/main/java/net/ktnx/mobileledger/ui/transaction_list/TransactionRowHolder.java
app/src/main/res/layout/transaction_list_row.xml

index 3946474f35bd245a3079d5e704b713a45a895073..35e68e59d733fa5062fe702333b23f216448dd20 100644 (file)
@@ -97,14 +97,12 @@ public class TransactionListAdapter extends RecyclerView.Adapter<TransactionRowH
                     holder.tvDelimiterMonth.setVisibility(View.VISIBLE);
                     //                holder.vDelimiterLine.setBackgroundResource(R.drawable
                     //                .dashed_border_8dp);
-                    holder.vDelimiterLine.setVisibility(View.GONE);
                     holder.vDelimiterThick.setVisibility(View.VISIBLE);
                 }
                 else {
                     holder.tvDelimiterMonth.setVisibility(View.GONE);
                     //                holder.vDelimiterLine.setBackgroundResource(R.drawable
                     //                .dashed_border_1dp);
-                    holder.vDelimiterLine.setVisibility(View.VISIBLE);
                     holder.vDelimiterThick.setVisibility(View.GONE);
                 }
                 break;
index 1bd6fd369a7c240aecdce61fea7b2d2fe3f737f1..93ff0edc88722684beac0b65f5545d8780e7abde 100644 (file)
@@ -36,7 +36,7 @@ class TransactionRowHolder extends RecyclerView.ViewHolder {
     ConstraintLayout vDelimiter;
     CardView vTransaction;
     TextView tvDelimiterMonth, tvDelimiterDate;
-    View vDelimiterLine, vDelimiterThick;
+    View vDelimiterThick;
     public TransactionRowHolder(@NonNull View itemView) {
         super(itemView);
         this.row = itemView.findViewById(R.id.transaction_row);
@@ -47,7 +47,6 @@ class TransactionRowHolder extends RecyclerView.ViewHolder {
         this.vTransaction = itemView.findViewById(R.id.transaction_card_view);
         this.tvDelimiterDate = itemView.findViewById(R.id.transaction_delimiter_date);
         this.tvDelimiterMonth = itemView.findViewById(R.id.transaction_delimiter_month);
-        this.vDelimiterLine = itemView.findViewById(R.id.transaction_delimiter_line);
         this.vDelimiterThick = itemView.findViewById(R.id.transaction_delimiter_thick);
     }
 }
index 952012109a42ad42ada326550948523affe0fcd3..e2d0013287a2782bbd9a32089acac8b2de0f9ef8 100644 (file)
     android:layout_width="match_parent"
     android:layout_height="wrap_content">
 
-    <androidx.cardview.widget.CardView
+    <com.google.android.material.card.MaterialCardView
         android:id="@+id/transaction_card_view"
+        style="@style/Widget.MaterialComponents.CardView"
         android:layout_width="match_parent"
         android:layout_height="wrap_content"
-        android:layout_margin="8dp"
+        android:layout_marginHorizontal="@dimen/activity_horizontal_margin"
+        android:layout_marginVertical="1dp"
         android:visibility="visible"
-        app:cardCornerRadius="16dp"
-        app:cardElevation="4dp"
-        app:cardUseCompatPadding="false">
+        app:cardCornerRadius="4dp"
+        app:cardElevation="2dp"
+        app:cardUseCompatPadding="false"
+        >
 
         <androidx.constraintlayout.widget.ConstraintLayout
             android:id="@+id/transaction_row"
                     />
             </LinearLayout>
 
-            <View
-                android:id="@+id/transaction_row_header_border"
-                android:layout_width="match_parent"
-                android:layout_height="2dp"
-                android:alpha="0.3"
-                android:background="@drawable/dashed_border_1dp"
-                android:height="2dp"
-                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_marginTop="8dp"
                 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">
+                app:layout_constraintTop_toBottomOf="@+id/transaction_row_head"
+                >
 
                 <include layout="@layout/transaction_list_row_accounts_table_row"/>
                 <include layout="@layout/transaction_list_row_accounts_table_row"/>
@@ -99,7 +93,7 @@
             </LinearLayout>
 
         </androidx.constraintlayout.widget.ConstraintLayout>
-    </androidx.cardview.widget.CardView>
+    </com.google.android.material.card.MaterialCardView>
 
     <androidx.constraintlayout.widget.ConstraintLayout
         android:id="@+id/transaction_delimiter"
             android:id="@+id/transaction_delimiter_month"
             android:layout_width="wrap_content"
             android:layout_height="match_parent"
-            android:background="?colorPrimary"
-            android:paddingStart="4dp"
-            android:paddingEnd="4dp"
+            android:layout_marginHorizontal="4dp"
             android:text="---------"
-            android:textColor="?android:attr/colorBackground"
+            android:textColor="?colorPrimary"
             android:textStyle="bold"
-            app:layout_constraintStart_toStartOf="parent"
+            app:layout_constraintEnd_toEndOf="parent"
             tools:ignore="HardcodedText" />
 
         <TextView
             android:id="@+id/transaction_delimiter_date"
             android:layout_width="wrap_content"
             android:layout_height="match_parent"
-            android:background="?colorPrimary"
-            android:paddingStart="4dp"
-            android:paddingEnd="4dp"
+            android:layout_marginHorizontal="4dp"
             android:text="--.--.----"
-            android:textColor="?android:attr/colorBackground"
+            android:textColor="?colorPrimary"
             android:textStyle="bold"
-            app:layout_constraintEnd_toEndOf="parent"
+            app:layout_constraintStart_toStartOf="parent"
             tools:ignore="HardcodedText" />
 
-        <View
-            android:id="@+id/transaction_delimiter_line"
-            android:layout_width="0dp"
-            android:layout_height="16dp"
-            android:layout_marginStart="8dp"
-            android:layout_marginEnd="8dp"
-            android:alpha="0.3"
-            android:background="@drawable/dashed_border_1dp"
-            app:layout_constraintBottom_toBottomOf="parent"
-            app:layout_constraintEnd_toStartOf="@id/transaction_delimiter_date"
-            app:layout_constraintStart_toEndOf="@id/transaction_delimiter_month"
-            app:layout_constraintTop_toTopOf="parent" />
-
         <View
             android:id="@+id/transaction_delimiter_thick"
             android:layout_width="0dp"
-            android:layout_height="0dp"
+            android:layout_height="1dp"
+            android:layout_marginHorizontal="16dp"
             android:background="?colorPrimary"
             app:layout_constraintBottom_toBottomOf="parent"
-            app:layout_constraintEnd_toStartOf="@id/transaction_delimiter_date"
-            app:layout_constraintStart_toEndOf="@id/transaction_delimiter_month"
-            app:layout_constraintTop_toTopOf="parent" />
+            app:layout_constraintEnd_toStartOf="@id/transaction_delimiter_month"
+            app:layout_constraintStart_toEndOf="@id/transaction_delimiter_date"
+            app:layout_constraintTop_toTopOf="parent"
+            />
 
     </androidx.constraintlayout.widget.ConstraintLayout>