Package com.pda.screenshotmatcher2.utils

Utility classes.

Types

CompareSizesByArea
Link copied to clipboard
class CompareSizesByArea : Comparator<Size?>

Comparator, which compares two Sizes and returns the bigger one.

MimeType
Link copied to clipboard
class MimeType(mimeType: MimeTypes)

Helper class to turn MimeTypes into their corresponding string representation.

MimeTypes
Link copied to clipboard
enum MimeTypes : Enum<MimeTypes>

Helper enum for all supported MIME types.

Functions

base64ToBitmap
Link copied to clipboard
fun base64ToBitmap(b64String: String): Bitmap

Converts a b64String to a Bitmap and returns it.

createDeviceID
Link copied to clipboard
fun createDeviceID(context: Context)

Creates a new device ID if the app is running for the very first time.

createSharingChooser
Link copied to clipboard
fun createSharingChooser(file: File, mimeType: MimeType, activity: Activity)

Creates a sharing chooser with the given file.

decodeBase64
Link copied to clipboard
fun decodeBase64(input: String): ByteArray?

Decodes a b64String to a Bitmap and returns it.

getDateString
Link copied to clipboard
fun getDateString(): String

Returns the current date/time.

getDeviceID
Link copied to clipboard
fun getDeviceID(context: Context): String

Returns the device ID.

getDeviceName
Link copied to clipboard
fun getDeviceName(): String

Returns the devices model name.

getPermissions
Link copied to clipboard
fun getPermissions(): Array<String>

Returns all required permissions for the app.

rescale
Link copied to clipboard
fun rescale(bitmap: Bitmap, targetSize: Int): Bitmap

Rescales a bitmap to the specified targetSize and returns it

rotateBitmap
Link copied to clipboard
fun rotateBitmap(bitmap: Bitmap, deg: Float): Bitmap

Rotates bitmap by deg and returns it.

saveBitmapToFile
Link copied to clipboard
fun saveBitmapToFile(file: File, bitmap: Bitmap)

Saves bitmap to file.

saveImageFileToGallery
Link copied to clipboard
fun saveImageFileToGallery(file: File, description: String, context: Context)
toGrayscale
Link copied to clipboard
fun toGrayscale(bmpOriginal: Bitmap): Bitmap

Converts a bitmap to grayscale and returns it

verifyPermissions
Link copied to clipboard
fun verifyPermissions(activity: Activity): Boolean

Verifies if activity has been granted all permissions of getPermissions. Automatically requests the missing permissions if necessary.