Browse Source

订阅管理备份3

RaoMeng 9 years ago
parent
commit
2759f6c868

+ 1 - 1
WeiChat/src/main/java/com/xzjmyk/pm/activity/ui/erp/fragment/SubscriptionAllFragment.java

@@ -387,6 +387,7 @@ public class SubscriptionAllFragment extends BaseFragment {
         public void handleMessage(Message msg) {
         public void handleMessage(Message msg) {
             switch (msg.what) {
             switch (msg.what) {
                 case GET_ALL_SUBSCRIPTION:
                 case GET_ALL_SUBSCRIPTION:
+                    progressDialog.dismiss();
                     mDbManager.deleteMasterAllSubs(currentMaster, currentUser);
                     mDbManager.deleteMasterAllSubs(currentMaster, currentUser);
                     String resultJson = msg.getData().getString("result");
                     String resultJson = msg.getData().getString("result");
                     Log.d("allsubscriptionResult: ", resultJson);
                     Log.d("allsubscriptionResult: ", resultJson);
@@ -479,7 +480,6 @@ public class SubscriptionAllFragment extends BaseFragment {
                         Log.d("allsubscription:", mAllSubscriptionAdapter.getmSubscriptionNumbers().toString());
                         Log.d("allsubscription:", mAllSubscriptionAdapter.getmSubscriptionNumbers().toString());
                         mAllSubscriptionAdapter.notifyDataSetChanged();
                         mAllSubscriptionAdapter.notifyDataSetChanged();
                     }
                     }
-                    progressDialog.dismiss();
 
 
                     if (mPullToRefreshListView.isRefreshing()) {
                     if (mPullToRefreshListView.isRefreshing()) {
                         mPullToRefreshListView.onRefreshComplete();
                         mPullToRefreshListView.onRefreshComplete();

+ 4 - 6
WeiChat/src/main/java/com/xzjmyk/pm/activity/ui/erp/fragment/SubscriptionMyFragment.java

@@ -105,14 +105,12 @@ public class SubscriptionMyFragment extends BaseFragment {
 
 
     @Override
     @Override
     protected void initDatas() {
     protected void initDatas() {
-//        List<PersonalSubscriptionBean> dbPersonalSubscriptionBeans = mDbManager.queryFromMySubs(new String[]{currentMaster,currentUser}, "subs_master=? and subs_username=? ");
-//        if (dbPersonalSubscriptionBeans == null || dbPersonalSubscriptionBeans.size() == 0){
-        if (true){
-//            Toast.makeText(getActivity(), "网络加载", Toast.LENGTH_SHORT).show();
+        List<PersonalSubscriptionBean> dbPersonalSubscriptionBeans = mDbManager.queryFromMySubs(new String[]{currentMaster,currentUser}, "subs_master=? and subs_username=? ");
+        if (dbPersonalSubscriptionBeans == null
+                || dbPersonalSubscriptionBeans.size() == 0
+                || CommonUtil.isNetWorkConnected(getActivity().getApplicationContext())){
             sendSubscriptionRequest();
             sendSubscriptionRequest();
         }else {
         }else {
-            List<PersonalSubscriptionBean> dbPersonalSubscriptionBeans = mDbManager.queryFromMySubs(new String[]{currentMaster,currentUser}, "subs_master=? and subs_username=? ");
-            Toast.makeText(getActivity(), "本地加载", Toast.LENGTH_SHORT).show();
             mPersonalSubscriptionBeans.clear();
             mPersonalSubscriptionBeans.clear();
             mPersonalSubscriptionBeans.addAll(dbPersonalSubscriptionBeans);
             mPersonalSubscriptionBeans.addAll(dbPersonalSubscriptionBeans);
             mMySubscriptionAdapter.notifyDataSetChanged();
             mMySubscriptionAdapter.notifyDataSetChanged();