Skip to content

Commit

Permalink
Merge pull request #43 from colinrtwhite/render-over-navigation-bar
Browse files Browse the repository at this point in the history
Add renderOverNavigationBar attribute, which renders the showcase over the nav bar.
  • Loading branch information
Dean Wild committed Mar 15, 2016
2 parents 5f82343 + 2bddd31 commit cbd25c3
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
Expand Up @@ -62,6 +62,7 @@ public class MaterialShowcaseView extends FrameLayout implements View.OnTouchLis
private int mContentTopMargin;
private boolean mDismissOnTouch = false;
private boolean mShouldRender = false; // flag to decide when we should actually render
private boolean mRenderOverNav = false;
private int mMaskColour;
private AnimationFactory mAnimationFactory;
private boolean mShouldAnimate = true;
Expand Down Expand Up @@ -269,7 +270,7 @@ public void setTarget(Target target) {
/**
* If we're on lollipop then make sure we don't draw over the nav bar
*/
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
if (!mRenderOverNav && Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
mBottomMargin = getSoftButtonsBarSizePort((Activity) getContext());
FrameLayout.LayoutParams contentLP = (LayoutParams) getLayoutParams();

Expand Down Expand Up @@ -457,6 +458,7 @@ public void setConfig(ShowcaseConfig config) {
setMaskColour(config.getMaskColor());
setShape(config.getShape());
setShapePadding(config.getShapePadding());
setRenderOverNavigationBar(config.getRenderOverNavigationBar());
}

private void updateDismissButton() {
Expand Down Expand Up @@ -653,6 +655,12 @@ public Builder withRectangleShape(boolean fullWidth) {
return this;
}

public Builder renderOverNavigationBar() {
// Note: This only has an effect in Lollipop or above.
showcaseView.setRenderOverNavigationBar(true);
return this;
}

public MaterialShowcaseView build() {
if (showcaseView.mShape == null) {
switch (shapeType) {
Expand Down Expand Up @@ -836,4 +844,7 @@ public static int getSoftButtonsBarSizePort(Activity activity) {
return 0;
}

private void setRenderOverNavigationBar(boolean mRenderOverNav) {
this.mRenderOverNav = mRenderOverNav;
}
}
Expand Up @@ -21,6 +21,7 @@ public class ShowcaseConfig {
private long mFadeDuration = DEFAULT_FADE_TIME;
private Shape mShape = DEFAULT_SHAPE;
private int mShapePadding = DEFAULT_SHAPE_PADDING;
private boolean renderOverNav = false;

public ShowcaseConfig() {
mMaskColour = Color.parseColor(ShowcaseConfig.DEFAULT_MASK_COLOUR);
Expand Down Expand Up @@ -83,4 +84,12 @@ public void setShapePadding(int padding) {
public int getShapePadding() {
return mShapePadding;
}

public boolean getRenderOverNavigationBar() {
return renderOverNav;
}

public void setRenderOverNavigationBar(boolean renderOverNav) {
this.renderOverNav = renderOverNav;
}
}

0 comments on commit cbd25c3

Please sign in to comment.