Search in sources :

Example 1 with BaselineGridTextView

use of io.plaidapp.ui.widget.BaselineGridTextView in project sbt-android by scala-android.

the class SearchActivity method setNoResultsVisibility.

private void setNoResultsVisibility(int visibility) {
    if (visibility == View.VISIBLE) {
        if (noResults == null) {
            noResults = (BaselineGridTextView) ((ViewStub) findViewById(R.id.stub_no_search_results)).inflate();
            noResults.setOnClickListener(new View.OnClickListener() {

                @Override
                public void onClick(View v) {
                    searchView.setQuery("", false);
                    searchView.requestFocus();
                    ImeUtils.showIme(searchView);
                }
            });
        }
        String message = String.format(getString(R.string.no_search_results), searchView.getQuery().toString());
        SpannableStringBuilder ssb = new SpannableStringBuilder(message);
        ssb.setSpan(new StyleSpan(Typeface.ITALIC), message.indexOf('“') + 1, message.length() - 1, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
        noResults.setText(ssb);
    }
    if (noResults != null) {
        noResults.setVisibility(visibility);
    }
}
Also used : ViewStub(android.view.ViewStub) StyleSpan(android.text.style.StyleSpan) View(android.view.View) SearchView(android.widget.SearchView) BaselineGridTextView(io.plaidapp.ui.widget.BaselineGridTextView) RecyclerView(android.support.v7.widget.RecyclerView) SpannableStringBuilder(android.text.SpannableStringBuilder)

Aggregations

RecyclerView (android.support.v7.widget.RecyclerView)1 SpannableStringBuilder (android.text.SpannableStringBuilder)1 StyleSpan (android.text.style.StyleSpan)1 View (android.view.View)1 ViewStub (android.view.ViewStub)1 SearchView (android.widget.SearchView)1 BaselineGridTextView (io.plaidapp.ui.widget.BaselineGridTextView)1