Search in sources :

Example 1 with MainApplication

use of com.vodafone360.people.MainApplication in project 360-Engine-for-Android by 360.

the class DatabaseHelper method deleteTimelineActivity.

/***
     * Removes the selected timeline activity from the database.
     * 
     * @param application The MainApplication
     * @param timelineItem TimelineSummaryItem to be deleted
     * @return SUCCESS or a suitable error code
     */
public ServiceStatus deleteTimelineActivity(MainApplication application, TimelineSummaryItem timelineItem, boolean isTimelineAll) {
    if (Settings.ENABLED_DATABASE_TRACE)
        trace(false, "DatabaseHelper.deleteTimelineActivity()");
    ServiceStatus status = ServiceStatus.SUCCESS;
    if (isTimelineAll) {
        status = ActivitiesTable.deleteTimelineActivities(mContext, timelineItem, getWritableDatabase(), getReadableDatabase());
    } else {
        status = ActivitiesTable.deleteTimelineActivity(mContext, timelineItem, getWritableDatabase(), getReadableDatabase());
    }
    if (status == ServiceStatus.SUCCESS) {
        // Update Notifications in the Notification Bar
        IPeopleService peopleService = application.getServiceInterface();
        long localContactId = 0L;
        if (timelineItem.mLocalContactId != null) {
            localContactId = timelineItem.mLocalContactId;
        }
        peopleService.updateChatNotification(localContactId);
    }
    fireDatabaseChangedEvent(DatabaseChangeType.ACTIVITIES, true);
    return status;
}
Also used : ServiceStatus(com.vodafone360.people.service.ServiceStatus) IPeopleService(com.vodafone360.people.service.interfaces.IPeopleService)

Example 2 with MainApplication

use of com.vodafone360.people.MainApplication in project 360-Engine-for-Android by 360.

the class DownloadServerContactsTest method setUp.

@Override
protected void setUp() throws Exception {
    super.setUp();
    mApplication = (MainApplication) Instrumentation.newApplication(MainApplication.class, getInstrumentation().getTargetContext());
    mApplication.onCreate();
    mDb = mApplication.getDatabase();
    mDb.removeUserData();
    mEngineTester = new EngineTestFramework(this);
    mEng = new DummyContactSyncEngine(mEngineTester);
    mProcessor = new DownloadServerContactProcessorTest(mEng, mApplication.getDatabase());
    mEng.setProcessor(mProcessor);
    mEngineTester.setEngine(mEng);
    mState = State.IDLE;
    NetworkAgent.setAgentState(NetworkAgent.AgentState.CONNECTED);
}
Also used : EngineTestFramework(com.vodafone360.people.tests.engine.EngineTestFramework)

Example 3 with MainApplication

use of com.vodafone360.people.MainApplication in project 360-Engine-for-Android by 360.

the class LoginEngineTest method setUp.

@Override
protected void setUp() throws Exception {
    super.setUp();
    mApplication = (MainApplication) Instrumentation.newApplication(MainApplication.class, getInstrumentation().getTargetContext());
    mApplication.onCreate();
    mEngineTester = new EngineTestFramework(this);
    mEng = new LoginEngine(getInstrumentation().getTargetContext(), mEngineTester, mApplication.getDatabase());
    mEngineTester.setEngine(mEng);
    mState = LoginTestState.IDLE;
    mEng.addListener(this);
}
Also used : LoginEngine(com.vodafone360.people.engine.login.LoginEngine)

Example 4 with MainApplication

use of com.vodafone360.people.MainApplication in project 360-Engine-for-Android by 360.

the class RemoteService method onCreate.

/**
     * Creation of RemoteService. Loads properties (i.e. supported features,
     * server URLs etc) from SettingsManager. Creates IPeopleServiceImpl,
     * NetworkAgent. Connects ConnectionManager creating Connection thread(s)
     * and DecoderThread 'Kicks' worker thread.
     */
@Override
public void onCreate() {
    LogUtils.logV("RemoteService.onCreate()");
    SettingsManager.loadProperties(this);
    mIPeopleServiceImpl = new PeopleServiceImpl(this, this);
    mNetworkAgent = new NetworkAgent(this, this, this);
    // Create NativeContactsApi here to access Application Context
    NativeContactsApi.createInstance(getApplicationContext());
    EngineManager.createEngineManager(this, mIPeopleServiceImpl);
    mNetworkAgent.onCreate();
    mIPeopleServiceImpl.setNetworkAgent(mNetworkAgent);
    /** The service has now been fully initialised. **/
    mIsStarted = true;
    kickWorkerThread();
    final MainApplication mainApp = (MainApplication) getApplication();
    mainApp.setServiceInterface(mIPeopleServiceImpl);
    if (VersionUtils.is2XPlatform()) {
        mAccountsObjectsHolder = new NativeAccountObjectsHolder(((MainApplication) getApplication()));
    }
    final UserDataProtection userDataProtection = new UserDataProtection(this, mainApp.getDatabase());
    userDataProtection.performStartupChecks();
}
Also used : NetworkAgent(com.vodafone360.people.service.agent.NetworkAgent) UserDataProtection(com.vodafone360.people.service.utils.UserDataProtection) MainApplication(com.vodafone360.people.MainApplication)

Example 5 with MainApplication

use of com.vodafone360.people.MainApplication in project 360-Engine-for-Android by 360.

the class IdlPeopleInterface method onCreate.

@Override
public final void onCreate() {
    super.onCreate();
    LogUtils.logI("IdlPeopleInterface.onCreate() " + "Initialising IPC for com.vodafone360.people");
    if (!SettingsManager.getBooleanProperty(Settings.ENABLE_AIDL_KEY)) {
        LogUtils.logW("IdlPeopleInterface.onCreate() " + "AIDL is disabled at built time");
        return;
    }
    /** Start the Service. **/
    startService(new Intent(this, RemoteService.class));
    mApplication = (MainApplication) getApplication();
    mPeopleService = mApplication.getServiceInterface();
    if (mPeopleService == null) {
        LogUtils.logV("IdlPeopleInterface.onCreate() " + "Waiting for service to load");
        mApplication.registerServiceLoadHandler(mServiceLoadedHandler);
    }
    if (mListeners == null) {
        mListeners = new HashMap<String, IDatabaseSubscriber>();
    }
}
Also used : RemoteService(com.vodafone360.people.service.RemoteService) Intent(android.content.Intent)

Aggregations

MainApplication (com.vodafone360.people.MainApplication)12 EngineTestFramework (com.vodafone360.people.tests.engine.EngineTestFramework)4 Intent (android.content.Intent)2 ActivitiesEngine (com.vodafone360.people.engine.activities.ActivitiesEngine)2 IdentityEngine (com.vodafone360.people.engine.identities.IdentityEngine)2 LoginEngine (com.vodafone360.people.engine.login.LoginEngine)2 SyncMeEngine (com.vodafone360.people.engine.meprofile.SyncMeEngine)2 PresenceEngine (com.vodafone360.people.engine.presence.PresenceEngine)2 NetworkErrorException (android.accounts.NetworkErrorException)1 Instrumentation (android.app.Instrumentation)1 Cursor (android.database.Cursor)1 Uri (android.net.Uri)1 Bundle (android.os.Bundle)1 SmallTest (android.test.suitebuilder.annotation.SmallTest)1 Suppress (android.test.suitebuilder.annotation.Suppress)1 ContactSyncEngine (com.vodafone360.people.engine.contactsync.ContactSyncEngine)1 ContentEngine (com.vodafone360.people.engine.content.ContentEngine)1 GroupsEngine (com.vodafone360.people.engine.groups.GroupsEngine)1 Authenticator (com.vodafone360.people.service.Authenticator)1 RemoteService (com.vodafone360.people.service.RemoteService)1