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-target-tooltip allows to create toasts like tooltips, but targets can be specified, plus custom properties and features.

TextViewWithLinks is a TextView With Link handler

Example Proguard configurations for common Android libraries.

This project assumes that your ProGuard configuration is based off of the latest official proguard-android.txt config as shown below. Each library configuration should only be the rules required for that specific library, not a complete Android ProGuard configuration. The various library configurations are combined by the Gradle build system. The library rules should be universal, any app specific rules (such as preserving model classes) should be added in a custom proguard-project.pro file.

Extend base components, use widgets, and call utility methods.

It is a tool for reverse engineering 3rd party, closed, binary Android apps. It can decode resources to nearly original form and rebuild them after making some modifications; it makes possible to debug smali code step by step. Also it makes working with app easier because of project-like files structure and automation of some repetitive tasks like building apk, etc.

FragmentMaster is a library allows you easily develop an Android application which only navigated by Fragments.

Features:

  • Pass data and receive result between two fragments.
  • Swipe right to navigate back.
  • Custom transform animation.

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