mirror of
https://github.com/topjohnwu/Magisk.git
synced 2024-12-26 08:37:38 +00:00
Trigger with event
This commit is contained in:
parent
2fa5e4679f
commit
a5a2df4956
@ -68,7 +68,7 @@ public class Async {
|
||||
|
||||
@Override
|
||||
protected void onPostExecute(Void v) {
|
||||
CallbackHandler.triggerCallback(StatusFragment.updateCheckDone);
|
||||
StatusFragment.updateCheckDone.trigger();
|
||||
}
|
||||
}
|
||||
|
||||
@ -77,7 +77,7 @@ public class Async {
|
||||
@Override
|
||||
public void handleResults(int i) {
|
||||
StatusFragment.SNCheckResult = i;
|
||||
CallbackHandler.triggerCallback(StatusFragment.safetyNetDone);
|
||||
StatusFragment.safetyNetDone.trigger();
|
||||
}
|
||||
}.requestTest();
|
||||
}
|
||||
@ -92,7 +92,7 @@ public class Async {
|
||||
|
||||
@Override
|
||||
protected void onPostExecute(Void v) {
|
||||
CallbackHandler.triggerCallback(ModulesFragment.moduleLoadDone);
|
||||
ModulesFragment.moduleLoadDone.trigger();
|
||||
}
|
||||
}
|
||||
|
||||
@ -112,7 +112,7 @@ public class Async {
|
||||
|
||||
@Override
|
||||
protected void onPostExecute(Void v) {
|
||||
CallbackHandler.triggerCallback(ReposFragment.repoLoadDone);
|
||||
ReposFragment.repoLoadDone.trigger();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -23,8 +23,7 @@ public class CallbackHandler {
|
||||
}
|
||||
}
|
||||
|
||||
public static void triggerCallback(Event event) {
|
||||
event.isTriggered = true;
|
||||
private static void triggerCallback(Event event) {
|
||||
HashSet<EventListener> list = listeners.get(event);
|
||||
if (list != null) {
|
||||
for (EventListener listener : list) {
|
||||
@ -35,6 +34,10 @@ public class CallbackHandler {
|
||||
|
||||
public static class Event {
|
||||
public boolean isTriggered = false;
|
||||
public void trigger() {
|
||||
isTriggered = true;
|
||||
triggerCallback(this);
|
||||
}
|
||||
}
|
||||
|
||||
public interface EventListener {
|
||||
|
Loading…
x
Reference in New Issue
Block a user