// Path: app/src/main/java/org/morsi/android/nethack/redux/CalculatorActivity.java
// public class CalculatorActivity extends Activity {
//     // actual calculators
//     private ArmorCalculator  armor;
//     private DamageCalculator damage;
//     private SpellsCalculator spells;
// 
//     private Spinner calculatorSpinner(){
//         return (Spinner) findViewById(R.id.calculator_spinner);
//     }
// 
//     private ArrayAdapter<CharSequence> spinnerAdapter(){
//         ArrayAdapter<CharSequence> adapter =
//                 ArrayAdapter.createFromResource(this,
//                         R.array.calculator_array,
//                         android.R.layout.simple_spinner_item);
//         adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
//         return adapter;
//     }
// 
//     private String selectedCalculator(){
//         return calculatorSpinner().getSelectedItem().toString();
//     }
// 
//     // Override menu / about_dialog dialog handlers
//     @Override
//     public boolean onSearchRequested() {
//         return AndroidMenu.onSearchRequested(this);
//     }
// 
//     @Override
//     public boolean onCreateOptionsMenu(Menu menu) {
//         return AndroidMenu.onCreateOptionsMenu(this, menu);
//     }
// 
//     @Override
//     public boolean onOptionsItemSelected(MenuItem item) {
//         return AndroidMenu.onOptionsItemSelected(this, item);
//     }
// 
//     @Override
//     protected Dialog onCreateDialog(int id) {
//         return AndroidMenu.onCreateDialog(this, id);
//     }
// 
//     @Override
//     public void onCreate(Bundle savedInstanceState) {
//         super.onCreate(savedInstanceState);
//         setContentView(R.layout.calculator);
// 
//         // hide calculator tools until one is selected by user
//         findViewById(R.id.armor_calculator).setVisibility(View.INVISIBLE);
// 
//         // setup calculator calculatorSpinner
//         calculatorSpinner().setAdapter(spinnerAdapter());
//         handleSpinnerSelection();
//         
//         armor  = new ArmorCalculator(this);
//         damage = new DamageCalculator(this);
//         spells = new SpellsCalculator(this);
//         
//         armor.onCreate();
//         damage.onCreate();
//         spells.onCreate();
//         
//         armor.updateView();
//         damage.updateView();
//         spells.updateView();
//     }
// 
//     private boolean armorSelected(){
//         return selectedCalculator().equals("Armor");
//     }
// 
//     private boolean damageSelected(){
//         return selectedCalculator().equals("Damage");
//     }
// 
//     private boolean spellsSelected(){
//         return selectedCalculator().equals("Spells");
//     }
// 
//     private void hideAll(){
//         UI.hideView(findViewById(R.id.armor_calculator));
//         UI.hideView(findViewById(R.id.damage_calculator));
//         UI.hideView(findViewById(R.id.spells_calculator));
//     }
// 
//     private void handleSpinnerSelection(){
//         final Activity activity = this;
// 
//         calculatorSpinner().setOnItemSelectedListener(new OnItemSelectedListener() {
//             // Handles calculator calculatorSpinner changes
//             public void onItemSelected(AdapterView<?> parent, View view, int pos, long id) {
//                 hideAll();
// 
//                 if(armorSelected()){
//                     UI.showView(findViewById(R.id.armor_calculator));
// 
//                 }else if(damageSelected()){
//                     UI.showView(findViewById(R.id.damage_calculator));
// 
//                 }else if(spellsSelected()){
//                     UI.showView(findViewById(R.id.spells_calculator));
//                 }
//             }
// 
//             public void onNothingSelected(AdapterView<?> parent) {
//             }
//         });
//     }
// }
// 
// Path: app/src/main/java/org/morsi/android/nethack/redux/util/Input.java
// public class Input {
//     public static boolean validInt(String input){
//         // TODO edit_text validation should be a numeric regex
//         return !input.equals("") && !input.equals("-");
//     }
// }


import java.util.Arrays;
import org.morsi.android.nethack.redux.CalculatorActivity;
import org.morsi.android.nethack.redux.R;
import org.morsi.android.nethack.redux.util.Input;
import android.content.SharedPreferences;
import android.text.Editable;
import android.text.TextWatcher;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemSelectedListener;
import android.widget.ArrayAdapter;
import android.widget.EditText;
import android.widget.Spinner;
import android.widget.TextView;
import android.widget.ToggleButton;

    private ToggleButton metalArmorInput() {
        return (ToggleButton)activity.findViewById(R.id.metalArmorInput);
    }

    private boolean metalArmorInputValue(){
        return metalArmorInput().isChecked();
    }

    private ToggleButton otherArmorInput() {
        return (ToggleButton)activity.findViewById(R.id.otherArmorInput);
    }

    private boolean otherArmorInputValue(){
        return otherArmorInput().isChecked();
    }

    private ToggleButton metalHelmetInput() {
        return (ToggleButton)activity.findViewById(R.id.metalHelmetInput);
    }

    private boolean metalHelmetInputValue(){
        return metalHelmetInput().isChecked();
    }

    private ToggleButton metalGlovesInput() {
        return (ToggleButton)activity.findViewById(R.id.metalGlovesInput);
    }

    private boolean metalGlovesInputValue(){
// Path: app/src/main/java/org/morsi/android/nethack/redux/CalculatorActivity.java
// public class CalculatorActivity extends Activity {
//     // actual calculators
//     private ArmorCalculator  armor;
//     private DamageCalculator damage;
//     private SpellsCalculator spells;
// 
//     private Spinner calculatorSpinner(){
//         return (Spinner) findViewById(R.id.calculator_spinner);
//     }
// 
//     private ArrayAdapter<CharSequence> spinnerAdapter(){
//         ArrayAdapter<CharSequence> adapter =
//                 ArrayAdapter.createFromResource(this,
//                         R.array.calculator_array,
//                         android.R.layout.simple_spinner_item);
//         adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
//         return adapter;
//     }
// 
//     private String selectedCalculator(){
//         return calculatorSpinner().getSelectedItem().toString();
//     }
// 
//     // Override menu / about_dialog dialog handlers
//     @Override
//     public boolean onSearchRequested() {
//         return AndroidMenu.onSearchRequested(this);
//     }
// 
//     @Override
//     public boolean onCreateOptionsMenu(Menu menu) {
//         return AndroidMenu.onCreateOptionsMenu(this, menu);
//     }
// 
//     @Override
//     public boolean onOptionsItemSelected(MenuItem item) {
//         return AndroidMenu.onOptionsItemSelected(this, item);
//     }
// 
//     @Override
//     protected Dialog onCreateDialog(int id) {
//         return AndroidMenu.onCreateDialog(this, id);
//     }
// 
//     @Override
//     public void onCreate(Bundle savedInstanceState) {
//         super.onCreate(savedInstanceState);
//         setContentView(R.layout.calculator);
// 
//         // hide calculator tools until one is selected by user
//         findViewById(R.id.armor_calculator).setVisibility(View.INVISIBLE);
// 
//         // setup calculator calculatorSpinner
//         calculatorSpinner().setAdapter(spinnerAdapter());
//         handleSpinnerSelection();
//         
//         armor  = new ArmorCalculator(this);
//         damage = new DamageCalculator(this);
//         spells = new SpellsCalculator(this);
//         
//         armor.onCreate();
//         damage.onCreate();
//         spells.onCreate();
//         
//         armor.updateView();
//         damage.updateView();
//         spells.updateView();
//     }
// 
//     private boolean armorSelected(){
//         return selectedCalculator().equals("Armor");
//     }
// 
//     private boolean damageSelected(){
//         return selectedCalculator().equals("Damage");
//     }
// 
//     private boolean spellsSelected(){
//         return selectedCalculator().equals("Spells");
//     }
// 
//     private void hideAll(){
//         UI.hideView(findViewById(R.id.armor_calculator));
//         UI.hideView(findViewById(R.id.damage_calculator));
//         UI.hideView(findViewById(R.id.spells_calculator));
//     }
// 
//     private void handleSpinnerSelection(){
//         final Activity activity = this;
// 
//         calculatorSpinner().setOnItemSelectedListener(new OnItemSelectedListener() {
//             // Handles calculator calculatorSpinner changes
//             public void onItemSelected(AdapterView<?> parent, View view, int pos, long id) {
//                 hideAll();
// 
//                 if(armorSelected()){
//                     UI.showView(findViewById(R.id.armor_calculator));
// 
//                 }else if(damageSelected()){
//                     UI.showView(findViewById(R.id.damage_calculator));
// 
//                 }else if(spellsSelected()){
//                     UI.showView(findViewById(R.id.spells_calculator));
//                 }
//             }
// 
//             public void onNothingSelected(AdapterView<?> parent) {
//             }
//         });
//     }
// }
// 
// Path: app/src/main/java/org/morsi/android/nethack/redux/util/Input.java
// public class Input {
//     public static boolean validInt(String input){
//         // TODO edit_text validation should be a numeric regex
//         return !input.equals("") && !input.equals("-");
//     }
// }


// Path: app/src/main/java/org/morsi/android/nethack/redux/calculators/SpellsCalculator.java
import java.util.Arrays;
import org.morsi.android.nethack.redux.CalculatorActivity;
import org.morsi.android.nethack.redux.R;
import org.morsi.android.nethack.redux.util.Input;
import android.content.SharedPreferences;
import android.text.Editable;
import android.text.TextWatcher;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemSelectedListener;
import android.widget.ArrayAdapter;
import android.widget.EditText;
import android.widget.Spinner;
import android.widget.TextView;
import android.widget.ToggleButton;


    private ToggleButton metalArmorInput() {
        return (ToggleButton)activity.findViewById(R.id.metalArmorInput);
    }

    private boolean metalArmorInputValue(){
        return metalArmorInput().isChecked();
    }

    private ToggleButton otherArmorInput() {
        return (ToggleButton)activity.findViewById(R.id.otherArmorInput);
    }

    private boolean otherArmorInputValue(){
        return otherArmorInput().isChecked();
    }

    private ToggleButton metalHelmetInput() {
        return (ToggleButton)activity.findViewById(R.id.metalHelmetInput);
    }

    private boolean metalHelmetInputValue(){
        return metalHelmetInput().isChecked();
    }

    private ToggleButton metalGlovesInput() {
        return (ToggleButton)activity.findViewById(R.id.metalGlovesInput);
    }

    private boolean metalGlovesInputValue(){
        return metalGlovesInput().isChecked();