mirror of
https://github.com/etesync/android
synced 2025-03-06 10:16:09 +00:00
Change LocalAddressBook to look like LocalCalendar (accept journalentity)
This commit is contained in:
parent
48a77530a8
commit
19b955f981
@ -32,6 +32,7 @@ import android.support.v4.os.OperationCanceledException;
|
|||||||
|
|
||||||
import com.etesync.syncadapter.App;
|
import com.etesync.syncadapter.App;
|
||||||
import com.etesync.syncadapter.model.CollectionInfo;
|
import com.etesync.syncadapter.model.CollectionInfo;
|
||||||
|
import com.etesync.syncadapter.model.JournalEntity;
|
||||||
import com.etesync.syncadapter.utils.Base64;
|
import com.etesync.syncadapter.utils.Base64;
|
||||||
|
|
||||||
import java.io.ByteArrayOutputStream;
|
import java.io.ByteArrayOutputStream;
|
||||||
@ -83,7 +84,8 @@ public class LocalAddressBook extends AndroidAddressBook implements LocalCollect
|
|||||||
return result.toArray(new LocalAddressBook[result.size()]);
|
return result.toArray(new LocalAddressBook[result.size()]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static LocalAddressBook create(@NonNull Context context, @NonNull ContentProviderClient provider, @NonNull Account mainAccount, @NonNull CollectionInfo info) throws ContactsStorageException {
|
public static LocalAddressBook create(@NonNull Context context, @NonNull ContentProviderClient provider, @NonNull Account mainAccount, @NonNull JournalEntity journalEntity) throws ContactsStorageException {
|
||||||
|
CollectionInfo info = journalEntity.getInfo();
|
||||||
AccountManager accountManager = AccountManager.get(context);
|
AccountManager accountManager = AccountManager.get(context);
|
||||||
|
|
||||||
Account account = new Account(accountName(mainAccount, info), App.getAddressBookAccountType());
|
Account account = new Account(accountName(mainAccount, info), App.getAddressBookAccountType());
|
||||||
@ -99,7 +101,8 @@ public class LocalAddressBook extends AndroidAddressBook implements LocalCollect
|
|||||||
return addressBook;
|
return addressBook;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void update(@NonNull CollectionInfo info) throws AuthenticatorException, OperationCanceledException, IOException, ContactsStorageException, android.accounts.OperationCanceledException {
|
public void update(@NonNull JournalEntity journalEntity) throws AuthenticatorException, OperationCanceledException, IOException, ContactsStorageException, android.accounts.OperationCanceledException {
|
||||||
|
CollectionInfo info = journalEntity.getInfo();
|
||||||
final String newAccountName = accountName(getMainAccount(), info);
|
final String newAccountName = accountName(getMainAccount(), info);
|
||||||
if (!account.name.equals(newAccountName) && Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
|
if (!account.name.equals(newAccountName) && Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
|
||||||
final AccountManager accountManager = AccountManager.get(context);
|
final AccountManager accountManager = AccountManager.get(context);
|
||||||
|
Loading…
Reference in New Issue
Block a user