Search in sources :

Example 1 with MainScreen

use of net.rim.device.api.ui.container.MainScreen in project Samples-for-Java by blackberry.

the class SendCommand method execute.

public void execute(ReadOnlyCommandMetadata metadata, Object context) {
    synchronized (UiApplication.getUiApplication().getEventLock()) {
        MainScreen screen = new ClientTextScreen();
        UiApplication.getUiApplication().pushScreen(screen);
    }
}
Also used : ClientTextScreen(nfc.sample.llcp.ui.ClientTextScreen) MainScreen(net.rim.device.api.ui.container.MainScreen)

Example 2 with MainScreen

use of net.rim.device.api.ui.container.MainScreen in project Samples-for-Java by blackberry.

the class ResponderCommand method execute.

public void execute(ReadOnlyCommandMetadata metadata, Object context) {
    UiApplication.getUiApplication();
    synchronized (UiApplication.getEventLock()) {
        MainScreen screen = new NfcSnepResponderScreen(Constants.VCARD_RESPONDER);
        UiApplication.getUiApplication().pushScreen(screen);
    }
}
Also used : NfcSnepResponderScreen(nfc.sample.peer2peer.ui.NfcSnepResponderScreen) MainScreen(net.rim.device.api.ui.container.MainScreen)

Example 3 with MainScreen

use of net.rim.device.api.ui.container.MainScreen in project Samples-for-Java by blackberry.

the class CreateCustomTagCommand method execute.

public void execute(ReadOnlyCommandMetadata metadata, Object context) {
    synchronized (UiApplication.getUiApplication().getEventLock()) {
        MainScreen screen = new CustomTagScreen();
        UiApplication.getUiApplication().pushScreen(screen);
    }
}
Also used : CustomTagScreen(nfc.sample.Ndef.Write.ui.CustomTagScreen) MainScreen(net.rim.device.api.ui.container.MainScreen)

Example 4 with MainScreen

use of net.rim.device.api.ui.container.MainScreen in project Samples-for-Java by blackberry.

the class EmulateSrCommand method execute.

public void execute(ReadOnlyCommandMetadata metadata, Object context) {
    synchronized (UiApplication.getUiApplication().getEventLock()) {
        MainScreen screen = new NfcVirtTargScreen(Constants.EMULATE_SR);
        UiApplication.getUiApplication().pushScreen(screen);
    }
}
Also used : NfcVirtTargScreen(nfc.sample.virtual.target.ui.NfcVirtTargScreen) MainScreen(net.rim.device.api.ui.container.MainScreen)

Example 5 with MainScreen

use of net.rim.device.api.ui.container.MainScreen in project Samples-for-Java by blackberry.

the class GameScreen method checkBids.

private void checkBids() {
    Utilities.log("XXXX checkBids: game_state.getMy_bid_sent()=" + game_state.getMy_bid_sent() + ",game_state.getOther_bid_received()=" + game_state.getOther_bid_received());
    if (game_state.getMy_bid_sent() == null || game_state.getOther_bid_received() == null) {
        return;
    }
    int device_role = 0;
    if (my_bid.getBid() > other_bid.getBid()) {
        Utilities.log("XXXX won the bid: player 1");
        device_role = Constants.PLAYER_1;
    } else {
        if (my_bid.getBid() < other_bid.getBid()) {
            Utilities.log("XXXX lost the bid: player 2");
            device_role = Constants.PLAYER_2;
        } else {
            setStatusMessage("It didn't work, please try again!");
            return;
        }
    }
    try {
        proto.disableMessaging();
    } catch (NFCException e) {
        Utilities.log("XXXX GameScreen:" + e.getClass().getName() + ":" + e.getMessage());
        setStatusMessage("It didn't work, try again!");
        return;
    }
    resetBidStateTracking();
    final int player_no = device_role;
    final MainScreen next_screen;
    if (player_no == Constants.PLAYER_2) {
        next_screen = GameScreen.getInstance(player_no);
    } else {
        next_screen = new SymbolSelectionScreen();
    }
    final GameScreen this_screen = this;
    UiApplication.getUiApplication().invokeLater(new Runnable() {

        public void run() {
            UiApplication.getUiApplication().popScreen(this_screen);
        }
    });
    UiApplication.getUiApplication().invokeLater(new Runnable() {

        public void run() {
            UiApplication.getUiApplication().pushScreen(next_screen);
        }
    });
}
Also used : NFCException(net.rim.device.api.io.nfc.NFCException) MainScreen(net.rim.device.api.ui.container.MainScreen)

Aggregations

MainScreen (net.rim.device.api.ui.container.MainScreen)11 NfcVirtTargScreen (nfc.sample.virtual.target.ui.NfcVirtTargScreen)3 NFCException (net.rim.device.api.io.nfc.NFCException)2 CustomTagScreen (nfc.sample.Ndef.Write.ui.CustomTagScreen)1 SpTagScreen (nfc.sample.Ndef.Write.ui.SpTagScreen)1 TextTagScreen (nfc.sample.Ndef.Write.ui.TextTagScreen)1 UriTagScreen (nfc.sample.Ndef.Write.ui.UriTagScreen)1 ClientTextScreen (nfc.sample.llcp.ui.ClientTextScreen)1 NfcSnepResponderScreen (nfc.sample.peer2peer.ui.NfcSnepResponderScreen)1 ProtocolMessageMasterBid (nfc.sample.tictactoe.protocol.ProtocolMessageMasterBid)1 ResponseTextScreen (nfc.sample.virtual.target.ui.ResponseTextScreen)1