You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
42 lines
1.3 KiB
42 lines
1.3 KiB
package com.community.pocket.data.main.garbage;
|
|
|
|
|
|
import com.community.pocket.R;
|
|
import com.community.pocket.data.model.GarbageSorting;
|
|
import com.community.pocket.ui.main.ui.garbage.sorting.GarbageSortingResponse;
|
|
|
|
import java.util.ArrayList;
|
|
import java.util.List;
|
|
|
|
/**
|
|
* 垃圾分类请求接口
|
|
* TODO 完善逻辑
|
|
*/
|
|
public class GarbageSortingRequest {
|
|
private static volatile GarbageSortingRequest instance;
|
|
|
|
private GarbageSortingRequest() {
|
|
}
|
|
|
|
public static GarbageSortingRequest getInstance() {
|
|
if (instance == null) {
|
|
instance = new GarbageSortingRequest();
|
|
}
|
|
return instance;
|
|
}
|
|
|
|
//检索垃圾
|
|
public GarbageSortingResponse search() {
|
|
List<GarbageSorting> garbageSortings = new ArrayList<>();
|
|
for (int i = 0; i < 10; i++) {
|
|
GarbageSorting garbageSorting = new GarbageSorting();
|
|
garbageSorting.setName("test" + i);
|
|
garbageSorting.setSorting("有害垃圾");
|
|
garbageSortings.add(garbageSorting);
|
|
}
|
|
GarbageSortingResponse garbageSortingResponse = new GarbageSortingResponse();
|
|
garbageSortingResponse.setSuccess(R.string.garbage_search_ok);
|
|
garbageSortingResponse.setBody(garbageSortings);
|
|
return garbageSortingResponse;
|
|
}
|
|
}
|
|
|