use of ingage.ingage20.managers.SessionManager 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.managers.SessionManager in project iNGAGE by davis123123.
the class FragmentBase method viewRoomStatus.
public String viewRoomStatus(Context context, String type, String thread_id) {
session = new SessionManager(getActivity().getApplicationContext());
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 FrontPageFragment method getThreadsJSON.
public void getThreadsJSON(int rowCount) {
queryThreadsHandler = new QueryThreadsHandler();
Log.d("ROWCOUNT", " result : " + rowCount);
session = new SessionManager(getActivity().getApplicationContext());
HashMap<String, String> user = session.getUserDetails();
String type = user.get(SessionManager.PAGE_TYPE);
try {
json_string = queryThreadsHandler.execute(type, String.valueOf(rowCount)).get();
Log.d("STATE", "query result : " + json_string);
threadListAdapter.setLoaded(false);
} catch (InterruptedException e) {
e.printStackTrace();
} catch (ExecutionException e) {
e.printStackTrace();
}
}
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);
* }*
*/
}
Aggregations