Fast Filter View¶
The FastFilterView
UI component allows users to quickly apply multiple filters.
Using the FastFilterView
¶
You can use FastFilterView
within your activity like any traditional Android view:
<com.sap.cloud.mobile.fiori.listControls.FastFilterView
android:id="@+id/fastFilter"
.../>
Setting FastFilterOptions
on FastFilterView
¶
You can set the options presented by FastFilterView
using public void setFastFilterOptions(@NonNull List<FastFilterOption>)
.
FastFilterOption
¶
FastFilterOption
is a Parcelable
class used to configure the options presented in FastFilterView
. Every option can be configured to:
- Contain a chip icon when selected
- Be removed from the
FastFilterView
when deselected
You can provide a list of FastFilterOption
s to configure the available options on FastFilterView
.
Preselecting Values on FastFilterView
¶
You can set the value on FastFilterView
by using public void setValue(@NonNull List<FastFilterOption> value)
. Please note that this
API ignores the FastFilterOptions
that were not provided in a previous call of public void setFastFilterOptions(@NonNull List<FastFilterOption>)
.
Callbacks for Value Changes¶
You can listen to changes caused by user interaction by attaching a listener using public void setValueChangeListener(@Nullable ValueChangeListener listener)
.
fastFilter.setValueChangeListener { value -> value?.let { mModel.applyFilter(it) } }
Utilities for FastFilterView
and Feedback Filter¶
In some applications it is desirable to present quick filters along with the option to explore large, category-based filtering options in a separate dialog or activity (known as FeedbackFilter
in Fiori design). In these cases, the application needs to communicate the user selections from the FeedbackFilter
to the original Activity
. To help applications integrate these scenarios with FastFilterView
, the SDK provides helper classes.
FeedbackDialogLifecycleObserver
¶
This class is a life cycle observer and broadcasts the user selections from the FeedbackFilter
to be caught during the original activity. When you attach an object of this class as a life cycle observer then you will only need to override one method.
FastFilterValueReceiver
¶
This class helps FastFilterView
to catch the user selection broadcast from FeedbackDialogLifecycleObserver
. You only need to create
an instance of the FastFilterValueReceiver
class by passing the reference of the FastFilterView
and LifeCycleOwner
. Handling of receiving the broadcast, filter options, and communicating desired changes to FastFilterView
are handled by the SDK.