예제 #1
0
  protected boolean onAayaPrev() {
    // If the resource file changes the names of components this call will break notifying you that
    // you should fix the code
    boolean val = super.onAayaPrev();

    if (selectedSurahPartNumber > 1) {
      selectedSurahPartNumber--;
    } else if (selectedSurahPartNumber <= 1) {
      int i = 2; // because it is already at 1.
      InputStream inputStream;
      while ((inputStream =
              getClass()
                  .getResourceAsStream("/res/quran/" + selectedSurahNumber + "_" + i + ".xml"))
          != null) {
        i++;
      }
      inputStream = null;
      if (i == 2) // this means `selectedSurahNumber`_2.xml does not exist.
      {
        return val; // prev. is pressed on a surah with only 1 aaya file. No need to reload
      }
      selectedSurahPartNumber = i - 1;
    }
    final DefaultListModel defaultListModel = (DefaultListModel) aayaList.getModel();
    defaultListModel.removeAll();
    Vector resultVector = getAayaList(selectedSurahNumber, selectedSurahPartNumber);
    aayaList.setModel(new DefaultListModel(resultVector));
    aayaList.setRenderer(new AayaListRenderer());
    return val;
  }
예제 #2
0
 protected void exitAaya(Form f) {
   // If the resource file changes the names of components this call will break notifying you that
   // you should fix the code
   super.exitAaya(f);
   try {
     List list = findListAaya(f);
     final DefaultListModel defaultListModel = (DefaultListModel) list.getModel();
     defaultListModel.removeAll();
     aayaList = null;
     selectedSurahPartNumber = 1;
   } catch (Exception e) {
     Dialog.show(null, "exit Aaya exception", "OK", null);
   }
 }
예제 #3
0
 protected void exitSurah(Form f) {
   // If the resource file changes the names of components this call will break notifying you that
   // you should fix the code
   super.exitSurah(f);
   try {
     List list = findListSurah(f);
     final DefaultListModel defaultListModel = (DefaultListModel) list.getModel();
     defaultListModel.removeAll();
     selectSurah = null;
   } catch (Exception e) {
     e.printStackTrace();
     Dialog.show(null, "exitSurah Exception", "OK", null);
   }
 }
 private void populateToDoList(String searchTerm) {
   toDoList.setModel(new DefaultListModel());
   try {
     String[] pimListNames = pim.listPIMLists(PIM.TODO_LIST);
     for (int i = 0; i < pimListNames.length; ++i) {
       ContactList cl =
           (ContactList) pim.openPIMList(PIM.TODO_LIST, PIM.READ_ONLY, pimListNames[i]);
       Enumeration items = cl.items(searchTerm);
       while (items.hasMoreElements()) {
         Contact c = (Contact) items.nextElement();
         toDoList.addItem(c.getString(Contact.FORMATTED_NAME, 0));
       }
     }
   } catch (PIMException ex) {
     ex.printStackTrace();
   }
   if (toDoList.getModel().getSize() == 0) {
     toDoList.addItem("No matches");
   }
 }
  public Form getResources() {
    if (frmResources == null) {
      frmResources = new Form("Resources");

      List list = new List();
      list.addItem("uno");
      list.addItem("due");
      list.addItem("tre");
      list.addItem("quattro");
      list.addItem("cinque");
      list.addItem("sei");
      frmResources.addComponent(list);

      ComboBox comboBox = new ComboBox(list.getModel());
      frmResources.addComponent(comboBox);
      frmResources.addCommand(mBackCommand);
      frmResources.addCommandListener(this); // Use setCommandListener() with LWUIT 1.3 or earlier.
    }
    return frmResources;
  }
예제 #6
0
  protected boolean onAayaNext() {
    // If the resource file changes the names of components this call will break notifying you that
    // you should fix the code
    boolean val = super.onAayaNext();
    InputStream inputStream =
        getClass()
            .getResourceAsStream(
                "/res/quran/" + selectedSurahNumber + "_" + selectedSurahPartNumber + 1 + ".xml");
    if (inputStream == null && selectedSurahPartNumber == 1) return val;
    else if (inputStream == null) selectedSurahPartNumber = 0;
    inputStream = null;
    selectedSurahPartNumber++;
    final DefaultListModel defaultListModel = (DefaultListModel) aayaList.getModel();
    defaultListModel.removeAll();
    Vector resultVector = getAayaList(selectedSurahNumber, selectedSurahPartNumber);
    aayaList.setModel(new DefaultListModel(resultVector));
    aayaList.setRenderer(new AayaListRenderer());

    return val;
  }