-
Notifications
You must be signed in to change notification settings - Fork 82
Customisation
Besides the standard android:
attributes, custom ones has been defined to be able to set specific parameter related to the view.
Below a list of the attributes, their default value (if any) and their correspondent Java method (if any).
Tells the view whether to automatically crop the image so to center an eventually detected face.
- XML Attribute:
masaccio:center_face
- Method:
MasaccioImageView.setCenterFace(boolean)
- Default value:
false
Sets the flags indicating in which situation to activate the face detection (0
means always).
Possible values regards the aspect ratio of the source image, that is, if the height is greater than the width (portraitImage
), the width is greater than the height (landscapeImage
) or they are equals (squareImage
). Note that the flags can be composed with |
in the XML or with &
in Java.
Note also that, in case the center face attribute is false
, the flags will be ignored.
- XML Attribute:
masaccio:activate_face_detection
- Method:
MasaccioImageView.setActivateDetectionFlags(int)
- Default value:
0
Sets the scale factor to apply after the crop has been computed. If a face is detected the scaled image will try to center it inside the view.
- XML Attribute:
masaccio:scale
- Method:
MasaccioImageView.setScale(float)
- Default value:
1
Sets the translation on the x axis to apply after the crop has been computed. The value is interpreted as a ratio of the difference between the cropped image and the view width.
- XML Attribute:
masaccio:translate_x
- Method:
MasaccioImageView.setTranslateX(float)
- Default value:
0.5
Sets the translation on the y axis to apply after the crop has been computed. The value is interpreted as a ratio of the difference between the cropped image and the view height.
- XML Attribute:
masaccio:translate_y
- Method:
MasaccioImageView.setTranslateY(float)
- Default value:
0.5
Sets the scale factor to apply after the crop has been computed, but before the post matrix is applied. If a face is detected the scaled image will try to center it inside the view. Note that this attribute is useless if no animation is set (see below).
- XML Attribute:
masaccio:pre_scale
- Method:
MasaccioImageView.setPreScale(float)
- Default value:
1
Sets the translation on the x axis to apply after the crop has been computed, but before the post matrix is applied. The value is interpreted as a ratio of the difference between the cropped image and the view width. Note that this attribute is useless if no animation is set (see below).
- XML Attribute:
masaccio:pre_translate_x
- Method:
MasaccioImageView.setPreTranslateX(float)
- Default value:
0.5
Sets the translation on the y axis to apply after the crop has been computed, but before the post matrix is applied. The value is interpreted as a ratio of the difference between the cropped image and the view height. Note that this attribute is useless if no animation is set (see below).
- XML Attribute:
masaccio:pre_translate_y
- Method:
MasaccioImageView.setPreTranslateY(float)
- Default value:
0.5
Sets the flags indicating in which situation to activate the post matrix (0
means always).
Possible values regards the aspect ratio of the source image, that is, if the height is greater than the width (portraitImage
), the width is greater than the height (landscapeImage
) or they are equals (squareImage
), and wether a face has been detected (ifFace
) or not (ifNoFace
). Note that the flags can be composed with |
in the XML or with &
in Java.
Note also that, in case the center face attribute is false
, the flags will be respected anyway.
- XML Attribute:
masaccio:activate_matrix
- Method:
MasaccioImageView.setActivateMatrixFlags(int)
- Default value:
0
Sets the duration of the animation in milliseconds between the pre and post matrix.
- XML Attribute:
masaccio:animation_duration
- Method:
MasaccioImageView.setAnimationDuration(long)
- Default value:
0
Sets the interpolator of the animation between the pre and post matrix.
- XML Attribute:
masaccio:animation_interpolator
- Method:
MasaccioImageView.setAnimationInterpolator(Interpolator)
- Default value:
null
Tells the widget to cyclically restart the animation between the pre and post matrix as soon as it ends.
- XML Attribute:
masaccio:cyclic_animation
- Method:
MasaccioImageView.setCyclicAnimation(boolean)
- Default value:
false
Tells the widget to ignore the faces with confidence detection level less than the given value.
- XML Attribute:
masaccio:min_confidence
- Method:
MasaccioImageView.setMinConfidence(float)
- Default value:
0
- Valid values:
0-1