| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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.annotation.SuppressLint; | 7 import android.annotation.SuppressLint; |
| 8 import android.app.ProgressDialog; | 8 import android.app.ProgressDialog; |
| 9 import android.content.DialogInterface; | 9 import android.content.DialogInterface; |
| 10 import android.content.Intent; | 10 import android.content.Intent; |
| (...skipping 477 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 488 public void onClick(DialogInterface dialog, int whic
h) { | 488 public void onClick(DialogInterface dialog, int whic
h) { |
| 489 deleteHost(hostId); | 489 deleteHost(hostId); |
| 490 dialog.dismiss(); | 490 dialog.dismiss(); |
| 491 } | 491 } |
| 492 }) | 492 }) |
| 493 .setNegativeButton(android.R.string.no, null) | 493 .setNegativeButton(android.R.string.no, null) |
| 494 .create().show(); | 494 .create().show(); |
| 495 } | 495 } |
| 496 | 496 |
| 497 /** Called when the user taps on a host entry. */ | 497 /** Called when the user taps on a host entry. */ |
| 498 private void onHostClicked(int index) { | 498 public void onHostClicked(int index) { |
| 499 HostInfo host = mHosts[index]; | 499 HostInfo host = mHosts[index]; |
| 500 if (host.isOnline) { | 500 if (host.isOnline) { |
| 501 connectToHost(host); | 501 connectToHost(host); |
| 502 } else { | 502 } else { |
| 503 String tooltip = host.getHostOfflineReasonText(this); | 503 String tooltip = host.getHostOfflineReasonText(this); |
| 504 Toast.makeText(this, tooltip, Toast.LENGTH_SHORT).show(); | 504 Toast.makeText(this, tooltip, Toast.LENGTH_SHORT).show(); |
| 505 } | 505 } |
| 506 } | 506 } |
| 507 | 507 |
| 508 private void connectToHost(final HostInfo host) { | 508 private void connectToHost(final HostInfo host) { |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 606 mDrawerLayout.closeDrawers(); | 606 mDrawerLayout.closeDrawers(); |
| 607 } | 607 } |
| 608 | 608 |
| 609 @Override | 609 @Override |
| 610 public void onHostListReceived(HostInfo[] hosts) { | 610 public void onHostListReceived(HostInfo[] hosts) { |
| 611 // Store a copy of the array, so that it can't be mutated by the HostLis
tManager. HostInfo | 611 // Store a copy of the array, so that it can't be mutated by the HostLis
tManager. HostInfo |
| 612 // is an immutable type, so a shallow copy of the array is sufficient he
re. | 612 // is an immutable type, so a shallow copy of the array is sufficient he
re. |
| 613 mHosts = Arrays.copyOf(hosts, hosts.length); | 613 mHosts = Arrays.copyOf(hosts, hosts.length); |
| 614 updateHostListView(); | 614 updateHostListView(); |
| 615 updateUi(); | 615 updateUi(); |
| 616 |
| 617 ConnectAndCancelTest.getTest().start(this); |
| 616 } | 618 } |
| 617 | 619 |
| 618 @Override | 620 @Override |
| 619 public void onHostUpdated() { | 621 public void onHostUpdated() { |
| 620 // Not implemented Yet. | 622 // Not implemented Yet. |
| 621 } | 623 } |
| 622 | 624 |
| 623 @Override | 625 @Override |
| 624 public void onHostDeleted() { | 626 public void onHostDeleted() { |
| 625 // Refresh the host list. there is no need to refetch the auth token aga
in. | 627 // Refresh the host list. there is no need to refetch the auth token aga
in. |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 708 // Unreachable, but required by Google Java style and findbugs. | 710 // Unreachable, but required by Google Java style and findbugs. |
| 709 assert false : "Unreached"; | 711 assert false : "Unreached"; |
| 710 } | 712 } |
| 711 | 713 |
| 712 if (dismissProgress && mProgressIndicator != null) { | 714 if (dismissProgress && mProgressIndicator != null) { |
| 713 mProgressIndicator.dismiss(); | 715 mProgressIndicator.dismiss(); |
| 714 mProgressIndicator = null; | 716 mProgressIndicator = null; |
| 715 } | 717 } |
| 716 } | 718 } |
| 717 } | 719 } |
| OLD | NEW |