Skip to content

Commit 64eab78

Browse files
committed
Add read
1 parent be1cd0b commit 64eab78

File tree

5 files changed

+75
-0
lines changed

5 files changed

+75
-0
lines changed

README.md

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
Buffer Text Input Layout
2+
-------------------------
3+
4+
This is a simple customisation of the TextInputLayout found in the Design Support Library.
5+
6+
Whilst this is an awesome component that we've made great use of, we wanted to be able to display
7+
the counter so that the value displayed was:
8+
9+
- Descending
10+
- Only visible when we reach a certain number of characters away from the maximum counter value
11+
12+
Hence why we created this simple component :)
13+
14+
##Ascending
15+
16+
![Ascending](/art/ascending.gif)
17+
18+
##Descending
19+
20+
![Descending](/art/descending.gif)
21+
22+
##Standard
23+
24+
![Standard](/art/standard.gif)
25+
26+
27+
##Display when a given count away from the maximum value
28+
29+
![Hidden](/art/hidden.gif)
30+
31+
32+
#How to use
33+
34+
In exactly the same way as the support library! Simply wrap an edit text field like so:
35+
36+
<org.buffer.android.buffertextinputlayout.BufferTextInputLayout
37+
android:layout_width="match_parent"
38+
android:layout_height="wrap_content"
39+
app:counterEnabled="true"
40+
app:counterMaxLength="10"
41+
app:counterOverflowTextAppearance="@style/counterOverride"
42+
app:counterTextAppearance="@style/counterText"
43+
app:hintEnabled="true"
44+
app:counterMode="ascending">
45+
46+
<EditText
47+
android:layout_width="match_parent"
48+
android:layout_height="wrap_content"
49+
android:hint="@string/text_hint" />
50+
51+
</org.buffer.android.buffertextinputlayout.BufferTextInputLayout>
52+
53+
54+
#Setting attributes via XML
55+
56+
In our XML layout, we can set two extra attributes for the BufferTextInputLayout:
57+
58+
- app:counterMode -> Set the mode in which the counter should use when being displayed (DESCENDING, ASCENDING, STANDARD)
59+
- app:displayFromCount -> Set the value for which how many characters should be remaining until the counter becomes visible
60+
61+
e.g
62+
63+
app:displayFromCount="5"
64+
app:counterMode="descending"
65+
66+
67+
#Setting attributes programmatically
68+
69+
- setCounterMode(CounterMode counterMode) -> Set the mode in which the counter should use when being displayed (DESCENDING, ASCENDING, STANDARD)
70+
- setCharactersRemainingUntilCounterDisplay(int remainingCharacters) -> Set the value for which how many characters should be remaining until the counter becomes visible
71+
72+
e.g.
73+
74+
bufferTextInputLayout.setCounterMode(CounterMode.DESCENDING);
75+
bufferTextInputLayout.setCharactersRemainingUntilCounterDisplay(40);

art/ascending.gif

37 KB
Loading

art/desceding.gif

36.9 KB
Loading

art/hidden.gif

48.5 KB
Loading

art/standard.gif

44.6 KB
Loading

0 commit comments

Comments
 (0)