Procházet zdrojové kódy

添加信用卡中无数据时显示暂无数据,稍后再试

zengjiebin před 8 roky
rodič
revize
3b979c1669

+ 10 - 6
app/src/main/java/com/kfzs/duanduan/fragment/FgtCreditCardProgressQuery.java

@@ -1,6 +1,5 @@
 package com.kfzs.duanduan.fragment;
 
-import android.util.SparseArray;
 import android.view.View;
 import android.widget.ImageView;
 import android.widget.ListView;
@@ -8,7 +7,6 @@ import android.widget.ListView;
 import com.alibaba.fastjson.JSON;
 import com.sheep.gamegroup.model.entity.BaseMessage;
 import com.sheep.gamegroup.model.entity.CreditCardProgressQuery;
-import com.sheep.gamegroup.model.entity.TaskReleaseEty;
 import com.sheep.gamegroup.model.util.SheepSubscriber;
 import com.sheep.gamegroup.view.adapter.CreditCardProgressQueryAdp;
 import com.sheep.gamegroup.view.customview.RefreshLayout;
@@ -36,6 +34,8 @@ public class FgtCreditCardProgressQuery extends BaseFragment {
     RefreshLayout swipe_container;
     @BindView(R.id.task_progress_iv)
     ImageView task_progress_iv;
+    @BindView(R.id.empty_view)
+    View empty_view;
     @Override
     public int getLayoutId() {
         return R.layout.fgt_credit_card_task_list;
@@ -69,8 +69,7 @@ public class FgtCreditCardProgressQuery extends BaseFragment {
                     public void onNext(BaseMessage baseMessage) {
                         List<CreditCardProgressQuery> newList = baseMessage.getDatas(CreditCardProgressQuery.class);
                         list.addAll(newList);
-                        adapter.notifyDataSetChanged();
-                        swipe_container.setRefreshing(false);
+                        notifyDataSetChanged();
                         if(BuildConfig.DEBUG)
                             System.out.println("baseMessage onNext "+ JSON.toJSONString(baseMessage));
                     }
@@ -80,9 +79,14 @@ public class FgtCreditCardProgressQuery 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);
+    }
 }

+ 9 - 10
app/src/main/java/com/kfzs/duanduan/fragment/FgtCreditCardTaskList.java

@@ -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);
+    }
 }

+ 0 - 17
app/src/main/java/com/sheep/jiuyan/samllsheep/base/BaseActivity.java

@@ -72,23 +72,6 @@ public abstract class BaseActivity extends AppCompatActivity {
 
     }
 
-
-    @Override
-    protected void onDestroy() {
-        super.onDestroy();
-    }
-
-    @Override
-    public boolean onKeyDown(int keyCode, KeyEvent event) {
-        /*if (BuildConfig.DEBUG)
-            if (keyCode == KeyEvent.KEYCODE_VOLUME_DOWN) {
-                Intent intent = Chuck.getLaunchIntent(BaseActivity.this);
-                startActivity(intent);
-                return true;
-            }*/
-        return super.onKeyDown(keyCode, event);
-    }
-
     protected abstract int getLayoutId();
 
     public abstract void initView();

binární
app/src/main/res/drawable-xxhdpi/understand_small_bg.webp


binární
app/src/main/res/drawable-xxxhdpi/understand_small_bg.jpg


+ 20 - 10
app/src/main/res/layout/fgt_credit_card_task_list.xml

@@ -1,30 +1,40 @@
 <?xml version="1.0" encoding="utf-8"?>
-<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
     android:layout_width="match_parent"
     android:layout_height="match_parent"
-    android:orientation="vertical"
-    android:background="@color/white_light">
+    android:background="@color/white_light"
+    android:orientation="vertical">
+
     <ImageView
         android:id="@+id/task_progress_iv"
         android:layout_width="match_parent"
         android:layout_height="wrap_content"
-        android:scaleType="fitXY"
         android:adjustViewBounds="true"
-        android:src="@drawable/credit_card_process"/>
+        android:scaleType="fitXY"
+        android:src="@drawable/credit_card_process" />
+
+    <include
+        android:id="@+id/empty_view"
+        layout="@layout/empty_view"
+        android:layout_width="match_parent"
+        android:layout_height="match_parent"
+        android:layout_below="@+id/task_progress_iv" />
+
     <com.sheep.gamegroup.view.customview.RefreshLayout
         android:id="@+id/swipe_container"
         android:layout_width="match_parent"
-        android:layout_height="match_parent">
+        android:layout_height="match_parent"
+        android:layout_below="@+id/task_progress_iv">
 
         <ListView
             android:id="@+id/credit_card_task_list"
             android:layout_width="match_parent"
             android:layout_height="match_parent"
-            android:listSelector="@color/transparent"
-            android:divider="@null"
             android:layout_margin="@dimen/content_padding_13"
-            android:scrollbars="none"/>
+            android:divider="@null"
+            android:listSelector="@color/transparent"
+            android:scrollbars="none" />
 
     </com.sheep.gamegroup.view.customview.RefreshLayout>
 
-</LinearLayout>
+</RelativeLayout>