summaryrefslogtreecommitdiffstats
path: root/remoting/android
diff options
context:
space:
mode:
authorlambroslambrou@chromium.org <lambroslambrou@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-03-27 03:02:31 +0000
committerlambroslambrou@chromium.org <lambroslambrou@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-03-27 03:02:31 +0000
commitb21a12be9fd03ecabba338db6c22207e2ca961ac (patch)
tree9ca6fd4c5c8775ea1f87f81812fd35a4eefa647c /remoting/android
parent2e91b5fba1a0d7b4aa072ab0581704a2da82d70f (diff)
downloadchromium_src-b21a12be9fd03ecabba338db6c22207e2ca961ac.zip
chromium_src-b21a12be9fd03ecabba338db6c22207e2ca961ac.tar.gz
chromium_src-b21a12be9fd03ecabba338db6c22207e2ca961ac.tar.bz2
Preserve account selection on rotating the device in Chromoting Android app
This uses a different method of reloading the accounts spinner if the device is rotated. R=jamiewalch@chromium.org Review URL: https://codereview.chromium.org/213823003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@259770 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'remoting/android')
-rw-r--r--remoting/android/java/src/org/chromium/chromoting/Chromoting.java10
1 files changed, 6 insertions, 4 deletions
diff --git a/remoting/android/java/src/org/chromium/chromoting/Chromoting.java b/remoting/android/java/src/org/chromium/chromoting/Chromoting.java
index 9a477b0..d89b92c 100644
--- a/remoting/android/java/src/org/chromium/chromoting/Chromoting.java
+++ b/remoting/android/java/src/org/chromium/chromoting/Chromoting.java
@@ -61,6 +61,9 @@ public class Chromoting extends Activity implements JniInterface.ConnectionListe
/** List of accounts on the system. */
private Account[] mAccounts;
+ /** SpinnerAdapter used in the action bar for selecting accounts. */
+ private AccountsAdapter mAccountsAdapter;
+
/** Account auth token. */
private String mToken;
@@ -191,9 +194,9 @@ public class Chromoting extends Activity implements JniInterface.ConnectionListe
getActionBar().setTitle(R.string.mode_me2me);
getActionBar().setSubtitle(mAccount.name);
} else {
- AccountsAdapter adapter = new AccountsAdapter(this, mAccounts);
+ mAccountsAdapter = new AccountsAdapter(this, mAccounts);
getActionBar().setNavigationMode(ActionBar.NAVIGATION_MODE_LIST);
- getActionBar().setListNavigationCallbacks(adapter, this);
+ getActionBar().setListNavigationCallbacks(mAccountsAdapter, this);
getActionBar().setSelectedNavigationItem(index);
}
@@ -215,8 +218,7 @@ public class Chromoting extends Activity implements JniInterface.ConnectionListe
// Reload the spinner resources, since the font sizes are dependent on the screen
// orientation.
if (mAccounts.length != 1) {
- AccountsAdapter adapter = new AccountsAdapter(this, mAccounts);
- getActionBar().setListNavigationCallbacks(adapter, this);
+ mAccountsAdapter.notifyDataSetChanged();
}
}