Search in sources :

Example 6 with SessionManager

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

the class MainActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    mContext = getApplicationContext();
    session = new SessionManager(mContext);
    session.checkLogin();
    setContentView(R.layout.activity_main);
    setupToolbar(savedInstanceState);
    /**
     *RecyclerView (TEMPORARY, MOVE TO A FRAGMENT LATER)*
     */
    parseJSON();
    setupNavigationMenu(savedInstanceState);
    setupNavigationDrawer();
    session.updatePage(pageType);
    session.updateCategory(pageCategory);
    // initTabs();
    searchBar = (FloatingSearchView) findViewById(R.id.floating_search_view);
    viewPager = (ViewPager) findViewById(R.id.viewpager);
    tabLayout = (TabLayout) findViewById(R.id.tabs);
    tabLayout.setupWithViewPager(viewPager);
    setupViewPager(viewPager);
    // initAnnouncement();
    HashMap<String, String> user = session.getUserDetails();
    String categoryType = "";
    categoryType = user.get(SessionManager.CATEGORY_TYPE);
    // Log.d("CategoryName", categoryType);
    if (categoryType == null) {
        categoryType = "Home";
    }
    // Set the title for the fragment.
    final ActionBar actionBar = this.getSupportActionBar();
    if (actionBar != null) {
        actionBar.setTitle(categoryType);
    }
    getSupportActionBar().setDisplayHomeAsUpEnabled(true);
    UserProfileActivity.recentComments.clear();
}
Also used : SessionManager(ingage.ingage.managers.SessionManager) ActionBar(android.support.v7.app.ActionBar)

Example 7 with SessionManager

use of ingage.ingage.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);
        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);
        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();
            }
        };
        String ip = App.getAppContext().getResources().getString(R.string.ip);
        handler = new UserInfoHandler();
        handler.setCallBackData(callBackData);
        handler.enqueue(userProfileActivity.getUsername(), ip);
        recycler.setVisibility(View.GONE);
        mShortAnimationDuration = getResources().getInteger(android.R.integer.config_shortAnimTime);
    }
    return rootView;
}
Also used : UserProfileInfoAdapter(ingage.ingage.adapters.UserProfileInfoAdapter) SessionManager(ingage.ingage.managers.SessionManager) UserInfoHandler(ingage.ingage.handlers.UserInfoHandler) LinearLayoutManager(android.support.v7.widget.LinearLayoutManager)

Example 8 with SessionManager

use of ingage.ingage.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);
    try {
        if (categoryType != null)
            json_string = queryThreadsHandler.execute("categoryDate", categoryType, String.valueOf(rowCount)).get();
        else
            json_string = queryThreadsHandler.execute("date", 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 9 with SessionManager

use of ingage.ingage.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);
    rowCount = 0;
    threadListAdapter = new ThreadListAdapter(this, getActivity(), true);
    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 10 with SessionManager

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

the class SplashActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    Log.d(LOG_TAG, "onCreate");
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_splash);
    session = new SessionManager(getApplicationContext());
    final Thread thread = new Thread(new Runnable() {

        public void run() {
            // if the user was already previously in to a provider.
            if (session.isLoggedIn() == true) {
                // asynchronously handle refreshing credentials and call our handler.
                HashMap<String, String> user = session.getUserDetails();
                String username = user.get(SessionManager.KEY_NAME);
                String password = user.get(SessionManager.KEY_PASSWORD);
                String type = "login";
                goMain();
            } else {
                // Asyncronously go to the sign-in page (after the splash delay has expired).
                goSignIn();
            }
            // Wait for the splash timeout.
            try {
                Thread.sleep(2000);
            } catch (InterruptedException e) {
            }
            // Expire the splash page delay.
            timeoutLatch.countDown();
        }
    });
    thread.start();
}
Also used : HashMap(java.util.HashMap) 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