|
@@ -33,7 +33,6 @@ import android.content.pm.PackageManager.NameNotFoundException;
|
|
|
import android.content.res.Configuration;
|
|
|
import android.graphics.drawable.ColorDrawable;
|
|
|
import android.net.Uri;
|
|
|
-import android.os.Build;
|
|
|
import android.os.Bundle;
|
|
|
import android.preference.ListPreference;
|
|
|
import android.preference.Preference;
|
|
@@ -89,7 +88,6 @@ import javax.inject.Inject;
|
|
|
|
|
|
import androidx.annotation.LayoutRes;
|
|
|
import androidx.annotation.NonNull;
|
|
|
-import androidx.annotation.RequiresApi;
|
|
|
import androidx.annotation.VisibleForTesting;
|
|
|
import androidx.appcompat.app.ActionBar;
|
|
|
import androidx.appcompat.app.AlertDialog;
|
|
@@ -421,7 +419,7 @@ public class SettingsActivity extends ThemedPreferenceActivity
|
|
|
|
|
|
Preference pMnemonic = findPreference("mnemonic");
|
|
|
if (pMnemonic != null) {
|
|
|
- if (!mnemonic.isEmpty() && Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
|
|
|
+ if (!mnemonic.isEmpty()) {
|
|
|
if (DeviceCredentialUtils.areCredentialsAvailable(this)) {
|
|
|
pMnemonic.setOnPreferenceClickListener(preference -> {
|
|
|
|
|
@@ -571,8 +569,8 @@ public class SettingsActivity extends ThemedPreferenceActivity
|
|
|
if (!passCodeEnabled) {
|
|
|
lockEntries.remove(1);
|
|
|
lockValues.remove(1);
|
|
|
- } else if (!deviceCredentialsEnabled || Build.VERSION.SDK_INT < Build.VERSION_CODES.M ||
|
|
|
- !DeviceCredentialUtils.areCredentialsAvailable(getApplicationContext())) {
|
|
|
+ } else if (!deviceCredentialsEnabled ||
|
|
|
+ !DeviceCredentialUtils.areCredentialsAvailable(getApplicationContext())) {
|
|
|
lockEntries.remove(2);
|
|
|
lockValues.remove(2);
|
|
|
}
|
|
@@ -628,8 +626,7 @@ public class SettingsActivity extends ThemedPreferenceActivity
|
|
|
|
|
|
Preference pSyncedFolder = findPreference("synced_folders_configure_folders");
|
|
|
if (pSyncedFolder != null) {
|
|
|
- if (getResources().getBoolean(R.bool.syncedFolder_light)
|
|
|
- && Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
|
|
|
+ if (getResources().getBoolean(R.bool.syncedFolder_light)) {
|
|
|
pSyncedFolder.setOnPreferenceClickListener(preference -> {
|
|
|
Intent intent = new Intent(this, SyncedFoldersActivity.class);
|
|
|
startActivity(intent);
|
|
@@ -649,8 +646,7 @@ public class SettingsActivity extends ThemedPreferenceActivity
|
|
|
i.setAction(PassCodeActivity.ACTION_REQUEST_WITH_RESULT);
|
|
|
startActivityForResult(i, ACTION_REQUEST_PASSCODE);
|
|
|
} else if (LOCK_DEVICE_CREDENTIALS.equals(lock)){
|
|
|
- if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M &&
|
|
|
- !DeviceCredentialUtils.areCredentialsAvailable(getApplicationContext())) {
|
|
|
+ if (!DeviceCredentialUtils.areCredentialsAvailable(getApplicationContext())) {
|
|
|
DisplayUtils.showSnackMessage(this, R.string.prefs_lock_device_credentials_not_setup);
|
|
|
} else {
|
|
|
DisplayUtils.showSnackMessage(this, R.string.prefs_lock_device_credentials_enabled);
|
|
@@ -852,21 +848,19 @@ public class SettingsActivity extends ThemedPreferenceActivity
|
|
|
} else if (requestCode == ACTION_REQUEST_CODE_DAVDROID_SETUP && resultCode == RESULT_OK) {
|
|
|
DisplayUtils.showSnackMessage(this, R.string.prefs_calendar_contacts_sync_setup_successful);
|
|
|
} else if (requestCode == ACTION_CONFIRM_DEVICE_CREDENTIALS && resultCode == RESULT_OK &&
|
|
|
- Build.VERSION.SDK_INT >= Build.VERSION_CODES.M &&
|
|
|
- data.getIntExtra(RequestCredentialsActivity.KEY_CHECK_RESULT,
|
|
|
- RequestCredentialsActivity.KEY_CHECK_RESULT_FALSE) ==
|
|
|
- RequestCredentialsActivity.KEY_CHECK_RESULT_TRUE) {
|
|
|
+ data.getIntExtra(RequestCredentialsActivity.KEY_CHECK_RESULT,
|
|
|
+ RequestCredentialsActivity.KEY_CHECK_RESULT_FALSE) ==
|
|
|
+ RequestCredentialsActivity.KEY_CHECK_RESULT_TRUE) {
|
|
|
changeLockSetting(LOCK_NONE);
|
|
|
DisplayUtils.showSnackMessage(this, R.string.credentials_disabled);
|
|
|
if (!LOCK_NONE.equals(pendingLock)) {
|
|
|
enableLock(pendingLock);
|
|
|
}
|
|
|
- } else if (requestCode == PassCodeManager.PASSCODE_ACTIVITY && Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
|
|
|
+ } else if (requestCode == PassCodeManager.PASSCODE_ACTIVITY) {
|
|
|
handleMnemonicRequest(data);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- @RequiresApi(api = Build.VERSION_CODES.M)
|
|
|
@VisibleForTesting
|
|
|
public void handleMnemonicRequest(Intent data) {
|
|
|
if (data == null) {
|