Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class PleaseWaitPopup extends PopupScreen {
- private PleaseWaitPopup(String msg) {
- super(new VerticalFieldManager());
- add(new LabelField(msg));
- }
- /**
- * This method shows the user a 'please wait' dialog while waiting for a monitor to be unlocked.
- * Execution of the current thread is blocked until the monitor is unlocked.
- * @param msg Message to be shown to the user
- * @param monitor
- */
- public static void waitForUnlock(String msg, final Object monitor) {
- final PleaseWaitPopup popup = new PleaseWaitPopup(msg);
- final UiApplication app = UiApplication.getUiApplication();
- app.invokeLater(new Runnable() {
- public void run() {
- app.pushModalScreen(popup);
- }
- });
- synchronized(monitor) {}
- app.invokeLater(new Runnable() {
- public void run() {
- popup.close();
- }
- });
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement