Elegant Number Button


Source link: https://github.com/ashik94vc/ElegantNumberButton

Elegant Number Button

A simple Android library to implement a number counter with increment and decrement buttons.

Screens

Download

Grab the latest version on gradle using

compile 'com.cepheuen.elegant-number-button:lib:1.0.2'

or on maven

<dependency>
<groupId>com.cepheuen.elegant-number-button</groupId>
<artifactId>lib</artifactId>
<version>1.0.2</version>
<type>pom</type> </dependency>  

Usage

For Working implementation of this library check ElegantNumberButtonSample App

  • Just include the view as you do with any android widget.

  • Implement it in your java code as anyother widget.

  • To get the number simply call getNumber() method on the button object.

  • To get the number from the button as soon as the button is clicked add a setOnClickListener to the view.

    ElegantNumberButton button = (ElegantNumberButton) findViewById(R.id.button);
     button.setOnClickListener(new ElegantNumberButton.OnClickListener() {
    
    @Override
    
    public void onClick(View view) {
    
     String num = button.getNumber();
    
    }
    
      
    }
    );
    
  • Or use a valueChangeListener to listen for changes in value.

    elegantNumberButton.setOnValueChangeListener(new ElegantNumberButton.OnValueChangeListener() {
    
    @Override
    
    public void onValueChange(ElegantNumberButton view, int oldValue, int newValue) {
    
     Log.d(TAG, String.format("oldValue: %d
    newValue: %d", oldValue, newValue));
    
    }
    
      
    }
    );
    

Customization

backgroundColor : Set button Background color

initialNumber: Set initial number for the button.

finalNumber : Set final number range for button.

textColor: Modify the text color of the button.

textSize: Change text size of the button.

backgroundDrawable: Add drawable background for the button.

Methods

setNumber(Integer number): Update the number of the widget.

setRange(Integer startNumber, Integer finalNumber) : Set the operational range for the widget

setOnValueChangeListener(OnValueChangedListener listener): listen for changes in the value

Contributing

  1. Fork it!
  2. Create your feature branch: git checkout -b my-new-feature
  3. Commit your changes: git commit -am 'Add some feature'
  4. Push to the branch: git push origin my-new-feature
  5. Submit a pull request

Changelog

Version 1.0.2

  • Added ValueChangeListener to listen for changes in values

Version 1.0.1

  • Added Range for the widget
  • Changed attribute from initialText to initialNumber

Version 1.0

  • Initial Release

Author

License

Copyright 2016 Ashik Vetrivelu

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. 

Resources

A tool for generating Android Parcelable implementations.

Library that allows you to easily add emoji support to your Android application.

An Android Library dedicated to encourage users to rate/comment an app.

Android Tinted Status Bars using Xposed.

AndroidSlidingUpPanel provides a simple way to add a draggable sliding up panel (popularized by Google Music, Google Maps and Rdio) to your Android application.

ConnectBot is a Secure Shell client for the Android platform. Its ultimate goal is to create a secure connection through which you can use a shell on a remote machine and transfer files back and forth to your phone.

Topics


2D Engines   3D Engines   9-Patch   Action Bars   Activities   ADB   Advertisements   Analytics   Animations   ANR   AOP   API   APK   APT   Architecture   Audio   Autocomplete   Background Processing   Backward Compatibility   Badges   Bar Codes   Benchmarking   Bitmaps   Bluetooth   Blur Effects   Bread Crumbs   BRMS   Browser Extensions   Build Systems   Bundles   Buttons   Caching   Camera   Canvas   Cards   Carousels   Changelog   Checkboxes   Cloud Storages   Color Analysis   Color Pickers   Colors   Comet/Push   Compass Sensors   Conferences   Content Providers   Continuous Integration   Crash Reports   Credit Cards   Credits   CSV   Curl/Flip   Data Binding   Data Generators   Data Structures   Database   Database Browsers   Date &   Debugging   Decompilers   Deep Links   Dependency Injections   Design   Design Patterns   Dex   Dialogs   Distributed Computing   Distribution Platforms   Download Managers   Drawables   Emoji   Emulators   EPUB   Equalizers &   Event Buses   Exception Handling   Face Recognition   Feedback &   File System   File/Directory   Fingerprint   Floating Action   Fonts   Forms   Fragments   FRP   FSM   Functional Programming   Gamepads   Games   Geocaching   Gestures   GIF   Glow Pad   Gradle Plugins   Graphics   Grid Views   Highlighting   HTML   HTTP Mocking   Icons   IDE   IDE Plugins   Image Croppers   Image Loaders   Image Pickers   Image Processing   Image Views   Instrumentation   Intents   Job Schedulers   JSON   Keyboard   Kotlin   Layouts   Library Demos   List View   List Views   Localization   Location   Lock Patterns   Logcat   Logging   Mails   Maps   Markdown   Mathematics   Maven Plugins   MBaaS   Media   Menus   Messaging   MIME   Mobile Web   Native Image   Navigation   NDK   Networking   NFC   NoSQL   Number Pickers   OAuth   Object Mocking   OCR Engines   OpenGL   ORM   Other Pickers   Parallax List   Parcelables   Particle Systems   Password Inputs   PDF   Permissions   Physics Engines   Platforms   Plugin Frameworks   Preferences   Progress Indicators   ProGuard   Properties   Protocol Buffer   Pull To   Purchases   Push/Pull   QR Codes   Quick Return   Radio Buttons   Range Bars   Ratings   Recycler Views   Resources   REST   Ripple Effects   RSS   Screenshots   Scripting   Scroll Views   SDK   Search Inputs   Security   Sensors   Services   Showcase Views   Signatures   Sliding Panels   Snackbars   SOAP   Social Networks   Spannable   Spinners   Splash Screens   SSH   Static Analysis   Status Bars   Styling   SVG   System   Tags   Task Managers   TDD &   Template Engines   Testing   Testing Tools   Text Formatting   Text Views   Text Watchers   Text-to   Toasts   Toolkits For   Tools   Tooltips   Trainings   TV   Twitter   Updaters   USB   User Stories   Utils   Validation   Video   View Adapters   View Pagers   Views   Watch Face   Wearable Data   Wearables   Weather   Web Tools   Web Views   WebRTC   WebSockets   Wheel Widgets   Wi-Fi   Widgets   Windows   Wizards   XML   XMPP   YAML   ZIP Codes