From 888c1871f5dd4c02c096bda2fa643df9629b0dac Mon Sep 17 00:00:00 2001 From: TacoTheDank Date: Sat, 16 Jan 2021 22:05:29 -0500 Subject: [PATCH] Fix a few deprecations in Helper --- app/src/main/java/eu/faircode/email/Helper.java | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/app/src/main/java/eu/faircode/email/Helper.java b/app/src/main/java/eu/faircode/email/Helper.java index 3af915f58a..e33ad326db 100644 --- a/app/src/main/java/eu/faircode/email/Helper.java +++ b/app/src/main/java/eu/faircode/email/Helper.java @@ -76,6 +76,7 @@ import androidx.annotation.Nullable; import androidx.appcompat.app.AlertDialog; import androidx.biometric.BiometricManager; import androidx.biometric.BiometricPrompt; +import androidx.browser.customtabs.CustomTabColorSchemeParams; import androidx.browser.customtabs.CustomTabsClient; import androidx.browser.customtabs.CustomTabsIntent; import androidx.browser.customtabs.CustomTabsServiceConnection; @@ -458,7 +459,7 @@ public class Helper { try { if (Build.VERSION.SDK_INT < Build.VERSION_CODES.M) { ContentResolver resolver = context.getContentResolver(); - int enabled = Settings.System.getInt(resolver, Settings.System.LOCK_PATTERN_ENABLED, 0); + int enabled = Settings.System.getInt(resolver, Settings.Secure.LOCK_PATTERN_ENABLED, 0); return (enabled != 0); } else { KeyguardManager kgm = (KeyguardManager) context.getSystemService(Context.KEYGUARD_SERVICE); @@ -627,12 +628,14 @@ public class Helper { } else { // https://developer.chrome.com/multidevice/android/customtabs CustomTabsIntent.Builder builder = new CustomTabsIntent.Builder(); - builder.setToolbarColor(resolveColor(context, R.attr.colorPrimary)); - builder.setSecondaryToolbarColor(resolveColor(context, R.attr.colorPrimaryDark)); + builder.setDefaultColorSchemeParams(new CustomTabColorSchemeParams.Builder() + .setToolbarColor(resolveColor(context, R.attr.colorPrimary)) + .setSecondaryToolbarColor(resolveColor(context, R.attr.colorPrimaryDark)) + .build()); builder.setColorScheme(Helper.isDarkTheme(context) ? CustomTabsIntent.COLOR_SCHEME_DARK : CustomTabsIntent.COLOR_SCHEME_LIGHT); - builder.setDefaultShareMenuItemEnabled(true); + builder.setShareState(CustomTabsIntent.SHARE_STATE_ON); builder.setUrlBarHidingEnabled(true); CustomTabsIntent customTabsIntent = builder.build();