Exemplo n.º 1
0
 @Override
 protected void onPause() {
   super.onPause();
   SharedPreferences.Editor editor =
       getSharedPreferences(Constants.APP_SHARED_PREF, Constants.MODE_PRIVATE).edit();
   editor.putString(Constants.TOURNAMENT, mTournament.getName());
   editor.putString(Constants.POSITION, mTournament.getTeamPositionString());
   editor.putString(Constants.EVENT_CODE, mTournament.getmEventCode());
   editor.commit();
 }
Exemplo n.º 2
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    // Load The Blue Alliance API
    APIv2Helper.setAppId(Constants.API_ID);

    setContentView(R.layout.activity_main);
    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);

    mDBHelper = new DBHelper(this);
    loadPersistentData();

    DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
    ActionBarDrawerToggle toggle =
        new ActionBarDrawerToggle(
            this,
            drawer,
            toolbar,
            R.string.navigation_drawer_open,
            R.string.navigation_drawer_close);
    drawer.setDrawerListener(toggle);
    toggle.syncState();

    NavigationView navigationView = (NavigationView) findViewById(R.id.nav_view);
    navigationView.setNavigationItemSelectedListener(this);

    android.support.v4.app.FragmentTransaction ft = getSupportFragmentManager().beginTransaction();
    if (!mTournament.getName().equals("")) {
      mCurrentFragment = new StatusFragment();
    } else {
      // Overwrites the empty tournament object
      mCurrentFragment = new SetUpNewTournamentFragment();
    }
    ft.replace(R.id.fragment_container, mCurrentFragment);
    ft.commit();
  }