OLD | NEW |
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.physicalweb; | 5 package org.chromium.chrome.browser.physicalweb; |
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.view.LayoutInflater; | 9 import android.view.LayoutInflater; |
10 import android.view.View; | 10 import android.view.View; |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
74 PwsResult pwsResult = getItem(position); | 74 PwsResult pwsResult = getItem(position); |
75 Bitmap iconBitmap = mIconUrlToIconMap.get(pwsResult.iconUrl); | 75 Bitmap iconBitmap = mIconUrlToIconMap.get(pwsResult.iconUrl); |
76 | 76 |
77 titleTextView.setText(pwsResult.title); | 77 titleTextView.setText(pwsResult.title); |
78 urlTextView.setText(pwsResult.siteUrl); | 78 urlTextView.setText(pwsResult.siteUrl); |
79 descriptionTextView.setText(pwsResult.description); | 79 descriptionTextView.setText(pwsResult.description); |
80 iconImageView.setImageBitmap(iconBitmap); | 80 iconImageView.setImageBitmap(iconBitmap); |
81 | 81 |
82 return view; | 82 return view; |
83 } | 83 } |
| 84 |
| 85 /** |
| 86 * Gets whether the specified site URL is in the list. |
| 87 * @param siteUrl A string containing the site URL. |
| 88 * @return Boolean true if the specified site URL is already in the list. |
| 89 */ |
| 90 public boolean hasSiteUrl(String siteUrl) { |
| 91 int itemCount = getCount(); |
| 92 for (int position = 0; position < itemCount; ++position) { |
| 93 PwsResult pwsResult = getItem(position); |
| 94 if (siteUrl.equals(pwsResult.siteUrl)) { |
| 95 return true; |
| 96 } |
| 97 } |
| 98 |
| 99 return false; |
| 100 } |
84 } | 101 } |
OLD | NEW |