com.vodafone360.people
Class ApplicationCache

java.lang.Object
  extended by com.vodafone360.people.ApplicationCache

public class ApplicationCache
extends java.lang.Object

Caches information about the current state of the application. Stores most recent activity and caches other information such as login details, so that the application is returned to its most recent state when brought back to the foreground or re-entered. The cached details can be cleared if required (as part of 'Remove user data' for example).


Field Summary
static java.lang.String CONTACT_DATA
           
static java.lang.String CONTACT_ID
           
static java.lang.String CONTACT_MODIFIED
           
static java.lang.String CONTACT_NAME
           
static java.lang.String CONTACT_NETWORK
           
static java.lang.String CONTACT_NUMBER
           
static int CONTACT_PROFILE_ADD
           
static int CONTACT_PROFILE_EDIT
           
static int CONTACT_PROFILE_VIEW
           
static int CONTACT_PROFILE_VIEW_ME
           
static java.lang.String CONTACT_SUMMARY
           
private static java.lang.String FACEBOOK_SUBSCRIBED
           
private static java.lang.String FALSE
           
static long[] FREQUENCY_SETTING_LONG
           
private static java.lang.String HYVES_SUBSCRIBED
           
private  boolean mAcceptedTermsAndConditions
           
private  Contact mCurrentContact
           
private  ContactSummary mCurrentContactSummary
           
private  ActivitiesTable.TimelineSummaryItem mCurrentTimelineSummary
           
private  boolean mFirstTimeLogin
           
private  int mIdentityBeingProcessed
           
private  ContactSummary mMeProfileSummary
           
private  boolean mScanThirdPartyAccounts
           
private  ServiceStatus mServiceStatus
           
private  SyncStatus mSyncStatus
          In memory cache of the current contacts sync status.
private  java.util.ArrayList<ThirdPartyAccount> mThirdPartyAccountsCache
           
static java.lang.String PREFS_CHECK_FREQUENCY
           
static java.lang.String PREFS_FILE
          Login details are stored in the preferences file so that they can be used to pre-populate the edit fields if the user is interrupted in the middle of login/signup
static java.lang.String PREFS_LAST_CHECKED_DATE
           
static java.lang.String PREFS_LAST_DIALOG_DATE
           
static java.lang.String PREFS_NAME
           
static java.lang.String PREFS_UPGRADE_LATEST_VERSION
           
static java.lang.String PREFS_UPGRADE_TEXT
           
static java.lang.String PREFS_UPGRADE_URL
           
static int RESULT_DELETE
           
static java.lang.String sIsNewMessage
           
static java.lang.String STARTUP_LAUNCH_PATH_KEY
           
static java.lang.String sWidgetProviderClassName
           
static java.lang.String THIRD_PARTY_ACCOUNT_CAPABILITIES
           
static java.lang.String THIRD_PARTY_ACCOUNT_ERROR_CODE
           
static java.lang.String THIRD_PARTY_ACCOUNT_NAME_KEY
           
static java.lang.String THIRD_PARTY_ACCOUNT_NETWORK_KEY
           
static java.lang.String THIRD_PARTY_ACCOUNT_PASSWORD_KEY
           
static java.lang.String THIRD_PARTY_ACCOUNT_USERNAME_KEY
           
private static java.lang.String TRUE
           
 
Constructor Summary
ApplicationCache()
           
 
Method Summary
protected  void clearCachedData(Context context)
          Clear all cached data currently stored in People application.
 boolean firstTimeLogin()
          Whether this is a first time login (on this device) for current account.
 boolean getAcceptedTermsAndConditions()
          Return whether user has accepted the Terms and Conditions on sign-up.
 Contact getCurrentContact()
          Gets the contact currently being viewed in the UI.
 ContactSummary getCurrentContactSummary()
          Gets the summary information of the contact currently being viewed in the UI.
 ActivitiesTable.TimelineSummaryItem getCurrentTimelineSummary()
          Gets the summary information of the Timeline currently being viewed in the UI.
 int getIdentityBeingProcessed()
          Return index of the Identity currently being processed.
 ContactSummary getMeProfile()
          Gets the ME profile object.
 boolean getScanThirdPartyAccounts()
          Return whether application should re-scan 3rd party accounts.
 ServiceStatus getServiceStatus()
          Return status of request issued to People service.
static int getSnsSubscribedWarningId(Context context)
          Return the resource ID for the SNS Subscribed warning (e.g.
 SyncStatus getSyncStatus()
          Gets the current sync state, or NULL if the state has not been set in this JVM instance.
 java.util.ArrayList<ThirdPartyAccount> getThirdPartyAccounts()
          Return cached list of 3rd party accounts (Identities) associated with current login.
private static java.lang.String getValue(Context context, java.lang.String key, java.lang.String defaultValue)
          Get a value from the preferences file.
 int[] getWidgetIdList(Context context)
          Get list of IDs of Home-screen widgets.
static boolean isBooleanValue(Context context, java.lang.String key)
           
private static boolean isFacebookInThirdPartyAccountList(java.util.ArrayList<ThirdPartyAccount> list)
          Return TRUE if the given ThirdPartyAccount contains a Facebook account.
private static boolean isHyvesInThirdPartyAccountList(java.util.ArrayList<ThirdPartyAccount> list)
          Return TRUE if the given ThirdPartyAccount contains a Hyves account.
 void setAcceptedTermsAndConditions(boolean state)
          Set whether user has accepted the Terms and Conditions on sign-up.
static void setBooleanValue(Context context, java.lang.String key, boolean value)
           
 void setCurrentContact(Contact contact)
          Sets the contact currently being viewed in the UI.
 void setCurrentContactSummary(ContactSummary contactSummary)
          Sets the summary information of the contact currently being viewed in the UI.
 void setCurrentTimelineSummary(ActivitiesTable.TimelineSummaryItem timelineSummary)
          Sets the summary information of the Timeline Item currently being viewed in the UI.
 void setFirstTimeLogin(boolean state)
          Set whether this is a first time login (on this device) for current account.
 void setIdentityBeingProcessed(int index)
          Set index of Identity currently being processed.
 void setMeProfile(ContactSummary summary)
          Sets the ME profile object.
 void setScanThirdPartyAccounts(boolean state)
          Set whether application should re-scan 3rd party accounts.
 void setServiceStatus(ServiceStatus status)
          Set status of request issued to People service.
 void setSyncStatus(SyncStatus syncStatus)
          Sets the current sync status.
private static void setValue(Context context, java.lang.String key, java.lang.String value)
          Set a value in the preferences file.
 void storeThirdPartyAccounts(Context context, java.util.ArrayList<ThirdPartyAccount> list)
          Cache list of 3rd party accounts (Identities) associated with current login.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

TRUE

private static final java.lang.String TRUE
See Also:
Constant Field Values

FALSE

private static final java.lang.String FALSE
See Also:
Constant Field Values

PREFS_FILE

public static final java.lang.String PREFS_FILE
Login details are stored in the preferences file so that they can be used to pre-populate the edit fields if the user is interrupted in the middle of login/signup

See Also:
Constant Field Values

CONTACT_DATA

public static final java.lang.String CONTACT_DATA
See Also:
Constant Field Values

CONTACT_SUMMARY

public static final java.lang.String CONTACT_SUMMARY
See Also:
Constant Field Values

CONTACT_ID

public static final java.lang.String CONTACT_ID
See Also:
Constant Field Values

CONTACT_NAME

public static final java.lang.String CONTACT_NAME
See Also:
Constant Field Values

CONTACT_NUMBER

public static final java.lang.String CONTACT_NUMBER
See Also:
Constant Field Values

CONTACT_NETWORK

public static final java.lang.String CONTACT_NETWORK
See Also:
Constant Field Values

CONTACT_MODIFIED

public static final java.lang.String CONTACT_MODIFIED
See Also:
Constant Field Values

STARTUP_LAUNCH_PATH_KEY

public static final java.lang.String STARTUP_LAUNCH_PATH_KEY
See Also:
Constant Field Values

RESULT_DELETE

public static final int RESULT_DELETE
See Also:
Constant Field Values

CONTACT_PROFILE_VIEW

public static final int CONTACT_PROFILE_VIEW
See Also:
Constant Field Values

CONTACT_PROFILE_EDIT

public static final int CONTACT_PROFILE_EDIT
See Also:
Constant Field Values

CONTACT_PROFILE_ADD

public static final int CONTACT_PROFILE_ADD
See Also:
Constant Field Values

CONTACT_PROFILE_VIEW_ME

public static final int CONTACT_PROFILE_VIEW_ME
See Also:
Constant Field Values

THIRD_PARTY_ACCOUNT_NAME_KEY

public static final java.lang.String THIRD_PARTY_ACCOUNT_NAME_KEY
See Also:
Constant Field Values

THIRD_PARTY_ACCOUNT_NETWORK_KEY

public static final java.lang.String THIRD_PARTY_ACCOUNT_NETWORK_KEY
See Also:
Constant Field Values

THIRD_PARTY_ACCOUNT_USERNAME_KEY

public static final java.lang.String THIRD_PARTY_ACCOUNT_USERNAME_KEY
See Also:
Constant Field Values

THIRD_PARTY_ACCOUNT_PASSWORD_KEY

public static final java.lang.String THIRD_PARTY_ACCOUNT_PASSWORD_KEY
See Also:
Constant Field Values

THIRD_PARTY_ACCOUNT_CAPABILITIES

public static final java.lang.String THIRD_PARTY_ACCOUNT_CAPABILITIES
See Also:
Constant Field Values

THIRD_PARTY_ACCOUNT_ERROR_CODE

public static final java.lang.String THIRD_PARTY_ACCOUNT_ERROR_CODE
See Also:
Constant Field Values

FACEBOOK_SUBSCRIBED

private static final java.lang.String FACEBOOK_SUBSCRIBED
See Also:
Constant Field Values

HYVES_SUBSCRIBED

private static final java.lang.String HYVES_SUBSCRIBED
See Also:
Constant Field Values

PREFS_NAME

public static final java.lang.String PREFS_NAME
See Also:
Constant Field Values

PREFS_CHECK_FREQUENCY

public static final java.lang.String PREFS_CHECK_FREQUENCY
See Also:
Constant Field Values

PREFS_LAST_DIALOG_DATE

public static final java.lang.String PREFS_LAST_DIALOG_DATE
See Also:
Constant Field Values

PREFS_LAST_CHECKED_DATE

public static final java.lang.String PREFS_LAST_CHECKED_DATE
See Also:
Constant Field Values

PREFS_UPGRADE_LATEST_VERSION

public static final java.lang.String PREFS_UPGRADE_LATEST_VERSION
See Also:
Constant Field Values

PREFS_UPGRADE_URL

public static final java.lang.String PREFS_UPGRADE_URL
See Also:
Constant Field Values

PREFS_UPGRADE_TEXT

public static final java.lang.String PREFS_UPGRADE_TEXT
See Also:
Constant Field Values

sWidgetProviderClassName

public static java.lang.String sWidgetProviderClassName

sIsNewMessage

public static java.lang.String sIsNewMessage

FREQUENCY_SETTING_LONG

public static final long[] FREQUENCY_SETTING_LONG

mSyncStatus

private SyncStatus mSyncStatus
In memory cache of the current contacts sync status.


mFirstTimeLogin

private boolean mFirstTimeLogin

mScanThirdPartyAccounts

private boolean mScanThirdPartyAccounts

mAcceptedTermsAndConditions

private boolean mAcceptedTermsAndConditions

mIdentityBeingProcessed

private int mIdentityBeingProcessed

mThirdPartyAccountsCache

private java.util.ArrayList<ThirdPartyAccount> mThirdPartyAccountsCache

mMeProfileSummary

private ContactSummary mMeProfileSummary

mCurrentContact

private Contact mCurrentContact

mCurrentContactSummary

private ContactSummary mCurrentContactSummary

mServiceStatus

private ServiceStatus mServiceStatus

mCurrentTimelineSummary

private ActivitiesTable.TimelineSummaryItem mCurrentTimelineSummary
Constructor Detail

ApplicationCache

public ApplicationCache()
Method Detail

firstTimeLogin

public boolean firstTimeLogin()
Whether this is a first time login (on this device) for current account.

Returns:
True if this is the first login for current account.

setFirstTimeLogin

public void setFirstTimeLogin(boolean state)
Set whether this is a first time login (on this device) for current account. If we have not logged in on this device (or after 'Remove user data') we will need to perform the first time 'full' time contact sync.

Parameters:
aState - True if this is our 1st time sync.

setScanThirdPartyAccounts

public void setScanThirdPartyAccounts(boolean state)
Set whether application should re-scan 3rd party accounts.

Parameters:
state - true if application should re-scan 3rd party accounts.

getScanThirdPartyAccounts

public boolean getScanThirdPartyAccounts()
Return whether application should re-scan 3rd party accounts.

Returns:
true if application should re-scan 3rd party accounts.

setIdentityBeingProcessed

public void setIdentityBeingProcessed(int index)
Set index of Identity currently being processed.

Parameters:
index - Index of Identity currently being processed.

getIdentityBeingProcessed

public int getIdentityBeingProcessed()
Return index of the Identity currently being processed.

Returns:
index of the Identity currently being processed.

setAcceptedTermsAndConditions

public void setAcceptedTermsAndConditions(boolean state)
Set whether user has accepted the Terms and Conditions on sign-up.

Parameters:
state - true if user has accepted terms and conditions.

getAcceptedTermsAndConditions

public boolean getAcceptedTermsAndConditions()
Return whether user has accepted the Terms and Conditions on sign-up.

Returns:
true if user has accepted terms and conditions.

clearCachedData

protected void clearCachedData(Context context)
Clear all cached data currently stored in People application.


getMeProfile

public ContactSummary getMeProfile()
Gets the ME profile object.

Returns:
The ME profile object.

setMeProfile

public void setMeProfile(ContactSummary summary)
Sets the ME profile object.

Parameters:
summary - ContyactSummary for Me profile.

getCurrentContact

public Contact getCurrentContact()
Gets the contact currently being viewed in the UI.

Returns:
The currently view contact.

setCurrentContact

public void setCurrentContact(Contact contact)
Sets the contact currently being viewed in the UI.

Parameters:
contact - The currently viewed contact.

getCurrentContactSummary

public ContactSummary getCurrentContactSummary()
Gets the summary information of the contact currently being viewed in the UI.

Returns:
Contact summary information.

setCurrentContactSummary

public void setCurrentContactSummary(ContactSummary contactSummary)
Sets the summary information of the contact currently being viewed in the UI.

Parameters:
contactSummary - Contact summary information.

getServiceStatus

public ServiceStatus getServiceStatus()
Return status of request issued to People service.

Returns:
status of request issued to People service.

setServiceStatus

public void setServiceStatus(ServiceStatus status)
Set status of request issued to People service.

Parameters:
status - of request issued to People service.

storeThirdPartyAccounts

public void storeThirdPartyAccounts(Context context,
                                    java.util.ArrayList<ThirdPartyAccount> list)
Cache list of 3rd party accounts (Identities) associated with current login.

Parameters:
list - List of ThirdPartyAccount items retrieved from current login.

getThirdPartyAccounts

public java.util.ArrayList<ThirdPartyAccount> getThirdPartyAccounts()
Return cached list of 3rd party accounts (Identities) associated with current login.

Returns:
List of ThirdPartyAccount items retrieved from current login.

isFacebookInThirdPartyAccountList

private static boolean isFacebookInThirdPartyAccountList(java.util.ArrayList<ThirdPartyAccount> list)
Return TRUE if the given ThirdPartyAccount contains a Facebook account.

Parameters:
list - List of ThirdPartyAccount objects, can be NULL.
Returns:
TRUE if the given ThirdPartyAccount contains a Facebook account.

isHyvesInThirdPartyAccountList

private static boolean isHyvesInThirdPartyAccountList(java.util.ArrayList<ThirdPartyAccount> list)
Return TRUE if the given ThirdPartyAccount contains a Hyves account.

Parameters:
list - List of ThirdPartyAccount objects, can be NULL.
Returns:
TRUE if the given ThirdPartyAccount contains a Hyves account.

getWidgetIdList

public int[] getWidgetIdList(Context context)
Get list of IDs of Home-screen widgets.

Parameters:
context - Current context.
Returns:
list of IDs of Home-screen widgets.

setValue

private static void setValue(Context context,
                             java.lang.String key,
                             java.lang.String value)
Set a value in the preferences file.

Parameters:
context - Android context.
key - Preferences file parameter key.
value - Preference value.

getSyncStatus

public SyncStatus getSyncStatus()
Gets the current sync state, or NULL if the state has not been set in this JVM instance.

Returns:
SyncStatus or NULL.

setSyncStatus

public void setSyncStatus(SyncStatus syncStatus)
Sets the current sync status.

Parameters:
syncStatus - New sync status.

getValue

private static java.lang.String getValue(Context context,
                                         java.lang.String key,
                                         java.lang.String defaultValue)
Get a value from the preferences file.

Parameters:
context - Android context.
key - Preferences file parameter key.
defaultValue - Preference value.
Returns:

getSnsSubscribedWarningId

public static int getSnsSubscribedWarningId(Context context)
Return the resource ID for the SNS Subscribed warning (e.g. facebook/hyves/etc posting), or -1 if no warning is necessary.

Parameters:
context - Android context.
Returns:
Resource ID for textView or -1 is warning is not required.
Throws:
java.security.InvalidParameterException - when context is NULL.

isBooleanValue

public static boolean isBooleanValue(Context context,
                                     java.lang.String key)

setBooleanValue

public static void setBooleanValue(Context context,
                                   java.lang.String key,
                                   boolean value)

getCurrentTimelineSummary

public ActivitiesTable.TimelineSummaryItem getCurrentTimelineSummary()
Gets the summary information of the Timeline currently being viewed in the UI.

Returns:
Timeline summary information.

setCurrentTimelineSummary

public void setCurrentTimelineSummary(ActivitiesTable.TimelineSummaryItem timelineSummary)
Sets the summary information of the Timeline Item currently being viewed in the UI.

Parameters:
timelineSummary - Timeline summary information.


JavaDoc