private void setInputProvider() {
List<IExtensionModule> moduleList = RongExtensionManager.getInstance().getExtensionModules();
IExtensionModule defaultModule = null;
if (moduleList != null) {
for (IExtensionModule module : moduleList) {
if (module instanceof DefaultExtensionModule) {
defaultModule = module;
break;
}
}
if (defaultModule != null) {
RongExtensionManager.getInstance().unregisterExtensionModule(defaultModule);
RongExtensionManager.getInstance().registerExtensionModule(new DefaultExtensionModule() {
public EditText mEditText;
public void onDetachedFromExtension() {
this.mEditText = null;
}
@Override
public void onAttachedToExtension(RongExtension extension) {
mEditText = extension.getInputEditText();
extension.getInputEditText().setTextColor(Color.parseColor("#333333"));
}
public List<IEmoticonTab> getEmoticonTabs() {
EmojiTab emojiTab = new EmojiTab();
emojiTab.setOnItemClickListener(new IEmojiItemClickListener() {
public void onEmojiClick(String emoji) {
int start = mEditText.getSelectionStart();
mEditText.getText().insert(start, emoji);
}
public void onDeleteClick() {
mEditText.dispatchKeyEvent(new KeyEvent(0, 67));
}
});
ArrayList list = new ArrayList();
list.add(emojiTab);
list.add(emojiTabTudou);
return list;
}
@Override
public List<IPluginModule> getPluginModules(Conversation.ConversationType
conversationType) {
List<IPluginModule> pluginModules = super.getPluginModules
(conversationType);
//去掉文件传输
pluginModules.remove(0);
pluginModules.remove(0);
if (conversationType.equals(Conversation.ConversationType.PRIVATE)) {
pluginModules.add(new ImagePlugin() {
@Override
public Drawable obtainDrawable(Context context) {
return ContextCompat.getDrawable(context, R.drawable
.icon_photo);
}
});
//小视频
pluginModules.add(SmallvidoPlugin.getInstance());
//红包
pluginModules.add(RedpackagePlugin.getInstance());
//直播
pluginModules.add(LivePlugin.getInstance(ConversationActivity.this,
Constant.LIVING_PRI));
//礼物
pluginModules.add(GiftPlugin.getInstance());
} else if (conversationType.equals(Conversation.ConversationType.GROUP)) {
pluginModules.add(new ImagePlugin() {
@Override
public Drawable obtainDrawable(Context context) {
return ContextCompat.getDrawable(context, R.drawable
.icon_photo);
}
});
//小视频
pluginModules.add(SmallvidoPlugin.getInstance());
//红包
pluginModules.add(RedpackagePlugin.getInstance());
if (mGroupinfo != null && mGroupinfo.getUid().equals(App.getLoginUser().getUid())) {
//群直播
pluginModules.add(LivePlugin.getInstance(ConversationActivity
.this, Constant.LIVING_GROUP));
}
}
return pluginModules;
}
});
}
}
}
```java
网友评论