@Override public void onEvent(Event event) { if (model.getIsSearchShowing()) { searchView.setVisibility(View.VISIBLE); } else { searchView.setVisibility(View.GONE); } }
/** Find our references to the objects in the XML layout */ @Override protected void onFinishInflate() { super.onFinishInflate(); listView = (PullToRefreshListView) findViewById(R.id.pull_to_refresh_listview); listView.setOnRefreshListener( new OnRefreshListener<ListView>() { @Override public void onRefresh(PullToRefreshBase<ListView> refreshView) { viewListener.onListViewRefresh(); } }); listView.setMode(Mode.BOTH); model.addListener(ApplicationsModel.ChangeEvent.LIST_REFRESH_COMPLETE, refreshListener); model.addListener(ApplicationsModel.ChangeEvent.SEARCH_DIALOG_CHANGE, searchViewChangeListener); LinearLayout emptyLayout = (LinearLayout) View.inflate(getContext(), R.layout.empty, null); mEmptyView = (TextView) emptyLayout.findViewById(android.R.id.empty); listView.setEmptyView(emptyLayout); searchView = (TextView) findViewById(R.id.inputSearchApps); }
public void destroy() { model.removeListener(ApplicationsModel.ChangeEvent.LIST_REFRESH_COMPLETE, refreshListener); model.removeListener( ApplicationsModel.ChangeEvent.SEARCH_DIALOG_CHANGE, searchViewChangeListener); }
public ApplicationsView(Context context, AttributeSet attrs) { super(context, attrs); model = ApplicationsModel.getInstance(); }