diff options
author | linus_lee <llee@cyngn.com> | 2014-10-08 16:19:20 -0700 |
---|---|---|
committer | linus_lee <llee@cyngn.com> | 2014-11-20 12:51:32 -0800 |
commit | 5f0a300f87d70ab85f2e85a03b0818ea75c57a7b (patch) | |
tree | f0f6edabd6d003a4bbfa1337c8ad120d1e4cfb4d | |
parent | 2e720d9e87b41248bab1a3baa4552103038b0541 (diff) | |
download | android_packages_apps_Eleven-5f0a300f87d70ab85f2e85a03b0818ea75c57a7b.tar.gz android_packages_apps_Eleven-5f0a300f87d70ab85f2e85a03b0818ea75c57a7b.tar.bz2 android_packages_apps_Eleven-5f0a300f87d70ab85f2e85a03b0818ea75c57a7b.zip |
Eleven: Update top tab bar to be closer to the spec
https://cyanogen.atlassian.net/browse/MUSIC-82
https://cyanogen.atlassian.net/browse/MUSIC-81
https://cyanogen.atlassian.net/browse/MUSIC-80
Change-Id: I890392fd0b3f937a386b969fc7da867cf0442b54
-rw-r--r-- | res/drawable/tabpageindicator.xml | 20 | ||||
-rw-r--r-- | res/layout/fragment_music_browser_phone.xml | 13 | ||||
-rw-r--r-- | res/values/styles.xml | 15 | ||||
-rw-r--r-- | src/com/cyngn/eleven/ui/fragments/phone/MusicBrowserPhoneFragment.java | 29 |
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 +} |