use of co.mobiwise.materialintro.prefs.PreferencesManager in project MaterialIntroView by iammert.
the class MaterialIntroView method init.
private void init(Context context) {
setWillNotDraw(false);
setVisibility(INVISIBLE);
/**
* set default values
*/
maskColor = Constants.DEFAULT_MASK_COLOR;
delayMillis = Constants.DEFAULT_DELAY_MILLIS;
fadeAnimationDuration = Constants.DEFAULT_FADE_DURATION;
padding = Constants.DEFAULT_TARGET_PADDING;
colorTextViewInfo = Constants.DEFAULT_COLOR_TEXTVIEW_INFO;
focusType = Focus.ALL;
focusGravity = FocusGravity.CENTER;
shapeType = ShapeType.CIRCLE;
isReady = false;
isFadeAnimationEnabled = true;
dismissOnTouch = false;
isLayoutCompleted = false;
isInfoEnabled = false;
isDotViewEnabled = false;
isPerformClick = false;
isImageViewEnabled = true;
isIdempotent = false;
/**
* initialize objects
*/
handler = new Handler();
preferencesManager = new PreferencesManager(context);
eraser = new Paint();
eraser.setColor(0xFFFFFFFF);
eraser.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.CLEAR));
eraser.setFlags(Paint.ANTI_ALIAS_FLAG);
View layoutInfo = LayoutInflater.from(getContext()).inflate(R.layout.material_intro_card, null);
infoView = layoutInfo.findViewById(R.id.info_layout);
textViewInfo = (TextView) layoutInfo.findViewById(R.id.textview_info);
textViewInfo.setTextColor(colorTextViewInfo);
imageViewIcon = (ImageView) layoutInfo.findViewById(R.id.imageview_icon);
dotView = LayoutInflater.from(getContext()).inflate(R.layout.dotview, null);
dotView.measure(MeasureSpec.UNSPECIFIED, MeasureSpec.UNSPECIFIED);
getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {
@Override
public void onGlobalLayout() {
targetShape.reCalculateAll();
if (targetShape != null && targetShape.getPoint().y != 0 && !isLayoutCompleted) {
if (isInfoEnabled)
setInfoLayout();
if (isDotViewEnabled)
setDotViewLayout();
removeOnGlobalLayoutListener(MaterialIntroView.this, this);
}
}
});
}
Aggregations