diff --git a/PennMobile/src/main/java/com/pennapps/labs/pennmobile/DiningFragment.kt b/PennMobile/src/main/java/com/pennapps/labs/pennmobile/DiningFragment.kt index cf9df2dd..06fd4a0e 100644 --- a/PennMobile/src/main/java/com/pennapps/labs/pennmobile/DiningFragment.kt +++ b/PennMobile/src/main/java/com/pennapps/labs/pennmobile/DiningFragment.kt @@ -27,8 +27,6 @@ import java.time.format.DateTimeFormatter class DiningFragment : Fragment() { private lateinit var mActivity: MainActivity private lateinit var mStudentLife: StudentLife - private lateinit var loadingPanel: View - private lateinit var noResults: View private var _binding: FragmentDiningBinding? = null val binding get() = _binding!! @@ -74,8 +72,6 @@ class DiningFragment : Fragment() { savedInstanceState: Bundle?, ) { super.onViewCreated(view, savedInstanceState) - loadingPanel = view.findViewById(R.id.loadingPanel) - noResults = view.findViewById(R.id.no_results) getDiningHalls() } @@ -167,9 +163,9 @@ class DiningFragment : Fragment() { mActivity.runOnUiThread { getMenus(diningHalls) val adapter = DiningAdapter(diningHalls) - loadingPanel?.visibility = View.GONE + binding.loadingPanel.root.visibility = View.GONE if (diningHalls.size > 0) { - noResults?.visibility = View.GONE + binding.noResults.root.visibility = View.GONE } // Log non-fatal error to crashyltics if null @@ -188,7 +184,7 @@ class DiningFragment : Fragment() { Log.e("DiningFragment", "Error getting dining halls", it) mActivity.runOnUiThread { Log.e("Dining", "Could not load Dining page", it) - loadingPanel?.visibility = View.GONE + binding.loadingPanel.root.visibility = View.GONE binding.diningSwiperefresh.isRefreshing = false } }) diff --git a/PennMobile/src/main/java/com/pennapps/labs/pennmobile/GsrReservationsFragment.kt b/PennMobile/src/main/java/com/pennapps/labs/pennmobile/GsrReservationsFragment.kt index b0ac756f..a0736ce7 100644 --- a/PennMobile/src/main/java/com/pennapps/labs/pennmobile/GsrReservationsFragment.kt +++ b/PennMobile/src/main/java/com/pennapps/labs/pennmobile/GsrReservationsFragment.kt @@ -19,7 +19,6 @@ import com.pennapps.labs.pennmobile.databinding.FragmentGsrReservationsBinding class GsrReservationsFragment : Fragment() { private lateinit var mActivity: MainActivity - private lateinit var loadingPanel: View private var _binding: FragmentGsrReservationsBinding? = null val binding get() = _binding!! @@ -65,13 +64,12 @@ class GsrReservationsFragment : Fragment() { savedInstanceState: Bundle?, ) { super.onViewCreated(view, savedInstanceState) - loadingPanel = view.findViewById(R.id.loadingPanel) if (!isOnline(context)) { binding.internetConnectionGSRReservations.setBackgroundColor(resources.getColor(R.color.darkRedBackground)) binding.internetConnectionMessageGsrReservations.text = "Not Connected to Internet" binding.internetConnectionGSRReservations.visibility = View.VISIBLE binding.gsrReservationsRefreshLayout.isRefreshing = false - loadingPanel?.visibility = View.GONE + binding.loadingPanel.root.visibility = View.GONE binding.gsrNoReservations.visibility = View.VISIBLE } else { binding.internetConnectionGSRReservations.visibility = View.GONE @@ -85,7 +83,7 @@ class GsrReservationsFragment : Fragment() { binding.internetConnectionGSRReservations.visibility = View.VISIBLE binding.gsrReservationsRefreshLayout.isRefreshing = false binding.gsrReservationsRv.adapter = GsrReservationsAdapter(ArrayList()) - loadingPanel?.visibility = View.GONE + binding.loadingPanel.root.visibility = View.GONE binding.gsrNoReservations.visibility = View.VISIBLE } else { binding.internetConnectionGSRReservations.visibility = View.GONE @@ -102,7 +100,7 @@ class GsrReservationsFragment : Fragment() { try { labs.getGsrReservations("Bearer $token").subscribe({ reservations -> mActivity.runOnUiThread { - loadingPanel?.visibility = View.GONE + binding.loadingPanel.root.visibility = View.GONE try { binding.gsrReservationsRv.adapter = GsrReservationsAdapter(ArrayList(reservations)) @@ -121,7 +119,7 @@ class GsrReservationsFragment : Fragment() { mActivity.runOnUiThread { Log.e("GsrReservationsFragment", "Error getting reservations", throwable) throwable.printStackTrace() - loadingPanel?.visibility = View.GONE + binding.loadingPanel.root.visibility = View.GONE try { binding.gsrReservationsRv.adapter = GsrReservationsAdapter(ArrayList()) binding.gsrNoReservations.visibility = View.VISIBLE diff --git a/PennMobile/src/main/java/com/pennapps/labs/pennmobile/HomeFragment.kt b/PennMobile/src/main/java/com/pennapps/labs/pennmobile/HomeFragment.kt index 0edca9c5..9638ff0b 100644 --- a/PennMobile/src/main/java/com/pennapps/labs/pennmobile/HomeFragment.kt +++ b/PennMobile/src/main/java/com/pennapps/labs/pennmobile/HomeFragment.kt @@ -29,7 +29,6 @@ import java.util.Locale class HomeFragment : Fragment() { private lateinit var mActivity: MainActivity private lateinit var sharedPreferences: SharedPreferences - private lateinit var loadingPanel: View private lateinit var toolbar: Toolbar private var _binding: FragmentHomeBinding? = null @@ -84,7 +83,6 @@ class HomeFragment : Fragment() { set to View.VISIBLE instead of View.INVISIBLE and hide loadingPanel */ toolbar = mActivity.findViewById(R.id.toolbar) - loadingPanel = view.findViewById(R.id.loadingPanel) binding.homeCellsRv.layoutManager = LinearLayoutManager( context, @@ -102,7 +100,7 @@ class HomeFragment : Fragment() { homepageViewModel.blurViewsLoaded.observe(viewLifecycleOwner) { loaded -> if (loaded) { binding.homeCellsRv.visibility = View.VISIBLE - loadingPanel?.visibility = View.GONE + binding.loadingPanel.root.visibility = View.GONE } } @@ -132,7 +130,7 @@ class HomeFragment : Fragment() { binding.homeCellsRv.setPadding(0, 90, 0, 0) binding.internetConnectionHome.visibility = View.VISIBLE binding.homeRefreshLayout.isRefreshing = false - loadingPanel?.visibility = View.GONE + binding.loadingPanel.root.visibility = View.GONE return false } diff --git a/PennMobile/src/main/java/com/pennapps/labs/pennmobile/LaundryFragment.kt b/PennMobile/src/main/java/com/pennapps/labs/pennmobile/LaundryFragment.kt index e8bf1e36..be27fb20 100644 --- a/PennMobile/src/main/java/com/pennapps/labs/pennmobile/LaundryFragment.kt +++ b/PennMobile/src/main/java/com/pennapps/labs/pennmobile/LaundryFragment.kt @@ -26,7 +26,6 @@ class LaundryFragment : Fragment() { private lateinit var mStudentLife: StudentLifeRf2 private lateinit var mContext: Context - private lateinit var loadingPanel: View private lateinit var sharedPreferences: SharedPreferences @@ -84,12 +83,10 @@ class LaundryFragment : Fragment() { mActivity.removeTabs() mActivity.setTitle(R.string.laundry) - loadingPanel = view.findViewById(R.id.loadingPanel) - mAdapter = LaundryRoomAdapter(mContext, laundryRooms, roomsData, false) binding.favoriteLaundryList.adapter = mAdapter - loadingPanel.visibility = View.VISIBLE + binding.loadingPanel.root.visibility = View.VISIBLE laundryViewModel.favoriteRooms.observe(viewLifecycleOwner) { favorites -> binding.laundryMachineRefresh.isRefreshing = false @@ -108,7 +105,7 @@ class LaundryFragment : Fragment() { mAdapter!!.notifyItemChanged(pos) } - loadingPanel.visibility = View.GONE + binding.loadingPanel.root.visibility = View.GONE binding.laundryHelpText.visibility = View.INVISIBLE } @@ -123,7 +120,7 @@ class LaundryFragment : Fragment() { binding.internetConnectionLaundry.visibility = View.VISIBLE binding.laundryHelpText.visibility = View.INVISIBLE binding.laundryMachineRefresh.isRefreshing = false - loadingPanel?.visibility = View.GONE + binding.loadingPanel.root.visibility = View.GONE return false } diff --git a/PennMobile/src/main/java/com/pennapps/labs/pennmobile/PottruckFragment.kt b/PennMobile/src/main/java/com/pennapps/labs/pennmobile/PottruckFragment.kt index 648cf040..44180931 100644 --- a/PennMobile/src/main/java/com/pennapps/labs/pennmobile/PottruckFragment.kt +++ b/PennMobile/src/main/java/com/pennapps/labs/pennmobile/PottruckFragment.kt @@ -32,7 +32,6 @@ class PottruckFragment : Fragment() { private lateinit var mView: View private lateinit var swipeRefresh: SwipeRefreshLayout private lateinit var recyclerView: RecyclerView - private lateinit var loadingPanel: View private lateinit var dataModel: FitnessPreferenceViewModel private lateinit var favoritesAdapter: FitnessAdapter @@ -73,7 +72,6 @@ class PottruckFragment : Fragment() { swipeRefresh = binding.swiperefreshFitness recyclerView = binding.recyclerViewFitnessRooms - loadingPanel = view.findViewById(R.id.loadingPanel) swipeRefresh.setColorSchemeResources(R.color.color_accent, R.color.color_primary) recyclerView.layoutManager = @@ -134,7 +132,7 @@ class PottruckFragment : Fragment() { Log.e("PottruckFragment", "Error getting fitness rooms", it) mActivity.runOnUiThread { Log.e("Fitness", "Could not load Pottruck page", it) - loadingPanel.visibility = View.GONE + binding.loadingPanel.root.visibility = View.GONE swipeRefresh.isRefreshing = false } }) @@ -159,7 +157,7 @@ class PottruckFragment : Fragment() { ) recyclerView.adapter = concatAdapter - loadingPanel.visibility = View.GONE + binding.loadingPanel.root.visibility = View.GONE swipeRefresh.isRefreshing = false // set click listener for favorites button @@ -198,7 +196,7 @@ class PottruckFragment : Fragment() { ) connectionMessage.text = getString(R.string.internet_error) connectionToolbar.visibility = View.VISIBLE - loadingPanel.visibility = View.GONE + binding.loadingPanel.root.visibility = View.GONE swipeRefresh.isRefreshing = false return false } diff --git a/PennMobile/src/main/res/layout/fragment_dining.xml b/PennMobile/src/main/res/layout/fragment_dining.xml index 79baf3ea..163228c3 100644 --- a/PennMobile/src/main/res/layout/fragment_dining.xml +++ b/PennMobile/src/main/res/layout/fragment_dining.xml @@ -28,9 +28,13 @@ - + - + - + \ No newline at end of file diff --git a/PennMobile/src/main/res/layout/fragment_home.xml b/PennMobile/src/main/res/layout/fragment_home.xml index 9c731517..da74ac79 100644 --- a/PennMobile/src/main/res/layout/fragment_home.xml +++ b/PennMobile/src/main/res/layout/fragment_home.xml @@ -135,7 +135,9 @@ - + - + - +