public class ViewUtils
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
class |
ViewUtils.RegexSettingsTextWatcher
A Regex based SettingsTextWatcher to simplify validation
|
class |
ViewUtils.SettingsTextWatcher
TextWatcher adapter class bound to a View |
Constructor and Description |
---|
ViewUtils() |
Modifier and Type | Method and Description |
---|---|
static Drawable |
getDrawableForBlaubotState(Context ctx,
IBlaubotState state)
Retrieve the corresponding drawable by the blaubot state
|
static Drawable |
getDrawableForBlaubotState(Context ctx,
State stateEnum)
Retrieve the corresponding drawable by the blaubot state
|
static java.lang.String |
humanReadableByteCount(long bytes,
boolean si)
Converts a byte size into a human readable sting
|
static boolean |
isValidHostname(java.lang.String hostname)
Validates a hostname
|
static boolean |
isValidIpAddress(java.lang.String ip)
Checks wheter an ipv4 address is valid
|
static boolean |
validateURLPathSegment(java.lang.String val)
Validates url path segements.
|
public static Drawable getDrawableForBlaubotState(Context ctx, IBlaubotState state)
ctx
- the contextstate
- the blaubot state to retrieve the drawable forjava.lang.IllegalStateException
- if the state is not mapped to an iconpublic static Drawable getDrawableForBlaubotState(Context ctx, State stateEnum)
ctx
- the contextstateEnum
- the blaubot state to retrieve the drawable forjava.lang.IllegalStateException
- if the state is not mapped to an iconpublic static boolean validateURLPathSegment(java.lang.String val)
val
- the url path segment to be validatedpublic static boolean isValidHostname(java.lang.String hostname)
hostname
- the hostname to be validatedpublic static boolean isValidIpAddress(java.lang.String ip)
ip
- the ip to be checkedpublic static java.lang.String humanReadableByteCount(long bytes, boolean si)
bytes
- the number of bytessi
- if true, the output will be in si units