| Index: chrome/android/java/src/org/chromium/chrome/browser/customtabs/CustomTabActivity.java
|
| diff --git a/chrome/android/java/src/org/chromium/chrome/browser/customtabs/CustomTabActivity.java b/chrome/android/java/src/org/chromium/chrome/browser/customtabs/CustomTabActivity.java
|
| index 6029bb2d19e6d1f6384bc1e7a455c1b5427fb40b..e4c24b8e33ea1af5a432c595bfbbdeb94a58c7f2 100644
|
| --- a/chrome/android/java/src/org/chromium/chrome/browser/customtabs/CustomTabActivity.java
|
| +++ b/chrome/android/java/src/org/chromium/chrome/browser/customtabs/CustomTabActivity.java
|
| @@ -16,7 +16,9 @@ import android.view.MenuItem;
|
| import android.view.View;
|
| import android.view.View.OnClickListener;
|
| import android.view.ViewGroup;
|
| +import android.view.ViewStub;
|
| import android.view.Window;
|
| +import android.widget.ImageButton;
|
|
|
| import org.chromium.base.ApiCompatibilityUtils;
|
| import org.chromium.base.Log;
|
| @@ -46,6 +48,8 @@ import org.chromium.chrome.browser.tabmodel.TabModelSelectorImpl;
|
| import org.chromium.chrome.browser.toolbar.ToolbarControlContainer;
|
| import org.chromium.chrome.browser.util.ColorUtils;
|
| import org.chromium.chrome.browser.util.IntentUtils;
|
| +import org.chromium.chrome.browser.widget.FadingShadow;
|
| +import org.chromium.chrome.browser.widget.FadingShadowView;
|
| import org.chromium.chrome.browser.widget.findinpage.FindToolbarManager;
|
| import org.chromium.components.dom_distiller.core.DomDistillerUrlUtils;
|
| import org.chromium.content_public.browser.LoadUrlParams;
|
| @@ -53,6 +57,8 @@ import org.chromium.content_public.browser.WebContents;
|
| import org.chromium.content_public.common.Referrer;
|
| import org.chromium.ui.base.PageTransition;
|
|
|
| +import java.util.List;
|
| +
|
| /**
|
| * The activity for custom tabs. It will be launched on top of a client's task.
|
| */
|
| @@ -175,7 +181,7 @@ public class CustomTabActivity extends ChromeActivity {
|
| setTabModelSelector(new TabModelSelectorImpl(this, 0, getWindowAndroid(), false));
|
| getToolbarManager().setCloseButtonDrawable(mIntentDataProvider.getCloseButtonDrawable());
|
| getToolbarManager().setShowTitle(mIntentDataProvider.getTitleVisibilityState()
|
| - == CustomTabIntentDataProvider.SHOW_PAGE_TITLE);
|
| + == CustomTabsIntent.SHOW_PAGE_TITLE);
|
| int toolbarColor = mIntentDataProvider.getToolbarColor();
|
| getToolbarManager().updatePrimaryColor(toolbarColor);
|
| if (toolbarColor != ApiCompatibilityUtils.getColor(
|
| @@ -187,6 +193,7 @@ public class CustomTabActivity extends ChromeActivity {
|
| // Setting task title and icon to be null will preserve the client app's title and icon.
|
| ApiCompatibilityUtils.setTaskDescription(this, null, null, toolbarColor);
|
| showActionButton();
|
| + showBottombarIfNecessary();
|
| }
|
|
|
| @Override
|
| @@ -435,7 +442,7 @@ public class CustomTabActivity extends ChromeActivity {
|
| */
|
| private boolean showActionButton() {
|
| if (!mIntentDataProvider.shouldShowActionButton()) return false;
|
| - ActionButtonParams params = mIntentDataProvider.getActionButtonParams();
|
| + ButtonParams params = mIntentDataProvider.getActionButtonParams();
|
| getToolbarManager().setCustomActionButton(
|
| params.getIcon(getResources()),
|
| params.getDescription(),
|
| @@ -450,6 +457,31 @@ public class CustomTabActivity extends ChromeActivity {
|
| return true;
|
| }
|
|
|
| + /**
|
| + * Inflates the bottom bar {@link ViewStub} and its shadow, and populates it with items.
|
| + */
|
| + private void showBottombarIfNecessary() {
|
| + if (!mIntentDataProvider.shouldShowBottomBar()) return;
|
| +
|
| + ViewStub bottombarStub = ((ViewStub) findViewById(R.id.buttombar_stub));
|
| + bottombarStub.setLayoutResource(R.layout.custom_tabs_bottombar);
|
| + bottombarStub.inflate();
|
| +
|
| + // Unlike others, this shadow docks itself at bottom and casts graphics upwards.
|
| + FadingShadowView shadow = (FadingShadowView) findViewById(R.id.bottombar_shadow);
|
| + shadow.setVisibility(View.VISIBLE);
|
| + shadow.init(ApiCompatibilityUtils.getColor(getResources(),
|
| + R.color.toolbar_shadow_color), FadingShadow.POSITION_BOTTOM);
|
| +
|
| + ViewGroup bottomBar = (ViewGroup) findViewById(R.id.bottombar);
|
| + bottomBar.setBackgroundColor(mIntentDataProvider.getBottomBarColor());
|
| + List<BottombarItemParams> items = mIntentDataProvider.getBottomBarItems();
|
| + for (BottombarItemParams params : items) {
|
| + ImageButton button = params.toImageButton(this, bottomBar);
|
| + bottomBar.addView(button);
|
| + }
|
| + }
|
| +
|
| @Override
|
| public boolean shouldShowAppMenu() {
|
| return getActivityTab() != null && getToolbarManager().isInitialized();
|
|
|