]> git.ktnx.net Git - mobile-ledger.git/commitdiff
somewhat more visible marker between months
authorDamyan Ivanov <dam+mobileledger@ktnx.net>
Sat, 12 Jan 2019 13:07:01 +0000 (13:07 +0000)
committerDamyan Ivanov <dam+mobileledger@ktnx.net>
Sat, 12 Jan 2019 13:07:01 +0000 (13:07 +0000)
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/drawable/dashed_border_8dp.xml [new file with mode: 0644]
app/src/main/res/layout/transaction_list_row.xml

index febca0191ecb02525c8bd47b7205f26dcb8b76f5..0e79b7ae24223cb9d5669043f133d11688516a43 100644 (file)
@@ -82,8 +82,15 @@ public class TransactionListAdapter extends RecyclerView.Adapter<TransactionRowH
             holder.vTransaction.setVisibility(View.GONE);
             holder.vDelimiter.setVisibility(View.VISIBLE);
             holder.tvDelimiterDate.setText(DateFormat.getDateInstance().format(date));
-            holder.tvDelimiterMonth
-                    .setText(item.isMonthShown() ? Globals.monthNames[date.getMonth()] : "");
+            if (item.isMonthShown()) {
+                holder.tvDelimiterMonth.setText(Globals.monthNames[date.getMonth()]);
+                holder.tvDelimiterMonth.setVisibility(View.VISIBLE);
+                holder.vDelimiterLine.setBackgroundResource(R.drawable.dashed_border_8dp);
+            }
+            else {
+                holder.tvDelimiterMonth.setVisibility(View.GONE);
+                holder.vDelimiterLine.setBackgroundResource(R.drawable.dashed_border_1dp);
+            }
         }
     }
 
index f23311a0368af425cefda476b978173bd83c8487..91111a6fea991e74f8a731ea37f9f21ea23bf5e8 100644 (file)
@@ -34,6 +34,7 @@ class TransactionRowHolder extends RecyclerView.ViewHolder {
     ConstraintLayout vDelimiter;
     CardView vTransaction;
     TextView tvDelimiterMonth, tvDelimiterDate;
+    View vDelimiterLine;
     public TransactionRowHolder(@NonNull View itemView) {
         super(itemView);
         this.row = itemView.findViewById(R.id.transaction_row);
@@ -43,5 +44,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);
     }
 }
diff --git a/app/src/main/res/drawable/dashed_border_8dp.xml b/app/src/main/res/drawable/dashed_border_8dp.xml
new file mode 100644 (file)
index 0000000..c77f8d8
--- /dev/null
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="utf-8"?><!--
+  ~ Copyright © 2019 Damyan Ivanov.
+  ~ This file is part of Mobile-Ledger.
+  ~ Mobile-Ledger is free software: you can distribute it and/or modify it
+  ~ under the term of the GNU General Public License as published by
+  ~ the Free Software Foundation, either version 3 of the License, or
+  ~ (at your opinion), any later version.
+  ~
+  ~ Mobile-Ledger is distributed in the hope that it will be useful,
+  ~ but WITHOUT ANY WARRANTY; without even the implied warranty of
+  ~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+  ~ GNU General Public License terms for details.
+  ~
+  ~ You should have received a copy of the GNU General Public License
+  ~ along with Mobile-Ledger. If not, see <https://www.gnu.org/licenses/>.
+  -->
+
+<shape xmlns:android="http://schemas.android.com/apk/res/android"
+    android:shape="line"
+    android:thickness="1dp"
+    android:tint="@color/header_border">
+    <stroke
+        android:width="8dp"
+        android:color="@color/colorPrimaryDark"
+        android:dashWidth="16dp"
+        android:dashGap="8dp" />
+
+</shape>
\ No newline at end of file
index 775dc79ffacb2c5157f56be9c8f668cf2b0c9f94..256ebb24ed2a85599ce332fe1ee7130160e55484 100644 (file)
             tools:ignore="HardcodedText" />
 
         <View
-            android:id="@+id/view"
+            android:id="@+id/transaction_delimiter_line"
             android:layout_width="0dp"
             android:layout_height="0dp"
             android:layout_marginStart="8dp"