All Projects → savepopulation → piri

savepopulation / piri

Licence: other
Piri is a lightweight annotation processing library that generates static factory methods for your Activities and Fragments.

Programming Languages

java
68154 projects - #9 most used programming language

Projects that are alternatives of or similar to piri

MethodScope
Reduce repetitive inheritance works in OOP world using @MethodScope.
Stars: ✭ 33 (-37.74%)
Mutual labels:  annotation-processor, annotation-processing
RapidORM
Quick solutions for Android ORM
Stars: ✭ 24 (-54.72%)
Mutual labels:  annotation-processor, annotation-processing
generate-kotlin-multiple-rounds
Android sample project demonstrating how to generate Kotlin code through annotation processing, and then feeding it into a second round of annotation processing.
Stars: ✭ 25 (-52.83%)
Mutual labels:  annotation-processor, annotation-processing
simple-annotation-processor
Simple annotation processor example. Inspired by the idea of "How ButterKnife works?"
Stars: ✭ 54 (+1.89%)
Mutual labels:  annotation-processor, annotation-processing
Kotlin-Annotation-Processor
Annotation Processor Sample in Kotlin
Stars: ✭ 19 (-64.15%)
Mutual labels:  annotation-processor, annotation-processing
Placeholderview
This library provides advance views for lists and stacks. Some of the views are build on top of RecyclerView and others are written in their own. Annotations are compiled by annotation processor to generate bind classes. DOCS -->
Stars: ✭ 2,104 (+3869.81%)
Mutual labels:  annotation-processor, annotation-processing
dagger2-ktx
Kotlin extension bridge library for Dagger2 (proof-of-concept)
Stars: ✭ 41 (-22.64%)
Mutual labels:  annotation-processor, annotation-processing
AnnotationProcessorStarter
Project to set up basics of a Java annotation processor
Stars: ✭ 19 (-64.15%)
Mutual labels:  annotation-processor, annotation-processing
AnnotationProcessing
✔️ㅤ[ARTICLE] Writing your own Annotation Processors in Android
Stars: ✭ 47 (-11.32%)
Mutual labels:  annotation-processor, annotation-processing
symbok-bundle
Symfony annotations bundle
Stars: ✭ 50 (-5.66%)
Mutual labels:  annotation-processing
simple-preferences
Android Library to simplify SharedPreferences use with code generation.
Stars: ✭ 48 (-9.43%)
Mutual labels:  annotation-processor
green-annotations
An Android Annotations plugin to support Green Robot.
Stars: ✭ 21 (-60.38%)
Mutual labels:  annotation-processor
copydynamic
Prototype of generating `copyDynamic` extension functions for kotlin data classes
Stars: ✭ 57 (+7.55%)
Mutual labels:  annotation-processing
avaje-inject
Dependency injection via APT (source code generation) ala "Server side Dagger DI"
Stars: ✭ 114 (+115.09%)
Mutual labels:  annotation-processing
extclassgenerator
Ext JS code generator. Creating model js classes from java classes
Stars: ✭ 14 (-73.58%)
Mutual labels:  annotation-processor
NavigationComponentPlayground
Sample app leveraging Android Navigation Component
Stars: ✭ 60 (+13.21%)
Mutual labels:  android-navigation
domino-jackson
Jackson with Annotation processing
Stars: ✭ 46 (-13.21%)
Mutual labels:  annotation-processing
COCO-Assistant
Helper for dealing with MS-COCO annotations
Stars: ✭ 83 (+56.6%)
Mutual labels:  annotation-processor
Spork
Annotation processing and dependency injection for Java/Android
Stars: ✭ 77 (+45.28%)
Mutual labels:  annotation-processing
shade
Automatic code generation for the SharedPreferences operation.
Stars: ✭ 26 (-50.94%)
Mutual labels:  annotation-processing

piri

Piri is a lightweight annotation processing library that generates static factory methods for your Activities and Fragments.

How to use?

Add PiriActivity annotation to your Activity.

@PiriActivity
public class YourActivity extends AppCompatActivity {
...
}

And start YourActivity from another Activity.

public class MainActivity extends AppCompatActivity {
...
 navButton.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                final Intent intent = PiriIntentFactory.newIntentForYourActivity(MainActivity.this);
                startActivity(intent);
            }
        });
...
}

If you want to pass data to YourActivity with Piri add PiriParam annotation to your fields in your Activity and receive data from bundle.

@PiriActivity
public class YourActivity extends AppCompatActivity {
    
    @PiriParam(key = "extra_id")
    private Long id;

    @PiriParam(key = "extra_name")
    private String name;
    
    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_your);

        final Bundle bundle = getIntent().getExtras();
        if (bundle != null) {
            id = bundle.getLong("extra_id");
            name = bundle.getString("extra_name");
        }

        // INIT UI
        ...
    }
}

And start YourActivity like the following:

public class MainActivity extends AppCompatActivity {
...

 final Long id = 1234567890L;
 final String name = "PiriExample";
 navButton.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                final Intent intent = PiriIntentFactory.newIntentForYourActivity(MainActivity.this,id,name);
                startActivity(intent);
            }
        });
...
}

Now you can generate your fragment instances with Piri.

Add PiriFragment annotation to your Fragments.

@PiriFragment
public class SampleFragment extends Fragment{
    
    private static final String EXTRA_ID = "extra_id";
    private static final String EXTRA_USER = "extra_user";
    private static final String EXTRA_BOOK = "extra_book";

    @PiriParam(key = EXTRA_ID)
    private Long id;

    @PiriParam(key = EXTRA_USER)
    private User user;

    @PiriParam(key = EXTRA_BOOK)
    private Book book;

    @Override
    public void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        final Bundle args = getArguments();
        if (args != null) {
            id = args.getLong(EXTRA_ID, 0);
            user = args.getParcelable(EXTRA_USER);
            book = (Book) args.getSerializable(EXTRA_BOOK);
        }
    }
}

Where Piri comes from?

https://en.wikipedia.org/wiki/P%C3%AEr%C3%AE_Reis

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].