@@ -60,15 +60,15 @@ class DohEndpointAdapter(private val context: Context, private val appConfig: Ap
60
60
newConnection : DoHEndpoint
61
61
): Boolean {
62
62
return (oldConnection.id == newConnection.id &&
63
- oldConnection.isSelected == newConnection.isSelected)
63
+ oldConnection.isSelected == newConnection.isSelected)
64
64
}
65
65
66
66
override fun areContentsTheSame (
67
67
oldConnection : DoHEndpoint ,
68
68
newConnection : DoHEndpoint
69
69
): Boolean {
70
70
return (oldConnection.id == newConnection.id &&
71
- oldConnection.isSelected != newConnection.isSelected)
71
+ oldConnection.isSelected != newConnection.isSelected)
72
72
}
73
73
}
74
74
}
@@ -140,16 +140,25 @@ class DohEndpointAdapter(private val context: Context, private val appConfig: Ap
140
140
?.lifecycle
141
141
?.currentState
142
142
?.isAtLeast(androidx.lifecycle.Lifecycle .State .STARTED ) == false ||
143
- bindingAdapterPosition == RecyclerView .NO_POSITION
143
+ bindingAdapterPosition == RecyclerView .NO_POSITION
144
144
) {
145
145
statusCheckJob?.cancel()
146
146
return
147
147
}
148
148
149
- // always use the id as Dnsx.Preffered as it is the primary dns id for now
150
- val state = VpnController .getDnsStatus(Backend .Preferred )
151
- val status = getDnsStatusStringRes(state)
152
- b.endpointDesc.text = context.getString(status).replaceFirstChar(Char ::titlecase)
149
+ updateDnsStatus()
150
+ }
151
+
152
+ private fun updateDnsStatus () {
153
+ io {
154
+ // always use the id as Dnsx.Preffered as it is the primary dns id for now
155
+ val state = VpnController .getDnsStatus(Backend .Preferred )
156
+ val status = getDnsStatusStringRes(state)
157
+ uiCtx {
158
+ b.endpointDesc.text =
159
+ context.getString(status).replaceFirstChar(Char ::titlecase)
160
+ }
161
+ }
153
162
}
154
163
155
164
private fun showIcon (endpoint : DoHEndpoint ) {
@@ -198,14 +207,12 @@ class DohEndpointAdapter(private val context: Context, private val appConfig: Ap
198
207
builder.setTitle(title)
199
208
builder.setMessage(url + " \n\n " + getDnsDesc(message))
200
209
builder.setCancelable(true )
201
- builder.setPositiveButton(context.getString(R .string.dns_info_positive)) {
202
- dialogInterface,
203
- _ ->
210
+ builder.setPositiveButton(context.getString(R .string.dns_info_positive)) { dialogInterface,
211
+ _ ->
204
212
dialogInterface.dismiss()
205
213
}
206
- builder.setNeutralButton(context.getString(R .string.dns_info_neutral)) {
207
- _: DialogInterface ,
208
- _: Int ->
214
+ builder.setNeutralButton(context.getString(R .string.dns_info_neutral)) { _: DialogInterface ,
215
+ _: Int ->
209
216
clipboardCopy(context, url, context.getString(R .string.copy_clipboard_label))
210
217
Utilities .showToastUiCentered(
211
218
context,
0 commit comments