summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--AndroidManifest.xml2
-rw-r--r--project.properties1
-rw-r--r--res/layout/main.xml9
-rw-r--r--res/values/styles.xml14
-rw-r--r--src/de/podfetcher/activity/PodfetcherActivity.java29
5 files changed, 49 insertions, 6 deletions
diff --git a/AndroidManifest.xml b/AndroidManifest.xml
index f5af6ed1d..9d296eb81 100644
--- a/AndroidManifest.xml
+++ b/AndroidManifest.xml
@@ -18,7 +18,7 @@
android:name="de.podfetcher.PodcastApp">
<activity
android:label="@string/app_name"
- android:name="de.podfetcher.activity.PodfetcherActivity" >
+ android:name="de.podfetcher.activity.PodfetcherActivity" android:theme="@style/StyledIndicators">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
diff --git a/project.properties b/project.properties
index 62be9be8e..bdd48aa7e 100644
--- a/project.properties
+++ b/project.properties
@@ -10,3 +10,4 @@
# Project target.
target=android-14
android.library.reference.1=../actionbarsherlock/library/
+android.library.reference.2=../Android-ViewPagerIndicator/library
diff --git a/res/layout/main.xml b/res/layout/main.xml
index 6c578105e..1ab614050 100644
--- a/res/layout/main.xml
+++ b/res/layout/main.xml
@@ -1,9 +1,16 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
- android:id="@+id/main_view"
+ android:id="@+id/main_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
+
+ <com.viewpagerindicator.TabPageIndicator
+ android:id="@+id/tabs"
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content"
+ />
+
<android.support.v4.view.ViewPager
android:id="@+id/viewpager"
android:layout_width="match_parent"
diff --git a/res/values/styles.xml b/res/values/styles.xml
new file mode 100644
index 000000000..c4238d984
--- /dev/null
+++ b/res/values/styles.xml
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="utf-8"?>
+<resources xmlns:android="http://schemas.android.com/apk/res/android">
+
+ <style name="PodTheme" parent="@style/Theme.Sherlock.Light.ForceOverflow">
+ <item name="vpiTabPageIndicatorStyle">@style/Widget.TabPageIndicator</item>
+ </style>
+
+ <style name="StyledIndicators" parent="PodTheme">
+ <item name="vpiTabPageIndicatorStyle">@style/Widget.TabPageIndicator</item>
+ <item name="android:textColor">@color/black</item>
+ </style>
+
+
+</resources> \ No newline at end of file
diff --git a/src/de/podfetcher/activity/PodfetcherActivity.java b/src/de/podfetcher/activity/PodfetcherActivity.java
index 3feab2c10..03df51772 100644
--- a/src/de/podfetcher/activity/PodfetcherActivity.java
+++ b/src/de/podfetcher/activity/PodfetcherActivity.java
@@ -23,6 +23,7 @@ import com.actionbarsherlock.app.SherlockFragmentActivity;
import com.actionbarsherlock.view.Menu;
import com.actionbarsherlock.view.MenuInflater;
import com.actionbarsherlock.view.MenuItem;
+import com.viewpagerindicator.TabPageIndicator;
import de.podfetcher.R;
import de.podfetcher.feed.FeedManager;
@@ -39,6 +40,7 @@ public class PodfetcherActivity extends SherlockFragmentActivity {
private FeedManager manager;
private ViewPager viewpager;
private MainPagerAdapter pagerAdapter;
+ private TabPageIndicator tabs;
@Override
public void onCreate(Bundle savedInstanceState) {
@@ -46,13 +48,15 @@ public class PodfetcherActivity extends SherlockFragmentActivity {
manager = FeedManager.getInstance();
requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);
setContentView(R.layout.main);
- // Set up tabs
ActionBar actionBar = getSupportActionBar();
- //actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);
actionBar.setDisplayShowTitleEnabled(false);
- pagerAdapter = new MainPagerAdapter(getSupportFragmentManager());
+ pagerAdapter = new MainPagerAdapter(getSupportFragmentManager(), this);
+
viewpager = (ViewPager) findViewById(R.id.viewpager);
+ tabs = (TabPageIndicator) findViewById(R.id.tabs);
+
viewpager.setAdapter(pagerAdapter);
+ tabs.setViewPager(viewpager);
}
@Override
@@ -137,9 +141,12 @@ public class PodfetcherActivity extends SherlockFragmentActivity {
private static final int POS_FEEDLIST = 0;
private static final int POS_NEW_ITEMS = 1;
private static final int POS_QUEUE = 2;
+
+ private Context context;
- public MainPagerAdapter(FragmentManager fm) {
+ public MainPagerAdapter(FragmentManager fm, Context context) {
super(fm);
+ this.context = context;
}
@Override
@@ -160,6 +167,20 @@ public class PodfetcherActivity extends SherlockFragmentActivity {
public int getCount() {
return NUM_ITEMS;
}
+
+ @Override
+ public CharSequence getPageTitle(int position) {
+ switch (position) {
+ case POS_FEEDLIST:
+ return context.getString(R.string.feeds_label);
+ case POS_NEW_ITEMS:
+ return context.getString(R.string.new_label);
+ case POS_QUEUE:
+ return context.getString(R.string.queue_label);
+ default:
+ return null;
+ }
+ }
}
}