Loading app/src/main/java/io/eelo/appinstaller/updates/UpdatesFragment.kt +14 −0 Original line number Diff line number Diff line Loading @@ -9,11 +9,13 @@ import android.support.v7.widget.RecyclerView import android.view.LayoutInflater import android.view.View import android.view.ViewGroup import android.widget.Button import android.widget.LinearLayout import android.widget.ProgressBar import android.widget.TextView import io.eelo.appinstaller.R import io.eelo.appinstaller.application.model.Application import io.eelo.appinstaller.application.model.State import io.eelo.appinstaller.applicationmanager.ApplicationManager import io.eelo.appinstaller.common.ApplicationListAdapter import io.eelo.appinstaller.updates.viewModel.UpdatesViewModel Loading @@ -38,6 +40,7 @@ class UpdatesFragment : Fragment() { updatesViewModel = ViewModelProviders.of(activity!!).get(UpdatesViewModel::class.java) recyclerView = view.findViewById(R.id.app_list) 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 errorContainer = view.findViewById<LinearLayout>(R.id.error_container) Loading @@ -46,10 +49,19 @@ class UpdatesFragment : Fragment() { // Initialise UI elements updatesViewModel.initialise(applicationManager!!) recyclerView.visibility = View.GONE updateAll.isEnabled = false updateAll.setOnClickListener { applicationList.forEach { application -> if (application.state == State.NOT_UPDATED) { application.buttonClicked(activity!!) } } } progressBar.visibility = View.VISIBLE errorContainer.visibility = View.GONE splashContainer.visibility = View.GONE view.findViewById<TextView>(R.id.error_resolve).setOnClickListener { updateAll.isEnabled = false progressBar.visibility = View.VISIBLE updatesViewModel.loadApplicationList(context!!) } Loading @@ -64,6 +76,7 @@ class UpdatesFragment : Fragment() { if (it != null) { applicationList.clear() applicationList.addAll(it) updateAll.isEnabled = true progressBar.visibility = View.GONE recyclerView.adapter.notifyDataSetChanged() recyclerView.scrollToPosition(0) Loading @@ -82,6 +95,7 @@ class UpdatesFragment : Fragment() { if (it != null) { errorDescription.text = activity!!.getString(Common.getScreenErrorDescriptionId(it)) errorContainer.visibility = View.VISIBLE updateAll.isEnabled = false progressBar.visibility = View.GONE splashContainer.visibility = View.GONE recyclerView.visibility = View.GONE Loading app/src/main/res/layout/fragment_updates.xml +0 −1 Original line number Diff line number Diff line Loading @@ -16,7 +16,6 @@ app:popupTheme="@style/AlertDialog.AppCompat.Light"> <RelativeLayout android:id="@+id/update_all_container" android:layout_width="match_parent" android:layout_height="wrap_content"> Loading app/src/main/res/values/strings.xml +0 −3 Original line number Diff line number Diff line Loading @@ -65,9 +65,6 @@ <string name="updates_splash_title">All apps are up-to-date</string> <!-- Settings Fragment --> <string name="preference_theme_title">Theme</string> <string name="preference_theme_dark_title">Dark theme</string> <string name="preference_theme_dark_description">Use a dark theme throughout the app</string> <string name="preference_updates_title">Updates</string> <string name="preference_update_interval_default">24</string> <string name="preference_update_interval_title">Automatic update interval</string> Loading app/src/main/res/xml/preferences.xml +0 −10 Original line number Diff line number Diff line Loading @@ -3,16 +3,6 @@ android:layout_width="match_parent" android:layout_height="match_parent"> <PreferenceCategory android:title="@string/preference_theme_title"> <SwitchPreference android:defaultValue="false" android:key="pref_theme_dark" android:summary="@string/preference_theme_dark_description" android:title="@string/preference_theme_dark_title" /> </PreferenceCategory> <PreferenceCategory android:title="@string/preference_updates_title"> <ListPreference Loading Loading
app/src/main/java/io/eelo/appinstaller/updates/UpdatesFragment.kt +14 −0 Original line number Diff line number Diff line Loading @@ -9,11 +9,13 @@ import android.support.v7.widget.RecyclerView import android.view.LayoutInflater import android.view.View import android.view.ViewGroup import android.widget.Button import android.widget.LinearLayout import android.widget.ProgressBar import android.widget.TextView import io.eelo.appinstaller.R import io.eelo.appinstaller.application.model.Application import io.eelo.appinstaller.application.model.State import io.eelo.appinstaller.applicationmanager.ApplicationManager import io.eelo.appinstaller.common.ApplicationListAdapter import io.eelo.appinstaller.updates.viewModel.UpdatesViewModel Loading @@ -38,6 +40,7 @@ class UpdatesFragment : Fragment() { updatesViewModel = ViewModelProviders.of(activity!!).get(UpdatesViewModel::class.java) recyclerView = view.findViewById(R.id.app_list) 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 errorContainer = view.findViewById<LinearLayout>(R.id.error_container) Loading @@ -46,10 +49,19 @@ class UpdatesFragment : Fragment() { // Initialise UI elements updatesViewModel.initialise(applicationManager!!) recyclerView.visibility = View.GONE updateAll.isEnabled = false updateAll.setOnClickListener { applicationList.forEach { application -> if (application.state == State.NOT_UPDATED) { application.buttonClicked(activity!!) } } } progressBar.visibility = View.VISIBLE errorContainer.visibility = View.GONE splashContainer.visibility = View.GONE view.findViewById<TextView>(R.id.error_resolve).setOnClickListener { updateAll.isEnabled = false progressBar.visibility = View.VISIBLE updatesViewModel.loadApplicationList(context!!) } Loading @@ -64,6 +76,7 @@ class UpdatesFragment : Fragment() { if (it != null) { applicationList.clear() applicationList.addAll(it) updateAll.isEnabled = true progressBar.visibility = View.GONE recyclerView.adapter.notifyDataSetChanged() recyclerView.scrollToPosition(0) Loading @@ -82,6 +95,7 @@ class UpdatesFragment : Fragment() { if (it != null) { errorDescription.text = activity!!.getString(Common.getScreenErrorDescriptionId(it)) errorContainer.visibility = View.VISIBLE updateAll.isEnabled = false progressBar.visibility = View.GONE splashContainer.visibility = View.GONE recyclerView.visibility = View.GONE Loading
app/src/main/res/layout/fragment_updates.xml +0 −1 Original line number Diff line number Diff line Loading @@ -16,7 +16,6 @@ app:popupTheme="@style/AlertDialog.AppCompat.Light"> <RelativeLayout android:id="@+id/update_all_container" android:layout_width="match_parent" android:layout_height="wrap_content"> Loading
app/src/main/res/values/strings.xml +0 −3 Original line number Diff line number Diff line Loading @@ -65,9 +65,6 @@ <string name="updates_splash_title">All apps are up-to-date</string> <!-- Settings Fragment --> <string name="preference_theme_title">Theme</string> <string name="preference_theme_dark_title">Dark theme</string> <string name="preference_theme_dark_description">Use a dark theme throughout the app</string> <string name="preference_updates_title">Updates</string> <string name="preference_update_interval_default">24</string> <string name="preference_update_interval_title">Automatic update interval</string> Loading
app/src/main/res/xml/preferences.xml +0 −10 Original line number Diff line number Diff line Loading @@ -3,16 +3,6 @@ android:layout_width="match_parent" android:layout_height="match_parent"> <PreferenceCategory android:title="@string/preference_theme_title"> <SwitchPreference android:defaultValue="false" android:key="pref_theme_dark" android:summary="@string/preference_theme_dark_description" android:title="@string/preference_theme_dark_title" /> </PreferenceCategory> <PreferenceCategory android:title="@string/preference_updates_title"> <ListPreference Loading