sunhapper / Spedittool
Licence: mit
An efficient and scalable library for inputing and displaying gif or @mention on graph-text mixed TextView/EditText
Stars: ✭ 292
Programming Languages
kotlin
9241 projects
Projects that are alternatives of or similar to Spedittool
Gsyricktext
类似微博的emoji表情、@人、话题等的EdiText,优化了编辑框中的光标点击和删除处理。TextView支持emoji表情、话题、链接、电话和@某人特殊显示的文本。
Stars: ✭ 651 (+122.95%)
Mutual labels: edittext, emoji, textview
CustomFontView
Custom View classes for TextView, EditText & Buttons - to set custom fonts
Stars: ✭ 26 (-91.1%)
Mutual labels: android-ui, textview, edittext
LicenseTextView
Custom Lincese TextView for android
Stars: ✭ 31 (-89.38%)
Mutual labels: android-ui, textview
Editdrawabletext
EditDrawableText - An EditText which makes your Drawable Clickable
Stars: ✭ 288 (-1.37%)
Mutual labels: edittext, drawable
SuperShapeView
A smart custom view support shapes for ImageView, TextView ,EditView ,instead of shape.xml.(自定义形状控件,支持TextView,EditText)
Stars: ✭ 60 (-79.45%)
Mutual labels: textview, edittext
Extract-Color-Palette-Api
Create gradient drawable by extracting prominent colors from image⚫⚪
Stars: ✭ 16 (-94.52%)
Mutual labels: android-ui, drawable
Streamoji
Custom emoji rendering library for iOS apps with support for GIF & still images - plug-in extension for UITextView - performance, cache ✅ - Made with 💘 by @GetStream
Stars: ✭ 215 (-26.37%)
Mutual labels: gif, emoji
svg2vector
Online batch converter of SVG images to Android vector drawable XML resource files
Stars: ✭ 39 (-86.64%)
Mutual labels: android-ui, drawable
EasyMoney-Widgets
The widgets (EditText and TextView) for support of money requirements like currency, number formatting, comma formatting etc.
Stars: ✭ 91 (-68.84%)
Mutual labels: textview, edittext
Awesome-Image-Gallery-Android
Open source Image Gallery with tons of feature .
Stars: ✭ 22 (-92.47%)
Mutual labels: gif, glide
QuestionnaireView
A simple view to be able to display question and various field (Radio, EditText, checkbox ) for answers
Stars: ✭ 34 (-88.36%)
Mutual labels: android-ui, edittext
TypedTextView
Custom implementation of Android's TextView simulating a keyboard/type-writer.
Stars: ✭ 57 (-80.48%)
Mutual labels: android-ui, textview
ReactButton
Android Library to make it easy to add ReactButton feature in your app with Multi Reactions like Facebook or Linkedin, you can add many reactions as you want, you can also split them into a number of columns, and also customize the colours and text for each reaction
Stars: ✭ 100 (-65.75%)
Mutual labels: emoji, android-ui
ShapeView
打造万能shape,再也不用写很多xml了,可以当做TextView,Button,EditText等多种控件,方便实用
Stars: ✭ 34 (-88.36%)
Mutual labels: textview, edittext
TextViewPlus
an android library for setting custom font in xml layout
Stars: ✭ 27 (-90.75%)
Mutual labels: textview, edittext
Android Gif Drawable
Views and Drawable for displaying animated GIFs on Android
Stars: ✭ 8,987 (+2977.74%)
Mutual labels: gif, drawable
KodeEditor
A simple code editor with syntax highlighting and pinch to zoom
Stars: ✭ 60 (-79.45%)
Mutual labels: textview, edittext
Description
An efficient and scalable library for inputing and displaying gif or @mention on graph-text mixed TextView/EditText
ScreenShot
feature
- [x] fully removed special content
- [x] part removed special content
- [x] custom style
- [x] show gif on text
- [x] load gif with AndroidGifDrawable
- [x] load gif with Gidle
todo
- [ ] load gif with Fresco
- [ ] more styles of ImageSpan
change log
-
1.0.1-1.0.4
- fix bug
-
1.0.0
- use more elegant implementation of @mention(special thanks to iYaoy)
- clearer package structure
- library for supporting Glide/AndroidGifDrawable
Usage
Gradle
- root build.gradle
allprojects {
repositories {
...
maven { url 'https://jitpack.io' }
}
}
- dependency
dependencies {
implementation 'com.github.sunhapper.SpEditTool:SpEditText:{last version}'
//help to create gif drawable use Glide
implementation 'com.github.sunhapper.SpEditTool:SpGlideDrawable:{last version}'
//help to create gif drawable use AndroidGifDrawable
implementation 'com.github.sunhapper.SpEditTool:SpGifDrawable:{last version}'
}
xml
EditText
- CustomInputConnectionWrapper to accept keyEvent,because setOnKeyListener may not react KeyEvent when use Google input method
- SpanChangedWatcher to handle @mention content
- GifWatcher to display gif on text
<com.sunhapper.x.spedit.view.SpXEditText
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
TextView
<com.sunhapper.x.spedit.view.SpXTextView
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
java
- create @mention Spannable
//IntegratedSpan will be fully removed
public class MentionUser implements IntegratedSpan {
public String name;
public long id;
public Spannable getSpannableString() {
SpannableString spannableString = new SpannableString(getDisplayText());
spannableString.setSpan(new ForegroundColorSpan(Color.MAGENTA), 0, spannableString.length(),
Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
spannableString.setSpan(this, 0, spannableString.length(),
Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
SpannableStringBuilder stringBuilder = new SpannableStringBuilder();
return stringBuilder.append(spannableString).append(" ");
}
}
- delete style span when BreakableSpan was broken
//BreakableSpan can be part removed
public class Topic implements BreakableSpan {
...
/**
* @return true the BreakableSpan will be removed
* you can remove custom style span when content broken
*/
@Override
public boolean isBreak(Spannable text) {
int spanStart = text.getSpanStart(this);
int spanEnd = text.getSpanEnd(this);
boolean isBreak = spanStart >= 0 && spanEnd >= 0 && !text.subSequence(spanStart, spanEnd).toString().equals(
getDisplayText());
if (isBreak && styleSpan != null) {
text.removeSpan(styleSpan);
styleSpan = null;
}
return isBreak;
}
}
- load gif with AndroidGifDrawable
Drawable drawable = new TextGifDrawable(emojiconFile);
Spannable spannable = SpUtil.createGifDrawableSpan(gifDrawable,"text");
- load gif with Glide
//placeholder drawable
GifDrawable gifDrawable = new TextGifDrawable(getResources(), R.drawable.a);
ProxyDrawable proxyDrawable = new ProxyDrawable();
GlideApp.with(this)
.load(gifurl)
.placeholder(gifDrawable)
.into(new DrawableTarget(proxyDrawable));
return SpUtil.createResizeGifDrawableSpan(proxyDrawable, "text");
- custom Factory
- you can create your own SpanWatcher and Spannable.Factory/Editable.Factory
- use
setSpannableFactory/setEditableFactory
instead of using SpXTextView or SpXEditText
proguard
-keep class com.sunhapper.x.spedit.**{*;}
more detail info and guidance,please see the app demo
welcome to star,PR and issue
Note that the project description data, including the texts, logos, images, and/or trademarks,
for each open source project belongs to its rightful owner.
If you wish to add or remove any projects, please contact us at [email protected].