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

Side by Side Diff: remoting/android/java/src/org/chromium/chromoting/NavigationMenuAdapter.java

Issue 1997793002: [Remoting Android] Put Icons and Credits on Navigation Menu (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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
« no previous file with comments | « remoting/android/java/src/org/chromium/chromoting/Chromoting.java ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2016 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.chromoting;
6
7 import android.content.Context;
8 import android.view.LayoutInflater;
9 import android.view.View;
10 import android.view.ViewGroup;
11 import android.widget.AdapterView;
12 import android.widget.ArrayAdapter;
13
14 /**
15 * Describes the appearance and behavior of the navigation menu. Please set this to both Adapter and
Lambros 2016/05/20 01:39:25 For the second sentence, maybe say: This also impl
Yuwei 2016/05/20 03:13:51 Done.
16 * OnItemClickListener.
17 */
18 public class NavigationMenuAdapter extends ArrayAdapter<NavigationMenuAdapter.Na vigationMenuItem>
19 implements AdapterView.OnItemClickListener {
20 /**
21 * Defines a menu item.
22 */
23 public static class NavigationMenuItem {
24 private int mLayoutResourceId;
25 private Runnable mCallback;
26 public NavigationMenuItem(int layoutResourceId, Runnable callback) {
27 mLayoutResourceId = layoutResourceId;
28 mCallback = callback;
29 }
30 }
31
32 public NavigationMenuAdapter(Context context, NavigationMenuItem[] objects) {
33 super(context, -1, objects);
34 }
35
36 /** Generates a View corresponding to the particular navigation item. */
37 @Override
38 public View getView(int position, View convertView, ViewGroup parent) {
39 if (convertView == null) {
40 NavigationMenuItem item = getItem(position);
41 LayoutInflater inflater =
42 (LayoutInflater) getContext().getSystemService(Context.LAYOU T_INFLATER_SERVICE);
43 convertView = inflater.inflate(item.mLayoutResourceId, null);
44 }
45 return convertView;
46 }
47
48
49 /** AdapterView.OnItemClickListener override. */
50 @Override
51 public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
52 getItem(position).mCallback.run();
53 }
54 }
OLDNEW
« no previous file with comments | « remoting/android/java/src/org/chromium/chromoting/Chromoting.java ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698