summaryrefslogtreecommitdiffstats
path: root/remoting/android
diff options
context:
space:
mode:
authorlambroslambrou@chromium.org <lambroslambrou@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-03-26 05:25:02 +0000
committerlambroslambrou@chromium.org <lambroslambrou@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-03-26 05:25:02 +0000
commit439be42cd51dfdd2544c7f4d77e167a8142bb35b (patch)
tree7c981c6aa51ca7219ccfaf63122643b9e9b270d3 /remoting/android
parent522a5bb8e2e22bb226f6c882839c37324e7c76d2 (diff)
downloadchromium_src-439be42cd51dfdd2544c7f4d77e167a8142bb35b.zip
chromium_src-439be42cd51dfdd2544c7f4d77e167a8142bb35b.tar.gz
chromium_src-439be42cd51dfdd2544c7f4d77e167a8142bb35b.tar.bz2
Improve host-list appearance in Chromoting Android client.
This removes the non-localized ONLINE/OFFLINE text, and adds new styling to distinguish offline hosts. This also adds toast to indicate a host is offline. BUG=331103,355868 Review URL: https://codereview.chromium.org/211953002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@259511 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'remoting/android')
-rw-r--r--remoting/android/java/src/org/chromium/chromoting/HostListAdapter.java22
1 files changed, 14 insertions, 8 deletions
diff --git a/remoting/android/java/src/org/chromium/chromoting/HostListAdapter.java b/remoting/android/java/src/org/chromium/chromoting/HostListAdapter.java
index 28c6e43..1d38ec8 100644
--- a/remoting/android/java/src/org/chromium/chromoting/HostListAdapter.java
+++ b/remoting/android/java/src/org/chromium/chromoting/HostListAdapter.java
@@ -4,11 +4,11 @@
package org.chromium.chromoting;
-import android.text.Html;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.TextView;
+import android.widget.Toast;
/** Describes the appearance and behavior of each host list entry. */
class HostListAdapter extends ArrayAdapter<HostInfo> {
@@ -33,11 +33,9 @@ class HostListAdapter extends ArrayAdapter<HostInfo> {
final HostInfo host = getItem(position);
- // TODO(lambroslambrou): Don't use hardcoded ONLINE/OFFLINE strings here.
- // See http://crbug.com/331103
- target.setText(Html.fromHtml(host.name + " (<font color=\"" +
- (host.isOnline ? HOST_COLOR_ONLINE : HOST_COLOR_OFFLINE) + "\">" +
- (host.isOnline ? "ONLINE" : "OFFLINE") + "</font>)"));
+ target.setText(host.name);
+ target.setCompoundDrawablesWithIntrinsicBounds(
+ host.isOnline ? R.drawable.icon_host : R.drawable.icon_host_offline, 0, 0, 0);
if (host.isOnline) {
target.setOnClickListener(new View.OnClickListener() {
@@ -47,8 +45,16 @@ class HostListAdapter extends ArrayAdapter<HostInfo> {
}
});
} else {
- // Disallow interaction with this entry.
- target.setEnabled(false);
+ target.setTextColor(mChromoting.getResources().getColor(R.color.host_offline_text));
+ target.setBackgroundResource(R.drawable.list_item_disabled_selector);
+ target.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ Toast.makeText(mChromoting,
+ mChromoting.getString(R.string.host_offline_tooltip),
+ Toast.LENGTH_SHORT).show();
+ }
+ });
}
return target;