diff --git a/app/src/main/java/com/example/nerbos/fragments/transaction/TransactionFragment.kt b/app/src/main/java/com/example/nerbos/fragments/transaction/TransactionFragment.kt index 97982afd3f0740f66602942e9c0d61918e38827b..0b92fd4b198c06a21bb55736270b47f77989ff65 100644 --- a/app/src/main/java/com/example/nerbos/fragments/transaction/TransactionFragment.kt +++ b/app/src/main/java/com/example/nerbos/fragments/transaction/TransactionFragment.kt @@ -279,7 +279,7 @@ class TransactionFragment : Fragment() { dialog.dismiss() } - dialog.findViewById<EditText>(R.id.locationInput).setOnClickListener { + dialog.findViewById<ImageView>(R.id.autoFillLocationButton).setOnClickListener { // TODO: Buat percabangan kalau ada internet val etLocation= dialog.findViewById<EditText>(R.id.locationInput) etLocation.setText(getAddressName()) @@ -325,6 +325,11 @@ class TransactionFragment : Fragment() { etNominal.setText(transaction.nominal.toString()) transactionDate.text = Utils.formatDate(transaction.date.toString()) + dialog.findViewById<ImageView>(R.id.autoFillLocationButton).setOnClickListener { + // TODO: Buat percabangan kalau ada internet + etLocation.setText(getAddressName()) + } + dialog.findViewById<Button>(R.id.saveButton).setOnClickListener{ if(updateDataToDatabase(dialog, transaction.id)){ dialog.dismiss() @@ -382,7 +387,6 @@ class TransactionFragment : Fragment() { } private fun getDialogData(view:Dialog): Transaction? { - // TODO: Nanti diganti dengan input beneran, NIM diambil dari decode token JWT try{ // Button Group val radioGroup : RadioGroup = view.findViewById(R.id.categoryInput) diff --git a/app/src/main/res/layout/add_transaction.xml b/app/src/main/res/layout/add_transaction.xml index 819700876885041d8decb506e2fcb13beb6307cc..f24067587d744d282fa859f915a17f80d019a6aa 100644 --- a/app/src/main/res/layout/add_transaction.xml +++ b/app/src/main/res/layout/add_transaction.xml @@ -127,11 +127,11 @@ <EditText android:id="@+id/locationInput" - android:layout_width="match_parent" + android:layout_width="270dp" android:layout_height="wrap_content" android:layout_marginStart="20dp" android:layout_marginTop="15dp" - android:layout_marginEnd="20dp" + android:layout_marginEnd="0dp" android:ems="10" android:hint="@string/location" android:padding="10sp" @@ -142,11 +142,23 @@ android:textSize="18sp" android:textColor="@color/white" android:textColorHint="@color/base_blur" - app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintEnd_toStartOf="@id/autoFillLocationButton" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toBottomOf="@+id/nominalInput" android:autofillHints="Location Input" /> + <ImageView + android:id="@+id/autoFillLocationButton" + android:layout_width="40dp" + android:layout_height="40dp" + android:background="@drawable/ic_location" + android:layout_marginTop="15dp" + android:layout_marginEnd="20dp" + app:layout_constraintTop_toBottomOf="@id/nominalInput" + app:layout_constraintStart_toEndOf="@id/locationInput" + app:layout_constraintEnd_toEndOf="parent" + android:contentDescription="@string/autofill_location_button"/> + <Button android:id="@+id/cancelButton" android:layout_width="wrap_content" @@ -154,7 +166,7 @@ android:text="@string/cancel" android:textSize="18sp" android:textColor="@color/white" - android:layout_marginTop="30dp" + android:layout_marginTop="40dp" android:layout_marginBottom="20dp" android:layout_marginStart="20dp" android:background="@drawable/round_corner_button_weak" @@ -166,7 +178,7 @@ android:id="@+id/addButton" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:layout_marginTop="30dp" + android:layout_marginTop="40dp" android:layout_marginBottom="20dp" android:layout_marginEnd="20dp" android:textColor="@color/white" diff --git a/app/src/main/res/layout/modify_transaction.xml b/app/src/main/res/layout/modify_transaction.xml index 677185feb58b1eef42d3ba11aacb66512584ed2c..b7ac88171b772f8f0a5037460e4714fed9c5fc17 100644 --- a/app/src/main/res/layout/modify_transaction.xml +++ b/app/src/main/res/layout/modify_transaction.xml @@ -127,11 +127,11 @@ <EditText android:id="@+id/locationInput" - android:layout_width="match_parent" + android:layout_width="270dp" android:layout_height="wrap_content" android:layout_marginStart="20dp" android:layout_marginTop="15dp" - android:layout_marginEnd="20dp" + android:layout_marginEnd="0dp" android:ems="10" android:hint="@string/location" android:padding="10sp" @@ -142,11 +142,23 @@ android:textSize="18sp" android:textColor="@color/white" android:textColorHint="@color/base_blur" - app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintEnd_toStartOf="@id/autoFillLocationButton" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toBottomOf="@+id/nominalInput" android:autofillHints="Location Input" /> + <ImageView + android:id="@+id/autoFillLocationButton" + android:layout_width="40dp" + android:layout_height="40dp" + android:background="@drawable/ic_location" + android:layout_marginTop="15dp" + android:layout_marginEnd="20dp" + app:layout_constraintTop_toBottomOf="@id/nominalInput" + app:layout_constraintStart_toEndOf="@id/locationInput" + app:layout_constraintEnd_toEndOf="parent" + android:contentDescription="@string/autofill_location_button"/> + <TextView android:id="@+id/transactionDateDialog" android:layout_width="match_parent" @@ -173,7 +185,7 @@ android:text="@string/delete" android:textColor="@color/white" android:textSize="18sp" - android:layout_marginTop="30dp" + android:layout_marginTop="40dp" android:layout_marginBottom="20dp" android:layout_marginStart="20dp" android:background="@drawable/round_corner_input_category_outcome" @@ -185,7 +197,7 @@ android:id="@+id/saveButton" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:layout_marginTop="30dp" + android:layout_marginTop="40dp" android:layout_marginBottom="20dp" android:layout_marginEnd="20dp" android:textSize="18sp" diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 6a6d9fa32baed9091b99b0fb716f0ce165da584c..dfc7cc405f38a0a3c3f91d166ae34a8950aad4d4 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -69,5 +69,6 @@ <string name="email_message">Here is your transaction report</string> <string name="logo">Logo</string> <string name="back_button">Back Button</string> + <string name="autofill_location_button">AutoFill Location Button</string> </resources> \ No newline at end of file