@Override public void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); if (requestCode == REQUEST_CODE_SELECT && data != null) { jump(data.getStringExtra(OSIS), data.getStringExtra(VERSE)); } else if (requestCode == REQUEST_CODE_VERSION && data != null) { bible.setVersion(data.getStringExtra(VERSION)); refresh(); } }
@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; }
@Override protected void onCreate(Bundle savedInstanceState) { setTheme(); resolveColors(); super.onCreate(savedInstanceState); setContentView(getContentLayout()); mHeader = findHeader(); mPager = (ViewPager) findViewById(R.id.pager); bible = Bible.getInstance(this); fontPath = BibleUtils.getFontPath(this); mAdapter = new ReadingAdapter(getSupportFragmentManager(), retrieveOsisCount()); initialize(); }
protected final void updateVersion() { if (versionView != null) { versionView.setText(bible.getVersionName(bible.getVersion())); } }