public class ChipsUtil extends Object
Modifier and Type | Class and Description |
---|---|
static interface |
ChipsUtil.PermissionsCheckListener
Listener that gets notified when we check whether we have permission.
|
Modifier and Type | Field and Description |
---|---|
static String[] |
REQUIRED_PERMISSIONS
Permissions required by Chips library.
|
Constructor and Description |
---|
ChipsUtil() |
Modifier and Type | Method and Description |
---|---|
static int |
checkPermission(Context context,
String permission)
Returns
PackageManager.PERMISSION_GRANTED if given permission is granted, or
PackageManager.PERMISSION_DENIED if not. |
static boolean |
hasPermissions(Context context,
ChipsUtil.PermissionsCheckListener permissionsCheckListener)
Returns true if all permissions in
REQUIRED_PERMISSIONS are granted. |
static boolean |
isRunningMOrLater()
Whether we are running on M or later version.
|
static boolean |
supportsChipsUi()
Returns true when the caller can use Chips UI in its environment.
|
public static final String[] REQUIRED_PERMISSIONS
public static boolean supportsChipsUi()
public static boolean isRunningMOrLater()
This is interesting for us because new permission model is introduced in M and we need to
check if we have REQUIRED_PERMISSIONS
.
public static int checkPermission(Context context, String permission)
PackageManager.PERMISSION_GRANTED
if given permission is granted, or
PackageManager.PERMISSION_DENIED
if not.public static boolean hasPermissions(Context context, @Nullable ChipsUtil.PermissionsCheckListener permissionsCheckListener)
REQUIRED_PERMISSIONS
are granted.
If ChipsUtil.PermissionsCheckListener
is specified it will be called for every
checkPermission(android.content.Context, java.lang.String)
call.