Bug 965361 - Show firefox watermark when you hide all panels in about:home (r=lucasr)

This commit is contained in:
Sola Ogunsakin 2014-02-12 21:52:47 -08:00
parent 862b3a6da9
commit c4a076a416
5 changed files with 33 additions and 2 deletions

View File

@ -14,6 +14,7 @@ import org.mozilla.gecko.home.HomeConfig.PanelType;
import org.mozilla.gecko.util.HardwareUtils;
import android.content.Context;
import android.graphics.drawable.Drawable;
import android.os.Build;
import android.os.Bundle;
import android.support.v4.app.Fragment;
@ -51,6 +52,9 @@ public class HomePager extends ViewPager {
// Whether or not we need to restart the loader when we show the HomePager.
private boolean mRestartLoader;
// Cached original ViewPager background.
private final Drawable mOriginalBackground;
// This is mostly used by UI tests to easily fetch
// specific list views at runtime.
static final String LIST_TAG_HISTORY = "history";
@ -122,6 +126,8 @@ public class HomePager extends ViewPager {
// ensure there is always a focusable view. This would ordinarily be done via an XML
// attribute, but it is not working properly.
setFocusableInTouchMode(true);
mOriginalBackground = getBackground();
}
@Override
@ -310,9 +316,18 @@ public class HomePager extends ViewPager {
// Update the adapter with the new panel configs
adapter.update(enabledPanels);
// Hide the tab strip if the new configuration contains no panels.
final int count = enabledPanels.size();
mTabStrip.setVisibility(count > 0 ? View.VISIBLE : View.INVISIBLE);
if (count == 0) {
// Set firefox watermark as background.
setBackgroundResource(R.drawable.home_pager_empty_state);
// Hide the tab strip as there are no panels.
mTabStrip.setVisibility(View.INVISIBLE);
} else {
mTabStrip.setVisibility(View.VISIBLE);
// Restore original background.
setBackground(mOriginalBackground);
}
// Re-install the adapter with the final state
// in the pager.
setAdapter(adapter);

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.1 KiB

View File

@ -0,0 +1,16 @@
<?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/. -->
<layer-list xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:gecko="http://schemas.android.com/apk/res-auto">
<item android:maxLevel="0" android:drawable="@android:color/white"/>
<item>
<bitmap android:src="@drawable/icon_home_empty_firefox"
android:gravity="center"/>
</item>
</layer-list>