timrijckaert/NewsStandHeaderView


A view inspired by Google Play Newsstand.

Download


Step 1. Add the JitPack repository to your build file

Add it in your root settings.gradle at the end of repositories:

	dependencyResolutionManagement {
		repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
		repositories {
			mavenCentral()
			maven { url 'https://jitpack.io' }
		}
	}

Add it in your settings.gradle.kts at the end of repositories:

	dependencyResolutionManagement {
		repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
		repositories {
			mavenCentral()
			maven { url = uri("https://jitpack.io") }
		}
	}

Add to pom.xml

	<repositories>
		<repository>
		    <id>jitpack.io</id>
		    <url>https://jitpack.io</url>
		</repository>
	</repositories>

Add it in your build.sbt at the end of resolvers:

 
    resolvers += "jitpack" at "https://jitpack.io"
        
    

Add it in your project.clj at the end of repositories:

 
    :repositories [["jitpack" "https://jitpack.io"]]
        
    

Step 2. Add the dependency

	dependencies {
		implementation 'com.github.timrijckaert:NewsStandHeaderView:v1.4'
	}
	dependencies {
		implementation("com.github.timrijckaert:NewsStandHeaderView:v1.4")
	}
	<dependency>
	    <groupId>com.github.timrijckaert</groupId>
	    <artifactId>NewsStandHeaderView</artifactId>
	    <version>v1.4</version>
	</dependency>

                            
    libraryDependencies += "com.github.timrijckaert" % "NewsStandHeaderView" % "v1.4"
        
        

                            
    :dependencies [[com.github.timrijckaert/NewsStandHeaderView "v1.4"]]
        
        

Readme


NewsStandHeaderView

A view that was inspired by Google's Play Kiosk. The header automatically sets itself up with the help of an ViewPager. Provided a fully working sample.

GIF showing fancy animation the NewsStandHeaderView provides

##Installation

Add it in your root build.gradle at the end of repositories:

allprojects {
    repositories {
        ...
        maven { url "https://jitpack.io" }
    }
}

Add the dependency

dependencies {
        compile 'com.github.timrijckaert:NewsStandHeaderView:v1.4'
}

##Usage :

Add the NewsStandHeaderView in your CollapsingToolbarLayout or AppBarLayout.

<android.support.design.widget.CoordinatorLayout>
    <android.support.design.widget.AppBarLayout>
        <android.support.design.widget.CollapsingToolbarLayout>

            <be.vrt.mobile.android.sporza.voetbal.ui.widget.slf.NewsStandHeaderView
                android:id="@+id/newsstandheaderview"
                android:layout_width="match_parent"
                android:layout_height="match_parent" />

            <android.support.v7.widget.Toolbar/>
            <android.support.design.widget.TabLayout />
        </android.support.design.widget.CollapsingToolbarLayout>
    </android.support.design.widget.AppBarLayout>
    <android.support.v4.view.ViewPager />

</android.support.design.widget.CoordinatorLayout>

add the attached ViewPager. You can call setupWithViewPager similar to TabLayout's setupWithViewPager

@Bind(R.id.tablayout)
TabLayout tabLayout;
@Bind(R.id.viewpager)
ViewPager viewPager;
@Bind(R.id.newsstandheaderview)
NewsStandHeaderView newsStandHeaderView;

@Override
protected void onCreate(Bundle savedInstanceState) {
    setContentView(R.layout.activity_main);
    ButterKnife.bind(this);
    tabLayout.setupWithViewPager(viewPager);
    newsStandHeaderView.setupWithViewPager(viewPager);
}

your ViewPager's adapter will need to implement NewsStandHeaderView.NewsStandHeaderViewConfiguratorAdapter to provide the correct colors and fallback images.

Images

You can push images to the header with setImages(int position of tab where the images should be displayed, List<String>).

newsStandHeaderView.setImages(0, asList(
                "http://sporza.be/polopoly_fs/1.2648002!image/4084014349.jpg_gen/derivatives/landscape670/4084014349.jpg",
                "http://sporza.be//polopoly_fs/1.2648048!image/755200629.jpg_gen/derivatives/landscape670/755200629.jpg",
                "http://sporza.be/polopoly_fs/1.2647785!image/1278319731.jpg_gen/derivatives/landscape670/1278319731.jpg"
        ));

Production Usages

Dependencies

Contributors