/** Close search view. */ public void closeSearch() { if (!isSearchOpen()) { return; } mSearchSrcTextView.setText(null); dismissSuggestions(); clearFocus(); mSearchLayout.setVisibility(GONE); if (mSearchViewListener != null) { mSearchViewListener.onSearchViewClosed(); } mIsSearchOpen = false; }
/** * Open Search View. if animate is true, Animate the showing of the view. * * @param animate */ public void showSearch(boolean animate) { if (isSearchOpen()) { return; } // Request Focus mSearchSrcTextView.setText(null); mSearchSrcTextView.requestFocus(); if (animate) { AnimationUtil.fadeInView( mSearchLayout, AnimationUtil.ANIMATION_DURATION_SHORT, new AnimationUtil.AnimationListener() { @Override public boolean onAnimationStart(View view) { return false; } @Override public boolean onAnimationEnd(View view) { if (mSearchViewListener != null) { mSearchViewListener.onSearchViewShown(); } return false; } @Override public boolean onAnimationCancel(View view) { return false; } }); } else { mSearchLayout.setVisibility(VISIBLE); if (mSearchViewListener != null) { mSearchViewListener.onSearchViewShown(); } } mIsSearchOpen = true; }