GreenDaoUpgradeHelper


Source link: https://github.com/yuweiguocn/GreenDaoUpgradeHelper

GreenDaoUpgradeHelper( ???)

GreenDaoUpgradeHelper is a database upgrade helper for greenDao.Use GreenDaoUpgradeHelper can easy solve database upgrade that's just need one line code.

The original code is from stackoverflow.

How to use

1.Add it in your root build.gradle at the end of repositories:

 allprojects {

repositories {

 ...
 maven {
 url "https://jitpack.io" 
}

}
  
}
 

2.Add the dependency?greendao 3.0 above?

 dependencies {

 compile 'org.greenrobot:greendao:3.2.0'

 compile 'com.github.yuweiguocn:GreenDaoUpgradeHelper:v2.0.0'  
}
 

or (greendao 3.0 below)


 dependencies {

 compile 'de.greenrobot:greendao:2.0.0'

 compile 'com.github.yuweiguocn:GreenDaoUpgradeHelper:v1.0.1'  
}
 

3.Add a new class that extends DaoMaster.OpenHelper,add a constructor,implement onUpgrade method and called migrate method,arguments is all of generated Dao class:

MigrationHelper.migrate(db, new MigrationHelper.ReCreateAllTableListener() {

 @Override

 public void onCreateAllTables(Database db, boolean ifNotExists) {

  DaoMaster.createAllTables(db, ifNotExists);

 
}

 @Override

 public void onDropAllTables(Database db, boolean ifExists) {

  DaoMaster.dropAllTables(db, ifExists);

 
}

}
,TestDataDao.class, TestData2Dao.class, TestData3Dao.class);
 

like this:

public class MySQLiteOpenHelper extends DaoMaster.OpenHelper {

  public MySQLiteOpenHelper(Context context, String name, SQLiteDatabase.CursorFactory factory) {

super(context, name, factory);

  
}

  @Override
  public void onUpgrade(Database db, int oldVersion, int newVersion) {

MigrationHelper.migrate(db, new MigrationHelper.ReCreateAllTableListener() {

@Override

public void onCreateAllTables(Database db, boolean ifNotExists) {

 DaoMaster.createAllTables(db, ifNotExists);

}

@Override

public void onDropAllTables(Database db, boolean ifExists) {

 DaoMaster.dropAllTables(db, ifExists);

}

  
}
,TestDataDao.class, TestData2Dao.class, TestData3Dao.class);

  
}
 
}
  

4.Finally,init like this:

//MigrationHelper.DEBUG = true;  //if you want see the log info,default is false MySQLiteOpenHelper helper = new MySQLiteOpenHelper(this, "test.db",

  null);

daoMaster = new DaoMaster(helper.getWritableDatabase());
 

Thanks

greenDAO

Pedro Okawa

Contact me

weibo: @???

gmail: [email protected]

blog: yuweiguo's blog

License

Copyright 2016 yuweiguocn  Licensed under the Apache License, Version 2.0 (the "License");
 you may not use this file except in compliance with the License. You may obtain a copy of the License at
  http://www.apache.org/licenses/LICENSE-2.0  Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. 

Resources

This is a simple FidgetSpinner view.

CircularProgressbar project lets you to create a circular progressbar in the simplest way.

This library uses the power of RxJava to wrap an Observable android Activity#onActivityResult() method so you can easily request something from other activities and have the result right there in your observabale's subscribe() method.

Main Benefits

  • Don't Break The Chain: Prevents you to split your code between the permission request and the result handling. Currently without this library you have to request in one place and handle the result in Activity#onActivityResult().
  • Reactive: All what RX provides about transformation, filter, chaining...

Circle Time View is an android custom view for displaying time in a pretty format. The View is highly customizable, so you can adapt the appearance according your needs.

You can use this view to create countdown timers, alarms or just allow user to set time manually.

This library requires API level 8 or higher.

A fancy CircularProgressView.

Sometimes when working with REST APIs in Android apps there is a need to return some mock data. Maybe for demo purposes, or real endpoint is just not ready yet. Endpoint2mock aims to help with that by integrating with Retrofit and allowing you to easily redirect some (but not all!) of your requests to your mock server.

Topics


2D Engines   3D Engines   9-Patch   Action Bars   Activities   ADB   Advertisements   Analytics   Animations   ANR   AOP   API   APK   APT   Architecture   Audio   Autocomplete   Background Processing   Backward Compatibility   Badges   Bar Codes   Benchmarking   Bitmaps   Bluetooth   Blur Effects   Bread Crumbs   BRMS   Browser Extensions   Build Systems   Bundles   Buttons   Caching   Camera   Canvas   Cards   Carousels   Changelog   Checkboxes   Cloud Storages   Color Analysis   Color Pickers   Colors   Comet/Push   Compass Sensors   Conferences   Content Providers   Continuous Integration   Crash Reports   Credit Cards   Credits   CSV   Curl/Flip   Data Binding   Data Generators   Data Structures   Database   Database Browsers   Date &   Debugging   Decompilers   Deep Links   Dependency Injections   Design   Design Patterns   Dex   Dialogs   Distributed Computing   Distribution Platforms   Download Managers   Drawables   Emoji   Emulators   EPUB   Equalizers &   Event Buses   Exception Handling   Face Recognition   Feedback &   File System   File/Directory   Fingerprint   Floating Action   Fonts   Forms   Fragments   FRP   FSM   Functional Programming   Gamepads   Games   Geocaching   Gestures   GIF   Glow Pad   Gradle Plugins   Graphics   Grid Views   Highlighting   HTML   HTTP Mocking   Icons   IDE   IDE Plugins   Image Croppers   Image Loaders   Image Pickers   Image Processing   Image Views   Instrumentation   Intents   Job Schedulers   JSON   Keyboard   Kotlin   Layouts   Library Demos   List View   List Views   Localization   Location   Lock Patterns   Logcat   Logging   Mails   Maps   Markdown   Mathematics   Maven Plugins   MBaaS   Media   Menus   Messaging   MIME   Mobile Web   Native Image   Navigation   NDK   Networking   NFC   NoSQL   Number Pickers   OAuth   Object Mocking   OCR Engines   OpenGL   ORM   Other Pickers   Parallax List   Parcelables   Particle Systems   Password Inputs   PDF   Permissions   Physics Engines   Platforms   Plugin Frameworks   Preferences   Progress Indicators   ProGuard   Properties   Protocol Buffer   Pull To   Purchases   Push/Pull   QR Codes   Quick Return   Radio Buttons   Range Bars   Ratings   Recycler Views   Resources   REST   Ripple Effects   RSS   Screenshots   Scripting   Scroll Views   SDK   Search Inputs   Security   Sensors   Services   Showcase Views   Signatures   Sliding Panels   Snackbars   SOAP   Social Networks   Spannable   Spinners   Splash Screens   SSH   Static Analysis   Status Bars   Styling   SVG   System   Tags   Task Managers   TDD &   Template Engines   Testing   Testing Tools   Text Formatting   Text Views   Text Watchers   Text-to   Toasts   Toolkits For   Tools   Tooltips   Trainings   TV   Twitter   Updaters   USB   User Stories   Utils   Validation   Video   View Adapters   View Pagers   Views   Watch Face   Wearable Data   Wearables   Weather   Web Tools   Web Views   WebRTC   WebSockets   Wheel Widgets   Wi-Fi   Widgets   Windows   Wizards   XML   XMPP   YAML   ZIP Codes