private void setFocusSortColumn(int column) { TrackedEntityInstanceAdapter teiAdapter = (TrackedEntityInstanceAdapter) mAdapter; View view = mForm.getColumnNames().getView(); switch (column) { // todo put UI stuff inside here when list is sorted either ascending or descending case 1: // first column { if (teiAdapter.getFilteredColumn() == column) { } else if (teiAdapter.isListIsReversed(column)) { } break; } case 2: // second column { break; } case 3: // third column { break; } case 4: // status column { break; } } }
@Override public void onLoadFinished( Loader<List<TrackedEntityInstanceRow>> loader, List<TrackedEntityInstanceRow> data) { if (LOADER_ID == loader.getId()) { mProgressBar.setVisibility(View.GONE); mAdapter.setData(data); mAdapter.swapData(data); } }
@Override public void onFocusChange(View view, boolean hasFocus) { if (view instanceof SearchView) { if (!hasFocus) { mAdapter.getFilter().filter(""); // show all rows } } }
@Override public boolean onQueryTextChange(String newText) { Log.d(TAG, newText); ((TrackedEntityInstanceAdapter) mAdapter) .getFilter() .filter(TrackedEntityInstanceAdapter.FILTER_SEARCH + newText); return true; }
@Override public void onLoadFinished( Loader<SelectProgramFragmentForm> loader, SelectProgramFragmentForm data) { if (LOADER_ID == loader.getId()) { mProgressBar.setVisibility(View.GONE); mForm = data; ((TrackedEntityInstanceAdapter) mAdapter).setData(data.getEventRowList()); mAdapter.swapData(data.getEventRowList()); } }
private void handleViews(int level) { mAdapter.swapData(null); switch (level) { case 0: mRegisterEventButton.hide(); mUpcomingEventsButton.hide(); break; case 1: mRegisterEventButton.show(); mUpcomingEventsButton.show(); } }
@Subscribe public void onItemClick(OnTrackedEntityInstanceColumnClick eventClick) { Log.d(TAG, "COLUMN CLICKED : " + eventClick.getColumnClicked()); switch (eventClick.getColumnClicked()) { case OnTrackedEntityInstanceColumnClick.FIRST_COLUMN: { Log.d(TAG, "Filter column " + TrackedEntityInstanceAdapter.FILTER_FIRST_COLUMN); ((TrackedEntityInstanceAdapter) mAdapter) .getFilter() .filter(TrackedEntityInstanceAdapter.FILTER_FIRST_COLUMN + ""); setFocusSortColumn(1); break; } case OnTrackedEntityInstanceColumnClick.SECOND_COLUMN: { Log.d(TAG, "Filter column " + TrackedEntityInstanceAdapter.FILTER_SECOND_COLUMN); ((TrackedEntityInstanceAdapter) mAdapter) .getFilter() .filter(TrackedEntityInstanceAdapter.FILTER_SECOND_COLUMN + ""); break; } case OnTrackedEntityInstanceColumnClick.THIRD_COLUMN: { Log.d(TAG, "Filter column " + TrackedEntityInstanceAdapter.FILTER_THIRD_COLUMN); ((TrackedEntityInstanceAdapter) mAdapter) .getFilter() .filter(TrackedEntityInstanceAdapter.FILTER_THIRD_COLUMN + ""); break; } case OnTrackedEntityInstanceColumnClick.STATUS_COLUMN: { Log.d(TAG, "Filter column " + TrackedEntityInstanceAdapter.FILTER_STATUS); ((TrackedEntityInstanceAdapter) mAdapter) .getFilter() .filter(TrackedEntityInstanceAdapter.FILTER_STATUS + ""); break; } } }
@Subscribe public void onItemClick(OnTrackedEntityColumnClick eventClick) { Log.d(TAG, "COLUMN CLICKED : " + eventClick.getColumnClicked()); switch (eventClick.getColumnClicked()) { case OnTrackedEntityColumnClick.FIRST_COLUMN: { } case OnTrackedEntityColumnClick.SECOND_COLUMN: { } case OnTrackedEntityColumnClick.THIRD_COLUMN: { } case OnTrackedEntityColumnClick.STATUS_COLUMN: { mAdapter.getFilter().filter(TrackedEntityInstanceAdapter.FILTER_STATUS + ""); } } }
@Override public boolean onMenuItemActionCollapse(MenuItem item) { // mAdapter.getFilter().filter(""); // showing all rows return true; }
@Override public void onLoaderReset(Loader<List<TrackedEntityInstanceRow>> loader) { mAdapter.swapData(null); }
@Override public boolean onMenuItemActionCollapse(MenuItem item) { ((TrackedEntityInstanceAdapter) mAdapter).getFilter().filter(""); // showing all rows return true; }