|
|
@ -16,10 +16,10 @@ import mightypork.utils.logging.Log; |
|
|
|
* @author Ondřej Hruška (MightyPork) |
|
|
|
* @author Ondřej Hruška (MightyPork) |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public class ShutdownEvent extends BusEvent<ShutdownListener> { |
|
|
|
public class ShutdownEvent extends BusEvent<ShutdownListener> { |
|
|
|
|
|
|
|
|
|
|
|
private final Runnable shutdownTask; |
|
|
|
private final Runnable shutdownTask; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* Make a shutdown event |
|
|
|
* Make a shutdown event |
|
|
|
* |
|
|
|
* |
|
|
@ -29,26 +29,26 @@ public class ShutdownEvent extends BusEvent<ShutdownListener> { |
|
|
|
{ |
|
|
|
{ |
|
|
|
this.shutdownTask = doShutdown; |
|
|
|
this.shutdownTask = doShutdown; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
protected void handleBy(ShutdownListener handler) |
|
|
|
protected void handleBy(ShutdownListener handler) |
|
|
|
{ |
|
|
|
{ |
|
|
|
handler.onShutdown(this); |
|
|
|
handler.onShutdown(this); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public void onDispatchComplete(EventBus bus) |
|
|
|
public void onDispatchComplete(EventBus bus) |
|
|
|
{ |
|
|
|
{ |
|
|
|
if (!isConsumed()) { |
|
|
|
if (!isConsumed()) { |
|
|
|
Log.i("Shutting down..."); |
|
|
|
Log.i("Shutting down..."); |
|
|
|
|
|
|
|
|
|
|
|
App.bus().send(new MainLoopRequest(shutdownTask, true)); |
|
|
|
App.bus().send(new MainLoopRequest(shutdownTask, true)); |
|
|
|
|
|
|
|
|
|
|
|
} else { |
|
|
|
} else { |
|
|
|
Log.i("Shutdown aborted."); |
|
|
|
Log.i("Shutdown aborted."); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|