/ScrollFullScreen

Scroll to full screen for Android

Primary LanguageJavaMIT LicenseMIT

ScrollFullScreen

ScreenCast

ScrollFullScreen is scroll to full screen library like Google I/O 2014 App. It supports ListView, ScrollView, WebView.

Usage

1. Implement OnFullScreenListener and instance ScrollDetector

ScrollFullScreen does not provide full screen behevior. You should implement your own beheivior to listener.

ScrollDetector scrollDetector = new ScrollDetector(new OnFullScreenListener() {
    @Override
    public void onFullScreenStarted() {
        // Implement full screen beheivior
        getSupportActionBar().hide();
    }

    @Override
    public void onFullScreenFinished() {
        getSupportActionBar().show();
    }
});

2. Attach to view

ListView

Instance ListViewAdapter and set OnScreenListener to ListView.

ListView listView = getListView();
ListViewAdapter listViewAdapter = new ListViewAdapter.Builder(scrollDetector).build();
listView.setOnScrollListener(listViewAdapter); // ListViewAdapter implements AbsListView.OnScrollListener

WebView, ScrollView

Use ScrollViewAdapter and add OnScrollChangedListener to ScrollView's ViewTreeObserver.

WebView webView = (WebView)findViewById(R.id.webview);
ScrollViewAdapter scrollViewAdapter = new ScrollViewAdapter.Builder(webView, scrollDetector).build();
webView.getViewTreeObserver().addOnScrollChangedListener(scrollViewAdapter); // ScrollViewAdapter implements ViewTreeObserver.OnScrollChangedListener

Requrements

  • ListView
    • Android 2.3 or later
  • ScrollView, WebView
    • Android 4.0 or later

Download

We are planing to upload maven later.

License

MIT license.