|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.vodafone360.people.engine.activities.FetchSmsLogEvents
public class FetchSmsLogEvents
Fetches SMS/MMS log events from the Native message log. These are treated as Activities and displayed in Timeline UI.
Nested Class Summary | |
---|---|
private static class |
FetchSmsLogEvents.InternalState
Internal states for message log sync: Idle,, fetching SMS events, fetching MMS events. |
Field Summary | |
---|---|
private static int |
COLUMN_SMS_ADDRESS
|
private static int |
COLUMN_SMS_BODY
|
private static int |
COLUMN_SMS_DATE
|
private static int |
COLUMN_SMS_ID
|
private static int |
COLUMN_SMS_SUBJECT
|
private static int |
COLUMN_SMS_THREAD_ID
|
private static int |
COLUMN_SMS_TYPE
|
private static int |
MAX_DESC_LENGTH
|
private static int |
MAX_ITEMS_PER_PAGE
|
private static int |
MAX_ITEMS_TO_WRITE
|
private static int |
MAX_PAGES_TO_LOAD_AT_ONCE
the number of timeline pages to be loaded by one ISyncHelper |
private Context |
mContext
|
private ContentResolver |
mCr
|
private DatabaseHelper |
mDb
|
private ActivitiesEngine |
mEngine
|
private static int |
MESSAGE_TYPE_INBOX
|
private static int |
MESSAGE_TYPE_SENT
|
private FetchSmsLogEvents.InternalState |
mInternalState
|
private Cursor |
mMmsCursor
|
private long |
mNewestMessage
the current newest message time |
private long |
mOldestMessage
the current oldest message time |
private int |
mPageCount
the number of pages have been read |
private boolean |
mRefresh
is true if newer events need to be loaded, false - if older |
private Cursor |
mSmsCursor
|
private java.util.ArrayList<ActivitiesTable.TimelineSummaryItem> |
mSyncItemList
|
protected static Uri |
SMS_CONTENT_URI
|
private static java.lang.String[] |
SMS_PROJECTION
|
private static java.lang.String |
SMS_SORT_ORDER
|
Constructor Summary | |
---|---|
FetchSmsLogEvents(Context context,
ActivitiesEngine engine,
DatabaseHelper db,
boolean refresh)
Constructor. |
Method Summary | |
---|---|
private void |
addSmsData(int id)
Create TimelineSummaryItem from Native message-log item. |
void |
cancel()
Cancel message log sync. |
private void |
complete(ServiceStatus status)
/** Completion of fetch from Native message log. |
private ActivityItem.Type |
nativeToNpTypeConvert(int type)
Convert Native message type (Inbox, Sent) to corresponding ActivityItem type. |
void |
run()
Drive internal state machine, either start call log sync, fetch next page of SMS items, next page of MMS items or complete call-log sync operation. |
private void |
saveTimeStampMms()
This method updates the newest and oldest MMS timestamps in the database. |
private void |
saveTimeStampSms()
This method updates the newest and oldest SMS timestamps in the database. |
private void |
startSyncMms()
Start sync. of MMS message events. |
private void |
startSyncSms()
Start sync of SMS message events. |
private void |
syncNextMmsPage()
Sync. next page of MMS events (current page size is 2). |
private void |
syncNextSmsPage()
Sync. next page of SMS events (current page size is 2). |
private void |
updateTimestamps()
This method goes through the event list and updates the current newest and oldest message timestamps. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected static final Uri SMS_CONTENT_URI
private static final int MAX_PAGES_TO_LOAD_AT_ONCE
private static final int MAX_ITEMS_PER_PAGE
private static final int MAX_ITEMS_TO_WRITE
private static final int MAX_DESC_LENGTH
private static final java.lang.String SMS_SORT_ORDER
private static final java.lang.String[] SMS_PROJECTION
private static final int COLUMN_SMS_ID
private static final int COLUMN_SMS_DATE
private static final int COLUMN_SMS_ADDRESS
private static final int COLUMN_SMS_SUBJECT
private static final int COLUMN_SMS_BODY
private static final int COLUMN_SMS_TYPE
private static final int COLUMN_SMS_THREAD_ID
private static final int MESSAGE_TYPE_INBOX
private static final int MESSAGE_TYPE_SENT
private Context mContext
private ActivitiesEngine mEngine
private DatabaseHelper mDb
private ContentResolver mCr
private FetchSmsLogEvents.InternalState mInternalState
private Cursor mSmsCursor
private Cursor mMmsCursor
private java.util.ArrayList<ActivitiesTable.TimelineSummaryItem> mSyncItemList
private boolean mRefresh
private int mPageCount
private long mOldestMessage
private long mNewestMessage
Constructor Detail |
---|
FetchSmsLogEvents(Context context, ActivitiesEngine engine, DatabaseHelper db, boolean refresh)
context
- Context - actually RemoteServe's Context.engine
- Handle to ActivitiesEngine.db
- Handle to DatabaseHelper.refresh
- - true if we need to fetch new sms, false if older.Method Detail |
---|
public void run()
run
in interface ActivitiesEngine.ISyncHelper
private void complete(ServiceStatus status)
status
- ServiceStatus containing result of sync.private void startSyncSms()
private void startSyncMms()
private void syncNextSmsPage()
private void updateTimestamps()
private void saveTimeStampMms()
private void saveTimeStampSms()
private void syncNextMmsPage()
private void addSmsData(int id)
id
- ID of item from Native log.private ActivityItem.Type nativeToNpTypeConvert(int type)
type
- Native message type.
public void cancel()
cancel
in interface ActivitiesEngine.ISyncHelper
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
JavaDoc