Merge pull request #191 from TacoTheDank/master

Fix a few deprecations in Helper
pull/193/head
Marcel Bokhorst 4 years ago committed by GitHub
commit 8191540db4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -76,6 +76,7 @@ import androidx.annotation.Nullable;
import androidx.appcompat.app.AlertDialog; import androidx.appcompat.app.AlertDialog;
import androidx.biometric.BiometricManager; import androidx.biometric.BiometricManager;
import androidx.biometric.BiometricPrompt; import androidx.biometric.BiometricPrompt;
import androidx.browser.customtabs.CustomTabColorSchemeParams;
import androidx.browser.customtabs.CustomTabsClient; import androidx.browser.customtabs.CustomTabsClient;
import androidx.browser.customtabs.CustomTabsIntent; import androidx.browser.customtabs.CustomTabsIntent;
import androidx.browser.customtabs.CustomTabsServiceConnection; import androidx.browser.customtabs.CustomTabsServiceConnection;
@ -458,7 +459,7 @@ public class Helper {
try { try {
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.M) { if (Build.VERSION.SDK_INT < Build.VERSION_CODES.M) {
ContentResolver resolver = context.getContentResolver(); 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); return (enabled != 0);
} else { } else {
KeyguardManager kgm = (KeyguardManager) context.getSystemService(Context.KEYGUARD_SERVICE); KeyguardManager kgm = (KeyguardManager) context.getSystemService(Context.KEYGUARD_SERVICE);
@ -627,12 +628,14 @@ public class Helper {
} else { } else {
// https://developer.chrome.com/multidevice/android/customtabs // https://developer.chrome.com/multidevice/android/customtabs
CustomTabsIntent.Builder builder = new CustomTabsIntent.Builder(); CustomTabsIntent.Builder builder = new CustomTabsIntent.Builder();
builder.setToolbarColor(resolveColor(context, R.attr.colorPrimary)); builder.setDefaultColorSchemeParams(new CustomTabColorSchemeParams.Builder()
builder.setSecondaryToolbarColor(resolveColor(context, R.attr.colorPrimaryDark)); .setToolbarColor(resolveColor(context, R.attr.colorPrimary))
.setSecondaryToolbarColor(resolveColor(context, R.attr.colorPrimaryDark))
.build());
builder.setColorScheme(Helper.isDarkTheme(context) builder.setColorScheme(Helper.isDarkTheme(context)
? CustomTabsIntent.COLOR_SCHEME_DARK ? CustomTabsIntent.COLOR_SCHEME_DARK
: CustomTabsIntent.COLOR_SCHEME_LIGHT); : CustomTabsIntent.COLOR_SCHEME_LIGHT);
builder.setDefaultShareMenuItemEnabled(true); builder.setShareState(CustomTabsIntent.SHARE_STATE_ON);
builder.setUrlBarHidingEnabled(true); builder.setUrlBarHidingEnabled(true);
CustomTabsIntent customTabsIntent = builder.build(); CustomTabsIntent customTabsIntent = builder.build();

Loading…
Cancel
Save