예제 #1
0
 /** If data is stored, read it and display, otherwise dummy stuff */
 public void checkUserStats() {
   boolean isStored = UserStats.isSaved(cont);
   if (isStored) {
     stats = new UserStats(cont);
     stats.readData();
     fillDataStored();
   } else {
     fillDataEmpty();
   }
 }
예제 #2
0
 /** Read stuff from file then output it as the same so it's all hunky dory */
 public void fillDataStored() {
   RadioButton male = (RadioButton) findViewById(R.id.gender_male);
   RadioButton female = (RadioButton) findViewById(R.id.gender_female);
   RadioButton pounds = (RadioButton) findViewById(R.id.weight_lbs);
   RadioButton kgs = (RadioButton) findViewById(R.id.weight_kgs);
   if (stats.isMan) {
     male.setChecked(true);
   } else {
     female.setChecked(true);
   }
   if (stats.isKG) {
     kgs.setChecked(true);
   } else {
     pounds.setChecked(true);
   }
   EditText weight = (EditText) findViewById(R.id.weight_view);
   EditText deadlift_view = (EditText) findViewById(R.id.deadlift_view);
   EditText squat_view = (EditText) findViewById(R.id.squat_view);
   EditText bench_view = (EditText) findViewById(R.id.bench_view);
   weight.setText(String.valueOf(stats.weight));
   deadlift_view.setText(String.valueOf(stats.deadlift));
   squat_view.setText(String.valueOf(stats.squat));
   bench_view.setText(String.valueOf(stats.bench));
   InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
   imm.hideSoftInputFromWindow(weight.getWindowToken(), 0);
   imm.hideSoftInputFromWindow(deadlift_view.getWindowToken(), 0);
   imm.hideSoftInputFromWindow(squat_view.getWindowToken(), 0);
   imm.hideSoftInputFromWindow(bench_view.getWindowToken(), 0);
   TextView output = (TextView) findViewById(R.id.output_view);
   DecimalFormat df = new DecimalFormat("#.###");
   StringBuilder outputString = new StringBuilder(1000);
   outputString.append(
       "Big 3 Total: " + df.format(stats.total) + "\nWilks Score: " + df.format(stats.wilksScore));
   try {
     String classification = stats.getClassifs();
     if (!classification.contains("Un-trained")) {
       outputString.append("\nClassification: " + stats.getClassifs());
     }
   } catch (Exception e) {
     Log.e("Wilks Calculator", "Error getting classifs", e);
   }
   output.setText(outputString.toString());
   output.setOnClickListener(
       new OnClickListener() {
         @Override
         public void onClick(View v) {
           wilksPopup();
         }
       });
   setButtonsOnClick(male, female, pounds, kgs, weight, deadlift_view, squat_view, bench_view);
 }