mirror of
https://github.com/pierre42100/ComunicAndroid
synced 2024-12-26 13:38:59 +00:00
Use icons instead of text to show posts visibility levels
This commit is contained in:
parent
ff8f791f1e
commit
bc662d2174
@ -1,6 +1,7 @@
|
||||
package org.communiquons.android.comunic.client.ui.adapters;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.support.annotation.CallSuper;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.v7.widget.RecyclerView;
|
||||
@ -168,7 +169,7 @@ public class PostsAdapter extends BaseRecyclerViewAdapter {
|
||||
private WebUserAccountImage mUserAccountImage;
|
||||
private TextView mUserAccountName;
|
||||
private TextView mPostDate;
|
||||
private TextView mPostVisibility;
|
||||
private ImageView mPostVisibility;
|
||||
private ImageView mPostActions;
|
||||
private FrameLayout mAdditionnalViews;
|
||||
private TextView mPostContent;
|
||||
@ -231,26 +232,29 @@ public class PostsAdapter extends BaseRecyclerViewAdapter {
|
||||
|
||||
|
||||
//Display post visibility
|
||||
int visibility_res_id;
|
||||
switch (post.getVisibilityLevel()){
|
||||
|
||||
case PUBLIC:
|
||||
mPostVisibility.setText(R.string.post_visibility_public);
|
||||
visibility_res_id = R.drawable.ic_public;
|
||||
break;
|
||||
|
||||
case FRIENDS:
|
||||
mPostVisibility.setText(R.string.post_visibility_friends);
|
||||
visibility_res_id = R.drawable.ic_friends;
|
||||
break;
|
||||
|
||||
case MEMBERS:
|
||||
mPostVisibility.setText(R.string.post_visibility_members);
|
||||
visibility_res_id = R.drawable.ic_friends;
|
||||
break;
|
||||
|
||||
case PRIVATE:
|
||||
default:
|
||||
mPostVisibility.setText(R.string.post_visibility_private);
|
||||
visibility_res_id = R.drawable.ic_user;
|
||||
break;
|
||||
}
|
||||
|
||||
Drawable drawable = UiUtils.getDrawable(getContext(), visibility_res_id);
|
||||
drawable.setTint(UiUtils.getColor(getContext(), R.color.darker_gray));
|
||||
mPostVisibility.setImageDrawable(drawable);
|
||||
|
||||
//Set post actions
|
||||
mPostActions.setOnClickListener(new View.OnClickListener() {
|
||||
|
9
app/src/main/res/drawable/ic_public.xml
Normal file
9
app/src/main/res/drawable/ic_public.xml
Normal file
@ -0,0 +1,9 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="24.0"
|
||||
android:viewportHeight="24.0">
|
||||
<path
|
||||
android:fillColor="@color/default_drawable_color"
|
||||
android:pathData="M12,2C6.48,2 2,6.48 2,12s4.48,10 10,10 10,-4.48 10,-10S17.52,2 12,2zM11,19.93c-3.95,-0.49 -7,-3.85 -7,-7.93 0,-0.62 0.08,-1.21 0.21,-1.79L9,15v1c0,1.1 0.9,2 2,2v1.93zM17.9,17.39c-0.26,-0.81 -1,-1.39 -1.9,-1.39h-1v-3c0,-0.55 -0.45,-1 -1,-1L8,12v-2h2c0.55,0 1,-0.45 1,-1L11,7h2c1.1,0 2,-0.9 2,-2v-0.41c2.93,1.19 5,4.06 5,7.41 0,2.08 -0.8,3.97 -2.1,5.39z"/>
|
||||
</vector>
|
@ -51,12 +51,14 @@
|
||||
android:layout_weight="1" />
|
||||
|
||||
<!-- Post visibility level -->
|
||||
<TextView
|
||||
<ImageView
|
||||
android:id="@+id/post_visibility"
|
||||
style="@style/PostVisibility"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_height="@dimen/post_options_btn_height"
|
||||
android:layout_gravity="top"
|
||||
android:src="@drawable/ic_public"
|
||||
android:contentDescription="@string/post_visibility_icon"
|
||||
tools:text="Public" />
|
||||
|
||||
<ImageView
|
||||
|
@ -267,4 +267,5 @@
|
||||
<string name="err_get_older_posts">Could not get older posts!</string>
|
||||
<string name="err_get_posts_list">Could not get the list of posts!</string>
|
||||
<string name="notice_no_post_yet">There is no post to display here yet.</string>
|
||||
<string name="post_visibility_icon">Post visibility</string>
|
||||
</resources>
|
||||
|
Loading…
Reference in New Issue
Block a user