X-Git-Url: http://git.linex4red.de/pub/Android/ownCloud.git/blobdiff_plain/7488345470b405b06a648748b3e4039e9ae964f0..c75e5aa71cf93e677e5abb95cb3d9c1f45a64ea7:/src/com/owncloud/android/ui/activity/AccountSelectActivity.java diff --git a/src/com/owncloud/android/ui/activity/AccountSelectActivity.java b/src/com/owncloud/android/ui/activity/AccountSelectActivity.java index a98c38e7..1b73c86e 100644 --- a/src/com/owncloud/android/ui/activity/AccountSelectActivity.java +++ b/src/com/owncloud/android/ui/activity/AccountSelectActivity.java @@ -111,8 +111,11 @@ public class AccountSelectActivity extends SherlockListActivity implements @Override public boolean onCreateOptionsMenu(Menu menu) { - MenuInflater inflater = getSherlock().getMenuInflater(); - inflater.inflate(R.menu.account_picker, menu); + // Show Create Account if Multiaccount is enabled + if (getResources().getBoolean(R.bool.multiaccount_support)) { + MenuInflater inflater = getSherlock().getMenuInflater(); + inflater.inflate(R.menu.account_picker, menu); + } return true; } @@ -147,7 +150,6 @@ public class AccountSelectActivity extends SherlockListActivity implements this, null, null); - return true; } return false; @@ -197,21 +199,33 @@ public class AccountSelectActivity extends SherlockListActivity implements AccountManager am = (AccountManager) getSystemService(ACCOUNT_SERVICE); Account accounts[] = am .getAccountsByType(MainApp.getAccountType()); - LinkedList> ll = new LinkedList>(); - for (Account a : accounts) { - HashMap h = new HashMap(); - h.put("NAME", a.name); - h.put("VER", - "ownCloud version: " - + am.getUserData(a, - AccountAuthenticator.KEY_OC_VERSION)); - ll.add(h); + if (am.getAccountsByType(MainApp.getAccountType()).length == 0) { + // Show create account screen if there isn't any account + am.addAccount(MainApp.getAccountType(), + null, + null, + null, + this, + null, + null); } + else { + LinkedList> ll = new LinkedList>(); + for (Account a : accounts) { + HashMap h = new HashMap(); + h.put("NAME", a.name); + h.put("VER", + "ownCloud version: " + + am.getUserData(a, + AccountAuthenticator.KEY_OC_VERSION)); + ll.add(h); + } - setListAdapter(new AccountCheckedSimpleAdepter(this, ll, - android.R.layout.simple_list_item_single_choice, - new String[] { "NAME" }, new int[] { android.R.id.text1 })); - registerForContextMenu(getListView()); + setListAdapter(new AccountCheckedSimpleAdepter(this, ll, + android.R.layout.simple_list_item_single_choice, + new String[] { "NAME" }, new int[] { android.R.id.text1 })); + registerForContextMenu(getListView()); + } } @Override