Git Product home page Git Product logo

droidparts's Introduction

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.

droidparts's People

Contributors

aleksanb avatar cwc avatar drudge avatar emartynov avatar intrications avatar kennethkr avatar makovkastar avatar plzen avatar vovan888 avatar yanchenko avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

droidparts's Issues

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)

MultiSelectListPreference missing @Override setEntryValues

Hi Alex,

I added to your Source MultiSelectListPreference.java the method:

@Override
public void setEntryValues(CharSequence[] entryValues) {
    super.setEntryValues(entryValues);
    updateCheckedEntryIndexes();
}

Otherwise there is a problem in case sombody tries to reload the underlying List dynamically with more entryValues/entries.

If I load the new (bigger) list in the order

        mlp.setEntries(entries);
        mlp.setEntryValues(entryValues);

it works fine.

But if I load the list by calling

        mlp.setEntryValues(entryValues);
        mlp.setEntries(entries);

I run in an OutOfBoundException in the method 'getCheckedEntries()' because
the the variable this.checkedEntryIndexes is not consistent set to the new size.

With the correction mentioned above the classs variables are consisten.

Thanks for sharing your code.

Greetings Franz

requestLayout()

в android 4.3 поле становится недоступным из-за warning : requestLayout() improperly called by .....ClearableEditText{41e755c0 VFED..CL .F...... 0,0-504,80 #7f050066 app:id/editProfession} during second layout pass: posting in next frame.
Проблема в методе setClearIconVisible(boolean visible) - setCompoundDrawables(getCompoundDrawables()[0],
getCompoundDrawables()[1], x, getCompoundDrawables()[3]);

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.

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;

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.

RestClient redirect 301, 302

I was fighting against this issue for a long and finally I was able to solve it modifiying RestClient.java. For sure should be a better way to do it, but I will let you know just in case you need it.

public HTTPResponse get(String uri) throws HTTPException {
HTTPResponse res = get(uri, -1, null, true);
if (res.code == 301 || res.code == 302) {
if (res.headers.get("Location") != null
&& res.headers.get("Location").size() > 0) {
return get(res.headers.get("Location").get(0));
}
}

    return res;
}

public HTTPResponse getInputStream(String uri) throws HTTPException {
    HTTPResponse res = get(uri, -1, null, false);
    if (res.code == 301 || res.code == 302) {

        if (res.headers.get("Location") != null
                && res.headers.get("Location").size() > 0) {
            return getInputStream(res.headers.get("Location").get(0));
        }

    }

    return res;
}

Не удается запустить под 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 дня так и не удалось ни черта собрать на последней бесплатной идее

How to send file with RestClient?

В своем приложении мне нужно отсылать изображение на сервер. Я не нашел в RestClient'е такой возможности, только отправка строки.

APK for Sample

Any chance we could see this in action, either as a video, or preferably as an APK of the sample app?

Great work by the way - I'm very keep to see this project thrive! Sounds like it could make my life as an Android developer a lot easier.

Runtime Exception

Unable to instantiate application org.droidparts.gram.Application: java.lang.ClassNotFoundException: Didn't find class "org.droidparts.gram.Application" on path: /data/app/org.droidparts.gram-1.apk

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..

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[]?

Event second parameter can be typed?

Hi!

Can I use typed parameter instead of Object? example:

@ReceiveEvents
private void onAnyEvent(String eventName, ConreteType eventData) {
   // TODO process any event with optional data
}

On click Clear darwable action

Возможно ли выполнить определенные действия после нажатия иконки очистки элемента?

[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:

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.

postEventSticky bug

public static void postEventSticky(String name) {
postEventSticky(name, null);
}

but

@throws NullPointerException if the specified key or value is null

for ConcurrentHashMap

in

public static void postEventSticky(String name, Object data) {
stickyEvents.put(name, data);
postEvent(name, data);

}

possible solution:
public static void postEventSticky(String name) {
postEventSticky(name, "");
}

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.

ClearableEditText X styling

Hi,

Thanks for this library it's very much appreciated. Sorry for creating a github issue for this but it seems the easiest way to reach you.

I'd like use the ClearableEditText and make the X look like to does on your web page( http://droidparts.org/widgets.html#clearableedittext). Currently the X is small and in a a grey circle. I'd like it to just be the X nice and clean. How do you style it?

Thanks!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.