OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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.chromoting; | 5 package org.chromium.chromoting; |
6 | 6 |
7 import android.view.View; | 7 import android.view.View; |
8 import android.view.ViewGroup; | 8 import android.view.ViewGroup; |
9 import android.widget.ArrayAdapter; | 9 import android.widget.ArrayAdapter; |
10 import android.widget.TextView; | 10 import android.widget.TextView; |
(...skipping 11 matching lines...) Expand all Loading... |
22 | 22 |
23 /** Constructor. */ | 23 /** Constructor. */ |
24 public HostListAdapter(Chromoting chromoting, int textViewResourceId, HostIn
fo[] hosts) { | 24 public HostListAdapter(Chromoting chromoting, int textViewResourceId, HostIn
fo[] hosts) { |
25 super(chromoting, textViewResourceId, hosts); | 25 super(chromoting, textViewResourceId, hosts); |
26 mChromoting = chromoting; | 26 mChromoting = chromoting; |
27 } | 27 } |
28 | 28 |
29 /** Generates a View corresponding to this particular host. */ | 29 /** Generates a View corresponding to this particular host. */ |
30 @Override | 30 @Override |
31 public View getView(int position, View convertView, ViewGroup parent) { | 31 public View getView(int position, View convertView, ViewGroup parent) { |
32 TextView target = (TextView)super.getView(position, convertView, parent)
; | 32 TextView target = (TextView) super.getView(position, convertView, parent
); |
33 | 33 |
34 final HostInfo host = getItem(position); | 34 final HostInfo host = getItem(position); |
35 | 35 |
36 target.setText(host.name); | 36 target.setText(host.name); |
37 target.setCompoundDrawablesWithIntrinsicBounds( | 37 target.setCompoundDrawablesWithIntrinsicBounds( |
38 host.isOnline ? R.drawable.icon_host : R.drawable.icon_host_offl
ine, 0, 0, 0); | 38 host.isOnline ? R.drawable.icon_host : R.drawable.icon_host_offl
ine, 0, 0, 0); |
39 | 39 |
40 if (host.isOnline) { | 40 if (host.isOnline) { |
41 target.setOnClickListener(new View.OnClickListener() { | 41 target.setOnClickListener(new View.OnClickListener() { |
42 @Override | 42 @Override |
(...skipping 10 matching lines...) Expand all Loading... |
53 Toast.makeText(mChromoting, | 53 Toast.makeText(mChromoting, |
54 mChromoting.getString(R.string.host_offline_tool
tip), | 54 mChromoting.getString(R.string.host_offline_tool
tip), |
55 Toast.LENGTH_SHORT).show(); | 55 Toast.LENGTH_SHORT).show(); |
56 } | 56 } |
57 }); | 57 }); |
58 } | 58 } |
59 | 59 |
60 return target; | 60 return target; |
61 } | 61 } |
62 } | 62 } |
OLD | NEW |