Class StampPickerItem
-
- All Implemented Interfaces:
-
android.os.Parcelable
public class StampPickerItem implements Parcelable
Entity representing single stamp in StampPickerDialog.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public class
StampPickerItem.Builder
Builder for creating custom stamps from PredefinedStampType or custom String stamp type.
public class
StampPickerItem.BitmapStampBuilder
Builder for creating custom stamps with bitmap image.
-
Field Summary
Fields Modifier and Type Field Description public final static float
DEFAULT_STAMP_ANNOTATION_ASPECT_RATIO
public final static float
DEFAULT_STAMP_ANNOTATION_PDF_WIDTH
public final static float
DEFAULT_STAMP_ANNOTATION_PDF_HEIGHT
public final static Parcelable.Creator<StampPickerItem>
CREATOR
public final StampType
stampType
public final String
title
public final String
subtitle
public final float
defaultPdfWidth
public final float
defaultPdfHeight
public final Bitmap
bitmap
public final Integer
textColor
public final AppearanceStreamGenerator
appearanceStreamGenerator
-
Method Summary
Modifier and Type Method Description StampType
getStampType()
Returns type of this stamp if it's one of the standard types listed in StampType. String
getTitle()
Returns text in first line of the stamp if any is available. String
getSubtitle()
Returns text in second line of the stamp if any is available. float
getDefaultPdfWidth()
Default width of this stamp type in pdf coordinates. float
getDefaultPdfHeight()
Default height of this stamp type in pdf coordinates. Bitmap
getBitmap()
Returns bitmap if set, null
otherwise.Integer
getTextColor()
Returns text textColor if set, null
otherwise.AppearanceStreamGenerator
getAppearanceStreamGenerator()
Returns appearance stream generator that replaces default stamp appearance. static List<StampPickerItem>
getDefaultStampPickerItems(@NonNull() Context context)
Returns default list of stamp picker items. static StampPickerItem.BitmapStampBuilder
fromBitmap(@NonNull() Bitmap bitmap)
Creates builder for stamp annotation with bitmap image. static StampPickerItem.Builder
fromPredefinedType(@NonNull() Context context, @NonNull() PredefinedStampType predefinedStampType)
Creates builder for stamp annotations pre-filled with properties of . static StampPickerItem.Builder
fromStampType(@NonNull() Context context, @NonNull() StampType stampType)
Creates builder for stamp annotation using a custom stamp type. static StampPickerItem.Builder
fromTitle(@NonNull() Context context, @NonNull() String title)
Creates builder for stamp annotation using a title. StampAnnotation
createStampAnnotation(@IntRange(from = 0) int pageIndex)
Creates stamp annotation from picker item data. boolean
isCustomStamp()
Returns true
for special custom stamp can be personalized by users.Single<Bitmap>
renderAppearanceStreamToBitmapAsync(@NonNull() Context context)
Renders configured appearance stream to bitmap with size defined in getDefaultPdfWidth and getDefaultPdfHeight scaled to display size. StampPickerItem
mutate()
Create new instance of this item. int
describeContents()
void
writeToParcel(Parcel dest, int flags)
-
-
Method Detail
-
getStampType
@Nullable() StampType getStampType()
Returns type of this stamp if it's one of the standard types listed in StampType. Returns
null
if the stamp uses a non-standard title.- Returns:
stamp type or
null
if the type isn't standard.
-
getTitle
@Nullable() String getTitle()
Returns text in first line of the stamp if any is available.
- Returns:
title of the annotation or
null
if none is set.
-
getSubtitle
@Nullable() String getSubtitle()
Returns text in second line of the stamp if any is available.
- Returns:
subtitle of the annotation or
null
if none is set.
-
getDefaultPdfWidth
@FloatRange(from = 0.0) float getDefaultPdfWidth()
Default width of this stamp type in pdf coordinates. Also used to ensure correct stamp aspect ratio in StampPickerDialog.
-
getDefaultPdfHeight
@FloatRange(from = 0.0) float getDefaultPdfHeight()
Default height of this stamp type in pdf coordinates. Also used to ensure correct stamp aspect ratio in StampPickerDialog.
-
getBitmap
@Nullable() Bitmap getBitmap()
Returns bitmap if set,
null
otherwise. Stamp picker items with bitmap are special items with:- Returns:
Bitmap if set,
null
otherwise.
-
getTextColor
@Nullable() Integer getTextColor()
Returns text textColor if set,
null
otherwise.- Returns:
Text textColor.
-
getAppearanceStreamGenerator
@Nullable() AppearanceStreamGenerator getAppearanceStreamGenerator()
Returns appearance stream generator that replaces default stamp appearance.
- Returns:
Appearance stream generator if set,
null
otherwise.
-
getDefaultStampPickerItems
@NonNull() static List<StampPickerItem> getDefaultStampPickerItems(@NonNull() Context context)
Returns default list of stamp picker items.
- Parameters:
context
- Context used in created StampPickerItems.- Returns:
List of default stamp picker items.
-
fromBitmap
@NonNull() static StampPickerItem.BitmapStampBuilder fromBitmap(@NonNull() Bitmap bitmap)
Creates builder for stamp annotation with bitmap image.
- Parameters:
bitmap
- Bitmap used for custom stamp annotation.
-
fromPredefinedType
static StampPickerItem.Builder fromPredefinedType(@NonNull() Context context, @NonNull() PredefinedStampType predefinedStampType)
Creates builder for stamp annotations pre-filled with properties of .
- Parameters:
context
- The context used to access resources.predefinedStampType
- Predefined stamp type used to initialize builder properties.
-
fromStampType
static StampPickerItem.Builder fromStampType(@NonNull() Context context, @NonNull() StampType stampType)
Creates builder for stamp annotation using a custom stamp type.
- Parameters:
context
- The context used to access resources.stampType
- Stamp type to use for created stamp annotation.
-
fromTitle
static StampPickerItem.Builder fromTitle(@NonNull() Context context, @NonNull() String title)
Creates builder for stamp annotation using a title.
- Parameters:
context
- The context used to access resources.title
- Text that is displayed on the stamp.
-
createStampAnnotation
@NonNull() StampAnnotation createStampAnnotation(@IntRange(from = 0) int pageIndex)
Creates stamp annotation from picker item data.
- Parameters:
pageIndex
- Page to create stamp annotation on.
-
isCustomStamp
boolean isCustomStamp()
Returns
true
for special custom stamp can be personalized by users.- Returns:
true
for special custom stamp can be personalized by users.
-
renderAppearanceStreamToBitmapAsync
Single<Bitmap> renderAppearanceStreamToBitmapAsync(@NonNull() Context context)
Renders configured appearance stream to bitmap with size defined in getDefaultPdfWidth and getDefaultPdfHeight scaled to display size. This method returns cached bitmap if the appearance stream has been rendered previously.
- Returns:
Single emitting rendered bitmap or error.
-
mutate
@NonNull() StampPickerItem mutate()
Create new instance of this item.
-
describeContents
int describeContents()
-
writeToParcel
void writeToParcel(Parcel dest, int flags)
-
-
-
-