Revision 0ddfaa70
b/res/menu/accounts_list_menu.xml | ||
---|---|---|
1 | 1 |
<?xml version="1.0" encoding="utf-8"?> |
2 | 2 |
<menu xmlns:android="http://schemas.android.com/apk/res/android"> |
3 |
<item android:id="@+id/add_account" android:title="New Account" android:icon="@drawable/ic_menu_add"/> |
|
4 |
<item android:id="@+id/add_password" android:title="Password Lock" |
|
5 |
android:icon="@drawable/ic_menu_login"></item> |
|
6 |
<item android:title="Fanitical Support" android:id="@+id/contact_rackspace" android:icon="@drawable/ic_menu_help"></item> |
|
7 |
|
|
8 |
|
|
3 |
<item android:id="@+id/add_account" |
|
4 |
android:title="New Account" |
|
5 |
android:icon="@drawable/ic_menu_add"/> |
|
6 |
<item android:id="@+id/add_password" |
|
7 |
android:title="Password Lock" |
|
8 |
android:icon="@drawable/ic_menu_login"/> |
|
9 |
<item android:title="Fanatical Support" |
|
10 |
android:id="@+id/contact_rackspace" |
|
11 |
android:icon="@drawable/ic_menu_help"/> |
|
9 | 12 |
</menu> |
b/src/com/rackspacecloud/android/ListAccountsActivity.java | ||
---|---|---|
309 | 309 |
|
310 | 310 |
//removes the selected account from account list if remove is clicked |
311 | 311 |
public boolean onContextItemSelected(MenuItem item) { |
312 |
AdapterContextMenuInfo info = (AdapterContextMenuInfo) item.getMenuInfo(); |
|
313 |
accounts.remove(info.position); |
|
314 |
writeAccounts(); |
|
315 |
loadAccounts(); |
|
316 |
return true; |
|
312 |
if (accounts.size() == 0) { |
|
313 |
displayNoAccountsCell(); |
|
314 |
return true; |
|
315 |
} else { |
|
316 |
AdapterContextMenuInfo info = (AdapterContextMenuInfo) item.getMenuInfo(); |
|
317 |
accounts.remove(info.position); |
|
318 |
writeAccounts(); |
|
319 |
loadAccounts(); |
|
320 |
return true; |
|
321 |
} |
|
317 | 322 |
} |
318 | 323 |
|
319 | 324 |
class AccountAdapter extends ArrayAdapter<Account> { |
Also available in: Unified diff