| 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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 46 /** | 46 /** |
| 47 * Return true if we already know an icon for this URL. | 47 * Return true if we already know an icon for this URL. |
| 48 * @param iconUrl The icon URL as returned by PWS | 48 * @param iconUrl The icon URL as returned by PWS |
| 49 * @return true if the icon is present | 49 * @return true if the icon is present |
| 50 */ | 50 */ |
| 51 public boolean hasIcon(String iconUrl) { | 51 public boolean hasIcon(String iconUrl) { |
| 52 return mIconUrlToIconMap.containsKey(iconUrl); | 52 return mIconUrlToIconMap.containsKey(iconUrl); |
| 53 } | 53 } |
| 54 | 54 |
| 55 /** | 55 /** |
| 56 * Return true if we already know we have a given groupId. |
| 57 * @param groupId The requested groupId |
| 58 * @return true if a PwsResult is present that has the given groupId |
| 59 */ |
| 60 public boolean hasGroupId(String groupId) { |
| 61 for (int position = 0; position < getCount(); ++position) { |
| 62 if (groupId.equals(getItem(position).groupId)) { |
| 63 return true; |
| 64 } |
| 65 } |
| 66 return false; |
| 67 } |
| 68 |
| 69 /** |
| 56 * Get the view for an item in the data set. | 70 * Get the view for an item in the data set. |
| 57 * @param position Index of the list view item within the array. | 71 * @param position Index of the list view item within the array. |
| 58 * @param view The old view to reuse, if possible. | 72 * @param view The old view to reuse, if possible. |
| 59 * @param viewGroup The parent that this view will eventually be attached to
. | 73 * @param viewGroup The parent that this view will eventually be attached to
. |
| 60 * @return A view corresponding to the list view item. | 74 * @return A view corresponding to the list view item. |
| 61 */ | 75 */ |
| 62 @Override | 76 @Override |
| 63 public View getView(int position, View view, ViewGroup viewGroup) { | 77 public View getView(int position, View view, ViewGroup viewGroup) { |
| 64 if (view == null) { | 78 if (view == null) { |
| 65 LayoutInflater inflater = LayoutInflater.from(getContext()); | 79 LayoutInflater inflater = LayoutInflater.from(getContext()); |
| (...skipping 26 matching lines...) Expand all Loading... |
| 92 for (int position = 0; position < itemCount; ++position) { | 106 for (int position = 0; position < itemCount; ++position) { |
| 93 PwsResult pwsResult = getItem(position); | 107 PwsResult pwsResult = getItem(position); |
| 94 if (siteUrl.equals(pwsResult.siteUrl)) { | 108 if (siteUrl.equals(pwsResult.siteUrl)) { |
| 95 return true; | 109 return true; |
| 96 } | 110 } |
| 97 } | 111 } |
| 98 | 112 |
| 99 return false; | 113 return false; |
| 100 } | 114 } |
| 101 } | 115 } |
| OLD | NEW |