Loading app/src/main/java/foundation/e/apps/updates/UpdatesFragment.kt +16 −4 Original line number Diff line number Diff line Loading @@ -18,6 +18,7 @@ package foundation.e.apps.updates import android.os.Bundle import android.os.Handler import android.view.LayoutInflater import android.view.View import android.view.ViewGroup Loading Loading @@ -59,6 +60,7 @@ class UpdatesFragment : Fragment() { val updateAll = view.findViewById<Button>(R.id.update_all) val splashContainer = view.findViewById<LinearLayout>(R.id.splash_container) val progressBar = view.findViewById<ProgressBar>(R.id.progress_bar) val reloadProgressBar = view.findViewById<ProgressBar>(R.id.progress_bar2) val errorContainer = view.findViewById<LinearLayout>(R.id.error_container) val errorDescription = view.findViewById<TextView>(R.id.error_description) Loading @@ -74,6 +76,7 @@ class UpdatesFragment : Fragment() { } } progressBar.visibility = View.VISIBLE reloadProgressBar.visibility = View.GONE errorContainer.visibility = View.GONE splashContainer.visibility = View.GONE view.findViewById<TextView>(R.id.error_resolve).setOnClickListener { Loading @@ -90,9 +93,12 @@ class UpdatesFragment : Fragment() { // Bind recycler view adapter to outdated applications list in view model updatesViewModel.getApplications().observe(this, Observer { if (it != null) { applicationList.clear() applicationList.addAll(it) progressBar.visibility = View.GONE reloadProgressBar.visibility=View.GONE recyclerView.adapter?.notifyDataSetChanged() recyclerView.scrollToPosition(0) if (applicationList.isEmpty()) { Loading @@ -114,28 +120,34 @@ class UpdatesFragment : Fragment() { errorContainer.visibility = View.VISIBLE updateAll.isEnabled = false progressBar.visibility = View.GONE reloadProgressBar.visibility = View.GONE splashContainer.visibility = View.GONE recyclerView.visibility = View.GONE } else { errorContainer.visibility = View.GONE } }) if (updatesViewModel.getApplications().value == null || updatesViewModel.getApplications().value!!.isEmpty()) { updatesViewModel.loadApplicationList(context!!) } return view } override fun onResume() { super.onResume() val progressBar2 = view!!.findViewById<ProgressBar>(R.id.progress_bar2) if (::updatesViewModel.isInitialized) { updatesViewModel.getApplications().value?.let { it.forEach { application -> progressBar2.visibility=View.VISIBLE application.checkForStateUpdate(context!!) } val handler = Handler() handler.postDelayed({ progressBar2.visibility=View.GONE }, 10000) } } } Loading app/src/main/res/layout/fragment_updates.xml +15 −2 Original line number Diff line number Diff line Loading @@ -19,6 +19,7 @@ <androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent"> Loading @@ -32,7 +33,6 @@ android:theme="@style/ThemeOverlay.AppCompat.ActionBar" app:layout_constraintTop_toTopOf="parent" app:popupTheme="@style/AlertDialog.AppCompat.Light"> <RelativeLayout android:layout_width="match_parent" android:layout_height="wrap_content"> Loading Loading @@ -70,13 +70,26 @@ </androidx.appcompat.widget.Toolbar> <ProgressBar android:id="@+id/progress_bar2" style="@style/Widget.AppCompat.ProgressBar.Horizontal" android:layout_width="match_parent" android:layout_height="wrap_content" android:indeterminate="true" android:paddingBottom="5dp" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintTop_toBottomOf="@id/toolbar" app:layout_constraintVertical_bias="0.0" tools:layout_editor_absoluteX="111dp"/> <androidx.recyclerview.widget.RecyclerView android:id="@+id/app_list" android:layout_width="match_parent" android:layout_height="0dp" android:scrollbars="none" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintTop_toBottomOf="@id/toolbar" /> app:layout_constraintTop_toBottomOf="@id/progress_bar2"/> <include layout="@layout/updates_splash_layout" Loading Loading
app/src/main/java/foundation/e/apps/updates/UpdatesFragment.kt +16 −4 Original line number Diff line number Diff line Loading @@ -18,6 +18,7 @@ package foundation.e.apps.updates import android.os.Bundle import android.os.Handler import android.view.LayoutInflater import android.view.View import android.view.ViewGroup Loading Loading @@ -59,6 +60,7 @@ class UpdatesFragment : Fragment() { val updateAll = view.findViewById<Button>(R.id.update_all) val splashContainer = view.findViewById<LinearLayout>(R.id.splash_container) val progressBar = view.findViewById<ProgressBar>(R.id.progress_bar) val reloadProgressBar = view.findViewById<ProgressBar>(R.id.progress_bar2) val errorContainer = view.findViewById<LinearLayout>(R.id.error_container) val errorDescription = view.findViewById<TextView>(R.id.error_description) Loading @@ -74,6 +76,7 @@ class UpdatesFragment : Fragment() { } } progressBar.visibility = View.VISIBLE reloadProgressBar.visibility = View.GONE errorContainer.visibility = View.GONE splashContainer.visibility = View.GONE view.findViewById<TextView>(R.id.error_resolve).setOnClickListener { Loading @@ -90,9 +93,12 @@ class UpdatesFragment : Fragment() { // Bind recycler view adapter to outdated applications list in view model updatesViewModel.getApplications().observe(this, Observer { if (it != null) { applicationList.clear() applicationList.addAll(it) progressBar.visibility = View.GONE reloadProgressBar.visibility=View.GONE recyclerView.adapter?.notifyDataSetChanged() recyclerView.scrollToPosition(0) if (applicationList.isEmpty()) { Loading @@ -114,28 +120,34 @@ class UpdatesFragment : Fragment() { errorContainer.visibility = View.VISIBLE updateAll.isEnabled = false progressBar.visibility = View.GONE reloadProgressBar.visibility = View.GONE splashContainer.visibility = View.GONE recyclerView.visibility = View.GONE } else { errorContainer.visibility = View.GONE } }) if (updatesViewModel.getApplications().value == null || updatesViewModel.getApplications().value!!.isEmpty()) { updatesViewModel.loadApplicationList(context!!) } return view } override fun onResume() { super.onResume() val progressBar2 = view!!.findViewById<ProgressBar>(R.id.progress_bar2) if (::updatesViewModel.isInitialized) { updatesViewModel.getApplications().value?.let { it.forEach { application -> progressBar2.visibility=View.VISIBLE application.checkForStateUpdate(context!!) } val handler = Handler() handler.postDelayed({ progressBar2.visibility=View.GONE }, 10000) } } } Loading
app/src/main/res/layout/fragment_updates.xml +15 −2 Original line number Diff line number Diff line Loading @@ -19,6 +19,7 @@ <androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent"> Loading @@ -32,7 +33,6 @@ android:theme="@style/ThemeOverlay.AppCompat.ActionBar" app:layout_constraintTop_toTopOf="parent" app:popupTheme="@style/AlertDialog.AppCompat.Light"> <RelativeLayout android:layout_width="match_parent" android:layout_height="wrap_content"> Loading Loading @@ -70,13 +70,26 @@ </androidx.appcompat.widget.Toolbar> <ProgressBar android:id="@+id/progress_bar2" style="@style/Widget.AppCompat.ProgressBar.Horizontal" android:layout_width="match_parent" android:layout_height="wrap_content" android:indeterminate="true" android:paddingBottom="5dp" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintTop_toBottomOf="@id/toolbar" app:layout_constraintVertical_bias="0.0" tools:layout_editor_absoluteX="111dp"/> <androidx.recyclerview.widget.RecyclerView android:id="@+id/app_list" android:layout_width="match_parent" android:layout_height="0dp" android:scrollbars="none" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintTop_toBottomOf="@id/toolbar" /> app:layout_constraintTop_toBottomOf="@id/progress_bar2"/> <include layout="@layout/updates_splash_layout" Loading