Java Code Examples for com.raizlabs.android.dbflow.config.FlowManager#init()

The following examples show how to use com.raizlabs.android.dbflow.config.FlowManager#init() . 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: ApplicationController.java    From amiibo with GNU General Public License v2.0 6 votes vote down vote up
@Override
public void onCreate() {
    super.onCreate();
    Fabric.with(this, new Crashlytics(), new Answers());

    _updated = false;
    setInUpdate(false);

    //init the database orm
    FlowManager.init(this);

    //init the AmiiboHelper
    AmiiboHelper.init();

    mApplicationBus = EventBus.builder().build();

    mApplicationBus.register(this);

    AmiitoolFactory.getInstance().init(this);
}
 
Example 2
Source File: RuuviScannerApplication.java    From com.ruuvi.station with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
@Override
public void onCreate() {
    super.onCreate();
    me = this;
    Log.d(TAG, "App class onCreate");
    FlowManager.init(getApplicationContext());
    prefs = new Preferences(getApplicationContext());
    ruuviRangeNotifier = new RuuviRangeNotifier(getApplicationContext(), "RuuviScannerApplication");
    Foreground.init(this);
    Foreground.get().addListener(listener);
    new Handler().postDelayed(new Runnable() {
        @Override
        public void run() {
            if (!foreground) {
                if (prefs.getBackgroundScanMode() == BackgroundScanModes.FOREGROUND) {
                    new ServiceUtils(getApplicationContext()).startForegroundService();
                } else if (prefs.getBackgroundScanMode() == BackgroundScanModes.BACKGROUND) {
                    startBackgroundScanning();
                }
            }
        }
    }, 5000);
    region = new Region("com.ruuvi.station.leRegion", null, null, null);
}
 
Example 3
Source File: TestUtil.java    From dev-summit-architecture-demo with Apache License 2.0 6 votes vote down vote up
public static TestComponent prepare(App app) {
    FlowManager.destroy();
    resetSingleton(FlowManager.class, "mDatabaseHolder");
    ApplicationModule appModule = new ApplicationModule(app) {
        @Override
        public EventBus eventBus() {
            return new LoggingBus();
        }
        @Provides
        @Singleton
        public JobManager jobManager() {
            JobManager mock = mock(JobManager.class);
            when(mock.addJob(any(Job.class))).thenReturn(1L);
            return mock;
        }
    };
    TestComponent testComponent = DaggerTestComponent.builder()
            .testApplicationModule(new TestApplicationModule())
            .applicationModule(appModule)
            .build();
    testComponent.appContext().deleteDatabase(DemoDatabase.NAME + ".db");
    FlowManager.init(app);
    testComponent.feedModel().clear();
    testComponent.loggingBus().clear();
    return testComponent;
}
 
Example 4
Source File: ScroballApplication.java    From scroball with MIT License 6 votes vote down vote up
@Override
public void onCreate() {
  super.onCreate();
  Fabric.with(this, new Crashlytics());
  FlowManager.init(this);
  MobileAds.initialize(this, "ca-app-pub-9985743520520066~4279780475");

  sharedPreferences = PreferenceManager.getDefaultSharedPreferences(this);

  String userAgent =
      String.format(Locale.UK, "%s.%d", BuildConfig.APPLICATION_ID, BuildConfig.VERSION_CODE);
  String sessionKeyKey = getString(R.string.saved_session_key);
  LastfmApi api = new LastfmApi();
  Caller caller = Caller.getInstance();

  if (sharedPreferences.contains(sessionKeyKey)) {
    String sessionKey = sharedPreferences.getString(sessionKeyKey, null);
    lastfmClient = new LastfmClient(api, caller, userAgent, sessionKey);
  } else {
    lastfmClient = new LastfmClient(api, caller, userAgent);
  }

  scroballDB = new ScroballDB();
  eventBus.register(this);
}
 
Example 5
Source File: MainApplication.java    From AndroidDatabaseLibraryComparison with MIT License 6 votes vote down vote up
@Override
public void onCreate() {
    super.onCreate();

    ActiveAndroid.initialize(new Configuration.Builder(this)
                                     .setDatabaseName("activeandroid")
                                     .setDatabaseVersion(1)
                                     .setModelClasses(SimpleAddressItem.class, AddressItem.class,
                                                      AddressBook.class, Contact.class).create());

    Ollie.with(this)
            .setName("ollie")
            .setVersion(1)
            .setLogLevel(Ollie.LogLevel.FULL)
            .init();

    FlowManager.init(this);

    Sprinkles.init(this, "sprinkles.db", 2);

    RealmConfiguration realmConfig = new RealmConfiguration.Builder(this).build();
    Realm.setDefaultConfiguration(realmConfig);

    mDatabase = getDatabase();
}
 
Example 6
Source File: JianShiApplication.java    From jianshi with Apache License 2.0 6 votes vote down vote up
@Override
public void onCreate() {
  super.onCreate();

  appComponent = DaggerAppComponent.builder()
      .appModule(new AppModule(JianShiApplication.this))
      .build();

  final Fabric fabric = new Fabric.Builder(this)
      .kits(new Crashlytics())
      .debuggable(true)
      .build();
  Fabric.with(fabric);
  Stetho.initializeWithDefaults(this);
  instance = this;
  FlowManager.init(new FlowConfig.Builder(this).openDatabasesOnInit(true).build());

  initLog();

  CalligraphyConfig.initDefault(new CalligraphyConfig.Builder()
      .setDefaultFontPath("fonts/jianshi_default.otf")
      .setFontAttrId(R.attr.fontPath)
      .build()
  );
}
 
Example 7
Source File: TavernaApplication.java    From incubator-taverna-mobile with Apache License 2.0 5 votes vote down vote up
@Override
public void onCreate() {
    super.onCreate();

    FlowManager.init(new FlowConfig.Builder(this).build());
    if (BuildConfig.DEBUG) {
        Stetho.initializeWithDefaults(this);
    }

    if (LeakCanary.isInAnalyzerProcess(this)) {
        return;
    }
    LeakCanary.install(this);

}
 
Example 8
Source File: TyApplication.java    From tysq-android with GNU General Public License v3.0 5 votes vote down vote up
/**
 * 初始化数据库
 */
private void initDb() {
    FlowManager
            .init(FlowConfig.builder(this)
                    .addDatabaseConfig(
                            DatabaseConfig.builder(TyDB.class)
                                    .databaseName(TyDB.NAME)
                                    .build()
                    )
                    .build());

    FlowManager.initModule(TyGeneratedDatabaseHolder.class);
}
 
Example 9
Source File: App.java    From dev-summit-architecture-demo with Apache License 2.0 5 votes vote down vote up
@Override
public void onCreate() {
    super.onCreate();
    FlowManager.init(this);
    mAppComponent = DaggerAppComponent.builder()
            .applicationModule(new ApplicationModule(this))
            .build();
}
 
Example 10
Source File: DhisController.java    From dhis2-android-dashboard with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
private DhisController(Context context) {
    mContext = context;
    FlowManager.init(context);
    LastUpdatedManager.init(context);
    DateTimeManager.init(context);

    // fetch meta data from disk
    readSession();
}
 
Example 11
Source File: DBFlowExecutor.java    From android-orm-benchmark-updated with Apache License 2.0 5 votes vote down vote up
@Override
public long createDbStructure() throws SQLException
{
    long start = System.nanoTime();

    FlowManager.init(
        new FlowConfig.Builder(applicationContext)
            .openDatabasesOnInit(true)
        .build()
    );
    return System.nanoTime() - start;
}
 
Example 12
Source File: CoderfunApplication.java    From coderfun with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void onCreate() {
    super.onCreate();
    appContext = getApplicationContext();

    Fresco.initialize(this);
    FlowManager.init(this);
}
 
Example 13
Source File: Model.java    From UPMiss with GNU General Public License v3.0 5 votes vote down vote up
public static void setApplication(Application application) {
    APPLICATION = application;
    // DB Flow init
    FlowManager.init(new FlowConfig.Builder(application)
            .openDatabasesOnInit(true)
            .build());

    Model.log(TAG, "setApplication");
}
 
Example 14
Source File: StockHawkApplication.java    From Stock-Hawk with Apache License 2.0 5 votes vote down vote up
@Override
public void onCreate() {
    super.onCreate();

    if (BuildConfig.DEBUG) {
        Timber.plant(new Timber.DebugTree());
        Fabric.with(this, new Crashlytics());
    }

    FlowManager.init(new FlowConfig.Builder(this).build());
    Stetho.initializeWithDefaults(this);
}
 
Example 15
Source File: JerryDownloadConfig.java    From tysq-android with GNU General Public License v3.0 5 votes vote down vote up
/**
 * 初始化
 *
 * @param context
 */
public static void init(Context context) {
    FlowManager
            .init(FlowConfig.builder(context)
                    .addDatabaseConfig(
                            DatabaseConfig.builder(DownloadDB.class)
                                    .databaseName(DownloadDB.NAME)
                                    .build()
                    )
                    .build());

    FlowManager.initModule(JerryMultiDownloadGeneratedDatabaseHolder.class);
}
 
Example 16
Source File: Application.java    From CSCI4669-Fall15-Android with Apache License 2.0 4 votes vote down vote up
@Override
public void onCreate() {
    super.onCreate();
    FlowManager.init(this);
}
 
Example 17
Source File: DemoApp.java    From DBFlowManager with Apache License 2.0 4 votes vote down vote up
@Override
public void onCreate() {
    super.onCreate();

    FlowManager.init(new FlowConfig.Builder(this).build());
}
 
Example 18
Source File: ScroballDBTest.java    From scroball with MIT License 4 votes vote down vote up
@Before
public void before() {
  FlowManager.init(RuntimeEnvironment.application);
}
 
Example 19
Source File: PerfTestDbFlow.java    From android-database-performance with Apache License 2.0 4 votes vote down vote up
@Override
public void setUp() throws Exception {
    super.setUp();

    FlowManager.init(new FlowConfig.Builder(getTargetContext()).build());
}
 
Example 20
Source File: DefaultAddressProvider.java    From JDAddressSelector with MIT License 4 votes vote down vote up
public DefaultAddressProvider(Context context) {
    FlowManager.init(new FlowConfig.Builder(context.getApplicationContext()).build());
}