diff options
Diffstat (limited to 'org.fox.ttrss')
3 files changed, 48 insertions, 4 deletions
diff --git a/org.fox.ttrss/src/main/AndroidManifest.xml b/org.fox.ttrss/src/main/AndroidManifest.xml index b13c76a6..bbd26b4e 100644 --- a/org.fox.ttrss/src/main/AndroidManifest.xml +++ b/org.fox.ttrss/src/main/AndroidManifest.xml @@ -1,8 +1,8 @@ <?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="org.fox.ttrss" - android:versionCode="242" - android:versionName="1.43" > + android:versionCode="243" + android:versionName="1.44" > <uses-sdk android:minSdkVersion="8" diff --git a/org.fox.ttrss/src/main/java/org/fox/ttrss/offline/OfflineFeedCategoriesFragment.java b/org.fox.ttrss/src/main/java/org/fox/ttrss/offline/OfflineFeedCategoriesFragment.java index 8fde8176..796c344e 100644 --- a/org.fox.ttrss/src/main/java/org/fox/ttrss/offline/OfflineFeedCategoriesFragment.java +++ b/org.fox.ttrss/src/main/java/org/fox/ttrss/offline/OfflineFeedCategoriesFragment.java @@ -12,6 +12,7 @@ import android.preference.PreferenceManager; import android.provider.BaseColumns; import android.support.v4.app.Fragment; import android.support.v4.widget.SimpleCursorAdapter; +import android.support.v4.widget.SwipeRefreshLayout; import android.util.Log; import android.view.ContextMenu; import android.view.ContextMenu.ContextMenuInfo; @@ -35,6 +36,7 @@ public class OfflineFeedCategoriesFragment extends Fragment implements OnItemCli private int m_selectedCatId; private Cursor m_cursor; private OfflineFeedsActivity m_activity; + private SwipeRefreshLayout m_swipeLayout; @Override public void onCreateContextMenu(ContextMenu menu, View v, @@ -66,6 +68,10 @@ public class OfflineFeedCategoriesFragment extends Fragment implements OnItemCli } public void refresh() { + if (!isAdded()) return; + + if (m_swipeLayout != null) m_swipeLayout.setRefreshing(true); + if (m_cursor != null && !m_cursor.isClosed()) m_cursor.close(); m_cursor = createCursor(); @@ -73,6 +79,7 @@ public class OfflineFeedCategoriesFragment extends Fragment implements OnItemCli if (m_cursor != null && m_adapter != null) { m_adapter.changeCursor(m_cursor); m_adapter.notifyDataSetChanged(); + if (m_swipeLayout != null) m_swipeLayout.setRefreshing(false); } } @@ -134,7 +141,23 @@ public class OfflineFeedCategoriesFragment extends Fragment implements OnItemCli } View view = inflater.inflate(R.layout.feeds_fragment, container, false); - + + m_swipeLayout = (SwipeRefreshLayout) view.findViewById(R.id.feeds_swipe_container); + + m_swipeLayout.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() { + @Override + public void onRefresh() { + refresh(); + } + }); + + if (!m_activity.isCompatMode()) { + m_swipeLayout.setColorScheme(android.R.color.holo_green_dark, + android.R.color.holo_red_dark, + android.R.color.holo_blue_dark, + android.R.color.holo_orange_dark); + } + ListView list = (ListView)view.findViewById(R.id.feeds); m_cursor = createCursor(); diff --git a/org.fox.ttrss/src/main/java/org/fox/ttrss/offline/OfflineFeedsFragment.java b/org.fox.ttrss/src/main/java/org/fox/ttrss/offline/OfflineFeedsFragment.java index 8c04d0cd..06cc79d2 100644 --- a/org.fox.ttrss/src/main/java/org/fox/ttrss/offline/OfflineFeedsFragment.java +++ b/org.fox.ttrss/src/main/java/org/fox/ttrss/offline/OfflineFeedsFragment.java @@ -17,6 +17,7 @@ import android.preference.PreferenceManager; import android.provider.BaseColumns; import android.support.v4.app.Fragment; import android.support.v4.widget.SimpleCursorAdapter; +import android.support.v4.widget.SwipeRefreshLayout; import android.util.Log; import android.view.ContextMenu; import android.view.ContextMenu.ContextMenuInfo; @@ -43,6 +44,7 @@ public class OfflineFeedsFragment extends Fragment implements OnItemClickListene private boolean m_enableFeedIcons; private Cursor m_cursor; private OfflineFeedsActivity m_activity; + private SwipeRefreshLayout m_swipeLayout; public void initialize(int catId) { m_catId = catId; @@ -123,6 +125,8 @@ public class OfflineFeedsFragment extends Fragment implements OnItemClickListene public void refresh() { try { if (!isAdded()) return; + + if (m_swipeLayout != null) m_swipeLayout.setRefreshing(true); if (m_cursor != null && !m_cursor.isClosed()) m_cursor.close(); @@ -131,6 +135,7 @@ public class OfflineFeedsFragment extends Fragment implements OnItemClickListene if (m_cursor != null && m_adapter != null) { m_adapter.changeCursor(m_cursor); m_adapter.notifyDataSetChanged(); + if (m_swipeLayout != null) m_swipeLayout.setRefreshing(false); } } catch (NullPointerException e) { e.printStackTrace(); @@ -146,7 +151,23 @@ public class OfflineFeedsFragment extends Fragment implements OnItemClickListene } View view = inflater.inflate(R.layout.feeds_fragment, container, false); - + + m_swipeLayout = (SwipeRefreshLayout) view.findViewById(R.id.feeds_swipe_container); + + m_swipeLayout.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() { + @Override + public void onRefresh() { + refresh(); + } + }); + + if (!m_activity.isCompatMode()) { + m_swipeLayout.setColorScheme(android.R.color.holo_green_dark, + android.R.color.holo_red_dark, + android.R.color.holo_blue_dark, + android.R.color.holo_orange_dark); + } + ListView list = (ListView)view.findViewById(R.id.feeds); m_cursor = createCursor(); |