Search in sources :

Example 16 with SessionManager

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

the class PostThreadActivity method onCreate.

@Override
protected void onCreate(final Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    session = new SessionManager(getApplicationContext());
    setContentView(R.layout.activity_post_thread);
    getSupportActionBar().setDisplayHomeAsUpEnabled(true);
    getSupportActionBar().setHomeButtonEnabled(true);
    categorySpinner = (Spinner) findViewById(R.id.category_spinner);
    adapter = ArrayAdapter.createFromResource(this, R.array.thread_categories, android.R.layout.simple_spinner_item);
    adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
    categorySpinner.setAdapter(adapter);
    categorySpinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {

        @Override
        public void onItemSelected(AdapterView<?> parent, View view, int position, long l) {
            Toast.makeText(getBaseContext(), parent.getItemAtPosition(position) + "selected", Toast.LENGTH_LONG).show();
        }

        @Override
        public void onNothingSelected(AdapterView<?> adapterView) {
        }
    });
    mInsertThreadContent = (EditText) findViewById(R.id.insert_thread_content_text_view);
    mInsertThreadTitle = (EditText) findViewById(R.id.insert_thread_title_text_view);
    imageToUpload = (ImageView) findViewById(R.id.uploadImageView);
    llUploadImage = (LinearLayout) findViewById(R.id.llUploadImage);
    imageToUpload.setVisibility(View.INVISIBLE);
    setUploadImageLayout();
    addListenerOnSpinnerItemSelection();
    // bUploadImage = (Button) findViewById(R.id.upload_image_button);
    llUploadImage.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View view) {
            goUploadImage();
        }
    });
    imageToUpload.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View view) {
            goUploadImage();
        }
    });
}
Also used : SessionManager(ingage.ingage20.managers.SessionManager) AdapterView(android.widget.AdapterView) ImageView(android.widget.ImageView) View(android.view.View) AdapterView(android.widget.AdapterView) TextView(android.widget.TextView)

Example 17 with SessionManager

use of ingage.ingage20.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.chat_layout, viewGroup, shouldAttachToParentImmediately);
    Log.d("STATE", "viewType: " + viewType);
    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.chat_layout_own, viewGroup, shouldAttachToParentImmediately);
    else if (viewType == 1)
        view = inflater.inflate(R.layout.chat_layout, viewGroup, shouldAttachToParentImmediately);
    if (viewType == 2)
        view = inflater.inflate(R.layout.chat_layout_own_right, viewGroup, shouldAttachToParentImmediately);
    else if (viewType == 3)
        view = inflater.inflate(R.layout.chat_layout_right, viewGroup, shouldAttachToParentImmediately);
    ChatViewHolder viewHolder = new ChatViewHolder(view);
    return viewHolder;
}
Also used : Context(android.content.Context) SessionManager(ingage.ingage20.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 18 with SessionManager

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

the class CategoriesPageFragment method getThreadsJSON.

public void getThreadsJSON(int rowCount) {
    queryThreadsHandler = new QueryThreadsHandler();
    session = new SessionManager(getActivity().getApplicationContext());
    HashMap<String, String> user = session.getUserDetails();
    String type = user.get(SessionManager.PAGE_TYPE);
    String categoryType = user.get(SessionManager.CATEGORY_TYPE);
    Log.d("CategoryType", " result : " + categoryType);
    Log.d("PageType", " result : " + rowCount);
    try {
        json_string = queryThreadsHandler.execute(type, categoryType, 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 19 with SessionManager

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

the class FragmentBase method spectate.

public void spectate(int p) {
    ThreadsHelper threadsHelper = (ThreadsHelper) threadListAdapter.getItem(p);
    String thread_id = threadsHelper.getThread_id();
    String type = "spectate";
    session = new SessionManager(getActivity().getApplicationContext());
    HashMap<String, String> user = session.getUserDetails();
    String username = user.get(SessionManager.KEY_NAME);
    SpectateRoomHandler spectateRoomHandler = new SpectateRoomHandler(getActivity().getApplicationContext());
    try {
        // Log.d("JOINSPECTATE", "yes");
        result = spectateRoomHandler.execute(type, thread_id, username).get();
    } catch (InterruptedException | ExecutionException e) {
        e.printStackTrace();
    }
    if (result.equals("Spectate room failed")) {
        Toast.makeText(getActivity(), "spectate room failed!", Toast.LENGTH_LONG).show();
    } else {
        chatRoomManager = new ChatRoomManager(getActivity().getApplicationContext());
        chatRoomManager.updateUserRoomSession(thread_id, null, "true");
        goToChat(result);
    }
}
Also used : SpectateRoomHandler(ingage.ingage20.handlers.SpectateRoomHandler) SessionManager(ingage.ingage20.managers.SessionManager) ChatRoomManager(ingage.ingage20.managers.ChatRoomManager) ExecutionException(java.util.concurrent.ExecutionException) ThreadsHelper(ingage.ingage20.helpers.ThreadsHelper)

Example 20 with SessionManager

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

the class FragmentBase method joinRoom.

public String joinRoom(Context context, String type, String thread_id, String userJSON) {
    session = new SessionManager(getActivity().getApplicationContext());
    HashMap<String, String> user = session.getUserDetails();
    String username = user.get(SessionManager.KEY_NAME);
    String token = MainActivity.appToken;
    String result = null;
    ChatRoomHandler chatRoomHandler = new ChatRoomHandler(context);
    try {
        result = chatRoomHandler.execute(type, thread_id, username, token, side).get();
    } catch (InterruptedException | ExecutionException e) {
        e.printStackTrace();
    }
    chatRoomManager = new ChatRoomManager(getActivity().getApplicationContext());
    chatRoomManager.updateUserRoomSession(thread_id, side, "false");
    return result;
}
Also used : ChatRoomHandler(ingage.ingage20.handlers.ChatRoomHandler) SessionManager(ingage.ingage20.managers.SessionManager) ChatRoomManager(ingage.ingage20.managers.ChatRoomManager) 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