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; }
/** * Indicate that we are no longer connected to the Companion, adjust buttons accordingly. Called * from BlocklyPanel */ public static void indicateDisconnect() { DesignToolbar instance = Ode.getInstance().getDesignToolbar(); instance.updateConnectToDropDownButton(false, false, false); instance.replStarted = false; // This is ugly, I should really define a method to do this // but that would just take space and time... }