From 67d931ba96c0e37f439940809813c5179b139bb5 Mon Sep 17 00:00:00 2001
From: Jacek Kowalski <Jacek@jacekk.info>
Date: Sun, 16 Aug 2015 22:30:25 +0000
Subject: [PATCH] Add SVG icon file

---
 src/brydz/BrydzForm.java |   60 ++++++++++++++++++++++++++++++++++++++++++------------------
 1 files changed, 42 insertions(+), 18 deletions(-)

diff --git a/src/brydz/BrydzForm.java b/src/brydz/BrydzForm.java
index 33adaa1..4c72459 100644
--- a/src/brydz/BrydzForm.java
+++ b/src/brydz/BrydzForm.java
@@ -1,10 +1,18 @@
+/*
+ * Copyright (c) 2012, Jacek Kowalski (http://jacekk.info)
+ * Wszystkie prawa zastrzeżone
+ * 
+ * Licencja w pliku BSD-3.txt
+ */
+
 package brydz;
 
 import javax.microedition.lcdui.*;
 
 public class BrydzForm extends Form implements CommandListener, ItemStateListener {
     protected BrydzMIDlet midlet;
-    protected BrydzMenu menu = null;
+    protected BrydzPomocForm help = null;
+    protected BrydzPomocForm about = null;
     
     protected TextField kontraktField;
     protected ChoiceGroup kontraktChoice;
@@ -53,29 +61,45 @@
         this.append(this.resultText);
         
         this.addCommand(new Command("Wyczyść", Command.BACK, 1));
-        this.addCommand(new Command("Menu", Command.OK, 1));
+        this.addCommand(new Command("Pomoc", Command.HELP, 2));
+        this.addCommand(new Command("O programie", Command.HELP, 3));
+        this.addCommand(new Command("Wyjście", Command.EXIT, 4));
         
         this.setItemStateListener(this);
         this.setCommandListener(this);
     }
     
     public void commandAction(Command command, Displayable displayable) {
-        if (command.getCommandType() == Command.BACK) {
-            this.kontraktField.setString(null);
-            this.kontraktChoice.setSelectedIndex(0, true);
-            this.kontraChoice.setSelectedIndex(0, true);
-            this.partiaChoice.setSelectedIndex(0, true);
-            this.punktyField.setString(null);
-            this.lewyField.setString(null);
-            this.resultText.setText("Podaj wszystkie dane.");
-            
-            this.midlet.display.setCurrentItem(this.kontraktField);
-        }
-        else if (command.getCommandType() == Command.OK) {
-            if(this.menu == null) {
-                this.menu = new BrydzMenu(this.midlet, this);
-            }
-            this.midlet.display.setCurrent(this.menu);
+        switch(command.getCommandType()) {
+            case Command.EXIT:
+                this.midlet.destroyApp(true);
+            break;
+            case Command.CANCEL:
+            case Command.BACK:
+                this.kontraktField.setString(null);
+                this.kontraktChoice.setSelectedIndex(0, true);
+                this.kontraChoice.setSelectedIndex(0, true);
+                this.partiaChoice.setSelectedIndex(0, true);
+                this.punktyField.setString(null);
+                this.lewyField.setString(null);
+                this.resultText.setText("Podaj wszystkie dane.");
+
+                this.midlet.display.setCurrentItem(this.kontraktField);
+            break;
+            case Command.HELP:
+                if(command.getPriority() == 2) {
+                    if(this.help == null) {
+                        this.help = new BrydzPomocForm(this.midlet, this, false);
+                    }
+                    this.midlet.display.setCurrent(this.help);
+                }
+                else if(command.getPriority() == 3) {
+                    if(this.about == null) {
+                        this.about = new BrydzPomocForm(this.midlet, this, true);
+                    }
+                    this.midlet.display.setCurrent(this.about);
+                }
+            break;
         }
     }
     

--
Gitblit v1.9.1