offline: workaround against crashes in fragment refreshes
This commit is contained in:
parent
caef01010f
commit
124c791ab8
@ -1,8 +1,8 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
package="org.fox.ttrss"
|
package="org.fox.ttrss"
|
||||||
android:versionCode="183"
|
android:versionCode="184"
|
||||||
android:versionName="1.8.3" >
|
android:versionName="1.8.4" >
|
||||||
|
|
||||||
<uses-sdk
|
<uses-sdk
|
||||||
android:minSdkVersion="8"
|
android:minSdkVersion="8"
|
||||||
|
@ -121,13 +121,19 @@ public class OfflineFeedsFragment extends Fragment implements OnItemClickListene
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void refresh() {
|
public void refresh() {
|
||||||
if (m_cursor != null && !m_cursor.isClosed()) m_cursor.close();
|
try {
|
||||||
|
if (!isAdded()) return;
|
||||||
m_cursor = createCursor();
|
|
||||||
|
if (m_cursor != null && !m_cursor.isClosed()) m_cursor.close();
|
||||||
if (m_cursor != null) {
|
|
||||||
m_adapter.changeCursor(m_cursor);
|
m_cursor = createCursor();
|
||||||
m_adapter.notifyDataSetChanged();
|
|
||||||
|
if (m_cursor != null && m_adapter != null) {
|
||||||
|
m_adapter.changeCursor(m_cursor);
|
||||||
|
m_adapter.notifyDataSetChanged();
|
||||||
|
}
|
||||||
|
} catch (NullPointerException e) {
|
||||||
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -256,13 +256,19 @@ public class OfflineHeadlinesFragment extends Fragment implements OnItemClickLis
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void refresh() {
|
public void refresh() {
|
||||||
if (m_cursor != null && !m_cursor.isClosed()) m_cursor.close();
|
try {
|
||||||
|
if (!isAdded()) return;
|
||||||
m_cursor = createCursor();
|
|
||||||
|
if (m_cursor != null && !m_cursor.isClosed()) m_cursor.close();
|
||||||
if (m_cursor != null) {
|
|
||||||
m_adapter.changeCursor(m_cursor);
|
m_cursor = createCursor();
|
||||||
m_adapter.notifyDataSetChanged();
|
|
||||||
|
if (m_cursor != null && m_adapter != null) {
|
||||||
|
m_adapter.changeCursor(m_cursor);
|
||||||
|
m_adapter.notifyDataSetChanged();
|
||||||
|
}
|
||||||
|
} catch (NullPointerException e) {
|
||||||
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user