class ImageTransformation : Transformation, Parcelable
Replaces the content of a child ImageView
of a presentation template
with the first image that matches a regular expression (regex).
Typically used to display credit card logos. Example:
new ImageTransformation.Builder(ccNumberId, Pattern.compile("^4815.*$"),
R.drawable.ic_credit_card_logo1, "Brand 1")
.addOption(Pattern.compile("^1623.*$"), R.drawable.ic_credit_card_logo2, "Brand 2")
.addOption(Pattern.compile("^42.*$"), R.drawable.ic_credit_card_logo3, "Brand 3")
.build();
There is no imposed limit in the number of options, but keep in mind that regexs are expensive to evaluate, so use the minimum number of regexs and add the most common first (for example, if this is a tranformation for a credit card logo and the most common credit card issuers are banks X and Y, add the regexes that resolves these 2 banks first).
Summary
Inherited constants |
From class Parcelable
Int |
CONTENTS_FILE_DESCRIPTOR
Descriptor bit used with describeContents() : indicates that the Parcelable object's flattened representation includes a file descriptor.
|
Int |
PARCELABLE_WRITE_RETURN_VALUE
Flag for use with writeToParcel : the object being written is a return value, that is the result of a function such as "Parcelable someFunction() ", "void someFunction(out Parcelable) ", or "void someFunction(inout Parcelable) ". Some implementations may want to release resources at this point.
|
|
Public methods
describeContents
fun describeContents(): Int
toString
fun toString(): String
Return |
String |
a string representation of the object. |
writeToParcel
fun writeToParcel(
parcel: Parcel,
flags: Int
): Unit
Properties