1
0
mirror of https://github.com/moparisthebest/k-9 synced 2025-02-07 02:30:10 -05: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) for (final ApplicationAware aware : observers)
{ {
if (K9.DEBUG)
{
Log.v(K9.LOG_TAG, "Initializing observer: " + aware);
}
try try
{ {
aware.initializeComponent(this); aware.initializeComponent(this);

View File

@ -26,6 +26,7 @@ import android.database.DataSetObserver;
import android.database.MatrixCursor; import android.database.MatrixCursor;
import android.net.Uri; import android.net.Uri;
import android.os.Bundle; import android.os.Bundle;
import android.provider.BaseColumns;
import android.util.Log; import android.util.Log;
import com.fsck.k9.Account; import com.fsck.k9.Account;
@ -47,6 +48,31 @@ import com.fsck.k9.mail.store.LocalStore;
public class MessageProvider extends ContentProvider 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 protected interface QueryHandler
{ {
/** /**
@ -626,11 +652,11 @@ public class MessageProvider extends ContentProvider
private static final String[] DEFAULT_MESSAGE_PROJECTION = new String[] private static final String[] DEFAULT_MESSAGE_PROJECTION = new String[]
{ {
"id", MessageColumns._ID,
"date", MessageColumns.SEND_DATE,
"sender", MessageColumns.SENDER,
"subject", MessageColumns.SUBJECT,
"preview", MessageColumns.PREVIEW,
"account", "account",
"uri", "uri",
"delUri" "delUri"
@ -663,6 +689,23 @@ public class MessageProvider extends ContentProvider
registerQueryHandler(new ThrottlingQueryHandler(new MessagesQueryHandler())); registerQueryHandler(new ThrottlingQueryHandler(new MessagesQueryHandler()));
registerQueryHandler(new ThrottlingQueryHandler(new UnreadQueryHandler())); 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; return true;
} }