use of ingage.ingage.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")) {
// cancel old timer to restart new one with smaller cooldown
if (mCountDownTimer != null)
mCountDownTimer.cancel();
if (currentCooldown > 30000) {
timer(currentCooldown - 30000);
} else {
mCountDownTimer.cancel();
unblockMSG();
}
} 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();
}
}
use of ingage.ingage.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.ingage.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.ingage.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();
}
}
Aggregations