|
|
@@ -10,6 +10,7 @@ import android.os.Handler;
|
|
|
import android.os.Message;
|
|
|
import android.support.annotation.NonNull;
|
|
|
import android.support.annotation.Nullable;
|
|
|
+import android.support.v4.widget.SwipeRefreshLayout;
|
|
|
import android.support.v7.app.AlertDialog;
|
|
|
import android.support.v7.app.AppCompatActivity;
|
|
|
import android.os.Bundle;
|
|
|
@@ -71,6 +72,7 @@ public class DetailActivity extends AppCompatActivity implements DetailAdapter.D
|
|
|
private Context mCtx = this;
|
|
|
private DetailActivity self = this;
|
|
|
private ExpandableListView mListView;
|
|
|
+ private SwipeRefreshLayout mRefresh;
|
|
|
private DetailAdapter mAdapter;
|
|
|
private ArrayList<DetailSectionModel> mSectionArray = new ArrayList<>();
|
|
|
private JSONObject mJson;
|
|
|
@@ -99,6 +101,13 @@ public class DetailActivity extends AppCompatActivity implements DetailAdapter.D
|
|
|
mListView.setDividerHeight(RAUtil.dp2px(mCtx,1));
|
|
|
mListView.setGroupIndicator(null);
|
|
|
|
|
|
+ mRefresh = findViewById(R.id.detail_refresh);
|
|
|
+ mRefresh.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
|
|
|
+ @Override
|
|
|
+ public void onRefresh() {
|
|
|
+ loadData();
|
|
|
+ }
|
|
|
+ });
|
|
|
|
|
|
loadData();
|
|
|
}
|
|
|
@@ -243,6 +252,10 @@ public class DetailActivity extends AppCompatActivity implements DetailAdapter.D
|
|
|
switch (msg.what) {
|
|
|
case DetailActionReloadData: {
|
|
|
|
|
|
+ if (activity.mRefresh.isRefreshing()) {
|
|
|
+ activity.mRefresh.setRefreshing(false);
|
|
|
+ }
|
|
|
+
|
|
|
JSONObject json = (JSONObject) msg.obj;
|
|
|
|
|
|
if (json != null) {
|