SeslAppPickerView

An abstract base class for views that display a list or grid of applications, allowing users to pick one or more.

This class extends RecyclerView and implements several interfaces to manage application data, selection state, and user interactions.

Key features:

  • Supports both list and grid layouts.

  • Handles different ordering options for the application list.

  • Allows customization of subheader appearance (solid or transparent).

  • Provides methods for adding, removing, and updating application items.

  • Manages item selection state.

  • Integrates with AppDataRepository for data fetching and SelectStateLoader for managing selection.

  • Uses strategy pattern for customizing data handling and presentation logic.

Subclasses must implement getAppPickerAdapter and getLayoutManager to provide the specific adapter and layout manager for the chosen view type (list or grid).

XML attributes:

  • strategy: (Optional) The fully qualified class name of the Strategy implementation to use. Defaults to androidx.picker.controller.strategy.AppItemStrategy.

  • appPickerContextClass: (Optional) The fully qualified class name of the androidx.picker.di.AppPickerContext implementation to use. Defaults to androidx.picker.di.AppPickerContext.

  • seslRoundedCorner: (Optional) Integer value to set the rounded corner radius for items. Defaults to 15.

  • pickerApp_subHeaderType: (Optional) Defines the subheader style. Can be SUBHEADER_TYPE_SOLID (0) or SUBHEADER_TYPE_TRANSPARENT (1). Defaults to SUBHEADER_TYPE_SOLID.

Inheritors

Constructors

Link copied to clipboard
constructor(context: Context, attrs: AttributeSet? = null, defStyleAttr: Int = 0)

Types

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
object Companion
Link copied to clipboard

Interface definition for a callback to be invoked when a search filter operation is completed.

Properties

Link copied to clipboard
Link copied to clipboard

The repository responsible for providing application data.

Link copied to clipboard

The order in which the application list is sorted.

Link copied to clipboard

The adapter responsible for managing the header and footer views in the list.

Link copied to clipboard
open override val logTag: String
Link copied to clipboard

The current view type of the app picker.

Functions

Link copied to clipboard
fun addFooter(title: String)

Adds a footer view to the list with the given string as its text content.

fun addFooter(view: View, roundedCorner: Int = ROUNDED_CORNER_ALL)

Adds a footer view to the list.

Link copied to clipboard
fun addHeader(title: String)

Adds a header view to the list with the given string as its text content.

fun addHeader(view: View, roundedCorner: Int = ROUNDED_CORNER_NONE)

Adds a header view to the top of the list.

Link copied to clipboard
Link copied to clipboard
fun getAppData(appInfo: AppInfo): AppData?

Convenience method for ViewDataController.getAppData

Link copied to clipboard
abstract fun getAppPickerAdapter(viewType: Int): AbsAdapter

Returns an AbsAdapter instance to be used for the given viewType type.

Link copied to clipboard

Returns a LayoutManager instance to be used for the given view type.

Link copied to clipboard
open override fun getState(appInfo: AppInfo): Boolean

Retrieves the current selection state of the specified application.

Link copied to clipboard
open fun initialize()

Initializes the view and sets up any required resources or listeners. This is be called inside init of the concrete subclasses after setting the viewType.

Link copied to clipboard
open override fun onBindViewHolder(viewHolder: PickerViewHolder, viewData: ViewData)

Called to set and update the click listener for viewHolder's item view.

Link copied to clipboard
open override fun onViewRecycled(viewHolder: RecyclerView.ViewHolder)
Link copied to clipboard

Removes a specific application item from the list.

Link copied to clipboard

Removes a list of AppData items from the view.

Link copied to clipboard
fun scrollToAppInfo(appInfo: AppInfo, induce: Boolean = false, smoothScroll: Boolean = false): Long

Scrolls the list to the item corresponding to the given AppInfo.

Link copied to clipboard
open fun setItemDecoration(i: Int, headerFooterAdapter: HeaderFooterAdapter)
Link copied to clipboard

Sets the listener to be called when an action button in an item is clicked.

Link copied to clipboard

Sets the listener to be called when an item in the list is clicked.

Link copied to clipboard

Sets a listener to be notified of changes in the selection state of items.

Link copied to clipboard

Sets a search filter on the adapter.

Link copied to clipboard
open override fun setState(appInfo: AppInfo, isSelected: Boolean)

Updates the selection state of the item associated with the given appInfo.

Link copied to clipboard
open override fun setStateAll(isAllSelected: Boolean)

Updates the selection state of all applications currently displayed in the list.

Link copied to clipboard
fun smoothScrollToAppInfo(appInfo: AppInfo, induce: Boolean = false): Long

Smoothly scrolls the list to the item corresponding to the given AppInfo.

Link copied to clipboard
fun submitList(list: List<AppData>? = null)

Submits a new list of AppData to be displayed.

Link copied to clipboard
fun updateItem(appData: AppData)

Updates an existing application item in the list with new data.

Link copied to clipboard

Updates the list of selectable items in the SelectStateLoader.