diff options
author | Arne Schwabe <arne@rfc2549.org> | 2020-04-23 12:33:40 +0200 |
---|---|---|
committer | Arne Schwabe <arne@rfc2549.org> | 2020-04-23 12:33:40 +0200 |
commit | 6c3c646b550ddd8ebfaaaf3bf11891dcea432c3e (patch) | |
tree | 86cf7a0005725cc109154fe03261606ebacce6e7 | |
parent | 2ce18467858f429c8528c5af0de49c91ea45b318 (diff) |
Fix lint warnings
-rw-r--r-- | main/src/ui/java/de/blinkt/openvpn/fragments/KeyChainSettingsFragment.kt | 10 | ||||
-rw-r--r-- | main/src/ui/java/de/blinkt/openvpn/fragments/Settings_Allowed_Apps.kt | 4 |
2 files changed, 7 insertions, 7 deletions
diff --git a/main/src/ui/java/de/blinkt/openvpn/fragments/KeyChainSettingsFragment.kt b/main/src/ui/java/de/blinkt/openvpn/fragments/KeyChainSettingsFragment.kt index ef6eae69..2444fb25 100644 --- a/main/src/ui/java/de/blinkt/openvpn/fragments/KeyChainSettingsFragment.kt +++ b/main/src/ui/java/de/blinkt/openvpn/fragments/KeyChainSettingsFragment.kt @@ -46,7 +46,7 @@ internal abstract class KeyChainSettingsFragment : Settings_Fragment(), View.OnC @TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR2) @Throws(KeyChainException::class, InterruptedException::class) get() { - val key: PrivateKey = KeyChain.getPrivateKey(activity!!.applicationContext, mProfile.mAlias) ?: return false + val key: PrivateKey = KeyChain.getPrivateKey(requireActivity().applicationContext, mProfile.mAlias) ?: return false if (Build.VERSION.SDK_INT > Build.VERSION_CODES.M) { val keyFactory = KeyFactory.getInstance(key.getAlgorithm(), "AndroidKeyStore") @@ -88,7 +88,7 @@ internal abstract class KeyChainSettingsFragment : Settings_Fragment(), View.OnC try { val b = ExtAuthHelper.getCertificateMetaData(context!!, mProfile.mExternalAuthenticator, mProfile.mAlias) mProfile.mAlias = b.getString(ExtAuthHelper.EXTRA_ALIAS) - activity!!.runOnUiThread { setAlias() } + requireActivity().runOnUiThread { setAlias() } } catch (e: KeyChainException) { e.printStackTrace() } @@ -115,7 +115,7 @@ internal abstract class KeyChainSettingsFragment : Settings_Fragment(), View.OnC certstr = getString(R.string.extauth_not_configured) } } else { - val certChain = KeyChain.getCertificateChain(activity!!.applicationContext, mProfile.mAlias) + val certChain = KeyChain.getCertificateChain(requireActivity().applicationContext, mProfile.mAlias) if (certChain != null) { cert = certChain[0] if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2) { @@ -137,7 +137,7 @@ internal abstract class KeyChainSettingsFragment : Settings_Fragment(), View.OnC val certStringCopy = certstr val finalMetadata = metadata - activity!!.runOnUiThread { + requireActivity().runOnUiThread { mAliasCertificate.text = certStringCopy if (finalMetadata != null) mExtAliasName.text = finalMetadata.getString(ExtAuthHelper.EXTRA_DESCRIPTION) @@ -210,7 +210,7 @@ internal abstract class KeyChainSettingsFragment : Settings_Fragment(), View.OnC fun showCertDialog() { try { - KeyChain.choosePrivateKeyAlias(activity!!, + KeyChain.choosePrivateKeyAlias(requireActivity(), { alias -> // Credential alias selected. Remember the alias selection for future use. mProfile.mAlias = alias diff --git a/main/src/ui/java/de/blinkt/openvpn/fragments/Settings_Allowed_Apps.kt b/main/src/ui/java/de/blinkt/openvpn/fragments/Settings_Allowed_Apps.kt index 56171388..f745d2e0 100644 --- a/main/src/ui/java/de/blinkt/openvpn/fragments/Settings_Allowed_Apps.kt +++ b/main/src/ui/java/de/blinkt/openvpn/fragments/Settings_Allowed_Apps.kt @@ -75,9 +75,9 @@ class Settings_Allowed_Apps : Fragment(), AdapterView.OnItemClickListener, Compo override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) - val profileUuid = requireArguments().getString(activity!!.packageName + ".profileUUID") + val profileUuid = requireArguments().getString(requireActivity().packageName + ".profileUUID") mProfile = ProfileManager.get(activity, profileUuid) - activity!!.title = getString(R.string.edit_profile_title, mProfile.name) + requireActivity().title = getString(R.string.edit_profile_title, mProfile.name) setHasOptionsMenu(true) } |