ConstraintManager
@RequiresCarApi(value = 2)
public class ConstraintManager implements Manager
Manages various constraints on the library as enforced by the host.
Depending on the host the app is connected to, there could be different various limits that apply, such as the number of items that could be in a list in different templates. An app can use this manager to query for these limits at runtime and react accordingly.
Summary
Constants |
|
|---|---|
static final int |
Represents the limit for contents to be shown in a grid format. |
static final int |
Represents the limit for generic, uniform list contents. |
static final int |
Represents the limit for contents to be shown in a pane format. |
static final int |
Represents the limit for list contents that are associated with points of interest. |
static final int |
Represents the limit for list contents that are associated with navigation routes. |
Public methods |
|
|---|---|
int |
getContentLimit(int contentLimitType)Requests for the limit associated with the |
boolean |
@RequiresCarApi(value = 6)Determines if the hosts supports App Driven Refresh. |
Constants
CONTENT_LIMIT_TYPE_GRID
public static final int CONTENT_LIMIT_TYPE_GRID = 1
Represents the limit for contents to be shown in a grid format.
The limit of this type should be no smaller than the values defined in content_limit_grid, but the host may support a larger limit.
CONTENT_LIMIT_TYPE_LIST
public static final int CONTENT_LIMIT_TYPE_LIST = 0
Represents the limit for generic, uniform list contents.
The limit of this type should be no smaller than the values defined in content_limit_list, but the host may support a larger limit.
CONTENT_LIMIT_TYPE_PANE
public static final int CONTENT_LIMIT_TYPE_PANE = 4
Represents the limit for contents to be shown in a pane format.
The limit of this type should be no smaller than the values defined in content_limit_pane, but the host may support a larger limit.
CONTENT_LIMIT_TYPE_PLACE_LIST
public static final int CONTENT_LIMIT_TYPE_PLACE_LIST = 2
Represents the limit for list contents that are associated with points of interest.
The limit of this type should be no smaller than the values defined in content_limit_place_list, but the host may support a larger limit.
CONTENT_LIMIT_TYPE_ROUTE_LIST
public static final int CONTENT_LIMIT_TYPE_ROUTE_LIST = 3
Represents the limit for list contents that are associated with navigation routes.
The limit of this type should be no smaller than the values defined in content_limit_route_list, but the host may support a larger limit.
Public methods
getContentLimit
public int getContentLimit(int contentLimitType)
Requests for the limit associated with the contentLimitType.
| Throws | |
|---|---|
androidx.car.app.HostException |
if the remote call fails |
isAppDrivenRefreshEnabled
@RequiresCarApi(value = 6)
public boolean isAppDrivenRefreshEnabled()
Determines if the hosts supports App Driven Refresh. This enables applications to refresh lists content without being counted towards a step. If this function returns false the app should return a template that is of the same type and contains the same main content as the previous template, the new template will not be counted against the quota.