|
|
@@ -1,13 +1,11 @@
|
|
|
package com.kfzs.duanduan.fragment;
|
|
|
|
|
|
-import android.text.TextUtils;
|
|
|
import android.view.View;
|
|
|
import android.widget.AdapterView;
|
|
|
import android.widget.ListView;
|
|
|
|
|
|
import com.alibaba.fastjson.JSON;
|
|
|
import com.sheep.gamegroup.model.entity.BaseMessage;
|
|
|
-import com.sheep.gamegroup.model.entity.CreditCard;
|
|
|
import com.sheep.gamegroup.model.entity.TaskReleaseEty;
|
|
|
import com.sheep.gamegroup.model.util.SheepSubscriber;
|
|
|
import com.sheep.gamegroup.util.Jump2View;
|
|
|
@@ -17,16 +15,12 @@ import com.sheep.jiuyan.samllsheep.BuildConfig;
|
|
|
import com.sheep.jiuyan.samllsheep.R;
|
|
|
import com.sheep.jiuyan.samllsheep.SheepApp;
|
|
|
import com.sheep.jiuyan.samllsheep.base.BaseFragment;
|
|
|
-import com.sheep.jiuyan.samllsheep.utils.G;
|
|
|
-import com.zhy.http.okhttp.OkHttpUtils;
|
|
|
-import com.zhy.http.okhttp.callback.StringCallback;
|
|
|
|
|
|
import java.util.ArrayList;
|
|
|
import java.util.List;
|
|
|
|
|
|
import butterknife.BindView;
|
|
|
import butterknife.ButterKnife;
|
|
|
-import okhttp3.Call;
|
|
|
import rx.android.schedulers.AndroidSchedulers;
|
|
|
import rx.schedulers.Schedulers;
|
|
|
|
|
|
@@ -39,6 +33,8 @@ public class FgtCreditCardTaskList extends BaseFragment {
|
|
|
ListView credit_card_task_list;
|
|
|
@BindView(R.id.swipe_container)
|
|
|
RefreshLayout swipe_container;
|
|
|
+ @BindView(R.id.empty_view)
|
|
|
+ View empty_view;
|
|
|
@Override
|
|
|
public int getLayoutId() {
|
|
|
return R.layout.fgt_credit_card_task_list;
|
|
|
@@ -83,8 +79,7 @@ public class FgtCreditCardTaskList extends BaseFragment {
|
|
|
public void onNext(BaseMessage baseMessage) {
|
|
|
List<TaskReleaseEty> newList = baseMessage.getDatas(TaskReleaseEty.class);
|
|
|
list.addAll(newList);
|
|
|
- adapter.notifyDataSetChanged();
|
|
|
- swipe_container.setRefreshing(false);
|
|
|
+ notifyDataSetChanged();
|
|
|
if(BuildConfig.DEBUG)
|
|
|
System.out.println("baseMessage onNext "+ JSON.toJSONString(baseMessage));
|
|
|
}
|
|
|
@@ -94,9 +89,13 @@ public class FgtCreditCardTaskList extends BaseFragment {
|
|
|
if(BuildConfig.DEBUG)
|
|
|
System.out.println("baseMessage onError "+JSON.toJSONString(baseMessage));
|
|
|
// G.showToast(TextUtils.isEmpty(baseMessage.getMsg()) ? "服务器错误,请稍候再试" : baseMessage.getMsg());
|
|
|
- adapter.notifyDataSetChanged();
|
|
|
- swipe_container.setRefreshing(false);
|
|
|
+ notifyDataSetChanged();
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
+ private void notifyDataSetChanged() {
|
|
|
+ empty_view.setVisibility(list.isEmpty() ? View.VISIBLE : View.INVISIBLE);
|
|
|
+ adapter.notifyDataSetChanged();
|
|
|
+ swipe_container.setRefreshing(false);
|
|
|
+ }
|
|
|
}
|