当前位置: 首页>>代码示例>>Java>>正文


Java LiteOrm.newSingleInstance方法代码示例

本文整理汇总了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();
    }

}
 
开发者ID:litesuits,项目名称:for-test,代码行数:21,代码来源:MainActivity.java

示例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;
}
 
开发者ID:kituri,项目名称:KituriFlux,代码行数:10,代码来源:DaoUtils.java

示例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);
    }
}
 
开发者ID:benchegnzhou,项目名称:MeiZi_App,代码行数:10,代码来源:App.java

示例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;
}
 
开发者ID:LittleFriendsGroup,项目名称:KakaCache-RxJava,代码行数:36,代码来源:KakaCache.java

示例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;
}
 
开发者ID:gavinliu,项目名称:NotificationBox,代码行数:12,代码来源:NotificationBoxApp.java

示例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);
    }
}
 
开发者ID:Assassinss,项目名称:smile,代码行数:10,代码来源:MyApp.java

示例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);
}
 
开发者ID:maoruibin,项目名称:AppPlus,代码行数:10,代码来源:App.java

示例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
}
 
开发者ID:MPDL,项目名称:LabCam,代码行数:10,代码来源:LiteOrmManager.java

示例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);
    }
 
开发者ID:elffy,项目名称:AbroadEasy,代码行数:9,代码来源:LiteOrmDBUtil.java

示例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);
    }
}
 
开发者ID:litesuits,项目名称:android-lite-orm,代码行数:18,代码来源:SingleTestActivity.java

示例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;
}
 
开发者ID:ImKarl,项目名称:JianshuApp,代码行数:7,代码来源:BaseDao.java

示例12: GComicDB

import com.litesuits.orm.LiteOrm; //导入方法依赖的package包/类
private GComicDB(Context context) {
    liteOrm = LiteOrm.newSingleInstance(context, DB_NAME);
    liteOrm.setDebugged(true);
}
 
开发者ID:SamuelGjk,项目名称:GComic,代码行数:5,代码来源:GComicDB.java

示例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);
}
 
开发者ID:xcc3641,项目名称:SeeWeather,代码行数:7,代码来源:OrmLite.java

示例14: OrmLite

import com.litesuits.orm.LiteOrm; //导入方法依赖的package包/类
private OrmLite() {
    if (liteOrm == null) {
        liteOrm = LiteOrm.newSingleInstance(BaseApplication.getmAppContext(), "cities.db");
    }
    liteOrm.setDebugged(BuildConfig.DEBUG);
}
 
开发者ID:JasonChow1989,项目名称:SeeWeather-master,代码行数:7,代码来源:OrmLite.java

示例15: DbHelper

import com.litesuits.orm.LiteOrm; //导入方法依赖的package包/类
private DbHelper() {
    liteOrm = LiteOrm.newSingleInstance(GankApplication.getContext(), "gankmeizhi.db");
}
 
开发者ID:overlooping,项目名称:GankMeizhi,代码行数:4,代码来源:DbHelper.java


注:本文中的com.litesuits.orm.LiteOrm.newSingleInstance方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。