Skip to content

Commit

Permalink
Adapted DashboardItemAddFragment to use Dhis2 as main API.
Browse files Browse the repository at this point in the history
  • Loading branch information
arazabishov committed Sep 30, 2015
1 parent d8e7e42 commit d6d122c
Showing 1 changed file with 10 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -164,8 +164,8 @@ public void onButtonClick(View v) {
@OnItemClick(R.id.listview_simple)
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
OptionAdapterValue adapterValue = mAdapter.getItem(position);
// DashboardItemContent resource = Models.dashboardItemContent().query(adapterValue.id);
// Dhis2.dashboards().addDashboardContent(mDashboard, resource);
DashboardItemContent resource = Dhis2.dashboardItemContents().query(adapterValue.id);
Dhis2.dashboards().addDashboardContent(mDashboard, resource);

DhisService.getInstance().syncDashboards();
EventBusProvider.post(new UiEvent(UiEvent.UiEventType.SYNC_DASHBOARDS));
Expand Down Expand Up @@ -207,6 +207,12 @@ public void onLoaderReset(Loader<List<OptionAdapterValue>> loader) {
}
}

@Override
public void onDestroyView() {
super.onDestroyView();
ButterKnife.unbind(this);
}

private void queryApiResources() {
getLoaderManager().restartLoader(LOADER_ID, getArguments(), this);
}
Expand Down Expand Up @@ -258,15 +264,14 @@ public List<OptionAdapterValue> query(Context context) {
return new ArrayList<>();
}

/* List<DashboardItemContent> resources = Models.dashboardItemContent().query(mTypes);
List<DashboardItemContent> resources = Dhis2.dashboardItemContents().query(mTypes);
List<OptionAdapterValue> adapterValues = new ArrayList<>();
for (DashboardItemContent dashboardItemContent : resources) {
adapterValues.add(new OptionAdapterValue(dashboardItemContent.getUId(),
dashboardItemContent.getDisplayName()));
}

return adapterValues; */
return null;
return adapterValues;
}
}
}

0 comments on commit d6d122c

Please sign in to comment.