-
Notifications
You must be signed in to change notification settings - Fork 33
Run UI updates on main Handler; fix delete task #15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
Howard20181
wants to merge
7
commits into
libxposed:master
Choose a base branch
from
Howard20181:mainlooper
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+123
−29
Open
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
cde542b
Run UI updates on main Handler; fix delete task
Howard20181 737c5e4
Potential fix for pull request finding
Howard20181 e40d409
Add example for get cap
Howard20181 ae24636
Reload scope when on listener
Howard20181 b41c8e3
Resolve all review
Howard20181 1216b0e
Resolve all review
Howard20181 1c45401
Update MainActivity.kt
Howard20181 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,67 @@ | ||
| package io.github.libxposed.example | ||
|
|
||
| import android.app.Application | ||
| import io.github.libxposed.service.XposedService | ||
| import io.github.libxposed.service.XposedServiceHelper | ||
| import java.util.concurrent.CopyOnWriteArraySet | ||
| import kotlin.concurrent.Volatile | ||
|
|
||
| class App : Application(), XposedServiceHelper.OnServiceListener { | ||
|
|
||
|
|
||
| companion object { | ||
| @Volatile | ||
| var mService: XposedService? = null | ||
| private set | ||
| private val serviceStateListeners = | ||
| CopyOnWriteArraySet<ServiceStateListener>() | ||
|
|
||
| private fun dispatchServiceState( | ||
| listener: ServiceStateListener, | ||
| service: XposedService? | ||
| ) { | ||
| if (serviceStateListeners.contains(listener)) { | ||
| listener.onServiceStateChanged(service) | ||
| } | ||
| } | ||
|
|
||
| fun addServiceStateListener( | ||
| listener: ServiceStateListener, | ||
| notifyImmediately: Boolean | ||
| ) { | ||
| serviceStateListeners.add(listener) | ||
| if (notifyImmediately) { | ||
| dispatchServiceState(listener, mService) | ||
| } | ||
| } | ||
|
|
||
| fun removeServiceStateListener(listener: ServiceStateListener) { | ||
| serviceStateListeners.remove(listener) | ||
| } | ||
| } | ||
|
|
||
| private fun notifyServiceStateChanged(service: XposedService?) { | ||
| for (listener in serviceStateListeners) { | ||
| dispatchServiceState(listener, service) | ||
| } | ||
Howard20181 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| } | ||
|
|
||
| override fun onCreate() { | ||
| super.onCreate() | ||
| XposedServiceHelper.registerListener(this) | ||
| } | ||
|
|
||
| interface ServiceStateListener { | ||
| fun onServiceStateChanged(service: XposedService?) | ||
| } | ||
|
|
||
| override fun onServiceBind(service: XposedService) { | ||
| mService = service | ||
| notifyServiceStateChanged(mService) | ||
| } | ||
|
|
||
| override fun onServiceDied(service: XposedService) { | ||
| mService = null | ||
| notifyServiceStateChanged(mService) | ||
| } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,3 @@ | ||
| tasks.register("Delete", Delete::class) { | ||
| delete(rootProject.buildDir) | ||
| delete(rootProject.layout.buildDirectory) | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.