Skip to content
This repository was archived by the owner on Apr 24, 2018. It is now read-only.

Commit aceded4

Browse files
committed
By default, use the content view to insert into
1 parent 47a11e9 commit aceded4

File tree

3 files changed

+7
-10
lines changed

3 files changed

+7
-10
lines changed

library/src/main/java/com/github/amlcurran/showcaseview/ShowcaseView.java

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -421,9 +421,8 @@ public Builder(Activity activity, boolean useNewStyle) {
421421
this.activity = activity;
422422
this.showcaseView = new ShowcaseView(activity, useNewStyle);
423423
this.showcaseView.setTarget(Target.NONE);
424-
425-
this.parent = ((ViewGroup) activity.getWindow().getDecorView());
426-
this.parentIndex = -1;
424+
this.parent = (ViewGroup) activity.findViewById(android.R.id.content);
425+
this.parentIndex = parent.getChildCount();
427426
}
428427

429428
/**
@@ -620,12 +619,12 @@ public Builder blockAllTouches() {
620619
}
621620

622621
/**
623-
* Uses the android content view to insert a showcase, this is highly recommended
624-
* when using appcompat (and really, highly recommended in general)
622+
* Uses the android decor view to insert a showcase, this is not recommended
623+
* as then UI elements in showcase view can hide behind the nav bar
625624
*/
626-
public Builder useContentViewAsParent() {
627-
parent = (ViewGroup) activity.findViewById(android.R.id.content);
628-
parentIndex = parent.getChildCount();
625+
public Builder useDecorViewAsParent() {
626+
this.parent = ((ViewGroup) activity.getWindow().getDecorView());
627+
this.parentIndex = -1;
629628
return this;
630629
}
631630
}

sample/src/main/java/com/github/amlcurran/showcaseview/sample/ActionItemsSampleActivity.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ protected void onCreate(@Nullable Bundle savedInstanceState) {
1919

2020
new ShowcaseView.Builder(this)
2121
.withMaterialShowcase()
22-
.useContentViewAsParent()
2322
.setTarget(new ToolbarActionItemTarget(viewById, R.id.menu_item1))
2423
.setStyle(R.style.CustomShowcaseTheme2)
2524
.setContentText("Here's how to highlight items on a toolbar")

sample/src/main/java/com/github/amlcurran/showcaseview/sample/SampleActivity.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,6 @@ public void onCreate(Bundle savedInstanceState) {
7272

7373
ViewTarget target = new ViewTarget(R.id.buttonBlocked, this);
7474
sv = new ShowcaseView.Builder(this)
75-
.useContentViewAsParent()
7675
.withMaterialShowcase()
7776
.setTarget(target)
7877
.setContentTitle(R.string.showcase_main_title)

0 commit comments

Comments
 (0)