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

Commit 2eff0002 authored by Nihar Thakkar's avatar Nihar Thakkar
Browse files

Create ProgressBar on updates screen

parent 9f53b74d
Loading
Loading
Loading
Loading
+8 −2
Original line number Diff line number Diff line
@@ -9,6 +9,7 @@ import android.support.v7.widget.RecyclerView
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.ProgressBar
import io.eelo.appinstaller.R
import io.eelo.appinstaller.application.model.InstallManager
import io.eelo.appinstaller.common.ApplicationListAdapter
@@ -27,13 +28,18 @@ class UpdatesFragment : Fragment() {

        updatesViewModel = ViewModelProviders.of(activity!!).get(UpdatesViewModel::class.java)
        val recyclerView = view.findViewById<RecyclerView>(R.id.app_list)
        val progressBar = view.findViewById<ProgressBar>(R.id.progress_bar)

        initializeRecyclerView(recyclerView)
        updatesViewModel.initialise(installManager!!)
        initializeRecyclerView(recyclerView)
        progressBar.visibility = View.VISIBLE

        // Bind recycler view adapter to search results list in view model
        updatesViewModel.getApplications().observe(this, Observer {
            if (it!!.isNotEmpty()) {
                recyclerView.adapter.notifyDataSetChanged()
                progressBar.visibility = View.GONE
            }
        })

        updatesViewModel.loadApplicationList(context!!)
+11 −2
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    xmlns:app="http://schemas.android.com/apk/res-auto">
    android:layout_height="match_parent">

    <android.support.v7.widget.RecyclerView
        android:id="@+id/app_list"
@@ -12,4 +12,13 @@
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintTop_toTopOf="parent" />

    <ProgressBar
        android:id="@+id/progress_bar"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toTopOf="parent" />

</android.support.constraint.ConstraintLayout>