/* * Copyright © 2013 Nokia Corporation. All rights reserved. Nokia and Nokia * Connecting People are registered trademarks of Nokia Corporation. Oracle and * Java are trademarks or registered trademarks of Oracle and/or its affiliates. * Other product and company names mentioned herein may be trademarks or trade * names of their respective owners. See LICENSE.TXT for license information. */ package com.nokia.example.satsa; import com.nokia.mid.ui.IconCommand; import javax.microedition.lcdui.*; // Screen used to display a decrypted message class EncryptScreen extends Form implements CommandListener { private final SATSAMIDlet midlet; private final Command commandBack = new Command("Back", Command.BACK, 1); private final Command commandShowDecrypted = new Command("Decrypt", Command.ITEM, 1); /**Creates a new IconCommand with the given label, type, priority and system icon id. */ private final IconCommand commandShowDecryptedAction1 = new IconCommand("OK", Command.OK, 1, IconCommand.OK); private int index; private String encryptedMessage; EncryptScreen(SATSAMIDlet midlet) { super(null); this.midlet = midlet; createForm(); } public void commandAction(Command c, Displayable d) { if (c == commandBack) { midlet.showMessageList(); } if (c == commandShowDecrypted || c == commandShowDecryptedAction1) { midlet.showPasswordScreen(index); } } void setIndex(int index) { this.index = index; } void setMessage(String encryptedMessage) { this.encryptedMessage = encryptedMessage; createForm(); } private void createForm() { deleteAll(); setTitle("Encrypted Message "); StringItem messageItem = new StringItem(null, encryptedMessage); append(messageItem); addCommand(commandBack); addCommand(commandShowDecrypted); addCommand(commandShowDecryptedAction1); setCommandListener(this); } }