com.j256.ormlite.android.apptools.OpenHelperManager Java Examples

The following examples show how to use com.j256.ormlite.android.apptools.OpenHelperManager. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: KADataService.java    From android-viewer-for-khan-academy with GNU General Public License v3.0 6 votes vote down vote up
@Override
public void onDestroy() {
	Log.d(LOG_TAG, "onDestroy");
	
	api = null;
	captionManager = null;
	
	offlineVideoManager.destroy();
	offlineVideoManager = null;
	
	thumbnailManager.destroy();
	thumbnailManager = null;
	
	OpenHelperManager.releaseHelper();
	flushResponseCache();
	
	mBinder.setDataService(null);
	mBinder = null;
	notificationManager = null;
	
	super.onDestroy();
}
 
Example #2
Source File: BulkReadCardDataOperationRunner.java    From Walrus with GNU General Public License v3.0 6 votes vote down vote up
@Override
public void run() {
    databaseHelper = OpenHelperManager.getHelper(context, DatabaseHelper.class);

    try {
        readCardDataOperation.execute(context, this, this);
    } catch (final IOException exception) {
        new Handler(context.getMainLooper()).post(new Runnable() {
            @Override
            public void run() {
                Toast.makeText(context,
                        context.getString(R.string.failed_bulk_reading, exception.getMessage()),
                        Toast.LENGTH_LONG).show();
            }
        });
    }

    OpenHelperManager.releaseHelper();

    onStopCallback.onStop(this);
}
 
Example #3
Source File: HistoryFragment.java    From Notification-Analyser with MIT License 5 votes vote down vote up
@Override
public void onDestroy() {
    super.onDestroy();
    if (databaseHelper != null) {
        OpenHelperManager.releaseHelper();
        databaseHelper = null;
    }
}
 
Example #4
Source File: FlowActivity.java    From flow-android with MIT License 5 votes vote down vote up
public FlowDatabaseHelper getHelper() {
    if (flowDatabaseHelper == null) {
        flowDatabaseHelper =
                OpenHelperManager.getHelper(this, FlowDatabaseHelper.class);
    }
    return flowDatabaseHelper;
}
 
Example #5
Source File: FlowActivity.java    From flow-android with MIT License 5 votes vote down vote up
@Override
protected void onDestroy() {
    super.onDestroy();

    if (flowDatabaseHelper != null) {
        OpenHelperManager.releaseHelper();
        flowDatabaseHelper = null;
    }

    ((FlowApplication) getApplication()).getMixpanel().flush();
}
 
Example #6
Source File: HelperFactory.java    From hash-checker with Apache License 2.0 5 votes vote down vote up
public static void setHelper(@NonNull Context context) {
    if (databaseHelper != null) {
        releaseHelper();
    }
    databaseHelper = OpenHelperManager.getHelper(
            context,
            OrmLiteDatabaseHelper.class
    );
}
 
Example #7
Source File: NotificationListener.java    From Notification-Analyser with MIT License 5 votes vote down vote up
@Override
public void onDestroy() {
    super.onDestroy();
    if (databaseHelper != null) {
        OpenHelperManager.releaseHelper();
        databaseHelper = null;
    }
}
 
Example #8
Source File: AppDetail.java    From Notification-Analyser with MIT License 5 votes vote down vote up
@Override
public void onDestroy() {
    super.onDestroy();
    if (databaseHelper != null) {
        OpenHelperManager.releaseHelper();
        databaseHelper = null;
    }
}
 
Example #9
Source File: TreatmentService.java    From AndroidAPS with GNU Affero General Public License v3.0 5 votes vote down vote up
/**
 * This method is a simple re-implementation of the database create and up/downgrade functionality
 * in SQLiteOpenHelper#getDatabaseLocked method.
 * <p>
 * It is implemented to be able to late initialize separate plugins of the application.
 */
protected void dbInitialize() {
    DatabaseHelper helper = OpenHelperManager.getHelper(this, DatabaseHelper.class);
    int newVersion = helper.getNewVersion();
    int oldVersion = helper.getOldVersion();

    if (oldVersion > newVersion) {
        onDowngrade(this.getConnectionSource(), oldVersion, newVersion);
    } else {
        onUpgrade(this.getConnectionSource(), oldVersion, newVersion);
    }
}
 
Example #10
Source File: FoodService.java    From AndroidAPS with GNU Affero General Public License v3.0 5 votes vote down vote up
/**
 * This method is a simple re-implementation of the database create and up/downgrade functionality
 * in SQLiteOpenHelper#getDatabaseLocked method.
 * <p>
 * It is implemented to be able to late initialize separate plugins of the application.
 */
protected void dbInitialize() {
    DatabaseHelper helper = OpenHelperManager.getHelper(this, DatabaseHelper.class);
    int newVersion = helper.getNewVersion();
    int oldVersion = helper.getOldVersion();

    if (oldVersion > newVersion) {
        onDowngrade(this.getConnectionSource(), oldVersion, newVersion);
    } else {
        onUpgrade(this.getConnectionSource(), oldVersion, newVersion);
    }
}
 
Example #11
Source File: ApplicationAndroidStarter.java    From AndroidStarter with Apache License 2.0 5 votes vote down vote up
@Override
public void onTerminate() {
    super.onTerminate();
    sSharedApplication = null;
    OpenHelperManager.releaseHelper();
    merlin.unbind();
}
 
Example #12
Source File: IgnoredApps.java    From Notification-Analyser with MIT License 5 votes vote down vote up
@Override
public void onDestroy() {
    super.onDestroy();
    if (databaseHelper != null) {
        OpenHelperManager.releaseHelper();
        databaseHelper = null;
    }
}
 
Example #13
Source File: OrmLiteBaseAppCompatActivity.java    From Walrus with GNU General Public License v3.0 5 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    // noinspection unchecked
    helper = (H) OpenHelperManager.getHelper(this, helperClass);

    super.onCreate(savedInstanceState);
}
 
Example #14
Source File: HistorySyncService.java    From SightRemote with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void onDestroy() {
    pendingIntent.cancel();
    if (databaseHelper != null) {
        OpenHelperManager.releaseHelper();
        databaseHelper = null;
    }
}
 
Example #15
Source File: SightActivity.java    From SightRemote with GNU General Public License v3.0 5 votes vote down vote up
@Override
protected void onDestroy() {
    super.onDestroy();
    if (databaseHelper != null) {
        OpenHelperManager.releaseHelper();
        databaseHelper = null;
    }
}
 
Example #16
Source File: TodayFragment.java    From Notification-Analyser with MIT License 5 votes vote down vote up
@Override
public void onDestroy() {
    super.onDestroy();
    if (databaseHelper != null) {
        OpenHelperManager.releaseHelper();
        databaseHelper = null;
    }
}
 
Example #17
Source File: IgnoredApps.java    From Notification-Analyser with MIT License 4 votes vote down vote up
public DatabaseHelper getDatabaseHelper() {
    if (databaseHelper == null) {
        databaseHelper = OpenHelperManager.getHelper(this, DatabaseHelper.class);
    }
    return databaseHelper;
}
 
Example #18
Source File: DatabaseHelper.java    From poetry with Apache License 2.0 4 votes vote down vote up
public static DatabaseHelper getHelper(Context context)
{
    return OpenHelperManager.getHelper(context, DatabaseHelper.class);
}
 
Example #19
Source File: HistoryFragment.java    From Notification-Analyser with MIT License 4 votes vote down vote up
public DatabaseHelper getDatabaseHelper() {
    if (databaseHelper == null) {
        databaseHelper = OpenHelperManager.getHelper(this.getActivity(), DatabaseHelper.class);
    }
    return databaseHelper;
}
 
Example #20
Source File: AppDetail.java    From Notification-Analyser with MIT License 4 votes vote down vote up
public DatabaseHelper getDatabaseHelper() {
    if (databaseHelper == null) {
        databaseHelper = OpenHelperManager.getHelper(this, DatabaseHelper.class);
    }
    return databaseHelper;
}
 
Example #21
Source File: NotificationListener.java    From Notification-Analyser with MIT License 4 votes vote down vote up
public DatabaseHelper getDatabaseHelper() {
    if (databaseHelper == null) {
        databaseHelper = OpenHelperManager.getHelper(this, DatabaseHelper.class);
    }
    return databaseHelper;
}
 
Example #22
Source File: DemoDataGenerator.java    From Notification-Analyser with MIT License 4 votes vote down vote up
private void close() {
    if (databaseHelper != null) {
        OpenHelperManager.releaseHelper();
        databaseHelper = null;
    }
}
 
Example #23
Source File: TodayFragment.java    From Notification-Analyser with MIT License 4 votes vote down vote up
public DatabaseHelper getDatabaseHelper() {
    if (databaseHelper == null) {
        databaseHelper = OpenHelperManager.getHelper(getActivity(), DatabaseHelper.class);
    }
    return databaseHelper;
}
 
Example #24
Source File: DemoDataGenerator.java    From Notification-Analyser with MIT License 4 votes vote down vote up
private DatabaseHelper getDatabaseHelper() {
    if (databaseHelper == null) {
        databaseHelper = OpenHelperManager.getHelper(context, DatabaseHelper.class);
    }
    return databaseHelper;
}
 
Example #25
Source File: OutlineFragment.java    From mOrgAnd with GNU General Public License v2.0 4 votes vote down vote up
@Override
public void onDestroy() {
    Application.getBus().unregister(this);
    super.onDestroy();
    OpenHelperManager.releaseHelper();
}
 
Example #26
Source File: DatabaseHelper.java    From mOrgAnd with GNU General Public License v2.0 4 votes vote down vote up
public static RuntimeExceptionDao<OrgNode, Integer> getOrgNodeDao() {
    Context context = Application.getInstace();
    return OpenHelperManager.getHelper(context, DatabaseHelper.class).getRuntimeExceptionDao(OrgNode.class);
}
 
Example #27
Source File: OrgFile.java    From mOrgAnd with GNU General Public License v2.0 4 votes vote down vote up
public static RuntimeExceptionDao<OrgFile, String> getDao() {
    Context context = Application.getInstace();
    return OpenHelperManager.getHelper(context, DatabaseHelper.class).getRuntimeExceptionDao(OrgFile.class);
}
 
Example #28
Source File: DbProvider.java    From Man-Man with GNU General Public License v3.0 4 votes vote down vote up
public static void releaseHelper() {
    OpenHelperManager.releaseHelper();
    databaseHelper = null;
}
 
Example #29
Source File: DbProvider.java    From Man-Man with GNU General Public License v3.0 4 votes vote down vote up
public static void setHelper(Context context) {
    databaseHelper = OpenHelperManager.getHelper(context, PersistManager.class);
}
 
Example #30
Source File: DatabaseHelper.java    From poetry with Apache License 2.0 4 votes vote down vote up
public static void releaseHelper()
{
    OpenHelperManager.releaseHelper();
}