Skip to content

Repository files navigation

Pull Back Layout

Pull down to finish an Activity.

Download

repositories {
// ...
maven { url "https://jitpack.io" }
}
dependencies {
// ... support library ...// ...
compile 'com.github.oxoooo:pull-back-layout:1.0.1'
}

Usage

You may refer to one of our apps that already using this library: mr-mantou-android

  1. Make your Activity translucent by adding these two lines to your theme:
<stylename="AppTheme" ...>
<!-- ... -->
<itemname="android:windowBackground">@android:color/transparent</item>
<itemname="android:windowIsTranslucent">true</item>
<!-- also translucent system ui -- suggested but not required -->
<itemname="android:windowTranslucentStatus">true</item>
<itemname="android:windowTranslucentNavigation">true</item>
</style>
  1. Wraps ooo.oxo.library.widget.PullBackLayout around your ImageView or ViewPager:
<ooo.oxo.library.widget.PullBackLayout
android:id="@+id/puller"android:layout_width="match_parent"android:layout_height="match_parent">
<android.support.v4.view.ViewPager
android:id="@+id/pager"android:layout_width="match_parent"android:layout_height="match_parent" />
</ooo.oxo.library.widget.PullBackLayout>
  1. Set a callback:
publicclassViewerActivityextendsAppCompatActivityimplementsPullBackLayout.Callback {
@OverrideprotectedvoidonCreate(BundlesavedInstanceState) {
super.onCreate(savedInstanceState);
/* ... */puller.setCallback(this);
}
@OverridepublicvoidonPullStart() {
// fade out Action Bar ...// show Status Bar ...
}
@OverridepublicvoidonPull(floatprogress) {
// set the opacity of the window's background
}
@OverridepublicvoidonPullCancel() {
// fade in Action Bar
}
@OverridepublicvoidonPullComplete() {
supportFinishAfterTransition();
}
}

License

MIT License

About

Pull down to finish an Activity.

Resources

Stars

535 stars

Watchers

13 watching

Forks

Releases

Packages

Contributors

Languages