From a8a6d959ef110bea992859f428f5ba2fa4420638 Mon Sep 17 00:00:00 2001
From: debbyalmadea <almadeaputri@gmail.com>
Date: Mon, 1 Apr 2024 10:27:42 +0700
Subject: [PATCH] fix: scroll view layout

---
 .../main/res/layout-land/fragment_graph.xml   |  2 ++
 app/src/main/res/layout/activity_main.xml     |  8 ++++-
 app/src/main/res/layout/dialog_no_network.xml |  6 ++--
 app/src/main/res/layout/fragment_graph.xml    |  2 ++
 app/src/main/res/layout/fragment_login.xml    |  4 +--
 .../main/res/layout/fragment_no_network.xml   |  1 +
 app/src/main/res/layout/fragment_scan.xml     |  2 ++
 .../main/res/layout/fragment_scan_home.xml    |  7 ++--
 .../main/res/layout/fragment_scan_result.xml  |  2 ++
 app/src/main/res/layout/fragment_settings.xml |  2 ++
 .../main/res/layout/fragment_transaction.xml  | 34 ++++++++++---------
 .../layout/fragment_transaction_create.xml    |  2 ++
 .../res/layout/fragment_transaction_edit.xml  |  2 ++
 app/src/main/res/layout/fragment_twibbon.xml  |  2 ++
 app/src/main/res/layout/item_transaction.xml  |  2 +-
 15 files changed, 52 insertions(+), 26 deletions(-)

diff --git a/app/src/main/res/layout-land/fragment_graph.xml b/app/src/main/res/layout-land/fragment_graph.xml
index dc83539..3b96c6b 100644
--- a/app/src/main/res/layout-land/fragment_graph.xml
+++ b/app/src/main/res/layout-land/fragment_graph.xml
@@ -4,6 +4,8 @@
     xmlns:tools="http://schemas.android.com/tools"
     android:layout_width="match_parent"
     android:layout_height="match_parent"
+    android:layout_weight="1.0"
+    android:layout_marginBottom="80dp"
     tools:context=".view.graph.GraphFragment"
     android:background="@color/md_theme_surface"
     >
diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml
index ff8ea44..7a0f861 100644
--- a/app/src/main/res/layout/activity_main.xml
+++ b/app/src/main/res/layout/activity_main.xml
@@ -33,11 +33,16 @@
         app:itemTextAppearanceActive="@style/BottomNavigationViewTextStyle"
         app:menu="@menu/bottom_nav_menu"  />
 
+    <ScrollView
+        android:layout_width="match_parent"
+        android:layout_height="match_parent"
+        android:fillViewport="true"
+        >
     <fragment
         android:id="@+id/nav_host_fragment_activity_main"
         android:name="androidx.navigation.fragment.NavHostFragment"
         android:layout_width="match_parent"
-        android:layout_height="match_parent"
+        android:layout_height="wrap_content"
         app:defaultNavHost="true"
         app:layout_constraintBottom_toTopOf="@id/nav_view"
         app:layout_constraintHorizontal_bias="1.0"
@@ -46,6 +51,7 @@
         app:layout_constraintTop_toTopOf="parent"
         app:layout_constraintVertical_bias="1.0"
         app:navGraph="@navigation/mobile_navigation" />
+    </ScrollView>
 </androidx.constraintlayout.widget.ConstraintLayout>
     <FrameLayout
         android:id="@+id/loading"
diff --git a/app/src/main/res/layout/dialog_no_network.xml b/app/src/main/res/layout/dialog_no_network.xml
index 41ad33d..2996d32 100644
--- a/app/src/main/res/layout/dialog_no_network.xml
+++ b/app/src/main/res/layout/dialog_no_network.xml
@@ -29,8 +29,8 @@
 
         <ImageView
             android:id="@+id/img_no_network"
-            android:layout_width="200dp"
-            android:layout_height="200dp"
+            android:layout_width="150dp"
+            android:layout_height="150dp"
             android:layout_marginBottom="18dp"
             android:contentDescription="@string/img_no_network_description"
             android:src="@drawable/img_no_network"
@@ -68,7 +68,7 @@
         <Button
             android:id="@+id/dialog_btn_okay"
             android:layout_width="match_parent"
-            android:layout_height="match_parent"
+            android:layout_height="wrap_content"
             android:text="@string/okay"
             android:layout_marginTop="30dp"
             style="@style/buttonStylePrimary"
diff --git a/app/src/main/res/layout/fragment_graph.xml b/app/src/main/res/layout/fragment_graph.xml
index c502625..8ee5568 100644
--- a/app/src/main/res/layout/fragment_graph.xml
+++ b/app/src/main/res/layout/fragment_graph.xml
@@ -4,6 +4,8 @@
     xmlns:tools="http://schemas.android.com/tools"
     android:layout_width="match_parent"
     android:layout_height="match_parent"
+    android:layout_weight="1.0"
+    android:layout_marginBottom="80dp"
     tools:context=".view.graph.GraphFragment"
     android:background="@color/md_theme_surface"
     >
diff --git a/app/src/main/res/layout/fragment_login.xml b/app/src/main/res/layout/fragment_login.xml
index 3020057..d13c249 100644
--- a/app/src/main/res/layout/fragment_login.xml
+++ b/app/src/main/res/layout/fragment_login.xml
@@ -5,13 +5,13 @@
     xmlns:tools="http://schemas.android.com/tools"
     android:layout_width="match_parent"
     android:layout_height="match_parent"
+    android:layout_weight="1.0"
     android:background="@color/md_theme_background" >
 <androidx.constraintlayout.widget.ConstraintLayout
     android:id="@+id/login_fragment"
     android:layout_width="match_parent"
     android:layout_height="wrap_content"
     android:paddingHorizontal="30dp"
-    android:paddingBottom="100dp"
     android:layout_gravity="center"
     tools:context=".view.login.LoginFragment">
 
@@ -35,7 +35,7 @@
         android:layout_height="wrap_content"
         android:layout_marginStart="8dp"
         android:layout_marginEnd="8dp"
-        android:layout_marginBottom="50dp"
+        android:layout_marginBottom="20dp"
         android:text="@string/login"
         android:textAlignment="center"
         android:textColor="@color/md_theme_primary"
diff --git a/app/src/main/res/layout/fragment_no_network.xml b/app/src/main/res/layout/fragment_no_network.xml
index ea323b6..ad25bca 100644
--- a/app/src/main/res/layout/fragment_no_network.xml
+++ b/app/src/main/res/layout/fragment_no_network.xml
@@ -4,6 +4,7 @@
     xmlns:tools="http://schemas.android.com/tools"
     android:layout_width="match_parent"
     android:layout_height="wrap_content"
+    android:layout_weight="1.0"
     android:paddingHorizontal="30dp"
     android:layout_gravity="center"
     android:background="@color/md_theme_background"
diff --git a/app/src/main/res/layout/fragment_scan.xml b/app/src/main/res/layout/fragment_scan.xml
index 54ebb32..566a96e 100644
--- a/app/src/main/res/layout/fragment_scan.xml
+++ b/app/src/main/res/layout/fragment_scan.xml
@@ -4,6 +4,8 @@
     xmlns:tools="http://schemas.android.com/tools"
     android:layout_width="match_parent"
     android:layout_height="match_parent"
+    android:layout_weight="1.0"
+    android:layout_marginBottom="80dp"
     android:background="@color/md_theme_primary"
     android:paddingHorizontal="30dp">
 
diff --git a/app/src/main/res/layout/fragment_scan_home.xml b/app/src/main/res/layout/fragment_scan_home.xml
index ebd34b7..180300d 100644
--- a/app/src/main/res/layout/fragment_scan_home.xml
+++ b/app/src/main/res/layout/fragment_scan_home.xml
@@ -5,6 +5,8 @@
     xmlns:tools="http://schemas.android.com/tools"
     android:layout_width="match_parent"
     android:layout_height="match_parent"
+    android:layout_weight="1.0"
+    android:layout_marginBottom="80dp"
     android:background="@color/md_theme_background" >
 <androidx.constraintlayout.widget.ConstraintLayout
     android:id="@+id/scan_fragment"
@@ -37,8 +39,7 @@
 
     <ImageView
         android:layout_width="wrap_content"
-        android:layout_height="wrap_content"
-        android:layout_marginStart="0dp"
+        android:layout_height="0dp"
         android:src="@drawable/scan"
         app:layout_constraintStart_toStartOf="@+id/tv_scan_title"
         app:layout_constraintTop_toBottomOf="@+id/tv_scan_deskripsi"
@@ -47,7 +48,7 @@
     <LinearLayout
         android:id = "@+id/ll_button"
         android:layout_width="match_parent"
-        android:layout_height="220dp"
+        android:layout_height="wrap_content"
         android:background="@color/white"
         android:orientation="vertical"
         app:layout_constraintBottom_toBottomOf="parent"
diff --git a/app/src/main/res/layout/fragment_scan_result.xml b/app/src/main/res/layout/fragment_scan_result.xml
index 6b61d8a..6007725 100644
--- a/app/src/main/res/layout/fragment_scan_result.xml
+++ b/app/src/main/res/layout/fragment_scan_result.xml
@@ -3,6 +3,8 @@
     xmlns:tools="http://schemas.android.com/tools"
     android:layout_width="match_parent"
     android:layout_height="match_parent"
+    android:layout_weight="1.0"
+    android:layout_marginBottom="80dp"
     xmlns:app="http://schemas.android.com/apk/res-auto"
     android:background="@color/md_theme_primary">
 
diff --git a/app/src/main/res/layout/fragment_settings.xml b/app/src/main/res/layout/fragment_settings.xml
index ca2d4c0..5a9a35d 100644
--- a/app/src/main/res/layout/fragment_settings.xml
+++ b/app/src/main/res/layout/fragment_settings.xml
@@ -4,6 +4,8 @@
     xmlns:tools="http://schemas.android.com/tools"
     android:layout_width="match_parent"
     android:layout_height="match_parent"
+    android:layout_weight="1.0"
+    android:layout_marginBottom="80dp"
     android:paddingHorizontal="@dimen/fragment_horizontal_padding"
     android:background="@color/md_theme_surface">
 
diff --git a/app/src/main/res/layout/fragment_transaction.xml b/app/src/main/res/layout/fragment_transaction.xml
index a588bb6..b87b99d 100644
--- a/app/src/main/res/layout/fragment_transaction.xml
+++ b/app/src/main/res/layout/fragment_transaction.xml
@@ -3,6 +3,8 @@
     xmlns:app="http://schemas.android.com/apk/res-auto"
     xmlns:tools="http://schemas.android.com/tools"
     android:layout_width="match_parent"
+    android:layout_weight="1.0"
+    android:layout_marginBottom="80dp"
     android:background="@color/md_theme_surface"
     android:layout_height="match_parent"
     android:paddingHorizontal="@dimen/fragment_horizontal_padding"
@@ -33,7 +35,9 @@
         android:paddingBottom="22dp"
         app:layout_constraintEnd_toEndOf="parent"
         app:layout_constraintStart_toStartOf="parent"
-        app:layout_constraintTop_toBottomOf="@+id/tv_title_fragment">
+        app:layout_constraintTop_toBottomOf="@+id/tv_title_fragment"
+        app:layout_constraintBottom_toTopOf="@+id/constraintLayout2"
+        >
 
         <TextView
             android:id="@+id/tv_email"
@@ -72,7 +76,7 @@
     <androidx.constraintlayout.widget.ConstraintLayout
         android:id="@+id/constraintLayout2"
         android:layout_width="match_parent"
-        android:layout_height="580dp"
+        android:layout_height="0dp"
         app:layout_constraintVertical_bias="0"
         app:layout_constraintBottom_toBottomOf="parent"
         app:layout_constraintEnd_toEndOf="parent"
@@ -83,26 +87,24 @@
             android:id="@+id/rvTransaction"
             android:layout_width="match_parent"
             android:layout_height="match_parent"
-            android:layout_marginBottom="40dp"
             app:layout_constraintEnd_toEndOf="parent"
             app:layout_constraintStart_toStartOf="parent"
             app:layout_constraintTop_toTopOf="parent"
             app:layout_constraintBottom_toBottomOf="parent"/>
-
-        <com.google.android.material.floatingactionbutton.FloatingActionButton
-            android:id="@+id/fab_create_transaction"
-            style="@style/FloatingActionButtonStyle"
-            android:layout_width="60dp"
-            android:layout_height="60dp"
-            android:layout_marginBottom="30dp"
-            android:clickable="true"
-            app:backgroundTint="@color/md_theme_primary"
-            android:contentDescription="@string/cd_transaction_create"
-            app:layout_constraintBottom_toBottomOf="parent"
-            app:layout_constraintEnd_toEndOf="parent"
-            app:srcCompat="@drawable/ic_add" />
     </androidx.constraintlayout.widget.ConstraintLayout>
 
+    <com.google.android.material.floatingactionbutton.FloatingActionButton
+        android:id="@+id/fab_create_transaction"
+        style="@style/FloatingActionButtonStyle"
+        android:layout_width="60dp"
+        android:layout_height="60dp"
+        android:clickable="true"
+        app:backgroundTint="@color/md_theme_primary"
+        android:contentDescription="@string/cd_transaction_create"
+        app:layout_constraintBottom_toBottomOf="parent"
+        app:layout_constraintEnd_toEndOf="parent"
+        app:srcCompat="@drawable/ic_add" />
+
     <androidx.constraintlayout.widget.ConstraintLayout
         android:id="@+id/cl_empty_rv"
         android:layout_width="match_parent"
diff --git a/app/src/main/res/layout/fragment_transaction_create.xml b/app/src/main/res/layout/fragment_transaction_create.xml
index eeafc7e..33c6da9 100644
--- a/app/src/main/res/layout/fragment_transaction_create.xml
+++ b/app/src/main/res/layout/fragment_transaction_create.xml
@@ -4,6 +4,7 @@
     xmlns:tools="http://schemas.android.com/tools"
     android:layout_width="match_parent"
     android:layout_height="match_parent"
+    android:layout_weight="1.0"
     android:paddingHorizontal="@dimen/fragment_horizontal_padding"
     tools:context=".view.transaction.CreateTransactionFragment">
 
@@ -171,6 +172,7 @@
     <androidx.constraintlayout.widget.ConstraintLayout
         android:layout_width="match_parent"
         android:layout_height="wrap_content"
+        android:layout_marginTop="20dp"
         app:layout_constraintBottom_toBottomOf="parent"
         app:layout_constraintEnd_toEndOf="parent"
         app:layout_constraintStart_toStartOf="parent"
diff --git a/app/src/main/res/layout/fragment_transaction_edit.xml b/app/src/main/res/layout/fragment_transaction_edit.xml
index 52a0077..90fdf3b 100644
--- a/app/src/main/res/layout/fragment_transaction_edit.xml
+++ b/app/src/main/res/layout/fragment_transaction_edit.xml
@@ -4,6 +4,8 @@
     xmlns:tools="http://schemas.android.com/tools"
     android:layout_width="match_parent"
     android:layout_height="match_parent"
+    android:layout_weight="1.0"
+    android:layout_marginBottom="80dp"
     android:paddingHorizontal="@dimen/fragment_horizontal_padding"
     tools:context=".view.transaction.EditTransactionFragment">
 
diff --git a/app/src/main/res/layout/fragment_twibbon.xml b/app/src/main/res/layout/fragment_twibbon.xml
index ac37b10..665eec4 100644
--- a/app/src/main/res/layout/fragment_twibbon.xml
+++ b/app/src/main/res/layout/fragment_twibbon.xml
@@ -3,6 +3,8 @@
     xmlns:app="http://schemas.android.com/apk/res-auto"
     xmlns:tools="http://schemas.android.com/tools"
     android:layout_width="match_parent"
+    android:layout_weight="1.0"
+    android:layout_marginBottom="80dp"
     android:background="@color/md_theme_surface"
     android:layout_height="match_parent"
     tools:context=".view.twibbon.TwibbonFragment"
diff --git a/app/src/main/res/layout/item_transaction.xml b/app/src/main/res/layout/item_transaction.xml
index 290cc35..b4eafc0 100644
--- a/app/src/main/res/layout/item_transaction.xml
+++ b/app/src/main/res/layout/item_transaction.xml
@@ -2,7 +2,7 @@
     xmlns:app="http://schemas.android.com/apk/res-auto"
     android:layout_width="match_parent"
     android:layout_height="wrap_content"
-    android:layout_marginTop="@dimen/vertical_gap"
+    android:layout_marginBottom="@dimen/vertical_gap"
     android:background="@drawable/bg_transaction_card_view"
     android:padding="@dimen/card_padding">
 
-- 
GitLab