|
@@ -20,14 +20,12 @@ import com.kfzs.duanduan.BaseCompatFragment;
|
|
|
import com.sheep.gamegroup.model.entity.BaseMessage;
|
|
import com.sheep.gamegroup.model.entity.BaseMessage;
|
|
|
import com.sheep.gamegroup.model.entity.FindItem;
|
|
import com.sheep.gamegroup.model.entity.FindItem;
|
|
|
import com.sheep.gamegroup.model.entity.FindTag;
|
|
import com.sheep.gamegroup.model.entity.FindTag;
|
|
|
-import com.sheep.gamegroup.model.entity.UserLabel;
|
|
|
|
|
import com.sheep.gamegroup.model.util.SheepSubscriber;
|
|
import com.sheep.gamegroup.model.util.SheepSubscriber;
|
|
|
import com.sheep.gamegroup.util.ListUtil;
|
|
import com.sheep.gamegroup.util.ListUtil;
|
|
|
import com.sheep.gamegroup.util.LogUtil;
|
|
import com.sheep.gamegroup.util.LogUtil;
|
|
|
import com.sheep.gamegroup.util.SysAppUtil;
|
|
import com.sheep.gamegroup.util.SysAppUtil;
|
|
|
import com.sheep.gamegroup.util.ViewHolder;
|
|
import com.sheep.gamegroup.util.ViewHolder;
|
|
|
import com.sheep.gamegroup.util.ViewUtil;
|
|
import com.sheep.gamegroup.util.ViewUtil;
|
|
|
-import com.sheep.gamegroup.view.activity.ActUserLabelList;
|
|
|
|
|
import com.sheep.gamegroup.view.adapter.AdbCommonRecycler;
|
|
import com.sheep.gamegroup.view.adapter.AdbCommonRecycler;
|
|
|
import com.sheep.jiuyan.samllsheep.R;
|
|
import com.sheep.jiuyan.samllsheep.R;
|
|
|
import com.sheep.jiuyan.samllsheep.SheepApp;
|
|
import com.sheep.jiuyan.samllsheep.SheepApp;
|
|
@@ -78,6 +76,8 @@ public class FgtFindChild extends BaseCompatFragment {
|
|
|
|
|
|
|
|
@BindView(R.id.find_refresh)
|
|
@BindView(R.id.find_refresh)
|
|
|
SwipeRefreshLayout refresh;
|
|
SwipeRefreshLayout refresh;
|
|
|
|
|
+ @BindView(R.id.empty_view)
|
|
|
|
|
+ View empty_view;
|
|
|
@BindView(R.id.check_net_ll)
|
|
@BindView(R.id.check_net_ll)
|
|
|
View check_net_ll;
|
|
View check_net_ll;
|
|
|
@BindView(R.id.find_list)
|
|
@BindView(R.id.find_list)
|
|
@@ -91,17 +91,26 @@ public class FgtFindChild extends BaseCompatFragment {
|
|
|
}
|
|
}
|
|
|
});
|
|
});
|
|
|
|
|
|
|
|
-
|
|
|
|
|
view_list.setLayoutManager(new LinearLayoutManager(SheepApp.getInstance()));
|
|
view_list.setLayoutManager(new LinearLayoutManager(SheepApp.getInstance()));
|
|
|
view_list.setAdapter(new AdbCommonRecycler<FindItem>(SheepApp.getInstance(), list){
|
|
view_list.setAdapter(new AdbCommonRecycler<FindItem>(SheepApp.getInstance(), list){
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
|
- public int getViewIdByType(int type) {
|
|
|
|
|
|
|
+ public int getItemViewType(int position) {
|
|
|
|
|
+ return position;
|
|
|
|
|
+ }
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public int getViewIdByType(int type) {//type来源于 getItemViewType 返回的值
|
|
|
|
|
+ if(type == -1 + list.size()){
|
|
|
|
|
+ return R.layout.find_item_bottom;
|
|
|
|
|
+ }
|
|
|
return R.layout.find_item;
|
|
return R.layout.find_item;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
|
public void convert(ViewHolder holder, final FindItem item) {
|
|
public void convert(ViewHolder holder, final FindItem item) {
|
|
|
|
|
+ if(item == null){
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
View rootConvertView = holder.itemView;
|
|
View rootConvertView = holder.itemView;
|
|
|
TextView find_item_name = (TextView)rootConvertView.findViewById(R.id.find_item_name);
|
|
TextView find_item_name = (TextView)rootConvertView.findViewById(R.id.find_item_name);
|
|
|
TextView find_item_time = (TextView)rootConvertView.findViewById(R.id.find_item_time);
|
|
TextView find_item_time = (TextView)rootConvertView.findViewById(R.id.find_item_time);
|
|
@@ -135,7 +144,7 @@ public class FgtFindChild extends BaseCompatFragment {
|
|
|
TagAdapter adapter = new TagAdapter<FindTag>(item.getTages()) {
|
|
TagAdapter adapter = new TagAdapter<FindTag>(item.getTages()) {
|
|
|
@Override
|
|
@Override
|
|
|
public View getView(FlowLayout parent, int position, FindTag item) {
|
|
public View getView(FlowLayout parent, int position, FindTag item) {
|
|
|
- TextView tv = (TextView) LayoutInflater.from(activity).inflate(R.layout.user_label, parent, false);
|
|
|
|
|
|
|
+ TextView tv = (TextView) LayoutInflater.from(activity).inflate(R.layout.find_item_tag, parent, false);
|
|
|
ViewUtil.setText(tv, item.getName());
|
|
ViewUtil.setText(tv, item.getName());
|
|
|
return tv;
|
|
return tv;
|
|
|
}
|
|
}
|
|
@@ -154,6 +163,7 @@ public class FgtFindChild extends BaseCompatFragment {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
private void initData(){
|
|
private void initData(){
|
|
|
|
|
+ empty_view.setVisibility(View.INVISIBLE);
|
|
|
SysAppUtil.checkNet(new Action1<Integer>() {
|
|
SysAppUtil.checkNet(new Action1<Integer>() {
|
|
|
@Override
|
|
@Override
|
|
|
public void call(Integer result) {
|
|
public void call(Integer result) {
|
|
@@ -163,7 +173,6 @@ public class FgtFindChild extends BaseCompatFragment {
|
|
|
} else {
|
|
} else {
|
|
|
if(check_net_ll != null)
|
|
if(check_net_ll != null)
|
|
|
check_net_ll.setVisibility(View.GONE);
|
|
check_net_ll.setVisibility(View.GONE);
|
|
|
-
|
|
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
});
|
|
});
|
|
@@ -178,16 +187,25 @@ public class FgtFindChild extends BaseCompatFragment {
|
|
|
if(!ListUtil.isEmpty(newList)){
|
|
if(!ListUtil.isEmpty(newList)){
|
|
|
list.clear();
|
|
list.clear();
|
|
|
ListUtil.addAll(list, newList);
|
|
ListUtil.addAll(list, newList);
|
|
|
- view_list.getAdapter().notifyDataSetChanged();
|
|
|
|
|
|
|
+ notifyDataSetChanged();
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
|
public void onError(BaseMessage baseMessage) {
|
|
public void onError(BaseMessage baseMessage) {
|
|
|
LogUtil.println("baseMessage onError "+JSON.toJSONString(baseMessage));
|
|
LogUtil.println("baseMessage onError "+JSON.toJSONString(baseMessage));
|
|
|
- G.showToast(baseMessage);
|
|
|
|
|
|
|
+ notifyDataSetChanged();
|
|
|
}
|
|
}
|
|
|
});
|
|
});
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+ private void notifyDataSetChanged(){
|
|
|
|
|
+ if(list.isEmpty())
|
|
|
|
|
+ empty_view.setVisibility(View.VISIBLE);
|
|
|
|
|
+ else
|
|
|
|
|
+ list.add(null);//底部部分----我是有底线的
|
|
|
|
|
+ refresh.setRefreshing(false);
|
|
|
|
|
+ view_list.getAdapter().notifyDataSetChanged();
|
|
|
|
|
+ }
|
|
|
private List<FindItem> list = ListUtil.emptyList();
|
|
private List<FindItem> list = ListUtil.emptyList();
|
|
|
}
|
|
}
|