private BaseSkillEditor findSkillEditor(ISkill sk) { TableLayout tableSkills = (TableLayout) findViewById(R.id.tableSkills); int rows = tableSkills.getChildCount(); for (int i = 0; i < rows; i++) { BaseSkillEditor editor = (BaseSkillEditor) tableSkills.getChildAt(i); if (editor.isEditorFor(sk)) return editor; } return null; }
// This sucks but it's pretty straightforward for now private void calculateDynamicSkills(Attribute attribute, boolean updateEditor) { ISkill sk = null; if (attribute.getName().equals("DEX")) { sk = investigator.getSkills().get("Dodge"); if (sk != null) sk.setBaseValue(attribute.getTotal() * 2); } else if (attribute.getName().equals("EDU")) { sk = investigator.getSkills().get("Own Language"); if (sk != null) sk.setBaseValue(Math.min(99, attribute.getTotal() * 5)); } if (updateEditor && sk != null) { BaseSkillEditor editor = findSkillEditor(sk); editor.updateBaseValue(); } }