public class Util extends Object
Constructor and Description |
---|
Util() |
Modifier and Type | Method and Description |
---|---|
static RectF |
convertToRectF(RadRect rect)
|
static <T> T |
createViewFromXML(int layoutId,
Class<T> resultType,
Context context)
Creates a view from the given xml resource id.
|
static boolean |
Equals(Object obj1,
Object obj2) |
static String |
generateDummyText(String text)
Generates dummy text avoiding any below line characters.
|
static int |
generateViewId() |
static float |
getDimen(int type,
float dimen)
Converts the provided value in dp to a value in physical pixels using the provided context.
|
static int |
getDP(float dp) |
static <T> T |
getLayoutPart(Activity parent,
int partId,
Class<T> resultType)
Gets an xml layout part.
|
static <T> T |
getLayoutPart(Activity parent,
int partId,
Class<T> resultType,
boolean throwException)
Gets an xml layout part.
|
static <T> T |
getLayoutPart(View parent,
int partId,
Class<T> resultType)
Gets an xml layout part.
|
static <T> T |
getLayoutPart(View parent,
int partId,
Class<T> resultType,
boolean throwException)
Gets an xml layout part.
|
static int |
getSP(float sp)
Converts the provided value in sp to a value in physical pixels.
|
static boolean |
isNullOrEmpty(String value) |
static Rect |
RectFToRect(RectF rect)
Converts the given RectF to Rect by rounding its members.
|
static String |
toString(Object object) |
public static boolean isNullOrEmpty(String value)
public static int generateViewId()
public static Rect RectFToRect(RectF rect)
rect
- The rect to convert.public static float getDimen(int type, float dimen)
type
- The type of dimension.dimen
- The dimension to get.public static int getDP(float dp)
public static int getSP(float sp)
public static RectF convertToRectF(RadRect rect)
rect
- The rectangle to convert.public static <T> T getLayoutPart(View parent, int partId, Class<T> resultType)
T
- The type of the part to get.parent
- The View inside which the part resides.partId
- The id of the part to get.resultType
- The class of the part to get.public static <T> T getLayoutPart(View parent, int partId, Class<T> resultType, boolean throwException)
T
- The type of the part to get.parent
- The View inside which the part resides.partId
- The id of the part to get.resultType
- The class of the part to get.throwException
- true
if a MissingLayoutPartException
should be thrown
if the layout part is not found and false
otherwise.public static <T> T getLayoutPart(Activity parent, int partId, Class<T> resultType)
T
- The type of the part to get.parent
- The View inside which the part resides.partId
- The id of the part to get.resultType
- The class of the part to get.public static <T> T getLayoutPart(Activity parent, int partId, Class<T> resultType, boolean throwException)
T
- The type of the part to get.parent
- The View inside which the part resides.partId
- The id of the part to get.resultType
- The class of the part to get.throwException
- true
if a MissingLayoutPartException
should be thrown
if the layout part is not found and false
otherwise.public static <T> T createViewFromXML(int layoutId, Class<T> resultType, Context context)
T
- The result type.layoutId
- The id of the xml resource.resultType
- The type of view declared in the xml resource.context
- A context from which a LayoutInflater will be obtained.