use of ingage.ingage20.handlers.SpectateRoomHandler in project iNGAGE by davis123123.
the class FragmentBase method spectate.
public void spectate(int p) {
ThreadsHelper threadsHelper = (ThreadsHelper) threadListAdapter.getItem(p);
String thread_id = threadsHelper.getThread_id();
String type = "spectate";
session = new SessionManager(getActivity().getApplicationContext());
HashMap<String, String> user = session.getUserDetails();
String username = user.get(SessionManager.KEY_NAME);
SpectateRoomHandler spectateRoomHandler = new SpectateRoomHandler(getActivity().getApplicationContext());
try {
// Log.d("JOINSPECTATE", "yes");
result = spectateRoomHandler.execute(type, thread_id, username).get();
} catch (InterruptedException | ExecutionException e) {
e.printStackTrace();
}
if (result.equals("Spectate room failed")) {
Toast.makeText(getActivity(), "spectate room failed!", Toast.LENGTH_LONG).show();
} else {
chatRoomManager = new ChatRoomManager(getActivity().getApplicationContext());
chatRoomManager.updateUserRoomSession(thread_id, null, "true");
goToChat(result);
}
}
use of ingage.ingage20.handlers.SpectateRoomHandler in project iNGAGE by davis123123.
the class ChatActivity method onResume.
@Override
public void onResume() {
super.onResume();
Log.d("RESUMECHAT", "textRESUME ");
HashMap<String, String> chat_user = chatRoomManager.getUserDetails();
String spectator = chat_user.get(ChatRoomManager.SPECTATOR);
// check from cache is user is spectator
if (spectator.equals("true") && paused) {
String type = "spectate";
session = new SessionManager(getApplicationContext());
HashMap<String, String> user = session.getUserDetails();
String username = user.get(SessionManager.KEY_NAME);
SpectateRoomHandler spectateRoomHandler = new SpectateRoomHandler(getApplicationContext());
String result;
setSpectateMode();
try {
result = spectateRoomHandler.execute(type, thread_id, username).get();
} catch (InterruptedException | ExecutionException e) {
e.printStackTrace();
}
paused = false;
}
}
use of ingage.ingage20.handlers.SpectateRoomHandler in project iNGAGE by davis123123.
the class ChatActivity method leaveRoom.
private void leaveRoom() {
HashMap<String, String> chat_user = chatRoomManager.getUserDetails();
String side = chat_user.get(ChatRoomManager.SIDE);
String thread_id = chat_user.get(ChatRoomManager.THREAD_ID);
String spectator = chat_user.get(ChatRoomManager.SPECTATOR);
if (spectator.equals("true")) {
String type = "leave_spectate";
String result = null;
HashMap<String, String> user = session.getUserDetails();
String username = user.get(SessionManager.KEY_NAME);
SpectateRoomHandler spectateRoomHandler = new SpectateRoomHandler(getApplicationContext());
try {
result = spectateRoomHandler.execute(type, thread_id, username, side).get();
} catch (InterruptedException | ExecutionException e) {
e.printStackTrace();
}
Log.d("SPECTATORSTATE", "text: " + result);
} else {
String type = "leave";
String result = null;
HashMap<String, String> user = session.getUserDetails();
String username = user.get(SessionManager.KEY_NAME);
ChatRoomHandler chatRoomHandler = new ChatRoomHandler(getApplicationContext());
try {
result = chatRoomHandler.execute(type, thread_id, username, side).get();
} catch (InterruptedException | ExecutionException e) {
e.printStackTrace();
}
}
// leave user's session on cache
chatRoomManager.updateUserRoomSession("", "", "");
}
use of ingage.ingage20.handlers.SpectateRoomHandler in project iNGAGE by davis123123.
the class ChatActivity method onPause.
@Override
public void onPause() {
super.onPause();
HashMap<String, String> chat_user = chatRoomManager.getUserDetails();
String side = chat_user.get(ChatRoomManager.SIDE);
String thread_id = chat_user.get(ChatRoomManager.THREAD_ID);
String spectator = chat_user.get(ChatRoomManager.SPECTATOR);
if (spectator.equals("true")) {
paused = true;
String type = "leave_spectate";
String result = null;
HashMap<String, String> user = session.getUserDetails();
String username = user.get(SessionManager.KEY_NAME);
SpectateRoomHandler spectateRoomHandler = new SpectateRoomHandler(getApplicationContext());
try {
result = spectateRoomHandler.execute(type, thread_id, username, side).get();
} catch (InterruptedException | ExecutionException e) {
e.printStackTrace();
}
Log.d("SPECTATORSTATE", "textpause: " + result);
}
}
Aggregations