Skip to content
This repository has been archived by the owner on Feb 8, 2022. It is now read-only.

add the possibility to completly disable the viewpager-toolbar #108

Merged
merged 2 commits into from
Jul 28, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,8 @@ protected void onFinishInflate() {
logoContainer = (ViewGroup) findViewById(R.id.logoContainer);

mToolbar = (Toolbar) findViewById(R.id.toolbar);
if(settings.disableToolbar)
mToolbar.setVisibility(GONE);
mViewPager = (ViewPager) findViewById(R.id.viewPager);

mViewPager.addOnPageChangeListener(this);
Expand Down Expand Up @@ -225,6 +227,15 @@ public PagerSlidingTabStrip getPagerTitleStrip() {
return (PagerSlidingTabStrip) pagerTitleStripContainer.findViewById(R.id.materialviewpager_pagerTitleStrip);
}

/**
* Retrieve the displayed toolbar
*
* @return the displayed toolbar
*/
public void setToolbar(Toolbar toolbar) {
mToolbar=toolbar;
}

/**
* Retrieve the displayed toolbar
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ public class MaterialViewPagerSettings implements Parcelable {
protected boolean displayToolbarWhenSwipe;
protected boolean toolbarTransparent;
protected boolean animatedHeaderImage;
protected boolean disableToolbar;

/**
* Retrieve attributes from the MaterialViewPager
Expand Down Expand Up @@ -75,7 +76,7 @@ protected void handleAttributes(Context context, AttributeSet attrs){
}
{
parallaxHeaderFactor = styledAttrs.getFloat(R.styleable.MaterialViewPager_viewpager_parallaxHeaderFactor, 1.5f);
parallaxHeaderFactor = Math.max(parallaxHeaderFactor,1); //min=1
parallaxHeaderFactor = Math.max(parallaxHeaderFactor, 1); //min=1
}
{
hideToolbarAndTitle = styledAttrs.getBoolean(R.styleable.MaterialViewPager_viewpager_hideToolbarAndTitle, false);
Expand All @@ -93,6 +94,9 @@ protected void handleAttributes(Context context, AttributeSet attrs){
{
animatedHeaderImage = styledAttrs.getBoolean(R.styleable.MaterialViewPager_viewpager_animatedHeaderImage, true);
}
{
disableToolbar = styledAttrs.getBoolean(R.styleable.MaterialViewPager_viewpager_disableToolbar, false);
}
styledAttrs.recycle();
} catch (Exception e) {
e.printStackTrace();
Expand Down
1 change: 1 addition & 0 deletions materialviewpager/src/main/res/values/attrs.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
<attr name="viewpager_displayToolbarWhenSwipe" format="boolean"/>
<attr name="viewpager_transparentToolbar" format="boolean"/>
<attr name="viewpager_animatedHeaderImage" format="boolean"/>
<attr name="viewpager_disableToolbar" format="boolean"/>

</declare-styleable>

Expand Down