mirror of
https://github.com/nextcloud/talk-android.git
synced 2024-11-26 23:25:20 +03:00
delete unnecessary "!!" operators
Signed-off-by: Marcel Hibbe <dev@mhibbe.de>
This commit is contained in:
parent
9af3ffa784
commit
a37b0cb4aa
1 changed files with 30 additions and 30 deletions
|
@ -333,30 +333,30 @@ class SettingsController : BaseController(R.layout.controller_settings) {
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun registerChangeListeners() {
|
private fun registerChangeListeners() {
|
||||||
appPreferences!!.registerProxyTypeListener(ProxyTypeChangeListener().also { proxyTypeChangeListener = it })
|
appPreferences.registerProxyTypeListener(ProxyTypeChangeListener().also { proxyTypeChangeListener = it })
|
||||||
appPreferences!!.registerProxyCredentialsListener(
|
appPreferences.registerProxyCredentialsListener(
|
||||||
ProxyCredentialsChangeListener().also {
|
ProxyCredentialsChangeListener().also {
|
||||||
proxyCredentialsChangeListener = it
|
proxyCredentialsChangeListener = it
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
appPreferences!!.registerScreenSecurityListener(
|
appPreferences.registerScreenSecurityListener(
|
||||||
ScreenSecurityChangeListener().also {
|
ScreenSecurityChangeListener().also {
|
||||||
screenSecurityChangeListener = it
|
screenSecurityChangeListener = it
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
appPreferences!!.registerScreenLockListener(ScreenLockListener().also { screenLockChangeListener = it })
|
appPreferences.registerScreenLockListener(ScreenLockListener().also { screenLockChangeListener = it })
|
||||||
appPreferences!!.registerScreenLockTimeoutListener(
|
appPreferences.registerScreenLockTimeoutListener(
|
||||||
ScreenLockTimeoutListener().also {
|
ScreenLockTimeoutListener().also {
|
||||||
screenLockTimeoutChangeListener = it
|
screenLockTimeoutChangeListener = it
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
appPreferences!!.registerThemeChangeListener(ThemeChangeListener().also { themeChangeListener = it })
|
appPreferences.registerThemeChangeListener(ThemeChangeListener().also { themeChangeListener = it })
|
||||||
appPreferences!!.registerPhoneBookIntegrationChangeListener(
|
appPreferences.registerPhoneBookIntegrationChangeListener(
|
||||||
PhoneBookIntegrationChangeListener(this).also {
|
PhoneBookIntegrationChangeListener(this).also {
|
||||||
phoneBookIntegrationChangeListener = it
|
phoneBookIntegrationChangeListener = it
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
appPreferences!!.registerReadPrivacyChangeListener(
|
appPreferences.registerReadPrivacyChangeListener(
|
||||||
ReadPrivacyChangeListener().also {
|
ReadPrivacyChangeListener().also {
|
||||||
readPrivacyChangeListener = it
|
readPrivacyChangeListener = it
|
||||||
}
|
}
|
||||||
|
@ -525,7 +525,7 @@ class SettingsController : BaseController(R.layout.controller_settings) {
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun setupProxyTypeSettings() {
|
private fun setupProxyTypeSettings() {
|
||||||
if (("No proxy" == appPreferences!!.proxyType) || appPreferences!!.proxyType == null) {
|
if (("No proxy" == appPreferences.proxyType) || appPreferences.proxyType == null) {
|
||||||
hideProxySettings()
|
hideProxySettings()
|
||||||
} else {
|
} else {
|
||||||
showProxySettings()
|
showProxySettings()
|
||||||
|
@ -533,7 +533,7 @@ class SettingsController : BaseController(R.layout.controller_settings) {
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun setupProxyCredentialSettings() {
|
private fun setupProxyCredentialSettings() {
|
||||||
if (appPreferences!!.proxyCredentials) {
|
if (appPreferences.proxyCredentials) {
|
||||||
showProxyCredentials()
|
showProxyCredentials()
|
||||||
} else {
|
} else {
|
||||||
hideProxyCredentials()
|
hideProxyCredentials()
|
||||||
|
@ -655,16 +655,16 @@ class SettingsController : BaseController(R.layout.controller_settings) {
|
||||||
|
|
||||||
private fun setupCheckables() {
|
private fun setupCheckables() {
|
||||||
(binding.settingsScreenSecurity.findViewById<View>(R.id.mp_checkable) as Checkable).isChecked =
|
(binding.settingsScreenSecurity.findViewById<View>(R.id.mp_checkable) as Checkable).isChecked =
|
||||||
appPreferences!!.isScreenSecured
|
appPreferences.isScreenSecured
|
||||||
|
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||||
(binding.settingsIncognitoKeyboard.findViewById<View>(R.id.mp_checkable) as Checkable).isChecked =
|
(binding.settingsIncognitoKeyboard.findViewById<View>(R.id.mp_checkable) as Checkable).isChecked =
|
||||||
appPreferences!!.isKeyboardIncognito
|
appPreferences.isKeyboardIncognito
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
|
||||||
(binding.settingsIncognitoKeyboard.findViewById<View>(R.id.mp_checkable) as Checkable).isChecked =
|
(binding.settingsIncognitoKeyboard.findViewById<View>(R.id.mp_checkable) as Checkable).isChecked =
|
||||||
appPreferences!!.isKeyboardIncognito
|
appPreferences.isKeyboardIncognito
|
||||||
}
|
}
|
||||||
|
|
||||||
if (CapabilitiesUtilNew.isReadStatusAvailable(userManager.currentUser.blockingGet())) {
|
if (CapabilitiesUtilNew.isReadStatusAvailable(userManager.currentUser.blockingGet())) {
|
||||||
|
@ -675,19 +675,19 @@ class SettingsController : BaseController(R.layout.controller_settings) {
|
||||||
}
|
}
|
||||||
|
|
||||||
(binding.settingsPhoneBookIntegration.findViewById<View>(R.id.mp_checkable) as Checkable).isChecked =
|
(binding.settingsPhoneBookIntegration.findViewById<View>(R.id.mp_checkable) as Checkable).isChecked =
|
||||||
appPreferences!!.isPhoneBookIntegrationEnabled
|
appPreferences.isPhoneBookIntegrationEnabled
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun setupScreenLockSetting() {
|
private fun setupScreenLockSetting() {
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
|
||||||
val keyguardManager = context!!.getSystemService(Context.KEYGUARD_SERVICE) as KeyguardManager
|
val keyguardManager = context.getSystemService(Context.KEYGUARD_SERVICE) as KeyguardManager
|
||||||
if (keyguardManager.isKeyguardSecure) {
|
if (keyguardManager.isKeyguardSecure) {
|
||||||
binding.settingsScreenLock.isEnabled = true
|
binding.settingsScreenLock.isEnabled = true
|
||||||
binding.settingsScreenLockTimeout.isEnabled = true
|
binding.settingsScreenLockTimeout.isEnabled = true
|
||||||
(binding.settingsScreenLock.findViewById<View>(R.id.mp_checkable) as Checkable).isChecked =
|
(binding.settingsScreenLock.findViewById<View>(R.id.mp_checkable) as Checkable).isChecked =
|
||||||
appPreferences!!.isScreenLocked
|
appPreferences.isScreenLocked
|
||||||
binding.settingsScreenLockTimeout.isEnabled = appPreferences!!.isScreenLocked
|
binding.settingsScreenLockTimeout.isEnabled = appPreferences.isScreenLocked
|
||||||
if (appPreferences!!.isScreenLocked) {
|
if (appPreferences.isScreenLocked) {
|
||||||
binding.settingsScreenLockTimeout.alpha = ENABLED_ALPHA
|
binding.settingsScreenLockTimeout.alpha = ENABLED_ALPHA
|
||||||
} else {
|
} else {
|
||||||
binding.settingsScreenLockTimeout.alpha = DISABLED_ALPHA
|
binding.settingsScreenLockTimeout.alpha = DISABLED_ALPHA
|
||||||
|
@ -696,8 +696,8 @@ class SettingsController : BaseController(R.layout.controller_settings) {
|
||||||
} else {
|
} else {
|
||||||
binding.settingsScreenLock.isEnabled = false
|
binding.settingsScreenLock.isEnabled = false
|
||||||
binding.settingsScreenLockTimeout.isEnabled = false
|
binding.settingsScreenLockTimeout.isEnabled = false
|
||||||
appPreferences!!.removeScreenLock()
|
appPreferences.removeScreenLock()
|
||||||
appPreferences!!.removeScreenLockTimeout()
|
appPreferences.removeScreenLockTimeout()
|
||||||
(binding.settingsScreenLock.findViewById<View>(R.id.mp_checkable) as Checkable).isChecked = false
|
(binding.settingsScreenLock.findViewById<View>(R.id.mp_checkable) as Checkable).isChecked = false
|
||||||
binding.settingsScreenLock.alpha = DISABLED_ALPHA
|
binding.settingsScreenLock.alpha = DISABLED_ALPHA
|
||||||
binding.settingsScreenLockTimeout.alpha = DISABLED_ALPHA
|
binding.settingsScreenLockTimeout.alpha = DISABLED_ALPHA
|
||||||
|
@ -792,12 +792,12 @@ class SettingsController : BaseController(R.layout.controller_settings) {
|
||||||
.enqueue(OneTimeWorkRequest.Builder(ContactAddressBookWorker::class.java).build())
|
.enqueue(OneTimeWorkRequest.Builder(ContactAddressBookWorker::class.java).build())
|
||||||
checkForPhoneNumber()
|
checkForPhoneNumber()
|
||||||
} else {
|
} else {
|
||||||
appPreferences!!.setPhoneBookIntegration(false)
|
appPreferences.setPhoneBookIntegration(false)
|
||||||
(binding.settingsPhoneBookIntegration.findViewById<View>(R.id.mp_checkable) as Checkable).isChecked =
|
(binding.settingsPhoneBookIntegration.findViewById<View>(R.id.mp_checkable) as Checkable).isChecked =
|
||||||
appPreferences!!.isPhoneBookIntegrationEnabled
|
appPreferences.isPhoneBookIntegrationEnabled
|
||||||
Toast.makeText(
|
Toast.makeText(
|
||||||
context,
|
context,
|
||||||
context!!.resources.getString(R.string.no_phone_book_integration_due_to_permissions),
|
context.resources.getString(R.string.no_phone_book_integration_due_to_permissions),
|
||||||
Toast.LENGTH_LONG
|
Toast.LENGTH_LONG
|
||||||
).show()
|
).show()
|
||||||
}
|
}
|
||||||
|
@ -806,7 +806,7 @@ class SettingsController : BaseController(R.layout.controller_settings) {
|
||||||
private inner class ScreenLockTimeoutListener : OnPreferenceValueChangedListener<String?> {
|
private inner class ScreenLockTimeoutListener : OnPreferenceValueChangedListener<String?> {
|
||||||
override fun onChanged(newValue: String?) {
|
override fun onChanged(newValue: String?) {
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
|
||||||
SecurityUtils.createKey(appPreferences!!.screenLockTimeout)
|
SecurityUtils.createKey(appPreferences.screenLockTimeout)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -949,8 +949,8 @@ class SettingsController : BaseController(R.layout.controller_settings) {
|
||||||
.setTitle(R.string.nc_settings_phone_book_integration_phone_number_dialog_title)
|
.setTitle(R.string.nc_settings_phone_book_integration_phone_number_dialog_title)
|
||||||
.setMessage(R.string.nc_settings_phone_book_integration_phone_number_dialog_description)
|
.setMessage(R.string.nc_settings_phone_book_integration_phone_number_dialog_description)
|
||||||
.setView(phoneNumberLayoutWrapper)
|
.setView(phoneNumberLayoutWrapper)
|
||||||
.setPositiveButton(context!!.resources.getString(R.string.nc_common_set), null)
|
.setPositiveButton(context.resources.getString(R.string.nc_common_set), null)
|
||||||
.setNegativeButton(context!!.resources.getString(R.string.nc_common_skip), null)
|
.setNegativeButton(context.resources.getString(R.string.nc_common_skip), null)
|
||||||
|
|
||||||
viewThemeUtils.dialog.colorMaterialAlertDialogBackground(phoneNumberInputLayout.context, dialogBuilder)
|
viewThemeUtils.dialog.colorMaterialAlertDialogBackground(phoneNumberInputLayout.context, dialogBuilder)
|
||||||
|
|
||||||
|
@ -994,13 +994,13 @@ class SettingsController : BaseController(R.layout.controller_settings) {
|
||||||
dialog.dismiss()
|
dialog.dismiss()
|
||||||
Toast.makeText(
|
Toast.makeText(
|
||||||
context,
|
context,
|
||||||
context!!.resources.getString(
|
context.resources.getString(
|
||||||
R.string.nc_settings_phone_book_integration_phone_number_dialog_success
|
R.string.nc_settings_phone_book_integration_phone_number_dialog_success
|
||||||
),
|
),
|
||||||
Toast.LENGTH_LONG
|
Toast.LENGTH_LONG
|
||||||
).show()
|
).show()
|
||||||
} else {
|
} else {
|
||||||
textInputLayout.helperText = context!!.resources.getString(
|
textInputLayout.helperText = context.resources.getString(
|
||||||
R.string.nc_settings_phone_book_integration_phone_number_dialog_invalid
|
R.string.nc_settings_phone_book_integration_phone_number_dialog_invalid
|
||||||
)
|
)
|
||||||
Log.d(TAG, "failed to set phoneNumber. statusCode=$statusCode")
|
Log.d(TAG, "failed to set phoneNumber. statusCode=$statusCode")
|
||||||
|
@ -1008,7 +1008,7 @@ class SettingsController : BaseController(R.layout.controller_settings) {
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onError(e: Throwable) {
|
override fun onError(e: Throwable) {
|
||||||
textInputLayout.helperText = context!!.resources.getString(
|
textInputLayout.helperText = context.resources.getString(
|
||||||
R.string.nc_settings_phone_book_integration_phone_number_dialog_invalid
|
R.string.nc_settings_phone_book_integration_phone_number_dialog_invalid
|
||||||
)
|
)
|
||||||
Log.e(TAG, "setPhoneNumber error", e)
|
Log.e(TAG, "setPhoneNumber error", e)
|
||||||
|
@ -1041,7 +1041,7 @@ class SettingsController : BaseController(R.layout.controller_settings) {
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onError(e: Throwable) {
|
override fun onError(e: Throwable) {
|
||||||
appPreferences!!.setReadPrivacy(!newValue)
|
appPreferences.setReadPrivacy(!newValue)
|
||||||
(binding.settingsReadPrivacy.findViewById<View>(R.id.mp_checkable) as Checkable).isChecked =
|
(binding.settingsReadPrivacy.findViewById<View>(R.id.mp_checkable) as Checkable).isChecked =
|
||||||
!newValue
|
!newValue
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue