lint recommendation

This commit is contained in:
Milos Kozak 2020-10-19 17:54:41 +02:00
parent c8bd0856bf
commit 0a207cbecc
5 changed files with 12 additions and 16 deletions

View file

@ -26,7 +26,7 @@ class OpenHumansLoginActivity : NoSplashAppCompatActivity() {
val button = findViewById<Button>(R.id.button)
val checkbox = findViewById<CheckBox>(R.id.checkbox)
button.setOnClickListener { _ ->
button.setOnClickListener {
if (checkbox.isChecked) {
CustomTabsIntent.Builder().build().launchUrl(this, Uri.parse(OpenHumansUploader.AUTH_URL))
} else {
@ -55,7 +55,7 @@ class OpenHumansLoginActivity : NoSplashAppCompatActivity() {
}
override fun onCreateDialog(savedInstanceState: Bundle?): Dialog {
return AlertDialog.Builder(activity!!)
return AlertDialog.Builder(requireActivity())
.setTitle(R.string.completing_login)
.setMessage(R.string.please_wait)
.create()
@ -65,10 +65,10 @@ class OpenHumansLoginActivity : NoSplashAppCompatActivity() {
super.onCreate(savedInstanceState)
disposable = openHumansUploader.login(arguments?.getString("authToken")!!).subscribeOn(Schedulers.io()).subscribe({
dismiss()
SetupDoneDialog().show(fragmentManager!!, "SetupDoneDialog")
SetupDoneDialog().show(parentFragmentManager, "SetupDoneDialog")
}, {
dismiss()
ErrorDialog(it.message).show(fragmentManager!!, "ErrorDialog")
ErrorDialog(it.message).show(parentFragmentManager, "ErrorDialog")
})
}
@ -96,7 +96,7 @@ class OpenHumansLoginActivity : NoSplashAppCompatActivity() {
val message = arguments?.getString("message")
val shownMessage = if (message == null) getString(R.string.there_was_an_error)
else "${getString(R.string.there_was_an_error)}\n\n$message"
return AlertDialog.Builder(activity!!)
return AlertDialog.Builder(requireActivity())
.setTitle(R.string.error)
.setMessage(shownMessage)
.setPositiveButton(R.string.close, null)
@ -122,14 +122,14 @@ class OpenHumansLoginActivity : NoSplashAppCompatActivity() {
}
override fun onCreateDialog(savedInstanceState: Bundle?): Dialog {
return AlertDialog.Builder(activity!!)
return AlertDialog.Builder(requireActivity())
.setTitle(R.string.successfully_logged_in)
.setMessage(R.string.setup_will_continue_in_background)
.setCancelable(false)
.setPositiveButton(R.string.close) { _, _ ->
activity!!.run {
requireActivity().run {
setResult(Activity.RESULT_OK)
activity!!.finish()
requireActivity().finish()
}
}
.create()

View file

@ -133,8 +133,8 @@ object PrefImportSummaryDialog {
val dialog = builder.show()
val textView = dialog.findViewById<View>(android.R.id.message) as TextView?
textView!!.textSize = 12f
textView!!.setPadding(10,0,0,0)
textView?.textSize = 12f
textView?.setPadding(10,0,0,0)
dialog.setCanceledOnTouchOutside(false)
}

View file

@ -1,17 +1,14 @@
package info.nightscout.androidaps.utils.ui
import android.content.Context
import android.text.TextWatcher
import android.util.AttributeSet
import android.util.Log
import android.view.View.OnFocusChangeListener
import android.widget.Button
import info.nightscout.androidaps.core.R
import java.text.DecimalFormat
class MinutesNumberPicker constructor(context: Context, attrs: AttributeSet? = null) : NumberPicker(context, attrs) {
fun setParams(initValue: Double, minValue: Double, maxValue: Double, step: Double, allowZero: Boolean, okButton: Button? = null, textWatcher: TextWatcher? = null) {
fun setParams(initValue: Double, minValue: Double, maxValue: Double, step: Double, allowZero: Boolean, okButton: Button? = null) {
super.setParams(initValue, minValue, maxValue, step, null, allowZero, okButton)
}

View file

@ -114,7 +114,6 @@ class DanaRSService : DaggerService() {
fun readPumpStatus() {
try {
val now = System.currentTimeMillis()
val pump = activePlugin.activePump
rxBus.send(EventPumpStatusChanged(resourceHelper.gs(R.string.gettingpumpsettings)))
sendMessage(DanaRS_Packet_Etc_Keep_Connection(injector)) // test encryption for v3

View file

@ -17,7 +17,7 @@ abstract class ActionViewModelBase : ViewModel() {
fun executeAction() {
_isActionExecutingLiveData.postValue(true)
val disposable = SingleSubject.fromCallable<PumpEnactResult>(this::doExecuteAction)
SingleSubject.fromCallable<PumpEnactResult>(this::doExecuteAction)
.subscribeOn(Schedulers.io())
.doOnSuccess { result ->
_isActionExecutingLiveData.postValue(false)