mirror of https://github.com/NekoX-Dev/NekoX.git
66 lines
2.0 KiB
Java
66 lines
2.0 KiB
Java
/*
|
|
* This is the source code of Telegram for Android v. 1.3.2.
|
|
* It is licensed under GNU GPL v. 2 or later.
|
|
* You should have received a copy of the license in this archive (see LICENSE).
|
|
*
|
|
* Copyright Nikolai Kudashov, 2013.
|
|
*/
|
|
|
|
package org.telegram.android;
|
|
|
|
import android.accounts.Account;
|
|
import android.accounts.OperationCanceledException;
|
|
import android.app.Service;
|
|
import android.content.AbstractThreadedSyncAdapter;
|
|
import android.content.ContentProviderClient;
|
|
import android.content.Context;
|
|
import android.content.Intent;
|
|
import android.content.SyncResult;
|
|
import android.os.Bundle;
|
|
import android.os.IBinder;
|
|
|
|
import org.telegram.messenger.FileLog;
|
|
|
|
public class ContactsSyncAdapterService extends Service {
|
|
private static SyncAdapterImpl sSyncAdapter = null;
|
|
|
|
public ContactsSyncAdapterService() {
|
|
super();
|
|
}
|
|
|
|
private static class SyncAdapterImpl extends AbstractThreadedSyncAdapter {
|
|
private Context mContext;
|
|
|
|
public SyncAdapterImpl(Context context) {
|
|
super(context, true);
|
|
mContext = context;
|
|
}
|
|
|
|
@Override
|
|
public void onPerformSync(Account account, Bundle extras, String authority, ContentProviderClient provider, SyncResult syncResult) {
|
|
try {
|
|
ContactsSyncAdapterService.performSync(mContext, account, extras, authority, provider, syncResult);
|
|
} catch (OperationCanceledException e) {
|
|
FileLog.e("tmessages", e);
|
|
}
|
|
}
|
|
}
|
|
|
|
@Override
|
|
public IBinder onBind(Intent intent) {
|
|
return getSyncAdapter().getSyncAdapterBinder();
|
|
}
|
|
|
|
private SyncAdapterImpl getSyncAdapter() {
|
|
if (sSyncAdapter == null) {
|
|
sSyncAdapter = new SyncAdapterImpl(this);
|
|
}
|
|
return sSyncAdapter;
|
|
}
|
|
|
|
private static void performSync(Context context, Account account, Bundle extras, String authority, ContentProviderClient provider, SyncResult syncResult)
|
|
throws OperationCanceledException {
|
|
FileLog.d("telegram", "performSync: " + account.toString());
|
|
}
|
|
}
|