修改测试问题,shouye ytuijian
This commit is contained in:
parent
2b5d3b51f4
commit
e96d0e7bf4
@ -368,7 +368,6 @@ public class MainActivity extends AbsActivity implements MainAppBarLayoutListene
|
||||
mViewPager.setCurrentItem(0);
|
||||
mTabButtonGroup.setCurPosition(0);
|
||||
isInstructor();
|
||||
initAnchorRecommendBanner();
|
||||
findViewById(R.id.banner_click).setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
@ -406,6 +405,7 @@ public class MainActivity extends AbsActivity implements MainAppBarLayoutListene
|
||||
if (index==0){
|
||||
floatBanner.setVisibility(View.VISIBLE);
|
||||
findViewById(R.id.banner_click).setVisibility(View.VISIBLE);
|
||||
initAnchorRecommendBanner();
|
||||
}else {
|
||||
floatBanner.setVisibility(View.GONE);
|
||||
findViewById(R.id.banner_click).setVisibility(View.GONE);
|
||||
@ -675,7 +675,7 @@ public class MainActivity extends AbsActivity implements MainAppBarLayoutListene
|
||||
//获取指导员引导逻辑
|
||||
NoviceInstructorManager.get(mContext).getNoviceInstructor();
|
||||
NoviceInstructorManager.get(mContext).checktHomeZdyPop();
|
||||
|
||||
initAnchorRecommendBanner();
|
||||
|
||||
}
|
||||
|
||||
|
@ -25,6 +25,7 @@ public class SearchResultsAdapter extends RecyclerView.Adapter {
|
||||
private List<SearchModel> searchModels = new ArrayList<>();
|
||||
private int type = -1;
|
||||
private Context context;
|
||||
private String searchKey;
|
||||
|
||||
public SearchResultsAdapter(Context context) {
|
||||
this.context = context;
|
||||
@ -42,7 +43,7 @@ public class SearchResultsAdapter extends RecyclerView.Adapter {
|
||||
//展示网络请求弹窗
|
||||
|
||||
SearchResultsViewHolder resultsViewHolder = (SearchResultsViewHolder) holder;
|
||||
resultsViewHolder.showData(searchModels.get(position), type);
|
||||
resultsViewHolder.showData(searchModels.get(position), type,searchKey);
|
||||
resultsViewHolder.setCallback(new SearchResultsViewHolder.SearchResultsCallback() {
|
||||
@Override
|
||||
public void focusOn(SearchModel model) {
|
||||
@ -82,7 +83,8 @@ public class SearchResultsAdapter extends RecyclerView.Adapter {
|
||||
*
|
||||
* @param models
|
||||
*/
|
||||
public void putData(List<SearchModel> models, int type) {
|
||||
public void putData(List<SearchModel> models, int type, String searchKey) {
|
||||
this.searchKey = searchKey;
|
||||
this.type = type;
|
||||
searchModels.clear();
|
||||
searchModels.addAll(models);
|
||||
|
@ -24,6 +24,7 @@ public class SearchResultsItemAdapter extends RecyclerView.Adapter {
|
||||
private int type = -1;
|
||||
//确定是不是全部展示列表
|
||||
private boolean isAll = true;
|
||||
private String searchKey = "";
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
@ -42,13 +43,13 @@ public class SearchResultsItemAdapter extends RecyclerView.Adapter {
|
||||
public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, int position) {
|
||||
if (holder instanceof AnchorSearchResultsItemViewHolder) {
|
||||
AnchorSearchResultsItemViewHolder itemViewHolder = (AnchorSearchResultsItemViewHolder) holder;
|
||||
itemViewHolder.showAnchors(lists.get(position), ANCHOR);
|
||||
itemViewHolder.showAnchors(lists.get(position), ANCHOR,searchKey);
|
||||
if (type != 1 && !isAll) {
|
||||
itemViewHolder.hideTypeTitle();
|
||||
}
|
||||
} else {
|
||||
UserSearchResultsItemViewHolder viewHolder = (UserSearchResultsItemViewHolder) holder;
|
||||
viewHolder.showAnchors(lists.get(position), USER);
|
||||
viewHolder.showAnchors(lists.get(position), USER,searchKey);
|
||||
if (type != 1 && !isAll) {
|
||||
viewHolder.hideTypeTitle();
|
||||
}
|
||||
@ -78,7 +79,8 @@ public class SearchResultsItemAdapter extends RecyclerView.Adapter {
|
||||
* @param mLists 數據源
|
||||
* @param type
|
||||
*/
|
||||
public void showData(List<List<SearchModel>> mLists, int type) {
|
||||
public void showData(List<List<SearchModel>> mLists, int type,String searchKey) {
|
||||
this.searchKey = searchKey;
|
||||
this.type = type;
|
||||
//展示全部列表在只展示用户或者主播的一个判断,服务器在查全部的时候会返回两个集合没数据也会展示一个空集合
|
||||
if (mLists.size() > 1) {
|
||||
@ -104,7 +106,8 @@ public class SearchResultsItemAdapter extends RecyclerView.Adapter {
|
||||
/**
|
||||
* 加载更多资源
|
||||
*/
|
||||
public void onLoadMoreData(List<List<SearchModel>> mLists) {
|
||||
public void onLoadMoreData(List<List<SearchModel>> mLists,String searchKey) {
|
||||
this.searchKey = searchKey;
|
||||
lists.addAll(mLists);
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
|
@ -83,9 +83,9 @@ public class SearchResultsItemFragment extends BaseFragment {
|
||||
public void onSuccess(List<List<SearchModel>> data) {
|
||||
fragment.dismiss();
|
||||
if (page > 1) {
|
||||
itemAdapter.onLoadMoreData(data);
|
||||
itemAdapter.onLoadMoreData(data,searchKey);
|
||||
} else {
|
||||
itemAdapter.showData(data, type);
|
||||
itemAdapter.showData(data, type,searchKey);
|
||||
}
|
||||
}
|
||||
|
||||
@ -109,9 +109,9 @@ public class SearchResultsItemFragment extends BaseFragment {
|
||||
List<List<SearchModel>> listList = new ArrayList<>();
|
||||
listList.add(data);
|
||||
if (page > 1) {
|
||||
itemAdapter.onLoadMoreData(listList);
|
||||
itemAdapter.onLoadMoreData(listList,searchKey);
|
||||
} else {
|
||||
itemAdapter.showData(listList, type);
|
||||
itemAdapter.showData(listList, type,searchKey);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -39,12 +39,12 @@ public class AnchorSearchResultsItemViewHolder extends RecyclerView.ViewHolder {
|
||||
});
|
||||
}
|
||||
|
||||
public void showAnchors(List<SearchModel> searchModels, int type) {
|
||||
public void showAnchors(List<SearchModel> searchModels, int type, String searchKey) {
|
||||
this.searchModels = searchModels;
|
||||
resultsAdapter = new SearchResultsAdapter(itemView.getContext());
|
||||
anchorList.setLayoutManager(new LinearLayoutManager(itemView.getContext(), LinearLayoutManager.VERTICAL, false));
|
||||
anchorList.setAdapter(resultsAdapter);
|
||||
resultsAdapter.putData(searchModels, type);
|
||||
resultsAdapter.putData(searchModels, type,searchKey );
|
||||
}
|
||||
|
||||
public void hideTypeTitle() {
|
||||
|
@ -71,7 +71,7 @@ public class FloatBannerView extends FrameLayout {
|
||||
*/
|
||||
public void showBanner(List<AnchorRecommendItemModel> mList) {
|
||||
list.clear();
|
||||
list.addAll(mList);
|
||||
list.addAll(mList);release();
|
||||
bannerHandler.post(mFlipRunnable);
|
||||
|
||||
}
|
||||
|
@ -1,5 +1,7 @@
|
||||
package com.yunbao.main.views;
|
||||
|
||||
import android.text.Html;
|
||||
import android.text.Spanned;
|
||||
import android.text.TextUtils;
|
||||
import android.view.View;
|
||||
import android.widget.ImageView;
|
||||
@ -25,6 +27,7 @@ public class SearchResultsViewHolder extends RecyclerView.ViewHolder {
|
||||
private RelativeLayout avatarLayout;
|
||||
private SearchModel model;
|
||||
private SearchResultsCallback callback;
|
||||
private String searchKey = "";
|
||||
|
||||
public SearchResultsViewHolder setCallback(SearchResultsCallback callback) {
|
||||
this.callback = callback;
|
||||
@ -51,7 +54,7 @@ public class SearchResultsViewHolder extends RecyclerView.ViewHolder {
|
||||
});
|
||||
}
|
||||
|
||||
public void showData(SearchModel model, int type) {
|
||||
public void showData(SearchModel model, int type, String searchKey) {
|
||||
this.model = model;
|
||||
ImgLoader.displayAvatar(itemView.getContext(), model.getAvatar(), avatar);
|
||||
//用戶直接隱藏
|
||||
@ -66,7 +69,7 @@ public class SearchResultsViewHolder extends RecyclerView.ViewHolder {
|
||||
if (anchorLevelBean != null) {
|
||||
ImgLoader.display(isLive.getContext(), CommonAppConfig.getInstance().HOST + anchorLevelBean.getThumb(), contribute);
|
||||
}
|
||||
isLive.setVisibility(model.getIslive() == 0 ? View.VISIBLE : View.GONE);
|
||||
isLive.setVisibility(model.getIslive() == 0 ? View.GONE : View.VISIBLE);
|
||||
}
|
||||
|
||||
if (model.getSex() == 2) {
|
||||
@ -74,7 +77,7 @@ public class SearchResultsViewHolder extends RecyclerView.ViewHolder {
|
||||
} else {
|
||||
ImgLoader.displayAvatar(itemView.getContext(), R.mipmap.icon_sex_male_1, sex);
|
||||
}
|
||||
nickName.setText(model.getUserNicename());
|
||||
nickName.setText(userNicenamehighlight(model.getUserNicename(),searchKey));
|
||||
focusOn.setVisibility(TextUtils.equals(model.getIsattention(), "1") ? View.GONE : View.VISIBLE);
|
||||
}
|
||||
|
||||
@ -91,4 +94,12 @@ public class SearchResultsViewHolder extends RecyclerView.ViewHolder {
|
||||
public interface SearchResultsCallback {
|
||||
void focusOn(SearchModel model);
|
||||
}
|
||||
|
||||
private Spanned userNicenamehighlight(String context, String keyword) {
|
||||
String keywordHtml = "</font><font color='#FF8D41'size='42px'>" + keyword + "</font><font color='#161616'size='42px'>";
|
||||
String contextHtml = "<font color='#161616'size='42px'>" + context + "</font>";
|
||||
contextHtml = contextHtml.replace(keyword, keywordHtml);
|
||||
return Html.fromHtml(contextHtml);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -38,11 +38,11 @@ public class UserSearchResultsItemViewHolder extends RecyclerView.ViewHolder {
|
||||
});
|
||||
}
|
||||
|
||||
public void showAnchors(List<SearchModel> searchModels, int type) {
|
||||
public void showAnchors(List<SearchModel> searchModels, int type, String searchKey) {
|
||||
resultsAdapter = new SearchResultsAdapter(itemView.getContext());
|
||||
anchorList.setLayoutManager(new LinearLayoutManager(itemView.getContext(), LinearLayoutManager.VERTICAL, false));
|
||||
anchorList.setAdapter(resultsAdapter);
|
||||
resultsAdapter.putData(searchModels, type);
|
||||
resultsAdapter.putData(searchModels, type,searchKey);
|
||||
//滾動到頂部
|
||||
anchorList.smoothScrollToPosition(0);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user