java.lang.Object | |
↳ | com.sap.cloud.mobile.fiori.common.Utility |
Common utility functions
Fields | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
public static int | TABLET_SMALLEST_WIDTH_DP | The smallest width in dp that a tablet could have. |
Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Utility() |
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
static BitmapDrawable | convertViewToDrawable(View view) | ||||||||||
static int |
dpToPx(int dp)
Convert Dp to Px
| ||||||||||
static Activity | findActivity(Context context) | ||||||||||
static Bitmap | getBitmapFromView(View view) | ||||||||||
static int | getColorResourceFromTheme(Context context, int attr, int defaultColor) | ||||||||||
static String |
getDataColumn(Context context, Uri uri, String selection, String[] selectionArgs)
Get the value of the data column for this Uri.
| ||||||||||
static float | getDimenResourceFromTheme(Context context, int attr, int dimen) | ||||||||||
static Typeface | getFioriTypeface(int styleIndex) | ||||||||||
static float |
getFloat(Resources resources, int id)
Returns a float resource.
| ||||||||||
static String |
getLocalPath(Context context, Uri uri)
Get the local path of the given Uri from the Context
| ||||||||||
static int | getResourceFromTheme(Context context, int attr, int defaultRes) | ||||||||||
static Bitmap | getScreenViewBitmap(View view) | ||||||||||
static float |
getSpacingAdd(TextPaint paint, float lineHeight)
Returns spacingAdd by comparing lineHeight and font metrics.
| ||||||||||
static float |
getSpacingMultiplier(TextPaint paint, float lineHeight)
Returns spacingMultiplier by comparing lineHeight and font metrics.
| ||||||||||
static int |
getTrueSurfaceColor(Context context, float elevation)
A tool for Dark Theme that returns the custom View's surface color based on its elevation.
| ||||||||||
static void | hideKeyboard(Activity activity) | ||||||||||
static boolean | isDownloadsDocument(Uri uri) | ||||||||||
static boolean | isExternalStorageDocument(Uri uri) | ||||||||||
static boolean |
isLandscapeOrientation(Context context)
Check if the device is in landscape mode or not
| ||||||||||
static boolean | isMediaDocument(Uri uri) | ||||||||||
static boolean | isNightMode(Context context) | ||||||||||
static boolean | isRTL() | ||||||||||
static boolean |
isTablet(Context context)
Tests whether the current application runs on a tablet.
| ||||||||||
static Date | parseTime(String time) | ||||||||||
static int |
pxToDp(int px)
Convert pixels to density independent pixels (dp).
| ||||||||||
static float |
smootherStep(float edge1, float edge2, float val)
By Ken Perlin.
|
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
![]() |
The smallest width in dp that a tablet could have.
Convert Dp to Px
dp | int |
---|
Get the value of the data column for this Uri. This is useful for MediaStore Uris, and other file-based ContentProviders.
context | The context. |
---|---|
uri | The Uri to query. |
selection | (Optional) Filter used in the query. |
selectionArgs | (Optional) Selection arguments used in the query. |
styleIndex | The style (normal, bold, italic) of the typeface. e.g. NORMAL, BOLD, ITALIC, BOLD_ITALIC |
---|
Returns a float resource. Resources.getFloat is hidden in API v28.
resources | resources object |
---|---|
id | float resource id defined as |
Returns spacingAdd by comparing lineHeight and font metrics.
Returns spacingMultiplier by comparing lineHeight and font metrics.
A tool for Dark Theme that returns the custom View's surface color based on its elevation.
uri | The Uri to check. |
---|
Check if the device is in landscape mode or not
uri | The Uri to check. |
---|
Tests whether the current application runs on a tablet.
context | context of the application |
---|
Convert pixels to density independent pixels (dp).
px | The number of pixels. |
---|
By Ken Perlin. See Smoothstep - Wikipedia.