use of ingage.ingage20.handlers.ChatFeaturesHandler in project iNGAGE by davis123123.
the class ChatFragment method insertVote.
@Override
public void insertVote(int p, String prev_voted, String vote) {
String type = "insert_vote";
ChatFeaturesHandler chatFeaturesHandler = new ChatFeaturesHandler(getContext());
ChatMessageHelper chatMessageHelper = (ChatMessageHelper) chatAdapter.getItem(p);
// sets user's vote to memory
chatMessageHelper.setUserVote(vote);
// username is messageBy
String messageBy = chatMessageHelper.getMessageUser();
Log.d("insertvote", type + vote + prev_voted);
String chat_id = chatMessageHelper.getMessageID();
String chat_side = chatMessageHelper.getSide();
HashMap<String, String> chat = chatRoomManager.getUserDetails();
String thread_id = chat.get(ChatRoomManager.THREAD_ID);
session = new SessionManager(getContext());
HashMap<String, String> user = session.getUserDetails();
// chatuser is current user of app
String chat_user = user.get(SessionManager.KEY_NAME);
// insert vote into target user profile and own profile
Log.d("insertvote", chat_user);
String result = "";
try {
result = chatFeaturesHandler.execute(type, messageBy, thread_id, prev_voted, chat_id, vote, chat_side, chat_user).get();
} catch (InterruptedException | ExecutionException e) {
e.printStackTrace();
}
// Log.d("insertvote", result);
}
use of ingage.ingage20.handlers.ChatFeaturesHandler in project iNGAGE by davis123123.
the class ChatFragment method onAvatarClick.
// inserts vote in mysql database
@Override
public void onAvatarClick(int p) {
ChatFeaturesHandler chatFeaturesHandler = new ChatFeaturesHandler(getContext());
ChatMessageHelper chatMessageHelper = (ChatMessageHelper) chatAdapter.getItem(p);
String user = chatMessageHelper.getMessageUser();
// Log.d("AvatarClick", chatMessageHelper.getMessageUser());
chatActivity.startProfileActivity(user);
}
use of ingage.ingage20.handlers.ChatFeaturesHandler in project iNGAGE by davis123123.
the class ChatActivity method sendCoin.
private void sendCoin() {
String type = "send_coin";
String result;
ChatFeaturesHandler chatFeaturesHandler = new ChatFeaturesHandler(getApplicationContext());
try {
result = chatFeaturesHandler.execute(type, targetUser).get();
} catch (InterruptedException | ExecutionException e) {
e.printStackTrace();
}
}
use of ingage.ingage20.handlers.ChatFeaturesHandler 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.handlers.ChatFeaturesHandler in project iNGAGE by davis123123.
the class ChatActivity method useCoin.
private void useCoin() {
String type = "use_coin";
String result = "";
HashMap<String, String> chat_user = session.getUserDetails();
String username = chat_user.get(SessionManager.KEY_NAME);
ChatFeaturesHandler chatFeaturesHandler = new ChatFeaturesHandler(getApplicationContext());
try {
result = chatFeaturesHandler.execute(type, username).get();
} catch (InterruptedException | ExecutionException e) {
e.printStackTrace();
}
if (result.equals("success")) {
if (mCountDownTimer != null)
mCountDownTimer.cancel();
if (currentCooldown > 30000) {
timer(currentCooldown - 30000);
}
} else {
// tell user no coins left
new AlertDialog.Builder(this).setTitle("Sorry you are out of coins!").setMessage("Try again when you get tagged!").setIcon(android.R.drawable.ic_dialog_alert).show();
}
}
Aggregations