Bug 873579: Remove existing vertical about:home view. [r=bnicholson]

This commit is contained in:
Sriram Ramasubramanian 2013-05-29 11:31:52 -07:00
parent 264594d237
commit 2ff01ea490
6 changed files with 19 additions and 28 deletions

View File

@ -73,6 +73,8 @@ public class Tab {
public static final int STATE_SUCCESS = 2;
public static final int STATE_ERROR = 3;
private static final int DEFAULT_BACKGROUND_COLOR = Color.WHITE;
public Tab(Context context, int id, String url, boolean external, int parentId, String title) {
mContext = context;
mId = id;
@ -106,7 +108,7 @@ public class Tab {
// At startup, the background is set to a color specified by LayerView
// when the LayerView is created. Shortly after, this background color
// will be used before the tab's content is shown.
mBackgroundColor = getBackgroundColorForUrl(url);
mBackgroundColor = DEFAULT_BACKGROUND_COLOR;
}
private ContentResolver getContentResolver() {
@ -589,7 +591,7 @@ public class Tab {
setReaderEnabled(false);
setZoomConstraints(new ZoomConstraints(true));
setHasTouchListeners(false);
setBackgroundColor(getBackgroundColorForUrl(uri));
setBackgroundColor(DEFAULT_BACKGROUND_COLOR);
Tabs.getInstance().notifyListeners(this, Tabs.TabEvents.LOCATION_CHANGE, uri);
}
@ -598,13 +600,6 @@ public class Tab {
return "about:home".equals(url) || ReaderModeUtils.isAboutReader(url);
}
private int getBackgroundColorForUrl(String url) {
if ("about:home".equals(url)) {
return mContext.getResources().getColor(R.color.background_normal);
}
return Color.WHITE;
}
void handleDocumentStart(boolean showProgress, String url) {
setState(shouldShowProgress(url) ? STATE_SUCCESS : STATE_LOADING);
updateIdentityData(null);

View File

@ -215,7 +215,7 @@ public class LayerView extends FrameLayout {
// created, and it will be shown immediately at startup. Shortly
// after, the tab's background color will be used before any content
// is shown.
mTextureView.setBackgroundResource(R.color.background_normal);
mTextureView.setBackgroundColor(Color.WHITE);
addView(mTextureView, ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT);
} else {
// This will stop PropertyAnimator from creating a drawing cache (i.e. a bitmap)
@ -223,7 +223,7 @@ public class LayerView extends FrameLayout {
setWillNotCacheDrawing(false);
mSurfaceView = new LayerSurfaceView(getContext(), this);
mSurfaceView.setBackgroundResource(R.color.background_normal);
mSurfaceView.setBackgroundColor(Color.WHITE);
addView(mSurfaceView, ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT);
SurfaceHolder holder = mSurfaceView.getHolder();

View File

@ -5,9 +5,7 @@
package org.mozilla.gecko.home;
import java.util.ArrayList;
import java.util.EnumMap;
import java.util.EnumSet;
import org.mozilla.gecko.widget.AboutHome;
import android.content.Context;
import android.os.Bundle;
@ -18,14 +16,16 @@ import android.support.v4.view.ViewPager;
import android.util.AttributeSet;
import android.view.ViewGroup;
import org.mozilla.gecko.widget.AboutHome;
import java.util.ArrayList;
import java.util.EnumMap;
import java.util.EnumSet;
public class HomePager extends ViewPager {
private final Context mContext;
private volatile boolean mLoaded;
// List of pages in order.
private enum Page {
ABOUT_HOME
}
private EnumMap<Page, Fragment> mPages = new EnumMap<Page, Fragment>(Page.class);
@ -48,7 +48,9 @@ public class HomePager extends ViewPager {
public void show(FragmentManager fm) {
mLoaded = true;
TabsAdapter adapter = new TabsAdapter(fm);
adapter.addTab(Page.ABOUT_HOME, AboutHome.class, null, "");
// Add the pages to the adapter in order.
setAdapter(adapter);
setVisibility(VISIBLE);
}
@ -78,20 +80,14 @@ public class HomePager extends ViewPager {
* @see AboutHome#update(EnumSet)
*/
public void updateAboutHome(final EnumSet<AboutHome.UpdateFlags> flags) {
AboutHome aboutHome = (AboutHome) mPages.get(Page.ABOUT_HOME);
if (aboutHome != null) {
aboutHome.update(flags);
}
// FIXME: Individual sections should update based on the flags.
}
/**
* @see AboutHome#setLastTabsVisibility(boolean)
*/
public void setAboutHomeLastTabsVisibility(boolean visible) {
AboutHome aboutHome = (AboutHome) mPages.get(Page.ABOUT_HOME);
if (aboutHome != null) {
aboutHome.setLastTabsVisibility(visible);
}
// FIXME: Page handling last tabs should update it.
}
class TabsAdapter extends FragmentStatePagerAdapter {

View File

@ -30,7 +30,7 @@
<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:background="@android:color/white"
android:visibility="gone">
<org.mozilla.gecko.home.HomePagerTabStrip android:layout_width="fill_parent"

View File

@ -39,7 +39,7 @@
Activity based themes.
-->
<style name="Gecko.App">
<item name="android:windowBackground">@color/background_normal</item>
<item name="android:windowBackground">@android:color/white</item>
<item name="android:panelBackground">@drawable/menu_panel_bg</item>
<item name="android:listViewStyle">@style/Widget.ListView</item>
</style>

View File

@ -76,7 +76,7 @@
Activity based themes.
-->
<style name="Gecko.App">
<item name="android:windowBackground">@color/background_normal</item>
<item name="android:windowBackground">@android:color/white</item>
<item name="android:buttonStyle">@style/Widget.Button</item>
<item name="android:dropDownItemStyle">@style/Widget.DropDownItem</item>
<item name="android:editTextStyle">@style/Widget.EditText</item>