本文整理汇总了Java中com.arlib.floatingsearchview.suggestions.model.SearchSuggestion类的典型用法代码示例。如果您正苦于以下问题:Java SearchSuggestion类的具体用法?Java SearchSuggestion怎么用?Java SearchSuggestion使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
SearchSuggestion类属于com.arlib.floatingsearchview.suggestions.model包,在下文中一共展示了SearchSuggestion类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onBindViewHolder
import com.arlib.floatingsearchview.suggestions.model.SearchSuggestion; //导入依赖的package包/类
@Override
public void onBindViewHolder(RecyclerView.ViewHolder vh, int position) {
SearchSuggestionViewHolder viewHolder = (SearchSuggestionViewHolder) vh;
if (!mShowRightMoveUpBtn) {
viewHolder.rightIcon.setEnabled(false);
viewHolder.rightIcon.setVisibility(View.INVISIBLE);
} else {
viewHolder.rightIcon.setEnabled(true);
viewHolder.rightIcon.setVisibility(View.VISIBLE);
}
SearchSuggestion suggestionItem = mSearchSuggestions.get(position);
viewHolder.body.setText(suggestionItem.getBody());
if (mOnBindSuggestionCallback != null) {
mOnBindSuggestionCallback.onBindSuggestion(viewHolder.itemView, viewHolder.leftIcon, viewHolder.body,
suggestionItem, position);
}
}
示例2: swapSuggestions
import com.arlib.floatingsearchview.suggestions.model.SearchSuggestion; //导入依赖的package包/类
private void swapSuggestions(final List<? extends SearchSuggestion> newSearchSuggestions,
final boolean withAnim) {
mSuggestionsList.getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {
@Override
public void onGlobalLayout() {
Util.removeGlobalLayoutObserver(mSuggestionsList, this);
boolean isSuggestionItemsFillRecyclerView = updateSuggestionsSectionHeight(newSearchSuggestions, withAnim);
//we only need to employ the reverse layout technique if the items don't fill up the RecyclerView
LinearLayoutManager suggestionsListLm = (LinearLayoutManager) mSuggestionsList.getLayoutManager();
if (isSuggestionItemsFillRecyclerView) {
suggestionsListLm.setReverseLayout(false);
} else {
mSuggestionsAdapter.reverseList();
suggestionsListLm.setReverseLayout(true);
}
mSuggestionsList.setAlpha(1);
}
});
mSuggestionsList.setAdapter(mSuggestionsAdapter);//workaround to avoid list retaining scroll pos
mSuggestionsList.setAlpha(0);
mSuggestionsAdapter.swapData(newSearchSuggestions);
mDivider.setVisibility(!newSearchSuggestions.isEmpty() ? View.VISIBLE : View.GONE);
}
示例3: swapSuggestions
import com.arlib.floatingsearchview.suggestions.model.SearchSuggestion; //导入依赖的package包/类
private void swapSuggestions(final List<? extends SearchSuggestion> newSearchSuggestions,
final boolean withAnim) {
mSuggestionsList.getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {
@Override
public void onGlobalLayout() {
Util.removeGlobalLayoutObserver(mSuggestionsList, this);
updateSuggestionsSectionHeight(newSearchSuggestions, withAnim);
}
});
mSuggestionsAdapter.swapData(newSearchSuggestions);
mDivider.setVisibility(!newSearchSuggestions.isEmpty() ? View.VISIBLE : View.GONE);
}
示例4: getVisibleItemsHeight
import com.arlib.floatingsearchview.suggestions.model.SearchSuggestion; //导入依赖的package包/类
private int getVisibleItemsHeight(List<? extends SearchSuggestion> suggestions) {
int visibleItemsHeight = 0;
for (int i = 0; i < suggestions.size() && i < mSuggestionsList.getChildCount(); i++) {
visibleItemsHeight += mSuggestionsList.getChildAt(i).getHeight();
if (visibleItemsHeight > mSuggestionListContainer.getHeight()) {
visibleItemsHeight = mSuggestionListContainer.getHeight();
break;
}
}
return visibleItemsHeight;
}
示例5: onBindViewHolder
import com.arlib.floatingsearchview.suggestions.model.SearchSuggestion; //导入依赖的package包/类
@Override
public void onBindViewHolder(RecyclerView.ViewHolder vh, int position) {
SearchSuggestionViewHolder viewHolder = (SearchSuggestionViewHolder) vh;
if (!mShowRightMoveUpBtn) {
viewHolder.rightIcon.setEnabled(false);
viewHolder.rightIcon.setVisibility(View.INVISIBLE);
} else {
viewHolder.rightIcon.setEnabled(true);
viewHolder.rightIcon.setVisibility(View.VISIBLE);
}
SearchSuggestion suggestionItem = mSearchSuggestions.get(position);
viewHolder.body.setText(suggestionItem.getBody());
if(mTextColor != -1){
viewHolder.body.setTextColor(mTextColor);
}
if(mRightIconColor != -1){
Util.setIconColor(viewHolder.rightIcon, mRightIconColor);
}
if (mOnBindSuggestionCallback != null) {
mOnBindSuggestionCallback.onBindSuggestion(viewHolder.itemView, viewHolder.leftIcon, viewHolder.body,
suggestionItem, position);
}
}
示例6: calculateSuggestionItemsHeight
import com.arlib.floatingsearchview.suggestions.model.SearchSuggestion; //导入依赖的package包/类
private int calculateSuggestionItemsHeight(List<? extends SearchSuggestion> suggestions, int max) {
//todo
// 'i < suggestions.size()' in the below 'for' seems unneeded, investigate if there is a use for it.
int visibleItemsHeight = 0;
for (int i = 0; i < suggestions.size() && i < mSuggestionsList.getChildCount(); i++) {
visibleItemsHeight += mSuggestionsList.getChildAt(i).getHeight();
if (visibleItemsHeight > max) {
visibleItemsHeight = max;
break;
}
}
return visibleItemsHeight;
}
示例7: initEvent
import com.arlib.floatingsearchview.suggestions.model.SearchSuggestion; //导入依赖的package包/类
/**
* set listeners
*/
private void initEvent() {
// refresh listener
bind.vContent.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
@Override
public void onRefresh() {
loadData(true);
}
});
// load more listener
searchAdapter.setOnLoadMoreListener(new BaseQuickAdapter.RequestLoadMoreListener() {
@Override
public void onLoadMoreRequested() {
bind.rv.post(new Runnable() {
@Override
public void run() {
loadMore();
}
});
}
});
// item click listener
bind.rv.addOnItemTouchListener(new OnItemClickListener() {
@Override
public void SimpleOnItemClick(BaseQuickAdapter baseQuickAdapter, View view, int i) {
// get item url
ProjectBean project = (ProjectBean) baseQuickAdapter.getItem(i);
// start detail activity
Intent intent = new Intent(SearchActivity.this, DetailActivity.class);
intent.putExtra(DetailActivity.EXTRA_URL, project.url);
intent.putExtra(DetailActivity.EXTRA_TITLE, project.title);
intent.putExtra(DetailActivity.EXTRA_DESCRIPTION, project.description);
startActivity(intent);
}
});
// search listener
bind.fsv.setOnSearchListener(new FloatingSearchView.OnSearchListener() {
@Override
public void onSuggestionClicked(SearchSuggestion searchSuggestion) {
}
@Override
public void onSearchAction(String currentQuery) {
if (!TextUtils.isEmpty(currentQuery)) {
presenter.setSearchString(currentQuery);
loadData(false);
}
}
});
}
示例8: onCreate
import com.arlib.floatingsearchview.suggestions.model.SearchSuggestion; //导入依赖的package包/类
@Override protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_timeline);
if (savedInstanceState == null) {
getSupportFragmentManager().beginTransaction()
.replace(R.id.content, TimelineFragment.newInstance())
.commit();
}
searchView = (FloatingSearchView) findViewById(R.id.floating_search_view);
searchView.setOnLeftMenuClickListener(new FloatingSearchView.OnLeftMenuClickListener() {
@Override public void onMenuOpened() {
}
@Override public void onMenuClosed() {
}
});
searchView.setOnMenuItemClickListener(new FloatingSearchView.OnMenuItemClickListener() {
@Override public void onActionMenuItemSelected(MenuItem item) {
Log.d(TAG, "onActionMenuItemSelected() called with: " + "item = [" + item + "]");
if (item.getItemId() == R.id.action_search) {
searchView.clearQuery();
searchView.setSearchText(QUERIES[(int) (QUERIES.length * Math.random())]);
}
}
});
searchView.setOnSearchListener(new FloatingSearchView.OnSearchListener() {
@Override public void onSuggestionClicked(SearchSuggestion searchSuggestion) {
Log.d(TAG, "onSuggestionClicked() called with: "
+ "searchSuggestion = ["
+ searchSuggestion
+ "]");
}
@Override public void onSearchAction(String currentQuery) {
hideIme(searchView);
SearchBottomSheetFragment searchFragment =
SearchBottomSheetFragment.newInstance(currentQuery);
searchFragment.show(getSupportFragmentManager(), SearchBottomSheetFragment.TAG);
}
});
}
示例9: onBindSuggestion
import com.arlib.floatingsearchview.suggestions.model.SearchSuggestion; //导入依赖的package包/类
void onBindSuggestion(View suggestionView, ImageView leftIcon, TextView textView,
SearchSuggestion item, int itemPosition);
示例10: swapData
import com.arlib.floatingsearchview.suggestions.model.SearchSuggestion; //导入依赖的package包/类
public void swapData(List<? extends SearchSuggestion> searchSuggestions) {
mSearchSuggestions.clear();
mSearchSuggestions.addAll(searchSuggestions);
notifyDataSetChanged();
}
示例11: getDataSet
import com.arlib.floatingsearchview.suggestions.model.SearchSuggestion; //导入依赖的package包/类
public List<? extends SearchSuggestion> getDataSet() {
return mSearchSuggestions;
}
示例12: swapData
import com.arlib.floatingsearchview.suggestions.model.SearchSuggestion; //导入依赖的package包/类
public void swapData(List<? extends SearchSuggestion> searchSuggestions) {
mSearchSuggestions = searchSuggestions;
notifyDataSetChanged();
}
示例13: onSuggestionClicked
import com.arlib.floatingsearchview.suggestions.model.SearchSuggestion; //导入依赖的package包/类
/**
* Called when a suggestion was clicked indicating
* that the current search has completed.
*
* @param searchSuggestion
*/
void onSuggestionClicked(SearchSuggestion searchSuggestion);
示例14: clearSuggestions
import com.arlib.floatingsearchview.suggestions.model.SearchSuggestion; //导入依赖的package包/类
/**
* Collapses the suggestions list and
* then clears its suggestion items.
*/
public void clearSuggestions() {
swapSuggestions(new ArrayList<SearchSuggestion>());
}
示例15: onItemSelected
import com.arlib.floatingsearchview.suggestions.model.SearchSuggestion; //导入依赖的package包/类
void onItemSelected(SearchSuggestion item);