GithubHelp home page GithubHelp logo

frantisekgazo / blade Goto Github PK

View Code? Open in Web Editor NEW
267.0 10.0 22.0 1.01 MB

Android library for boilerplate destruction

License: Apache License 2.0

Java 42.21% Groovy 57.67% Shell 0.12%
android-library boilerplate-destruction android annotation-processor

blade's People

Contributors

frantisekgazo avatar guydavis90 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

blade's Issues

NoClassDefFoundError: javax/inject/Inject

Error:Execution failed for task ':app:compileDebugJavaWithJavac'.

java.lang.NoClassDefFoundError: javax/inject/Inject

After including and downloading Blade

buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.0'
classpath 'eu.f3rog.blade:plugin:2.7.0'
}
}

apply plugin: 'com.android.application'
apply plugin: 'blade'

Possible improvement?

Hi, I have a suggestion I would like to propose an adjustment to the library for discussion.
I am using Blade in 2 projects now and I am really happy with how easy to use it is and the great job of boilerplate destruction. :D
My adjustment is to allow for an Arg and a State to be applied to the same variable in a way that the State is applied AFTER the Arg is so it is not overwritten by the Arg bundle stored variable, but instead ends up with the restored state from the State.
I have noticed that this happens the other way around and perhaps there is a way that it can be adjusted to allow for my suggestion?
Perhaps also there is a reason for it being done the way it is that I am unaware of.
I will try and implement it myself but honestly I don't have much idea where to start.
Thanks!

Error for gradle 4.x

When migrating to Gradle 4.x presents the error:

Execution failed for task ':app:transformClassesWithBladeForDebug'.

java.io.FileNotFoundException: C:\A-NG\azure\mntng- android\app\build\intermediates\transforms\Blade\debug\0\androidx\dynamicanimation\R$id.class
(O sistema não pode encontrar o caminho especificado)

How to pass List as Extra?

I want to pass List as Extra (MyType is Serializable). How can I do that?
I can use ArrayList instead of List, but I think that to use concreate implementation is not a good programming practice.

Could you please modify BundleWrapper, so it will support lists of serializable objects?

There is no I.startMyActivity() generated if there is no @Extra annotation in the class.

Some activities don't have extras but I would like to use I.startMyActivity() pattern for all activities in my project.

Please consider adding some way how to mark activities to be included in I class.

I would prefer to introduce @BladeActivity (and @BladeFragment, @BladeService, ...) for this purpose. Such a annotation could give more fine grained control over code generation.

Generate assertions from standard Android annotations

When method parameter is annotated with @NonNull -> generate runtime assertions in code like this:

void foo(@NonNull final String param) {
 /* Code generated by Blade */
 if (param == null) {
  throw new AssertionError("text == null");
 }
 /* ~ */

 // Actual method code here
}

Consider adding support for other Android support annotations e.g.:
@IntRange :

void foo(@IntRange(from=0) final int index) {
 /* Code generated by Blade */
 if (index < 0) {
  throw new AssertionError("index < 0");
 }
 /* ~ */

 // Actual method code here
}

Other possible assertions for: @FloatRange, @Size, @UiThread, @WorkerThread, @RequiresApi

[idea] And what about when method has annotated return value like this:

@NonNull
public String foo() {
 // Actual method code here
 String returnVal = null;

 /* Code modified by Blade */
 if (returnVal == null) {
  throw new AssertionError("return value of method foo is null");
 }
 return returnVal;
 /* ~ */
}

Only Fragment subclass can contain @Arg with AndroidX

i'm getting this

/home/gabriel/projetos/mntng-android/app/build/tmp/kapt3/stubs/debug/br/com/ngi/mnt/ui/main/service/orders/OrdersPageFragment.java:12: error: Only Fragment subclass can contain @Arg.
public final class OrdersPageFragment extends br.com.ngi.mnt.base.BaseFragment implements br.com.ngi.mnt.ui.main.service.orders.contracts.OrdersPageView {

after migrating to AndroidX, i think that is cuz the fragment import changed from
import android.support.v4.app.Fragment
to
import androidx.fragment.app.Fragment

And blade doesn't recognize the new package as a fragment

Support for MVVM

Add support for MVVM. Unlike in MVP, the View holds a reference to the View Model, but the View Model has no information about the View.

Kotlin support

Hi,
I've tried to use this lib within my Kotlin project - to no avail.
Is it / will it be possible to use Blade with Kotlin? (Kotlin uses kapt instead of aapt)

Add method for Bundle creation to blade.F

Currently Blade generates only MyFragment newMyFragment(...) method for a class MyFragment inside the blade.F class.

Add also Bundle forMyFragment(...) method to enable creation of bundles separately.

This is usefull for projects with a generic detail activity that has to save the content fragment' bundle also into the intent for state restoration purposes.

Kotlin primitive is generated as private

i'm doing this:

class MainActivity : BaseActivity() {
    @Extra
    lateinit var userModel: LoginModel

    @Extra
    var cameFromLogin: Boolean = false
}

and i get the error:

error: Field annotated with @Extra cannot be private, protected nor final private boolean cameFromLogin;

i could try to resolve, but i have no idea where the code is generated/parsed

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.