@Override public void onFocusChange(View view, boolean hasFocus) { if (view instanceof SearchView) { if (!hasFocus) { ((TrackedEntityInstanceAdapter) 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; }
@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; } } }
@Override public boolean onMenuItemActionCollapse(MenuItem item) { ((TrackedEntityInstanceAdapter) mAdapter).getFilter().filter(""); // showing all rows return true; }