Ejemplo n.º 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;
  }
Ejemplo n.º 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);
   }
 }
Ejemplo n.º 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);
   }
 }
Ejemplo n.º 4
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;
  }