コード例 #1
0
 @Override
 protected void onDestroy() {
   // TODO Auto-generated method stub
   super.onDestroy();
   if (rvFromDb != null) rvFromDb.closeDb();
 }
コード例 #2
0
  /** Functionality to show the text of the verse to related chapter and book */
  void displayVerseText() {
    // clear the highlighted array list
    EBibleConstants.verseListToHighlight.clear();
    EBibleConstants.paragraphListToHighlight.clear();
    EBibleConstants.contentListToHighlight.clear();

    highlightedMatchedDescriptionArr.clear();
    highlightedMatchedColorCodeArr.clear();
    highlightedMatchedUnderlineArr.clear();
    highlightedMatchedVerseArr.clear();

    // clear the description string
    descriptionString = "";
    // clear the position value
    versePositionToHighlighten = -1;
    verseHighlightedPositionToStore = "";
    int pagenumber;
    if (EBibleConstants.isHighlightedDialogPassed) {
      EBibleConstants.isHighlightedDialogPassed = false;
      pagenumber = EBibleConstants.lastOpenendPagenumber;
    } else {
      // set the text description content with paging
      pagenumber = EBibleConstants.lastOpenendPagenumber = EBibleConstants.pageNumber;
    }
    Log.i("", "page number = " + pagenumber);

    for (int countParagraph = 0;
        countParagraph < EBibleConstants.paragraphList.size();
        countParagraph++) {
      if (EBibleConstants.paragraphList.get(countParagraph).equalsIgnoreCase("" + pagenumber)) {
        String contentTextAtPosition = EBibleConstants.contentList.get(countParagraph);
        if (contentTextAtPosition.contains("<")) {
          contentTextAtPosition = Html.fromHtml(contentTextAtPosition).toString();
        }
        // descriptionString += EBibleConstants.verseList.get(countParagraph)+")
        // "+contentTextAtPosition;
        // versePositionToHighlighten = countParagraph;

        // find if that verse has any highlighted text stored into db
        Cursor cursor =
            rvFromDb.retrieveValues(
                EBibleConstants.verseList.get(countParagraph),
                selectedChapterPosition,
                selectedBookName);
        if (cursor.getCount() > 0) {
          Log.i("", "cursor value = " + cursor.getCount());
          cursor.moveToFirst();
          for (int curCount = 0; curCount < cursor.getCount(); curCount++) {
            String desc = cursor.getString(1);
            Log.i(
                "cursor matched",
                "values = "
                    + desc
                    + "\n"
                    + cursor.getString(2)
                    + "\n"
                    + cursor.getString(3)
                    + "\n"
                    + cursor.getString(4)
                    + "\n"
                    + cursor.getString(5)
                    + "\n"
                    + cursor.getString(6)
                    + "\n"
                    + cursor.getString(7)
                    + "\n");

            /*if(!highlightedMatchedVerseArr.contains(cursor.getString(2)))
            {*/
            highlightedMatchedVerseArr.add(cursor.getString(2));
            // }
            highlightedMatchedColorCodeArr.add(URLDecoder.decode(cursor.getString(5)));
            highlightedMatchedUnderlineArr.add(cursor.getString(7));

            highlightedMatchedDescriptionArr.add(cursor.getString(1));

            cursor.moveToNext();
          }
        }
        Log.i(
            "db desc array",
            ""
                + highlightedMatchedDescriptionArr
                + "\n"
                + highlightedMatchedColorCodeArr
                + "\n"
                + highlightedMatchedUnderlineArr);
        // close the cursor
        if (cursor != null) {
          cursor.close();
          cursor = null;
        }

        // store into array list to highlight on highlighted page
        EBibleConstants.verseListToHighlight.add(EBibleConstants.verseList.get(countParagraph));
        EBibleConstants.paragraphListToHighlight.add(
            EBibleConstants.paragraphList.get(countParagraph));
        EBibleConstants.contentListToHighlight.add(contentTextAtPosition);
      }
    }
    Log.i("", "description = \n" + descriptionString);
    Log.i(
        "",
        "list content to highlight "
            + EBibleConstants.verseListToHighlight
            + "\npara= "
            + EBibleConstants.paragraphListToHighlight
            + "\ncontent = "
            + EBibleConstants.contentListToHighlight);
    // set the description texts
    // description.setText(descriptionString);
    descList.setAdapter(new VersesListAdapter());

    Log.i(
        "",
        "page no = "
            + EBibleConstants.pageNumber
            + "\nlast para value = "
            + EBibleConstants.lastParaValue);

    /*//find the values from the local database for the perticular verses
    String[] coloms = {"DESCRIPTION, VERSENO, CHAPTERNO, BOOKNAME, PARAGRAPHNO, " +
    "SECTIONID, CHARPOSITION, ISHIGHLIGHTED, ISUNDERLINE"};

    String whereCondition = "VERSENO="+verseno+" AND CHAPTERNO="+chapterno+" " +
    		"AND BOOKNAME="+bookname+" AND ISHIGHLIGHTED=true";
    new LocalDatabaseAsync(BookDescriptionActivity.this, EBibleConstants.DESCRIPTION_ACTIVITY,
    						this, EBibleConstants.DATA_RETRIEVE, "TEXTHIGHLIGHT", coloms,
    						whereCondition, null, null, null);*/
    /*if(EBibleConstants.pageNumber < (EBibleConstants.lastParaValue))
    {
    	next.setEnabled(true);
    }
    else
    {
    	next.setEnabled(false);
    }
    if(EBibleConstants.pageNumber == (EBibleConstants.startParaNumber) )
    {
    	previous.setEnabled(false);
    }
    else
    {
        previous.setEnabled(true);
    }

    description.setOnLongClickListener(new View.OnLongClickListener() {

    	@Override
    	public boolean onLongClick(View v) {
    		Log.i("","selected chapter "+selectedChapterName);
    		//start the highlight view dialog
    		new HighlightDialog(BookDescriptionActivity.this, selectedBookName,
    				selectedChapterPosition, versePositionToHighlighten);
    		return false;
    	}
    });*/
  }