Java Code Examples for android.content.ContentResolver#SYNC_OBSERVER_TYPE_ACTIVE

The following examples show how to use android.content.ContentResolver#SYNC_OBSERVER_TYPE_ACTIVE . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: BaseFragment.java    From hr with GNU Affero General Public License v3.0 6 votes vote down vote up
/** Callback invoked with the sync adapter status changes. */
@Override
public void onStatusChanged(int which) {
    boolean refreshing = false;
    switch (which) {
        case ContentResolver.SYNC_OBSERVER_TYPE_PENDING:
        case ContentResolver.SYNC_OBSERVER_TYPE_ACTIVE:
            refreshing = true;
    }
    final boolean finalRefreshing = refreshing;
    getActivity().runOnUiThread(new Runnable() {
        @Override
        public void run() {
            mSyncStatusObserverListener.onStatusChange(finalRefreshing);
        }
    });
}
 
Example 2
Source File: BaseFragment.java    From framework with GNU Affero General Public License v3.0 6 votes vote down vote up
/** Callback invoked with the sync adapter status changes. */
@Override
public void onStatusChanged(int which) {
    boolean refreshing = false;
    switch (which) {
        case ContentResolver.SYNC_OBSERVER_TYPE_PENDING:
        case ContentResolver.SYNC_OBSERVER_TYPE_ACTIVE:
            refreshing = true;
    }
    final boolean finalRefreshing = refreshing;
    getActivity().runOnUiThread(new Runnable() {
        @Override
        public void run() {
            mSyncStatusObserverListener.onStatusChange(finalRefreshing);
        }
    });
}
 
Example 3
Source File: BaseFragment.java    From hr with GNU Affero General Public License v3.0 5 votes vote down vote up
@Override
public void onResume() {
    super.onResume();
    if (OUser.current(getActivity()) == null)
        return;
    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));
}
 
Example 4
Source File: EntryListFragment.java    From android-BasicSyncAdapter with Apache License 2.0 5 votes vote down vote up
@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);
}
 
Example 5
Source File: BaseFragment.java    From framework with GNU Affero General Public License v3.0 5 votes vote down vote up
@Override
public void onResume() {
    super.onResume();
    if (OUser.current(getActivity()) == null)
        return;
    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));
}