integrate viewpagerindicator to display feed reading progress

This commit is contained in:
Andrew Dolgov 2013-04-16 22:00:59 +04:00
parent 5b76e9c2ab
commit f10c37563a
4 changed files with 36 additions and 9 deletions

View File

@ -9,3 +9,4 @@
# Project target.
target=android-17
android.library.reference.1=../Android-ViewPagerIndicator/library

View File

@ -1,9 +1,22 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/article_pager_container"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<android.support.v4.view.ViewPager
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/article_pager"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:id="@+id/article_pager">
android:layout_alignParentTop="true" >
</android.support.v4.view.ViewPager>
<com.viewpagerindicator.UnderlinePageIndicator
android:id="@+id/article_titles"
android:layout_width="fill_parent"
android:layout_height="2dp"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true" />
</RelativeLayout>

View File

@ -24,6 +24,8 @@ import android.view.ViewGroup;
import android.view.WindowManager;
import com.google.gson.JsonElement;
import com.viewpagerindicator.TitlePageIndicator;
import com.viewpagerindicator.UnderlinePageIndicator;
public class ArticlePager extends Fragment {
@ -101,8 +103,13 @@ public class ArticlePager extends Fragment {
m_activity.setProgressBarVisibility(true);
pager.setAdapter(m_adapter);
UnderlinePageIndicator indicator = (UnderlinePageIndicator)view.findViewById(R.id.article_titles);
indicator.setViewPager(pager);
pager.setCurrentItem(position);
pager.setOnPageChangeListener(new ViewPager.OnPageChangeListener() {
indicator.setOnPageChangeListener(new ViewPager.OnPageChangeListener() {
@Override
public void onPageScrollStateChanged(int arg0) {

View File

@ -2,6 +2,8 @@ package org.fox.ttrss.offline;
import org.fox.ttrss.R;
import com.viewpagerindicator.UnderlinePageIndicator;
import android.app.Activity;
import android.content.SharedPreferences;
import android.database.Cursor;
@ -171,8 +173,12 @@ public class OfflineArticlePager extends Fragment {
ViewPager pager = (ViewPager) view.findViewById(R.id.article_pager);
pager.setAdapter(m_adapter);
UnderlinePageIndicator indicator = (UnderlinePageIndicator)view.findViewById(R.id.article_titles);
indicator.setViewPager(pager);
pager.setCurrentItem(position);
pager.setOnPageChangeListener(new ViewPager.OnPageChangeListener() {
indicator.setOnPageChangeListener(new ViewPager.OnPageChangeListener() {
@Override
public void onPageScrollStateChanged(int arg0) {