Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 3c25cfa2 authored by Fahim Salam Chowdhury's avatar Fahim Salam Chowdhury 👽
Browse files

Add shimmerView for homePage per category appList

parent 8d5e2b97
Loading
Loading
Loading
Loading
+16 −0
Original line number Original line Diff line number Diff line
@@ -19,6 +19,7 @@
package foundation.e.apps.ui.home.model
package foundation.e.apps.ui.home.model


import android.view.LayoutInflater
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.view.ViewGroup
import androidx.lifecycle.LifecycleOwner
import androidx.lifecycle.LifecycleOwner
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.LinearLayoutManager
@@ -77,6 +78,21 @@ class HomeParentRVAdapter(
            setRecycledViewPool(viewPool)
            setRecycledViewPool(viewPool)
        }
        }
        observeAppInstall(fusedHome, homeChildRVAdapter)
        observeAppInstall(fusedHome, homeChildRVAdapter)

        handleChildShimmerView(fusedHome, holder)
    }

    private fun handleChildShimmerView(fusedHome: FusedHome, holder: ViewHolder) {
        if (fusedHome.list.isEmpty()) {
            holder.binding.shimmerLayout.visibility = View.VISIBLE
            holder.binding.shimmerLayout.startShimmer()
            holder.binding.childRV.visibility = View.GONE
            return
        }

        holder.binding.shimmerLayout.visibility = View.GONE
        holder.binding.shimmerLayout.stopShimmer()
        holder.binding.childRV.visibility = View.VISIBLE
    }
    }


    private fun observeAppInstall(
    private fun observeAppInstall(
+12 −1
Original line number Original line Diff line number Diff line
@@ -17,9 +17,9 @@
  -->
  -->


<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="wrap_content"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_height="wrap_content"
    xmlns:tools="http://schemas.android.com/tools"
    android:orientation="vertical">
    android:orientation="vertical">


    <RelativeLayout
    <RelativeLayout
@@ -46,6 +46,17 @@
        android:layout_marginTop="10dp"
        android:layout_marginTop="10dp"
        android:layout_marginBottom="10dp">
        android:layout_marginBottom="10dp">


        <com.facebook.shimmer.ShimmerFrameLayout
            android:id="@+id/shimmerLayout"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:orientation="vertical"
            android:visibility="gone">

            <include layout="@layout/shimmer_placeholder_home_category" />
        </com.facebook.shimmer.ShimmerFrameLayout>


        <androidx.recyclerview.widget.RecyclerView
        <androidx.recyclerview.widget.RecyclerView
            android:id="@+id/childRV"
            android:id="@+id/childRV"
            android:layout_width="match_parent"
            android:layout_width="match_parent"
+43 −0
Original line number Original line Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?><!--
  ~ Apps  Quickly and easily install Android apps onto your device!
  ~ Copyright (C) 2023 MURENA SAS
  ~
  ~ This program is free software: you can redistribute it and/or modify
  ~ it under the terms of the GNU General Public License as published by
  ~ the Free Software Foundation, either version 3 of the License, or
  ~ (at your option) any later version.
  ~
  ~ This program is distributed in the hope that it will be useful,
  ~ but WITHOUT ANY WARRANTY; without even the implied warranty of
  ~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  ~ GNU General Public License for more details.
  ~
  ~ You should have received a copy of the GNU General Public License
  ~ along with this program.  If not, see <https://www.gnu.org/licenses/>.
  -->
<HorizontalScrollView xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:scrollbars="none">

    <LinearLayout
        android:layout_width="wrap_content"
        android:layout_height="match_parent"
        android:layout_marginTop="10dp"
        android:layout_marginBottom="10dp"
        android:orientation="horizontal">

        <include layout="@layout/shimmer_placeholder_home_child" />

        <include layout="@layout/shimmer_placeholder_home_child" />

        <include layout="@layout/shimmer_placeholder_home_child" />

        <include layout="@layout/shimmer_placeholder_home_child" />

        <include layout="@layout/shimmer_placeholder_home_child" />

        <include layout="@layout/shimmer_placeholder_home_child" />

    </LinearLayout>
</HorizontalScrollView>