diff options
author | lambroslambrou@chromium.org <lambroslambrou@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-03-22 03:09:11 +0000 |
---|---|---|
committer | lambroslambrou@chromium.org <lambroslambrou@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-03-22 03:09:11 +0000 |
commit | 8aa733f378aa219140c48e6fc3dd7f41fb003031 (patch) | |
tree | febbc9d73e1963c928d9dd58fbea1ebdc1cc889a /remoting/android | |
parent | c2ca3fd18959ff2b7d7a4d1ad5f39d0dc3a61070 (diff) | |
download | chromium_src-8aa733f378aa219140c48e6fc3dd7f41fb003031.zip chromium_src-8aa733f378aa219140c48e6fc3dd7f41fb003031.tar.gz chromium_src-8aa733f378aa219140c48e6fc3dd7f41fb003031.tar.bz2 |
Move "My Computers" header into action-bar, replacing Chromoting title.
Also refactored to use ListView.setEmptyView() to show
the empty state when there are no hosts.
NOTRY=true
Review URL: https://codereview.chromium.org/207543002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@258755 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'remoting/android')
-rw-r--r-- | remoting/android/java/src/org/chromium/chromoting/Chromoting.java | 31 |
1 files changed, 8 insertions, 23 deletions
diff --git a/remoting/android/java/src/org/chromium/chromoting/Chromoting.java b/remoting/android/java/src/org/chromium/chromoting/Chromoting.java index ebf826c..05523c7 100644 --- a/remoting/android/java/src/org/chromium/chromoting/Chromoting.java +++ b/remoting/android/java/src/org/chromium/chromoting/Chromoting.java @@ -26,7 +26,6 @@ import android.view.MenuItem; import android.view.View; import android.widget.ArrayAdapter; import android.widget.ListView; -import android.widget.TextView; import android.widget.Toast; import org.chromium.chromoting.jni.JniInterface; @@ -70,18 +69,12 @@ public class Chromoting extends Activity implements JniInterface.ConnectionListe /** Refresh button. */ private MenuItem mRefreshButton; - /** Main view of this activity */ - private View mMainView; + /** Host list as it appears to the user. */ + private ListView mHostListView; - /** Progress view shown instead of the main view when the host list is loading. */ + /** Progress view shown instead of the host list when the host list is loading. */ private View mProgressView; - /** Greeting at the top of the displayed list. */ - private TextView mGreeting; - - /** Host list as it appears to the user. */ - private ListView mList; - /** Dialog for reporting connection progress. */ private ProgressDialog mProgressIndicator; @@ -128,7 +121,7 @@ public class Chromoting extends Activity implements JniInterface.ConnectionListe /** Shows or hides the progress indicator for loading the host list. */ private void setHostListProgressVisible(boolean visible) { - mMainView.setVisibility(visible ? View.GONE : View.VISIBLE); + mHostListView.setVisibility(visible ? View.GONE : View.VISIBLE); mProgressView.setVisibility(visible ? View.VISIBLE : View.GONE); } @@ -145,10 +138,9 @@ public class Chromoting extends Activity implements JniInterface.ConnectionListe mHostListLoader = new HostListLoader(); // Get ahold of our view widgets. - mMainView = findViewById(R.id.hostList_main); + mHostListView = (ListView)findViewById(R.id.hostList_chooser); + mHostListView.setEmptyView(findViewById(R.id.hostList_empty)); mProgressView = findViewById(R.id.hostList_progress); - mGreeting = (TextView)findViewById(R.id.hostList_greeting); - mList = (ListView)findViewById(R.id.hostList_chooser); // Bring native components online. JniInterface.loadLibrary(this); @@ -175,6 +167,7 @@ public class Chromoting extends Activity implements JniInterface.ConnectionListe if (mAccounts.length == 1) { getActionBar().setDisplayShowTitleEnabled(true); + getActionBar().setTitle(R.string.mode_me2me); getActionBar().setSubtitle(mAccount.name); } else { AccountsAdapter adapter = new AccountsAdapter(this, mAccounts); @@ -374,17 +367,9 @@ public class Chromoting extends Activity implements JniInterface.ConnectionListe private void updateUi() { mRefreshButton.setEnabled(mAccount != null); - if (mHosts.length == 0) { - mGreeting.setText(getString(R.string.host_list_empty_android)); - mList.setAdapter(null); - return; - } - - mGreeting.setText(getString(R.string.mode_me2me)); - ArrayAdapter<HostInfo> displayer = new HostListAdapter(this, R.layout.host, mHosts); Log.i("hostlist", "About to populate host list display"); - mList.setAdapter(displayer); + mHostListView.setAdapter(displayer); } @Override |