Commit 5b0ae3db authored by Theresa's avatar Theresa Committed by Commit Bot

[EoC] Add placeholder thumbnail and change publisher text alignment

Add a placeholder thumbnail for use while loading thumbnails and for
suggestions without thumbnails.

Also move publisher text to just below the card title. This move affects
the NTP as well.

BUG=829075,834523

Change-Id: I27d82161eae337fe62939df1c38d0916f73319ae
Reviewed-on: https://chromium-review.googlesource.com/1018414
Commit-Queue: Theresa <twellington@chromium.org>
Reviewed-by: default avatarBernhard Bauer <bauerb@chromium.org>
Cr-Commit-Position: refs/heads/master@{#552105}
parent c88dae7b
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright 2017 The Chromium Authors. All rights reserved.
Use of this source code is governed by a BSD-style license that can be
found in the LICENSE file. -->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
tools:targetApi="21"
android:width="114dp"
android:height="114dp"
android:viewportWidth="114"
android:viewportHeight="114">
<path
android:fillColor="#BDC1C6"
android:fillType="evenOdd"
android:strokeWidth="1"
android:pathData="M49,41.0509168 L49,25 L89,25 L89,64.9575693 L72.9999126,64.9575693 C72.9999686,64.9801917 73,65.0028214 73,65.0254584 C73,78.2662321 62.254834,89 49,89 C35.745166,89 25,78.2662321 25,65.0254584 C25,51.7846847 35.745166,41.0509168 49,41.0509168 Z M49,41.0509168 L49,64.9575693 L72.9999126,64.9575693 C72.9632518,51.7480142 62.2321729,41.0509168 49,41.0509168 Z" />
</vector>
\ No newline at end of file
...@@ -71,8 +71,7 @@ ...@@ -71,8 +71,7 @@
style="@style/SuggestionCardTitleModern" style="@style/SuggestionCardTitleModern"
android:id="@+id/article_headline" android:id="@+id/article_headline"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="0dp" android:layout_height="wrap_content"
android:layout_weight="1"
tools:text="Article headline" /> tools:text="Article headline" />
<LinearLayout <LinearLayout
......
...@@ -201,5 +201,6 @@ ...@@ -201,5 +201,6 @@
<color name="bottom_system_nav_color">@android:color/white</color> <color name="bottom_system_nav_color">@android:color/white</color>
<color name="bottom_system_nav_divider_color">@color/black_alpha_12</color> <color name="bottom_system_nav_divider_color">@color/black_alpha_12</color>
<color name="search_box_hint">@color/black_alpha_54</color> <color name="search_box_hint">@color/black_alpha_54</color>
<color name="contextual_suggestions_thumbnail_bg_color">#DADCE0</color>
</resources> </resources>
...@@ -6,6 +6,7 @@ package org.chromium.chrome.browser.suggestions; ...@@ -6,6 +6,7 @@ package org.chromium.chrome.browser.suggestions;
import android.content.res.ColorStateList; import android.content.res.ColorStateList;
import android.content.res.Resources; import android.content.res.Resources;
import android.content.res.Resources.Theme;
import android.graphics.Bitmap; import android.graphics.Bitmap;
import android.graphics.drawable.BitmapDrawable; import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.ColorDrawable; import android.graphics.drawable.ColorDrawable;
...@@ -16,6 +17,7 @@ import android.os.StrictMode; ...@@ -16,6 +17,7 @@ import android.os.StrictMode;
import android.os.SystemClock; import android.os.SystemClock;
import android.support.annotation.DimenRes; import android.support.annotation.DimenRes;
import android.support.annotation.Nullable; import android.support.annotation.Nullable;
import android.support.graphics.drawable.VectorDrawableCompat;
import android.support.v4.text.BidiFormatter; import android.support.v4.text.BidiFormatter;
import android.text.TextUtils; import android.text.TextUtils;
import android.text.format.DateUtils; import android.text.format.DateUtils;
...@@ -176,7 +178,14 @@ public class SuggestionsBinder { ...@@ -176,7 +178,14 @@ public class SuggestionsBinder {
// Temporarily set placeholder and then fetch the thumbnail from a provider. // Temporarily set placeholder and then fetch the thumbnail from a provider.
mThumbnailView.setBackground(null); mThumbnailView.setBackground(null);
if (SuggestionsConfig.useModernLayout() if (mSuggestion.isContextual()) {
Resources res = mThumbnailView.getResources();
Theme theme = mThumbnailView.getContext().getTheme();
mThumbnailView.setImageDrawable(VectorDrawableCompat.create(
res, R.drawable.contextual_suggestions_placeholder, theme));
mThumbnailView.setBackgroundColor(ApiCompatibilityUtils.getColor(
res, R.color.contextual_suggestions_thumbnail_bg_color));
} else if (SuggestionsConfig.useModernLayout()
&& ChromeFeatureList.isEnabled( && ChromeFeatureList.isEnabled(
ChromeFeatureList.CONTENT_SUGGESTIONS_THUMBNAIL_DOMINANT_COLOR)) { ChromeFeatureList.CONTENT_SUGGESTIONS_THUMBNAIL_DOMINANT_COLOR)) {
ColorDrawable colorDrawable = ColorDrawable colorDrawable =
......
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