Display post message content.

This commit is contained in:
Pierre 2018-01-27 17:21:38 +01:00
parent 488ac397fa
commit 5d7efdc8d5
3 changed files with 27 additions and 1 deletions

View File

@ -91,6 +91,9 @@ public class PostsAdapter extends ArrayAdapter<Post>{
((TextView) convertView.findViewById(R.id.post_creation_time)).setText(utils. ((TextView) convertView.findViewById(R.id.post_creation_time)).setText(utils.
timeToString(Utilities.time() - post.getPost_time())); timeToString(Utilities.time() - post.getPost_time()));
//Set post conent
((TextView) convertView.findViewById(R.id.post_content)).setText(Utilities.prepareStringTextView(post.getContent()));
return convertView; return convertView;
} }
} }

View File

@ -3,7 +3,8 @@
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
android:orientation="vertical" android:orientation="vertical"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent"> android:layout_height="match_parent"
style="@style/PostContener">
<!-- Informations about user who created the post --> <!-- Informations about user who created the post -->
<LinearLayout <LinearLayout
@ -14,6 +15,7 @@
<ImageView <ImageView
android:id="@+id/user_account_image" android:id="@+id/user_account_image"
android:src="@drawable/default_account_image" android:src="@drawable/default_account_image"
android:contentDescription="@string/user_image_description"
android:layout_width="@dimen/account_image_default_width" android:layout_width="@dimen/account_image_default_width"
android:layout_height="@dimen/account_image_default_height" /> android:layout_height="@dimen/account_image_default_height" />
@ -45,5 +47,13 @@
</LinearLayout> </LinearLayout>
<!-- Post content -->
<TextView
android:id="@+id/post_content"
android:layout_width="match_parent"
android:layout_height="wrap_content"
tools:text="Post content"
style="@style/PostContent" />
</LinearLayout> </LinearLayout>

View File

@ -28,6 +28,12 @@
</style> </style>
<!-- Posts style --> <!-- Posts style -->
<!-- Post contener -->
<style name="PostContener">
<item name="android:paddingTop">5dp</item>
<item name="android:paddingBottom">5dp</item>
</style>
<!-- Post header --> <!-- Post header -->
<style name="PostHeader"> <style name="PostHeader">
<item name="android:padding">2dp</item> <item name="android:padding">2dp</item>
@ -44,4 +50,11 @@
<style name="PostDate"> <style name="PostDate">
<item name="android:paddingLeft">10dp</item> <item name="android:paddingLeft">10dp</item>
</style> </style>
<!-- Post content -->
<style name="PostContent">
<item name="android:textAlignment">center</item>
<item name="android:layout_marginTop">5dp</item>
<item name="android:layout_marginBottom">2dp</item>
</style>
</resources> </resources>