Commit e984100b authored by Gang Wu's avatar Gang Wu Committed by Commit Bot

Update "Add To" dialog title's size and position

Bug:1139000

Change-Id: I9471941bf822a22ad1405d6f8cf9972d6fcb3ef9
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2473500
Commit-Queue: Gang Wu <gangwu@chromium.org>
Reviewed-by: default avatarTheresa  <twellington@chromium.org>
Cr-Commit-Position: refs/heads/master@{#817752}
parent 64400870
......@@ -4,8 +4,26 @@
Use of this source code is governed by a BSD-style license that can be
found in the LICENSE file.
-->
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >
<ListView xmlns:android="http://schemas.android.com/apk/res/android"
android:divider="@null"
android:layout_height="match_parent"
android:layout_width="match_parent" />
\ No newline at end of file
<TextView
style="@style/AppMenuItemText"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/menu_add_to_dialog_title"
android:paddingTop="24dp"
android:paddingBottom="16dp"
android:paddingStart="24dp"
android:paddingEnd="24dp" />
<ListView
android:id="@+id/list"
android:divider="@null"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</LinearLayout>
......@@ -11,5 +11,6 @@
android:layout_width="match_parent"
android:layout_height="?android:attr/listPreferredItemHeightSmall"
android:background="?android:attr/listChoiceBackgroundIndicator"
android:gravity="center_vertical"
android:paddingStart="16dp"
android:paddingEnd="16dp" />
......@@ -201,9 +201,8 @@ class AddToMenuItemViewBinder extends ArrayAdapter<MenuItem>
Resources resources = mContext.getResources();
return new PropertyModel.Builder(ModalDialogProperties.ALL_KEYS)
.with(ModalDialogProperties.CONTROLLER, this)
.with(ModalDialogProperties.TITLE, resources, R.string.menu_add_to_dialog_title)
.with(ModalDialogProperties.POSITIVE_BUTTON_TEXT, resources, R.string.close)
.with(ModalDialogProperties.CUSTOM_VIEW, createAddToList())
.with(ModalDialogProperties.CUSTOM_VIEW, createAddToMenu())
.with(ModalDialogProperties.CANCEL_ON_TOUCH_OUTSIDE, true)
.build();
}
......@@ -213,11 +212,12 @@ class AddToMenuItemViewBinder extends ArrayAdapter<MenuItem>
mModalDialogManager.showDialog(mPropertyModel, ModalDialogManager.ModalDialogType.APP);
}
private ListView createAddToList() {
private View createAddToMenu() {
LayoutInflater inflater = LayoutInflater.from(mContext);
ListView addToMenu = (ListView) inflater.inflate(R.layout.add_to_menu_dialog, null);
addToMenu.setAdapter(this);
addToMenu.setOnItemClickListener(this);
View addToMenu = inflater.inflate(R.layout.add_to_menu_dialog, null);
ListView list = addToMenu.findViewById(R.id.list);
list.setAdapter(this);
list.setOnItemClickListener(this);
return addToMenu;
}
......
......@@ -12,6 +12,7 @@ import android.view.MenuItem;
import android.view.View;
import android.widget.LinearLayout;
import android.widget.ListView;
import android.widget.TextView;
import androidx.test.filters.SmallTest;
......@@ -459,9 +460,15 @@ public class TabbedAppMenuTest {
View addToItem = getListView().getChildAt(addToIndex);
PropertyModel dialogModel = clickAndGetCurrentDialog(addToItem);
Assert.assertNotNull("No add to dialog found.", dialogModel);
ListView addToCustomView = (ListView) dialogModel.get(ModalDialogProperties.CUSTOM_VIEW);
Assert.assertEquals(3, addToCustomView.getChildCount());
mRenderTestRule.render(addToCustomView, "add_to_dialog_not_bookmarked");
LinearLayout addToCustomView =
(LinearLayout) dialogModel.get(ModalDialogProperties.CUSTOM_VIEW);
Assert.assertEquals("The dialog should have 2 children, one is title, another is ListView.",
2, addToCustomView.getChildCount());
TextView addToTitle = (TextView) addToCustomView.getChildAt(0);
mRenderTestRule.render(addToTitle, "add_to_dialog_title");
ListView addToList = (ListView) addToCustomView.getChildAt(1);
Assert.assertEquals(3, addToList.getChildCount());
mRenderTestRule.render(addToList, "add_to_dialog_not_bookmarked");
}
@Test
......@@ -489,9 +496,15 @@ public class TabbedAppMenuTest {
View addToItem = getListView().getChildAt(addToIndex);
PropertyModel dialogModel = clickAndGetCurrentDialog(addToItem);
Assert.assertNotNull("No add to dialog found.", dialogModel);
ListView addToCustomView = (ListView) dialogModel.get(ModalDialogProperties.CUSTOM_VIEW);
Assert.assertEquals(3, addToCustomView.getChildCount());
mRenderTestRule.render(addToCustomView, "add_to_dialog_bookmarked");
LinearLayout addToCustomView =
(LinearLayout) dialogModel.get(ModalDialogProperties.CUSTOM_VIEW);
Assert.assertEquals("The dialog should have 2 children, one is title, another is ListView.",
2, addToCustomView.getChildCount());
TextView addToTitle = (TextView) addToCustomView.getChildAt(0);
mRenderTestRule.render(addToTitle, "add_to_dialog_title");
ListView addToList = (ListView) addToCustomView.getChildAt(1);
Assert.assertEquals(3, addToList.getChildCount());
mRenderTestRule.render(addToList, "add_to_dialog_bookmarked");
AppMenuPropertiesDelegateImpl.setPageBookmarkedForTesting(null);
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment