mdsami / android-query

Automatically exported from code.google.com/p/android-query
0 stars 0 forks source link

Is it possible add support for plurals-string-resources #83

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
usage:

aq.id(R.id.my_text_view).quantityText(R.plurals.number_of_files, count)
aq.id(R.id.my_text_view).quantityText(R.plurals.number_of_files, count,
   other args...);

Should be implemented in AbstractAQuery.java as:

public T quantityText(int resID, int quantity) {
    if(view instanceof TextView){                   
        TextView tv = (TextView) view;
        tv.setText(getResources().getQuantityString(resId, quantity));
    }
    return self();
}

public T quantityText(int resId, int quantity) {
    if(view instanceof TextView){                   
        TextView tv = (TextView) view;
        Resources res = context.getResources();
        tv.setText(res.getQuantityString(resId, quantity));
    }
    return self();
}

public T quantityText(int resId, int quantity, Object... formatArgs) {
    if(view instanceof TextView){                   
        TextView tv = (TextView) view;
        Resources res = context.getResources();
        tv.setText(res.getQuantityString(resId, quantity, formatArgs));
    }
    return self();
}

Original issue reported on code.google.com by tomas.zemres on 9 Sep 2012 at 9:19