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

Side by Side Diff: chrome/android/java_staging/src/org/chromium/chrome/browser/ntp/BookmarkFolderHierarchyItem.java

Issue 1141283003: Upstream oodles of Chrome for Android code into Chromium. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: final patch? Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 package org.chromium.chrome.browser.ntp;
6
7 import android.content.Context;
8 import android.content.res.TypedArray;
9 import android.graphics.drawable.Drawable;
10 import android.support.v7.widget.AppCompatTextView;
11 import android.util.TypedValue;
12 import android.view.Gravity;
13 import android.view.View;
14 import android.view.View.OnClickListener;
15
16 import com.google.android.apps.chrome.R;
17
18 import org.chromium.chrome.browser.ntp.BookmarksPageView.BookmarksPageManager;
19 import org.chromium.components.bookmarks.BookmarkId;
20
21 /**
22 * Displays the folder hierarchy item. This item can be clicked to be taken to t hat folder's
23 * contents.
24 */
25 public class BookmarkFolderHierarchyItem extends AppCompatTextView implements On ClickListener {
26
27 private static final int PADDING_DP = 5;
28
29 private final BookmarksPageManager mManager;
30 private final String mTitle;
31 private final BookmarkId mId;
32
33 BookmarkFolderHierarchyItem(Context context, BookmarksPageManager manager, B ookmarkId id,
34 String title, boolean isCurrentFolder) {
35 super(context);
36
37 mManager = manager;
38 mTitle = title;
39 mId = id;
40 if (!isCurrentFolder) setOnClickListener(this);
41 setText(mTitle);
42 float density = getResources().getDisplayMetrics().density;
43 int horizontalPadding = Math.round(PADDING_DP * density);
44 setMinHeight(Math.round(getResources().getDimension(R.dimen.bookmark_fol der_min_height)));
45 setTextSize(TypedValue.COMPLEX_UNIT_PX,
46 getResources().getDimension(R.dimen.bookmark_folder_text_size));
47 int textColorId = isCurrentFolder ? R.color.light_active_color
48 : R.color.ntp_list_header_subtext;
49 setTextColor(getResources().getColor(textColorId));
50 setGravity(Gravity.CENTER_VERTICAL);
51
52 TypedArray a = context.getTheme().obtainStyledAttributes(new int[] {
53 R.attr.listChoiceBackgroundIndicator });
54 Drawable background = a.getDrawable(0);
55 a.recycle();
56 setBackground(background);
57 setPadding(horizontalPadding, 0, horizontalPadding, 0);
58 }
59
60 @Override
61 public void onClick(View v) {
62 mManager.openFolder(this);
63 }
64
65 /**
66 * @return The folder id.
67 */
68 public BookmarkId getFolderId() {
69 return mId;
70 }
71 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698