本文整理汇总了Java中com.litesuits.orm.LiteOrm.newSingleInstance方法的典型用法代码示例。如果您正苦于以下问题:Java LiteOrm.newSingleInstance方法的具体用法?Java LiteOrm.newSingleInstance怎么用?Java LiteOrm.newSingleInstance使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.litesuits.orm.LiteOrm
的用法示例。
在下文中一共展示了LiteOrm.newSingleInstance方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onCreate
import com.litesuits.orm.LiteOrm; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
// init lite-orm
if (liteOrm == null) {
liteOrm = LiteOrm.newSingleInstance(this, "liteorm-notes");
}
// init GreenDAO
if (noteDao == null) {
DaoMaster.DevOpenHelper helper = new DaoMaster.DevOpenHelper(this, "greendao-notes", null);
SQLiteDatabase db = helper.getWritableDatabase();
DaoMaster daoMaster = new DaoMaster(db);
DaoSession daoSession = daoMaster.newSession();
noteDao = daoSession.getNoteDao();
}
}
示例2: getInstance
import com.litesuits.orm.LiteOrm; //导入方法依赖的package包/类
public static LiteOrm getInstance(Context context){
synchronized (object) {
if (liteOrm == null) {
liteOrm = LiteOrm.newSingleInstance(context, "liteorm.db");
}
liteOrm.setDebugged(true); // open the log
}
return liteOrm;
}
示例3: onCreate
import com.litesuits.orm.LiteOrm; //导入方法依赖的package包/类
@Override public void onCreate() {
super.onCreate();
sContext = this;
Toasts.register(this);
sDb = LiteOrm.newSingleInstance(this, DB_NAME);
if (BuildConfig.DEBUG) {
sDb.setDebugged(true);
}
}
示例4: manager
import com.litesuits.orm.LiteOrm; //导入方法依赖的package包/类
public static RxCacheManager manager() {
if (liteOrm == null) {
liteOrm = LiteOrm.newSingleInstance(context, "kakacache_journal.db");
}
liteOrm.setDebugged(true); // open the log
if (cacheManager == null) {
File storageDir = cacheDir;
if (storageDir == null || !storageDir.exists()) {
storageDir = Utils.getUsableCacheDir(context, DEFAULT_STORAGE_DIR);
}
L.log("storageDir="+storageDir);
CacheCore.Builder coreBuilder = new CacheCore.Builder();
coreBuilder.memory(new SimpleMemoryStorage());
coreBuilder.memoryJournal(new LRUMemoryJournal());
coreBuilder.memoryMax(10 * 1024 * 1024, 1000);
coreBuilder.disk(EmptyDiskStorage.INSTANCE);
if (storageDir != null) {
storageDir.mkdirs();
try {
FileDiskStorage fileDiskStorage = new FileDiskStorage(storageDir);
coreBuilder.disk(fileDiskStorage);
} catch (Exception ignored) { }
}
coreBuilder.diskJournal(new LRUDiskJournal(liteOrm));
coreBuilder.diskMax(30 * 1024 * 1024, 10 * 1000);
coreBuilder.diskConverter(new KryoDiskConverter(new Kryo()));
CacheCore core = coreBuilder.create();
cacheManager = new RxCacheManager(core, DEFAULT_EXPIRES);
}
return cacheManager;
}
示例5: getLiteOrm
import com.litesuits.orm.LiteOrm; //导入方法依赖的package包/类
public static LiteOrm getLiteOrm() {
if (sLiteOrm == null) {
synchronized (NotificationBoxApp.class) {
if (sLiteOrm == null) {
sLiteOrm = LiteOrm.newSingleInstance(sAppContext, "box.db");
sLiteOrm.setDebugged(true);
}
}
}
return sLiteOrm;
}
示例6: onCreate
import com.litesuits.orm.LiteOrm; //导入方法依赖的package包/类
@Override
public void onCreate() {
super.onCreate();
//初始化数据库
mLiteOrm = LiteOrm.newSingleInstance(this, "smile.db");
if (BuildConfig.DEBUG) {
mLiteOrm.setDebugged(true);
}
}
示例7: onCreate
import com.litesuits.orm.LiteOrm; //导入方法依赖的package包/类
@Override
public void onCreate() {
super.onCreate();
sDb = LiteOrm.newSingleInstance(this, DB_NAME);
sContext = this;
Once.initialise(this);
Logger.init("AppPlusLog").setLogLevel(BuildConfig.IS_DEBUG?LogLevel.FULL:LogLevel.NONE);
sDb.setDebugged(BuildConfig.IS_DEBUG);
}
示例8: LiteOrmManager
import com.litesuits.orm.LiteOrm; //导入方法依赖的package包/类
private LiteOrmManager(Context context) {
if (liteOrm == null) {
DataBaseConfig config = new DataBaseConfig(context, "tsb.db");
config.debugged = true; // open the log
config.dbVersion = 1; // set database version
liteOrm = LiteOrm.newSingleInstance(config);
}
liteOrm.setDebugged(true); // open the log
}
示例9: init
import com.litesuits.orm.LiteOrm; //导入方法依赖的package包/类
public static void init(Context context) {
sLiteOrm = LiteOrm.newSingleInstance(context, DB_NAME);
if (BuildConfig.DEBUG) {
sLiteOrm.setDebugged(true);
}
// sLiteOrm = LiteOrm.newCascadeInstance(context, DB_NAME);
// sLiteOrm.setDebugged(true);
}
示例10: onCreate
import com.litesuits.orm.LiteOrm; //导入方法依赖的package包/类
/**
* 在{@link com.litesuits.orm.samples.BaseActivity#onCreate(android.os.Bundle)}中设置视图
*/
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setSubTitile(getString(R.string.sub_title));
mockData();
if (liteOrm == null) {
DataBaseConfig config = new DataBaseConfig(this, "liteorm.db");
config.debugged = true; // open the log
config.dbVersion = 1; // set database version
config.onUpdateListener = null; // set database update listener
liteOrm = LiteOrm.newSingleInstance(config);
}
}
示例11: orm
import com.litesuits.orm.LiteOrm; //导入方法依赖的package包/类
static LiteOrm orm() {
if (sLiteOrm == null) {
sLiteOrm = LiteOrm.newSingleInstance(AppUtils.getContext(), AppConfig.db.DB_NAME);
}
return sLiteOrm;
}
示例12: GComicDB
import com.litesuits.orm.LiteOrm; //导入方法依赖的package包/类
private GComicDB(Context context) {
liteOrm = LiteOrm.newSingleInstance(context, DB_NAME);
liteOrm.setDebugged(true);
}
示例13: OrmLite
import com.litesuits.orm.LiteOrm; //导入方法依赖的package包/类
private OrmLite() {
if (sLiteOrm == null) {
sLiteOrm = LiteOrm.newSingleInstance(BaseApplication.getAppContext(), C.ORM_NAME);
}
sLiteOrm.setDebugged(BuildConfig.DEBUG);
}
示例14: OrmLite
import com.litesuits.orm.LiteOrm; //导入方法依赖的package包/类
private OrmLite() {
if (liteOrm == null) {
liteOrm = LiteOrm.newSingleInstance(BaseApplication.getmAppContext(), "cities.db");
}
liteOrm.setDebugged(BuildConfig.DEBUG);
}
示例15: DbHelper
import com.litesuits.orm.LiteOrm; //导入方法依赖的package包/类
private DbHelper() {
liteOrm = LiteOrm.newSingleInstance(GankApplication.getContext(), "gankmeizhi.db");
}