use of ingage.ingage20.managers.ChatRoomManager in project iNGAGE by davis123123.
the class FragmentBase method joinRoom.
public String joinRoom(Context context, String type, String thread_id, String userJSON) {
session = new SessionManager(getActivity().getApplicationContext());
HashMap<String, String> user = session.getUserDetails();
String username = user.get(SessionManager.KEY_NAME);
String token = MainActivity.appToken;
String result = null;
ChatRoomHandler chatRoomHandler = new ChatRoomHandler(context);
try {
result = chatRoomHandler.execute(type, thread_id, username, token, side).get();
} catch (InterruptedException | ExecutionException e) {
e.printStackTrace();
}
chatRoomManager = new ChatRoomManager(getActivity().getApplicationContext());
chatRoomManager.updateUserRoomSession(thread_id, side, "false");
return result;
}
use of ingage.ingage20.managers.ChatRoomManager in project iNGAGE by davis123123.
the class ChatActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_chat);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
session = new SessionManager(getApplicationContext());
HashMap<String, String> user = session.getUserDetails();
username = user.get(SessionManager.KEY_NAME);
chatRoomManager = new ChatRoomManager(getApplicationContext());
timerTv = (TextView) findViewById(R.id.timertv);
useCoinBt = (Button) findViewById(R.id.cooldownButton);
textArea = (LinearLayout) findViewById(R.id.text_area);
textButtons = (LinearLayout) findViewById(R.id.text_right);
timerTv.setVisibility(View.GONE);
useCoinBt.setVisibility(View.GONE);
Bundle extras = getIntent().getExtras();
if (extras != null) {
String title = extras.getString("title");
Log.i("clicked title: ", title);
ActionBar mActionBarToolbar = getSupportActionBar();
mActionBarToolbar.setTitle(title);
}
useCoinBt.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Log.d("Click", "clicked");
useCoin();
}
});
// click to use token
// getuser details
HashMap<String, String> chat = chatRoomManager.getUserDetails();
thread_id = chat.get(ChatRoomManager.THREAD_ID);
user_side = chat.get(ChatRoomManager.SIDE);
if (user_side != null) {
// fifteen minutes of inactivity will kick user out
kickTimer(900000);
Log.d("STATE", "side: " + user_side);
}
// Does not kick out spectator with timer
// ENTER MESSAGES WITH @TAGS
textField = (EditText) findViewById(R.id.msgField);
textChangeListener();
setKeyBoardListener();
// thread id for root of comments tree
root = FirebaseDatabase.getInstance().getReference().child(thread_id);
// TAKES TIME TO TRANSACT
pageCount(root);
// add messages to recycler view by clicking send
addButton = (Button) findViewById(R.id.sendMessageButton);
if (addButton != null) {
addButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
sendMsg();
}
});
// click to send message
// calls event listener to update message in realtime
// eventListener(root);
}
HashMap<String, String> chat_user = chatRoomManager.getUserDetails();
String spectator = chat_user.get(ChatRoomManager.SPECTATOR);
if (spectator.equals("true")) {
setSpectateMode();
}
}
Aggregations