|
|
@@ -2,11 +2,15 @@ package com.usai.apex.mainframe;
|
|
|
|
|
|
|
|
|
import android.app.ProgressDialog;
|
|
|
+import android.content.BroadcastReceiver;
|
|
|
import android.content.Context;
|
|
|
+import android.content.Intent;
|
|
|
+import android.content.IntentFilter;
|
|
|
import android.os.Bundle;
|
|
|
import android.support.annotation.Nullable;
|
|
|
import android.support.v4.app.Fragment;
|
|
|
import android.support.v4.app.ListFragment;
|
|
|
+import android.support.v4.content.LocalBroadcastManager;
|
|
|
import android.support.v4.widget.SwipeRefreshLayout;
|
|
|
import android.support.v7.app.AlertDialog;
|
|
|
import android.text.TextUtils;
|
|
|
@@ -460,6 +464,7 @@ TrackingListSearchResult searchresult = new TrackingListSearchResult();
|
|
|
boolean isLoading = false;//表示是否正处于加载状态
|
|
|
Context mContext;
|
|
|
SwipeRefreshLayout mSwipeRefresh;
|
|
|
+ private TrackingBroadcastReceiver mReceiver;
|
|
|
|
|
|
@Override
|
|
|
public void onAttach(Context context) {
|
|
|
@@ -508,6 +513,11 @@ TrackingListSearchResult searchresult = new TrackingListSearchResult();
|
|
|
|
|
|
// ------------------------------------------------------------------
|
|
|
|
|
|
+ mReceiver = new TrackingBroadcastReceiver();
|
|
|
+ LocalBroadcastManager localBroadcastManager = LocalBroadcastManager.getInstance(getContext());
|
|
|
+ IntentFilter intentFilter = new IntentFilter("com.apex.broadcast.person_mode");
|
|
|
+ localBroadcastManager.registerReceiver(mReceiver,intentFilter);
|
|
|
+
|
|
|
LinearLayout pframe = new LinearLayout(context);
|
|
|
pframe.setId(INTERNAL_PROGRESS_CONTAINER_ID);
|
|
|
pframe.setOrientation(LinearLayout.VERTICAL);
|
|
|
@@ -566,6 +576,15 @@ TrackingListSearchResult searchresult = new TrackingListSearchResult();
|
|
|
return root;
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public void onDestroy() {
|
|
|
+
|
|
|
+ LocalBroadcastManager localBroadcastManager = LocalBroadcastManager.getInstance(getContext());
|
|
|
+ localBroadcastManager.unregisterReceiver(mReceiver);
|
|
|
+
|
|
|
+ super.onDestroy();
|
|
|
+ }
|
|
|
+
|
|
|
@Override
|
|
|
public void setUserVisibleHint(boolean isVisibleToUser) {
|
|
|
super.setUserVisibleHint(isVisibleToUser);
|
|
|
@@ -580,4 +599,15 @@ TrackingListSearchResult searchresult = new TrackingListSearchResult();
|
|
|
protected void requestData() {
|
|
|
|
|
|
}
|
|
|
+
|
|
|
+ class TrackingBroadcastReceiver extends BroadcastReceiver {
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void onReceive(Context context, Intent intent) {
|
|
|
+ if (searchresult.get_count() > 0) {
|
|
|
+ mPullRefreshListView.setSelection(0);
|
|
|
+ }
|
|
|
+ requestData();
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|