# socialview **Repository Path**: chinasoft5_ohos/socialview ## Basic Information - **Project Name**: socialview - **Description**: 富文本输入框 支持hashtag、notify和超链接 - **Primary Language**: Java - **License**: Apache-2.0 - **Default Branch**: main - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 4 - **Forks**: 1 - **Created**: 2021-06-18 - **Last Updated**: 2022-09-06 ## Categories & Tags **Categories**: harmonyos-edit-text **Tags**: None ## README socialview ==================== ### 项目介绍 + 项目名称:socialview + 所属系列:openharmony的第三方组件适配移植 + 功能:富文本输入框 支持hashtag、notify和超链接。 + 项目移植状态:主功能完成 + 调用差异:无 + 开发版本:sdk6,DevEco Studio2.2 beta1 + 基线版本: release 0.2 ### 效果演示 ![](https://images.gitee.com/uploads/images/2021/0623/104425_7212bf6f_8941935.gif) ### 安装教程 **1)** 在项目根目录下的build.gradle文件中, ``` allprojects {   repositories {       maven {           url 'https://s01.oss.sonatype.org/content/repositories/releases/'       }   } } ``` **2)** 在entry模块的build.gradle文件中, ``` dependencies { implementation('com.gitee.chinasoft_ohos:socialview:1.0.0') implementation('com.gitee.chinasoft_ohos:socialview_commons:1.0.0') ...... } ``` 在sdk6,DevEco Studio2.2 Beta1下项目可直接运行 如无法运行,删除项目.gradle,.idea,build,gradle,build.gradle文件, 并依据自己的版本创建新项目,将新项目的对应文件复制到根目录下 ### 使用说明 设置setHashtagAdapter()和setMentionAdapter()。 ```java ArrayAdapter< Hashtag > hashtagAdapter = new HashtagAdapter (getContext()); hashtagAdapter.add(new Hashtag("follow")); hashtagAdapter.add(new Hashtag("followme", 1000)); hashtagAdapter.add(new Hashtag("followmeorillkillyou", 500)); listContainer.setItemProvider(hashtagAdapter); ArrayAdapter mentionAdapter = new MentionAdapter(getContext()); mentionAdapter.add(new Mention("dirtyhobo")); mentionAdapter.add(new Mention("hobo", "Regular Hobo", R.mipmap.ic_launcher)); listContainer.setItemProvider(mentionAdapter); ``` 设置自定义视图。 ```java public class Person { public final String name; public Person(String name) { this.name = name; } } public class PersonAdapter extends SocialArrayAdapter { public PersonAdapter(@NonNull Context context) { super(context, R.layout.item_person, R.id.textview_person); } @Override public String convertToString(Person $receiver) { return $receiver.name; } @Override public View getView(int position, View convertView, @NonNull ViewGroup parent) { ... } } // this works too public class PersonAdapter extends ArrayAdapter { // your own adapter layout, view holder, data binding // and of course, filtering logic } ``` 使用自定义视图。 ```java ArrayAdapter adapter = new PersonAdapter(getContext()); adapter.add(personA); adapter.add(personB); listContainer.setItemProvider(adapter); ``` ### 测试信息 CodeCheck代码测试无异常 CloudTest代码测试无异常 病毒安全检测通过 当前版本demo功能与原组件基本无差异 ### 版本迭代 - 1.0.0 - 0.0.1-SNAPSHOT #### 版权和许可信息 Apache 2.0 License