Browse Source

feat: hide fab on scroll profile list (#281)

Reviewed-on: https://gitea.angry.im/PeterCxy/OpenEUICC/pulls/281
Co-authored-by: septs <github@septs.pw>
Co-committed-by: septs <github@septs.pw>
septs 1 month ago
parent
commit
e5568e2164

+ 6 - 1
app-common/src/main/java/im/angry/openeuicc/ui/EuiccManagementFragment.kt

@@ -119,6 +119,11 @@ open class EuiccManagementFragment : Fragment(), EuiccProfilesChangedListener,
             }
             }
         ))
         ))
 
 
+        profileList.addOnScrollListener(object : RecyclerView.OnScrollListener() {
+            override fun onScrollStateChanged(view: RecyclerView, newState: Int) =
+                if (newState == RecyclerView.SCROLL_STATE_IDLE) fab.show() else fab.hide()
+        })
+
         return view
         return view
     }
     }
 
 
@@ -318,7 +323,7 @@ open class EuiccManagementFragment : Fragment(), EuiccProfilesChangedListener,
         popup.menu.findItem(R.id.delete).isVisible = false
         popup.menu.findItem(R.id.delete).isVisible = false
 
 
         // We hide the disable option by default to avoid "bricking" some cards that won't get
         // We hide the disable option by default to avoid "bricking" some cards that won't get
-        // recognized again by the phone's modem. However we don't have that worry if we are
+        // recognized again by the phone's modem. However, we don't have that worry if we are
         // accessing it through a USB card reader, or when the user explicitly opted in
         // accessing it through a USB card reader, or when the user explicitly opted in
         if (!isUsb && !disableSafeguardFlow.value) return
         if (!isUsb && !disableSafeguardFlow.value) return
         popup.menu.findItem(R.id.disable).isVisible = true
         popup.menu.findItem(R.id.disable).isVisible = true

+ 1 - 0
app-common/src/main/res/layout/fragment_euicc.xml

@@ -29,6 +29,7 @@
         android:layout_marginBottom="16dp"
         android:layout_marginBottom="16dp"
         android:contentDescription="@string/profile_download"
         android:contentDescription="@string/profile_download"
         android:src="@drawable/ic_add"
         android:src="@drawable/ic_add"
+        android:tooltipText="@string/profile_download"
         app:layout_constraintBottom_toBottomOf="parent"
         app:layout_constraintBottom_toBottomOf="parent"
         app:layout_constraintRight_toRightOf="parent" />
         app:layout_constraintRight_toRightOf="parent" />