Comments (5)
需要加入权限控制,有相应权限的人才可以使用相应的表情。
from xhsemoticonskeyboard.
什么意思呢
from xhsemoticonskeyboard.
就是类似小红书里面那样,redclub用户才能使用一部分表情。
from xhsemoticonskeyboard.
redclub用户才能使用一部分表情可以理解为具有某些标志的特殊表情集
那么只需要在构造键盘表情的时候做判断
if(redclub) {
// 有权限用户,直接添加小红书这部分的redclub表情集,参考SimpleCommonUtils/addXhsPageSetEntity()
EmoticonPageSetEntity xhsPageSetEntity
= new EmoticonPageSetEntity.Builder()
.setLine(3)
.setRow(7)
.setEmoticonList(ParseDataUtils.ParseXhsData(DefXhsEmoticons.xhsEmoticonArray, ImageBase.Scheme.ASSETS))
.setIPageViewInstantiateItem(getDefaultEmoticonPageViewInstantiateItem(getCommonEmoticonDisplayListener(emoticonClickListener, Constants.EMOTICON_CLICK_TEXT)))
.setShowDelBtn(EmoticonPageEntity.DelBtnStatus.LAST)
.setIconUri(ImageBase.Scheme.ASSETS.toUri("xhsemoji_19.png"))
.build();
pageSetAdapter.add(xhsPageSetEntity);
} else {
// 如果只是想在底部表情集合栏添加一个按钮,点击的时候弹出提示,参考SimpleChatActivity/initEmoticonsKeyBoardBar()
ekBar.getEmoticonsToolBarView().addToolItemView(R.mipmap.icon_setting, new View.OnClickListener() {
@Override
public void onClick(View v) {
Toast.makeText(SimpleChatActivity.this, "SETTING", Toast.LENGTH_SHORT).show();
}
});
// 如果只是想在底部表情集合栏添加一个按钮,同时还可以通过滑动的方式滑动到该页面,页面上提示解锁,那么可以插入一个自定义的view代替表情默认view,参考SimpleChatActivity/addTestPageSetEntity()
PageSetEntity pageSetEntity = new PageSetEntity.Builder()
.addPageEntity(new PageEntity(new SimpleAppsGridView(context)))
.setIconUri(ImageBase.Scheme.DRAWABLE.toUri("icon_kaomoji"))
.setShowIndicator(false)
.build();
pageSetAdapter.add(pageSetEntity);
}
// 如果想保持和其他正常的表情集一样的正常显示滑动,但是在表情页上有遮罩式的提示,那么就需要自定义EmoticonsAdapter,参考SimpleCommonUtils/addGoodGoodStudyPageSetEntity()
EmoticonPageSetEntity pageSetEntity
= new EmoticonPageSetEntity.Builder()
.setLine(emoticonPageSetEntity.getLine())
.setRow(emoticonPageSetEntity.getRow())
.setEmoticonList(emoticonPageSetEntity.getEmoticonList())
.setIPageViewInstantiateItem(getEmoticonPageViewInstantiateItem(BigEmoticonsAndTitleAdapter.class, emoticonClickListener))
.setIconUri(ImageBase.Scheme.FILE.toUri(filePath + "/" + emoticonPageSetEntity.getIconUri()))
.build();
pageSetAdapter.add(pageSetEntity);
// 如果想保持和其他正常的表情集其他全部都一样,但是在点击的时候提示权限不足,可以自定义EmoticonsAdapter,或者设置自定义actiontype,参考SimpleCommonUtils/getCommonEmoticonClickListener()
return new EmoticonClickListener() {
@Override
public void onEmoticonClick(Object o, int actionType, boolean isDelBtn) {
if (isDelBtn) {
SimpleCommonUtils.delClick(editText);
} else {
if (o == null) {
return;
}
if (actionType == Constants.EMOTICON_CLICK_TEXT) {
String content = null;
if (o instanceof EmojiBean) {
content = ((EmojiBean) o).emoji;
} else if (o instanceof EmoticonEntity) {
content = ((EmoticonEntity) o).getContent();
}
if (TextUtils.isEmpty(content)) {
return;
}
int index = editText.getSelectionStart();
Editable editable = editText.getText();
editable.insert(index, content);
}
}
}
};
from xhsemoticonskeyboard.
~ ~ ///
from xhsemoticonskeyboard.
Related Issues (20)
- 兼容性真的差劲 HOT 2
- RecyclerView HOT 1
- QQkeyboard demo的issue
- 建议把设置发送按钮背景的方法去掉
- clearSpan引发的卡顿
- 点击发送不隐藏键盘问题 HOT 1
- 怎么在关掉键盘的同时把已打开的emoji或和apps关闭
- 这上面的源码是最新的吗?怎么看版本还是2.0.1?而且Android studio 3.3.2不能使用AndroidEmoji
- Android studio 3.3.2不能使用AndroidEmoji HOT 3
- bug input区域空白 && 键盘无法升起 HOT 2
- context leaked HOT 1
- demo 可以把 AndroidEmoji也升级成1.3版本吗?不然我们自己还要修改
- com.github.w446108264:AndroidEmoji:1.0.0解决 HOT 1
- How add another emoji pack?
- 星多是有原因的~的确能用!但是项目就不能更新一下?新版AS都跑不起来,我改了好久才能用! HOT 2
- 已解决
- 为什么下载安装您提供的apk,打开应用之后显示的输入法还是手机默认的输入法呢?
- 为什么没有键盘布局的文件啊?
- 软键盘删除功能无效,对EditText添加OnKeyListener也无法监听输入键
- 锁屏后解锁出现空白区域,点击输入框软键盘弹起,把空白区域弹起
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from xhsemoticonskeyboard.