融云集成4--会话列表,会话界面的集成
2017-02-22 17:53
204 查看
参考资料:http://www.rongcloud.cn/docs/android.html#配置会话列表
一.静态注册
1.在需要显示会话列表的Activity布局文件中,直接引用:
注意 android:name 固定为融云的 ConversationListFragment。
2.配置 intent-filter:
融云 SDK 是通过隐式调用的方式来实现界面跳转的。因此您需要在 AndroidManifest.xml 中,您的会话列表 Activity 下面配置 intent-filter,其中,android:host 是您应用的包名,需要手动修改,其他请保持不变。
3.启动方式:
二、动态注册:
布局文件:
三、会话界面配置
1. 会话 Fragment 跟会话列表是完全一致的,您可以用同样的方式快速的配置好。
配置布局文件
这是您的会话 Activity 对应的布局文件 conversation.xml,注意 android:name 固定为融云的 ConversationFragment。
2.配置 intent-filter
在 AndroidManifest.xml 中,会话 Activity 下面配置 intent-filter。 注意请修改 android:host 为您应用的包名,其他保持不变。
3.会话界面设置顶部显示好友昵称:
4.启动方式
1. 自动启动:当我们点击会话列表中某个会话时,融云会触发自己实现的点击事件,隐式启动会话界面,从而进入某一个会话界面,所以我们可以不用去处理会话列表item的点击事件;
2.参考下面手动启动的方式
四、聚合会话列表
1.配置布局文件
这是您的聚合会话列表 Activity 对应的布局文件:subconversationlist.xml。 注意 android:name 固定为融云的 SubConversationListFragment。
2.配置 intent-filter
在 AndroidManifest.xml 中, 聚合会话 Activity 下面配置 intent-filter。 注意请修改 android:host 为您应用的包名,其他保持不变。
五、手动启动各种界面
一.静态注册
1.在需要显示会话列表的Activity布局文件中,直接引用:
注意 android:name 固定为融云的 ConversationListFragment。
<?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="match_parent" android:layout_height="match_parent"> <fragment android:id="@+id/conversationlist" android:name="io.rong.imkit.fragment.ConversationListFragment" android:layout_width="match_parent" android:layout_height="match_parent" /> </LinearLayout>
2.配置 intent-filter:
融云 SDK 是通过隐式调用的方式来实现界面跳转的。因此您需要在 AndroidManifest.xml 中,您的会话列表 Activity 下面配置 intent-filter,其中,android:host 是您应用的包名,需要手动修改,其他请保持不变。
<!--会话列表--> <activity android:name="io.rong.fast.activity.ConversationListActivity" android:screenOrientation="portrait" android:windowSoftInputMode="stateHidden|adjustResize"> <intent-filter> <action android:name="android.intent.action.VIEW" /> <category android:name="android.intent.category.DEFAULT" /> <data android:host="io.rong.fast" android:pathPrefix="/conversationlist" android:scheme="rong" /> </intent-filter> </activity>
3.启动方式:
HashMap<String, Boolean> hashMap = new HashMap<>(); //会话类型 以及是否聚合显示 hashMap.put(Conversation.ConversationType.PRIVATE.getName(),false); hashMap.put(Conversation.ConversationType.PUSH_SERVICE.getName(),true); hashMap.put(Conversation.ConversationType.SYSTEM.getName(),true); RongIM.getInstance().startConversationList(this,hashMap);
二、动态注册:
布局文件:
<!--会话列表--> <FrameLayout android:id="@+id/rong_container" android:layout_width="match_parent" android:layout_height="match_parent" android:layout_below="@id/line1" />
//会话列表 ConversationListFragment conversationListFragment = new ConversationListFragment(); Uri uri = Uri.parse("rong://" + getActivity().getApplicationInfo().packageName).buildUpon() .appendPath("conversationlist") .appendQueryParameter(Conversation.ConversationType.PRIVATE.getName(), "false") //设置私聊会话,该会话聚合显示 .appendQueryParameter(Conversation.ConversationType.SYSTEM.getName(), "true")//设置系统会话,该会话非聚合显示 .build(); conversationListFragment.setUri(uri); FragmentManager fragmentManager = getChildFragmentManager(); FragmentTransaction transaction = fragmentManager.beginTransaction(); transaction.add(R.id.rong_container,conversationListFragment); transaction.commit();
三、会话界面配置
1. 会话 Fragment 跟会话列表是完全一致的,您可以用同样的方式快速的配置好。
配置布局文件
这是您的会话 Activity 对应的布局文件 conversation.xml,注意 android:name 固定为融云的 ConversationFragment。
<?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical"> <fragment android:id="@+id/conversation" android:name="io.rong.imkit.fragment.ConversationFragment" android:layout_width="match_parent" android:layout_height="match_parent" /> </LinearLayout>
2.配置 intent-filter
在 AndroidManifest.xml 中,会话 Activity 下面配置 intent-filter。 注意请修改 android:host 为您应用的包名,其他保持不变。
<!--会话界面--> <activity android:name="io.rong.fast.activity.ConversationActivity" android:screenOrientation="portrait" android:windowSoftInputMode="stateHidden|adjustResize"> <intent-filter> <action android:name="android.intent.action.VIEW" /> <category android:name="android.intent.category.DEFAULT" /> <data android:host="io.rong.fast" android:pathPrefix="/conversation/" android:scheme="rong" /> </intent-filter> </activity>
3.会话界面设置顶部显示好友昵称:
/** * crate by longShun on 2017.2.18 * 每一个会话界面 */ public class ConversationActivity extends BaseActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_friend_messages); //会话界面 对方id //String targetId = getIntent().getData().getQueryParameter("targetId"); //对方 昵称 String title = getIntent().getData().getQueryParameter("title"); if (!TextUtils.isEmpty(title)){ //todo 设置标题为对方昵称 } } }
4.启动方式
1. 自动启动:当我们点击会话列表中某个会话时,融云会触发自己实现的点击事件,隐式启动会话界面,从而进入某一个会话界面,所以我们可以不用去处理会话列表item的点击事件;
2.参考下面手动启动的方式
四、聚合会话列表
1.配置布局文件
这是您的聚合会话列表 Activity 对应的布局文件:subconversationlist.xml。 注意 android:name 固定为融云的 SubConversationListFragment。
<?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical"> <fragment android:id="@+id/subconversationlist" android:name="io.rong.imkit.fragment.SubConversationListFragment" android:layout_width="match_parent" android:layout_height="match_parent" /> </LinearLayout>
2.配置 intent-filter
在 AndroidManifest.xml 中, 聚合会话 Activity 下面配置 intent-filter。 注意请修改 android:host 为您应用的包名,其他保持不变。
<!--聚合会话列表--> <activity android:name="io.rong.fast.activity.SubConversationListActivtiy" android:screenOrientation="portrait" android:windowSoftInputMode="stateHidden|adjustResize"> <intent-filter> <action android:name="android.intent.action.VIEW" /> <category android:name="android.intent.category.DEFAULT" /> <data android:host="io.rong.fast" android:pathPrefix="/subconversationlist" android:scheme="rong" /> </intent-filter> </activity>
五、手动启动各种界面
/** * <p>启动会话界面。</p> * <p>使用时,可以传入多种会话类型 {@link io.rong.imlib.model.Conversation.ConversationType} 对应不同的会话类型,开启不同的会话界面。 * 如果传入的是 {@link io.rong.imlib.model.Conversation.ConversationType#CHATROOM},sdk 会默认调用 * {@link RongIMClient#joinChatRoom(String, int, RongIMClient.OperationCallback)} 加入聊天室。 * 如果你的逻辑是,只允许加入已存在的聊天室,请使用接口 {@link #startChatRoomChat(Context, String, boolean)} 并且第三个参数为 true</p> * * @param context 应用上下文。 * @param conversationType 会话类型。 * @param targetId 根据不同的 conversationType,可能是用户 Id、讨论组 Id、群组 Id 或聊天室 Id。 * @param title 聊天的标题,开发者可以在聊天界面通过 intent.getData().getQueryParameter("title") 获取该值, 再手动设置为标题。 */ public void startConversation(Context context, Conversation.ConversationType conversationType, String targetId, String title) /** * 启动会话列表界面。 * * @param context 应用上下文。 * @param supportedConversation 定义会话列表支持显示的会话类型,及对应的会话类型是否聚合显示。 * 例如:supportedConversation.put(Conversation.ConversationType.PRIVATE.getName(), false) 非聚合式显示 private 类型的会话。 */ public void startConversationList(Context context, Map<String, Boolean> supportedConversation) /** * 启动聚合后的某类型的会话列表。<br> 例如:如果设置了单聊会话为聚合,则通过该方法可以打开包含所有的单聊会话的列表。 * * @param context 应用上下文。 * @param conversationType 会话类型。 */ public void startSubConversationList(Context context, Conversation.ConversationType conversationType)
相关文章推荐
- 融云集成2--用户信息在会话列表和会话界面的显示
- android 即时通讯 容云集成 融云会话界面 融云会话列表 头像和昵称设置
- # 融云 集成会话列表加头布局
- 融云集成5--聊天界面标题栏被顶上去 解决方法
- 融云即时通讯的自定义会话列表
- 融云基于IMkit自定义会话列表
- 融云 解决用户头像会话列表不显示问题
- 融云集成3--增删会话界面点击+号出现的模块ExtensionModule
- 融云开发文档之会话界面--点击图片消息查看详情
- android 集成环信即时通讯 easeUI 联系人列表 会话列表 头像 昵称
- android如何集成环信的聊天界面和消息列表
- iOS 环信集成(五) 加载会话列表
- Spring Boot集成持久化Quartz定时任务管理和界面展示
- 创新源于模仿之六:仿iPhone的分组列表做一个配置界面
- 金蝶EAS,列表界面实现启用、禁用等数据状态相关操作
- UI一揽子计划 17 (image的异步加载、KVO观察者模式、KVO进行豆瓣列表界面图片的异步加载)
- 【资源列表】MFC界面库
- openfire+smack仿微信会话界面制作
- 微信小程序之点击列表的item带参数跳转界面
- Spring Boot集成持久化Quartz定时任务管理和界面展示(转)