home *** CD-ROM | disk | FTP | other *** search
- import java.util.Timer;
- import javax.microedition.lcdui.Alert;
- import javax.microedition.lcdui.AlertType;
- import javax.microedition.lcdui.Command;
- import javax.microedition.lcdui.CommandListener;
- import javax.microedition.lcdui.Display;
- import javax.microedition.lcdui.Displayable;
- import javax.microedition.lcdui.Form;
- import javax.microedition.lcdui.Image;
- import javax.microedition.lcdui.ImageItem;
- import javax.microedition.lcdui.List;
- import javax.microedition.lcdui.StringItem;
- import javax.microedition.midlet.MIDlet;
- import javax.microedition.rms.RecordStore;
-
- public class First_Aid_Guide extends MIDlet implements CommandListener {
- private FAstore fastore = new FAstore();
- private Library_Class libClass = new Library_Class();
- private Display display = Display.getDisplay(this);
- private Form fmMain;
- private Form fmMainDisplay;
- private Alert alStatus;
- private Command cmExit;
- private Command cmStart;
- private Command cmBackCat;
- private Command cmSelectCat;
- private List lsCategories = new List("Please select one", 3);
- private int startNumRec;
- private int endNumRec;
- RecordStore FA_rs = null;
- String FIRST_AID_REC_STORE = "First_Aid_Store";
- private RecordStore testStore;
- String StoreString = "";
- private String[] LinesArray = new String[2];
- private StringItem siDisplay;
- private int indexValue;
- // $FF: renamed from: tm java.util.Timer
- private Timer field_0;
- // $FF: renamed from: tt TestTimerTask
- private First_Aid_Guide$TestTimerTask field_1;
- private String titleString = "";
-
- public First_Aid_Guide() {
- this.lsCategories.append("Bleeding", (Image)null);
- this.lsCategories.append("Broken Bones", (Image)null);
- this.lsCategories.append("Seizures", (Image)null);
- this.lsCategories.append("Choking", (Image)null);
- this.lsCategories.append("Drowning", (Image)null);
- this.lsCategories.append("Frostbite", (Image)null);
- this.lsCategories.append("Rescue Breathing", (Image)null);
- this.lsCategories.append("CPR", (Image)null);
- this.lsCategories.append("Hyperthermia", (Image)null);
- this.lsCategories.append("Hypothermia", (Image)null);
- this.lsCategories.append("Heart Attack", (Image)null);
- this.lsCategories.append("Stroke", (Image)null);
- this.lsCategories.append("Insect Bites", (Image)null);
- this.lsCategories.append("Insulin Reaction", (Image)null);
- this.lsCategories.append("Diabetic Coma", (Image)null);
- this.lsCategories.append("Burns", (Image)null);
- this.lsCategories.append("Nose Bleeds", (Image)null);
- this.lsCategories.append("Sprains", (Image)null);
- this.siDisplay = new StringItem("", "");
- this.fmMain = new Form("By Saranjeet Raj");
-
- try {
- Image var1 = Image.createImage("/first_aid.png");
- this.fmMain.append(new ImageItem((String)null, var1, 3, (String)null));
- } catch (Exception var2) {
- System.out.println("error with image load: " + var2);
- }
-
- this.fmMain.append("This application provides a brief guide to dealing with First Aid. It lists a number of injuries from which to choose from displaying both symptoms and actions to take. DISCLAIMER: Under no conditions responsibility is be accepted by the author, regarding the consequences of use of the information disctributed in this application. IN ALL CASES SEEK IMMEDIATE EMERGENCY TREATMENT AND ADVICE. (Version 1.0) © Saranjeet Raj");
- this.fmMainDisplay = new Form(this.titleString);
- this.cmStart = new Command("Start", 1, 1);
- this.cmBackCat = new Command("Back", 1, 1);
- this.cmExit = new Command("Exit", 7, 1);
- this.cmSelectCat = new Command("Select", 1, 1);
- this.fmMain.addCommand(this.cmStart);
- this.fmMain.addCommand(this.cmExit);
- this.lsCategories.addCommand(this.cmExit);
- this.lsCategories.addCommand(this.cmSelectCat);
- this.fmMainDisplay.addCommand(this.cmBackCat);
- this.indexValue = this.fmMainDisplay.append(this.siDisplay);
- this.fmMainDisplay.setCommandListener(this);
- this.lsCategories.setCommandListener(this);
- this.fmMain.setCommandListener(this);
- }
-
- public void startApp() {
- this.display.setCurrent(this.fmMain);
- this.field_0 = new Timer();
- this.field_1 = new First_Aid_Guide$TestTimerTask(this, (First_Aid_Guide$1)null);
- this.field_0.schedule(this.field_1, 100L);
- }
-
- public void setup() {
- this.libClass.openRecStore(this.FA_rs, this.FIRST_AID_REC_STORE);
- this.libClass.writeData(this.fastore.FAMethod());
- this.libClass.closeRecStore();
- }
-
- public void testExistence() {
- if (this.libClass.testRecStore(this.FA_rs, this.FIRST_AID_REC_STORE)) {
- this.libClass.closeRecStore();
- } else if (!this.libClass.testRecStore(this.FA_rs, this.FIRST_AID_REC_STORE)) {
- this.alStatus = new Alert("Status", "Installing.....(approx 10-15 seconds). ", (Image)null, (AlertType)null);
- this.alStatus.setTimeout(11000);
- this.display.setCurrent(this.alStatus);
- this.setup();
- }
-
- }
-
- public void CloseApp() {
- this.display.setCurrent(this.fmMain);
- }
-
- public void pauseApp() {
- }
-
- public void destroyApp(boolean var1) {
- }
-
- public void commandAction(Command var1, Displayable var2) {
- if (var1 == this.cmExit) {
- this.destroyApp(false);
- ((MIDlet)this).notifyDestroyed();
- } else if (var1 == this.cmStart) {
- this.display.setCurrent(this.lsCategories);
- } else if (var1 == this.cmBackCat) {
- this.display.setCurrent(this.lsCategories);
- } else if (var1 == this.cmSelectCat) {
- switch (this.lsCategories.getSelectedIndex()) {
- case 0:
- this.titleString = "--BLEEDING--";
- this.startNumRec = 1;
- this.endNumRec = 2;
- break;
- case 1:
- this.titleString = "--BROKEN BONES--";
- this.startNumRec = 2;
- this.endNumRec = 3;
- break;
- case 2:
- this.titleString = "--SEIZURES--";
- this.startNumRec = 3;
- this.endNumRec = 4;
- break;
- case 3:
- this.titleString = "--CHOKING--";
- this.startNumRec = 4;
- this.endNumRec = 5;
- break;
- case 4:
- this.titleString = "--DROWNING--";
- this.startNumRec = 5;
- this.endNumRec = 6;
- break;
- case 5:
- this.titleString = "--FROSTBITE--";
- this.startNumRec = 6;
- this.endNumRec = 7;
- break;
- case 6:
- this.titleString = "--RESCUE BREATHING--";
- this.startNumRec = 7;
- this.endNumRec = 8;
- break;
- case 7:
- this.titleString = "--CPR--";
- this.startNumRec = 8;
- this.endNumRec = 9;
- break;
- case 8:
- this.titleString = "--HYPERTHERMIA--";
- this.startNumRec = 9;
- this.endNumRec = 10;
- break;
- case 9:
- this.titleString = "--HYPOTHERMIA--";
- this.startNumRec = 10;
- this.endNumRec = 11;
- break;
- case 10:
- this.titleString = "--HEART ATTACK--";
- this.startNumRec = 11;
- this.endNumRec = 12;
- break;
- case 11:
- this.titleString = "--STROKE--";
- this.startNumRec = 12;
- this.endNumRec = 13;
- break;
- case 12:
- this.titleString = "--INSECT BITES--";
- this.startNumRec = 13;
- this.endNumRec = 14;
- break;
- case 13:
- this.titleString = "--INSULIN REACTION--";
- this.startNumRec = 14;
- this.endNumRec = 15;
- break;
- case 14:
- this.titleString = "--DIABETIC COMA--";
- this.startNumRec = 15;
- this.endNumRec = 16;
- break;
- case 15:
- this.titleString = "--BURNS--";
- this.startNumRec = 16;
- this.endNumRec = 17;
- break;
- case 16:
- this.titleString = "--NOSE BLEEDS--";
- this.startNumRec = 17;
- this.endNumRec = 18;
- break;
- case 17:
- this.titleString = "--SPRAINS--";
- this.startNumRec = 18;
- this.endNumRec = 19;
- }
-
- this.testStore = this.FA_rs;
- this.StoreString = this.FIRST_AID_REC_STORE;
- this.libClass.openRecStore(this.testStore, this.StoreString);
- System.arraycopy(this.libClass.readDataNewA(this.startNumRec, this.endNumRec), 0, this.LinesArray, 0, 1);
- this.libClass.closeRecStore();
- this.fmMainDisplay.set(this.indexValue, new StringItem(this.titleString, this.LinesArray[0]));
- this.display.setCurrent(this.fmMainDisplay);
- }
-
- }
- }
-