1
0
mirror of https://github.com/moparisthebest/k-9 synced 2024-11-30 13:12:25 -05:00

. Fixed issue 504: Added feedback (spinning progress on top right) when checking email in message list

. Added error message toast when checking email fails in message list
This commit is contained in:
Bao-Long Nguyen-Trong 2009-06-21 17:20:37 +00:00
parent 47a8537f08
commit 13cc3899d6

View File

@ -15,7 +15,6 @@ import android.content.DialogInterface;
import android.content.Intent; import android.content.Intent;
import android.graphics.Typeface; import android.graphics.Typeface;
import android.graphics.drawable.Drawable; import android.graphics.drawable.Drawable;
import android.net.Uri;
import android.os.Bundle; import android.os.Bundle;
import android.os.Handler; import android.os.Handler;
import android.os.Process; import android.os.Process;
@ -35,7 +34,6 @@ import android.widget.ListView;
import android.widget.AdapterView; import android.widget.AdapterView;
import android.widget.ProgressBar; import android.widget.ProgressBar;
import android.widget.TextView; import android.widget.TextView;
import android.widget.Button;
import android.widget.Toast; import android.widget.Toast;
import android.widget.AdapterView.AdapterContextMenuInfo; import android.widget.AdapterView.AdapterContextMenuInfo;
import android.widget.AdapterView.OnItemClickListener; import android.widget.AdapterView.OnItemClickListener;
@ -45,13 +43,10 @@ import com.android.email.Account;
import com.android.email.Email; import com.android.email.Email;
import com.android.email.MessagingController; import com.android.email.MessagingController;
import com.android.email.MessagingListener; import com.android.email.MessagingListener;
import com.android.email.Preferences;
import com.android.email.R; import com.android.email.R;
import com.android.email.Utility; import com.android.email.Utility;
import com.android.email.MessagingController.SORT_TYPE; import com.android.email.MessagingController.SORT_TYPE;
import com.android.email.activity.FolderList.FolderInfoHolder;
import com.android.email.activity.MessageList.MessageInfoHolder; import com.android.email.activity.MessageList.MessageInfoHolder;
import com.android.email.activity.setup.AccountSettings;
import com.android.email.activity.setup.FolderSettings; import com.android.email.activity.setup.FolderSettings;
import com.android.email.mail.Address; import com.android.email.mail.Address;
import com.android.email.mail.Flag; import com.android.email.mail.Flag;
@ -64,8 +59,6 @@ import com.android.email.mail.store.LocalStore;
import com.android.email.mail.store.LocalStore.LocalFolder; import com.android.email.mail.store.LocalStore.LocalFolder;
import com.android.email.mail.store.LocalStore.LocalMessage; import com.android.email.mail.store.LocalStore.LocalMessage;
import android.os.PowerManager;
import android.os.PowerManager.WakeLock;
import java.util.concurrent.LinkedBlockingQueue; import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.ThreadPoolExecutor; import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
@ -902,6 +895,7 @@ public class MessageList extends K9ListActivity {
MessagingController.getInstance(getApplication()).markMessageRead(mAccount, holder.message.getFolder().getName(), holder.uid, !holder.read); MessagingController.getInstance(getApplication()).markMessageRead(mAccount, holder.message.getFolder().getName(), holder.uid, !holder.read);
holder.read = !holder.read; holder.read = !holder.read;
mHandler.dataChanged();
} }
private void onToggleFlag(MessageInfoHolder holder) { private void onToggleFlag(MessageInfoHolder holder) {
@ -1060,7 +1054,7 @@ public class MessageList extends K9ListActivity {
} }
public void showProgressIndicator(boolean status) { public void showProgressIndicator(boolean status) {
setProgressBarIndeterminateVisibility(status);
ProgressBar bar = (ProgressBar)mListView.findViewById( R.id.message_list_progress); ProgressBar bar = (ProgressBar)mListView.findViewById( R.id.message_list_progress);
if (bar == null) { if (bar == null) {
return; return;
@ -1120,6 +1114,14 @@ public class MessageList extends K9ListActivity {
private MessagingListener mListener = new MessagingListener() { private MessagingListener mListener = new MessagingListener() {
@Override
public void synchronizeMailboxStarted(Account account, String folder) {
if (!account.equals(mAccount) || !folder.equals(mFolderName)) {
return;
}
mHandler.progress(true);
}
@Override @Override
public void synchronizeMailboxNewMessage(Account account, String folder, Message message) { public void synchronizeMailboxNewMessage(Account account, String folder, Message message) {
@ -1135,6 +1137,25 @@ public class MessageList extends K9ListActivity {
removeMessage(getMessage( message.getUid())); removeMessage(getMessage( message.getUid()));
} }
@Override
public void synchronizeMailboxFinished(Account account, String folder,
int totalMessagesInMailbox, int numNewMessages) {
if (!account.equals(mAccount) || !folder.equals(mFolderName)) {
return;
}
mHandler.progress(false);
}
@Override
public void synchronizeMailboxFailed(Account account, String folder, String message) {
if (!account.equals(mAccount) || !folder.equals(mFolderName)) {
return;
}
Toast.makeText(MessageList.this, message, Toast.LENGTH_LONG).show();
}
@Override @Override
public void listLocalMessagesStarted(Account account, String folder) { public void listLocalMessagesStarted(Account account, String folder) {
if (!account.equals(mAccount)) { if (!account.equals(mAccount)) {