communityUI
一個(gè)可快速集成的朋友圈界面,支持評(píng)論、子評(píng)論、點(diǎn)贊、回復(fù)人數(shù)。
Github地址 https://github.com/YellowDoing/communityUI 覺(jué)得喜歡就點(diǎn)個(gè)star吧
image
image
建議有一個(gè)自己的后臺(tái)數(shù)據(jù)庫(kù),可直接繼承,示例代碼用的是作者自己的簡(jiǎn)單后臺(tái)
集成步驟
1 . 繼承CommunityInterface接口,添加fragment
//朋友圈列表是一個(gè)fragment,需要事務(wù)添加
public class MainActivity extends AppCompatActivity implements CommunityInterface {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
getSupportFragmentManager().beginTransaction()
.add(R.id.container, new CommunityFragment().setCommunityInterface(this))
.commit();
}
2 . 實(shí)現(xiàn)接口的六個(gè)方法,進(jìn)行數(shù)據(jù)轉(zhuǎn)換
void loadCommunityList(CommunitySubsriber subsriber,int page);
void comment(CommentSubsriber2 subsriber,String communityId,String parentId,String commentId,String content);
void loadComments(CommentSubsriber subsriber,String communityId,int page);
void like(Subsriber subsriber,String communityId);
void unLike(Subsriber subsriber,String communityId);
void post(Subsriber subsriber,ArrayList<String> imagePaths,String content);
3 . 在Mainifest.xml文件添加activity聲明
<activity android:name="hg.yellowdoing.communityui.PostActivity"/>
<activity android:name="me.iwf.photopicker.PhotoPickerActivity"
android:theme="@style/Theme.AppCompat.NoActionBar" />
<activity android:name="me.iwf.photopicker.PhotoPagerActivity"
android:theme="@style/Theme.AppCompat.NoActionBar"/>
<activity android:name=".UserInfoActivity"/>
<activity android:name="hg.yellowdoing.communityui.CommunityDetialActivity"/>
<activity android:name="hg.yellowdoing.communityui.CommentDetailActivity"/>