Java Code Examples for android.app.SearchManager#FLAG_QUERY_REFINEMENT

The following examples show how to use android.app.SearchManager#FLAG_QUERY_REFINEMENT . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SuggestionsAdapter.java    From android_9.0.0_r45 with Apache License 2.0 4 votes vote down vote up
@Override
public void bindView(View view, Context context, Cursor cursor) {
    ChildViewCache views = (ChildViewCache) view.getTag();

    int flags = 0;
    if (mFlagsCol != INVALID_INDEX) {
        flags = cursor.getInt(mFlagsCol);
    }
    if (views.mText1 != null) {
        String text1 = getStringOrNull(cursor, mText1Col);
        setViewText(views.mText1, text1);
    }
    if (views.mText2 != null) {
        // First check TEXT_2_URL
        CharSequence text2 = getStringOrNull(cursor, mText2UrlCol);
        if (text2 != null) {
            text2 = formatUrl(context, text2);
        } else {
            text2 = getStringOrNull(cursor, mText2Col);
        }

        // If no second line of text is indicated, allow the first line of text
        // to be up to two lines if it wants to be.
        if (TextUtils.isEmpty(text2)) {
            if (views.mText1 != null) {
                views.mText1.setSingleLine(false);
                views.mText1.setMaxLines(2);
            }
        } else {
            if (views.mText1 != null) {
                views.mText1.setSingleLine(true);
                views.mText1.setMaxLines(1);
            }
        }
        setViewText(views.mText2, text2);
    }

    if (views.mIcon1 != null) {
        setViewDrawable(views.mIcon1, getIcon1(cursor), View.INVISIBLE);
    }
    if (views.mIcon2 != null) {
        setViewDrawable(views.mIcon2, getIcon2(cursor), View.GONE);
    }
    if (mQueryRefinement == REFINE_ALL
            || (mQueryRefinement == REFINE_BY_ENTRY
                    && (flags & SearchManager.FLAG_QUERY_REFINEMENT) != 0)) {
        views.mIconRefine.setVisibility(View.VISIBLE);
        views.mIconRefine.setTag(views.mText1.getText());
        views.mIconRefine.setOnClickListener(this);
    } else {
        views.mIconRefine.setVisibility(View.GONE);
    }
}
 
Example 2
Source File: SuggestionsAdapter.java    From CSipSimple with GNU General Public License v3.0 4 votes vote down vote up
@Override
public void bindView(View view, Context context, Cursor cursor) {
    ChildViewCache views = (ChildViewCache) view.getTag();

    int flags = 0;
    if (mFlagsCol != INVALID_INDEX) {
        flags = cursor.getInt(mFlagsCol);
    }
    if (views.mText1 != null) {
        String text1 = getStringOrNull(cursor, mText1Col);
        setViewText(views.mText1, text1);
    }
    if (views.mText2 != null) {
        // First check TEXT_2_URL
        CharSequence text2 = getStringOrNull(cursor, mText2UrlCol);
        if (text2 != null) {
            text2 = formatUrl(text2);
        } else {
            text2 = getStringOrNull(cursor, mText2Col);
        }

        // If no second line of text is indicated, allow the first line of text
        // to be up to two lines if it wants to be.
        if (TextUtils.isEmpty(text2)) {
            if (views.mText1 != null) {
                views.mText1.setSingleLine(false);
                views.mText1.setMaxLines(2);
            }
        } else {
            if (views.mText1 != null) {
                views.mText1.setSingleLine(true);
                views.mText1.setMaxLines(1);
            }
        }
        setViewText(views.mText2, text2);
    }

    if (views.mIcon1 != null) {
        setViewDrawable(views.mIcon1, getIcon1(cursor), View.INVISIBLE);
    }
    if (views.mIcon2 != null) {
        setViewDrawable(views.mIcon2, getIcon2(cursor), View.GONE);
    }
    if (mQueryRefinement == REFINE_ALL
            || (mQueryRefinement == REFINE_BY_ENTRY
            && (flags & SearchManager.FLAG_QUERY_REFINEMENT) != 0)) {
        views.mIconRefine.setVisibility(View.VISIBLE);
        views.mIconRefine.setTag(views.mText1.getText());
        views.mIconRefine.setOnClickListener(this);
    } else {
        views.mIconRefine.setVisibility(View.GONE);
    }
}
 
Example 3
Source File: SuggestionsAdapter.java    From zen4android with MIT License 4 votes vote down vote up
@Override
public void bindView(View view, Context context, Cursor cursor) {
    ChildViewCache views = (ChildViewCache) view.getTag();

    int flags = 0;
    if (mFlagsCol != INVALID_INDEX) {
        flags = cursor.getInt(mFlagsCol);
    }
    if (views.mText1 != null) {
        String text1 = getStringOrNull(cursor, mText1Col);
        setViewText(views.mText1, text1);
    }
    if (views.mText2 != null) {
        // First check TEXT_2_URL
        CharSequence text2 = getStringOrNull(cursor, mText2UrlCol);
        if (text2 != null) {
            text2 = formatUrl(text2);
        } else {
            text2 = getStringOrNull(cursor, mText2Col);
        }

        // If no second line of text is indicated, allow the first line of text
        // to be up to two lines if it wants to be.
        if (TextUtils.isEmpty(text2)) {
            if (views.mText1 != null) {
                views.mText1.setSingleLine(false);
                views.mText1.setMaxLines(2);
            }
        } else {
            if (views.mText1 != null) {
                views.mText1.setSingleLine(true);
                views.mText1.setMaxLines(1);
            }
        }
        setViewText(views.mText2, text2);
    }

    if (views.mIcon1 != null) {
        setViewDrawable(views.mIcon1, getIcon1(cursor), View.INVISIBLE);
    }
    if (views.mIcon2 != null) {
        setViewDrawable(views.mIcon2, getIcon2(cursor), View.GONE);
    }
    if (mQueryRefinement == REFINE_ALL
            || (mQueryRefinement == REFINE_BY_ENTRY
            && (flags & SearchManager.FLAG_QUERY_REFINEMENT) != 0)) {
        views.mIconRefine.setVisibility(View.VISIBLE);
        views.mIconRefine.setTag(views.mText1.getText());
        views.mIconRefine.setOnClickListener(this);
    } else {
        views.mIconRefine.setVisibility(View.GONE);
    }
}
 
Example 4
Source File: SuggestionsAdapter.java    From zhangshangwuda with Apache License 2.0 4 votes vote down vote up
@Override
public void bindView(View view, Context context, Cursor cursor) {
    ChildViewCache views = (ChildViewCache) view.getTag();

    int flags = 0;
    if (mFlagsCol != INVALID_INDEX) {
        flags = cursor.getInt(mFlagsCol);
    }
    if (views.mText1 != null) {
        String text1 = getStringOrNull(cursor, mText1Col);
        setViewText(views.mText1, text1);
    }
    if (views.mText2 != null) {
        // First check TEXT_2_URL
        CharSequence text2 = getStringOrNull(cursor, mText2UrlCol);
        if (text2 != null) {
            text2 = formatUrl(text2);
        } else {
            text2 = getStringOrNull(cursor, mText2Col);
        }

        // If no second line of text is indicated, allow the first line of text
        // to be up to two lines if it wants to be.
        if (TextUtils.isEmpty(text2)) {
            if (views.mText1 != null) {
                views.mText1.setSingleLine(false);
                views.mText1.setMaxLines(2);
            }
        } else {
            if (views.mText1 != null) {
                views.mText1.setSingleLine(true);
                views.mText1.setMaxLines(1);
            }
        }
        setViewText(views.mText2, text2);
    }

    if (views.mIcon1 != null) {
        setViewDrawable(views.mIcon1, getIcon1(cursor), View.INVISIBLE);
    }
    if (views.mIcon2 != null) {
        setViewDrawable(views.mIcon2, getIcon2(cursor), View.GONE);
    }
    if (mQueryRefinement == REFINE_ALL
            || (mQueryRefinement == REFINE_BY_ENTRY
            && (flags & SearchManager.FLAG_QUERY_REFINEMENT) != 0)) {
        views.mIconRefine.setVisibility(View.VISIBLE);
        views.mIconRefine.setTag(views.mText1.getText());
        views.mIconRefine.setOnClickListener(this);
    } else {
        views.mIconRefine.setVisibility(View.GONE);
    }
}
 
Example 5
Source File: SuggestionsAdapter.java    From Libraries-for-Android-Developers with MIT License 4 votes vote down vote up
@Override
public void bindView(View view, Context context, Cursor cursor) {
    ChildViewCache views = (ChildViewCache) view.getTag();

    int flags = 0;
    if (mFlagsCol != INVALID_INDEX) {
        flags = cursor.getInt(mFlagsCol);
    }
    if (views.mText1 != null) {
        String text1 = getStringOrNull(cursor, mText1Col);
        setViewText(views.mText1, text1);
    }
    if (views.mText2 != null) {
        // First check TEXT_2_URL
        CharSequence text2 = getStringOrNull(cursor, mText2UrlCol);
        if (text2 != null) {
            text2 = formatUrl(text2);
        } else {
            text2 = getStringOrNull(cursor, mText2Col);
        }

        // If no second line of text is indicated, allow the first line of text
        // to be up to two lines if it wants to be.
        if (TextUtils.isEmpty(text2)) {
            if (views.mText1 != null) {
                views.mText1.setSingleLine(false);
                views.mText1.setMaxLines(2);
            }
        } else {
            if (views.mText1 != null) {
                views.mText1.setSingleLine(true);
                views.mText1.setMaxLines(1);
            }
        }
        setViewText(views.mText2, text2);
    }

    if (views.mIcon1 != null) {
        setViewDrawable(views.mIcon1, getIcon1(cursor), View.INVISIBLE);
    }
    if (views.mIcon2 != null) {
        setViewDrawable(views.mIcon2, getIcon2(cursor), View.GONE);
    }
    if (mQueryRefinement == REFINE_ALL
            || (mQueryRefinement == REFINE_BY_ENTRY
            && (flags & SearchManager.FLAG_QUERY_REFINEMENT) != 0)) {
        views.mIconRefine.setVisibility(View.VISIBLE);
        views.mIconRefine.setTag(views.mText1.getText());
        views.mIconRefine.setOnClickListener(this);
    } else {
        views.mIconRefine.setVisibility(View.GONE);
    }
}