Skip to content
tkgktyk edited this page Nov 29, 2014 · 1 revision

Quick Start Guide for FlyingLayout


Setup Library

Import "Github - tkgktyk/FlyingLayout/FlyingLayout" as a library.

Layout

Wrap your layout in FlyingLayout.

<jp.tkgktyk.flyinglayout.FlyingLayout
    xmlns:app="http://schemas.android.com/apk/res/jp.tkgktyk.flyinglayoutexample"
    android:id="@+id/flying"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    app:enableTouchEventX="true"
    app:enableTouchEventY="true"
    app:horizontalPadding="@dimen/flying_padding"
    app:speed="1.5"
    app:slopScale="1.0"
    app:useContainer="true"
    app:verticalPadding="@dimen/flying_padding" >

    <!-- your layout is here -->
    <!-- if useContainer is true, move only first view -->
    <!-- otherwise move all child-views -->

</jp.tkgktyk.flyinglayout.FlyingLayout>

Register listener

Use FlyingLayout#setOnFlyingEventListener to register listener.

mFlyingLayout.setOnFlyingEventListener(new OnFlyingEventListener() {
        @Override
        public void onOutsideClick(FlyingLayout v, int x, int y) {
            v.goHome(true);
        }

        @Override
        public void onDragStarted(FlyingLayout v) {
            // ex. set boundary
        }

        @Override
        public void onDragFinished(FlyingLayout v) {
            // ex. unset boundary
        }
});