try to automatically refresh headlines while going through articlepager
add missing dummy_fragment.xml
This commit is contained in:
parent
e9fa47175c
commit
130d1ec845
7
res/layout/dummy_fragment.xml
Normal file
7
res/layout/dummy_fragment.xml
Normal 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>
|
@ -8,12 +8,14 @@ import android.support.v4.app.Fragment;
|
|||||||
import android.support.v4.app.FragmentManager;
|
import android.support.v4.app.FragmentManager;
|
||||||
import android.support.v4.app.FragmentStatePagerAdapter;
|
import android.support.v4.app.FragmentStatePagerAdapter;
|
||||||
import android.support.v4.view.ViewPager;
|
import android.support.v4.view.ViewPager;
|
||||||
|
import android.util.Log;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
|
|
||||||
public class ArticlePager extends Fragment {
|
public class ArticlePager extends Fragment {
|
||||||
|
|
||||||
|
private final String TAG = "ArticlePager";
|
||||||
private PagerAdapter m_adapter;
|
private PagerAdapter m_adapter;
|
||||||
private OnlineServices m_onlineServices;
|
private OnlineServices m_onlineServices;
|
||||||
private HeadlinesFragment m_hf;
|
private HeadlinesFragment m_hf;
|
||||||
@ -85,6 +87,13 @@ public class ArticlePager extends Fragment {
|
|||||||
m_onlineServices.saveArticleUnread(article);
|
m_onlineServices.saveArticleUnread(article);
|
||||||
}
|
}
|
||||||
m_onlineServices.setSelectedArticle(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();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user