Java Code Examples for com.j256.ormlite.android.apptools.OpenHelperManager#getHelper()

The following examples show how to use com.j256.ormlite.android.apptools.OpenHelperManager#getHelper() . 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: 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 2
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 3
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 4
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 5
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 6
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 7
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 8
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 9
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 10
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 11
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 12
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 13
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 14
Source File: DatabaseHelper.java    From poetry with Apache License 2.0 4 votes vote down vote up
public static <T extends DatabaseHelper> T getHelper(Context context, Class<T> classObject)
{
    return OpenHelperManager.getHelper(context, classObject);
}
 
Example 15
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 16
Source File: XpraApplication.java    From xpra-client with GNU General Public License v3.0 4 votes vote down vote up
@Override
public void onCreate() {
    super.onCreate();
    this.database = OpenHelperManager.getHelper(this, DatabaseHelper.class);
}
 
Example 17
Source File: HistorySyncService.java    From SightRemote with GNU General Public License v3.0 4 votes vote down vote up
public DatabaseHelper getDatabaseHelper() {
    if (databaseHelper == null) {
        databaseHelper = OpenHelperManager.getHelper(this, DatabaseHelper.class);
    }
    return databaseHelper;
}
 
Example 18
Source File: SightActivity.java    From SightRemote with GNU General Public License v3.0 4 votes vote down vote up
protected DatabaseHelper getDatabaseHelper() {
    if (databaseHelper == null) {
        databaseHelper = OpenHelperManager.getHelper(this, DatabaseHelper.class);
    }
    return databaseHelper;
}
 
Example 19
Source File: DatabaseHelper.java    From android-project-wo2b with Apache License 2.0 2 votes vote down vote up
/**
 * 返回DatabaseHelper对象
 * 
 * @param context
 * @return
 */
public static DatabaseHelper getDatabaseHelper(Context context)
{
	return OpenHelperManager.getHelper(context, DatabaseHelper.class);
}
 
Example 20
Source File: UserDatabaseHelper.java    From android-project-wo2b with Apache License 2.0 2 votes vote down vote up
/**
 * 返回UserDatabaseHelper对象
 * 
 * @param context
 * @return
 */
public static UserDatabaseHelper getUserDatabaseHelper2(Context context)
{
	return OpenHelperManager.getHelper(context, UserDatabaseHelper.class);
}