Class AdminBrowseProfilesAdapter

java.lang.Object
androidx.recyclerview.widget.RecyclerView.Adapter<AdminBrowseProfilesAdapter.ProfileViewHolder>
com.example.breeze_seas.AdminBrowseProfilesAdapter

public class AdminBrowseProfilesAdapter extends androidx.recyclerview.widget.RecyclerView.Adapter<AdminBrowseProfilesAdapter.ProfileViewHolder>
Adapter for the RecyclerView in the AdminBrowseProfiles screen. Binds a list of User objects to corresponding UI elements. Supports search filtering and item deletion.
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static interface 
    Interface definition for a callback to be invoked when a profile is deleted.
    static class 
    Holds references to the UI components for a single profile row.

    Nested classes/interfaces inherited from class androidx.recyclerview.widget.RecyclerView.Adapter

    androidx.recyclerview.widget.RecyclerView.Adapter.StateRestorationPolicy
  • Constructor Summary

    Constructors
    Constructor
    Description
    Constructs a new AdminBrowseProfilesAdapter.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    filter(String query)
    Filters the displayed list based on a search query.
    int
     
    void
     
    onCreateViewHolder(android.view.ViewGroup parent, int viewType)
     
    void
    Removes a user from both lists and refreshes the view.
    void
    updateList(List<User> newUsers)
    Replaces the full user list from the LiveData source, then refilters.

    Methods inherited from class androidx.recyclerview.widget.RecyclerView.Adapter

    bindViewHolder, createViewHolder, findRelativeAdapterPositionIn, getItemId, getItemViewType, getStateRestorationPolicy, hasObservers, hasStableIds, notifyDataSetChanged, notifyItemChanged, notifyItemChanged, notifyItemInserted, notifyItemMoved, notifyItemRangeChanged, notifyItemRangeChanged, notifyItemRangeInserted, notifyItemRangeRemoved, notifyItemRemoved, onAttachedToRecyclerView, onBindViewHolder, onDetachedFromRecyclerView, onFailedToRecycleView, onViewAttachedToWindow, onViewDetachedFromWindow, onViewRecycled, registerAdapterDataObserver, setHasStableIds, setStateRestorationPolicy, unregisterAdapterDataObserver

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • AdminBrowseProfilesAdapter

      public AdminBrowseProfilesAdapter(List<User> userList, AdminBrowseProfilesAdapter.OnProfileDeleteListener deleteListener)
      Constructs a new AdminBrowseProfilesAdapter.
      Parameters:
      userList - The full list of users to display.
      deleteListener - Callback invoked when the delete button is pressed.
  • Method Details

    • updateList

      public void updateList(List<User> newUsers)
      Replaces the full user list from the LiveData source, then refilters. Called by the fragment whenever the LiveData updates.
      Parameters:
      newUsers - The updated list of users.
    • filter

      public void filter(String query)
      Filters the displayed list based on a search query. Admin accounts are always excluded regardless of query. Matches against display name, username, and device ID (case-insensitive).
      Parameters:
      query - The search string to filter by.
    • removeUser

      public void removeUser(User user)
      Removes a user from both lists and refreshes the view.
      Parameters:
      user - The user to remove.
    • onCreateViewHolder

      @NonNull public AdminBrowseProfilesAdapter.ProfileViewHolder onCreateViewHolder(@NonNull android.view.ViewGroup parent, int viewType)
      Specified by:
      onCreateViewHolder in class androidx.recyclerview.widget.RecyclerView.Adapter<AdminBrowseProfilesAdapter.ProfileViewHolder>
    • onBindViewHolder

      public void onBindViewHolder(@NonNull AdminBrowseProfilesAdapter.ProfileViewHolder holder, int position)
      Specified by:
      onBindViewHolder in class androidx.recyclerview.widget.RecyclerView.Adapter<AdminBrowseProfilesAdapter.ProfileViewHolder>
    • getItemCount

      public int getItemCount()
      Specified by:
      getItemCount in class androidx.recyclerview.widget.RecyclerView.Adapter<AdminBrowseProfilesAdapter.ProfileViewHolder>