public static void popScreen() { DesignToolbar designToolbar = Ode.getInstance().getDesignToolbar(); long projectId = Ode.getInstance().getCurrentYoungAndroidProjectId(); String newScreen; if (pushedScreens.isEmpty()) { return; // Nothing to do really } newScreen = pushedScreens.removeFirst(); designToolbar.doSwitchScreen(projectId, newScreen, View.BLOCKS); }
/* * PushScreen -- Static method called by Blockly when the Companion requests * That we switch to a new screen. We keep track of the Screen we were on * and push that onto a stack of Screens which we pop when requested by the * Companion. */ public static boolean pushScreen(String screenName) { DesignToolbar designToolbar = Ode.getInstance().getDesignToolbar(); long projectId = Ode.getInstance().getCurrentYoungAndroidProjectId(); String currentScreen = designToolbar.currentProject.currentScreen; if (!designToolbar.currentProject.screens.containsKey( screenName)) // No such screen -- can happen return false; // because screen is user entered here. pushedScreens.addFirst(currentScreen); designToolbar.doSwitchScreen(projectId, screenName, View.BLOCKS); return true; }
/* * Switch to screen name in project projectId. Also switches projects if * necessary. */ public void switchToScreen(long projectId, String screenName, View view) { doSwitchScreen(projectId, screenName, view); }