Search in sources :

Example 1 with SessionManager

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();
            }
        }
    });
}
Also used : WifiManager(ingage.ingage20.managers.WifiManager) SessionManager(ingage.ingage20.managers.SessionManager) View(android.view.View) TextView(android.widget.TextView)

Example 2 with SessionManager

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);
}
Also used : WifiManager(ingage.ingage20.managers.WifiManager) ListView(android.widget.ListView) FrontPageFragment(ingage.ingage20.fragments.FrontPageFragment) SessionManager(ingage.ingage20.managers.SessionManager) FrontPageFragment(ingage.ingage20.fragments.FrontPageFragment) Fragment(android.support.v4.app.Fragment) CategoriesPageFragment(ingage.ingage20.fragments.CategoriesPageFragment) SearchResultFragment(ingage.ingage20.fragments.SearchResultFragment) ActionBar(android.support.v7.app.ActionBar)

Example 3 with SessionManager

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();
}
Also used : HashMap(java.util.HashMap) SessionManager(ingage.ingage20.managers.SessionManager)

Example 4 with SessionManager

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);
}
Also used : Bundle(android.os.Bundle) SessionManager(ingage.ingage20.managers.SessionManager) Intent(android.content.Intent) LinearLayoutManager(android.support.v7.widget.LinearLayoutManager) ImageView(android.widget.ImageView) View(android.view.View) RecyclerView(android.support.v7.widget.RecyclerView) TextView(android.widget.TextView)

Example 5 with SessionManager

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;
}
Also used : SessionManager(ingage.ingage20.managers.SessionManager) ChatRoomManager(ingage.ingage20.managers.ChatRoomManager) View(android.view.View) RecyclerView(android.support.v7.widget.RecyclerView)

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