mirror of
https://github.com/moparisthebest/open-keychain
synced 2024-12-25 16:38:50 -05:00
Add account only on jelly bean and above
This commit is contained in:
parent
0c1e65bc8b
commit
3c46c3c2df
@ -25,6 +25,7 @@ import android.content.Context;
|
|||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.graphics.PorterDuff;
|
import android.graphics.PorterDuff;
|
||||||
import android.graphics.drawable.Drawable;
|
import android.graphics.drawable.Drawable;
|
||||||
|
import android.os.Build;
|
||||||
import android.os.Environment;
|
import android.os.Environment;
|
||||||
import android.provider.ContactsContract;
|
import android.provider.ContactsContract;
|
||||||
|
|
||||||
@ -111,6 +112,8 @@ public class KeychainApplication extends Application {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static void setupAccountAsNeeded(Context context) {
|
public static void setupAccountAsNeeded(Context context) {
|
||||||
|
// only enabled for Jelly Bean because we need some newer methods in our sync adapter
|
||||||
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
|
||||||
AccountManager manager = AccountManager.get(context);
|
AccountManager manager = AccountManager.get(context);
|
||||||
Account[] accounts = manager.getAccountsByType(Constants.ACCOUNT_TYPE);
|
Account[] accounts = manager.getAccountsByType(Constants.ACCOUNT_TYPE);
|
||||||
if (accounts == null || accounts.length == 0) {
|
if (accounts == null || accounts.length == 0) {
|
||||||
@ -122,6 +125,7 @@ public class KeychainApplication extends Application {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static void brandGlowEffect(Context context, int brandColor) {
|
static void brandGlowEffect(Context context, int brandColor) {
|
||||||
// terrible hack to brand the edge overscroll glow effect
|
// terrible hack to brand the edge overscroll glow effect
|
||||||
|
@ -19,6 +19,7 @@ package org.sufficientlysecure.keychain.helper;
|
|||||||
|
|
||||||
import android.accounts.Account;
|
import android.accounts.Account;
|
||||||
import android.accounts.AccountManager;
|
import android.accounts.AccountManager;
|
||||||
|
import android.annotation.TargetApi;
|
||||||
import android.content.ContentProviderOperation;
|
import android.content.ContentProviderOperation;
|
||||||
import android.content.ContentResolver;
|
import android.content.ContentResolver;
|
||||||
import android.content.ContentUris;
|
import android.content.ContentUris;
|
||||||
@ -252,6 +253,7 @@ public class ContactHelper {
|
|||||||
return new ArrayList<String>(names);
|
return new ArrayList<String>(names);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TargetApi(Build.VERSION_CODES.JELLY_BEAN)
|
||||||
public static Uri dataUriFromContactUri(Context context, Uri contactUri) {
|
public static Uri dataUriFromContactUri(Context context, Uri contactUri) {
|
||||||
Cursor contactMasterKey = context.getContentResolver().query(contactUri,
|
Cursor contactMasterKey = context.getContentResolver().query(contactUri,
|
||||||
new String[]{ContactsContract.Data.DATA2}, null, null, null, null);
|
new String[]{ContactsContract.Data.DATA2}, null, null, null, null);
|
||||||
@ -367,6 +369,7 @@ public class ContactHelper {
|
|||||||
*
|
*
|
||||||
* @return raw contact id or -1 if not found
|
* @return raw contact id or -1 if not found
|
||||||
*/
|
*/
|
||||||
|
@TargetApi(Build.VERSION_CODES.JELLY_BEAN)
|
||||||
private static int findRawContactId(ContentResolver resolver, String fingerprint) {
|
private static int findRawContactId(ContentResolver resolver, String fingerprint) {
|
||||||
int rawContactId = -1;
|
int rawContactId = -1;
|
||||||
Cursor raw = resolver.query(ContactsContract.RawContacts.CONTENT_URI, ID_PROJECTION,
|
Cursor raw = resolver.query(ContactsContract.RawContacts.CONTENT_URI, ID_PROJECTION,
|
||||||
|
Loading…
Reference in New Issue
Block a user