本文整理匯總了Java中com.squareup.sqlbrite.SqlBrite.create方法的典型用法代碼示例。如果您正苦於以下問題:Java SqlBrite.create方法的具體用法?Java SqlBrite.create怎麽用?Java SqlBrite.create使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.squareup.sqlbrite.SqlBrite
的用法示例。
在下文中一共展示了SqlBrite.create方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: provideSqlBrite
import com.squareup.sqlbrite.SqlBrite; //導入方法依賴的package包/類
@Provides
@Singleton
SqlBrite provideSqlBrite(SQLiteOpenHelper openHelper) {
SqlBrite db = SqlBrite.create(openHelper);
if (BuildConfig.DEBUG) {
db.setLogger(new SqlBrite.Logger() {
@Override
public void log(String message) {
Timber.tag("Database").v(message);
}
});
db.setLoggingEnabled(true);
}
return db;
}
示例2: LocalAccountsDataSource
import com.squareup.sqlbrite.SqlBrite; //導入方法依賴的package包/類
@Inject
public LocalAccountsDataSource(@NonNull Context context, SchedulerProvider schedulerProvider) {
checkNotNull(context);
AccountsDbHelper accountsDbHelper = new AccountsDbHelper(context);
SqlBrite sqlBrite = SqlBrite.create();
this.accountsDbHelper = sqlBrite.wrapDatabaseHelper(accountsDbHelper, schedulerProvider.io());
accountMapperFunction = this::getAccount;
}
示例3: briteDatabase
import com.squareup.sqlbrite.SqlBrite; //導入方法依賴的package包/類
/**
* 提供BriteDatabase注入.
*
* @return BriteDatabase
*/
@Provides
BriteDatabase briteDatabase() {
SqlBrite sqlBrite = SqlBrite.create(message -> LogTool.debug("Database", message));
SQLiteOpenHelper sqLiteOpenHelper = new DatabaseOpenHelper(application, userId);
BriteDatabase db = sqlBrite.wrapDatabaseHelper(sqLiteOpenHelper);
db.setLoggingEnabled(BuildConfig.DEBUG);
return db;
}
示例4: providesBriteDatabase
import com.squareup.sqlbrite.SqlBrite; //導入方法依賴的package包/類
@Provides
@Singleton
BriteDatabase providesBriteDatabase(@ApplicationContext Context context){
SqlBrite sqlBrite = SqlBrite.create();
DBOpenHelper dbOpenHelper = new DBOpenHelper(context);
BriteDatabase db = sqlBrite.wrapDatabaseHelper(dbOpenHelper, Schedulers.io());
return db;
}
示例5: provideBrite
import com.squareup.sqlbrite.SqlBrite; //導入方法依賴的package包/類
@Provides
@Singleton
BriteDatabase provideBrite(Context c, SchedulersProvider schedulers) {
SqlBrite sqlBrite = SqlBrite.create();
PisaBikeDbHelper helper = new PisaBikeDbHelper(c);
return sqlBrite.wrapDatabaseHelper(helper.getDbHelper(),
schedulers.provideBackgroundScheduler());
}
示例6: onCreate
import com.squareup.sqlbrite.SqlBrite; //導入方法依賴的package包/類
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.list_of_kittens_layout);
listOfKittens = (RecyclerView) findViewById(R.id.list_of_kittens);
floatingActionButton = (FloatingActionButton) findViewById(R.id.fab);
floatingActionButton.setOnClickListener(this::addRandomKitten);
sqlBrite = SqlBrite.create();
kittenAdapter = new KittenAdapter(this);
listOfKittens.setLayoutManager(new LinearLayoutManager(this));
listOfKittens.setAdapter(kittenAdapter);
}
示例7: provideSqlBrite
import com.squareup.sqlbrite.SqlBrite; //導入方法依賴的package包/類
@Provides @Singleton SqlBrite provideSqlBrite(SQLiteOpenHelper openHelper) {
SqlBrite db = SqlBrite.create(openHelper);
if (BuildConfig.DEBUG) {
db.setLogger(new SqlBrite.Logger() {
@Override public void log(String message) {
Timber.tag("Database").v(message);
}
});
db.setLoggingEnabled(true);
}
return db;
}
示例8: provideSqlBrite
import com.squareup.sqlbrite.SqlBrite; //導入方法依賴的package包/類
@Provides @Singleton BriteDatabase provideSqlBrite(SQLiteOpenHelper openHelper) {
SqlBrite sqlBrite = SqlBrite.create(new SqlBrite.Logger() {
@Override public void log(String message) {
Timber.tag("Database").v(message);
}
});
BriteDatabase db = sqlBrite.wrapDatabaseHelper(openHelper);
if (BuildConfig.DEBUG) {
db.setLoggingEnabled(true);
}
return db;
}
示例9: provideSqlBrite
import com.squareup.sqlbrite.SqlBrite; //導入方法依賴的package包/類
@Provides
@Singleton
SqlBrite provideSqlBrite() {
return SqlBrite.create(message -> Timber.tag("Database").v(message));
}
示例10: provideSqlBrite
import com.squareup.sqlbrite.SqlBrite; //導入方法依賴的package包/類
@Provides @Singleton SqlBrite provideSqlBrite() {
return SqlBrite.create(Timber.tag(TAG)::v);
}
示例11: provideSqlBrite
import com.squareup.sqlbrite.SqlBrite; //導入方法依賴的package包/類
@Provides
@NonNull
@Singleton
public SqlBrite provideSqlBrite() {
return SqlBrite.create(message -> Timber.tag("Database").v(message));
}
示例12: DaoManager
import com.squareup.sqlbrite.SqlBrite; //導入方法依賴的package包/類
private DaoManager(Builder builder) {
if (builder.name == null) {
throw new IllegalArgumentException(
"Database name not set. Use Builder.databaseName() to specify a database name");
}
if (builder.version == -1) {
throw new IllegalArgumentException(
"Database version not set. Use Builder.version() to specify the database version");
}
if (builder.daos.isEmpty()) {
throw new IllegalArgumentException(
"No DAO added. Use Builder.add() to register at least one DAO");
}
this.name = builder.name;
this.version = builder.version;
this.createdListener = builder.createdListener;
this.upgradedListener = builder.upgradedListener;
this.daos = builder.daos;
OpenHelper openHelper;
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN) {
openHelper = new OpenHelper(builder.context, name, builder.cursorFactory, version,
builder.errorHandler, builder.foreignKeyConstraints);
} else {
openHelper = new OpenHelperApi16(builder.context, name, builder.cursorFactory, version,
builder.errorHandler, builder.foreignKeyConstraints);
}
SqlBrite brite;
if (builder.logger != null) {
brite = SqlBrite.create(builder.logger);
} else {
brite = SqlBrite.create();
}
db = brite.wrapDatabaseHelper(openHelper,
builder.scheduler == null ? Schedulers.io() : builder.scheduler);
db.setLoggingEnabled(builder.logging);
for (Dao dao : builder.daos) {
dao.setSqlBriteDb(db);
}
}
示例13: onAppCreate
import com.squareup.sqlbrite.SqlBrite; //導入方法依賴的package包/類
@Override
protected void onAppCreate(Context ctx) {
SqlBrite mSqlBrite = SqlBrite.create(s -> JUtils.Log("DB",s));
mDbBrite = mSqlBrite.wrapDatabaseHelper(new DBHelper(ctx));
}
示例14: provideSqlBrite
import com.squareup.sqlbrite.SqlBrite; //導入方法依賴的package包/類
@Provides @Singleton
SqlBrite provideSqlBrite(SQLiteOpenHelper helper) {
return SqlBrite.create(helper);
}
示例15: provideSqlBrite
import com.squareup.sqlbrite.SqlBrite; //導入方法依賴的package包/類
@Provides
@Singleton
SqlBrite provideSqlBrite() {
return SqlBrite.create();
}