|
|
@@ -0,0 +1,127 @@
|
|
|
+package com.kfzs.duanduan.fragment;
|
|
|
+
|
|
|
+import android.app.Activity;
|
|
|
+import android.os.Bundle;
|
|
|
+import android.support.annotation.Nullable;
|
|
|
+import android.support.v4.widget.SwipeRefreshLayout;
|
|
|
+import android.support.v7.widget.LinearLayoutManager;
|
|
|
+import android.support.v7.widget.RecyclerView;
|
|
|
+import android.view.LayoutInflater;
|
|
|
+import android.view.View;
|
|
|
+import android.widget.TextView;
|
|
|
+
|
|
|
+import com.kfzs.android.view.tag.FlowLayout;
|
|
|
+import com.kfzs.android.view.tag.TagAdapter;
|
|
|
+import com.kfzs.android.view.tag.TagFlowLayout;
|
|
|
+import com.kfzs.duanduan.BaseCompatFragment;
|
|
|
+import com.kfzs.duanduan.mine.GiftpackListAdapter;
|
|
|
+import com.sheep.gamegroup.model.entity.FindItem;
|
|
|
+import com.sheep.gamegroup.model.entity.UserLabel;
|
|
|
+import com.sheep.gamegroup.model.entity.UserLabelList;
|
|
|
+import com.sheep.gamegroup.util.ListUtil;
|
|
|
+import com.sheep.gamegroup.util.SysAppUtil;
|
|
|
+import com.sheep.gamegroup.util.ViewHolder;
|
|
|
+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.fragment.FgtTryMakeMoney;
|
|
|
+import com.sheep.jiuyan.samllsheep.R;
|
|
|
+import com.sheep.jiuyan.samllsheep.SheepApp;
|
|
|
+
|
|
|
+import java.util.List;
|
|
|
+
|
|
|
+import butterknife.BindView;
|
|
|
+import butterknife.ButterKnife;
|
|
|
+import rx.functions.Action1;
|
|
|
+
|
|
|
+/**
|
|
|
+ * Created by realicing on 2018/6/27.
|
|
|
+ * realicing@sina.com
|
|
|
+ */
|
|
|
+public class FgtFindChild extends BaseCompatFragment {
|
|
|
+
|
|
|
+ private int type;
|
|
|
+ public static FgtFindChild newInstance(int type){
|
|
|
+ FgtFindChild fgt = new FgtFindChild();
|
|
|
+ Bundle bundle = new Bundle();
|
|
|
+ bundle.putInt("type", type);
|
|
|
+ fgt.setArguments(bundle);
|
|
|
+ return fgt;
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void onCreate(@Nullable Bundle savedInstanceState) {
|
|
|
+ super.onCreate(savedInstanceState);
|
|
|
+ Bundle bundle = getArguments();
|
|
|
+ if(bundle != null){
|
|
|
+ type = bundle.getInt("type", 0);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ private Activity activity;
|
|
|
+ @Override
|
|
|
+ protected void initView(Bundle savedInstanceState) {
|
|
|
+ setContentView(R.layout.fgt_find_child);
|
|
|
+ activity = getActivity();
|
|
|
+ ButterKnife.bind(this, mContentView);
|
|
|
+ initView();
|
|
|
+ initData();
|
|
|
+ }
|
|
|
+
|
|
|
+ @BindView(R.id.find_refresh)
|
|
|
+ SwipeRefreshLayout refresh;
|
|
|
+ @BindView(R.id.check_net_ll)
|
|
|
+ View check_net_ll;
|
|
|
+ @BindView(R.id.find_list)
|
|
|
+ RecyclerView view_list;
|
|
|
+ private void initView(){
|
|
|
+ refresh.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
|
|
|
+ @Override
|
|
|
+ public void onRefresh() {
|
|
|
+ initData();
|
|
|
+ refresh.setRefreshing(false);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ private void initData(){
|
|
|
+ SysAppUtil.checkNet(new Action1<Integer>() {
|
|
|
+ @Override
|
|
|
+ public void call(Integer result) {
|
|
|
+ if(result != 0){//无网络
|
|
|
+ if(check_net_ll != null)
|
|
|
+ check_net_ll.setVisibility(View.VISIBLE);
|
|
|
+ testInitData();
|
|
|
+ loadData();
|
|
|
+ } else {
|
|
|
+ if(check_net_ll != null)
|
|
|
+ check_net_ll.setVisibility(View.GONE);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ private void testInitData() {
|
|
|
+ for (int i = 0; i < 10; i++) {
|
|
|
+ list.add(new FindItem());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ private List<FindItem> list = ListUtil.emptyList();
|
|
|
+ private void loadData() {
|
|
|
+ view_list.setLayoutManager(new LinearLayoutManager(SheepApp.getInstance()));
|
|
|
+ view_list.setAdapter(new AdbCommonRecycler<FindItem>(SheepApp.getInstance(), list){
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public int getViewIdByType(int type) {
|
|
|
+ return R.layout.find_item;
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void convert(ViewHolder holder, final FindItem item) {
|
|
|
+ View rootConvertView = holder.itemView;
|
|
|
+ TextView user_label_tv = rootConvertView.findViewById(R.id.user_label_tv);
|
|
|
+
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+}
|