Skip to content

Commit

Permalink
tabswitcher_ui_update
Browse files Browse the repository at this point in the history
  • Loading branch information
1311-hack1 committed Oct 14, 2024
1 parent 80362c5 commit 3831f15
Show file tree
Hide file tree
Showing 53 changed files with 123 additions and 24 deletions.
4 changes: 2 additions & 2 deletions src/chrome/android/java/res/values/dimens.xml
Original file line number Diff line number Diff line change
Expand Up @@ -120,8 +120,8 @@ found in the LICENSE file.
<dimen name="tab_modal_scrim_vertical_margin">16dp</dimen>

<!-- Should match toolbar_height_no_shadow -->
<dimen name="control_container_height">@dimen/default_action_bar_height</dimen>
<dimen name="custom_tabs_control_container_height">@dimen/default_action_bar_height</dimen>
<dimen name="control_container_height">112dp</dimen>
<dimen name="custom_tabs_control_container_height">112dp</dimen>

<!-- Find in Page dimensions -->
<dimen name="find_in_page_popup_width">375dp</dimen>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ found in the LICENSE file.
<resources xmlns:tools="http://schemas.android.com/tools">

<!-- Toolbar dimensions -->
<dimen name="toolbar_height_no_shadow">@dimen/default_action_bar_height</dimen>
<dimen name="toolbar_height_no_shadow">112dp</dimen>
<!-- toolbar_height_no_shadow_focused = toolbar_height_no_shadow + toolbar_url_focus_height_increase -->
<dimen name="toolbar_height_no_shadow_focused">64dp</dimen>
<dimen name="toolbar_url_focus_height_increase">8dp</dimen>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,4 +66,5 @@ found in the LICENSE file.
android:layout_height="@dimen/toolbar_height_no_shadow"
android:inflatedId="@+id/tab_switcher_toolbar"
android:layout="@layout/tab_switcher_toolbar" />

</org.chromium.chrome.browser.toolbar.top.ToolbarControlContainer>
125 changes: 106 additions & 19 deletions src/chrome/browser/ui/android/toolbar/java/res/layout/toolbar_phone.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,108 @@ found in the LICENSE file.
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="@dimen/toolbar_height_no_shadow" >
android:layout_height="wrap_content" >

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">

<FrameLayout
android:id="@+id/toolbar_frame_view"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:layout_margin="8dp"
android:padding="0dp"
android:visibility="visible">

<LinearLayout
android:id="@+id/pinned_apps_container"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">

<LinearLayout
android:id="@+id/tab_switcher_button_container"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:gravity="center">

<org.chromium.chrome.browser.toolbar.top.ToggleTabStackButton
android:id="@+id/tab_switcher_button"
style="@style/ToolbarHoverableButton"
android:layout_gravity="top"
android:clickable="false"
app:menuMaxWidth="@dimen/tab_switcher_menu_width"
app:menuVerticalOverlapAnchor="false" />

</LinearLayout>

<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="7"
android:orientation="horizontal"
android:gravity="center">

<ImageView
android:src="@drawable/btn_toolbar_home"
android:layout_width="48dp"
android:layout_height="48dp"
android:layout_margin="8dp"
android:contentDescription="Pinned App 1" />

<ImageView
android:src="@drawable/btn_toolbar_home"
android:layout_width="48dp"
android:layout_height="48dp"
android:layout_margin="8dp"
android:contentDescription="Pinned App 2" />

<ImageView
android:src="@drawable/btn_toolbar_home"
android:layout_width="48dp"
android:layout_height="48dp"
android:layout_margin="8dp"
android:contentDescription="Pinned App 1" />

<ImageView
android:src="@drawable/btn_toolbar_home"
android:layout_width="48dp"
android:layout_height="48dp"
android:layout_margin="8dp"
android:contentDescription="Pinned App 2" />

<LinearLayout
android:id="@+id/optional_button_container"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="2"
android:orientation="horizontal"
android:gravity="center">
<ViewStub
android:id="@+id/optional_button_stub"
android:inflatedId="@+id/optional_toolbar_button_container"
android:layout_gravity="top"
android:visibility="gone"
android:layout_width="52dp"
style="@style/ToolbarHoverableButton" />
</LinearLayout>

</LinearLayout>

</LinearLayout>

</FrameLayout>


<FrameLayout
android:id="@+id/toolbar_frame_view"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1">

<org.chromium.chrome.browser.toolbar.home_button.HomeButton
android:id="@+id/home_button"
Expand All @@ -29,7 +130,7 @@ found in the LICENSE file.
<org.chromium.chrome.browser.omnibox.LocationBarPhone
android:id="@+id/location_bar"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="top"
android:paddingStart="@dimen/location_bar_start_padding"
android:paddingEnd="@dimen/location_bar_end_padding"/>
Expand All @@ -42,25 +143,11 @@ found in the LICENSE file.
android:focusable="true"
android:focusableInTouchMode="true">

<ViewStub
android:id="@+id/optional_button_stub"
android:inflatedId="@+id/optional_toolbar_button_container"
android:layout_gravity="top"
android:visibility="gone"
android:layout_width="52dp"
style="@style/ToolbarHoverableButton" />
<include layout="@layout/menu_button"/>

<org.chromium.chrome.browser.toolbar.top.ToggleTabStackButton
android:id="@+id/tab_switcher_button"
style="@style/ToolbarButton"
android:background="@drawable/toolbar_tab_switcher_button_ripple"
android:paddingStart="@dimen/toolbar_tab_switcher_button_padding"
android:layout_gravity="top"
android:contentDescription="@string/accessibility_toolbar_btn_tabswitcher_toggle_default"
app:menuMaxWidth="@dimen/tab_switcher_menu_width"
app:menuVerticalOverlapAnchor="false" />
</LinearLayout>

<include layout="@layout/menu_button"/>
</FrameLayout>

</LinearLayout>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,8 @@ public class ToolbarPhone extends ToolbarLayout
protected LocationBarCoordinator mLocationBar;
private ObservableSupplier<Tracker> mTrackerSupplier;

private ViewGroup mTabSwitcherButtonContainer;
private ViewGroup mOptionalButtonContainer;
private ViewGroup mToolbarButtonsContainer;
protected @Nullable ToggleTabStackButton mToggleTabStackButton;
// Non-null after inflation occurs.
Expand Down Expand Up @@ -350,6 +352,8 @@ public void onFinishInflate() {
super.onFinishInflate();

mToolbarButtonsContainer = findViewById(R.id.toolbar_buttons);
mOptionalButtonContainer = findViewById(R.id.optional_button_container);
mTabSwitcherButtonContainer = findViewById(R.id.tab_switcher_button_container);
mHomeButton = findViewById(R.id.home_button);
mUrlBar = findViewById(R.id.url_bar);
mUrlActionContainer = findViewById(R.id.url_action_container);
Expand Down Expand Up @@ -1514,6 +1518,7 @@ void draWithoutBackground(Canvas canvas) {

// Translate to draw end toolbar buttons.
ViewUtils.translateCanvasToView(this, mToolbarButtonsContainer, canvas);
ViewUtils.translateCanvasToView(this, mTabSwitcherButtonContainer, canvas);

// Draw the optional button if visible. We check for both visibility and width because in
// some cases (e.g. the first frame of the showing animation) the view may be visible with a
Expand All @@ -1524,7 +1529,7 @@ void draWithoutBackground(Canvas canvas) {
&& mOptionalButtonCoordinator.getViewWidth() != 0) {
canvas.save();
ViewUtils.translateCanvasToView(
mToolbarButtonsContainer,
mOptionalButtonContainer,
mOptionalButtonCoordinator.getViewForDrawing(),
canvas);
mOptionalButtonCoordinator.getViewForDrawing().draw(canvas);
Expand All @@ -1538,7 +1543,7 @@ void draWithoutBackground(Canvas canvas) {
// Draw the tab stack button image.
canvas.save();
ViewUtils.translateCanvasToView(
mToolbarButtonsContainer, mToggleTabStackButton, canvas);
mTabSwitcherButtonContainer, mToggleTabStackButton, canvas);

int backgroundWidth = mToggleTabStackButton.getDrawable().getIntrinsicWidth();
int backgroundHeight = mToggleTabStackButton.getDrawable().getIntrinsicHeight();
Expand Down Expand Up @@ -3195,4 +3200,8 @@ public int getLocationBarBackgroundHeightForTesting() {
void setNtpSearchBoxScrollFractionForTesting(float ntpSearchBoxScrollFraction) {
mNtpSearchBoxScrollFraction = ntpSearchBoxScrollFraction;
}

public void ShowTabSwitcherToolbarContiainer() {
return;
}
}
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Manifest-Version: 1.0

0 comments on commit 3831f15

Please sign in to comment.