droidparts 6.7 0.0 L5 Java DI, ORM, JSON, ...

Overview

DroidParts

a carefully crafted Android framework that includes:

  • DI - injection of Views, Fragments, Services, etc.
  • ORM - efficient persistence utilizing Cursors & fluent API.
  • EventBus for posting event notifications.
  • Simple JSON (de)serialization capable of handling nested objects.
  • Improved AsyncTask & IntentService with Exceptions & result reporting support.
  • Logger that figures out tag itself & logs any object.
  • RESTClient for GETting, PUTting, POSTing, DELETing & InputStream-getting, also speaks JSON.
  • ImageFetcher to asynchronously attach images to ImageViews, with caching, cross-fade & transformation support.
  • Numerous Utils.

Documentation

available at http://droidparts.org.

Download

the latest JAR, get from Maven:

<dependency>
  <groupId>org.droidparts</groupId>
  <artifactId>droidparts</artifactId>
  <version>${version.from.jar.above}</version>
</dependency>

or Gradle:

dependencies {
   compile 'org.droidparts:droidparts:${version.from.jar.above}'
}

or use as a plain old Android library project.

Comments
  • [RFC] How to replace currently open SQLite database with backup?

    [RFC] How to replace currently open SQLite database with backup?

    Now I am trying to do it like so:

        Context context = Injector.getApplicationContext();
        Injector.tearDown();    // close all (and db too)
        replace_database_file();
        Injector.setUp(context);
    

    But the program after this crashes on the first attempt to access database with exception: java.lang.IllegalStateException: attempt to re-open an already-closed object: SQLiteDatabase:

    opened by vovan888 6
  • EventBus for posting event notifications. -> Slow

    EventBus for posting event notifications. -> Slow

    Hi, I've just read droidparts.org.

    I used a lot of EventBus in my android-applications, but I ended up removing it, because in profiling it turned out to be a big performance-hog. The reflection-api that EventBus relies on is dead-slow on Dalvik/Android, compared to desktop-java. It's not unusual that a couple of EventBus-calls or initializations take ~100-500ms.

    opened by fab1an 3
  • Не удается запустить под idea

    Не удается запустить под idea

    Видимо проект тестировался только на eclipse

    • При попытке запуска приложения legasy из примера:

    ERROR/AndroidRuntime(9422): FATAL EXCEPTION: main java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{org.droidparts.sample/org.droidparts.sample.activity.EntryListActivity}: java.lang.ClassNotFoundException: org.droidparts.sample.activity.EntryListActivity in loader dalvik.system.PathClassLoader[/data/app/org.droidparts.sample-2.apk]

    • Приложение legasy и библиотека legasy названы одинаково, просто лежат в разных директориях, что также приводит к колизиям в виде проекта legasy и legasy1 в idea
    • Попытка подключить base и extra как библиотеки в пустой проект с инъекцией - приводит к аналогичной ошибке (ClassNotFoundException)
    • Какие то странно прописанные пути к projectpropertis и т.п. приводят к зависимостям от структуры директорий, какая то магия с какими то депенденсипровайдерами о5 же из других директорий

    Вобщем за 2 дня так и не удалось ни черта собрать на последней бесплатной идее

    opened by recoilme 3
  • Custom Primary Key

    Custom Primary Key

    I am stuck with a scenario where I am bound to use a pre-defined database which has its primary keys already set. I have to manually insert column id in all the tables. Can you guys please get onto this problem. I mean either add an annotation of primary key so that people can override the default "id". Also its difficult to set a composite key. So, I have to manually handle this issue.

    opened by waqasahmadspace 2
  • Add Custom Font

    Add Custom Font

    public class MyEditText_Regular extends EditText implements View.OnTouchListener, View.OnFocusChangeListener, TextWatcherAdapter.TextWatcherListener { private Context context; private AttributeSet attrs; private int defStyle; public static enum Location { LEFT(0), RIGHT(2);

        final int idx;
    
        private Location(int idx) {
            this.idx = idx;
        }
    }
    
    public interface Listener {
        void didClearText();
    }
    
    public MyEditText_Regular(Context context) {
        super(context);
        Typeface face = Typeface.createFromAsset(context.getAssets(), "fonts/RobotoCondensed-Regular.ttf");
        this.setTypeface(face);
        this.context=context;
    }
    public MyEditText_Regular(Context context, AttributeSet attrs) {
        super(context, attrs);
        this.context=context;
        Typeface face = Typeface.createFromAsset(context.getAssets(), "fonts/RobotoCondensed-Regular.ttf");
        this.setTypeface(face);
        this.attrs=attrs;
        init();
    }
    
    public MyEditText_Regular(Context context, AttributeSet attrs, int defStyle) {
        super(context, attrs, defStyle);
        this.context=context;
        Typeface face = Typeface.createFromAsset(context.getAssets(), "fonts/RobotoCondensed-Regular.ttf");
        this.setTypeface(face);
        this.attrs=attrs;
        this.defStyle=defStyle;
        init();
    }
    
    public void setListener(Listener listener) {
        this.listener = listener;
    }
    

    /* null disables the icon*/

    public void setIconLocation(Location loc) {
        this.loc = loc;
        initIcon();
    }
    
    @Override
    public void setOnTouchListener(OnTouchListener l) {
        this.l = l;
    }
    
    @Override
    public void setOnFocusChangeListener(OnFocusChangeListener f) {
        this.f = f;
    }
    
    private Location loc = Location.RIGHT;
    
    private Drawable xD;
    private Listener listener;
    
    private OnTouchListener l;
    private OnFocusChangeListener f;
    
    @Override
    public boolean onTouch(View v, MotionEvent event) {
        if (getDisplayedDrawable() != null) {
            int x = (int) event.getX();
            int y = (int) event.getY();
            int left = (loc == Location.LEFT) ? 0 : getWidth() - getPaddingRight() - xD.getIntrinsicWidth();
            int right = (loc == Location.LEFT) ? getPaddingLeft() + xD.getIntrinsicWidth() : getWidth();
            boolean tappedX = x >= left && x <= right && y >= 0 && y <= (getBottom() - getTop());
            if (tappedX) {
                if (event.getAction() == MotionEvent.ACTION_UP) {
                    setText("");
                    if (listener != null) {
                        listener.didClearText();
                    }
                }
                return true;
            }
        }
        if (l != null) {
            return l.onTouch(v, event);
        }
        return false;
    }
    
    @Override
    public void onFocusChange(View v, boolean hasFocus) {
        if (hasFocus) {
            setClearIconVisible(isNotEmpty(getText()));
        } else {
            setClearIconVisible(false);
        }
        if (f != null) {
            f.onFocusChange(v, hasFocus);
        }
    }
    
    @Override
    public void onTextChanged(EditText view, String text) {
        if (isFocused()) {
            setClearIconVisible(isNotEmpty(text));
        }
    }
    
    @Override
    public void setCompoundDrawables(Drawable left, Drawable top, Drawable right, Drawable bottom) {
        super.setCompoundDrawables(left, top, right, bottom);
        initIcon();
    }
    
    private void init() {
        super.setOnTouchListener(this);
        super.setOnFocusChangeListener(this);
        addTextChangedListener(new TextWatcherAdapter(this, this));
        initIcon();
        Typeface font=Typeface.createFromAsset(getContext().getAssets(), "fonts/RobotoCondensed-Regular.ttf");
        this.setTypeface(font);
        setClearIconVisible(false);
    }
    
    private void initIcon() {
        xD = null;
        if (loc != null) {
            xD = getCompoundDrawables()[loc.idx];
        }
        if (xD == null) {
            xD = getResources().getDrawable(android.R.drawable.presence_offline);
        }
        xD.setBounds(0, 0, xD.getIntrinsicWidth(), xD.getIntrinsicHeight());
        int min = getPaddingTop() + xD.getIntrinsicHeight() + getPaddingBottom();
        if (getSuggestedMinimumHeight() < min) {
            setMinimumHeight(min);
        }
    }
    
    private Drawable getDisplayedDrawable() {
        return (loc != null) ? getCompoundDrawables()[loc.idx] : null;
    }
    
    protected void setClearIconVisible(boolean visible) {
        Drawable[] cd = getCompoundDrawables();
        Drawable displayed = getDisplayedDrawable();
        boolean wasVisible = (displayed != null);
        if (visible != wasVisible) {
            Drawable x = visible ? xD : null;
            super.setCompoundDrawables((loc == Location.LEFT) ? x : cd[0], cd[1], (loc == Location.RIGHT) ? x : cd[2],
                    cd[3]);
        }
    }
    

    } I am adding Typeface but it is workingPlaese help me..

    opened by shafaque 2
  • Unable to use empty string as default value

    Unable to use empty string as default value

    I've ran into that issue while trying to use addMissingColumns method:

    android.database.sqlite.SQLiteException: near ";": syntax error (code 1): , 
    while compiling: ALTER TABLE Table ADD COLUMN Column TEXT NOT NULL DEFAULT ;
    

    It is definitely possible: http://stackoverflow.com/questions/16606905/default-value-string-empty-in-sqlite-table Column definition:

    @Column
    private String column = "";
    
    opened by ghost 2
  • Larger Clear Text Icon for ClearableEditText

    Larger Clear Text Icon for ClearableEditText

    First of all, Thanks for awesome ClearableEditText . However, I came across to this little icon. IMHO, the default clear text icon is a little bit small. Here's the screenshot.

    Alt

    I replaced with ic_action_remove icon from Android Icon pack.

    Alt

    Just a suggestion and if you like, I would love to send a PR.

    opened by yelinaung 2
  • Allow the clear drawable in ClearableEditText to scale

    Allow the clear drawable in ClearableEditText to scale

    It seems like with the new use of the sexier clear icon, the height is enough to make the view increase in height. A flag to force the drawable to have a max height of the view would would be great. I'm currently using this scaling code for this purpose.

    float innerHeight = view.getHeight() - (view.getTotalPaddingTop() + view.getTotalPaddingBottom());
            float scale = innerHeight / drawable.getIntrinsicHeight();
    
            int width = (int) (scale * drawable.getIntrinsicWidth());
            int height = (int) (scale * drawable.getIntrinsicHeight());
            drawable.setBounds(
                    (drawable.getIntrinsicWidth() - width) / 2,
                    (drawable.getIntrinsicHeight() - height) / 2,
                    width, height);
    
            return drawable;
    
    opened by nickcaballero 2
  • ClearableEditText: Show clear button if text is present on field focus

    ClearableEditText: Show clear button if text is present on field focus

    In my application, I am programmatically setting the text field in some cases.

    I thought the clear button should show any time the field has focus if there was text in it. Currently, the clear button would only be shown if edits were made to the existing text.

    opened by drudge 2
  • Clearable EditText as a separate library

    Clearable EditText as a separate library

    Hi,

    The clearable edit text is a great piece of functionality - would you be interested in splitting it out as a separate library? I'd be happy to contribute/do it if you like. I'm currently using a version in Kotlin based on what you've written and thought it might be useful to provide it for others as well.

    opened by evolutionise 1
  • App crash in IntentService

    App crash in IntentService

    Hello.

    Found crash if IntentService gets intent=null.

    https://github.com/yanchenko/droidparts/blob/master/droidparts/src/org/droidparts/concurrent/service/IntentService.java#L67 String action = intent.getAction();

    Official docs http://developer.android.com/reference/android/app/IntentService.html#onStartCommand%28android.content.Intent,%20int,%20int%29

    opened by plzen 1
  • select(); throw exception

    select(); throw exception

    java.lang.NoSuchFieldException: No field elements in class Llibcore/reflect/AnnotationFactory; (declaration of 'libcore.reflect.AnnotationFactory' appears in /apex/com.android.runtime/javalib/core-libart.jar) at java.lang.Class.getDeclaredField(Native Method) at org.droidparts.inner.AnnotationElementsReader.getElements(AnnotationElementsReader.java:36) at org.droidparts.inner.ann.Ann.(Ann.java:45) at org.droidparts.inner.ann.sql.TableAnn.(TableAnn.java:26) at org.droidparts.inner.AnnBuilder.getTableAnn(AnnBuilder.java:54) at org.droidparts.inner.ClassSpecRegistry.getTableName(ClassSpecRegistry.java:107) at org.droidparts.persist.sql.EntityManager.getTableName(EntityManager.java:145) at org.droidparts.persist.sql.AbstractEntityManager.select(AbstractEntityManager.java:134)

    opened by andasl 0
  • ArrayCollectionConverter is used instead of ByteArrayConverter for byte[]

    ArrayCollectionConverter is used instead of ByteArrayConverter for byte[]

    ArrayCollectionConverter is used instead of ByteArrayConverter for byte[] leading to crash: SQLiteException: Unable to convert BLOB to string

    After I've migrated from 2.7.7 to 3.2.5 I am getting this error. Looks like (converter.getDBColumnType() == BLOB) at L171 doesn't evaluate to true, since ByteConverter returns INTEGER, thus ArrayCollectionConverter tries to get a String at L175. At this moment I solve this by calling ConverterRegistry.registerConverter(new ByteArrayConverter()); which puts it at index 0 of the registry.

    Maybe the ArrayCollectionConverter.canHandle(Class<?> cls) should return false for byte[]?

    opened by amayatsky 0
Releases(3.1.0)
LiteOrm is a fast, small, powerful ORM framework for Android. LiteOrm makes you do CRUD operarions on SQLite database with a sigle line of code efficiently.

#LiteOrm:Android高性能数据库框架 A fast, small, powerful ORM framework for Android. LiteOrm makes you do CRUD operarions on SQLite database with a sigle line

马天宇 1.5k Nov 19, 2022
Intellij Idea, Android Studio plugin for generating Kotlin data classes from JSON. Helps to avoid writing boilerplate code for model classes. Supports annotations for Gson, Moshi, Jackson.

JSONToKotlinClass Intellij Idea, Android Studio plugin. Plugin generates Kotlin data classes from JSON text. It can find inner classes in nested JSON.

Vasily 139 Dec 21, 2022
The most complete and powerful data-binding library and persistence infra for Kotlin 1.3, Android & Splitties Views DSL, JavaFX & TornadoFX, JSON, JDBC & SQLite, SharedPreferences.

Lychee (ex. reactive-properties) Lychee is a library to rule all the data. ToC Approach to declaring data Properties Other data-binding libraries Prop

Mike 112 Dec 9, 2022
A framework for hook java methods.

Legend Projects are out of date, plese move to: Whale Hook What is Legend? Legend is a Hook framework for Android Development, it allows you to Hook J

Lody 1.6k Dec 15, 2022
Cross-platform framework for building truly native mobile apps with Java or Kotlin. Write Once Run Anywhere support for iOS, Android, Desktop & Web.

Codename One - Cross Platform Native Apps with Java or Kotlin Codename One is a mobile first cross platform environment for Java and Kotlin developers

Codename One 1.4k Dec 23, 2022
🚀Plugin for Android Studio And IntelliJ Idea to generate Kotlin data class code from JSON text ( Json to Kotlin )

JsonToKotlinClass Hi, Welcome! This is a plugin to generate Kotlin data class from JSON string, in another word, a plugin that converts JSON string to

Seal 2.8k Jan 3, 2023
Android Material Json Form Wizard is a library for creating beautiful form based wizards within your app just by defining json in a particular format.

Android Json Wizard Android Json Wizard is a library for creating beautiful form based wizards within your app just by defining json in a particular f

Vijay Rawat 355 Nov 11, 2022
Images grid JSON | Сетка изображений JSON

Images grid JSON | Сетка изображений JSON Задача Разработать приложение: Приложение должно получать JSON-список ссылок на изображения с сервера по адр

Sefo Notasi 2 Apr 25, 2022
Dynamic-UI-From-JSON - A Sample Android app to show dynamic UI generation from Json

Dynamic UI from JSON Functionality The app's functionality includes: The app gen

Rafsan Ahmad 12 Dec 16, 2022
lightweight and minimalist ORM for Java/Android. works with SQLite & MySQL. (not actively maintained)

Description ORMAN is an minimalistic and lightweight ORM framework for Java which can handle your common database usage without writing SQL and strugg

Ahmet Alp Balkan 246 Nov 20, 2022
lightweight and minimalist ORM for Java/Android. works with SQLite & MySQL. (not actively maintained)

Description ORMAN is an minimalistic and lightweight ORM framework for Java which can handle your common database usage without writing SQL and strugg

Ahmet Alp Balkan 246 Nov 20, 2022
A Java serialization/deserialization library to convert Java Objects into JSON and back

Gson Gson is a Java library that can be used to convert Java Objects into their JSON representation. It can also be used to convert a JSON string to a

Google 21.7k Jan 5, 2023
LiteHttp is a simple, intelligent and flexible HTTP framework for Android. With LiteHttp you can make HTTP request with only one line of code! It could convert a java model to the parameter and rander the response JSON as a java model intelligently.

Android network framework: LiteHttp Tags : litehttp2.x-tutorials Website : http://litesuits.com QQgroup : 42960650 , 47357508 Android网络通信为啥子选 lite-htt

马天宇 829 Dec 29, 2022
I was fed up with writing Java classes to mirror json models. So I wrote this Java app to automate the process.

Json2Java I was fed up with writing Java classes to mirror json models. So I wrote this Java app to automate the process. What this tool can do right

Jon F Hancock 303 Oct 8, 2022
A blazing fast, powerful, and very simple ORM android database library that writes database code for you.

README DBFlow is fast, efficient, and feature-rich Kotlin database library built on SQLite for Android. DBFlow utilizes annotation processing to gener

Andrew Grosner 4.9k Dec 30, 2022
greenDAO is a light & fast ORM solution for Android that maps objects to SQLite databases.

Check out ObjectBox Check out our new mobile database ObjectBox (GitHub repo). ObjectBox is a superfast object-oriented database with strong relation

Markus Junginger 12.6k Jan 3, 2023
Android ORM

Shillelagh Shillelagh is an sqlite library. It was built to make life easier. The entire library was built around simplicity when using sqlite in Andr

Andrew Reitz 49 Sep 11, 2020
Compile-time active record ORM for Android

Ollie Compile-time active record ORM for Android. Multiple mapping methods. SQLiteDatabase-like interface (QueryUtils.java). Lightweight query builder

Michael Pardo 423 Dec 30, 2022
a 3d database ORM experiment. (used in two commercial projects)

Android-TriOrm a 3d database ORM experiment for Android. (used in two commercial projects). based around small tables concept and JVM Serialization. H

Tomer Shalev 19 Nov 24, 2021
A blazing fast, powerful, and very simple ORM android database library that writes database code for you.

README DBFlow is fast, efficient, and feature-rich Kotlin database library built on SQLite for Android. DBFlow utilizes annotation processing to gener

Andrew Grosner 4.9k Dec 30, 2022