Get rid of postDelayeds
FASTER!
This commit is contained in:
@@ -56,11 +56,9 @@ class VpnRequestActivity : AppCompatActivity(), ShadowsocksConnection.Interface
|
||||
}
|
||||
|
||||
override fun onServiceConnected(service: IShadowsocksService) {
|
||||
app.handler.postDelayed({
|
||||
val intent = VpnService.prepare(this)
|
||||
if (intent == null) onActivityResult(REQUEST_CONNECT, RESULT_OK, null)
|
||||
else startActivityForResult(intent, REQUEST_CONNECT)
|
||||
}, 1000)
|
||||
val intent = VpnService.prepare(this)
|
||||
if (intent == null) onActivityResult(REQUEST_CONNECT, RESULT_OK, null)
|
||||
else startActivityForResult(intent, REQUEST_CONNECT)
|
||||
}
|
||||
|
||||
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
|
||||
|
||||
@@ -84,9 +84,7 @@ class ServiceButton @JvmOverloads constructor(context: Context, attrs: Attribute
|
||||
TooltipCompat.setTooltipText(this, context.getString(R.string.connect))
|
||||
}
|
||||
refreshDrawableState()
|
||||
isEnabled = false
|
||||
if (state == BaseService.CONNECTED || state == BaseService.STOPPED) app.handler.postDelayed(
|
||||
{ isEnabled = state == BaseService.CONNECTED || state == BaseService.STOPPED }, 1000)
|
||||
isEnabled = state == BaseService.CONNECTED || state == BaseService.STOPPED
|
||||
}
|
||||
|
||||
private fun counters(a: AnimatedVectorDrawableCompat, b: AnimatedVectorDrawableCompat): Boolean =
|
||||
|
||||
Reference in New Issue
Block a user