Merge pull request #191 from TacoTheDank/master

Fix a few deprecations in Helper
This commit is contained in:
Marcel Bokhorst 2021-01-17 08:22:02 +01:00 committed by GitHub
commit 8191540db4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 4 deletions

View File

@ -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();