Email unbundling: Use accessor for CursorAdapter.mCursor and ListActivity.getListView().

Also added a todo for ContentResolver.SYNC_OBSERVER_TYPE_SETTINGS.
This commit is contained in:
Makoto Onuki 2009-12-18 11:58:49 -08:00
parent 99bfd7e9b7
commit 425fd30a9c
3 changed files with 11 additions and 7 deletions

View File

@ -878,17 +878,18 @@ public class AccountFolderList extends ListActivity implements OnItemClickListen
return view;
}
if (!mCursor.moveToPosition(getRealPosition(position))) {
final Cursor cursor = getCursor();
if (!cursor.moveToPosition(getRealPosition(position))) {
throw new IllegalStateException("cursor failed move to " + position);
}
View v;
if (convertView == null) {
v = newView(mContext, mCursor, parent);
v = newView(mContext, cursor, parent);
} else {
v = convertView;
}
bindView(v, mContext, mCursor);
bindView(v, mContext, cursor);
return v;
}

View File

@ -981,7 +981,7 @@ public class MessageList extends ListActivity implements OnItemClickListener, On
if (mListFooterMode != LIST_FOOTER_MODE_NONE) {
mListFooterView = ((LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE))
.inflate(R.layout.message_list_item_footer, mListView, false);
mList.addFooterView(mListFooterView);
getListView().addFooterView(mListFooterView);
setListAdapter(mListAdapter);
mListFooterProgress = mListFooterView.findViewById(R.id.progress);
@ -1512,7 +1512,8 @@ public class MessageList extends ListActivity implements OnItemClickListener, On
*/
@Override
protected synchronized void onContentChanged() {
if (mCursor != null && !mCursor.isClosed()) {
final Cursor cursor = getCursor();
if (cursor != null && !cursor.isClosed()) {
long sinceRefresh = SystemClock.elapsedRealtime() - mLastRefreshTime;
mRefreshTimer.schedule(REFRESH_INTERVAL_MS - sinceRefresh);
}
@ -1523,8 +1524,9 @@ public class MessageList extends ListActivity implements OnItemClickListener, On
* intercepted in onContentChanged().
*/
public void doRequery() {
if (mCursor != null && !mCursor.isClosed()) {
mDataValid = mCursor.requery();
final Cursor cursor = getCursor();
if (cursor != null && !cursor.isClosed()) {
mDataValid = cursor.requery();
notifyDataSetChanged();
}
}

View File

@ -1426,6 +1426,7 @@ public class SyncManager extends Service implements Runnable {
mResolver.registerContentObserver(Mailbox.CONTENT_URI, false, mMailboxObserver);
mResolver.registerContentObserver(Message.SYNCED_CONTENT_URI, true, mSyncedMessageObserver);
mResolver.registerContentObserver(Message.CONTENT_URI, true, mMessageObserver);
// TOOD SYNC_OBSERVER_TYPE_SETTINGS is hidden. Waiting for b/2337197
ContentResolver.addStatusChangeListener(ContentResolver.SYNC_OBSERVER_TYPE_SETTINGS,
mSyncStatusObserver);
mAccountsUpdatedListener = new EasAccountsUpdatedListener();