SimpLite


Source link: https://github.com/idoamram/SimpLite/

SimpLite

###SQLite ORM for Android. Simple and easy-to-use.

Usage

###1. Add a dependency to your build.gradle file

compile 'com.simplite:simplite-orm:0.9.4' 

###2. Create an Entity class

  • Add inheritance from the DBObject class
  • Add fields
  • For each field, create getters and setters
    • The get;set methods must named accordingly to the fields names
      • For exmaple, if you have firstName field, you'll have a getFirstName getter and a setFirstName setter
  • Add @Entity annotation to your class (MUST)

 @Entity(tableName = "my_cool_entity_table_name")
  public class MyCoolEntity extends DBObject 
  • Add @PrimaryKey to your primary key field (MUST)

 @PrimaryKey(columnName = "my_pk_column_name")
  private String id; 
  • Add Other columns annotations (See the full explanation below)
    • Column - a regular column - int age
    • ForeignKey - when the field is an instance of other entity - Car myCar
    • ForeignKeyArray - when the field is an ArrayList of instances of other entity - ArrayList<Car> myCars

###3. Add meta-data to your manifest Name | Type | Value | Default value ---- | ---- | ----- | ------------- DATABASE_NAME | String | <DATABASE_FILE_NAME> | default_db DATABASE_VERSION | Number | <CURRENT_DATABASE_VERSION> | 1 CONFIG_CLASS | String | <FULL_CONIFGURATION_CLASS_NAME> | null ENTITIES_CLASSES_NAME | String array | <FULL_CLASS_NAMES_ARRAY> | []

#####DATABASE_NAME Your database file name

<meta-data android:name="DATABASE_NAME" android:value="<DATABASE_NAME>" /> 

Exmaple

<meta-data android:name="DATABASE_NAME" android:value="my_great_db" /> 

#####DATABASE_VERSION Changing this value will cause database upgrade. When onUpgrade method called, all tables will drop (DROP TABLE) and recreates in onCreate. ALL OF YOUR DATA WILL GET LOST (See CONFIG_CLASS).

<meta-data android:name="DATABASE_VERSION" android:value="<DATABASE_VERSION>" /> 

Example

<meta-data android:name="DATABASE_VERSION" android:value="6" /> 

#####CONFIG_CLASS You MUST specify the FULL name, including all packages. The configuration class MUST implement the SimpLiteConfiguration interface. It has beforeOnCreate, afterOnCreate , beforeOnUpgrade, afterOnUpgrade. For saving your data during upgrade, hold it on beforeOnUpgrade, and insert it on afterOnCreate.

<meta-data android:name="CONFIG_CLASS" android:value="<FULL_CLASS_NAME>" /> 

Example

<meta-data android:name="CONFIG_CLASS" android:value="com.simplite.example.utils.LocalDBConfiguration" /> 

#####ENTITIES_CLASSES_NAME The FULL (include all packages) name of each class that represent an entity (table in the database). An Entity MUST extend from DBObject class. The entities should separate with a coma

<meta-data android:name="ENTITIES_CLASSES_NAME" android:value="com.simplite.example.entities.EntityOne,

 com.simplite.example.entities.EntityTwo,com.simplite.example.entities.EntityThree" /> 

###Annotations Usage

#####@Entity ######For a class that represents an entity (table) in the database Method | Expected Value ------ | -------------- tableName | The name of the table that this entity represents

#####@PrimaryKey ######For a field that is a primary key in its table. Method | Expected Value ------ | -------------- columnName | The name of the column options | Options to add to the column, like AUTOINCREMENT or UNIQUE

#####@Column ######For any field that is a regular column - not primary or foreign key Method | Expected Value ------ | -------------- name | The name of the column options | Options to add to the column, like AUTOINCREMENT or UNIQUE

#####@ForeignKey ######For any field that is an instance of other entity Method | Expected Value ------ | -------------- valueColumnName | The name of the column in the current table fkColumnName | The name of the column in the foreign table entityClass | The foreign entity class options | Options to add to the column, like AUTOINCREMENT or UNIQUE

#####@ForeignKeyArray ######For any field that is an ArrayList of instances of other entity Method | Expected Value ------ | -------------- valueColumnName | The name of the column in the current table fkColumnName | The name of the column in the foreign table entityClass | The foreign entity class options | Options to add to the column, like AUTOINCREMENT or UNIQUE

CRUD

Person person = new Person(context);
 

#####Create

person.create() 

#####Delete

person.delete() 

#####Update

person.save() 

#####Read

  • findAll
  • findAllByColumn
  • findOne
  • findById
  • query
  • rawQuery
  • count
  • countByColumn
  • getAverageByColumn

#####CRUD in background Each CRUD method have another method that called [methodName]+"InBackground"(For example: createInBackground), that execute the original method in an AsyncTask.

###SQL helpers Return string that is a CREATE TABLE command for a class.

getCreateTableCommand 

Return string that is an INSERT command for a class instance, including the current fields values.

getInsertCommand 

Return string that is an UPDATE command for a class instance, including the current fields values.

getUpdateCommand 

###Please feel more than FREE to contact me and give a feedback, i want to improve the library and make it better for you. ### [email protected]

Resources

Mobile Test Automation Tool

  • Run the same test on different mobile devices and operating systems with a mobile test automation tool that allows tests portability
  • Perform mobile test automation using real devices and emulators
  • Create a test on one device and run it on any other device model or operating system
  • Increase coverage with full peripheral testing capabilities
  • Start your mobile test automation quickly with a simple plug, record and play tool
  • Enhance your mobile test automation by Integrating into all your major ALM environments
  • Integrate with any continuous integration environment
  • Recorder for quick test creation

This example is basically used for simple using of data binding for Views and RecyclerView using model.

This library aims to provide a chat UI view.

  • You need to write just few code to create chat view
  • Easy to use for a chat app

SectionedMergeAdapter is a library based on MergeAdapter by CommonsWare. It allows you to work with sections and subheaders in your ListViews. With this library, you get the advantage of stitching together the rows and the header of the subsection in the subsection itself. For example, if there are no rows in a subsection of the ListView, the header of the subsection is also not shown.

One tool to manage key generation, key storing and encryption on different APIs of Android.

As you may know android provided API to use keystore that is stored in system only from API 18. They introduced AndroidKeyStore provider that is responsible to manage this.

But as always there are underwater stones. Up to API 23 you are only able to create asymmetric keys using AndroidKeyStore provider. Also algorithms that you can use are limited. And what about devices below API 18 ?

This project provides API that wraps default JCA api and AndroidKeyStore API and makes it easy to create, manage and use your keys on any andorid API.

Fontometrics is an Android library which help to use customs font with just writing one line of code avoiding all the hassle to add the .ttf/.otf font files in the assests folder.

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