AlphabetDecorator
Alphabet decorator for RecyclerView
Install / Use
/learn @damianpetla/AlphabetDecoratorREADME
AlphabetDecorator
This is an implementation of RecyclerView.ItemDecorator for alphabet letters being shown on a left side.
It's based on Google's Contatcs application.

What can you do with it?
You can set left padding in decorator constructor. If it is set to 0, letters will be drawn from the left edge of item view bounds. The size of the letter is equal to the half of the item view height. Also letter is centered vertically.
You can set letters color in decorator constructor.
recyclerView.addItemDecoration(AlphabetDecorator(48, Color.DKGRAY))
How to use it?
The easiest way is using JitPack
repositories {
// ...
maven { url "https://jitpack.io" }
}
dependencies {
compile 'com.github.damianpetla:AlphabetDecorator:v0.1'
}
Your RecyclerView's view holder must implement TextHolder and set TextView that provides text for ItemDecorator
Kotlin
class SimpleViewHolder(view: View) : RecyclerView.ViewHolder(view), TextHolder {
override val textView = view as TextView
}
Java
public class SimpleViewHolder extends RecyclerView.ViewHolder implements TextHolder {
public SimpleViewHolder(View itemView) {
super(itemView);
}
@NotNull
@Override
public TextView getTextView() {
return (TextView) itemView;
}
}
In sample above I assumed that item layout is a single TextView.
License
Copyright 2015 Damian Petla
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.
Related Skills
node-connect
343.1kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
90.0kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
343.1kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
qqbot-media
343.1kQQBot 富媒体收发能力。使用 <qqmedia> 标签,系统根据文件扩展名自动识别类型(图片/语音/视频/文件)。
