Update Scene
This commit is contained in:
1 parent
e8d1d92bfb
commit
0ce081512d
10 files changed
+141
-44
No files matched your search
@@ -37,10 +37,19 @@ import com.hippo.util.AssertUtils;
|
||||
*/
|
||||
public abstract class Scene {
|
||||
|
||||
static final int SCENE_STATE_CREATE = 0;
|
||||
static final int SCENE_STATE_RUN = 1;
|
||||
static final int SCENE_STATE_DESTROY = 2;
|
||||
static final int SCENE_STATE_OPEN = 3;
|
||||
static final int SCENE_STATE_CLOSE = 4;
|
||||
static final int SCENE_STATE_PAUSE = 5;
|
||||
|
||||
private @Nullable FrameLayout mSceneView;
|
||||
|
||||
private int mBackgroundColor = 0xffeeeeee; // TODO Need a better to set background color
|
||||
|
||||
private int mState = SCENE_STATE_CREATE;
|
||||
|
||||
private static SceneManager sSceneManager;
|
||||
|
||||
static void setSceneManager(SceneManager sceneManager) {
|
||||
@@ -76,6 +85,14 @@ public abstract class Scene {
|
||||
sSceneManager.startScene(sceneClass, announcer, curtain);
|
||||
}
|
||||
|
||||
int getState() {
|
||||
return mState;
|
||||
}
|
||||
|
||||
void setState(int state) {
|
||||
mState = state;
|
||||
}
|
||||
|
||||
public final void finish() {
|
||||
sSceneManager.finishScene(this);
|
||||
}
|
||||
@@ -131,8 +148,6 @@ public abstract class Scene {
|
||||
return mBackgroundColor;
|
||||
}
|
||||
|
||||
|
||||
|
||||
protected void setContentView(int resId) {
|
||||
AssertUtils.assertNull("Only call setContentView once", mSceneView);
|
||||
|
||||
@@ -240,6 +255,7 @@ public abstract class Scene {
|
||||
}
|
||||
|
||||
public void onBackPressed() {
|
||||
// TODO First click to show finish animation, click again to finish the animation at once and it is finished
|
||||
finish();
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user