Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/bufferapp/buffertextinputlayout
A simple customised version of the TextInputLayout from the Android Design Support Library ⌨️
https://github.com/bufferapp/buffertextinputlayout
android android-library android-ui java textinputlayout
Last synced: 5 days ago
JSON representation
A simple customised version of the TextInputLayout from the Android Design Support Library ⌨️
- Host: GitHub
- URL: https://github.com/bufferapp/buffertextinputlayout
- Owner: bufferapp
- License: apache-2.0
- Created: 2016-12-14T08:59:09.000Z (almost 8 years ago)
- Default Branch: main
- Last Pushed: 2020-06-22T16:03:56.000Z (over 4 years ago)
- Last Synced: 2024-08-02T01:23:31.719Z (3 months ago)
- Topics: android, android-library, android-ui, java, textinputlayout
- Language: Java
- Homepage:
- Size: 246 KB
- Stars: 983
- Watchers: 52
- Forks: 103
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
Buffer Text Input Layout
-------------------------(Coming to maven central soon!)
This is a simple customisation of the TextInputLayout found in the Design Support Library.
Whilst this is an awesome component that we've made great use of, we wanted to be able to display
the counter so that the value displayed was:- Not formatted in the way that the support library version was
- Only visible when we reach a certain number of characters away from the maximum counter valueHence why we created this simple component :)
## Ascending
![Ascending](/art/ascending.gif)
## Descending
![Descending](/art/descending.gif)
## Standard
![Standard](/art/standard.gif)
## Display when a given count away from the maximum value
![Hidden](/art/hidden.gif)
# How to use
In exactly the same way as the support library! Simply wrap an edit text field like so:
```xml
```
# Setting attributes via XML
In our XML layout, we can set two extra attributes for the BufferTextInputLayout:
- app:counterMode -> Set the mode in which the counter should use when being displayed (DESCENDING, ASCENDING, STANDARD)
- app:displayFromCount -> Set the value for which how many characters should be remaining until the counter becomes visiblee.g
```xml
app:displayFromCount="5"
app:counterMode="descending"
```# Setting attributes programmatically
- setCounterMode(CounterMode counterMode) -> Set the mode in which the counter should use when being displayed (DESCENDING, ASCENDING, STANDARD)
- setCharactersRemainingUntilCounterDisplay(int remainingCharacters) -> Set the value for which how many characters should be remaining until the counter becomes visiblee.g.
```java
bufferTextInputLayout.setCounterMode(CounterMode.DESCENDING);
bufferTextInputLayout.setCharactersRemainingUntilCounterDisplay(40);
```