Commit c8f1c3ce authored by Theresa's avatar Theresa Committed by Commit Bot

[Modern] More NTP polish

 * Fix all dismissed item
 * Adjust margin above "More" button
 * Adjust margin above sign-in promo
 * Adjust padding at top of most likely tiles

 BUG=803095,814073

Change-Id: I85f1bc682bfe8f23ee52438d85e9ee98fcb7970f
Reviewed-on: https://chromium-review.googlesource.com/935151Reviewed-by: default avatarTed Choc <tedchoc@chromium.org>
Commit-Queue: Theresa <twellington@chromium.org>
Cr-Commit-Position: refs/heads/master@{#538910}
parent cea91b39
......@@ -3,7 +3,8 @@
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content">
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/content_suggestions_action_modern_margin_top" >
<Button
style="@style/SuggestionCardAction"
......
......@@ -26,14 +26,36 @@
android:src="@drawable/ntp_all_dismissed_white" />
<org.chromium.ui.widget.TextViewWithLeading
android:id="@+id/body_text"
android:id="@+id/title_text"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/image"
android:layout_alignParentStart="true"
android:layout_marginBottom="8dp"
android:gravity="center_horizontal"
android:text="@string/ntp_title_no_suggestions"
android:textAppearance="@style/BlackTitle1"
chrome:leading="24dp" />
<org.chromium.ui.widget.TextViewWithLeading
android:id="@+id/body_text"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/title_text"
android:layout_alignParentStart="true"
android:gravity="center_horizontal"
android:text="@string/ntp_all_dismissed_body_text_morning"
android:textSize="14sp"
android:textColor="@color/snippets_text_color"
chrome:leading="20dp" />
</RelativeLayout>
<Button
android:id="@+id/action_button"
style="@style/SuggestionCardAction"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/body_text"
android:layout_centerHorizontal="true"
android:layout_marginTop="12dp"
android:text="@string/ntp_all_dismissed_refresh" />
</RelativeLayout>
\ No newline at end of file
......@@ -14,7 +14,8 @@
android:paddingBottom="12dp"
android:paddingEnd="16dp"
android:paddingStart="16dp"
android:paddingTop="12dp">
android:paddingTop="12dp"
android:layout_marginTop="12dp">
<FrameLayout
android:layout_width="match_parent"
......
......@@ -300,6 +300,7 @@
<!-- NTP dimensions -->
<dimen name="tile_grid_layout_max_width">504dp</dimen>
<dimen name="tile_grid_layout_padding_top">8dp</dimen>
<dimen name="tile_grid_layout_modern_padding_top">24dp</dimen>
<dimen name="tile_grid_layout_padding_start">12dp</dimen>
<dimen name="tile_grid_layout_padding_end">12dp</dimen>
<dimen name="tile_grid_layout_no_logo_padding_top">20dp</dimen>
......@@ -374,6 +375,9 @@
<dimen name="content_suggestions_card_modern_badge_size">18dp</dimen>
<dimen name="content_suggestions_card_modern_badge_margin_start">8dp</dimen>
<dimen name="content_suggestions_card_modern_badge_margin_top">8dp</dimen>
<!-- Used to offset content_suggestions_card_modern_margin applied to the bottom of the
last card. -->
<dimen name="content_suggestions_action_modern_margin_top">-16dp</dimen>
<dimen name="contextual_carousel_space_between_cards">8dp</dimen>
<dimen name="md_incognito_ntp_line_spacing">6sp</dimen>
<dimen name="md_incognito_ntp_padding_left">16dp</dimen>
......
......@@ -714,9 +714,12 @@ public class NewTabPageView
* Updates the padding for the tile grid based on what is shown above it.
*/
private void updateTileGridPadding() {
int paddingWithLogoId = SuggestionsConfig.useModernLayout()
? R.dimen.tile_grid_layout_modern_padding_top
: R.dimen.tile_grid_layout_padding_top;
// Set a bit more top padding on the tile grid if there is no logo.
final int paddingTop = getResources().getDimensionPixelSize(shouldShowLogo()
? R.dimen.tile_grid_layout_padding_top
? paddingWithLogoId
: R.dimen.tile_grid_layout_no_logo_padding_top);
mSiteSectionViewHolder.itemView.setPadding(
0, paddingTop, 0, mSiteSectionViewHolder.itemView.getPaddingBottom());
......
......@@ -64,20 +64,16 @@ public class AllDismissedItem extends OptionalLeaf {
super(LayoutInflater.from(root.getContext()).inflate(getLayout(), root, false));
mBodyTextView = itemView.findViewById(R.id.body_text);
if (!SuggestionsConfig.useModernLayout()) {
itemView.findViewById(R.id.action_button).setOnClickListener(v -> {
NewTabPageUma.recordAction(NewTabPageUma.ACTION_CLICKED_ALL_DISMISSED_REFRESH);
sections.restoreDismissedSections();
});
}
itemView.findViewById(R.id.action_button).setOnClickListener(v -> {
NewTabPageUma.recordAction(NewTabPageUma.ACTION_CLICKED_ALL_DISMISSED_REFRESH);
sections.restoreDismissedSections();
});
}
public void onBindViewHolder(int hourOfDay, Listener listener) {
@StringRes
final int messageId;
if (SuggestionsConfig.useModernLayout()) {
messageId = R.string.ntp_all_dismissed_body_text_modern;
} else if (hourOfDay >= 0 && hourOfDay < 12) {
if (hourOfDay >= 0 && hourOfDay < 12) {
messageId = R.string.ntp_all_dismissed_body_text_morning;
} else if (hourOfDay >= 12 && hourOfDay < 17) {
messageId = R.string.ntp_all_dismissed_body_text_afternoon;
......
......@@ -2430,9 +2430,6 @@ To obtain new licenses, connect to the internet and play your downloaded content
<message name="IDS_NTP_ALL_DISMISSED_BODY_TEXT_EVENING" desc="Body text shown in the evening on the New Tab Page when all suggested content has been dismissed.">
More articles will appear soon. Enjoy your evening!
</message>
<message name="IDS_NTP_ALL_DISMISSED_BODY_TEXT_MODERN" desc="Body text shown on the New Tab Page when all suggested content has been dismissed. The message refers to the &quot;More&quot; button to fetch more suggestions.">
Tap More to get articles
</message>
<message name="IDS_NTP_SUGGESTIONS_FETCH_FAILED" desc="Snackbar text shown when the user presses the More button to get more suggestions, but this fails (eg, no internet connectivity).">
Can’t get suggestions
</message>
......
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