public class Utils extends Object
Constructor and Description |
---|
Utils() |
Modifier and Type | Method and Description |
---|---|
static String |
formatPercentage(int percentage)
Formats an integer from 0..100 as a percentage.
|
static String |
formatPercentage(long amount,
long total)
Formats the ratio of amount/total as a percentage.
|
static int |
getBatteryLevel(Intent batteryChangedIntent) |
static String |
getBatteryStatus(Resources res,
Intent batteryChangedIntent) |
static String |
getBatteryStatus(Resources res,
Intent batteryChangedIntent,
boolean shortString) |
static int |
getColorAccent(Context context) |
static int |
getTetheringLabel(ConnectivityManager cm)
Return string resource that best describes combination of tethering
options available on this device.
|
static UserIconDrawable |
getUserIcon(Context context,
UserManager um,
UserInfo user)
Returns a circular icon for a user.
|
static String |
getUserLabel(Context context,
UserInfo info)
Returns a label for the user, in the form of "User: user name" or "Work profile".
|
static boolean |
isDeviceProvisioningPackage(Resources resources,
String packageName)
Returns
true if the supplied package is the device provisioning app. |
static boolean |
isSystemPackage(Resources resources,
PackageManager pm,
PackageInfo pkg)
Determine whether a package is a "system package", in which case certain things (like
disabling notifications or disabling the package altogether) should be disallowed.
|
public static int getTetheringLabel(ConnectivityManager cm)
public static String getUserLabel(Context context, UserInfo info)
public static UserIconDrawable getUserIcon(Context context, UserManager um, UserInfo user)
public static String formatPercentage(long amount, long total)
public static String formatPercentage(int percentage)
public static int getBatteryLevel(Intent batteryChangedIntent)
public static String getBatteryStatus(Resources res, Intent batteryChangedIntent, boolean shortString)
public static int getColorAccent(Context context)
public static boolean isSystemPackage(Resources resources, PackageManager pm, PackageInfo pkg)