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


Java DB类代码示例

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


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

示例1: whenDefaultGifsAreLoaded

import com.snappydb.DB; //导入依赖的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.DB; //导入依赖的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: savePinnedApps

import com.snappydb.DB; //导入依赖的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

示例4: onClick

import com.snappydb.DB; //导入依赖的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

示例5: getAppStateFromDB

import com.snappydb.DB; //导入依赖的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

示例6: saveAppState

import com.snappydb.DB; //导入依赖的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

示例7: checkForNonNull

import com.snappydb.DB; //导入依赖的package包/类
private DB checkForNonNull(DB pSnappyDatabase) throws SnappydbException {
    if (pSnappyDatabase == null) {
        throw new UnsupportedSnappyDb();
    } else {
        return pSnappyDatabase;
    }
}
 
开发者ID:AndroidIasi,项目名称:CodeCamp,代码行数:8,代码来源:SnappyDatabase.java

示例8: clear

import com.snappydb.DB; //导入依赖的package包/类
@Override
public void clear() {
    try {
        DB db = new SnappyDB.Builder(context).name(fileName).build();
        db.destroy();
    } catch (SnappydbException e) {
        Log.w("SnappySweeper", "Can't clear db", e);
    }
}
 
开发者ID:techery,项目名称:snapper,代码行数:10,代码来源:SnappySweeper.java

示例9: saveEnabledLenses

import com.snappydb.DB; //导入依赖的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

示例10: getCachDB

import com.snappydb.DB; //导入依赖的package包/类
public DB getCachDB() {
    return cachDB;
}
 
开发者ID:Dnet3,项目名称:CustomAndroidOneSheeld,代码行数:4,代码来源:InternetManager.java

示例11: getAppState

import com.snappydb.DB; //导入依赖的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

示例12: saveAppState

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

示例13: cleanup

import com.snappydb.DB; //导入依赖的package包/类
@After
public void cleanup() throws SnappydbException {
    DB db = DBFactory.open(getTargetContext());
    db.destroy();
}
 
开发者ID:Catbag,项目名称:redux-android-sample,代码行数:6,代码来源:DataManagerTest.java

示例14: RxSnappyClient

import com.snappydb.DB; //导入依赖的package包/类
public RxSnappyClient(DB db) {
    super(db);
}
 
开发者ID:team-supercharge,项目名称:rxsnappy,代码行数:4,代码来源:RxSnappyClient.java

示例15: BaseSnappyClient

import com.snappydb.DB; //导入依赖的package包/类
public BaseSnappyClient(DB db) {
    this.db = db;
    if (this.db == null) {
        throw new RxSnappyException("Database is null!");
    }
}
 
开发者ID:team-supercharge,项目名称:rxsnappy,代码行数:7,代码来源:BaseSnappyClient.java


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