|
@@ -99,8 +99,7 @@ public class ActSearchAppOrTask extends BaseActivity {
|
|
|
frame_container.postDelayed(autoSearchRunnable, delay);//1秒后自动搜索
|
|
frame_container.postDelayed(autoSearchRunnable, delay);//1秒后自动搜索
|
|
|
}
|
|
}
|
|
|
})
|
|
})
|
|
|
- .setRightBtn(this, "搜索", 0,
|
|
|
|
|
- v -> toSearchApp());
|
|
|
|
|
|
|
+ .setRightBtn(this, "搜索", 0, v -> toSearchApp());
|
|
|
|
|
|
|
|
recyclerView.setHasFixedSize(true);
|
|
recyclerView.setHasFixedSize(true);
|
|
|
recyclerView.setNestedScrollingEnabled(false);
|
|
recyclerView.setNestedScrollingEnabled(false);
|
|
@@ -109,12 +108,7 @@ public class ActSearchAppOrTask extends BaseActivity {
|
|
|
adpTitleInfoList.bindToRecyclerView(recyclerView);
|
|
adpTitleInfoList.bindToRecyclerView(recyclerView);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- private Runnable autoSearchRunnable = new Runnable() {
|
|
|
|
|
- @Override
|
|
|
|
|
- public void run() {
|
|
|
|
|
- toSearchApp();
|
|
|
|
|
- }
|
|
|
|
|
- };
|
|
|
|
|
|
|
+ private Runnable autoSearchRunnable = this::toSearchApp;
|
|
|
|
|
|
|
|
public static final int MAX_SHOW_SEARCH_RECORD_COUNT = 10;//最多展示的搜索历史的个数
|
|
public static final int MAX_SHOW_SEARCH_RECORD_COUNT = 10;//最多展示的搜索历史的个数
|
|
|
public static final int SORT_TOP_SEARCH = 1;//热门推荐 的排序
|
|
public static final int SORT_TOP_SEARCH = 1;//热门推荐 的排序
|
|
@@ -148,12 +142,7 @@ public class ActSearchAppOrTask extends BaseActivity {
|
|
|
List<TopSearchStatistics> newList = baseMessage.getDatas(TopSearchStatistics.class);
|
|
List<TopSearchStatistics> newList = baseMessage.getDatas(TopSearchStatistics.class);
|
|
|
topSearchStatisticsList.clear();
|
|
topSearchStatisticsList.clear();
|
|
|
topSearchStatisticsList.addAll(newList);
|
|
topSearchStatisticsList.addAll(newList);
|
|
|
- if (ListUtil.getItem(titleInfoListList, new ListUtil.CallBack<TitleInfoList, Boolean>() {
|
|
|
|
|
- @Override
|
|
|
|
|
- public Boolean call(TitleInfoList titleInfoList) {
|
|
|
|
|
- return titleInfoList.getSort() == SORT_TOP_SEARCH;
|
|
|
|
|
- }
|
|
|
|
|
- }) == null) {
|
|
|
|
|
|
|
+ if (ListUtil.getItem(titleInfoListList, titleInfoList -> titleInfoList.getSort() == SORT_TOP_SEARCH) == null) {
|
|
|
addListData("热门推荐", topSearchStatisticsList, SORT_TOP_SEARCH);
|
|
addListData("热门推荐", topSearchStatisticsList, SORT_TOP_SEARCH);
|
|
|
}
|
|
}
|
|
|
notifyDataSetChangedTitleInfoList();
|
|
notifyDataSetChangedTitleInfoList();
|
|
@@ -193,30 +182,24 @@ public class ActSearchAppOrTask extends BaseActivity {
|
|
|
ViewUtil.setText(item_search_record_name, item.getInput());
|
|
ViewUtil.setText(item_search_record_name, item.getInput());
|
|
|
if (item instanceof SearchRecord) {
|
|
if (item instanceof SearchRecord) {
|
|
|
//点击一条搜索历史后面的xx
|
|
//点击一条搜索历史后面的xx
|
|
|
- item_search_record_x.setOnClickListener(new View.OnClickListener() {
|
|
|
|
|
- @Override
|
|
|
|
|
- public void onClick(View view) {
|
|
|
|
|
- list.remove(item);
|
|
|
|
|
- ViewUtil.notifyDataSetChanged(recyclerView);
|
|
|
|
|
- DDProviderHelper.getInstance().deleteSearchRecord((SearchRecord) item);
|
|
|
|
|
- if (isTitleInfoListEmpty()) {
|
|
|
|
|
- frame_container.setVisibility(View.VISIBLE);
|
|
|
|
|
- recyclerView.setVisibility(View.INVISIBLE);
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ item_search_record_x.setOnClickListener(view12 -> {
|
|
|
|
|
+ list.remove(item);
|
|
|
|
|
+ ViewUtil.notifyDataSetChanged(recyclerView);
|
|
|
|
|
+ DDProviderHelper.getInstance().deleteSearchRecord((SearchRecord) item);
|
|
|
|
|
+ if (isTitleInfoListEmpty()) {
|
|
|
|
|
+ frame_container.setVisibility(View.VISIBLE);
|
|
|
|
|
+ recyclerView.setVisibility(View.INVISIBLE);
|
|
|
}
|
|
}
|
|
|
});
|
|
});
|
|
|
} else {
|
|
} else {
|
|
|
ViewUtil.setVisibility(item_search_record_x, false);
|
|
ViewUtil.setVisibility(item_search_record_x, false);
|
|
|
}
|
|
}
|
|
|
//点击一条搜索历史
|
|
//点击一条搜索历史
|
|
|
- view.setOnClickListener(new View.OnClickListener() {
|
|
|
|
|
- @Override
|
|
|
|
|
- public void onClick(View view) {
|
|
|
|
|
- textByClick = true;
|
|
|
|
|
- TitleBarUtils.getInstance().setSearchText(ActSearchAppOrTask.this, item.getInput());
|
|
|
|
|
- if (item instanceof IHomePageSearch)
|
|
|
|
|
- ApiUtil.postTopSearchStatisticsClickTopSearch((IHomePageSearch) item);
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ view.setOnClickListener(view1 -> {
|
|
|
|
|
+ textByClick = true;
|
|
|
|
|
+ TitleBarUtils.getInstance().setSearchText(ActSearchAppOrTask.this, item.getInput());
|
|
|
|
|
+ if (item instanceof IHomePageSearch)
|
|
|
|
|
+ ApiUtil.postTopSearchStatisticsClickTopSearch((IHomePageSearch) item);
|
|
|
});
|
|
});
|
|
|
}
|
|
}
|
|
|
}).setSort(sort));
|
|
}).setSort(sort));
|