check whether swipeLayout is null before trying to deal with it
This commit is contained in:
parent
8f6ca0eec0
commit
2af8bc98c8
@ -282,7 +282,7 @@ public class FeedCategoriesFragment extends Fragment implements OnItemClickListe
|
|||||||
} */
|
} */
|
||||||
|
|
||||||
public void refresh(boolean background) {
|
public void refresh(boolean background) {
|
||||||
m_swipeLayout.setRefreshing(true);
|
if (m_swipeLayout != null) m_swipeLayout.setRefreshing(true);
|
||||||
|
|
||||||
CatsRequest req = new CatsRequest(getActivity().getApplicationContext());
|
CatsRequest req = new CatsRequest(getActivity().getApplicationContext());
|
||||||
|
|
||||||
@ -325,7 +325,7 @@ public class FeedCategoriesFragment extends Fragment implements OnItemClickListe
|
|||||||
if (isDetached()) return;
|
if (isDetached()) return;
|
||||||
|
|
||||||
m_activity.setProgressBarVisibility(false);
|
m_activity.setProgressBarVisibility(false);
|
||||||
m_swipeLayout.setRefreshing(false);
|
if (m_swipeLayout != null) m_swipeLayout.setRefreshing(false);
|
||||||
|
|
||||||
if (getView() != null) {
|
if (getView() != null) {
|
||||||
ListView list = (ListView)getView().findViewById(R.id.feeds);
|
ListView list = (ListView)getView().findViewById(R.id.feeds);
|
||||||
|
@ -379,8 +379,8 @@ public class FeedsFragment extends Fragment implements OnItemClickListener, OnSh
|
|||||||
@SuppressWarnings({ "serial" })
|
@SuppressWarnings({ "serial" })
|
||||||
public void refresh(boolean background) {
|
public void refresh(boolean background) {
|
||||||
//FeedCategory cat = m_onlineServices.getActiveCategory();
|
//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;
|
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.setProgressBarVisibility(false);
|
||||||
//m_activity.m_pullToRefreshAttacher.setRefreshComplete();
|
//m_activity.m_pullToRefreshAttacher.setRefreshComplete();
|
||||||
m_swipeLayout.setRefreshing(false);
|
if (m_swipeLayout != null) m_swipeLayout.setRefreshing(false);
|
||||||
|
|
||||||
if (result != null) {
|
if (result != null) {
|
||||||
try {
|
try {
|
||||||
|
@ -298,7 +298,7 @@ public class HeadlinesFragment extends Fragment implements OnItemClickListener,
|
|||||||
View view = inflater.inflate(R.layout.headlines_fragment, container, false);
|
View view = inflater.inflate(R.layout.headlines_fragment, container, false);
|
||||||
|
|
||||||
m_swipeLayout = (SwipeRefreshLayout) view.findViewById(R.id.headlines_swipe_container);
|
m_swipeLayout = (SwipeRefreshLayout) view.findViewById(R.id.headlines_swipe_container);
|
||||||
|
|
||||||
m_swipeLayout.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
|
m_swipeLayout.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onRefresh() {
|
public void onRefresh() {
|
||||||
@ -415,7 +415,7 @@ public class HeadlinesFragment extends Fragment implements OnItemClickListener,
|
|||||||
if (m_activity != null && m_feed != null) {
|
if (m_activity != null && m_feed != null) {
|
||||||
m_refreshInProgress = true;
|
m_refreshInProgress = true;
|
||||||
|
|
||||||
m_swipeLayout.setRefreshing(true);
|
if (m_swipeLayout != null) m_swipeLayout.setRefreshing(true);
|
||||||
m_activity.setProgressBarVisibility(true);
|
m_activity.setProgressBarVisibility(true);
|
||||||
|
|
||||||
if (!m_feed.equals(GlobalState.getInstance().m_activeFeed)) {
|
if (!m_feed.equals(GlobalState.getInstance().m_activeFeed)) {
|
||||||
@ -463,7 +463,7 @@ public class HeadlinesFragment extends Fragment implements OnItemClickListener,
|
|||||||
super.onPostExecute(result);
|
super.onPostExecute(result);
|
||||||
|
|
||||||
if (isAdded()) {
|
if (isAdded()) {
|
||||||
m_swipeLayout.setRefreshing(false);
|
if (m_swipeLayout != null) m_swipeLayout.setRefreshing(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (result != null) {
|
if (result != null) {
|
||||||
|
@ -246,8 +246,8 @@ public class OfflineHeadlinesFragment extends Fragment implements OnItemClickLis
|
|||||||
public void refresh() {
|
public void refresh() {
|
||||||
try {
|
try {
|
||||||
if (!isAdded()) return;
|
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();
|
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.changeCursor(m_cursor);
|
||||||
m_adapter.notifyDataSetChanged();
|
m_adapter.notifyDataSetChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
m_swipeLayout.setRefreshing(false);
|
if (m_swipeLayout != null) m_swipeLayout.setRefreshing(false);
|
||||||
|
|
||||||
} catch (NullPointerException e) {
|
} catch (NullPointerException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user