Ejemplo n.º 1
0
 @Override
 public Bundle retrieveOsis(int position, String osis) {
   Bundle bundle = new Bundle();
   bundle.putString(OSIS, osis);
   Uri uri = Provider.CONTENT_URI_CHAPTER.buildUpon().appendEncodedPath(osis).build();
   Cursor cursor = null;
   try {
     cursor = getContentResolver().query(uri, null, null, null, null);
     if (cursor != null) {
       cursor.moveToFirst();
       bundle.putInt(ID, cursor.getInt(cursor.getColumnIndex(BaseColumns._ID)));
       String curr = cursor.getString(cursor.getColumnIndexOrThrow(Provider.COLUMN_OSIS));
       bundle.putString(CURR, curr);
       bundle.putString(
           NEXT, cursor.getString(cursor.getColumnIndexOrThrow(Provider.COLUMN_NEXT)));
       bundle.putString(
           PREV, cursor.getString(cursor.getColumnIndexOrThrow(Provider.COLUMN_PREVIOUS)));
       bundle.putString(
           HUMAN, cursor.getString(cursor.getColumnIndexOrThrow(Provider.COLUMN_HUMAN)));
       bundle.putString(
           CONTENT, cursor.getString(cursor.getColumnIndexOrThrow(Provider.COLUMN_CONTENT)));
       bundle.putString(OSIS, curr);
       bundle.putString(HIGHLIGHTED, bible.getHighlight(curr));
       bundle.putStringArray(NOTES, bible.getNoteVerses(curr));
     }
   } catch (SQLiteException e) {
     LogUtils.d("cannot query " + osis, e);
   } finally {
     if (cursor != null) {
       cursor.close();
     }
   }
   String version = bible.getVersion();
   SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(this);
   bundle.putInt(FONT_SIZE, sp.getInt(Settings.FONTSIZE + "-" + version, Settings.FONTSIZE_MED));
   bundle.putBoolean(CROSS, sp.getBoolean(Settings.XLINK, false));
   bundle.putBoolean(SHANGTI, sp.getBoolean(Settings.SHANGTI, false));
   bundle.putString(VERSION, bible.getVersion());
   bundle.putBoolean(RED, sp.getBoolean(Settings.RED, true));
   updateBundle(bundle);
   return bundle;
 }