Squeaky


Source link: https://github.com/jasonwyatt/squeaky-android

Squeaky for Android

SQLite is simple and lightweight; it follows that managing SQLite databases on Android should be also.

Squeaky strives to be a straightforward approach to creating, migrating, and accessing SQLite databases.

Setup

Add jitpack.io to your root build.gradle at the end of repositories:

allprojects {

  repositories {

...

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

  
}
 
}

Add SRML as a dependency to your app's build.gradle:

dependencies {

  compile 'com.github.jasonwyatt:squeaky-android:1.1.0' 
}

Getting Started

Define your Tables

import co.jasonwyatt.squeaky.Table  public class TodosTable extends Table {

  @Override
  public String getName() {

return "todos";
  
}

@Override
  public int getVersion() {

return 1;
  
}

@Override
  public String[] getCreateTable() {

return new String[] {

 "CREATE TABLE todos ("+

 "
 name TEXT NOT NULL"+

 "
 completed INTEGER NOT NULL DEFAULT 0"+

 ")"

}
;
  
}

@Override
  public String[] getMigration(int nextVersion) {

return new String[0];
  
}
 
}
 

Create your Database and add Tables to it

// in your Application's or Activity's onCreate() method Database myDB = new Database(this, "todos_db");
  myDb.addTable(new TodosTable());
 myDb.prepare();
 

Use it!

myDb.insert("INSERT INTO todos (name) VALUES (?)", "Learn how to use Squeaky");
 myDb.insert("INSERT INTO todos (name, completed) VALUES (?, ?)", "Already done", 1);
  // query Cursor c = myDb.query("SELECT rowid, name, completed FROM todos");
 while (c.moveToNext()) {

  // get values
  long rowid = c.getLong(0);

  String name = c.getString(1);

  boolean completed = c.getInt(2) == 1; 
}
  // in an OnClickListener, for example.. myDb.update("UPDATE todos SET completed = 1 WHERE rowid = ?", rowid);
 

Migrate a Table

Modify your Table definition class:

import co.jasonwyatt.squeaky.Table  public class TodosTable extends Table {

  @Override
  public String getName() {

return "todos";
  
}

@Override
  public int getVersion() {

return 2;
  
}

@Override
  public String[] getCreateTable() {

return new String[] {

 "CREATE TABLE todos ("+

 "
 name TEXT NOT NULL"+

 "
 completed INTEGER NOT NULL DEFAULT 0"+

 "
 due_date INTEGER"+

 ")"

}
;
  
}

@Override
  public String[] getMigration(int nextVersion) {

if (nextVersion == 2) {

 return new String[] {

  "ALTER TABLE todos ADD COLUMN due_date INTEGER"

 
}
;

}

return new String[0];
  
}
 
}
 

That's it. Next time your database is prepared after adding the table definition, the table will be migrated for you!

Resources

Android Annotations @ViewById annotation generator for Android Studio / IntelliJ IDEA, heavily based on the ButterKnifeZelezny plugin.

Library for handling Youtube Player in scrollable Views (ListView, GridView, ScrollView...)

Features:

  • Allows seamless transition between portrait and landscape (without rebufering)
  • Allows playback of one video at time
  • Attaches it self to view in scrollable container and scrolls with it
  • Supports AbsListView and ScrollView
  • Works from API level 17 (like YT API)

A command-line tool to copy Android Material Design icons to your project folders: drawable-ldpi, drawable-mdpi, and etc.

Unofficial client for local Youtube alternative website.

RecyclerView Animators is an Android library that allows developers to easily create RecyclerView with animations.

Read incoming and outgoing text messages using an Android application across different Android SDK versions it's not trivial. If yo don't want to appear as SMS application and your application has to read incoming and outgoing SMSs this is your library.

This Android library offers you two main classes to use to start listening text messages. SMS Radar is implemented in top of an Android service. To start / stop listening text messages use SmsRadar.initializeSmsRadarService(context, listener) with a Context instance and a SmsListener implementation.

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