public void initActivity(Activity.Panel actPanel) { this.actPanel = actPanel; if (formKeyboard.isVisible()) { formKeyboard.setVisible(false); } activityWithKeyboard = false; activityType = actPanel.getActivity().getShortClassName(); // Clear data // WARNING: Avoid the use of fixed-length arrays! for (int i = 0; i < MAX_SCANNING_ZONES; i++) { zonePoints[i] = -1; for (int n = 0; n < MAX_POINTS_PER_ZONE; n++) { px[i][n] = 0; py[i][n] = 0; sll[i][n] = ""; } } currentZone = 0; // Start scanning only buttons place = 0; oldActPanelRectangle.setBounds(0, 0, 0, 0); activityFinished = false; activityWithKeyboard = actPanel.getActivity().needsKeyboard(); if (formKeyboard != null && activityWithKeyboard && showKeyboard && isScanning) { formKeyboard.isHorizontalScanning = false; formKeyboard.xPos = 0; formKeyboard.yPos = -1; formKeyboard.setVisible(true); formKeyboard.calcFrameSize(); numberOfZones = 1; clickNumber = 1; currentZone = 1; } actPanel.calcScanPoints(); if (autoAutoScan) { if (autoScanActivationTimer == null) { enableAutoScanTimer(); } } else if (weAreAtTheStart) { if (autoScanOnStart) { enableAutoScan(); } else if (directedScanOnStart) { enableDirectedScan(); } } weAreAtTheStart = false; if (isAutoScanning) { startScanTimer(); } }
/** * **************************************************************************************************** */ public void startScanning() { if (actPanel != null) { zonePoints[0] = -1; zonePoints[1] = -1; zonePoints[2] = -1; if (withChangeZoneButton && formExchange != null) { formExchange.setVisible(true); } place = 0; isFirstScreen = true; isScanning = true; isAutoScanning = false; isDirectedScanning = false; actPanel.calcScanPoints(); // WARNING: isScanning was just initialized, so it always will be "true": if (formKeyboard != null && activityWithKeyboard && showKeyboard && isScanning) { formKeyboard.isHorizontalScanning = false; formKeyboard.xPos = 0; formKeyboard.yPos = -1; formKeyboard.setVisible(true); formKeyboard.calcFrameSize(); numberOfZones = 1; clickNumber = 1; currentZone = 1; } } }
public void stopScanning() { isScanning = false; isAutoScanning = false; isDirectedScanning = false; if (formExchange != null) { formExchange.setVisible(false); } if (formKeyboard != null) { formKeyboard.setVisible(false); } }
/** * **************************************************************************************************** */ public void clickLeftButton() { // System.out.println("Clic Botó esquerra. Zona: "+String.valueOf(Zona)); if (withChangeZoneButton) { // System.out.println("Clic Botó esquerra. Zona: "+String.valueOf(Zona)+" - // "+String.valueOf(Lloc)+" - "+String.valueOf(NumeroPuntsZona[Zona])); if (activityWithKeyboard && showKeyboard && isScanning) { if (currentZone == 0) { formKeyboard.isHorizontalScanning = false; formKeyboard.xPos = 0; formKeyboard.yPos = -1; formKeyboard.setVisible(true); formKeyboard.calcFrameSize(); numberOfZones = 1; clickNumber = 1; currentZone = 1; } formExchange.changeBgColor(currentZone); return; } if (changeZoneIfNoClick && (activityType.equals("@associations.SimpleAssociation") || activityType.equals("@associations.ComplexAssociation"))) { if (currentZone == 0 || currentZone == 2) { if (place > zonePoints[currentZone]) { if (currentZone == 0 && numberOfZones > 0) { currentZone = 1; place = 0; } else if (currentZone == 2) { currentZone = 0; place = 0; } // System.out.println("Clic Botó esquerra. Zona: "+String.valueOf(Zona)+" - // "+String.valueOf(Lloc)); formExchange.changeBgColor(currentZone); return; } } } else { if (currentZone == 0 || currentZone == 1) { if (place > zonePoints[currentZone]) { if (currentZone == 0 && numberOfZones > 0) { currentZone = 1; place = 0; } else if (currentZone == 1) { currentZone = 0; place = 0; } // System.out.println("Clic Botó esquerra. Zona: "+String.valueOf(Zona)+" - // "+String.valueOf(Lloc)); formExchange.changeBgColor(currentZone); return; } } } } if (numberOfZones == 1) { if (currentZone == 1) { if (!activityType.equals("@panels.InformationScreen") && !activityType.equals("@panels.Explore") && !activityType.equals("@panels.Identify") && !activityType.equals("@textGrid.WordSearch")) { place = 0; } /* NumeroClic++; if (NumeroClic==3) NumeroClic=1; */ } } else if (numberOfZones == 2) { if (currentZone == 1) { currentZone = 2; place = 0; } else if (currentZone == 2) { currentZone = 1; place = 0; } } /* if (currentZone>0) { ActivitatFinalitzada=actPanel.solved; if(ActivitatFinalitzada) System.out.println("Activitat Finalitzada"); } */ // if (OpcionsSaltarBenColocat) CalculateInactivePoints(); }