Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(244)

Issue 2194433002: Zine: support multiple sections in the ui (Closed)

Created:
4 years, 4 months ago by Michael van Ouwerkerk
Modified:
4 years, 4 months ago
CC:
chromium-reviews, ntp-dev+reviews_chromium.org
Base URL:
https://chromium.googlesource.com/chromium/src.git@master
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

Zine: support multiple sections in the ui (This CL was continued in https://codereview.chromium.org/2196273002) * The adapter now manages groups of items. * A SuggestionsSection is a group that holds suggestions, a header, and a status card. * Add @SuggestionsCategory and @SuggestionsCategoryStatus annotations. * SnippetsObserver now specifies what category it is talking about. BUG=616090

Patch Set 1 #

Patch Set 2 : Cleanups. #

Total comments: 7
Unified diffs Side-by-side diffs Delta from patch set Stats (+361 lines, -134 lines) Patch
M chrome/android/java/src/org/chromium/chrome/browser/ntp/cards/AboveTheFoldListItem.java View 1 chunk +2 lines, -2 lines 0 comments Download
M chrome/android/java/src/org/chromium/chrome/browser/ntp/cards/NewTabPageAdapter.java View 11 chunks +144 lines, -91 lines 0 comments Download
A chrome/android/java/src/org/chromium/chrome/browser/ntp/cards/NewTabPageItemGroup.java View 1 1 chunk +12 lines, -0 lines 0 comments Download
M chrome/android/java/src/org/chromium/chrome/browser/ntp/cards/NewTabPageRecyclerView.java View 4 chunks +9 lines, -10 lines 0 comments Download
A chrome/android/java/src/org/chromium/chrome/browser/ntp/cards/NewTabPageSingleItemGroup.java View 1 1 chunk +25 lines, -0 lines 0 comments Download
M chrome/android/java/src/org/chromium/chrome/browser/ntp/cards/SpacingListItem.java View 1 chunk +1 line, -1 line 0 comments Download
M chrome/android/java/src/org/chromium/chrome/browser/ntp/cards/StatusListItem.java View 2 chunks +3 lines, -2 lines 0 comments Download
A chrome/android/java/src/org/chromium/chrome/browser/ntp/cards/SuggestionsSection.java View 1 chunk +71 lines, -0 lines 0 comments Download
M chrome/android/java/src/org/chromium/chrome/browser/ntp/snippets/SnippetArticleListItem.java View 1 1 chunk +2 lines, -1 line 0 comments Download
M chrome/android/java/src/org/chromium/chrome/browser/ntp/snippets/SnippetsBridge.java View 1 3 chunks +20 lines, -15 lines 2 comments Download
A chrome/android/java/src/org/chromium/chrome/browser/ntp/snippets/SuggestionsCategory.java View 1 chunk +14 lines, -0 lines 1 comment Download
A chrome/android/java/src/org/chromium/chrome/browser/ntp/snippets/SuggestionsCategoryStatus.java View 1 chunk +22 lines, -0 lines 2 comments Download
M chrome/android/java_sources.gni View 1 chunk +6 lines, -1 line 0 comments Download
M chrome/android/junit/src/org/chromium/chrome/browser/ntp/cards/NewTabPageAdapterTest.java View 4 chunks +4 lines, -4 lines 0 comments Download
M chrome/browser/android/ntp/ntp_snippets_bridge.h View 1 chunk +3 lines, -2 lines 0 comments Download
M chrome/browser/android/ntp/ntp_snippets_bridge.cc View 3 chunks +10 lines, -4 lines 0 comments Download
M components/ntp_snippets/BUILD.gn View 1 chunk +1 line, -0 lines 0 comments Download
M components/ntp_snippets/content_suggestions_category.h View 1 chunk +12 lines, -1 line 2 comments Download

Messages

Total messages: 15 (12 generated)
Michael van Ouwerkerk
Bernhard and Philipp, could you take a look please?
4 years, 4 months ago (2016-07-28 16:50:35 UTC) #7
PEConn
https://codereview.chromium.org/2194433002/diff/20001/chrome/android/java/src/org/chromium/chrome/browser/ntp/snippets/SnippetsBridge.java File chrome/android/java/src/org/chromium/chrome/browser/ntp/snippets/SnippetsBridge.java (right): https://codereview.chromium.org/2194433002/diff/20001/chrome/android/java/src/org/chromium/chrome/browser/ntp/snippets/SnippetsBridge.java#newcode134 chrome/android/java/src/org/chromium/chrome/browser/ntp/snippets/SnippetsBridge.java:134: private void onSuggestionsAvailable(int category, String[] ids, String[] titles, String[] ...
4 years, 4 months ago (2016-07-29 10:01:43 UTC) #13
Bernhard Bauer
4 years, 4 months ago (2016-08-01 15:01:34 UTC) #14
FYI, I'm continuing this CL over at https://codereview.chromium.org/2196273002.

https://codereview.chromium.org/2194433002/diff/20001/chrome/android/java/src...
File
chrome/android/java/src/org/chromium/chrome/browser/ntp/snippets/SnippetsBridge.java
(right):

https://codereview.chromium.org/2194433002/diff/20001/chrome/android/java/src...
chrome/android/java/src/org/chromium/chrome/browser/ntp/snippets/SnippetsBridge.java:134:
private void onSuggestionsAvailable(int category, String[] ids, String[] titles,
String[] urls,
On 2016/07/29 10:01:43, PEConn1 wrote:
> Will all the different categories be providing the same data here? Maybe
offline
> documents care about both URLs and AMP URLs but for future types of suggestion
> this doesn't seem very general.
> 
> I think the reason we're passing the parameters like this (as a lists of
fields
> as opposed to just a list of objects) is that it's a pain to build Java
objects
> in native code. Ideally what we'd have is something like:
> 
> @CalledByNative
> ArticleSnippet createSnippet(String id, String title, String url, ...) {...}
> 
> @CalledByNative
> OfflinePage createOfflinePage(String id, String title, ...) {...}
> 
> Which are called to create the list of objects in native code, then
> |onSuggestionsAvailable| just takes a category and a list of
NewTabPageListItem.

I think the general idea is indeed that all categories are going to provide
(most of) the same data. We also don't want to use different classes for content
suggestions from different categories, as they would have the same UI anyway. I
do like constructing the Java suggestions via a create() method though -- the
arrays we pass in here have to be converted in a loop each as well, so it's not
like that actually saves overhead.

https://codereview.chromium.org/2194433002/diff/20001/chrome/android/java/src...
File
chrome/android/java/src/org/chromium/chrome/browser/ntp/snippets/SuggestionsCategoryStatus.java
(right):

https://codereview.chromium.org/2194433002/diff/20001/chrome/android/java/src...
chrome/android/java/src/org/chromium/chrome/browser/ntp/snippets/SuggestionsCategoryStatus.java:12:
@IntDef({ContentSuggestionsCategoryStatus.INITIALIZING,
ContentSuggestionsCategoryStatus.AVAILABLE,
On 2016/07/29 10:01:43, PEConn1 wrote:
> nit: Just put one on each line?

Done.

https://codereview.chromium.org/2194433002/diff/20001/components/ntp_snippets...
File components/ntp_snippets/content_suggestions_category.h (right):

https://codereview.chromium.org/2194433002/diff/20001/components/ntp_snippets...
components/ntp_snippets/content_suggestions_category.h:21: COUNT
On 2016/07/29 10:01:43, PEConn1 wrote:
> I think the convention is to have the last element called MAX, eg:
>
https://cs.chromium.org/chromium/src/components/signin/core/browser/signin_me...

MAX would be the maximum allowed value, which would really be OFFLINE_PAGES in
this case :)

Powered by Google App Engine
This is Rietveld 408576698