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();
}
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;
}
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();
}
}
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;
}
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();
}
Aggregations