Search in sources :

Example 11 with SessionManager

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

Example 12 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 13 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)

Example 14 with SessionManager

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

Example 15 with SessionManager

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();
    }
}
Also used : ChatRoomHandler(ingage.ingage20.handlers.ChatRoomHandler) SessionManager(ingage.ingage20.managers.SessionManager) ChatRoomManager(ingage.ingage20.managers.ChatRoomManager) JSONException(org.json.JSONException) LinearLayoutManager(android.support.v7.widget.LinearLayoutManager) ChatRoomUserHelper(ingage.ingage20.helpers.ChatRoomUserHelper) RoomUserAdapter(ingage.ingage20.adapters.RoomUserAdapter) JSONObject(org.json.JSONObject) ExecutionException(java.util.concurrent.ExecutionException)

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