check whether swipeLayout is null before trying to deal with it

This commit is contained in:
Andrew Dolgov 2014-10-17 00:25:39 +04:00
parent 8f6ca0eec0
commit 2af8bc98c8
4 changed files with 12 additions and 12 deletions

View File

@ -282,7 +282,7 @@ public class FeedCategoriesFragment extends Fragment implements OnItemClickListe
} */
public void refresh(boolean background) {
m_swipeLayout.setRefreshing(true);
if (m_swipeLayout != null) m_swipeLayout.setRefreshing(true);
CatsRequest req = new CatsRequest(getActivity().getApplicationContext());
@ -325,7 +325,7 @@ public class FeedCategoriesFragment extends Fragment implements OnItemClickListe
if (isDetached()) return;
m_activity.setProgressBarVisibility(false);
m_swipeLayout.setRefreshing(false);
if (m_swipeLayout != null) m_swipeLayout.setRefreshing(false);
if (getView() != null) {
ListView list = (ListView)getView().findViewById(R.id.feeds);

View File

@ -379,8 +379,8 @@ public class FeedsFragment extends Fragment implements OnItemClickListener, OnSh
@SuppressWarnings({ "serial" })
public void refresh(boolean background) {
//FeedCategory cat = m_onlineServices.getActiveCategory();
m_swipeLayout.setRefreshing(true);
if (m_swipeLayout != null) m_swipeLayout.setRefreshing(true);
final int catId = (m_activeCategory != null) ? m_activeCategory.id : -4;
@ -502,7 +502,7 @@ public class FeedsFragment extends Fragment implements OnItemClickListener, OnSh
m_activity.setProgressBarVisibility(false);
//m_activity.m_pullToRefreshAttacher.setRefreshComplete();
m_swipeLayout.setRefreshing(false);
if (m_swipeLayout != null) m_swipeLayout.setRefreshing(false);
if (result != null) {
try {

View File

@ -298,7 +298,7 @@ public class HeadlinesFragment extends Fragment implements OnItemClickListener,
View view = inflater.inflate(R.layout.headlines_fragment, container, false);
m_swipeLayout = (SwipeRefreshLayout) view.findViewById(R.id.headlines_swipe_container);
m_swipeLayout.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
@Override
public void onRefresh() {
@ -415,7 +415,7 @@ public class HeadlinesFragment extends Fragment implements OnItemClickListener,
if (m_activity != null && m_feed != null) {
m_refreshInProgress = true;
m_swipeLayout.setRefreshing(true);
if (m_swipeLayout != null) m_swipeLayout.setRefreshing(true);
m_activity.setProgressBarVisibility(true);
if (!m_feed.equals(GlobalState.getInstance().m_activeFeed)) {
@ -463,7 +463,7 @@ public class HeadlinesFragment extends Fragment implements OnItemClickListener,
super.onPostExecute(result);
if (isAdded()) {
m_swipeLayout.setRefreshing(false);
if (m_swipeLayout != null) m_swipeLayout.setRefreshing(false);
}
if (result != null) {

View File

@ -246,8 +246,8 @@ public class OfflineHeadlinesFragment extends Fragment implements OnItemClickLis
public void refresh() {
try {
if (!isAdded()) return;
m_swipeLayout.setRefreshing(true);
if (m_swipeLayout != null) m_swipeLayout.setRefreshing(true);
if (m_cursor != null && !m_cursor.isClosed()) m_cursor.close();
@ -257,8 +257,8 @@ public class OfflineHeadlinesFragment extends Fragment implements OnItemClickLis
m_adapter.changeCursor(m_cursor);
m_adapter.notifyDataSetChanged();
}
m_swipeLayout.setRefreshing(false);
if (m_swipeLayout != null) m_swipeLayout.setRefreshing(false);
} catch (NullPointerException e) {
e.printStackTrace();