Ejemplo n.º 1
0
 private void loadProfileView() {
   int goal = ((MyApp) getApplication()).getGoal();
   SwitchButton sb;
   if (goal == 1) {
     sb = (SwitchButton) findViewById(R.id.goalselection_button_strength);
     sb.toggle();
   } else if (goal == 2) {
     sb = (SwitchButton) findViewById(R.id.goalselection_button_cardio);
     sb.toggle();
   } else if (goal == 3) {
     sb = (SwitchButton) findViewById(R.id.goalselection_button_general);
     sb.toggle();
   }
 }
Ejemplo n.º 2
0
 public void toggle(View v) {
   // Toast.makeText(this,"Reached toggle", Toast.LENGTH_SHORT).show();
   SwitchButton sb = (SwitchButton) v;
   sb.toggle();
   onClick(v);
   // Toast.makeText(this,"passed click", Toast.LENGTH_SHORT).show();
   if (sb.isChecked()) {
     int thisViewID = sb.getId();
     int strengthID = R.id.goalselection_button_strength;
     int cardioID = R.id.goalselection_button_cardio;
     int generalID = R.id.goalselection_button_general;
     int[] list = {strengthID, cardioID, generalID};
     for (int id : list) {
       if (id != thisViewID) {
         ((SwitchButton) findViewById(id)).setChecked(false);
       }
     }
     // set the other buttons to the off position.
   } else {
     ((MyApp) this.getApplication()).setGoal(0); // indicates no goal is set.
   }
 }