Search in sources :

Example 6 with SessionManager

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);
}
Also used : ChatMessageHelper(ingage.ingage20.helpers.ChatMessageHelper) SessionManager(ingage.ingage20.managers.SessionManager) ExecutionException(java.util.concurrent.ExecutionException) ChatFeaturesHandler(ingage.ingage20.handlers.ChatFeaturesHandler)

Example 7 with SessionManager

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;
}
Also used : ChatRoomHandler(ingage.ingage20.handlers.ChatRoomHandler) SessionManager(ingage.ingage20.managers.SessionManager) ExecutionException(java.util.concurrent.ExecutionException)

Example 8 with SessionManager

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();
    }
}
Also used : SessionManager(ingage.ingage20.managers.SessionManager) QueryThreadsHandler(ingage.ingage20.handlers.QueryThreadsHandler) ExecutionException(java.util.concurrent.ExecutionException)

Example 9 with SessionManager

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));*
     */
    }
}
Also used : SessionManager(ingage.ingage20.managers.SessionManager) TextView(android.widget.TextView)

Example 10 with SessionManager

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);
 *        }*
 */
}
Also used : SessionManager(ingage.ingage20.managers.SessionManager) ImageView(android.widget.ImageView)

Aggregations

SessionManager (ingage.ingage20.managers.SessionManager)26 ExecutionException (java.util.concurrent.ExecutionException)10 TextView (android.widget.TextView)7 View (android.view.View)6 ImageView (android.widget.ImageView)5 ChatRoomManager (ingage.ingage20.managers.ChatRoomManager)5 ChatRoomHandler (ingage.ingage20.handlers.ChatRoomHandler)4 LinearLayoutManager (android.support.v7.widget.LinearLayoutManager)3 RecyclerView (android.support.v7.widget.RecyclerView)3 Bundle (android.os.Bundle)2 ActionBar (android.support.v7.app.ActionBar)2 QueryThreadsHandler (ingage.ingage20.handlers.QueryThreadsHandler)2 SpectateRoomHandler (ingage.ingage20.handlers.SpectateRoomHandler)2 WifiManager (ingage.ingage20.managers.WifiManager)2 Context (android.content.Context)1 Intent (android.content.Intent)1 Fragment (android.support.v4.app.Fragment)1 LayoutInflater (android.view.LayoutInflater)1 AdapterView (android.widget.AdapterView)1 ListView (android.widget.ListView)1