Skip to content

Commit ae24636

Browse files
committed
Reload scope when on listener
1 parent e40d409 commit ae24636

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

app/src/main/java/io/github/libxposed/example/MainActivity.kt

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,9 @@ import io.github.libxposed.service.XposedService.OnScopeEventListener
1212
import java.io.FileWriter
1313
import kotlin.random.Random
1414

15+
@SuppressLint("SetTextI18n")
1516
class MainActivity : Activity(), App.ServiceStateListener {
17+
private var mService: XposedService? = null
1618
private var binding: ActivityMainBinding? = null
1719

1820
private val mCallback = object : OnScopeEventListener {
@@ -23,6 +25,7 @@ class MainActivity : Activity(), App.ServiceStateListener {
2325
"onScopeRequestApproved: $approved",
2426
Toast.LENGTH_SHORT
2527
).show()
28+
binding?.scope?.text = "Scope: " + mService?.scope
2629
}
2730
}
2831

@@ -33,11 +36,11 @@ class MainActivity : Activity(), App.ServiceStateListener {
3336
"onScopeRequestFailed: $message",
3437
Toast.LENGTH_SHORT
3538
).show()
39+
binding?.scope?.text = "Scope: " + mService?.scope
3640
}
3741
}
3842
}
3943

40-
@SuppressLint("SetTextI18n")
4144
override fun onCreate(savedInstanceState: Bundle?) {
4245
super.onCreate(savedInstanceState)
4346
binding = ActivityMainBinding.inflate(layoutInflater)
@@ -57,8 +60,8 @@ class MainActivity : Activity(), App.ServiceStateListener {
5760
super.onStop()
5861
}
5962

60-
@SuppressLint("SetTextI18n")
6163
override fun onServiceStateChanged(service: XposedService?) {
64+
mService = service
6265
val handler = Handler(Looper.getMainLooper())
6366
binding?.let {
6467
handler.post {

0 commit comments

Comments
 (0)