am 67be8472: Update UI of accounts folder list and smart folders

Merge commit '67be84728a05f969ae1306fc1fed21fb1a2a8526'

* commit '67be84728a05f969ae1306fc1fed21fb1a2a8526':
  Update UI of accounts folder list and smart folders
This commit is contained in:
satok 2009-08-25 11:49:35 -07:00 committed by Android Git Automerger
commit 9a17d03970
4 changed files with 69 additions and 25 deletions

View File

@ -1,12 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2008 The Android Open Source Project
<!-- Copyright (C) 2009 The Android Open Source Project
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@ -15,12 +15,14 @@
-->
<menu xmlns:android="http://schemas.android.com/apk/res/android">
<item android:id="@+id/open_folder"
android:title="@string/open_action" />
<item android:id="@+id/compose"
android:title="@string/compose_action" />
<item android:id="@+id/refresh_account"
android:title="@string/refresh_action" />
<item android:id="@+id/edit_account"
android:title="@string/account_settings_action" />
<item android:id="@+id/delete_account"
android:title="@string/remove_account_action" />
<!-- This is probably temporary -->
<item android:id="@+id/refresh_account"
android:title="@string/refresh_action" />
</menu>

View File

@ -4,9 +4,9 @@
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@ -20,15 +20,15 @@
android:title="@string/refresh_action"
android:icon="@*android:drawable/ic_menu_refresh"
/>
<item android:id="@+id/add_new_account"
android:title="@string/add_account_action"
android:icon="@android:drawable/ic_menu_add"
/>
<item android:id="@+id/compose"
android:alphabeticShortcut="c"
android:title="@string/compose_action"
android:icon="@*android:drawable/ic_menu_compose"
/>
<item android:id="@+id/add_new_account"
android:title="@string/add_account_action"
android:icon="@android:drawable/ic_menu_add"
/>
<!--
<item android:id="@+id/search"
android:title="@string/search_action" />

View File

@ -0,0 +1,22 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2008 The Android Open Source Project
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<menu xmlns:android="http://schemas.android.com/apk/res/android">
<item android:id="@+id/open_folder"
android:title="@string/open_action" />
<item android:id="@+id/check_mail"
android:title="@string/refresh_action" />
</menu>

View File

@ -226,7 +226,7 @@ public class AccountFolderList extends ListActivity
public void onClick(View v) {
switch (v.getId()) {
case R.id.button_compose:
onCompose();
onCompose(-1);
break;
case R.id.button_refresh:
onRefresh(-1);
@ -379,10 +379,12 @@ public class AccountFolderList extends ListActivity
}
}
private void onCompose() {
long defaultAccountId = Account.getDefaultAccountId(this);
if (defaultAccountId != -1) {
MessageCompose.actionCompose(this, defaultAccountId);
private void onCompose(long accountId) {
if (accountId == -1) {
accountId = Account.getDefaultAccountId(this);
}
if (accountId != -1) {
MessageCompose.actionCompose(this, accountId);
} else {
onAddNewAccount();
}
@ -450,20 +452,35 @@ public class AccountFolderList extends ListActivity
(AdapterView.AdapterContextMenuInfo) item.getMenuInfo();
if (mListAdapter.isMailbox(menuInfo.position)) {
// TODO is there any context menu for smart mailboxes?
Cursor c = (Cursor) mListView.getItemAtPosition(menuInfo.position);
long id = c.getLong(MAILBOX_COLUMN_ID);
switch (item.getItemId()) {
case R.id.open_folder:
MessageList.actionHandleMailbox(this, id);
break;
case R.id.check_mail:
onRefresh(-1);
break;
}
return false;
} else if (mListAdapter.isAccount(menuInfo.position)) {
Cursor c = (Cursor) mListView.getItemAtPosition(menuInfo.position);
long accountId = c.getLong(Account.CONTENT_ID_COLUMN);
switch (item.getItemId()) {
case R.id.delete_account:
onDeleteAccount(accountId);
case R.id.open:
MailboxList.actionHandleAccount(this, accountId);
break;
case R.id.compose:
onCompose(accountId);
break;
case R.id.refresh_account:
onRefresh(accountId);
break;
case R.id.edit_account:
onEditAccount(accountId);
break;
case R.id.refresh_account:
onRefresh(accountId);
case R.id.delete_account:
onDeleteAccount(accountId);
break;
}
return true;
@ -481,7 +498,7 @@ public class AccountFolderList extends ListActivity
onRefresh(-1);
break;
case R.id.compose:
onCompose();
onCompose(-1);
break;
default:
return super.onOptionsItemSelected(item);
@ -505,7 +522,10 @@ public class AccountFolderList extends ListActivity
super.onCreateContextMenu(menu, v, info);
AdapterView.AdapterContextMenuInfo menuInfo = (AdapterView.AdapterContextMenuInfo) info;
if (mListAdapter.isMailbox(menuInfo.position)) {
// TODO is there any context menu for smart mailboxes?
Cursor c = (Cursor) mListView.getItemAtPosition(menuInfo.position);
String displayName = c.getString(Account.CONTENT_DISPLAY_NAME_COLUMN);
menu.setHeaderTitle(displayName);
getMenuInflater().inflate(R.menu.account_folder_list_smart_folder_context, menu);
} else if (mListAdapter.isAccount(menuInfo.position)) {
Cursor c = (Cursor) mListView.getItemAtPosition(menuInfo.position);
String accountName = c.getString(Account.CONTENT_DISPLAY_NAME_COLUMN);