Git Product home page Git Product logo

hidely's Introduction

Hidely

Custom Views that can hide/show a View with some Animations (inspired by the Android FAB)

Demo

Install

dependencies {
    compile 'com.devlomi.hidely:hidely:1.0.0'
}

Usage

Basic Usage

use one of the following Hidely Views

  • HidelyButton

  • HidelyImageButton

  • HidelyImageView

  • HidelyView

  • HidelyFrameLayout

  • HidelyRelativeLayout

  • HidelyLinearLayout

OR

if you want to make your own custom view then :

  1. make your own custom view and make it implements HidelyInterface this will give you the 4 methods show() , hide() ,isShowing() and setAnimationCallbacks()
  2. make an Object from HidelyCore and pass the view as a Parameter: hidelyCore = new HidelyCore(this);
  3. fill the 4 methods with hidely core like this
   @Override
    public void show() {
        if (hidelyCore != null)
            hidelyCore.show();
    }

    @Override
    public void hide() {
        if (hidelyCore != null)
            hidelyCore.hide();
    }

    @Override
    public boolean isShowing() {
        return hidelyCore == null ? false : hidelyCore.isShowing();
    }

    @Override
    public void setAnimationCallbacks(HidelyAnimationCallbacks animationCallbacks) {
        hidelyCore.setAnimationListener(animationCallbacks);
    }

XML

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context=".SimpleExample">

    <com.devlomi.hidely.hidelyviews.HidelyImageButton
        android:id="@+id/simple_example_hidely"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_centerInParent="true"
        android:background="@drawable/circle_bg"
        android:padding="50dp"
        android:src="@drawable/ic_add" />



    <Button
        android:id="@+id/change_button_state"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_below="@id/simple_example_hidely"
        android:layout_centerHorizontal="true"
        android:layout_marginTop="8dp"
        android:text="CHANGE BUTTON STATE" />

</RelativeLayout>

Java

        HidelyImageButton hidelyImageButton = findViewById(R.id.simple_example_hidely);
        Button changeButtonState = findViewById(R.id.change_button_state);

        changeButtonState.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                //check if button is Showing
                if (hidelyImageButton.isShowing())
                //hide button
                    hidelyImageButton.hide();
                else
                //show button
                    hidelyImageButton.show();
            }
        });

Listen for Animation Callbacks

 hidelyImageButton.setAnimationCallbacks(new HidelyAnimationCallbacks() {
            @Override
            public void onAnimationStart() {
                
            }

            @Override
            public void onAnimationEnd() {

            }
        });
        

hidely's People

Contributors

3llomi avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.