mirror of
https://github.com/sudoxnym/habitica-android.git
synced 2026-04-14 11:46:32 +00:00
Not showing like button in messages
This commit is contained in:
parent
a465c98d69
commit
d61175d819
3 changed files with 12 additions and 7 deletions
|
|
@ -38,6 +38,7 @@ import rx.subjects.PublishSubject;
|
|||
public class ChatRecyclerViewAdapter extends RealmRecyclerViewAdapter<ChatMessage, ChatRecyclerViewAdapter.ChatRecyclerViewHolder> {
|
||||
|
||||
private User user;
|
||||
private boolean isTavern;
|
||||
private String uuid;
|
||||
private User sendingUser;
|
||||
|
||||
|
|
@ -49,9 +50,10 @@ public class ChatRecyclerViewAdapter extends RealmRecyclerViewAdapter<ChatMessag
|
|||
private PublishSubject<ChatMessage> copyMessageAsTodoEvents = PublishSubject.create();
|
||||
private PublishSubject<ChatMessage> copyMessageEvents = PublishSubject.create();
|
||||
|
||||
public ChatRecyclerViewAdapter(@Nullable OrderedRealmCollection<ChatMessage> data, boolean autoUpdate, User user) {
|
||||
public ChatRecyclerViewAdapter(@Nullable OrderedRealmCollection<ChatMessage> data, boolean autoUpdate, User user, boolean isTavern) {
|
||||
super(data, autoUpdate);
|
||||
this.user = user;
|
||||
this.isTavern = isTavern;
|
||||
if (user != null) this.uuid = user.getId();
|
||||
}
|
||||
|
||||
|
|
@ -63,7 +65,7 @@ public class ChatRecyclerViewAdapter extends RealmRecyclerViewAdapter<ChatMessag
|
|||
public ChatRecyclerViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
|
||||
View view = LayoutInflater.from(parent.getContext())
|
||||
.inflate(R.layout.tavern_chat_item, parent, false);
|
||||
return new ChatRecyclerViewHolder(view, uuid);
|
||||
return new ChatRecyclerViewHolder(view, uuid, isTavern);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -108,25 +110,27 @@ public class ChatRecyclerViewAdapter extends RealmRecyclerViewAdapter<ChatMessag
|
|||
ImageView btnOptions;
|
||||
@BindView(R.id.user_background_layout)
|
||||
LinearLayout userBackground;
|
||||
@BindView(R.id.like_background_layout)
|
||||
LinearLayout likeBackground;
|
||||
@BindView(R.id.user_label)
|
||||
TextView userLabel;
|
||||
@BindView(R.id.message_text)
|
||||
EmojiTextView messageText;
|
||||
@BindView(R.id.ago_label)
|
||||
TextView agoLabel;
|
||||
@BindView(R.id.like_background_layout)
|
||||
LinearLayout likeBackground;
|
||||
@BindView(R.id.tvLikes)
|
||||
TextView tvLikes;
|
||||
|
||||
Context context;
|
||||
Resources res;
|
||||
private String userId;
|
||||
private boolean isTavern;
|
||||
private ChatMessage chatMessage;
|
||||
|
||||
ChatRecyclerViewHolder(View itemView, String currentUserId) {
|
||||
ChatRecyclerViewHolder(View itemView, String currentUserId, boolean isTavern) {
|
||||
super(itemView);
|
||||
this.userId = currentUserId;
|
||||
this.isTavern = isTavern;
|
||||
|
||||
ButterKnife.bind(this, itemView);
|
||||
|
||||
|
|
@ -191,6 +195,7 @@ public class ChatRecyclerViewAdapter extends RealmRecyclerViewAdapter<ChatMessag
|
|||
}
|
||||
|
||||
private void setLikeProperties() {
|
||||
likeBackground.setVisibility(isTavern ? View.VISIBLE : View.INVISIBLE);
|
||||
tvLikes.setText("+" + chatMessage.getLikeCount());
|
||||
|
||||
int backgroundColorRes;
|
||||
|
|
|
|||
|
|
@ -141,7 +141,7 @@ public class ChatListFragment extends BaseFragment implements SwipeRefreshLayout
|
|||
recyclerView.setLayoutManager(layoutManager);
|
||||
}
|
||||
|
||||
chatAdapter = new ChatRecyclerViewAdapter(null, true, user);
|
||||
chatAdapter = new ChatRecyclerViewAdapter(null, true, user, true);
|
||||
compositeSubscription.add(chatAdapter.getUserLabelClickEvents().subscribe(userId -> FullProfileActivity.open(getContext(), userId), RxErrorHandler.handleEmptyError()));
|
||||
compositeSubscription.add(chatAdapter.getDeleteMessageEvents().subscribe(this::showDeleteConfirmationDialog, RxErrorHandler.handleEmptyError()));
|
||||
compositeSubscription.add(chatAdapter.getFlatMessageEvents().subscribe(this::showFlagConfirmationDialog, RxErrorHandler.handleEmptyError()));
|
||||
|
|
|
|||
|
|
@ -80,7 +80,7 @@ public class InboxMessageListFragment extends BaseMainFragment
|
|||
//layoutManager.setStackFromEnd(false);
|
||||
recyclerView.setLayoutManager(layoutManager);
|
||||
|
||||
chatAdapter = new ChatRecyclerViewAdapter(null, true, user);
|
||||
chatAdapter = new ChatRecyclerViewAdapter(null, true, user, false);
|
||||
chatAdapter.setSendingUser(this.user);
|
||||
recyclerView.setAdapter(chatAdapter);
|
||||
recyclerView.setItemAnimator(new SafeDefaultItemAnimator());
|
||||
|
|
|
|||
Loading…
Reference in a new issue