• Stars
    star
    578
  • Rank 77,250 (Top 2 %)
  • Language
    Java
  • License
    Apache License 2.0
  • Created about 9 years ago
  • Updated about 9 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

An enum based library to replace fragments.

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 ain't nobody got 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?

No. The core principles are good, but this is a satire library. Read the code and see for yourself.

More details

  • The suggestion that we should stop using enums because #perfmatters is a fallacy. An enum is essentially a class. Every new class makes our binary a bit bigger and our runtime a bit slower. Should we stop using classes? Or should we instead focus on the perf problems that actually matter?
  • This library shows how to implement a very basic backstack. You don't need enums for that, you could have a Screen class instead.
  • It's cool to know that one could make an enum centric app. However just because you can, doesn't mean you should.
  • If you're into trolling at conferences, you can get the #enumsmatter T-Shirt here. I am not affiliated with this T-Shirt campaign.

screenshot1.png

screenshot2.png

screenshot3.png

More Repositories

1

frenchtoast

Stale Android Toasts made tasty.
Java
363
star
2

shipfaster

Dagger + Otto + Retrofit + Robolectric + Picasso + OkHttp
Java
328
star
3

CleanAndroidCode

ALL YOUR LIB ARE BELONG TO US
Java
173
star
4

androidsrc

Find Android sources
Ruby
173
star
5

SharkApp

Kotlin
42
star
6

diy

Kotlin
40
star
7

BuilderGen

Automatically generated builders
Java
31
star
8

pyricau.github.com

p-y.wtf static website
30
star
9

CatchLeaks

Bring your laptops and your investigative skills, we're going on a memory leak hunt!
Kotlin
29
star
10

dagger2-mortar-flow-experiment

Experimental hack to get Dagger 2, Mortar and Flow to work together
Java
26
star
11

FunkyJFunctional

A funky way to use functional programming in Java
Java
21
star
12

simpleperf-cleanup

Kotlin
18
star
13

androidannotations-dagger-example

An example of how to integrate AndroidAnnotations with Dagger. Experimental.
Java
16
star
14

toohardforyou

2H4U, which stands for Too Hard For You, is a mix between a Tetris-like game and a wall breaker.
Java
14
star
15

rockslide

Rockslide generates dynamic presentations
JavaScript
13
star
16

handler-thread-leaks

A simple projects that reproduces HandlerThread leaks
Kotlin
9
star
17

slides-formation-gwt

GWT Webapp based slides for the GWT training
Java
6
star
18

neveridle

Kotlin
5
star
19

TechTrekSummer2014

An app that consumes data from govtrack.us
Java
4
star
20

bisouland

Jeu par navigateur, volez des points d'amour Γ  vos adversaires en leur envoyant des bisous !
PHP
4
star
21

waste-o-meter

Android application to compute the cost of waiting for your computer
Java
3
star
22

express-board-android

Repository for eXpress JobZ, an Android client for two french Job Boards
Java
3
star
23

FormationAndroid

Repo pour les TP de la formation Android
Java
3
star
24

DevoxxBeerCounter

App for AA talk at Devoxx 2012
Java
2
star
25

excilys-teaser-formation-gwt

Mini site pour les inscriptions Γ  la formation GWT
2
star
26

cv-piwai

My online GWT Curriculum Vitae
Java
2
star
27

maven-forplay-archetype

A Maven archetype to quickly get started with ForPlay
Java
2
star
28

leakcanary-shell

An empty shell app to inject LeakCanary into other APKs
2
star
29

forplay-clone-pyricau

Clone to test forplay
Java
2
star
30

greenhouse-androidannotations

Porting greenhouse-android to AndroidAnnotations
Java
1
star
31

chromium-webview-leak

Repo that reproduces a Chromium Webview memory leak
Kotlin
1
star
32

androidannotations-scoping

A fake Android project that demonstrate how scoping would look like if implemented in AndroidAnnotations
Java
1
star
33

french-keyboard-putain

Type French in One Word
Java
1
star
34

fosdem-sms

Java
1
star
35

deRPC-big-payload

Sample demo GWT project to show how deRPC can generate big payloads
1
star
36

Formalys

App liΓ©e Γ  la gestion des formations Excilys
Java
1
star
37

BugAptEclipse

Reproduces a bug in Eclipse + APT
Java
1
star
38

slides-gwt-android-intro

Slides for a GWT & Android presentation at INSA Rouen
Java
1
star
39

speakerz

Java
1
star
40

maven-aa-apt-eclipse

Sample project using AA and annotation processing, trying to set everything right on Eclipse.
Java
1
star