集成笔记列表界面
协作中台 SDK 支持笔记列表的集成,笔记列表功能如下:
点击快捷功能图标跳转到不同类型界面,比如共享列表和更多列表。
显示笔记列表,可按更新时间最新和按创建时间最新两种排序方式,笔记支持置顶,分享和删除操作。
点击底部加号按钮,可创建新笔记。
点击列表笔记进行预览编辑,长按笔记列表单条笔记可以查看笔记创建人和权限状态。
效果展示

可以通过下面方式集成笔记列表页面:
KIMNoteHomeActivity
,直接包含了 KIMNoteHomeFragment 的 Activity 界面,可以通过KIM.getService().goPage(``KIMNoteHomeFragment``::class.java.getPageName(), this, Bundle())
启动KIMNoteHomeFragment
,接入方可以将该 Fragment 嵌入自己的 Activity,直接创建 KIMNoteHomeFragment, 并通过 fragmentManager 添加到自定义的 Activity 中
接口定义
kotlin
KIM.getService().goPage(pageName: String, context: Context?, args: Bundle)
参数说明
参数 | 类型 | 说明 |
---|---|---|
pageName | string | 这里固定值: KIMNoteHomeFragment::class.java.getPageName() |
context | Context | |
args | Bundle |
代码示例
示例一
直接使用KIMNoteHomeActivity
kotlin
KIM.getService().goPage(KIMNoteHomeFragment::class.java.getPageName(), this, Bundle())
示例二
使用KIMNoteHomeFragment
,接入方可以将该 Fragment
嵌入自己的 Activity
,直接创建 KIMNoteHomeFragment
, 并通过 fragmentManager
添加到自定义的 Activity
中。
- 自定义
Activity
并将Fragment
加入到Activity
中。
kotlin
import android.os.Bundle
import androidx.fragment.app.FragmentActivity
import com.kingsoft.kim.expand.databinding.KimUiCommonFragmentContainerBinding
import com.kingsoft.kim.kit.sample.R
import com.kingsoft.kim.sdk.note.ui.KIMNoteHomeFragment
class CustomNoteActivity : FragmentActivity() {
private lateinit var binding: KimUiCommonFragmentContainerBinding
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
binding = KimUiCommonFragmentContainerBinding.inflate(layoutInflater)
setContentView(binding.root)
if (savedInstanceState == null) {
val fragment = KIMNoteHomeFragment()
supportFragmentManager.beginTransaction()
.add(R.id.container, fragment, KIMNoteHomeFragment::class.java.name)
.commitAllowingStateLoss()
} else {
val fragment = supportFragmentManager.findFragmentByTag(KIMNoteHomeFragment::class.java.name)
if (fragment == null) {
finish()
return
}
supportFragmentManager.beginTransaction()
.attach(fragment)
.commitAllowingStateLoss()
}
}
}
请注意在 Manifest 完成注册及主题设置。
- 打开Activity
kotlin
startActivity(Intent(this, CustomNoteActivity::class.java))