MCPcopy Index your code
hub / github.com/bufferapp/BufferTextInputLayout

github.com/bufferapp/BufferTextInputLayout @1.1

Chat with this repo
repository ↗ · DeepWiki ↗ · release 1.1 ↗ · + Follow
211 symbols 449 edges 14 files 44 documented · 21%
What it actually does AI analysis from the code graph — generated when you open this
loading…
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 value

Hence why we created this simple component :)

Ascending

Ascending

Descending

Descending

Standard

Standard

Display when a given count away from the maximum value

Hidden

How to use

In exactly the same way as the support library! Simply wrap an edit text field like so:

<org.buffer.android.buffertextinputlayout.BufferTextInputLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        app:counterEnabled="true"
        app:counterMaxLength="10"
        app:counterOverflowTextAppearance="@style/counterOverride"
        app:counterTextAppearance="@style/counterText"
        app:hintEnabled="true"
        app:counterMode="ascending">

    <EditText
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:hint="@string/text_hint" />

</org.buffer.android.buffertextinputlayout.BufferTextInputLayout>

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 visible

e.g

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 visible

e.g.

bufferTextInputLayout.setCounterMode(CounterMode.DESCENDING);
bufferTextInputLayout.setCharactersRemainingUntilCounterDisplay(40);

Extension points exported contracts — how you extend this code

AnimatorUpdateListener (Interface)
(no doc) [3 implementers]
buffertextinputlayout/src/main/java/org/buffer/android/buffertextinputlayout/animator/ValueAnimatorCompat.java
TextInputListener (Interface)
(no doc) [1 implementers]
buffertextinputlayout/src/main/java/org/buffer/android/buffertextinputlayout/TextInputListener.java
Creator (Interface)
(no doc) [1 implementers]
buffertextinputlayout/src/main/java/org/buffer/android/buffertextinputlayout/animator/ValueAnimatorCompat.java

Core symbols most depended-on inside this repo

recalculate
called by 16
buffertextinputlayout/src/main/java/org/buffer/android/buffertextinputlayout/util/CollapsingTextHelper.java
getText
called by 13
buffertextinputlayout/src/main/java/org/buffer/android/buffertextinputlayout/util/CollapsingTextHelper.java
lerp
called by 10
buffertextinputlayout/src/main/java/org/buffer/android/buffertextinputlayout/util/CollapsingTextHelper.java
setText
called by 7
buffertextinputlayout/src/main/java/org/buffer/android/buffertextinputlayout/util/CollapsingTextHelper.java
updateLabelState
called by 6
buffertextinputlayout/src/main/java/org/buffer/android/buffertextinputlayout/BufferTextInputLayout.java
setHint
called by 6
buffertextinputlayout/src/main/java/org/buffer/android/buffertextinputlayout/BufferTextInputLayout.java
updateCounter
called by 6
buffertextinputlayout/src/main/java/org/buffer/android/buffertextinputlayout/BufferTextInputLayout.java
addView
called by 5
buffertextinputlayout/src/main/java/org/buffer/android/buffertextinputlayout/BufferTextInputLayout.java

Shape

Method 188
Class 17
Interface 5
Enum 1

Languages

Java100%

Modules by API surface

buffertextinputlayout/src/main/java/org/buffer/android/buffertextinputlayout/BufferTextInputLayout.java84 symbols
buffertextinputlayout/src/main/java/org/buffer/android/buffertextinputlayout/util/CollapsingTextHelper.java50 symbols
buffertextinputlayout/src/main/java/org/buffer/android/buffertextinputlayout/animator/ValueAnimatorCompat.java30 symbols
buffertextinputlayout/src/main/java/org/buffer/android/buffertextinputlayout/animator/ValueAnimatorCompatImpl.java13 symbols
buffertextinputlayout/src/main/java/org/buffer/android/buffertextinputlayout/util/ViewGroupUtils.java11 symbols
buffertextinputlayout/src/main/java/org/buffer/android/buffertextinputlayout/util/DrawableUtils.java4 symbols
buffertextinputlayout/src/main/java/org/buffer/android/buffertextinputlayout/util/ViewGroupUtilsHoneycomb.java3 symbols
buffertextinputlayout/src/main/java/org/buffer/android/buffertextinputlayout/util/MathUtils.java3 symbols
buffertextinputlayout/src/main/java/org/buffer/android/buffertextinputlayout/CounterMode.java3 symbols
sample/src/main/java/android/buffer/org/sample/MainActivity.java2 symbols
buffertextinputlayout/src/main/java/org/buffer/android/buffertextinputlayout/util/ViewUtils.java2 symbols
buffertextinputlayout/src/main/java/org/buffer/android/buffertextinputlayout/util/ThemeUtils.java2 symbols

For agents

$ claude mcp add BufferTextInputLayout \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact