• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java DBFactory类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中com.snappydb.DBFactory的典型用法代码示例。如果您正苦于以下问题:Java DBFactory类的具体用法?Java DBFactory怎么用?Java DBFactory使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



DBFactory类属于com.snappydb包,在下文中一共展示了DBFactory类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: whenDefaultGifsAreLoaded

import com.snappydb.DBFactory; //导入依赖的package包/类
@Test
public void whenDefaultGifsAreLoaded() {
    try {
        DB db = DBFactory.open(getTargetContext());
        db.destroy();
    } catch (Exception e) {
        Log.e("TEST", e.getLocalizedMessage(), e);
    }

    mHelper.dispatchFakeAppState(ImmutableAppState.builder().build());

    mHelper.replacePersistenceMiddleware(new DataManager(getTargetContext()));
    GifActionCreator.getInstance().setDispatcher(mock(DispatcherImpl.class));

    mActivityTestRule.launchActivity(new Intent());

    Map<String, Gif> expectedGifs = getAppStateDefault().getGifs();

    RecyclerTestLocker locker = new RecyclerTestLocker(getRecyclerView(), expectedGifs.size());
    locker.waitForEspresso();

    Map<Strings, Gif> gotGifs = ((GifsAdapter) getRecyclerView().getAdapter()).getGifs();
    assertEquals(expectedGifs, gotGifs);

    GifActionCreator.getInstance().setDispatcher(getFluxxan().getDispatcher());
}
 
开发者ID:Catbag,项目名称:redux-android-sample,代码行数:27,代码来源:GifListActivityTest.java


示例2: snappydbExecute

import com.snappydb.DBFactory; //导入依赖的package包/类
/**
 * @param context Context
 * @param dbName String
 * @param updateOperation SnappyDBUpdateOperation
 */
public static void snappydbExecute(Context context, String dbName, SnappyDBUpdateOperation updateOperation) {
    DB snappydb = null;

    try {
        snappydb = DBFactory.open(context, dbName);

        updateOperation.update(snappydb);

        snappydb.close();

    } catch (SnappydbException e) {
        Log.e(TAG, e.getLocalizedMessage());

        try {
            if (snappydb != null && snappydb.isOpen() ) {
                snappydb.close();
            }
        } catch (SnappydbException e1) {
            Log.e(TAG, e.getLocalizedMessage());
        }
    }
}
 
开发者ID:IamAlchemist,项目名称:AlchemistAndroidUtil,代码行数:28,代码来源:SnappyDBHelper.java


示例3: initView

import com.snappydb.DBFactory; //导入依赖的package包/类
private void initView() {


        id = getArguments().getString(CHANNELID);
        name = getArguments().getString(CHANNELNAME);

        if (TextUtils.isEmpty(id) || TextUtils.isEmpty(name)) {
            return;
        }

        try {
            snappydb = DBFactory.open(getActivity());
            old_data = snappydb.getObject(id, NewsItemData.class);
        } catch (SnappydbException e) {
            e.printStackTrace();
        }

        initRecycleView();

        if (old_data == null) {
            getData();
        } else {
            setData(old_data);
        }
    }
 
开发者ID:Daemon1993,项目名称:Pas,代码行数:26,代码来源:FragmentNewsItem.java


示例4: savePinnedApps

import com.snappydb.DBFactory; //导入依赖的package包/类
public void savePinnedApps () throws SnappydbException
{
	/*
	SharedPreferences prefs = this.getContext ().getSharedPreferences ("pinned", Context.MODE_PRIVATE);
	SharedPreferences.Editor editor = prefs.edit ();

	editor.clear ();

	for (int i = 0; i < this.pinned.size (); i++)
	{
		App app = this.pinned.get (i);
		StringBuilder packageAndActivityName = new StringBuilder (app.getPackageName ())
			.append ("\n")
			.append (app.getActivityName ());

		editor.putString (Integer.toString (i), packageAndActivityName.toString ());
	}

	editor.apply ();*/

	DB db = DBFactory.open (this.getContext ());
	db.put ("launcher_pinnedApps", this.pinned.toArray ());
	db.close ();

	this.parent.pinnedAppsChanged ();
}
 
开发者ID:RobinJ1995,项目名称:DistroHopper,代码行数:27,代码来源:AppManager.java


示例5: onClick

import com.snappydb.DBFactory; //导入依赖的package包/类
@Override
public void onClick(View v) {
    new GuillotineAnimation.GuillotineBuilder(guillotineMenu, guillotineMenu.findViewById(R.id.guillotine_hamburger), contentHamburger)
            .setStartDelay(RIPPLE_DURATION)
            .setActionBarViewForAnimation(toolbar)
            .setClosedOnStart(true)
            .build();
    switch (v.getId())
    {
        case R.id.activity_group:
            Toast.makeText(this,"My Events",Toast.LENGTH_SHORT).show();
            break;
        case R.id.feed_group:
            Intent intent2=new Intent(HomeActivity.this,FeedActivity.class);
            startActivity(intent2);
            break;
        case R.id.profile_group:
            Intent intent1=new Intent(HomeActivity.this,ProfileActivity.class);
            startActivity(intent1);
            break;
        case R.id.settings_group:
            LogSaver.appendLog("Facebook Logged Out :"+LoginManager.getInstance());
            LoginManager.getInstance().logOut();
            try {
                DB db = DBFactory.open(getApplicationContext(), "users");
                db.destroy();
                db.close();
            }
            catch (SnappydbException e){e.printStackTrace();}
            Intent intent=new Intent(HomeActivity.this,MainActivity.class);
            startActivity(intent);
            finish();
            LogSaver.appendLog("Facebook Logged Out");
           break;
    }
}
 
开发者ID:rishabh115,项目名称:Odyssey2017,代码行数:37,代码来源:HomeActivity.java


示例6: SnappyDB

import com.snappydb.DBFactory; //导入依赖的package包/类
public SnappyDB(Context context){
    try {
        snappydb = DBFactory.open(context);
        this.context = context;
    } catch (SnappydbException e) {
        e.printStackTrace();
    }
}
 
开发者ID:AmeliaPessoa,项目名称:DBPA,代码行数:9,代码来源:SnappyDB.java


示例7: cleanDatabase

import com.snappydb.DBFactory; //导入依赖的package包/类
@Override
protected void cleanDatabase() {
    try {
        snappydb.destroy();
        //Create again
        snappydb = DBFactory.open(context);
    } catch (SnappydbException e) {
        e.printStackTrace();
    }
}
 
开发者ID:AmeliaPessoa,项目名称:DBPA,代码行数:11,代码来源:SnappyDB.java


示例8: getAppStateFromDB

import com.snappydb.DBFactory; //导入依赖的package包/类
private AppState getAppStateFromDB() {
    AppState appstate = null;
    try {
        DB db = DBFactory.open(getTargetContext());
        appstate = AppState.fromJson(db.get(TAG_APP_STATE));
        db.close();
    } catch (SnappydbException | IOException e) {
        Log.e(getClass().getSimpleName(), "error", e);
    }
    return appstate;
}
 
开发者ID:Catbag,项目名称:redux-android-sample,代码行数:12,代码来源:DataManagerTest.java


示例9: saveAppState

import com.snappydb.DBFactory; //导入依赖的package包/类
private void saveAppState(AppState appState) {
    try {
        DB db = DBFactory.open(getTargetContext());
        db.put(TAG_APP_STATE, appState.toJson());
        db.close();
    } catch (SnappydbException | IOException e) {
        Log.e(getClass().getSimpleName(), "error", e);
    }
}
 
开发者ID:Catbag,项目名称:redux-android-sample,代码行数:10,代码来源:DataManagerTest.java


示例10: load

import com.snappydb.DBFactory; //导入依赖的package包/类
public static SharedPrefStore load(Context context) {

        try {
            return new SharedPrefStore(DBFactory.open(context, Constants.SHARED_PREFS_FILE));
        } catch (SnappydbException e) {
            e.printStackTrace();
            return null;
        }
    }
 
开发者ID:Drakuwa,项目名称:Fridge,代码行数:10,代码来源:SharedPrefStore.java


示例11: openDatabase

import com.snappydb.DBFactory; //导入依赖的package包/类
public void openDatabase() {
    if (db == null)
        try {
            db = DBFactory.open(context);
        } catch (SnappydbException e) {
            snappyErrorHandler.handlerError(e);
        }
}
 
开发者ID:richardradics,项目名称:MVPAndroidBootstrap,代码行数:9,代码来源:SnappyDatabase.java


示例12: init

import com.snappydb.DBFactory; //导入依赖的package包/类
public static void init(Context context) {
    if (db == null) {
        try {
            db = DBFactory.open(context);
        } catch (SnappydbException e) {
            Log.e("RxSnappy", "Failed to open database", e);
        }
    }
}
 
开发者ID:team-supercharge,项目名称:rxsnappy,代码行数:10,代码来源:RxSnappy.java


示例13: TelepatSnappyDb

import com.snappydb.DBFactory; //导入依赖的package包/类
public TelepatSnappyDb(Context mContext) {
    this.mContext = mContext;
    try {
        snappyDb = DBFactory.open(mContext, DB_NAME);
    } catch (SnappydbException e) {
        e.printStackTrace();
    }
}
 
开发者ID:telepat-io,项目名称:telepat-android-sdk,代码行数:9,代码来源:TelepatSnappyDb.java


示例14: empty

import com.snappydb.DBFactory; //导入依赖的package包/类
/**
 * Empty the internal DB
 */
@Override
public void empty() {
    try {
        snappyDb.destroy();
        snappyDb = DBFactory.open(mContext, DB_NAME);
    } catch (SnappydbException e) {
        e.printStackTrace();
    }
}
 
开发者ID:telepat-io,项目名称:telepat-android-sdk,代码行数:13,代码来源:TelepatSnappyDb.java


示例15: openDb

import com.snappydb.DBFactory; //导入依赖的package包/类
private void openDb() {
    try {
        snappyDb = DBFactory.open(mContext);
    } catch(Exception e) {
        Log.i(Constants.APP_NAME, "Error occurred while opening snappyDB");
    }
}
 
开发者ID:koustuvsinha,项目名称:benchmarker,代码行数:8,代码来源:DbSnappyHelper.java


示例16: createPersister

import com.snappydb.DBFactory; //导入依赖的package包/类
@Override
public StoragePersister createPersister(String adapterPrefix) throws IOException {
    if (db == null) {
        synchronized (SnappyStoragePersisterFactory.class) {
            try {
                if (db == null || !db.isOpen()) {
                    db = DBFactory.open(context, dbName);
                }
            } catch (SnappydbException e) {
                throw new IOException(e.getLocalizedMessage());
            }
        }
    }
    return new SnappyStoragePersister(db, adapterPrefix);
}
 
开发者ID:techery,项目名称:snapper,代码行数:16,代码来源:SnappyStoragePersisterFactory.java


示例17: saveEnabledLenses

import com.snappydb.DBFactory; //导入依赖的package包/类
public void saveEnabledLenses () throws SnappydbException
{
	DB db = DBFactory.open (this.context);

	List<String> enabledLenses = new ArrayList<String> ();
	for (int j = 0; j < this.enabled.size (); j++)
		enabledLenses.add (this.enabled.get (j).getClass ().getSimpleName ());

	db.put ("dash_enabledLenses", enabledLenses);
	db.close ();
}
 
开发者ID:RobinJ1995,项目名称:DistroHopper,代码行数:12,代码来源:LensManager.java


示例18: open

import com.snappydb.DBFactory; //导入依赖的package包/类
public void open() throws Exception {

        try {
            snappydb = DBFactory.open(context);
        }
        catch (SnappydbException ex)
        {

        }
    }
 
开发者ID:ludwigandersson,项目名称:thermospy,代码行数:11,代码来源:Database.java


示例19: init

import com.snappydb.DBFactory; //导入依赖的package包/类
public void init(Context context) throws SnappydbException {
    this.context = context;
    cachDB = DBFactory.open(context);
}
 
开发者ID:Dnet3,项目名称:CustomAndroidOneSheeld,代码行数:5,代码来源:InternetManager.java


示例20: getAppState

import com.snappydb.DBFactory; //导入依赖的package包/类
public AppState getAppState() throws SnappydbException, IOException {
    DB db = DBFactory.open(mContext);
    AppState appState = AppState.fromJson(db.get(TAG_APP_STATE));
    db.close();
    return appState;
}
 
开发者ID:Catbag,项目名称:redux-android-sample,代码行数:7,代码来源:Database.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java SyncRequest类代码示例发布时间:2022-05-21
下一篇:
Java Table类代码示例发布时间:2022-05-21
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap