mirror of
https://github.com/pierre42100/ComunicAndroid
synced 2024-11-27 07:49:28 +00:00
Display posts creation date
This commit is contained in:
parent
6280541829
commit
1c8cefb1e5
@ -17,6 +17,7 @@ import org.communiquons.android.comunic.client.data.UsersInfo.UserInfo;
|
||||
import org.communiquons.android.comunic.client.data.posts.Post;
|
||||
import org.communiquons.android.comunic.client.data.posts.PostsList;
|
||||
import org.communiquons.android.comunic.client.data.utils.UiUtils;
|
||||
import org.communiquons.android.comunic.client.data.utils.Utilities;
|
||||
|
||||
/**
|
||||
* Posts adapter
|
||||
@ -32,6 +33,11 @@ public class PostsAdapter extends ArrayAdapter<Post>{
|
||||
*/
|
||||
private ArrayMap<Integer, UserInfo> mUsersInfos;
|
||||
|
||||
/**
|
||||
* Utilities object
|
||||
*/
|
||||
private Utilities utils;
|
||||
|
||||
/**
|
||||
* Create the Post Adapter
|
||||
*
|
||||
@ -44,6 +50,9 @@ public class PostsAdapter extends ArrayAdapter<Post>{
|
||||
|
||||
//Save the users info object
|
||||
mUsersInfos = usersInfos;
|
||||
|
||||
//Create utilities object
|
||||
utils = new Utilities(getContext());
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@ -78,8 +87,9 @@ public class PostsAdapter extends ArrayAdapter<Post>{
|
||||
ImageLoadManager.load(getContext(), userInfo.getAcountImageURL(), userAccountImage);
|
||||
}
|
||||
|
||||
|
||||
|
||||
//Set post creation time
|
||||
((TextView) convertView.findViewById(R.id.post_creation_time)).setText(utils.
|
||||
timeToString(Utilities.time() - post.getPost_time()));
|
||||
|
||||
return convertView;
|
||||
}
|
||||
|
@ -17,13 +17,31 @@
|
||||
android:layout_width="@dimen/account_image_default_width"
|
||||
android:layout_height="@dimen/account_image_default_height" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/user_account_name"
|
||||
style="@style/PostOwnerName"
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
tools:text="User name"
|
||||
android:layout_gravity="center"/>
|
||||
android:orientation="vertical"
|
||||
android:layout_gravity="center">
|
||||
|
||||
<!-- User name -->
|
||||
<TextView
|
||||
android:id="@+id/user_account_name"
|
||||
style="@style/PostOwnerName"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
tools:text="User name" />
|
||||
|
||||
<!-- Post creation time -->
|
||||
<TextView
|
||||
android:id="@+id/post_creation_time"
|
||||
style="@style/PostDate"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
tools:text="15 days ago"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
|
@ -17,4 +17,7 @@
|
||||
|
||||
<!-- Conversations footer -->
|
||||
<color name="conversation_footer_bg">#8c9eff</color>
|
||||
|
||||
<!-- Specify to users name -->
|
||||
<color name="user_name_link">#23527c</color>
|
||||
</resources>
|
||||
|
@ -35,6 +35,13 @@
|
||||
|
||||
<!-- Post owner name -->
|
||||
<style name="PostOwnerName">
|
||||
<item name="android:paddingStart">10dp</item>
|
||||
<item name="android:paddingLeft">5dp</item>
|
||||
<item name="android:textColor">@color/user_name_link</item>
|
||||
<item name="android:textStyle">bold</item>
|
||||
</style>
|
||||
|
||||
<!-- Post date -->
|
||||
<style name="PostDate">
|
||||
<item name="android:paddingLeft">10dp</item>
|
||||
</style>
|
||||
</resources>
|
||||
|
Loading…
Reference in New Issue
Block a user