Display the account name in preferences

This commit is contained in:
Lennart Rosam 2012-04-10 00:37:31 +02:00
parent cf2c2eedc5
commit a6e98cc7dc

View file

@ -24,6 +24,7 @@ import java.util.Vector;
import eu.alefzero.owncloud.OwnCloudSession;
import eu.alefzero.owncloud.R;
import eu.alefzero.owncloud.authenticator.AccountAuthenticator;
import eu.alefzero.owncloud.authenticator.AuthUtils;
import eu.alefzero.owncloud.db.DbHandler;
import android.accounts.Account;
@ -98,6 +99,12 @@ public class Preferences extends PreferenceActivity {
mAccounts = accMan.getAccountsByType(AccountAuthenticator.ACCOUNT_TYPE);
ListPreference accountList = (ListPreference) findPreference("select_oc_account");
// Display the name of the current account if there is any
Account defaultAccount = AuthUtils.getCurrentOwnCloudAccount(this);
if(defaultAccount != null){
accountList.setSummary(defaultAccount.name);
}
// Transform accounts into array of string for preferences to use
String[] accNames = new String[mAccounts.length];
for(int i = 0; i < mAccounts.length; i++){