use of ingage.ingage20.managers.SessionManager in project iNGAGE by davis123123.
the class FrontPageFragment method viewRoomStatus.
public String viewRoomStatus(Context context, String type, String thread_id) {
session = new SessionManager(getActivity().getApplicationContext());
HashMap<String, String> user = session.getUserDetails();
String result = null;
ChatRoomHandler chatRoomHandler = new ChatRoomHandler(context);
try {
result = chatRoomHandler.execute(type, thread_id, side).get();
Log.d("STATE", "view: " + result);
//Toast.makeText(getActivity().getApplicationContext(), "view: " + store, Toast.LENGTH_LONG).show();
} catch (InterruptedException | ExecutionException e) {
e.printStackTrace();
}
return result;
}
use of ingage.ingage20.managers.SessionManager in project iNGAGE by davis123123.
the class NavigationDrawer method updateUserName.
private void updateUserName(final AppCompatActivity activity) {
final SessionManager sessionManager = new SessionManager(mContext);
final TextView userNameView = (TextView) activity.findViewById(R.id.userName);
if (!sessionManager.isLoggedIn()) {
// Not signed in
userNameView.setText(activity.getString(R.string.main_nav_menu_default_user_text));
//userNameView.setBackgroundColor(activity.getResources().getColor(R.color.nav_drawer_no_user_background));
return;
}
HashMap<String, String> user = sessionManager.getUserDetails();
final String userName = user.get(SessionManager.KEY_NAME);
if (userName != null) {
userNameView.setText(userName);
/**userNameView.setBackgroundColor(
activity.getResources().getColor(R.color.nav_drawer_top_background));**/
}
}
use of ingage.ingage20.managers.SessionManager in project iNGAGE by davis123123.
the class NavigationDrawer method updateUserImage.
private void updateUserImage(final AppCompatActivity activity) {
final SessionManager sessionManager = new SessionManager(mContext);
final ImageView imageView = (ImageView) activity.findViewById(R.id.userImage);
if (!sessionManager.isLoggedIn()) {
// Not signed in
if (Build.VERSION.SDK_INT < 22) {
imageView.setImageBitmap(BitmapFactory.decodeResource(activity.getResources(), R.mipmap.user));
} else {
imageView.setImageDrawable(activity.getDrawable(R.mipmap.user));
}
return;
}
/**final Bitmap userImage = identityManager.getUserImage();
if (userImage != null) {
imageView.setImageBitmap(userImage);
}**/
}
use of ingage.ingage20.managers.SessionManager in project iNGAGE by davis123123.
the class PostCommentActivity method onCreate.
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_post_comment);
session = new SessionManager(getApplicationContext());
sidesSpinner = (Spinner) findViewById(R.id.spinner);
mInsertComment = (EditText) findViewById(R.id.comment_edit_text);
addListenerOnSpinnerItemSelection();
}
use of ingage.ingage20.managers.SessionManager in project iNGAGE by davis123123.
the class RoomUsersActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_room_users);
String type = "check";
String json_string = "";
chatRoomManager = new ChatRoomManager(getApplicationContext());
HashMap<String, String> chatroom = chatRoomManager.getUserDetails();
String thread_id = chatroom.get(ChatRoomManager.THREAD_ID);
chatRoomHandler = new ChatRoomHandler(getApplicationContext());
sessionManager = new SessionManager(getApplicationContext());
HashMap<String, String> user = sessionManager.getUserDetails();
ownUsername = user.get(SessionManager.KEY_NAME);
roomUserRecyclerView = (RecyclerView) findViewById(R.id.rv_posts);
LinearLayoutManager layoutManager = new LinearLayoutManager(this);
roomUserRecyclerView.setLayoutManager(layoutManager);
roomUserAdapter = new RoomUserAdapter(this);
roomUserRecyclerView.setAdapter(roomUserAdapter);
try {
json_string = chatRoomHandler.execute(type, thread_id).get();
Log.d("CHECK", "result : " + json_string);
} catch (InterruptedException | ExecutionException e) {
e.printStackTrace();
}
try {
jsonObject = new JSONObject(json_string);
jsonArray = jsonObject.getJSONArray("users");
int count = 0;
String username, token;
username = "-";
while (count < jsonArray.length()) {
JSONObject JO = jsonArray.getJSONObject(count);
username = JO.getString("username");
token = JO.getString("token");
ChatRoomUserHelper chatRoomUserHelper = new ChatRoomUserHelper(username, token);
if (!ownUsername.equals(chatRoomUserHelper.getUsername())) {
roomUserAdapter.add(chatRoomUserHelper);
}
count++;
}
} catch (JSONException e) {
e.printStackTrace();
}
}
Aggregations