various progressbar usage fixes
remove unnecessary runOnUiThread from asynctask methods
This commit is contained in:
parent
2b25a9caec
commit
936935c019
@ -140,6 +140,13 @@ public class FeedsFragment extends Fragment implements OnItemClickListener {
|
||||
|
||||
if (sessionId != null) {
|
||||
|
||||
getActivity().runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
setLoadingStatus(R.string.blank, true);
|
||||
}
|
||||
});
|
||||
|
||||
HashMap<String,String> map = new HashMap<String,String>() {
|
||||
{
|
||||
put("op", "getFeeds");
|
||||
@ -157,6 +164,7 @@ public class FeedsFragment extends Fragment implements OnItemClickListener {
|
||||
}
|
||||
|
||||
public void setLoadingStatus(int status, boolean showProgress) {
|
||||
if (getView() != null) {
|
||||
TextView tv = (TextView)getView().findViewById(R.id.loading_message);
|
||||
|
||||
if (tv != null) {
|
||||
@ -169,6 +177,7 @@ public class FeedsFragment extends Fragment implements OnItemClickListener {
|
||||
pb.setVisibility(showProgress ? View.VISIBLE : View.GONE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private class FeedsRequest extends ApiRequest {
|
||||
|
||||
@ -187,8 +196,6 @@ public class FeedsFragment extends Fragment implements OnItemClickListener {
|
||||
Type listType = new TypeToken<List<Feed>>() {}.getType();
|
||||
final List<Feed> feeds = gson.fromJson(content, listType);
|
||||
|
||||
getActivity().runOnUiThread(new Runnable() {
|
||||
public void run() {
|
||||
m_feeds.clear();
|
||||
|
||||
for (Feed f : feeds)
|
||||
@ -202,8 +209,6 @@ public class FeedsFragment extends Fragment implements OnItemClickListener {
|
||||
setLoadingStatus(R.string.blank, false);
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
} else {
|
||||
MainActivity activity = (MainActivity)getActivity();
|
||||
activity.login();
|
||||
|
@ -144,6 +144,8 @@ public class HeadlinesFragment extends Fragment implements OnItemClickListener {
|
||||
|
||||
req.setOffset(skip);
|
||||
|
||||
setLoadingStatus(R.string.blank, true);
|
||||
|
||||
HashMap<String,String> map = new HashMap<String,String>() {
|
||||
{
|
||||
put("op", "getHeadlines");
|
||||
@ -171,6 +173,7 @@ public class HeadlinesFragment extends Fragment implements OnItemClickListener {
|
||||
}
|
||||
|
||||
public void setLoadingStatus(int status, boolean showProgress) {
|
||||
if (getView() != null) {
|
||||
TextView tv = (TextView)getView().findViewById(R.id.loading_message);
|
||||
|
||||
if (tv != null) {
|
||||
@ -183,6 +186,7 @@ public class HeadlinesFragment extends Fragment implements OnItemClickListener {
|
||||
pb.setVisibility(showProgress ? View.VISIBLE : View.GONE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private class HeadlinesRequest extends ApiRequest {
|
||||
int m_offset = 0;
|
||||
@ -202,9 +206,6 @@ public class HeadlinesFragment extends Fragment implements OnItemClickListener {
|
||||
Type listType = new TypeToken<List<Article>>() {}.getType();
|
||||
final List<Article> articles = gson.fromJson(content, listType);
|
||||
|
||||
getActivity().runOnUiThread(new Runnable() {
|
||||
public void run() {
|
||||
|
||||
if (m_offset == 0)
|
||||
m_articles.clear();
|
||||
|
||||
@ -227,8 +228,6 @@ public class HeadlinesFragment extends Fragment implements OnItemClickListener {
|
||||
|
||||
setLoadingStatus(R.string.blank, false);
|
||||
}
|
||||
});
|
||||
}
|
||||
} else {
|
||||
MainActivity activity = (MainActivity)getActivity();
|
||||
activity.login();
|
||||
|
Loading…
Reference in New Issue
Block a user