author | Sriram Ramasubramanian <sriram@mozilla.com> |
Wed, 15 May 2013 16:41:08 -0700 | |
changeset 143298 | 0f895e8c3d7f123878fa31c8745eb2db5be22bea |
parent 143297 | 9ab2cb00222facafdfa53dce2029dc25ad5f5e7a |
child 143299 | d334d36b5cf64211eb1d0edb806a15c36bff3b30 |
push id | 25130 |
push user | lrocha@mozilla.com |
push date | Wed, 21 Aug 2013 09:41:27 +0000 |
treeherder | mozilla-central@b2486721572e [default view] [failures only] |
perfherder | [talos] [build metrics] [platform microbench] (compared to previous push) |
reviewers | margaret |
bugs | 872762 |
milestone | 24.0a1 |
first release with | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
last release without | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
--- a/mobile/android/base/BrowserApp.java +++ b/mobile/android/base/BrowserApp.java @@ -358,17 +358,17 @@ abstract public class BrowserApp extends } else { mHomePager.requestFocus(); } } return false; } }); - mHomePager = (HomePager) findViewById(R.id.abouthome_pager); + mHomePager = (HomePager) findViewById(R.id.home_pager); mBrowserToolbar = new BrowserToolbar(this); mBrowserToolbar.from(actionBar); // Intercept key events for gamepad shortcuts actionBar.setOnKeyListener(this); if (mTabsPanel != null) {
--- a/mobile/android/base/Makefile.in +++ b/mobile/android/base/Makefile.in @@ -216,16 +216,17 @@ FENNEC_JAVA_FILES = \ gfx/TextLayer.java \ gfx/TextureGenerator.java \ gfx/TextureReaper.java \ gfx/TileLayer.java \ gfx/TouchEventHandler.java \ gfx/ViewTransform.java \ gfx/VirtualLayer.java \ home/HomePager.java \ + home/HomePagerTabStrip.java \ widget/AboutHome.java \ widget/AboutHomeView.java \ widget/AboutHomeSection.java \ widget/AddonsSection.java \ widget/DateTimePicker.java \ widget/FaviconView.java \ widget/IconTabWidget.java \ widget/LastTabsSection.java \
--- a/mobile/android/base/home/HomePager.java +++ b/mobile/android/base/home/HomePager.java @@ -43,17 +43,17 @@ public class HomePager extends ViewPager /** * Loads and initializes the pager. * * @param fm FragmentManager for the adapter */ public void show(FragmentManager fm) { mLoaded = true; TabsAdapter adapter = new TabsAdapter(fm); - adapter.addTab(Page.ABOUT_HOME, AboutHome.class, null); + adapter.addTab(Page.ABOUT_HOME, AboutHome.class, null, ""); setAdapter(adapter); setVisibility(VISIBLE); } /** * Hides the pager and removes all child fragments. */ public void hide() { @@ -96,46 +96,54 @@ public class HomePager extends ViewPager class TabsAdapter extends FragmentStatePagerAdapter { private final ArrayList<TabInfo> mTabs = new ArrayList<TabInfo>(); final class TabInfo { private final Page page; private final Class<?> clss; private final Bundle args; + private final String title; - TabInfo(Page page, Class<?> clss, Bundle args) { + TabInfo(Page page, Class<?> clss, Bundle args, String title) { this.page = page; this.clss = clss; this.args = args; + this.title = title; } } public TabsAdapter(FragmentManager fm) { super(fm); } - public void addTab(Page page, Class<?> clss, Bundle args) { - TabInfo info = new TabInfo(page, clss, args); + public void addTab(Page page, Class<?> clss, Bundle args, String title) { + TabInfo info = new TabInfo(page, clss, args, title); mTabs.add(info); notifyDataSetChanged(); } @Override public int getCount() { return mTabs.size(); } @Override public Fragment getItem(int position) { TabInfo info = mTabs.get(position); return Fragment.instantiate(mContext, info.clss.getName(), info.args); } @Override + public CharSequence getPageTitle(int position) { + TabInfo info = mTabs.get(position); + return info.title.toUpperCase(); + } + + @Override public Object instantiateItem(ViewGroup container, int position) { Fragment fragment = (Fragment) super.instantiateItem(container, position); mPages.put(mTabs.get(position).page, fragment); return fragment; }
new file mode 100644 --- /dev/null +++ b/mobile/android/base/home/HomePagerTabStrip.java @@ -0,0 +1,35 @@ +/* -*- Mode: Java; c-basic-offset: 4; tab-width: 20; indent-tabs-mode: nil; -*- + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +package org.mozilla.gecko.home; + +import android.content.Context; +import android.content.res.TypedArray; +import android.support.v4.view.PagerTabStrip; +import android.util.AttributeSet; + +import org.mozilla.gecko.R; + +/** + * HomePagerTabStrip is a custom implementation of PagerTabStrip + * that exposes XML attributes for the public methods. + */ + +public class HomePagerTabStrip extends PagerTabStrip { + + public HomePagerTabStrip(Context context) { + super(context); + } + + public HomePagerTabStrip(Context context, AttributeSet attrs) { + super(context, attrs); + + TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.HomePagerTabStrip); + int color = a.getColor(R.styleable.HomePagerTabStrip_tabIndicatorColor, 0x00); + a.recycle(); + + setTabIndicatorColor(color); + } +}
--- a/mobile/android/base/resources/layout/gecko_app.xml +++ b/mobile/android/base/resources/layout/gecko_app.xml @@ -1,14 +1,15 @@ <?xml version="1.0" encoding="utf-8"?> <!-- This Source Code Form is subject to the terms of the Mozilla Public - License, v. 2.0. If a copy of the MPL was not distributed with this - file, You can obtain one at http://mozilla.org/MPL/2.0/. --> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" + xmlns:gecko="http://schemas.android.com/apk/res-auto" android:layout_width="fill_parent" android:layout_height="fill_parent"> <org.mozilla.gecko.TabsPanel android:id="@+id/tabs_panel" android:layout_width="fill_parent" android:layout_height="fill_parent" android:background="@color/background_tabs" android:visibility="invisible"/> @@ -23,21 +24,31 @@ <RelativeLayout android:id="@+id/gecko_layout" android:layout_width="fill_parent" android:layout_height="fill_parent" android:layout_above="@+id/find_in_page"> <include layout="@layout/shared_ui_components"/> - <org.mozilla.gecko.home.HomePager android:id="@+id/abouthome_pager" + <org.mozilla.gecko.home.HomePager android:id="@+id/home_pager" android:layout_width="fill_parent" android:layout_height="fill_parent" android:background="@color/background_normal" - android:visibility="gone"/> + android:visibility="gone"> + + <org.mozilla.gecko.home.HomePagerTabStrip android:layout_width="fill_parent" + android:layout_height="32dip" + android:layout_gravity="top" + android:gravity="bottom" + android:background="#FFECF0F3" + gecko:tabIndicatorColor="@color/text_color_highlight" + android:textAppearance="@style/TextAppearance.Widget.HomePagerTabStrip"/> + + </org.mozilla.gecko.home.HomePager> </RelativeLayout> <org.mozilla.gecko.FindInPageBar android:id="@+id/find_in_page" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_alignParentBottom="true" style="@style/FindBar"
--- a/mobile/android/base/resources/values/attrs.xml +++ b/mobile/android/base/resources/values/attrs.xml @@ -159,10 +159,14 @@ <declare-styleable name="IconTabWidget"> <attr name="display"> <flag name="text" value="0x00" /> <flag name="icon" value="0x01" /> </attr> </declare-styleable> + <declare-styleable name="HomePagerTabStrip"> + <attr name="tabIndicatorColor" format="color"/> + </declare-styleable> + </resources>
--- a/mobile/android/base/resources/values/styles.xml +++ b/mobile/android/base/resources/values/styles.xml @@ -152,16 +152,20 @@ <style name="TextAppearance.Widget.EditText"> <item name="android:textColor">@color/primary_text</item> </style> <style name="TextAppearance.Widget.TextView"> <item name="android:textColor">@color/primary_text</item> </style> + <style name="TextAppearance.Widget.HomePagerTabStrip" parent="TextAppearance.Small"> + <item name="android:textColor">?android:attr/textColorHint</item> + </style> + <!-- BrowserToolbar --> <style name="BrowserToolbar"> <item name="android:layout_width">fill_parent</item> <item name="android:layout_height">@dimen/browser_toolbar_height</item> <item name="android:orientation">horizontal</item> </style> <style name="AddressBar.ImageButton.TabCount">