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;
}
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);
}
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);
}
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();
}
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>();
}
}
Aggregations