use of io.swagger.client.model.Post in project android-client by GenesisVision.
the class PostDetailsActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
setTheme(ThemeUtil.getCurrentThemeResource());
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_post_details);
ButterKnife.bind(this);
initRefreshLayout();
setSendCommentButtonEnabled(false);
setTextListener();
autoCompleteGvAssetsView.setListener(presenter);
if (getIntent().getExtras() != null) {
UUID postId = (UUID) getIntent().getExtras().getSerializable(EXTRA_POST_ID);
Post post = getIntent().getExtras().getParcelable(EXTRA_POST);
boolean showComments = getIntent().getExtras().getBoolean(EXTRA_SHOW_COMMENTS, false);
if (postId != null) {
if (post != null) {
updateView(post);
if (showComments) {
scrollview.post(() -> scrollview.scrollTo(0, commentsSection.getTop()));
}
}
presenter.setData(postId);
postView.setDetailsMode(true);
postView.setListener(presenter);
return;
}
}
Timber.e("Passed empty data to %s", getClass().getSimpleName());
onBackPressed();
}
use of io.swagger.client.model.Post in project android-client by GenesisVision.
the class PostsListAdapter method setPostDeleted.
public void setPostDeleted(Post deletedPost, boolean isDeleted) {
int i = 0;
for (Post post : posts) {
if (post.getId().toString().equals(deletedPost.getId().toString())) {
post.setIsDeleted(isDeleted);
notifyItemChanged(i);
break;
}
i++;
}
}
use of io.swagger.client.model.Post in project android-client by GenesisVision.
the class CreatePostActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
setTheme(ThemeUtil.getCurrentThemeResource());
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_create_post);
ButterKnife.bind(this);
publishButton.setEnabled(false);
repost.setRepostMode(true);
text.requestFocus();
setTextListener();
autoCompleteGvAssetsView.setListener(presenter);
if (getIntent().getExtras() != null) {
Post repost = getIntent().getExtras().getParcelable(EXTRA_REPOST);
Post editPost = getIntent().getExtras().getParcelable(EXTRA_EDIT_POST);
UUID userId = (UUID) getIntent().getExtras().getSerializable(EXTRA_USER_ID);
if (repost != null) {
presenter.setRepost(repost);
}
if (editPost != null) {
this.title.setText(getString(R.string.edit_post));
presenter.setPostToEdit(editPost);
} else {
showProgressBar(false);
}
if (userId != null) {
presenter.setUserId(userId);
}
}
}
use of io.swagger.client.model.Post in project android-client by GenesisVision.
the class PostDetailsActivity method updateView.
@Override
public void updateView(Post post) {
postView.setPost(post);
if (post.getComments() != null && !post.getComments().isEmpty()) {
this.commentsSection.setVisibility(View.VISIBLE);
this.comments.setText(String.format(Locale.getDefault(), "%d %s", post.getComments().size(), GenesisVisionApplication.INSTANCE.getResources().getQuantityString(R.plurals.comments, post.getComments().size())));
this.commentsGroup.removeAllViews();
for (Post comment : post.getComments()) {
SocialCommentView view = new SocialCommentView(this);
view.setCanCommentPost(post.getPersonalDetails() != null && post.getPersonalDetails().isCanComment());
view.setComment(comment);
view.setListener(presenter);
commentsGroup.addView(view);
}
} else {
this.commentsSection.setVisibility(View.GONE);
}
if (post.getPersonalDetails() != null && post.getPersonalDetails().isCanComment()) {
this.addCommentGroup.setVisibility(View.VISIBLE);
} else {
this.addCommentGroup.setVisibility(View.GONE);
}
}
Aggregations