public static void saveCurrentPassage( BibleText bibleText, SharedPreferences settings, int verseNumber) { SharedPreferences.Editor editor = settings.edit(); editor.putString(SharedPreferencesHelper.CURRENT_BOOK, bibleText.getBook()); editor.putString( SharedPreferencesHelper.CURRENT_CHAPTER, String.valueOf(bibleText.getChapter())); editor.putString(SharedPreferencesHelper.CURRENT_VERSE, String.valueOf(verseNumber)); editor.putString( SharedPreferencesHelper.CURRENT_TRANSLATION, bibleText.getTranslation().getInitials()); editor.commit(); }
/** Update bible text with new BibleText TODO: translation is current static */ public void updateBibleTextView(final BibleText bibleText) { if (bibleTextView != null) { loadSettings(); if (!bibleText.equals(bibleTextView.getBibleText())) { bibleTextView.setBibleText(bibleText); // String note = notesService.getNotes(bibleText.getKey()); // if (note != null) { // notesEditText.setText(note); // } else { // notesEditText.setText(""); // } // notesEditText.lock(); // Scroll to the required verse after reload, will be verse 1 if new chapter bibleTextView.post( new Runnable() { public void run() { try { getActivity().dismissDialog(LOADING_DIALOG); } catch (Exception e) { } // sermonBtn.requestFocus(); // only scroll to the verse if this thing is even visible if (getActivity().findViewById(R.id.prev_chapter_button) != null && bibleTextView.isShown() && bibleTextView.getBibleText() != null) { bibleTextView.scrollToVerse( bibleText.getVerse(), getActivity().findViewById(R.id.prev_chapter_button).getHeight()); } // do not give the editbox focus automatically when activity starts bibleTextView.clearFocus(); // grabFocus.requestFocus(); }; }); } } }
/** * This is where the bulk of our work is done. This function is called in a background thread * and should generate a new set of data to be published by the loader. */ @Override public String loadInBackground() { Log.d(TAG, "Load in Background"); // Done! return notesService.getAllNotesOfKey(bibleText.getKey()); }