Camposha
  • Home
  • Android
  • Buy Projects
  • My Account
    • Become a Member
    • Log In|Log Out
    • Free Projects
No Result
View All Result
Camposha
  • Home
  • Android
  • Buy Projects
  • My Account
    • Become a Member
    • Log In|Log Out
    • Free Projects
No Result
View All Result
Camposha
No Result
View All Result
Home Android UI Button

Fabulous Filter

Android library to animate Floating Action Button to Bottom Sheet Dialog and vice-versa

2 weeks ago
in Button
39 1
A A
40
SHARES
4k
VIEWS
Share on FacebookShare on Twitter

SimilarPosts

Android Button Introduction

2 years ago
4k
DescriptionInfoDownload

FabulousFilter

API Android Arsenal Material Up

Show some ❤️ and star the repo to support the project

GitHub stars GitHub forks GitHub watchers GitHub followers
Twitter Follow

This library is the implementation of filter-concept posted on MaterialUp.com.

It makes animation of FloatingActionButton to BottomSheetDialog easy to implement.

Concept

fabulousfilter concept

Demo

fabulousfilter demo 1 fabulousfilter demo 1

Download

Gradle

Step 1. Add the jCenter repository to your project-level build.gradle file

allprojects {
	repositories {
		jcenter()
	}
}

Step 2. Add the dependency to your app-level build.gradle file:

dependencies {
	 compile 'com.allattentionhere:fabulousfilter:0.0.5'
}

Usage

Create a Fragment that extends AAH_FabulousFragment:

public class MySampleFabFragment extends AAH_FabulousFragment {

    public static MySampleFabFragment newInstance() {
        MySampleFabFragment f = new MySampleFabFragment();
        return f;
    }

    @Override

    public void setupDialog(Dialog dialog, int style) {
        View contentView = View.inflate(getContext(), R.layout.filter_sample_view, null);
        RelativeLayout rl_content = (RelativeLayout) contentView.findViewById(R.id.rl_content);
        LinearLayout ll_buttons = (LinearLayout) contentView.findViewById(R.id.ll_buttons);
        contentView.findViewById(R.id.btn_close).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                closeFilter("closed");
            }
        });

        //params to set
        setAnimationDuration(600); //optional; default 500ms
        setPeekHeight(300); // optional; default 400dp
        setCallbacks((Callbacks) getActivity()); //optional; to get back result
	setAnimationListener((AnimationListener) getActivity()); //optional; to get animation callbacks
        setViewgroupStatic(ll_buttons); // optional; layout to stick at bottom on slide
        setViewPager(vp_types); //optional; if you use viewpager that has scrollview
        setViewMain(rl_content); //necessary; main bottomsheet view
        setMainContentView(contentView); // necessary; call at end before super
        super.setupDialog(dialog, style); //call super at last
    }

}

Create view for the fragment which has parent element AAH_FilterView:

<com.allattentionhere.fabulousfilter.AAH_FilterView 
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical">

    <RelativeLayout
        android:id="@+id/rl_content"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_alignParentBottom="true"
        android:background="@color/orange"
        android:visibility="invisible"
        tools:ignore="MissingPrefix"
        tools:visibility="visible">

        <LinearLayout
            android:id="@+id/ll_buttons"
            android:layout_width="match_parent"
            android:layout_height="56dp"
            android:layout_alignParentBottom="true"
            android:background="@color/brown"
            android:orientation="horizontal"
            android:weightSum="2">
        </LinearLayout>

    </RelativeLayout>

</com.allattentionhere.fabulousfilter.AAH_FilterView>

Start the fragment on click of FloatingActionButton as below:

fab.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                MySampleFabFragment dialogFrag = MySampleFabFragment.newInstance();
                dialogFrag.setParentFab(fab);
                dialogFrag.show(getSupportFragmentManager(), dialogFrag.getTag());
            }
        });

Parameters

  • Main View (Required)

This parameter specifies the ViewGroup of the bottom sheet to be shown after animation ends. It can be any ViewGroup(LinearLayout/FrameLayout etc):

setViewMain(relativelayout_content);
  • Inflated Dialog View (Required)

This parameter specifies the inflated view for the dialog:

setMainContentView(contentDialogView);
  • Animation duration (Optional)

This parameter sets animation duration of translate and scale animation in milliseconds:

setAnimationDuration(600); // default 500ms
  • Peek Height (Optional)

This parameter sets the peek height of the bottom sheet in dp:

setPeekHeight(300); // default 400dp
  • Callback (Optional)

This paramter is used to get callback from AAH_FabulousFragment to the component that called it:

setCallbacks((Callbacks) getActivity());

To use it, implement the callback in the calling component(Activity/Fragment etc), example:

public class MainSampleActivity extends AppCompatActivity implements AAH_FabulousFragment.Callbacks {
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main_sample);
    }

    @Override
    public void onResult(Object result) {
        Log.d("k9res", "onResult: " + result.toString());
        if (result.toString().equalsIgnoreCase("swiped_down")) {
            //do something or nothing
        } else {
            //handle result
        }
    }
}

  • Animation Listener (Optional)

This parameter is used to get animation callbacks.

setAnimationListener((AnimationListener) getActivity());

To use it, implement the AnimationListener in the calling component(Activity/Fragment etc), example:

public class MainSampleActivity extends AppCompatActivity implements AAH_FabulousFragment.AnimationListener {
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main_sample);
    }
    
   @Override
    public void onOpenAnimationStart() {
        //do something on open animation start
    }

    @Override
    public void onOpenAnimationEnd() {
        //do something on open animation end
    }

    @Override
    public void onCloseAnimationStart() {
        //do something on close animation start
    }

    @Override
    public void onCloseAnimationEnd() {
        //do something on close animation start
    }
}

  • Static View (Optional)

This parameter is used to make view in Bottom Sheet static when user slides it. It can be any ViewGroup(LinearLayout/FrameLayout etc):

setViewgroupStatic(linearlayout_buttons);
  • ViewPager (Optional)

This parameter is used to support scrolling in ViewPager as BottomSheetDialog does not support multiple views with scroll:

setViewPager(viewPager);

Libraries by developer

  • AutoplayVideos

Apps by developer

Price Stalker Show Card Game Safio chat

License

Copyright 2017 Krupen Ghetiya

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Android library to animate Floating Action Button to Bottom Sheet Dialog and vice-versa
Library written By: Krupen Krupen

Created: 2017-06-26T11:36:38ZLast Update: 2021-02-14T19:33:07Z

Stars: 2388Language: JavaForks: 315
View in Github

Download
Tags: Floating Action Button
Share16Tweet10Send

Related Posts

Programming

Android Button Introduction

December 19, 2020
4k

Categories

  • Android
    • Introduction
    • Activity
      • Activity Basics
      • Lifecycle
      • Routing
    • Fragment
    • UI
      • AppBar and Toolbar
      • TextView
      • Tabs
      • Dialog
      • CardView
      • Chips
      • EditText
      • Navigation Drawer
      • Button
      • Bottom Navigation
    • Animation
    • MediaPlayer
      • VideoPlayer
    • Biometric
    • Jetpack
    • Android Firebase
    • Layouts
    • JSON
    • ContentViews
    • RxJava
    • PinView
    • Utility
    • ScrollView
    • URL
    • Log
    • Intent
    • DateTime
    • DownloadManager
    • Camera
    • SharedPreferences
    • SQLite
    • Retrofit
    • RecyclerView
    • Bluetooth
    • Hardware and Sensors
    • HTTP
    • Android AdapterViews
    • Projects
    • InputViews
    • Navigation
    • Menu
    • System
    • Communication
    • HttpURLConnection
    • Fast Networking Library
    • FileSystem
    • Components
    • Threading
    • Local Database
    • Jetpack
  • Flutter
    • Flutter HTTP
    • Flutter Widgets
    • Flutter Firebase
  • Java
    • Java Threading
    • Java Collections
    • JavaFX
  • Programming
  • Flutter Projects
  • Java DateTime
  • Flutter Listing Views
  • Flutter Image
  • Flutter Local Database
  • Documentary
  • Meditation
  • Flutter Animation and Motion
  • Javascript
    • Framework7
  • Xamarin Android
  • Python
    • CherryPy

Get Free Projects

  • Home
  • Android
  • Buy Projects
  • My Account

© 2021 Camposha

No Result
View All Result
  • Account
  • Activate
  • Activity
  • Become a Teacher
  • Become a Teacher
  • Become a Teacher
  • Become instructor
  • Blog
  • Blog
  • Cancel Payment
  • Cancel Payment
  • Cart
  • Change Password
  • Change Password
  • Checkout
  • Checkout
  • Checkout
  • Contact
  • Contact
  • Contact Us
  • Content restricted
  • Course Checkout
  • Dashboard
  • Edit Profile
  • Edit Profile
  • FAQs
  • Forgot Password
  • Forgot Password
  • Guest
  • Guest
  • Home
  • Home
  • Home Light
  • Instructor Dashboard
  • Instructor Registration
  • IUMP – Account Page
  • IUMP – Default Redirect Page
  • IUMP – Login
  • IUMP – LogOut
  • IUMP – Register
  • IUMP – Reset Password
  • IUMP – TOS Page
  • IUMP – Visitor Inside User Page
  • List courses
  • List wish list
  • Login
  • Login
  • Maintenance
  • Members
  • Membership Account
    • Membership Billing
    • Membership Cancel
    • Membership Checkout
    • Membership Confirmation
    • Membership Invoice
    • Membership Levels
  • Membership Account
    • Membership Billing
    • Membership Cancel
    • Membership Checkout
    • Membership Confirmation
    • Membership Invoice
    • Membership Levels
  • Membership Plans
  • My Account
  • OnePage Documentation
  • Portfolio Grid
  • Portfolio Masonry
  • Portfolio Multigrid
  • Privacy Policy
  • Products
  • Profile
  • Profile
  • Profile
  • Projects
  • Register
  • Register
  • Register
  • Register
  • Sample Page
  • Shop
  • Sign in
  • Sign up
  • Student profile
  • Student Registration
  • Thank You
  • Thank You

© 2021 Camposha

Welcome Back!

Login to your account below

Forgotten Password? Sign Up

Create New Account!

Fill the forms below to register

All fields are required. Log In

Retrieve your password

Please enter your username or email address to reset your password.

Log In