try to automatically refresh headlines while going through articlepager

add missing dummy_fragment.xml
This commit is contained in:
Andrew Dolgov 2012-06-20 13:12:46 +04:00
parent e9fa47175c
commit 130d1ec845
2 changed files with 16 additions and 0 deletions

View File

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/dummy_fragment"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
</FrameLayout>

View File

@ -8,12 +8,14 @@ import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentStatePagerAdapter;
import android.support.v4.view.ViewPager;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
public class ArticlePager extends Fragment {
private final String TAG = "ArticlePager";
private PagerAdapter m_adapter;
private OnlineServices m_onlineServices;
private HeadlinesFragment m_hf;
@ -85,6 +87,13 @@ public class ArticlePager extends Fragment {
m_onlineServices.saveArticleUnread(article);
}
m_onlineServices.setSelectedArticle(article);
//Log.d(TAG, "Page #" + position + "/" + m_adapter.getCount());
if (position == m_adapter.getCount() - 5) {
m_hf.refresh(true);
m_adapter.notifyDataSetChanged();
}
}
}
});