带你实现女朋友欲罢不能的 App

本文介绍了如何利用融云 SDK 实现 Android App 中的即时通讯功能,包括设置布局和集成聊天模块。同时,还提到了使用日历控件创建纪念日提醒,帮助开发者构建一个让女朋友爱不释手的应用。完整代码可在作者的 Github 上找到。

前言

带你实现女朋友欲罢不能的 App

需求
  1. 需要日记本,甜言蜜语要记录
  2. 需要只能和 ta 聊天模块
  3. 需要可以记录关键日期,避免忘记送命
    0202年了,Android开发大都应该是老油条了把。这太简单,我们开始动手。
    我知道没图是骗不到人的。先放图,大家看一下最终实现的效果。
    avatar
即时通讯部分

使用了融云 sdk 集成了单聊部分
配置布局文件
这是您的会话列表 Activity 对应的布局文件:conversationlist.xml。注意 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>

新建 Activity

public class ConversationListActivity extends FragmentActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.conversationlist);
        FragmentManager fragmentManage = getSupportFragmentManager();
        ConversationListFragment fragement = (ConversationListFragment) fragmentManage.findFragmentById(R.id.conversationlist);
        Uri uri = Uri.parse("rong://" + getApplicationInfo().packageName).buildUpon()
            .appendPath("conversationlist")
            .appendQueryParameter(Conversation.ConversationType.PRIVATE.getName(), "false") 
            .appendQueryParameter(Conversation.ConversationType.GROUP.getName(), "false")
            .appendQueryParameter(Conversation.ConversationType.PUBLIC_SERVICE.getName(), "false")
            .appendQueryParameter(Conversation.ConversationType.APP_PUBLIC_SERVICE.getName(), "false")
            .appendQueryParameter(Conversation.ConversationType.SYSTEM.getName(), "true")
            .build();
        fragement.setUri(uri);
    }
  }
<!--会话列表-->
<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>

其他部分参考
融云官网:https://www.rongcloud.cn/
文档频道:https://docs.rongcloud.cn/v4

纪念日部分

日历控件:https://juejin.im/post/6844903512007000077
其他部分如若有人需要,会尽快传到 github 。
github:https://github.com/yanxiame/rongcloud/tree/loverschat

评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值