Back to project page AdoreLib.
The source code is released under:
MIT License
If you think the Android project AdoreLib listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package com.ylinval.adore.adorelib.Libs.State; /*from w w w .j av a 2 s.c om*/ import android.graphics.Canvas; import android.support.v4.app.Fragment; import android.view.MotionEvent; /** * Created by jdourlens on 5/10/14. */ public class StateManager { public static State state = null; public static int nbState = 0; public static boolean loaded = false; public static void goTo(Fragment f, State s) { loaded = false; if (state != null) { state.onQuit(); } nbState++; state = s; state.onLoad(f); loaded = true; } public static void quitCurrent() { if (state != null) { state.onQuit(); } state = null; } public static int getNbState() { return (nbState); } public static State getCurrent() { return (state); } public static void update(int dt) { if (state != null && loaded) state.update(dt); } public static void onScroll(MotionEvent e1, MotionEvent e2, float distanceX, float distanceY) { if (state != null && loaded) state.onScroll(e1, e2, distanceX, distanceY); } public static void onTap(MotionEvent e, float x, float y) { if (state != null && loaded) state.onTap(e, x, y); } public static void draw(Canvas c) { if (state != null && loaded) state.draw(c); } }