Feat: Added placeholder text when no fave or hidden apps.
Signed-off-by: HeCodes2Much <wayne6324@gmail.com>
This commit is contained in:
@@ -113,10 +113,21 @@ class FavoriteFragment : Fragment(),
|
||||
viewLifecycleOwner.lifecycleScope.launch {
|
||||
viewModel.favoriteApps.collect {
|
||||
favoriteAdapter.submitList(it)
|
||||
updateNoAppsTextViewVisibility(it.isEmpty())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun updateNoAppsTextViewVisibility(isEmpty: Boolean) {
|
||||
if (isEmpty) {
|
||||
binding.noApps.visibility = View.VISIBLE
|
||||
binding.favoriteAdapter.visibility = View.GONE
|
||||
} else {
|
||||
binding.noApps.visibility = View.GONE
|
||||
binding.favoriteAdapter.visibility = View.VISIBLE
|
||||
}
|
||||
}
|
||||
|
||||
private fun observeHomeAppOrder() {
|
||||
binding.favoriteAdapter.adapter = favoriteAdapter
|
||||
val listener: OnItemMoveListener.OnItemActionListener = favoriteAdapter
|
||||
|
||||
@@ -31,8 +31,6 @@ class FavoriteViewHolder(
|
||||
}
|
||||
|
||||
fun bind(appInfo: AppInfo) {
|
||||
|
||||
|
||||
binding.apply {
|
||||
// Get the current LayoutParams of appFavoriteName
|
||||
val layoutParams = appFavoriteName.layoutParams as LinearLayoutCompat.LayoutParams
|
||||
|
||||
@@ -93,10 +93,21 @@ class HiddenFragment : Fragment(),
|
||||
viewLifecycleOwner.lifecycleScope.launchWhenCreated {
|
||||
viewModel.hiddenApps.collect {
|
||||
hiddenAdapter.updateData(it)
|
||||
updateNoAppsTextViewVisibility(it.isEmpty())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun updateNoAppsTextViewVisibility(isEmpty: Boolean) {
|
||||
if (isEmpty) {
|
||||
binding.noApps.visibility = View.VISIBLE
|
||||
binding.hiddenAdapter.visibility = View.GONE
|
||||
} else {
|
||||
binding.noApps.visibility = View.GONE
|
||||
binding.hiddenAdapter.visibility = View.VISIBLE
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressLint("ClickableViewAccessibility")
|
||||
private fun observeSwipeTouchListener() {
|
||||
binding.apply {
|
||||
|
||||
@@ -36,6 +36,16 @@
|
||||
android:layout_marginHorizontal="20dp"
|
||||
android:layout_marginTop="92dp"
|
||||
app:layout_constraintTop_toBottomOf="@id/topTextView" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/noApps"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginHorizontal="20dp"
|
||||
android:layout_marginTop="92dp"
|
||||
android:text="@string/favorite_fragment_no_apps"
|
||||
android:textSize="18sp"
|
||||
android:visibility="gone" />
|
||||
</FrameLayout>
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
@@ -36,5 +36,15 @@
|
||||
android:layout_marginHorizontal="20dp"
|
||||
android:layout_marginTop="92dp"
|
||||
app:layout_constraintTop_toBottomOf="@id/topTextView" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/noApps"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginHorizontal="20dp"
|
||||
android:layout_marginTop="92dp"
|
||||
android:text="@string/hidden_fragment_no_apps"
|
||||
android:textSize="18sp"
|
||||
android:visibility="gone" />
|
||||
</FrameLayout>
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
@@ -14,6 +14,9 @@
|
||||
<string name="favorite_fragment_name">Favorite Apps</string>
|
||||
<string name="hidden_fragment_name">Hidden Apps</string>
|
||||
|
||||
<string name="favorite_fragment_no_apps">No Favorite Apps</string>
|
||||
<string name="hidden_fragment_no_apps">No Hidden Apps</string>
|
||||
|
||||
<string name="search">Search</string>
|
||||
|
||||
<string name="bottom_dialog_app_rename">Rename</string>
|
||||
|
||||
Reference in New Issue
Block a user