summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--res/drawable/tabpageindicator.xml20
-rw-r--r--res/layout/fragment_music_browser_phone.xml13
-rw-r--r--res/values/styles.xml15
-rw-r--r--src/com/cyngn/eleven/ui/fragments/phone/MusicBrowserPhoneFragment.java29
4 files changed, 40 insertions, 37 deletions
diff --git a/res/drawable/tabpageindicator.xml b/res/drawable/tabpageindicator.xml
new file mode 100644
index 0000000..2e2baaa
--- /dev/null
+++ b/res/drawable/tabpageindicator.xml
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2008 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+<!-- This shows the drawble when selected, but otherwise shows nothing -->
+<selector xmlns:android="http://schemas.android.com/apk/res/android">
+ <item android:state_selected="true" android:drawable="@drawable/vpi__tab_selected_holo" />
+</selector>
diff --git a/res/layout/fragment_music_browser_phone.xml b/res/layout/fragment_music_browser_phone.xml
index 9df4d3d..582fc66 100644
--- a/res/layout/fragment_music_browser_phone.xml
+++ b/res/layout/fragment_music_browser_phone.xml
@@ -23,18 +23,11 @@
android:layout_width="match_parent"
android:layout_height="match_parent" >
- <com.viewpagerindicator.TitlePageIndicator
- xmlns:tpi="http://schemas.android.com/apk/res-auto"
+ <com.viewpagerindicator.TabPageIndicator
android:id="@+id/fragment_home_phone_pager_titles"
android:background="@color/tpi_background_color"
- android:layout_width="match_parent"
- android:layout_height="@dimen/tpi_height"
- android:textColor="@color/tpi_text_color"
- tpi:boldAll="true"
- tpi:selectedColor="@color/tpi_selected_text_color"
- tpi:footerLineHeight="@dimen/tpi_footer_line_height"
- tpi:footerIndicatorHeight="@dimen/tpi_footer_indicator_height"
- android:textSize="@dimen/tpi_text_size" />
+ android:layout_width="wrap_content"
+ android:layout_height="@dimen/tpi_height" />
<android.support.v4.view.ViewPager
android:id="@+id/fragment_home_phone_pager"
diff --git a/res/values/styles.xml b/res/values/styles.xml
index 7a43cdc..4b4f0d3 100644
--- a/res/values/styles.xml
+++ b/res/values/styles.xml
@@ -27,6 +27,7 @@
<item name="android:actionOverflowButtonStyle">@style/ActionOverFlowButton</item>
<item name="android:actionBarWidgetTheme">@style/ActionBarWidgetTheme</item>
<item name="android:homeAsUpIndicator">@drawable/ic_action_back</item>
+ <item name="vpiTabPageIndicatorStyle">@style/Eleven.TabPageIndicator</item>
</style>
<style name="ActionBarWidgetTheme" parent="@android:style/Theme.Holo">
@@ -225,8 +226,18 @@
<item name="android:scaleType">centerInside</item>
</style>
- <style name="BottomActionBarItem.Play" parent="@style/BottomActionBarItem">
-
+ <style name="Eleven.TabPageIndicator" parent="@style/Widget">
+ <item name="android:gravity">center</item>
+ <item name="android:background">@drawable/tabpageindicator</item>
+ <item name="android:paddingLeft">22dp</item>
+ <item name="android:paddingRight">22dp</item>
+ <item name="android:textAppearance">@style/Eleven.TextAppearance.TabPageIndicator</item>
+ <item name="android:textSize">@dimen/tpi_text_size</item>
+ <item name="android:maxLines">1</item>
</style>
+ <style name="Eleven.TextAppearance.TabPageIndicator" parent="Widget">
+ <item name="android:textStyle">bold</item>
+ <item name="android:textColor">@color/tpi_text_color</item>
+ </style>
</resources>
diff --git a/src/com/cyngn/eleven/ui/fragments/phone/MusicBrowserPhoneFragment.java b/src/com/cyngn/eleven/ui/fragments/phone/MusicBrowserPhoneFragment.java
index ba392a1..f496bdf 100644
--- a/src/com/cyngn/eleven/ui/fragments/phone/MusicBrowserPhoneFragment.java
+++ b/src/com/cyngn/eleven/ui/fragments/phone/MusicBrowserPhoneFragment.java
@@ -29,8 +29,7 @@ import com.cyngn.eleven.ui.fragments.SongFragment;
import com.cyngn.eleven.utils.MusicUtils;
import com.cyngn.eleven.utils.PreferenceUtils;
import com.cyngn.eleven.utils.SortOrder;
-import com.viewpagerindicator.TitlePageIndicator;
-import com.viewpagerindicator.TitlePageIndicator.OnCenterItemClickListener;
+import com.viewpagerindicator.TabPageIndicator;
/**
* This class is used to hold the {@link ViewPager} used for swiping between the
@@ -44,8 +43,7 @@ import com.viewpagerindicator.TitlePageIndicator.OnCenterItemClickListener;
* Apollo for a couple of weeks or so before merging it with CM.
* @author Andrew Neal (andrewdneal@gmail.com)
*/
-public class MusicBrowserPhoneFragment extends BaseFragment implements
- OnCenterItemClickListener {
+public class MusicBrowserPhoneFragment extends BaseFragment {
/**
* Pager
@@ -108,12 +106,10 @@ public class MusicBrowserPhoneFragment extends BaseFragment implements
mViewPager.setCurrentItem(mPreferences.getStartPage());
// Initialze the TPI
- final TitlePageIndicator pageIndicator = (TitlePageIndicator)mRootView
+ final TabPageIndicator pageIndicator = (TabPageIndicator)mRootView
.findViewById(R.id.fragment_home_phone_pager_titles);
// Attach the ViewPager
pageIndicator.setViewPager(mViewPager);
- // Scroll to the current artist, album, or song
- pageIndicator.setOnCenterItemClickListener(this);
}
/**
@@ -261,23 +257,6 @@ public class MusicBrowserPhoneFragment extends BaseFragment implements
return super.onOptionsItemSelected(item);
}
- /**
- * {@inheritDoc}
- */
- @Override
- public void onCenterItemClick(final int position) {
- // If on the artist fragment, scrolls to the current artist
- if (position == MusicFragments.ARTIST.ordinal()) {
- getArtistFragment().scrollToCurrentArtist();
- // If on the album fragment, scrolls to the current album
- } else if (position == MusicFragments.ALBUM.ordinal()) {
- getAlbumFragment().scrollToCurrentAlbum();
- // If on the song fragment, scrolls to the current song
- } else if (position == MusicFragments.SONG.ordinal()) {
- getSongFragment().scrollToCurrentSong();
- }
- }
-
private boolean isArtistPage() {
return mViewPager.getCurrentItem() == MusicFragments.ARTIST.ordinal();
}
@@ -310,4 +289,4 @@ public class MusicBrowserPhoneFragment extends BaseFragment implements
private boolean isPlaylistPage() {
return mViewPager.getCurrentItem() == MusicFragments.PLAYLIST.ordinal();
}
-} \ No newline at end of file
+}