Example #1
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    Backendless.initApp(this, APP_ID, SECRET_KEY, VERSION);
    mToolbar = (Toolbar) findViewById(R.id.toolbar_actionbar);
    setSupportActionBar(mToolbar);
    getSupportActionBar().setDisplayShowTitleEnabled(false);

    mNavigationDrawerFragment =
        (NavigationDrawerFragment) getFragmentManager().findFragmentById(R.id.fragment_drawer);

    // Set up the drawer.
    mNavigationDrawerFragment.setup(
        R.id.fragment_drawer, (DrawerLayout) findViewById(R.id.drawer), mToolbar);

    this.loaded =
        true; // without this line, onNavigationDrawerItemSelected will run first for some reason

    isOnline();

    initOfferList();
    offerGridView = (GridView) findViewById(R.id.gridView);
    adapter = new OfferAdapter(this, offerList);
    offerGridView.setAdapter(adapter);
    // offerGridView.setOnItemClickListener();

  }
Example #2
0
 @Override
 public boolean onCreateOptionsMenu(Menu menu) {
   if (!mNavigationDrawerFragment.isDrawerOpen()) {
     // Only show items in the action bar relevant to this screen
     // if the drawer is not showing. Otherwise, let the drawer
     // decide what to show in the action bar.
     getMenuInflater().inflate(R.menu.main, menu);
     return true;
   }
   return super.onCreateOptionsMenu(menu);
 }
Example #3
0
 @Override
 public void onBackPressed() {
   if (mNavigationDrawerFragment.isDrawerOpen()) mNavigationDrawerFragment.closeDrawer();
   else super.onBackPressed();
 }