mirror of
https://github.com/pierre42100/ComunicAndroid
synced 2024-11-23 13:59:29 +00:00
Hide create post button if the user is not allowed to create post.
This commit is contained in:
parent
4aeddb3ba2
commit
a77254d098
@ -400,6 +400,8 @@ public class GetUsersHelper {
|
|||||||
//Get account creation time
|
//Get account creation time
|
||||||
advancedUserInfo.setAccount_creation_time(userObject.getInt("account_creation_time"));
|
advancedUserInfo.setAccount_creation_time(userObject.getInt("account_creation_time"));
|
||||||
|
|
||||||
|
//Check if user can post text or this page or not
|
||||||
|
advancedUserInfo.setCanPostText(userObject.getBoolean("can_post_texts"));
|
||||||
|
|
||||||
} catch (JSONException e){
|
} catch (JSONException e){
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
|
@ -12,6 +12,7 @@ public class AdvancedUserInfo extends UserInfo {
|
|||||||
//Private fields
|
//Private fields
|
||||||
private int account_creation_time;
|
private int account_creation_time;
|
||||||
private boolean accessForbidden = false;
|
private boolean accessForbidden = false;
|
||||||
|
private boolean canPostText;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the account creation time
|
* Get the account creation time
|
||||||
@ -48,4 +49,22 @@ public class AdvancedUserInfo extends UserInfo {
|
|||||||
public void setAccessForbidden(boolean accessForbidden) {
|
public void setAccessForbidden(boolean accessForbidden) {
|
||||||
this.accessForbidden = accessForbidden;
|
this.accessForbidden = accessForbidden;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set whether the current user can post a text on this user page or not
|
||||||
|
*
|
||||||
|
* @param canPostText TRUE to allow / FALSE to deny
|
||||||
|
*/
|
||||||
|
public void setCanPostText(boolean canPostText) {
|
||||||
|
this.canPostText = canPostText;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check whether the user can post text on this user page
|
||||||
|
*
|
||||||
|
* @return TRUE : yes / FALSE no
|
||||||
|
*/
|
||||||
|
public boolean isCanPostText() {
|
||||||
|
return canPostText;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -260,6 +260,10 @@ public class UserPageFragment extends Fragment implements PostsCreateFormFragmen
|
|||||||
ImageLoadHelper.remove(user_image);
|
ImageLoadHelper.remove(user_image);
|
||||||
ImageLoadHelper.load(getActivity(), userInfo.getAcountImageURL(), user_image);
|
ImageLoadHelper.load(getActivity(), userInfo.getAcountImageURL(), user_image);
|
||||||
|
|
||||||
|
//Check if the user can post text on this page
|
||||||
|
mCreatePostButton.setVisibility(userInfo.isCanPostText() ? View.VISIBLE : View.GONE);
|
||||||
|
|
||||||
|
|
||||||
//Load the list of posts of the user
|
//Load the list of posts of the user
|
||||||
load_posts();
|
load_posts();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user