示例#1
0
 public void showSuggestions() {
   if (mAdapter != null
       && mAdapter.getItemCount() > 0
       && mSuggestionsRecyclerView.getVisibility() == GONE) {
     mSuggestionsRecyclerView.setVisibility(VISIBLE);
     mSeparatorView.setVisibility(VISIBLE);
   }
 }
 @Override
 public void onBackPressed() {
   if (mSearchView.isSearching()) {
     mSearchView.closeSearch();
   } else if (mRecyclerView.getVisibility() == View.VISIBLE) {
     mResultAdapter.clear();
     mRecyclerView.setVisibility(View.GONE);
   } else {
     super.onBackPressed();
   }
 }
示例#3
0
  public void onEventMainThread(MainActivity.BottomItemRefreshEvent event) {
    if (event.bottomIndex == 2
        && !refreshing
        && mListView != null
        && mListView.getVisibility() == View.VISIBLE) {
      swipeRefreshLayout.setRefreshing(true);

      mListView.post(
          new Runnable() {
            @Override
            public void run() {
              mListView.smoothScrollToPosition(0);
            }
          });
      mListView.postDelayed(
          new Runnable() {
            @Override
            public void run() {
              onRefresh();
            }
          },
          800);
    }
  }
示例#4
0
 public void dismissSuggestions() {
   if (mSuggestionsRecyclerView.getVisibility() == VISIBLE) {
     mSuggestionsRecyclerView.setVisibility(GONE);
     mSeparatorView.setVisibility(GONE);
   }
 }