gurleensethi / LiteUtilities

Speed up your android development by removing boilerplate code
MIT License
397 stars 38 forks source link

LiteUtilities for Java #1

Closed therealshabi closed 7 years ago

therealshabi commented 7 years ago

Can this be used for Java files too? or if not can you please make these APIs for Java as well?

gurleensethi commented 7 years ago

This library can be used for Java projects as well, the signatures of API's will change though.

For example if you want to make a short toast, you will first have to refer to the file name and then call the function.

ToastUtilsKt.shortToast(this, "Hello");

Similarly, for making a recycler adapter.

List<String> list = new ArrayList<>();
        RecyclerAdapterUtil<String> adapter = new RecyclerAdapterUtil(this, list, R.layout.item_recycler_view);
        adapter.addOnDataBindListener(new Function3<View, String, Integer, Unit>() {
            @Override
            public Unit invoke(View view, String s, Integer integer) {
                TextView textView = (TextView) view.findViewById(R.id.textView);
                textView.setText(s);
                return null;
            }
        });