use of ingage.ingage20.helpers.ChatMessageHelper in project iNGAGE by davis123123.
the class ChatActivity method onUpvoteClick.
//modify unblock functions here
@Override
public void onUpvoteClick(int p) {
//Log.d("vote" , "up : ");
//get correct chat msg with ith key from chatmessage helper
ChatMessageHelper chatMessageHelper = (ChatMessageHelper) chatAdapter.getItem(p);
String chat_key = chatMessageHelper.getMessageID();
DatabaseReference message_root = root.child(chat_key);
//get upvote data
DatabaseReference upvote_count = message_root.child("upvotes");
upvote_count.runTransaction(new Transaction.Handler() {
@Override
public Transaction.Result doTransaction(MutableData currentData) {
Log.d("Data", String.valueOf(currentData));
if (currentData.getValue() == null) {
currentData.setValue(1);
} else {
currentData.setValue((Long) currentData.getValue() + 1);
}
//we can also abort by calling Transaction.abort()
return Transaction.success(currentData);
}
//TODO:Error handle here
@Override
public void onComplete(DatabaseError databaseError, boolean b, DataSnapshot dataSnapshot) {
}
});
}
use of ingage.ingage20.helpers.ChatMessageHelper in project iNGAGE by davis123123.
the class ChatActivity method insertVote.
@Override
public void insertVote(int p, String prev_voted, String vote) {
String type = "insert_vote";
ChatFeaturesHandler chatFeaturesHandler = new ChatFeaturesHandler(getApplicationContext());
ChatMessageHelper chatMessageHelper = (ChatMessageHelper) chatAdapter.getItem(p);
String chat_user = chatMessageHelper.getMessageUser();
Log.d("insertvote", type + chat_user + vote + prev_voted);
chatFeaturesHandler.execute(type, chat_user, vote, prev_voted);
}
use of ingage.ingage20.helpers.ChatMessageHelper in project iNGAGE by davis123123.
the class ChatArrayAdapter method onBindViewHolder.
@Override
public void onBindViewHolder(ChatArrayAdapter.ChatViewHolder holder, int position) {
ChatMessageHelper chatMessageHelper = (ChatMessageHelper) this.getItem(position);
//side = chatMessageHelper.getSide();
holder.bind(position);
}
use of ingage.ingage20.helpers.ChatMessageHelper in project iNGAGE by davis123123.
the class ChatArrayAdapter method update.
public void update(ChatMessageHelper newObject, String chat_id) {
//get old chatmsg
int position = chatHash.get(chat_id);
//update oldmsg with newobject
ChatMessageHelper chatMessageHelper = (ChatMessageHelper) getItem(position);
chatMessageHelper.setMessageDownvote(newObject.getMessageDownvote());
chatMessageHelper.setMessageUpvote(newObject.getMessageUpvote());
chatMessageHelper.setMessageText(newObject.getMessageText());
}
Aggregations