Skip to content

Commit

Permalink
decouple selected state (UI/view) from CDT codes
Browse files Browse the repository at this point in the history
  • Loading branch information
slogan621 committed Nov 15, 2020
1 parent 03e6f06 commit e0f7936
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,12 @@ public class CDTCodesModel {
private String m_desc;
private int m_id;
private JSONObject m_obj;
private boolean m_selected;

public CDTCodesModel(JSONObject obj, boolean selected) throws Exception {
CDTCodesModelInit(obj, selected);
public CDTCodesModel(JSONObject obj) throws Exception {
CDTCodesModelInit(obj);
}

public void CDTCodesModelInit(JSONObject obj, boolean selected) throws Exception {
public void CDTCodesModelInit(JSONObject obj) throws Exception {
this.m_obj = obj;

try {
Expand All @@ -46,7 +45,6 @@ public void CDTCodesModelInit(JSONObject obj, boolean selected) throws Exception
catch (JSONException e) {
throw e;
}
this.m_selected = selected;
}

public int getId() {
Expand All @@ -68,12 +66,4 @@ public String getDesc() {
public String repr() {
return m_repr;
}

public boolean isSelected() {
return m_selected;
}

public void setSelected(boolean selected) {
this.m_selected = selected;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ public boolean setModelData(JSONArray items) {
m_list.clear();
for (int i = 0; i < items.length(); i++) {
try {
CDTCodesModel model = new CDTCodesModel(items.getJSONObject(i), false);
CDTCodesModel model = new CDTCodesModel(items.getJSONObject(i));
m_list.put(model.repr(), model);
} catch (Exception e) {
ret = false;
Expand Down

0 comments on commit e0f7936

Please sign in to comment.