Search in sources :

Example 21 with SessionManager

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

the class SearchResultFragment method getThreadsJSON.

public void getThreadsJSON(int rowCount, String searchString) {
    searchHandler = new SearchHandler();
    Log.d("ROWCOUNT", " result : " + searchString);
    session = new SessionManager(getActivity().getApplicationContext());
    HashMap<String, String> user = session.getUserDetails();
    String type = user.get(SessionManager.PAGE_TYPE);
    try {
        json_string = searchHandler.execute(String.valueOf(rowCount), searchString).get();
        Log.d("STATE", "query result : " + json_string);
        threadListAdapter.setLoaded(false);
        inflateThreads();
    } catch (InterruptedException e) {
        e.printStackTrace();
    } catch (ExecutionException e) {
        e.printStackTrace();
    }
}
Also used : SearchHandler(ingage.ingage20.handlers.SearchHandler) SessionManager(ingage.ingage20.managers.SessionManager) ExecutionException(java.util.concurrent.ExecutionException)

Example 22 with SessionManager

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

the class SearchResultFragment 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);
    threadListAdapter = new ThreadListAdapter(this, getActivity());
    getThreadsJSON(rowCount, searchString);
    rootView = inflater.inflate(R.layout.fragment_front_page, container, false);
    rootView.setTag(TAG);
    return rootView;
}
Also used : SessionManager(ingage.ingage20.managers.SessionManager) ThreadListAdapter(ingage.ingage20.adapters.ThreadListAdapter)

Example 23 with SessionManager

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

the class UserInfoFragment method onCreateView.

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    // Inflate the layout for this fragment
    rootView = inflater.inflate(R.layout.fragment_user_info, container, false);
    recycler = (RecyclerView) rootView.findViewById(R.id.info);
    mLoadingView = rootView.findViewById(R.id.loading_spinner);
    SessionManager session = new SessionManager(getContext());
    HashMap<String, String> info = session.getUserDetails();
    if (userProfileActivity.getUsername().equals(info.get(SessionManager.KEY_NAME))) {
        mLoadingView.setVisibility(View.GONE);
        final LinearLayoutManager layoutManager = new LinearLayoutManager(getContext());
        recycler.setLayoutManager(layoutManager);
        adapter = new UserProfileInfoAdapter();
        recycler.setAdapter(adapter);
        username = info.get(SessionManager.KEY_NAME);
        email = info.get(SessionManager.KEY_EMAIL);
        tribute_pts = info.get(SessionManager.KEY_TRIBUTE_POINTS);
        subs = info.get(SessionManager.KEY_SUBSCRIPTIONS);
        date_joined = info.get(SessionManager.KEY_DATE_JOINED);
        if (email != null && email.length() > 0)
            adapter.add("Email: " + email);
        else
            adapter.add("Email: N/A");
        adapter.add("Tribute points: " + tribute_pts);
        setSubscriptions();
        adapter.add("Date joined: " + date_joined);
        adapter.notifyDataSetChanged();
    } else {
        UserInfoHandler.CallBackData callBackData = new UserInfoHandler.CallBackData() {

            @Override
            public void notifyChange(String serverResponse) {
                Log.d("SERVERREeeSPONSE", serverResponse);
                parseProfileJSON(serverResponse);
                crossFadeRecyler();
            }
        };
        handler = new UserInfoHandler();
        handler.setCallBackData(callBackData);
        handler.enqueue(userProfileActivity.getUsername());
        recycler.setVisibility(View.GONE);
        mShortAnimationDuration = getResources().getInteger(android.R.integer.config_shortAnimTime);
    }
    return rootView;
}
Also used : UserProfileInfoAdapter(ingage.ingage20.adapters.UserProfileInfoAdapter) SessionManager(ingage.ingage20.managers.SessionManager) UserInfoHandler(ingage.ingage20.handlers.UserInfoHandler) LinearLayoutManager(android.support.v7.widget.LinearLayoutManager)

Example 24 with SessionManager

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

the class ChangeAvatarActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    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.ingage20.managers.SessionManager)

Example 25 with SessionManager

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

the class ChatActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_chat);
    getSupportActionBar().setDisplayHomeAsUpEnabled(true);
    session = new SessionManager(getApplicationContext());
    HashMap<String, String> user = session.getUserDetails();
    username = user.get(SessionManager.KEY_NAME);
    chatRoomManager = new ChatRoomManager(getApplicationContext());
    timerTv = (TextView) findViewById(R.id.timertv);
    useCoinBt = (Button) findViewById(R.id.cooldownButton);
    textArea = (LinearLayout) findViewById(R.id.text_area);
    textButtons = (LinearLayout) findViewById(R.id.text_right);
    timerTv.setVisibility(View.GONE);
    useCoinBt.setVisibility(View.GONE);
    Bundle extras = getIntent().getExtras();
    if (extras != null) {
        String title = extras.getString("title");
        Log.i("clicked title: ", title);
        ActionBar mActionBarToolbar = getSupportActionBar();
        mActionBarToolbar.setTitle(title);
    }
    useCoinBt.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            Log.d("Click", "clicked");
            useCoin();
        }
    });
    // click to use token
    // getuser details
    HashMap<String, String> chat = chatRoomManager.getUserDetails();
    thread_id = chat.get(ChatRoomManager.THREAD_ID);
    user_side = chat.get(ChatRoomManager.SIDE);
    if (user_side != null) {
        // fifteen minutes of inactivity will kick user out
        kickTimer(900000);
        Log.d("STATE", "side: " + user_side);
    }
    // Does not kick out spectator with timer
    // ENTER MESSAGES WITH @TAGS
    textField = (EditText) findViewById(R.id.msgField);
    textChangeListener();
    setKeyBoardListener();
    // thread id for root of comments tree
    root = FirebaseDatabase.getInstance().getReference().child(thread_id);
    // TAKES TIME TO TRANSACT
    pageCount(root);
    // add messages to recycler view by clicking send
    addButton = (Button) findViewById(R.id.sendMessageButton);
    if (addButton != null) {
        addButton.setOnClickListener(new View.OnClickListener() {

            @Override
            public void onClick(View v) {
                sendMsg();
            }
        });
    // click to send message
    // calls event listener to update message in realtime
    // eventListener(root);
    }
    HashMap<String, String> chat_user = chatRoomManager.getUserDetails();
    String spectator = chat_user.get(ChatRoomManager.SPECTATOR);
    if (spectator.equals("true")) {
        setSpectateMode();
    }
}
Also used : SessionManager(ingage.ingage20.managers.SessionManager) Bundle(android.os.Bundle) ChatRoomManager(ingage.ingage20.managers.ChatRoomManager) View(android.view.View) TextView(android.widget.TextView) ActionBar(android.support.v7.app.ActionBar)

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