Skip to content

Commit ce24c4c

Browse files
author
ghui
committedNov 28, 2021
change sort mode to time
1 parent d1bd910 commit ce24c4c

File tree

5 files changed

+15
-3
lines changed

5 files changed

+15
-3
lines changed
 

‎app/src/main/java/me/ghui/v2er/injector/module/SearchModule.java

+2
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@ public LoadMoreRecyclerView.Adapter<SoV2EXSearchResultInfo.Hit> provideAdapter()
3636
@Override
3737
protected void convert(ViewHolder holder, SoV2EXSearchResultInfo.Hit hit, int position) {
3838
holder.setText(R.id.search_result_title_tv, hit.getSource().getTitle());
39+
String footnote = hit.getSource().getCreator() + " 于 " + hit.getSource().getTime() + " 发表, " + hit.getSource().getReplies() + " 回复";
40+
holder.setText(R.id.search_result_footnote_tv, footnote);
3941
RichText.from(hit.getSource().getContent())
4042
.supportUrlClick(false)
4143
.into(holder.getTextView(R.id.search_result_content_tv));

‎app/src/main/java/me/ghui/v2er/module/home/SearchPresenter.java

+4-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,10 @@ public void start() {
3030
@Override
3131
public void search(String query, int page) {
3232
int from = (page - 1) * 10;
33-
APIService.get().search(query, from)
33+
34+
// String sortWay = "sumup";
35+
String sortWay = "created";
36+
APIService.get().search(query, from, sortWay)
3437
.compose(mView.rx(page))
3538
.subscribe(new GeneralConsumer<SoV2EXSearchResultInfo>() {
3639
@Override

‎app/src/main/java/me/ghui/v2er/network/APIs.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ public interface APIs {
7070

7171
@Json
7272
@GET("https://www.sov2ex.com/api/search")
73-
Observable<SoV2EXSearchResultInfo> search(@Query("q") String keyword, @Query("from") int from);
73+
Observable<SoV2EXSearchResultInfo> search(@Query("q") String keyword, @Query("from") int from, @Query("sort") String sortWay);
7474

7575
// Below is YunGou API
7676
// @Json

‎app/src/main/java/me/ghui/v2er/network/bean/SoV2EXSearchResultInfo.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ public static class Source {
3333
private String nodeId;
3434
@SerializedName("replies")
3535
private long replies;
36-
@SerializedName("time")
36+
@SerializedName("created")
3737
private String time;
3838
@SerializedName("member")
3939
private String creator;

‎app/src/main/res/layout/item_bing_search.xml

+7
Original file line numberDiff line numberDiff line change
@@ -31,5 +31,12 @@
3131
android:maxLines="3"
3232
android:paddingTop="8dp"
3333
tools:text="Android - @yuyu5 - 当我们在 android 的 drawable 文件下加入图片的,常会因为图片命名不规范而引发一系列问题。今天,北京上课了的讲师为大家介绍一下 android 加入图片 ..." />
34+
35+
<TextView
36+
android:id="@+id/search_result_footnote_tv"
37+
style="@style/hintText"
38+
android:layout_width="match_parent"
39+
android:paddingTop="4dp"
40+
tools:text="xxx 于 2021-11-27发表,0回复" />
3441
</LinearLayout>
3542
</androidx.cardview.widget.CardView>

0 commit comments

Comments
 (0)
Please sign in to comment.