All Projects → hluhovskyi → Holdingbutton

hluhovskyi / Holdingbutton

Licence: apache-2.0
Button which is visible while user holds it. Main use case is controlling audio recording state (like in Telegram, Viber, VK).

Programming Languages

java
68154 projects - #9 most used programming language

Projects that are alternatives of or similar to Holdingbutton

Progressbutton
Android Progress Button
Stars: ✭ 662 (+11.26%)
Mutual labels:  material-design, button
Camerabutton
Instagram-like button for taking photos or recording videos
Stars: ✭ 121 (-79.66%)
Mutual labels:  material-design, button
Ripple Without Js
Create Material Design ripple effect in your HTML without using a single line of JS.
Stars: ✭ 53 (-91.09%)
Mutual labels:  material-design, button
Customfloatingactionbutton
This view is for replacement of standard Floating Action Button from Google Support Library. It is easy to use, customizable and you can also add text to button
Stars: ✭ 222 (-62.69%)
Mutual labels:  material-design, button
Wymaterialbutton
Interactive and fully animated Material Design button for iOS developers.
Stars: ✭ 80 (-86.55%)
Mutual labels:  material-design, button
Materialfavoritebutton
Animated favorite/star/like button
Stars: ✭ 586 (-1.51%)
Mutual labels:  material-design, button
Light
🍭 The usual Snackbar, but elegant
Stars: ✭ 542 (-8.91%)
Mutual labels:  material-design
Materialpopupmenu
Shows Material popup menus grouped in sections & more
Stars: ✭ 567 (-4.71%)
Mutual labels:  material-design
Remindly
Remindly is a simple and user friendly Android application to create reminders.
Stars: ✭ 535 (-10.08%)
Mutual labels:  material-design
Android Iconics
Android-Iconics - Use any icon font, or vector (.svg) as drawable in your application.
Stars: ✭ 4,916 (+726.22%)
Mutual labels:  material-design
Material Awesome
Material and Mouse driven config for AwesomeWM 4.3
Stars: ✭ 588 (-1.18%)
Mutual labels:  material-design
Polythene
Material Design component library for Mithril and React
Stars: ✭ 578 (-2.86%)
Mutual labels:  material-design
Grocery App
Flutter Grocery Shopping App (Mobile App, Web App) - Want to develop similar solutions for your business? Connect with us - [email protected] Or just submit an inquiry we will connect with you within 24 hours - https://forms.gle/L9EBUnSasYcUAn8Q9
Stars: ✭ 563 (-5.38%)
Mutual labels:  material-design
Angular Mdc Web
Angular wrapper for Material Design (Web) Components
Stars: ✭ 542 (-8.91%)
Mutual labels:  material-design
Introviews Flutter
☀️ A Flutter package for some material design app intro screens with some cool animations.
Stars: ✭ 570 (-4.2%)
Mutual labels:  material-design
Folding Cell Android
📃 FoldingCell is a material design expanding content cell inspired by folding paper material made by @Ramotion
Stars: ✭ 4,859 (+716.64%)
Mutual labels:  material-design
Android Material Design For Pre Lollipop
Various UI implementations, animations & effects based on Material Design compatible with pre Lollipop devices as well. (Work in progess)
Stars: ✭ 585 (-1.68%)
Mutual labels:  material-design
Awaker
article app for android
Stars: ✭ 526 (-11.6%)
Mutual labels:  material-design
Angular2 Mdl
Angular 2, 4, 5, 6, 7, 8, 9, 10, 11 components, directives and styles based on material design lite (npm: @angular-mdl/core)
Stars: ✭ 562 (-5.55%)
Mutual labels:  material-design
Material Design Template
Material Design Based One Page HTML Template
Stars: ✭ 572 (-3.87%)
Mutual labels:  material-design

HoldingButton

Android Arsenal

Button which is visible while user holds it. Main use case is controlling audio recording state (like in Telegram, Viber, VK).

Getting started

Add library as dependency to your build.gradle.

compile 'com.dewarder:holdingbutton:0.1.3'

How to use

  1. Wrap your layout with HoldingButtonLayout. It is simple FrameLayout inside.

     <com.dewarder.holdinglibrary.HoldingButtonLayout
         android:id="@+id/input_holder"
         android:layout_width="match_parent"
         android:layout_height="wrap_content">
         
         ...
      
         <ImageView
             android:id="@+id/start_record"
             android:layout_width="48dp"
             android:layout_height="match_parent"
             android:scaleType="center"
             android:src="@drawable/ic_mic_black_24dp"/>
    
         ...
    
     </com.dewarder.holdinglibrary.HoldingButtonLayout>
    
    
  2. Set app:hbl_holding_view property to id of view which would be translated to HoldingButton

     <com.dewarder.holdinglibrary.HoldingButtonLayout
         android:id="@+id/input_holder"
         android:layout_width="match_parent"
         android:layout_height="wrap_content"
         app:hbl_holding_view="@+id/start_record">
    
  3. Set app:hbl_icon property to icon (usually it is the same as in translated view) which would be appeared in HoldingButton.

     <com.dewarder.holdinglibrary.HoldingButtonLayout
         android:id="@+id/input_holder"
         android:layout_width="match_parent"
         android:layout_height="wrap_content"
         app:hbl_holding_view="@+id/start_record"
         app:hbl_icon="@drawable/ic_mic_black_24dp">
    
  4. Listen events

    mHoldingButtonLayout.addListener(new SimpleHoldingButtonLayoutListener() {
        @Override
        public void onOffsetChanged(float offset, boolean isCancel) {
            mSlideToCancel.setTranslationX(-mHoldingButtonLayout.getWidth() * offset);
            mSlideToCancel.setAlpha(1 - SLIDE_TO_CANCEL_ALPHA_MULTIPLIER * offset);
        }
    });
    
    
  5. Enjoy!

    Check full example

All XML properties

  • hbl_enabled (isButtonEnabled/setButtonEnabled)

    Set enabled or disabled state of button only.

  • hbl_direction (getDirection/setDirection)

    Set direction of sliding. Possible directions are start (from right to left) and end (from left to right).

  • hbl_cancel_offset (getCancelOffset/setCancelOffset)

    Set minimum offset for cancel action.

  • hbl_icon (setIcon)

  • hbl_cancel_icon (setCancelIcon)

  • hbl_color (getColor/setColor)

  • hbl_cancel_color (getCancelColor/CancelColor)

  • hbl_radius (getRadius/setRadius)

  • hbl_second_radius (getSecondRadius/setSecondRadius)

  • hbl_second_alpha (getSecondAlpha/setSecondAlpha)

  • hbl_offset_x (getOffsetX/setOffsetX)

  • hbl_offset_y (getOffsetY/setOffsetY)

  • hbl_animate_holding_view (setAnimateHoldingView/isAnimateHoldingView)

License

Copyright (C) 2017 Artem Glugovsky

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.
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].