Coder Social home page Coder Social logo

fragnums's Introduction

Fragnums

An enum based library to replace fragments, because #perfmatters.

“Frag your app complexity today!” - Zach K.

We all know that Fragments suck, and that #enumsmatter. What if we could replace Fragments with Enums?

What's Fragnums?

Fragnums is the smallest, simplest and most performant Android backstack library:

  • No reflection, unlike Fragments which are recreated through reflection.
  • Each enum value is both a screen and a presenter. This means only one instance of each value is created, ever. No useless garbage collection!
  • Synchronous transitions coz nobody ain't time for Async Fragment Transactions.
  • Handles configuration changes, for all the landscape nut lovers out there.

Show me the code

Creating a new screen is as simple as adding an enum value:

  MY_SCREEN(R.layout.my_screen_layout, R.string.my_screen_title) {
    @Override protected void onBind() {
      View button = findViewById(R.id.button);
      button.setOnClickListener(new View.OnClickListener() {
        @Override public void onClick(View view) {
          // Do something.
        }
      });
    }
  },

Then you can just do goTo(MY_SCREEN).

Getting started

  • Copy the three classes from the example.
  • You're good to go! You can now focus on writing new screens and features, just by adding new enum values.

Why should I use Fragnums?

  • Ultra small footprint: no dependency. In fact, it's not even a library, just three classes to copy.
  • It's really hard to test, so test zealots can't force you to write tests. You can therefore focus on writing more features.
  • All your business logic is in one place, so it's really easy to have a 30,000 feet picture of your code. We suggest you start using a smaller font size in your IDE.

How does it work?

Is this serious?

If someone seriously suggested that app developers stop using enums because #perfmatters, then this would be a serious library.

screenshot1.png

screenshot2.png

screenshot3.png

fragnums's People

Contributors

pyricau avatar

Watchers

Janusz Bagiński avatar James Cloos avatar

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.