use of ingage.ingage20.managers.SessionManager in project iNGAGE by davis123123.
the class LoginActivity method onCreate.
// String thread_subs;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_sign_in);
session = new SessionManager(getApplicationContext());
wifiManager = new WifiManager(getBaseContext());
usernameEt = (EditText) findViewById(R.id.username);
passwordEt = (EditText) findViewById(R.id.password);
LoginEt = (Button) findViewById(R.id.sign_in_button);
signUpTV = (TextView) findViewById(R.id.signIn_textView_CreateNewAccount);
signUpTV.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
if (wifiManager.checkInternet())
goSignUp();
else
wifiErrorDialog();
}
});
LoginEt.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
if (view == LoginEt) {
if (wifiManager.checkInternet())
OnLogin();
else
wifiErrorDialog();
}
}
});
}
use of ingage.ingage20.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)*
*/
ListView lvItems;
wifiManager = new WifiManager(getBaseContext());
if (wifiManager.checkInternet()) {
parseJSON();
setupNavigationMenu(savedInstanceState);
setupNavigationDrawer();
session.updatePage(pageType);
/* initilize FrontPage Fragment*/
fragmentManager = this.getSupportFragmentManager();
final Class fragmentClass = FrontPageFragment.class;
final Fragment fragment = Fragment.instantiate(this, fragmentClass.getName());
fragmentManager.beginTransaction().replace(R.id.main_fragment_container, fragment, fragmentClass.getSimpleName()).setTransition(FragmentTransaction.TRANSIT_FRAGMENT_OPEN).commit();
initTabs();
initAnnouncement();
}
// Set the title for the fragment.
final ActionBar actionBar = this.getSupportActionBar();
if (actionBar != null) {
actionBar.setTitle(getString(R.string.app_name));
}
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
UserProfileActivity.recentComments.clear();
// viewPager = (ViewPager) findViewById(R.id.viewpager);
// setupViewPager(viewPager);
// tabLayout.setupWithViewPager(viewPager);
}
use of ingage.ingage20.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";
// IdentityHandler identityHandler = new IdentityHandler(mcontext);
// identityHandler.execute(type, username, password);
goMain();
// goSignIn();
} 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();
}
use of ingage.ingage20.managers.SessionManager in project iNGAGE by davis123123.
the class UserProfileActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Bundle extras = getIntent().getExtras();
if (extras != null) {
username = extras.getString("USER");
Toast.makeText(getApplicationContext(), username, Toast.LENGTH_LONG).show();
}
setContentView(R.layout.activity_user_profile);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
SessionManager session = new SessionManager(getApplicationContext());
HashMap<String, String> info = session.getUserDetails();
curr_avatar = (ImageView) findViewById(R.id.profile_img);
if (username.equals(info.get(SessionManager.KEY_NAME))) {
curr_avatar.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent = new Intent(getApplicationContext(), ChangeAvatarActivity.class);
finish();
startActivity(intent);
}
});
}
/*display_username = (TextView) findViewById(R.id.user_name);
display_username.setText(username);*/
getSupportActionBar().setTitle(username);
final LinearLayoutManager layoutManager = new LinearLayoutManager(this);
downloadAvatar();
viewPager = (ViewPager) findViewById(R.id.viewpager);
setupViewPager(viewPager);
tabLayout = (TabLayout) findViewById(R.id.tabs);
tabLayout.setupWithViewPager(viewPager);
}
use of ingage.ingage20.managers.SessionManager in project iNGAGE by davis123123.
the class ChatFragment method onCreateView.
@Override
public View onCreateView(final LayoutInflater inflater, final ViewGroup container, final Bundle savedInstanceState) {
View v = create(inflater, container, savedInstanceState);
// thread id for root of comments tree
// getuser details
chatRoomManager = new ChatRoomManager(getContext());
HashMap<String, String> chat = chatRoomManager.getUserDetails();
thread_id = chat.get(ChatRoomManager.THREAD_ID);
user_side = chat.get(ChatRoomManager.SIDE);
root = FirebaseDatabase.getInstance().getReference().child(thread_id);
session = new SessionManager(getContext());
HashMap<String, String> user = session.getUserDetails();
username = user.get(SessionManager.KEY_NAME);
username = user.get(SessionManager.KEY_NAME);
return v;
}
Aggregations