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

Unified Diff: chrome/android/java/src/org/chromium/chrome/browser/physicalweb/NearbyUrlsAdapter.java

Issue 1412423007: Modify Physical Web Nearby URLs list to resemble search results (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: wip (fix maxLines->singleLine) Created 5 years, 2 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/android/java/src/org/chromium/chrome/browser/physicalweb/ListUrlsActivity.java ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/android/java/src/org/chromium/chrome/browser/physicalweb/NearbyUrlsAdapter.java
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/physicalweb/NearbyUrlsAdapter.java b/chrome/android/java/src/org/chromium/chrome/browser/physicalweb/NearbyUrlsAdapter.java
new file mode 100644
index 0000000000000000000000000000000000000000..fffd6c9164117b77ff70fa147cbf5d2b966b8e9d
--- /dev/null
+++ b/chrome/android/java/src/org/chromium/chrome/browser/physicalweb/NearbyUrlsAdapter.java
@@ -0,0 +1,56 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+package org.chromium.chrome.browser.physicalweb;
+
+import android.content.Context;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.ArrayAdapter;
+import android.widget.ImageView;
+import android.widget.TextView;
+
+import org.chromium.chrome.R;
+
+/**
+ * Adapter for displaying nearby URLs and associated metadata.
+ */
+class NearbyUrlsAdapter extends ArrayAdapter<PwsResult> {
+
+ /**
+ * Construct an empty NearbyUrlsAdapter.
+ */
+ public NearbyUrlsAdapter(Context context) {
+ super(context, 0);
+ }
+
+ /**
+ * Get the view for an item in the data set.
+ * @param position Index of the list view item within the array.
+ * @param view The old view to reuse, if possible.
+ * @param viewGroup The parent that this view will eventually be attached to.
+ * @return A view corresponding to the list view item.
+ */
+ @Override
+ public View getView(int position, View view, ViewGroup viewGroup) {
+ if (view == null) {
+ LayoutInflater inflater = LayoutInflater.from(getContext());
+ view = inflater.inflate(R.layout.physical_web_list_item_nearby_url, viewGroup, false);
+ }
+
+ TextView titleTextView = (TextView) view.findViewById(R.id.nearby_urls_title);
+ TextView urlTextView = (TextView) view.findViewById(R.id.nearby_urls_url);
+ TextView descriptionTextView = (TextView) view.findViewById(R.id.nearby_urls_description);
+ ImageView iconImageView = (ImageView) view.findViewById(R.id.nearby_urls_icon);
+
+ PwsResult pwsResult = getItem(position);
+ titleTextView.setText(pwsResult.title);
+ urlTextView.setText(pwsResult.siteUrl);
+ descriptionTextView.setText(pwsResult.description);
+ iconImageView.setImageBitmap(null);
+
+ return view;
+ }
+}
« no previous file with comments | « chrome/android/java/src/org/chromium/chrome/browser/physicalweb/ListUrlsActivity.java ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698