Skip to content

Commit

Permalink
Minor refactoring.
Browse files Browse the repository at this point in the history
  • Loading branch information
arazabishov committed Oct 1, 2015
1 parent b3f8544 commit ca690ab
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ private static class DashboardsQuery implements Query<Boolean> {

@Override
public Boolean query(Context context) {
List<Dashboard> dashboards = Dhis2.dashboards().query();
List<Dashboard> dashboards = Dhis2.dashboards().list();
return dashboards != null && dashboards.size() > 0;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -234,12 +234,13 @@ public List<DashboardItem> query(Context context) {
Dashboard dashboard = new Dashboard();
dashboard.setId(mDashboardId);

List<DashboardItem> dashboardItems = Dhis2.dashboardItems()
.filterByType(dashboard, DashboardItemContent.TYPE_MESSAGES);
/* List<DashboardItem> dashboardItems = Dhis2.dashboardItems()
.filterByType(dashboard, DashboardItemContent.TYPE_MESSAGES); */
List<DashboardItem> dashboardItems = Dhis2.dashboardItems().list();
if (dashboardItems != null && !dashboardItems.isEmpty()) {
for (DashboardItem dashboardItem : dashboardItems) {
List<DashboardElement> dashboardElements = Dhis2
.dashboardElements().query(dashboardItem);
.dashboardElements().list(dashboardItem);
dashboardItem.setDashboardElements(dashboardElements);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ public View onCreateView(LayoutInflater inflater, ViewGroup container,
@Override
public void onViewCreated(View view, Bundle savedInstanceState) {
long dashboardId = getArguments().getLong(DASHBOARD_ID);
mDashboard = Dhis2.dashboards().query(dashboardId);
mDashboard = Dhis2.dashboards().get(dashboardId);

ButterKnife.bind(this, view);

Expand Down Expand Up @@ -164,7 +164,7 @@ 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 = Dhis2.dashboardItemContents().query(adapterValue.id);
DashboardItemContent resource = Dhis2.dashboardItemContents().get(adapterValue.id);
Dhis2.dashboards().addDashboardContent(mDashboard, resource);

DhisService.getInstance().syncDashboards();
Expand Down Expand Up @@ -264,7 +264,7 @@ public List<OptionAdapterValue> query(Context context) {
return new ArrayList<>();
}

List<DashboardItemContent> resources = Dhis2.dashboardItemContents().query(mTypes);
List<DashboardItemContent> resources = Dhis2.dashboardItemContents().list(mTypes);
List<OptionAdapterValue> adapterValues = new ArrayList<>();
for (DashboardItemContent dashboardItemContent : resources) {
adapterValues.add(new OptionAdapterValue(dashboardItemContent.getUId(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle sa
@Override
public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
mDashboard = Dhis2.dashboards()
.query(getArguments().getLong(DASHBOARD_ID));
.get(getArguments().getLong(DASHBOARD_ID));

ButterKnife.bind(this, view);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ private static class DashboardQuery implements Query<List<Dashboard>> {

@Override
public List<Dashboard> query(Context context) {
List<Dashboard> dashboards = Dhis2.dashboards().query();
List<Dashboard> dashboards = Dhis2.dashboards().list();
Collections.sort(dashboards, Dashboard.DISPLAY_NAME_COMPARATOR);
return dashboards;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {

/* List<DashboardElement> elements = Models.dashboardElements()
.filter(mDashboardItem, State.TO_DELETE); */
List<DashboardElement> elements = Dhis2.dashboardElements().query(mDashboardItem);
List<DashboardElement> elements = Dhis2.dashboardElements().list(mDashboardItem);
mDashboardItem.setDashboardElements(elements);

mDialogLabel.setText(getString(R.string.create_interpretation));
Expand Down

0 comments on commit ca690ab

Please sign in to comment.