Search in sources :

Example 11 with SessionManager

use of ingage.ingage.managers.SessionManager in project iNGAGE by davis123123.

the class ChatArrayAdapter method onCreateViewHolder.

@Override
public ChatViewHolder onCreateViewHolder(ViewGroup viewGroup, int viewType) {
    // Get the RecyclerView item layout
    Context context = viewGroup.getContext();
    LayoutInflater inflater = LayoutInflater.from(context);
    boolean shouldAttachToParentImmediately = false;
    View view = inflater.inflate(R.layout.item_chat_post_agree, viewGroup, false);
    Log.d("STATE", "viewType: " + viewType);
    unselectedColor = context.getResources().getColor(R.color.tab_text_unselected);
    selectedColorAgree = context.getResources().getColor(R.color.green);
    selectedColorDisagree = context.getResources().getColor(R.color.colorPrimary);
    SessionManager session = new SessionManager(viewGroup.getContext());
    HashMap<String, String> user = session.getUserDetails();
    username = user.get(SessionManager.KEY_NAME);
    if (viewType == 0)
        view = inflater.inflate(R.layout.item_chat_post_agree_you, viewGroup, false);
    else if (viewType == 1)
        view = inflater.inflate(R.layout.item_chat_post_agree, viewGroup, false);
    if (viewType == 2)
        view = inflater.inflate(R.layout.item_chat_post_disagree_you, viewGroup, false);
    else if (viewType == 3)
        view = inflater.inflate(R.layout.item_chat_post_disagree, viewGroup, false);
    return new ChatViewHolder(view);
}
Also used : Context(android.content.Context) SessionManager(ingage.ingage.managers.SessionManager) LayoutInflater(android.view.LayoutInflater) ImageView(android.widget.ImageView) RecyclerView(android.support.v7.widget.RecyclerView) TextView(android.widget.TextView) View(android.view.View)

Example 12 with SessionManager

use of ingage.ingage.managers.SessionManager in project iNGAGE by davis123123.

the class ArchivedFragment method getThreadsJSON.

public void getThreadsJSON(int rowCount) {
    queryThreadsHandler = new QueryThreadsHandler();
    SessionManager session = new SessionManager(getActivity().getApplicationContext());
    HashMap<String, String> user = session.getUserDetails();
    String test = user.get(SessionManager.CATEGORY_TYPE);
    Log.d("ARCCATE", " " + test + " " + rowCount);
    try {
        if (user.get(SessionManager.CATEGORY_TYPE) != null) {
            json_string = queryThreadsHandler.execute("categoryArchived", user.get(SessionManager.CATEGORY_TYPE), String.valueOf(rowCount)).get();
            Log.d("ARCCATE2", " " + json_string);
        } else {
            json_string = queryThreadsHandler.execute("archived", 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.ingage.managers.SessionManager) QueryThreadsHandler(ingage.ingage.handlers.QueryThreadsHandler) ExecutionException(java.util.concurrent.ExecutionException)

Example 13 with SessionManager

use of ingage.ingage.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.ingage.helpers.ChatMessageHelper) SessionManager(ingage.ingage.managers.SessionManager) ExecutionException(java.util.concurrent.ExecutionException) ChatFeaturesHandler(ingage.ingage.handlers.ChatFeaturesHandler)

Example 14 with SessionManager

use of ingage.ingage.managers.SessionManager in project iNGAGE by davis123123.

the class SearchResultArchivedFragment method create.

public View create(final LayoutInflater inflater, final ViewGroup container, final Bundle savedInstanceState) {
    // Inflate the layout for this fragment
    session = new SessionManager(getContext());
    HashMap<String, String> user = session.getUserDetails();
    searchString = user.get(SessionManager.SEARCH_STRING);
    Log.d("STATE", "searchstring " + searchString);
    rowCount = 0;
    threadListAdapter = new ThreadListAdapter(this, getActivity(), false);
    getThreadsJSON(rowCount, searchString);
    rootView = inflater.inflate(R.layout.fragment_archived, container, false);
    rootView.setTag(TAG);
    return rootView;
}
Also used : SessionManager(ingage.ingage.managers.SessionManager) ThreadListAdapter(ingage.ingage.adapters.ThreadListAdapter)

Example 15 with SessionManager

use of ingage.ingage.managers.SessionManager in project iNGAGE by davis123123.

the class ChangeAvatarActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    loadingDialog("Loading");
    setContentView(R.layout.activity_change_avatar);
    getSupportActionBar().setDisplayHomeAsUpEnabled(true);
    getSupportActionBar().setTitle("Profile Photo");
    change = (Button) findViewById(R.id.change_avatar);
    new_avatar_preview = (CircularImageView) findViewById(R.id.prof_img_preview);
    SessionManager session = new SessionManager(getApplicationContext());
    HashMap<String, String> info = session.getUserDetails();
    username = info.get(SessionManager.KEY_NAME);
    downloadCurrentAvatar();
    setListeners();
}
Also used : SessionManager(ingage.ingage.managers.SessionManager)

Aggregations

SessionManager (ingage.ingage.managers.SessionManager)24 View (android.view.View)7 ExecutionException (java.util.concurrent.ExecutionException)6 TextView (android.widget.TextView)5 ImageView (android.widget.ImageView)4 ChatRoomManager (ingage.ingage.managers.ChatRoomManager)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 ThreadListAdapter (ingage.ingage.adapters.ThreadListAdapter)2 ChatRoomHandler (ingage.ingage.handlers.ChatRoomHandler)2 QueryThreadsHandler (ingage.ingage.handlers.QueryThreadsHandler)2 SpectateRoomHandler (ingage.ingage.handlers.SpectateRoomHandler)2 HashMap (java.util.HashMap)2 FragmentManager (android.app.FragmentManager)1 Context (android.content.Context)1 Intent (android.content.Intent)1 Resources (android.content.res.Resources)1 BitmapDrawable (android.graphics.drawable.BitmapDrawable)1