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

Side by Side Diff: chrome/android/java/src/org/chromium/chrome/browser/bookmarks/BookmarkBookmarkRow.java

Issue 1739163005: Java side of purging BookmarkId from offline pages (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 years, 9 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
1 // Copyright 2015 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 package org.chromium.chrome.browser.bookmarks; 5 package org.chromium.chrome.browser.bookmarks;
6 6
7 import android.content.Context; 7 import android.content.Context;
8 import android.graphics.Bitmap; 8 import android.graphics.Bitmap;
9 import android.graphics.drawable.BitmapDrawable; 9 import android.graphics.drawable.BitmapDrawable;
10 import android.support.v4.graphics.drawable.RoundedBitmapDrawable; 10 import android.support.v4.graphics.drawable.RoundedBitmapDrawable;
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 mTitleView.setText(item.getTitle()); 83 mTitleView.setText(item.getTitle());
84 mDelegate.getLargeIconBridge().getLargeIconForUrl(mUrl, mMinIconSize, th is); 84 mDelegate.getLargeIconBridge().getLargeIconForUrl(mUrl, mMinIconSize, th is);
85 updateOfflinePageSize(bookmarkId); 85 updateOfflinePageSize(bookmarkId);
86 return item; 86 return item;
87 } 87 }
88 88
89 private void updateOfflinePageSize(BookmarkId bookmarkId) { 89 private void updateOfflinePageSize(BookmarkId bookmarkId) {
90 OfflinePageItem offlinePage = null; 90 OfflinePageItem offlinePage = null;
91 OfflinePageBridge bridge = mDelegate.getModel().getOfflinePageBridge(); 91 OfflinePageBridge bridge = mDelegate.getModel().getOfflinePageBridge();
92 if (mDelegate.getCurrentState() == BookmarkUIState.STATE_FILTER && bridg e != null) { 92 if (mDelegate.getCurrentState() == BookmarkUIState.STATE_FILTER && bridg e != null) {
93 offlinePage = bridge.getPageByBookmarkId(bookmarkId); 93 offlinePage = bridge.getPageByClientId(
94 BookmarkModel.offlineClientIdForBookmarkId(bookmarkId));
fgorski 2016/02/29 18:42:28 Have you considered adding a small adapter for boo
bburns 2016/02/29 21:41:22 Hrm, I'm not sure I'm super happy about wrappers o
94 } 95 }
95 TextView textView = (TextView) findViewById(R.id.offline_page_size); 96 TextView textView = (TextView) findViewById(R.id.offline_page_size);
96 View bookmarkRowView = findViewById(R.id.bookmark_row); 97 View bookmarkRowView = findViewById(R.id.bookmark_row);
97 if (offlinePage != null) { 98 if (offlinePage != null) {
98 int verticalPadding = textView.getResources().getDimensionPixelSize( 99 int verticalPadding = textView.getResources().getDimensionPixelSize(
99 R.dimen.offline_page_item_vertical_spacing); 100 R.dimen.offline_page_item_vertical_spacing);
100 textView.setText(Formatter.formatFileSize(getContext(), offlinePage. getFileSize())); 101 textView.setText(Formatter.formatFileSize(getContext(), offlinePage. getFileSize()));
101 // Get the embedded bookmark_row layout, and add padding. This is b ecause the entries 102 // Get the embedded bookmark_row layout, and add padding. This is b ecause the entries
102 // in filter view are larger (contain more items) than normal bookma rk view. 103 // in filter view are larger (contain more items) than normal bookma rk view.
103 bookmarkRowView.setPadding(0, verticalPadding / 2, 0, verticalPaddin g / 2); 104 bookmarkRowView.setPadding(0, verticalPadding / 2, 0, verticalPaddin g / 2);
(...skipping 15 matching lines...) Expand all
119 mIconImageView.setImageDrawable(new BitmapDrawable(getResources(), i con)); 120 mIconImageView.setImageDrawable(new BitmapDrawable(getResources(), i con));
120 } else { 121 } else {
121 RoundedBitmapDrawable roundedIcon = RoundedBitmapDrawableFactory.cre ate( 122 RoundedBitmapDrawable roundedIcon = RoundedBitmapDrawableFactory.cre ate(
122 getResources(), 123 getResources(),
123 Bitmap.createScaledBitmap(icon, mDisplayedIconSize, mDisplay edIconSize, false)); 124 Bitmap.createScaledBitmap(icon, mDisplayedIconSize, mDisplay edIconSize, false));
124 roundedIcon.setCornerRadius(mCornerRadius); 125 roundedIcon.setCornerRadius(mCornerRadius);
125 mIconImageView.setImageDrawable(roundedIcon); 126 mIconImageView.setImageDrawable(roundedIcon);
126 } 127 }
127 } 128 }
128 } 129 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698