Ejemplo n.º 1
0
  protected ShowcaseView(Context context, AttributeSet attrs, int defStyle, boolean newStyle) {
    super(context, attrs, defStyle);

    ApiUtils apiUtils = new ApiUtils();
    animationFactory = new AnimatorAnimationFactory();
    showcaseAreaCalculator = new ShowcaseAreaCalculator();
    shotStateStore = new ShotStateStore(context);

    apiUtils.setFitsSystemWindowsCompat(this);
    getViewTreeObserver().addOnPreDrawListener(this);
    getViewTreeObserver().addOnGlobalLayoutListener(this);

    // Get the attributes for the ShowcaseView
    final TypedArray styled =
        context
            .getTheme()
            .obtainStyledAttributes(
                attrs, R.styleable.ShowcaseView, R.attr.showcaseViewStyle, R.style.ShowcaseView);

    // Set the default animation times
    fadeInMillis = getResources().getInteger(android.R.integer.config_mediumAnimTime);
    fadeOutMillis = getResources().getInteger(android.R.integer.config_mediumAnimTime);

    mEndButton = (Button) LayoutInflater.from(context).inflate(R.layout.showcase_button, null);
    if (newStyle) {
      showcaseDrawer = new NewShowcaseDrawer(getResources());
    } else {
      showcaseDrawer = new StandardShowcaseDrawer(getResources());
    }
    textDrawer = new TextDrawer(getResources(), showcaseAreaCalculator, getContext());

    updateStyle(styled, false);

    init();
  }
Ejemplo n.º 2
0
 /** @see com.github.amlcurran.showcaseview.ShowcaseView.Builder#setStyle(int) */
 public void setStyle(int theme) {
   TypedArray array = getContext().obtainStyledAttributes(theme, R.styleable.ShowcaseView);
   updateStyle(array, true);
 }