public interface ArgumentsBundle
RhythmSpecLayerFactory
implementations
to query spec layer properties when creating new layers.Modifier and Type | Interface and Description |
---|---|
static interface |
ArgumentsBundle.DimensionUnits
Type definition for dimension argument units
|
static interface |
ArgumentsBundle.EdgeAffinity
Type definition for screen edge that a keyline or pattern must be attached to.
|
Modifier and Type | Field and Description |
---|---|
static int |
UNITS_DP |
static int |
UNITS_IN |
static int |
UNITS_MM |
static int |
UNITS_NULL |
static int |
UNITS_NUMBER |
static int |
UNITS_PERCENT |
static int |
UNITS_PT |
static int |
UNITS_PX |
static int |
UNITS_SP |
Modifier and Type | Method and Description |
---|---|
boolean |
getBoolean(java.lang.String key,
boolean defaultValue)
Get boolean argument.
|
int |
getColor(java.lang.String key,
int defaultValue)
Get argument value as color integer with fallback to default value if argument is missing.
|
float |
getDimensionPixelExact(java.lang.String key,
float defaultValue)
Get dimension argument value as pixels with possible fallback to default value if argument is missing or invalid.
|
int |
getDimensionPixelOffset(java.lang.String key,
int defaultValue)
Get dimension argument value as pixels with possible fallback to default value if argument is missing or invalid.
|
int |
getDimensionPixelSize(java.lang.String key,
int defaultValue)
Get dimension argument value as pixels with possible fallback to default value if argument is missing or invalid.
|
int |
getDimensionUnits(java.lang.String key)
Get the units of a dimension argument.
|
float |
getDimensionValue(java.lang.String key,
float defaultValue)
Get raw numeric value from dimension argument disregarding units and NOT performing any conversion to pixels.
|
android.util.DisplayMetrics |
getDisplayMetrics()
Get display metrics associated with this arguments bundle.
|
int |
getEdgeAffinity(java.lang.String key,
int defaultValue)
Get argument as an
ArgumentsBundle.EdgeAffinity constant, which can be either Gravity.TOP , Gravity.LEFT ,
Gravity.RIGHT , or Gravity.BOTTOM , with fallback to default value if argument is missing or
invalid. |
float |
getFloat(java.lang.String key,
float defaultValue)
Get argument value as float with fallback to default value if argument is missing.
|
int |
getGravity(java.lang.String key,
int defaultValue)
Get argument value as a gravity value (a combination of
Gravity constants) with fallback to default value
if argument is missing. |
int |
getInt(java.lang.String key,
int defaultValue)
Get argument value as integer with fallback to default value if argument is missing.
|
java.lang.String |
getString(java.lang.String key)
Get argument value as a string.
|
java.lang.String |
getString(java.lang.String key,
java.lang.String defaultValue)
Get argument value as a string with fallback to default value if argument is missing.
|
boolean |
hasArgument(java.lang.String key)
Test if there's an argument with given key in the bundle, even if the value is
null . |
static final int UNITS_NULL
static final int UNITS_NUMBER
static final int UNITS_PERCENT
static final int UNITS_PX
static final int UNITS_DP
static final int UNITS_SP
static final int UNITS_PT
static final int UNITS_IN
static final int UNITS_MM
boolean hasArgument(java.lang.String key)
null
.key
- argument keyjava.lang.String getString(java.lang.String key)
key
- argument keyjava.lang.String getString(java.lang.String key, @Nullable java.lang.String defaultValue)
key
- argument keydefaultValue
- fallback valueint getInt(java.lang.String key, int defaultValue)
key
- argument keydefaultValue
- fallback valuefloat getFloat(java.lang.String key, float defaultValue)
key
- argument keydefaultValue
- fallback valueboolean getBoolean(java.lang.String key, boolean defaultValue)
arg
are identical to arg=true
.key
- argument keydefaultValue
- value if argument is not presentint getColor(java.lang.String key, int defaultValue)
key
- argument keydefaultValue
- fallback valueint getGravity(java.lang.String key, int defaultValue)
Gravity
constants) with fallback to default value
if argument is missing.key
- argument keydefaultValue
- fallback valuegetEdgeAffinity(String, int)
int getEdgeAffinity(java.lang.String key, int defaultValue)
ArgumentsBundle.EdgeAffinity
constant, which can be either Gravity.TOP
, Gravity.LEFT
,
Gravity.RIGHT
, or Gravity.BOTTOM
, with fallback to default value if argument is missing or
invalid.key
- argument keydefaultValue
- fallback valuegetGravity(String, int)
int getDimensionUnits(java.lang.String key)
key
- argument keyUNITS_NULL
if the argument is null or missingfloat getDimensionValue(java.lang.String key, float defaultValue)
key
- argument keydefaultValue
- fallback value in pixelsgetDimensionPixelSize(String, int)
,
getDimensionPixelOffset(String, int)
float getDimensionPixelExact(java.lang.String key, float defaultValue)
getDimensionPixelSize(String, int)
and getDimensionPixelSize(String, int)
, this method
doesn't perform any rounding.key
- argument keydefaultValue
- fallback value in pixelsgetDimensionPixelSize(String, int)
,
getDimensionPixelOffset(String, int)
int getDimensionPixelOffset(java.lang.String key, int defaultValue)
getDimensionPixelSize(String, int)
, this method is expected to round the raw value down to
the closest integer.key
- argument keydefaultValue
- fallback value in pixelsgetDimensionPixelSize(String, int)
,
getDimensionPixelExact(String, float)
int getDimensionPixelSize(java.lang.String key, int defaultValue)
getDimensionPixelOffset(String, int)
}, this method is expected to round the raw value up or
down to the closest integer by common rules, and must ensure the result is at least 1px if original value is
not 0.key
- argument keydefaultValue
- fallback value in pixelsgetDimensionPixelOffset(String, int)
,
getDimensionPixelExact(String, float)
android.util.DisplayMetrics getDisplayMetrics()