浏览代码

订阅号

gongpm 9 年之前
父节点
当前提交
8cbca91931

+ 2 - 11
WeiChat/src/main/java/com/xzjmyk/pm/activity/ui/message/SubscriptionActivity.java

@@ -91,7 +91,6 @@ public class SubscriptionActivity extends BaseActivity {
     };
     String mLoginUserId;
     private String emCode;
-    private TextView emptyView;
 
     @Override//设置右划退出
     public void setTouch(boolean b) {
@@ -110,8 +109,8 @@ public class SubscriptionActivity extends BaseActivity {
     private void initView() {
         listView = (PullToRefreshListView) findViewById(R.id.listview);
         listView.setMode(PullToRefreshBase.Mode.BOTH);
-        emptyView = (TextView) findViewById(R.id.emptyView);
-
+        View aa=LayoutInflater.from(this).inflate(R.layout.subscrip_emptyview,null);
+        listView.setEmptyView(aa);
         listView.setOnRefreshListener(new PullToRefreshBase.OnRefreshListener2<ListView>() {
             @Override
             public void onPullDownToRefresh(PullToRefreshBase<ListView> refreshView) {
@@ -233,11 +232,6 @@ public class SubscriptionActivity extends BaseActivity {
     }
 
     private void notifyAdapter() {
-        if (sortSubsrciprions == null || sortSubsrciprions.size() <= 0) {
-            emptyView.setVisibility(View.VISIBLE);
-        } else {
-            emptyView.setVisibility(View.GONE);
-        }
         if (adapter != null)
             adapter.notifyDataSetChanged();
     }
@@ -444,10 +438,7 @@ public class SubscriptionActivity extends BaseActivity {
                             "&title=" + bean.getTITLE_();
                     String title = TimeUtils.ym_long_2_str(sortSubsrciprions.get(position).tiem) + "  " + bean.getTITLE_();
                     ViewUtil.WebLinks(activity, url, title, true);
-                    Log.i("gongpengming", "bean.g" + bean.getSTATUS_());
-
                     if (bean.getSTATUS_() == 0) {//当点击未读消息
-                        Log.i("gongpengming", "bean.getSTATUS_() == 0");
                         SubscriptionDao.getInstance().UpdateStatus(bean.getID_() + "", true);
                         sortSubsrciprions.get(position).beans.get(i).setSTATUS_(-1);
                         notifyDataSetChanged();

+ 1 - 13
WeiChat/src/main/res/layout/activity_subscription.xml

@@ -4,23 +4,11 @@
     android:layout_width="match_parent"
     android:layout_height="match_parent">
 
-    <TextView
-        android:id="@+id/emptyView"
-        android:layout_width="wrap_content"
-        android:layout_height="wrap_content"
-        android:layout_gravity="center_horizontal|top"
-        android:drawableBottom="@drawable/icon_not_found"
-        android:drawablePadding="5dp"
-        android:gravity="center"
-        android:padding="10dp"
-        android:text="今天暂时没有数据 \n向上拉取前一天数据"
-        android:textColor="@color/black"
-        android:textSize="@dimen/SmallerTextSize"
-        android:visibility="gone" />
 
     <com.handmark.pulltorefresh.library.PullToRefreshListView
         android:id="@+id/listview"
         android:layout_width="match_parent"
+        android:background="@drawable/bg_main"
         android:layout_height="match_parent"
         android:layout_above="@+id/bottom_view"
         android:divider="#00000000"

+ 19 - 0
WeiChat/src/main/res/layout/subscrip_emptyview.xml

@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="utf-8"?>
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    android:orientation="vertical" android:layout_width="match_parent"
+    android:layout_height="match_parent">
+
+    <TextView
+        android:id="@+id/emptyView"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:layout_gravity="center_horizontal|top"
+        android:drawableBottom="@drawable/icon_not_found"
+        android:drawablePadding="5dp"
+        android:gravity="center"
+        android:padding="10dp"
+        android:text="今天暂时没有数据 \n向上拉取前一天数据"
+        android:textColor="@color/black"
+        android:textSize="@dimen/SmallerTextSize"
+          />
+</LinearLayout>