Search in sources :

Example 1 with PreferencesManager

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);
            }
        }
    });
}
Also used : PorterDuffXfermode(android.graphics.PorterDuffXfermode) Handler(android.os.Handler) Paint(android.graphics.Paint) PreferencesManager(co.mobiwise.materialintro.prefs.PreferencesManager) ImageView(android.widget.ImageView) View(android.view.View) TextView(android.widget.TextView) ViewTreeObserver(android.view.ViewTreeObserver)

Aggregations

Paint (android.graphics.Paint)1 PorterDuffXfermode (android.graphics.PorterDuffXfermode)1 Handler (android.os.Handler)1 View (android.view.View)1 ViewTreeObserver (android.view.ViewTreeObserver)1 ImageView (android.widget.ImageView)1 TextView (android.widget.TextView)1 PreferencesManager (co.mobiwise.materialintro.prefs.PreferencesManager)1