1
0
mirror of https://github.com/moparisthebest/k-9 synced 2024-08-13 17:03:48 -04:00

Update issue 1623

Restored accidently dropped content resolver notification code (dropped during r2397 refactoring)
First pass at documenting exposed fields
This commit is contained in:
Fiouz 2010-10-06 20:14:33 +00:00
parent f858c72482
commit 6feb483f36
2 changed files with 52 additions and 5 deletions

View File

@ -534,6 +534,10 @@ public class K9 extends Application
{
for (final ApplicationAware aware : observers)
{
if (K9.DEBUG)
{
Log.v(K9.LOG_TAG, "Initializing observer: " + aware);
}
try
{
aware.initializeComponent(this);

View File

@ -26,6 +26,7 @@ import android.database.DataSetObserver;
import android.database.MatrixCursor;
import android.net.Uri;
import android.os.Bundle;
import android.provider.BaseColumns;
import android.util.Log;
import com.fsck.k9.Account;
@ -47,6 +48,31 @@ import com.fsck.k9.mail.store.LocalStore;
public class MessageProvider extends ContentProvider
{
public static interface MessageColumns extends BaseColumns
{
/**
* The number of milliseconds since Jan. 1, 1970, midnight GMT.
*
* <P>Type: INTEGER (long)</P>
*/
String SEND_DATE = "date";
/**
* <P>Type: TEXT</P>
*/
String SENDER = "sender";
/**
* <P>Type: TEXT</P>
*/
String SUBJECT = "subject";
/**
* <P>Type: TEXT</P>
*/
String PREVIEW = "preview";
}
protected interface QueryHandler
{
/**
@ -626,11 +652,11 @@ public class MessageProvider extends ContentProvider
private static final String[] DEFAULT_MESSAGE_PROJECTION = new String[]
{
"id",
"date",
"sender",
"subject",
"preview",
MessageColumns._ID,
MessageColumns.SEND_DATE,
MessageColumns.SENDER,
MessageColumns.SUBJECT,
MessageColumns.PREVIEW,
"account",
"uri",
"delUri"
@ -663,6 +689,23 @@ public class MessageProvider extends ContentProvider
registerQueryHandler(new ThrottlingQueryHandler(new MessagesQueryHandler()));
registerQueryHandler(new ThrottlingQueryHandler(new UnreadQueryHandler()));
K9.registerApplicationAware(new K9.ApplicationAware()
{
@Override
public void initializeComponent(final K9 application) throws Exception
{
Log.v(K9.LOG_TAG, "Registering content resolver notifier");
MessagingController.getInstance(application).addListener(new MessagingListener() {
@Override
public void searchStats(final AccountStats stats)
{
application.getContentResolver().notifyChange(CONTENT_URI, null);
}
});
}
});
return true;
}