Selaa lähdekoodia

1.修改Android Apex Mobile数据加载指示器。
2.修改Android Apex Mobile Result在调整显示列后刷新显示不正确。

Pen Li 8 vuotta sitten
vanhempi
commit
cc29bd78f0

+ 16 - 0
Apex Mobile/app/src/main/java/com/usai/apex/Result/SearchResultActivity.java

@@ -891,6 +891,14 @@ public class SearchResultActivity extends AppCompatActivity {
                    layoutParams.height = height;
                    holder.row.setLayoutParams(layoutParams);
 
+                   // 调整显示列后,需要删除多余的列
+                   if (holder.row.getChildCount() > arr_col.length()) {
+                       for (int i = arr_col.length(); i < holder.row.getChildCount(); i++) {
+                           TextView tv = (TextView)holder.row.findViewById(i);
+                           holder.row.removeView(tv);
+                       }
+                   }
+
                    // col
                    for (int i = 0; i < arr_col.length(); i++) {
 
@@ -975,6 +983,14 @@ public class SearchResultActivity extends AppCompatActivity {
                    layoutParams.height = row_h;
                    holder.row.setLayoutParams(layoutParams);
 
+                   // 调整显示列后,需要删除多余的列
+                   if (holder.row.getChildCount() > arr_col.length()) {
+                       for (int i = arr_col.length(); i < holder.row.getChildCount(); i++) {
+                           TextView tv = (TextView)holder.row.findViewById(i);
+                           holder.row.removeView(tv);
+                       }
+                   }
+
                    // col
                    for (int i = 0; i < arr_col.length(); i++) {
 

+ 9 - 4
Apex Mobile/app/src/main/java/com/usai/apex/mainframe/HistoryFragment.java

@@ -41,6 +41,7 @@ public class HistoryFragment extends TrackingListFragment {
     }
     public HistoryFragment() {
         // Required empty public constructor
+        bdirty = true;
     }
 
 
@@ -76,9 +77,9 @@ public class HistoryFragment extends TrackingListFragment {
         });
 
         // this.getListView().setBackgroundColor(Color.WHITE);
-        if (searchresult.get_count() == 0) {
-            requestData();
-        }
+//        if (searchresult.get_count() == 0) {
+//            requestData();
+//        }
 
     }
 //    private void requestdata()
@@ -159,7 +160,9 @@ public class HistoryFragment extends TrackingListFragment {
         params.putInt("limit",load_limit);
 
         isLoading = true;
-        showProgress(true);
+//        showProgress(true);
+
+        showProgressDialog();
 
         new Thread(new Runnable() {
             @Override
@@ -177,6 +180,8 @@ public class HistoryFragment extends TrackingListFragment {
                             mSwipeRefresh.setRefreshing(false);
                         }
 
+                        dismissProgressDialog();
+
                         if (jsobj != null) {
 
                             try {

+ 32 - 1
Apex Mobile/app/src/main/java/com/usai/apex/mainframe/KPIFragment.java

@@ -2,6 +2,7 @@ package com.usai.apex.mainframe;
 
 
 import android.app.Activity;
+import android.app.ProgressDialog;
 import android.content.BroadcastReceiver;
 import android.content.Context;
 import android.content.Intent;
@@ -366,6 +367,28 @@ public void checkDirty()
         super.onHiddenChanged(hidden);
     }
 
+
+    private ProgressDialog mProgressDialog;
+
+    public void showProgressDialog() {
+
+        if (mProgressDialog == null) {
+            if (getContext() == null) {
+                return;
+            }
+            mProgressDialog = new ProgressDialog(getContext());
+            mProgressDialog.setCancelable(false);
+            mProgressDialog.setMessage("Loading...");
+        }
+        mProgressDialog.show();
+    }
+
+    public void dismissProgressDialog() {
+        if (mProgressDialog != null && mProgressDialog.isShowing()) {
+            mProgressDialog.dismiss();
+        }
+    }
+
     private boolean loading = false;
     private void loadKPIData() {
 
@@ -374,8 +397,9 @@ public void checkDirty()
         }
 
         loading = true;
-        mLoadIndicator.setVisibility(View.VISIBLE);
+//        mLoadIndicator.setVisibility(View.VISIBLE);
 
+        showProgressDialog();
 
         new Thread(new Runnable() {
             @Override
@@ -392,6 +416,7 @@ public void checkDirty()
                         if (mSwipeRefresh.isRefreshing()) {
                             mSwipeRefresh.setRefreshing(false);
                         }
+                        dismissProgressDialog();
                         prepareData();
 //                        if (mKPIArr != null && mKPIArr.size() > 0) {
 //                            mKPIPager.setCurrentItem(currentKPI,false);
@@ -570,6 +595,12 @@ public void checkDirty()
             return view == object;
         }
 
+        @Override
+        public int getItemPosition(Object object) {
+//            return super.getItemPosition(object);
+            return POSITION_NONE;
+        }
+
         @Override
         public void destroyItem(ViewGroup container, int position, Object object) {
 

+ 5 - 1
Apex Mobile/app/src/main/java/com/usai/apex/mainframe/RecentFragment.java

@@ -130,7 +130,9 @@ public class RecentFragment extends TrackingListFragment {
             return;
         }
         isLoading = true;
-        showProgress(true);
+//        showProgress(true);
+        showProgressDialog();
+
         new Thread(new Runnable() {
             @Override
             public void run() {
@@ -146,6 +148,8 @@ public class RecentFragment extends TrackingListFragment {
                             mSwipeRefresh.setRefreshing(false);
                         }
 
+                        dismissProgressDialog();
+
                         if (jsobj != null) {
                             handleJson(jsobj);
                             bdirty = false;

+ 26 - 4
Apex Mobile/app/src/main/java/com/usai/apex/mainframe/TrackingListFragment.java

@@ -1,6 +1,7 @@
 package com.usai.apex.mainframe;
 
 
+import android.app.ProgressDialog;
 import android.content.BroadcastReceiver;
 import android.content.Context;
 import android.content.Intent;
@@ -72,8 +73,8 @@ TrackingListSearchResult searchresult	= new TrackingListSearchResult();
 //            else
 //                initTable();
         }
-        else
-            requestData();
+//        else
+//            requestData();
     }
 
 //    protected class TrackingListSearchResult implements Serializable
@@ -365,8 +366,8 @@ TrackingListSearchResult searchresult	= new TrackingListSearchResult();
 //            else
 //                initTable();
         }
-        else
-            requestData();
+//        else
+//            requestData();
 
         setupAdapter();
         customize_style();
@@ -635,4 +636,25 @@ TrackingListSearchResult searchresult	= new TrackingListSearchResult();
 //
         }
     }
+
+    private ProgressDialog mProgressDialog;
+
+    public void showProgressDialog() {
+
+        if (mProgressDialog == null) {
+            if (getContext() == null) {
+                return;
+            }
+            mProgressDialog = new ProgressDialog(getContext());
+            mProgressDialog.setCancelable(false);
+            mProgressDialog.setMessage("Loading...");
+        }
+        mProgressDialog.show();
+    }
+
+    public void dismissProgressDialog() {
+        if (mProgressDialog != null && mProgressDialog.isShowing()) {
+            mProgressDialog.dismiss();
+        }
+    }
 }