Java Code Examples for com.activeandroid.Configuration#Builder
The following examples show how to use
com.activeandroid.Configuration#Builder .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DatabaseContentProvider.java From 10000sentences with Apache License 2.0 | 5 votes |
@Override protected Configuration getConfiguration() { Configuration.Builder builder = new Configuration.Builder(getContext()); builder.addModelClass(info.puzz.a10000sentences.models.Language.class); builder.addModelClass(info.puzz.a10000sentences.models.Sentence.class); builder.addModelClass(info.puzz.a10000sentences.models.SentenceCollection.class); builder.addModelClass(info.puzz.a10000sentences.models.SentenceHistory.class); builder.addModelClass(info.puzz.a10000sentences.models.Annotation.class); builder.addModelClass(info.puzz.a10000sentences.models.WordAnnotation.class); return builder.create(); }
Example 2
Source File: MimiApplication.java From mimi-reader with Apache License 2.0 | 4 votes |
@SuppressLint("CheckResult") @Override public void onCreate() { super.onCreate(); app = this; MimiUtil.getInstance().init(this); @SuppressWarnings("unchecked") Configuration.Builder configurationBuilder = new Configuration.Builder(this) .addModelClasses( Board.class, History.class, UserPost.class, HiddenThread.class, PostOption.class, Filter.class, PostModel.class, CatalogPostModel.class, Archive.class, ArchivedPost.class ); ActiveAndroid.initialize(configurationBuilder.create()); DatabaseUtils.createIfNeedColumn(ArchivedPost.class, ArchivedPost.THREAD_ID, DatabaseUtils.COLUMN_TYPE.LONG, false); DatabaseUtils.createIfNeedColumn(ArchivedPost.class, ArchivedPost.POST_ID, DatabaseUtils.COLUMN_TYPE.LONG, false); DatabaseUtils.createIfNeedColumn(ArchivedPost.class, ArchivedPost.BOARD_NAME, DatabaseUtils.COLUMN_TYPE.STRING, false); DatabaseUtils.createIfNeedColumn(ArchivedPost.class, ArchivedPost.ARCHIVE_DOMAIN, DatabaseUtils.COLUMN_TYPE.STRING, false); DatabaseUtils.createIfNeedColumn(ArchivedPost.class, ArchivedPost.ARCHIVE_NAME, DatabaseUtils.COLUMN_TYPE.STRING, false); DatabaseUtils.createIfNeedColumn(ArchivedPost.class, ArchivedPost.MEDIA_LINK, DatabaseUtils.COLUMN_TYPE.STRING, false); DatabaseUtils.createIfNeedColumn(ArchivedPost.class, ArchivedPost.THUMB_LINK, DatabaseUtils.COLUMN_TYPE.STRING, false); try { final File fullImageDir = new File(MimiUtil.getInstance().getCacheDir().getAbsolutePath(), "full_images/"); MimiUtil.deleteRecursive(fullImageDir, false); } catch (Exception e) { e.printStackTrace(); } final SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(this); final int notificationLevel = Integer.valueOf(preferences.getString(getString(R.string.background_notification_pref), "0")); final boolean defaultSet = preferences.getBoolean(getString(R.string.crappy_samsung_default_set), false); if (!defaultSet) { boolean useCrappyVideoPlayer = MimiUtil.isCrappySamsung(); preferences.edit() .putBoolean(getString(R.string.crappy_samsung_default_set), true) .putBoolean(getString(R.string.use_crappy_video_player), useCrappyVideoPlayer) .apply(); } if (notificationLevel == 0) { preferences.edit().putString(getString(R.string.background_notification_pref), "3").apply(); } final int historyPruneDays = Integer.valueOf(preferences.getString(getString(R.string.history_prune_time_pref), "0")); MimiUtil.pruneHistory(historyPruneDays) .flatMap((Function<Boolean, Single<Boolean>>) aBoolean -> HiddenThreadTableConnection.prune(5)) .flatMap((Function<Boolean, Single<Boolean>>) aBoolean -> UserPostTableConnection.prune(7)) .subscribe(aBoolean -> { if (aBoolean) { Log.d(LOG_TAG, "Pruned history"); } else { Log.e(LOG_TAG, "Failed to prune history"); } }, throwable -> Log.e(LOG_TAG, "Caught exception while setting up database", throwable)); ThreadRegistry.getInstance().init(); BusProvider.getInstance(); RefreshScheduler.getInstance(); SimpleChromeCustomTabs.initialize(this); }