List of usage examples for android.content ContentResolver addStatusChangeListener
public static Object addStatusChangeListener(int mask, final SyncStatusObserver callback)
From source file:com.elegion.newsfeed.fragment.SwipeToRefreshList.java
@Override public void onResume() { super.onResume(); mRefresher.setOnRefreshListener(this); mSyncMonitor = ContentResolver.addStatusChangeListener( ContentResolver.SYNC_OBSERVER_TYPE_ACTIVE | ContentResolver.SYNC_OBSERVER_TYPE_PENDING, this); mListView.setOnItemClickListener(this); mListView.setOnTouchListener(mSwipeToDismissController); mListView.setOnScrollListener(mSwipeToDismissController); }
From source file:org.ohmage.fragments.HomeFragment.java
@Override public void onResume() { super.onResume(); syncObserverHandle = ContentResolver.addStatusChangeListener( ContentResolver.SYNC_OBSERVER_TYPE_PENDING | ContentResolver.SYNC_OBSERVER_TYPE_ACTIVE, this); checkSyncStatus();/*www . j a v a2s . c om*/ }
From source file:com.alphabetbloc.accessmrs.ui.admin.BaseAdminActivity.java
@Override protected void onResume() { mPaused = false;/*from ww w .j ava2 s . c o m*/ super.onResume(); IntentFilter filter = new IntentFilter(SyncManager.SYNC_MESSAGE); LocalBroadcastManager.getInstance(this).registerReceiver(onSyncNotice, filter); mSyncObserverHandle = ContentResolver.addStatusChangeListener(ContentResolver.SYNC_OBSERVER_TYPE_ACTIVE, this); if (RefreshDataService.isSyncActive) updateSyncProgress(); }
From source file:edu.mit.mobile.android.locast.ver2.browser.BrowserHome.java
@Override protected void onResume() { super.onResume(); mSyncHandle = ContentResolver.addStatusChangeListener(0xff, new SyncStatusObserver() { @Override//from ww w .j a v a 2 s .com public void onStatusChanged(int which) { Account a = Authenticator.getFirstAccount(BrowserHome.this); if (!ContentResolver.isSyncActive(a, MediaProvider.AUTHORITY) && !ContentResolver.isSyncPending(a, MediaProvider.AUTHORITY)) { Log.d(TAG, "Sync finished, should refresh naw!!"); mHandler.sendEmptyMessage(MSG_SET_NOT_REFRESHING); } else { Log.d(TAG, "Sync Active or Pending!!"); mHandler.sendEmptyMessage(MSG_SET_REFRESHING); } } }); //check if synch is in progress Account a = Authenticator.getFirstAccount(BrowserHome.this); if (!ContentResolver.isSyncActive(a, MediaProvider.AUTHORITY) && !ContentResolver.isSyncPending(a, MediaProvider.AUTHORITY)) { Log.d(TAG, "Sync finished, should refresh naw!!"); mHandler.sendEmptyMessage(MSG_SET_NOT_REFRESHING); } else { Log.d(TAG, "Sync Active or Pending!!"); mHandler.sendEmptyMessage(MSG_SET_REFRESHING); } if (shouldRefresh) { refresh(false); } }
From source file:edu.mit.mobile.android.locast.ver2.itineraries.ItineraryList.java
@Override protected void onResume() { super.onResume(); mSyncWhenLoaded = true;//w ww . j a v a 2 s .c o m mSyncHandle = ContentResolver.addStatusChangeListener(0xff, new SyncStatusObserver() { @Override public void onStatusChanged(int which) { Account a = Authenticator.getFirstAccount(ItineraryList.this); if (!ContentResolver.isSyncActive(a, MediaProvider.AUTHORITY) && !ContentResolver.isSyncPending(a, MediaProvider.AUTHORITY)) { Log.d(TAG, "Sync finished, should refresh naw!!"); mHandler.sendEmptyMessage(MSG_SET_NOT_REFRESHING); } else { Log.d(TAG, "Sync Active or Pending!!"); mHandler.sendEmptyMessage(MSG_SET_REFRESHING); } } }); //check if synch is in progress Account a = Authenticator.getFirstAccount(ItineraryList.this); if (!ContentResolver.isSyncActive(a, MediaProvider.AUTHORITY) && !ContentResolver.isSyncPending(a, MediaProvider.AUTHORITY)) { Log.d(TAG, "Sync finished, should refresh naw!!"); mHandler.sendEmptyMessage(MSG_SET_NOT_REFRESHING); } else { Log.d(TAG, "Sync Active or Pending!!"); mHandler.sendEmptyMessage(MSG_SET_REFRESHING); } }
From source file:com.odoo.core.support.addons.fragment.BaseFragment.java
@Override public void onResume() { super.onResume(); if (OUser.current(getActivity()) == null) return;//from w w w. j a v a 2 s . co m if (mSyncStatusObserverListener != null) { mSyncStatusObserver.onStatusChanged(0); int mask = ContentResolver.SYNC_OBSERVER_TYPE_PENDING | ContentResolver.SYNC_OBSERVER_TYPE_ACTIVE; mSyncObserverHandle = ContentResolver.addStatusChangeListener(mask, mSyncStatusObserver); } parent().registerReceiver(syncFinishReceiver, new IntentFilter(ISyncFinishReceiver.SYNC_FINISH)); }
From source file:com.ntsync.android.sync.activities.AccountListFragment.java
@Override public void onResume() { super.onResume(); getLoaderManager().restartLoader(LOADERID_ACCOUNTLIST, null, this); statusListener = ContentResolver.addStatusChangeListener(ContentResolver.SYNC_OBSERVER_TYPE_ACTIVE, this); }
From source file:com.election.US.basicsyncadapter.EntryListFragment.java
@Override public void onResume() { super.onResume(); mSyncStatusObserver.onStatusChanged(0); // Watch for sync state changes final int mask = ContentResolver.SYNC_OBSERVER_TYPE_PENDING | ContentResolver.SYNC_OBSERVER_TYPE_ACTIVE; mSyncObserverHandle = ContentResolver.addStatusChangeListener(mask, mSyncStatusObserver); }
From source file:com.meiste.tempalarm.ui.CurrentTemp.java
@Override protected void onResume() { super.onResume(); mSyncStatusObserver.onStatusChanged(0); if (checkPlayServices()) { final GoogleAccountCredential credential = AccountUtils.getCredential(this); if (credential.getSelectedAccountName() != null) { GCMHelper.registerIfNeeded(getApplicationContext(), AppConstants.GCM_SENDER_ID, this); } else {//from w ww .ja v a2 s .com startActivityForResult(credential.newChooseAccountIntent(), ACCOUNT_PICKER_REQUEST); } // Watch for sync state changes final int mask = ContentResolver.SYNC_OBSERVER_TYPE_PENDING | ContentResolver.SYNC_OBSERVER_TYPE_ACTIVE; mSyncObserverHandle = ContentResolver.addStatusChangeListener(mask, mSyncStatusObserver); } }
From source file:org.alfresco.mobile.android.application.fragments.sync.SyncFragment.java
@Override public void onResume() { getLoaderManager().restartLoader(0, null, this); hasSynchroActive = getMode() == MODE_PROGRESS || SyncContentManager.getInstance(getActivity()).hasActivateSync(acc); mContentProviderHandle = ContentResolver.addStatusChangeListener(ContentResolver.SYNC_OBSERVER_TYPE_ACTIVE, this); if (isSyncActive()) { startRefresh();/*w ww . j av a 2 s . c om*/ } super.onResume(); }