diff --git a/app/src/main/java/com/mhn/bondoman/ui/transactions/TransactionAdapter.kt b/app/src/main/java/com/mhn/bondoman/ui/transactions/TransactionAdapter.kt index 1a7790367250331752d7a275d5030c2ef9ce34d4..879d10b68ffd0663f12b590a9f553a9f8f953e90 100644 --- a/app/src/main/java/com/mhn/bondoman/ui/transactions/TransactionAdapter.kt +++ b/app/src/main/java/com/mhn/bondoman/ui/transactions/TransactionAdapter.kt @@ -28,19 +28,34 @@ class TransactionAdapter( fun bind(transaction: Transaction) { binding.tvTransaksi.text = transaction.transaction_name binding.tvTransactionDate.text = transaction.transaction_date - binding.tvKategori.text = transaction.transaction_category binding.Location.text = transaction.transaction_location - binding.price.text = "Rp ${transaction.transaction_price}" + binding.Location.contentDescription = "View location of ${transaction.transaction_name}" + if (transaction.transaction_category == "Income") { + binding.price.text = "+ Rp ${transaction.transaction_price}" + } else { + binding.price.text = "- Rp ${transaction.transaction_price}" + } + binding.price.setTextColor( + if (transaction.transaction_category == "Income") { + activity.getColor(android.R.color.holo_green_light) + } else { + activity.getColor(android.R.color.holo_red_light) + } + ) binding.btnDelete.setOnClickListener { val confirmationDialog = ConfirmationModal() currentItemPosition = adapterPosition confirmationDialog.setConfirmationDialogListener(this@TransactionAdapter) confirmationDialog.show(fragmentManager, "ConfirmationDialog") } + binding.btnDelete.contentDescription = "Delete ${transaction.transaction_name}" itemView.setOnClickListener { onItemClick(transaction.transaction_id ?: 0) } - binding.Location.setOnClickListener { + binding.Location.contentDescription = "View location of ${transaction.transaction_name}" + binding.locationSymbol.contentDescription = + "View location symbol of ${transaction.transaction_name}" + binding.locationSymbol.setOnClickListener { val gmmIntentUri = Uri.parse("geo:0,0?q=${transaction.transaction_latitude},${transaction.transaction_longitude}") val mapIntent = Intent(Intent.ACTION_VIEW, gmmIntentUri) diff --git a/app/src/main/res/drawable/ic_map_marker2.xml b/app/src/main/res/drawable/ic_map_marker2.xml new file mode 100644 index 0000000000000000000000000000000000000000..1c35bf5168f87552bc9ef110f576b46827b77f0e --- /dev/null +++ b/app/src/main/res/drawable/ic_map_marker2.xml @@ -0,0 +1,11 @@ +<vector xmlns:android="http://schemas.android.com/apk/res/android" + android:width="20dp" + android:height="20dp" + android:viewportWidth="8" + android:viewportHeight="8"> + + <path + android:fillColor="#D8D4D4" + android:pathData="m4,0c-1.66,0 -3,1.34 -3,3 0,2 3,5 3,5s3,-3 3,-5c0,-1.66 -1.34,-3 -3,-3zM4,1c1.11,0 2,0.9 2,2 0,1.11 -0.89,2 -2,2 -1.1,0 -2,-0.89 -2,-2 0,-1.1 0.9,-2 2,-2z" /> + +</vector> diff --git a/app/src/main/res/drawable/ic_trash.xml b/app/src/main/res/drawable/ic_trash.xml index 67c304fb3e752f00627e46939dd821cca756b0cb..1e67ecf6a8fdf5c8d6733e185b3e9383496b4b2e 100644 --- a/app/src/main/res/drawable/ic_trash.xml +++ b/app/src/main/res/drawable/ic_trash.xml @@ -4,10 +4,10 @@ android:width="25dp" xmlns:android="http://schemas.android.com/apk/res/android"> <path - android:fillColor="#722732" + android:fillColor="#FF0025" android:pathData="M3,6.386C3,5.902 3.345,5.509 3.771,5.509L6.436,5.508C6.965,5.493 7.432,5.11 7.612,4.544C7.617,4.529 7.622,4.511 7.642,4.444L7.757,4.053C7.827,3.812 7.888,3.603 7.974,3.416C8.312,2.677 8.938,2.164 9.661,2.033C9.845,2 10.038,2 10.261,2H13.739C13.962,2 14.156,2 14.339,2.033C15.062,2.164 15.688,2.677 16.026,3.416C16.112,3.603 16.173,3.812 16.243,4.053L16.358,4.444C16.378,4.511 16.383,4.529 16.388,4.544C16.568,5.11 17.128,5.494 17.657,5.509H20.229C20.655,5.509 21,5.902 21,6.386C21,6.87 20.655,7.263 20.229,7.263H3.771C3.345,7.263 3,6.87 3,6.386Z" /> <path - android:fillColor="#722732" + android:fillColor="#FF0025" android:fillType="evenOdd" android:pathData="M11.596,22H12.404C15.187,22 16.579,22 17.483,21.114C18.388,20.228 18.48,18.775 18.665,15.869L18.932,11.681C19.033,10.104 19.083,9.315 18.629,8.816C18.175,8.316 17.409,8.316 15.876,8.316H8.124C6.591,8.316 5.825,8.316 5.371,8.816C4.917,9.315 4.967,10.104 5.068,11.681L5.335,15.869C5.52,18.775 5.612,20.228 6.517,21.114C7.422,22 8.813,22 11.596,22ZM10.246,12.189C10.205,11.755 9.838,11.438 9.425,11.482C9.013,11.525 8.713,11.912 8.754,12.346L9.254,17.609C9.295,18.043 9.662,18.359 10.075,18.316C10.487,18.272 10.788,17.886 10.746,17.452L10.246,12.189ZM14.575,11.482C14.987,11.525 15.288,11.912 15.246,12.346L14.746,17.609C14.705,18.043 14.337,18.359 13.925,18.316C13.513,18.272 13.212,17.886 13.254,17.452L13.754,12.189C13.795,11.755 14.163,11.438 14.575,11.482Z" /> </vector> diff --git a/app/src/main/res/drawable/spinnerborder.xml b/app/src/main/res/drawable/spinnerborder.xml index c4b14588fed56cea2c1008b9609bb61f01de2584..6bf509471cd17470665aa9b0eeede26f4c04a700 100644 --- a/app/src/main/res/drawable/spinnerborder.xml +++ b/app/src/main/res/drawable/spinnerborder.xml @@ -4,6 +4,6 @@ <solid android:color="@android:color/transparent" /> <stroke android:width="1dp" - android:color="#9A9A9A" /> + android:color="@color/black" /> <corners android:radius="4dp" /> </shape> \ No newline at end of file diff --git a/app/src/main/res/layout/fragment_add_transaction.xml b/app/src/main/res/layout/fragment_add_transaction.xml index a80bce56cb2e1201fdd33b849cc1158b25fb6b32..9914bcc57dd2e8ce9fa0362f936f669e61609e5d 100644 --- a/app/src/main/res/layout/fragment_add_transaction.xml +++ b/app/src/main/res/layout/fragment_add_transaction.xml @@ -4,6 +4,7 @@ android:layout_width="match_parent" android:layout_height="match_parent" android:background="@drawable/glow_effect"> + <androidx.constraintlayout.widget.ConstraintLayout android:layout_width="match_parent" android:layout_height="wrap_content"> @@ -12,9 +13,9 @@ android:id="@+id/card_view" android:layout_width="match_parent" android:layout_height="wrap_content" + android:layout_marginLeft="20dp" android:layout_marginTop="100dp" android:layout_marginRight="20dp" - android:layout_marginLeft="20dp" android:layout_marginBottom="100dp" app:cardCornerRadius="20dp" app:layout_constraintBottom_toBottomOf="parent" @@ -34,16 +35,18 @@ android:id="@+id/titleLayout" style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox" android:layout_width="match_parent" - android:layout_height="match_parent"> + android:layout_height="match_parent" + android:textColorHint="@color/black" + app:boxStrokeColor="@color/black"> <com.google.android.material.textfield.TextInputEditText android:id="@+id/etTitle" android:layout_width="match_parent" android:layout_height="wrap_content" - android:minHeight="48dp" android:layout_marginTop="100dp" android:hint="@string/title_name" android:inputType="text" + android:minHeight="48dp" android:padding="10dp" /> </com.google.android.material.textfield.TextInputLayout> @@ -53,17 +56,19 @@ android:layout_width="match_parent" android:layout_height="match_parent" android:layout_marginTop="20dp" + android:textColorHint="@color/black" + app:boxStrokeColor="@color/black" app:layout_constraintTop_toBottomOf="@+id/titleLayout"> <com.google.android.material.textfield.TextInputEditText android:id="@+id/etNominal" android:layout_width="match_parent" android:layout_height="wrap_content" - android:minHeight="48dp" android:layout_marginTop="60dp" android:ems="10" android:hint="@string/nominal" android:inputType="number" + android:minHeight="48dp" android:padding="10dp" /> </com.google.android.material.textfield.TextInputLayout> @@ -71,13 +76,13 @@ android:id="@+id/etKategori" android:layout_width="match_parent" android:layout_height="wrap_content" - android:minHeight="48dp" android:layout_marginTop="30dp" android:background="@drawable/spinnerborder" android:ems="10" android:fontFamily="@font/syne_regular" android:hint="@string/kategori" android:inputType="text" + android:minHeight="48dp" android:padding="10dp" android:spinnerMode="dropdown" /> @@ -85,18 +90,20 @@ style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox" android:layout_width="match_parent" android:layout_height="match_parent" + android:layout_marginTop="30dp" android:minHeight="48dp" - android:layout_marginTop="30dp"> + android:textColorHint="@color/black" + app:boxStrokeColor="@color/black"> <com.google.android.material.textfield.TextInputEditText android:id="@+id/etLokasi" android:layout_width="match_parent" android:layout_height="wrap_content" - android:minHeight="48dp" android:layout_marginTop="20dp" android:ems="10" android:hint="@string/location_name" android:inputType="text" + android:minHeight="48dp" android:padding="10dp" /> </com.google.android.material.textfield.TextInputLayout> diff --git a/app/src/main/res/layout/transaction_item.xml b/app/src/main/res/layout/transaction_item.xml index f0a7fc7f8af48eed71fb1fc115de1ac1e438401a..26319fc8b0275afadb2571efa68a48e43d932d6a 100644 --- a/app/src/main/res/layout/transaction_item.xml +++ b/app/src/main/res/layout/transaction_item.xml @@ -2,38 +2,29 @@ <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="wrap_content" - android:padding="20dp" android:layout_marginLeft="5dp" android:layout_marginRight="5dp" android:layout_marginBottom="20dp" - android:background="@drawable/rounded_item_transaction"> + android:background="@drawable/rounded_item_transaction" + android:padding="20dp"> <TextView android:id="@+id/tvTransactionDate" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:text="dd/mm/yyyy" android:layout_marginTop="35dp" + android:text="dd/mm/yyyy" android:textColor="@color/white" /> <ImageButton android:id="@+id/btnDelete" - android:layout_width="25dp" - android:layout_height="25dp" - android:layout_gravity="end|center_vertical" + android:layout_width="48dp" + android:layout_height="48dp" android:layout_alignParentEnd="true" + android:layout_gravity="end|center_vertical" android:background="@android:color/transparent" - android:src="@drawable/ic_trash" - android:contentDescription="@string/delete_button"/> - - <TextView - android:id="@+id/tvKategori" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:layout_marginTop="10dp" - android:layout_alignParentBottom="true" - android:text="@string/kategori" - android:textColor="@color/white" /> + android:contentDescription="@string/delete_button" + android:src="@drawable/ic_trash" /> <TextView android:id="@+id/tvTransaksi" @@ -49,33 +40,34 @@ android:id="@+id/price" android:layout_width="wrap_content" android:layout_height="wrap_content" + android:layout_alignParentBottom="true" + android:layout_marginTop="10dp" android:text="@string/nominal" - android:paddingVertical="10dp" - android:layout_below="@+id/btnDelete" - android:paddingHorizontal="20dp" - android:layout_alignParentEnd="true" - android:textSize="15sp" - android:background="@drawable/rounded_rectangle" - android:textColor="@color/white" /> + android:textColor="@color/white" + android:textSize="15sp" /> <ImageView android:id="@+id/locationSymbol" - android:layout_width="20dp" - android:layout_height="20dp" - android:src="@drawable/ic_map_marker" + android:layout_width="48dp" + android:layout_height="48dp" + android:layout_below="@+id/btnDelete" android:layout_alignParentEnd="true" - android:layout_below="@+id/price" android:layout_marginTop="10dp" - android:contentDescription="@string/location_symbol" /> + android:contentDescription="@string/location_symbol" + android:src="@drawable/ic_map_marker2" /> <TextView android:id="@+id/Location" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignTop="@id/locationSymbol" + android:layout_marginTop="15dp" android:layout_marginEnd="10dp" android:layout_toStartOf="@+id/locationSymbol" android:text="@string/location_name" - android:textColor="@color/white" /> + android:textColor="@color/white" + android:textSize="15sp" /> </RelativeLayout> + +