final UIInterfaceOrientation statusBarOrientation = uiApp.getStatusBarOrientation(); double statusBarHeight = Math.min(statusBarFrame.getWidth(), statusBarFrame.getHeight()); double screenWidth = screenBounds.getWidth(); double screenHeight = screenBounds.getHeight(); return lastScreenBounds = new CGRect(0.0, statusBarHeight, screenWidth, screenHeight);
@WeaklyLinked public CGRect inset(UIEdgeInsets insets) { getOrigin().setX(getOrigin().getX() + insets.getLeft()); getOrigin().setY(getOrigin().getY() + insets.getTop()); getSize().setWidth(getSize().getWidth() - (insets.getLeft() + insets.getRight())); getSize().setHeight(getSize().getHeight() - (insets.getTop() + insets.getBottom())); return this; }
public static CGRect fromDictionary(NSDictionary<NSString, NSNumber> dict) { CGRect r = new CGRect(); if (!fromDictionary(dict, r)) { throw new IllegalArgumentException("Failed to create CGRect from dictionary " + dict); } return r; }
@Override public void viewDidLayoutSubviews () { super.viewDidLayoutSubviews(); // get the view size and update graphics CGRect bounds = app.getBounds(); graphics.width = (int)bounds.getWidth(); graphics.height = (int)bounds.getHeight(); graphics.makeCurrent(); if (graphics.created) { app.listener.resize(graphics.width, graphics.height); } }
CGGradient gradient = new CGGradient(colorSpace, new double[] { 0, 1 }, new double[] { 0, 0, 0, 0, 0, 0, 0, 0.75 }); CGPoint gradCenter = new CGPoint(getBounds().getWidth() / 2, getBounds().getHeight() / 2); double gradRadius = Math.min(getBounds().getWidth(), getBounds().getHeight()); CGRect boxRect = new CGRect(Math.round((allRect.getSize().getWidth() - size.getWidth()) / 2), Math.round((allRect.getSize().getHeight() - size.getHeight()) / 2), size.getWidth(), size.getHeight()); context.moveToPoint(boxRect.getMinX() + radius, boxRect.getMinY()); context.addArc(boxRect.getMaxX() - radius, boxRect.getMinY() + radius, radius, 3 * Math.PI / 2, 0, false); context.addArc(boxRect.getMaxX() - radius, boxRect.getMaxY() - radius, radius, 0, Math.PI / 2, false); context.addArc(boxRect.getMinX() + radius, boxRect.getMaxY() - radius, radius, Math.PI / 2, Math.PI, false); context.addArc(boxRect.getMinX() + radius, boxRect.getMinY() + radius, radius, Math.PI, 3 * Math.PI / 2, false); context.closePath(); context.fillPath();
private void createDefaultTextField () { textfield = new UITextField(new CGRect(10, 10, 100, 50)); //Parameters // Setting parameters textfield.setKeyboardType(UIKeyboardType.Default); textfield.setReturnKeyType(UIReturnKeyType.Done); textfield.setAutocapitalizationType(UITextAutocapitalizationType.None); textfield.setAutocorrectionType(UITextAutocorrectionType.No); textfield.setSpellCheckingType(UITextSpellCheckingType.No); textfield.setHidden(true); // Text field needs to have at least one symbol - so we can use backspace textfield.setText("x"); app.getUIViewController().getView().addSubview(textfield); }
private static Rectangle computeBounds(CTFont font, CGRect bounds) { // the y coordinate of bounds is a little tricky: iOS reports y as the number of pixels to // below the baseline that the text extends (the descent, but precisely for this text, not the // font's "maximum" descent) and the value is negative (due to the inverted coordinate system); // so we have to do some math to recover the desired y value which is the number of pixels // below the top-left of the line bounding box float ascent = (float)font.getAscent(); return new Rectangle((float)bounds.getMinX(), ascent - (float)(bounds.getHeight() + bounds.getMinY()), (float)bounds.getWidth(), (float)bounds.getHeight()); } }
double maxWidth = bounds.getSize().getWidth() - 4 * margin; CGSize totalSize = new CGSize(); indicatorF.getSize().setWidth(Math.min(indicatorF.getSize().getWidth(), maxWidth)); totalSize.setWidth(Math.max(totalSize.getWidth(), indicatorF.getSize().getWidth())); totalSize.setHeight(totalSize.getHeight() + indicatorF.getSize().getHeight()); if (titleLabelSize.getHandle() > 0 && indicatorF.getSize().getHeight() > 0) { totalSize.setHeight(totalSize.getHeight() + padding); double remainingHeight = bounds.getSize().getHeight() - totalSize.getHeight() - padding - 4 * margin; CGSize messageLabelSize = messageText.length() > 0 ? NSString.getBoundingRect(messageText, maxSize, NSStringDrawingOptions.UsesLineFragmentOrigin, new NSAttributedStringAttributes().setFont(message.getFont()), null).getSize() : new CGSize(); && (indicatorF.getSize().getHeight() > 0 || titleLabelSize.getHeight() > 0)) { totalSize.setHeight(totalSize.getHeight() + padding); double yPos = Math.round(((bounds.getSize().getHeight() - totalSize.getHeight()) / 2) + margin); double xPos = 0; indicatorF.setY(yPos); indicatorF.setX(Math.round((bounds.getSize().getWidth() - indicatorF.getSize().getWidth()) / 2) + xPos); yPos += indicatorF.getSize().getHeight(); if (titleLabelSize.getHeight() > 0 && indicatorF.getSize().getHeight() > 0) {
w=(float) getFrame().getWidth(); h= (float) getFrame().getHeight(); float fx=nativeTextField.getX(); float fy=nativeTextField.getY(); float my=(cutHeight+fy)*bly; y= (float) (screenSize.getHeight()-h)-my; cgRect.setWidth(w); cgRect.setHeight(h); cgRect.setX(x); cgRect.setY(y); setFrame(cgRect); }else setHidden(true);
CGRect keyboardRect =aValue.rectValue(); CGRect frame = getFrame(); double keyboardHeight=screenSize.getHeight()-keyboardRect.getHeight(); final Stage stage = nativeTextField.getStage(); float fullHeight = stage instanceof VStage ? ((VStage) stage).getFullHeight() : stage.getHeight(); bly= (float) (1f/screenSize.getHeight() * fullHeight); libgdxKeyboardHeight = (float) (keyboardRect.getHeight() *bly); }else{ return; if(frame.getY()+frame.getHeight()> keyboardHeight) { switch (nativeTextField.getAdaptKeyboardType()){ case Self: frame.setY(keyboardHeight-frame.getHeight()); setFrame(frame); break;
/** * @since Available in iOS 2.0 and later. */ @Bridge(symbol="CGRectGetWidth", optional=true) private static native @MachineSizedFloat double getWidth(@ByVal CGRect rect); /**
/** * @since Available in iOS 2.0 and later. */ @Bridge(symbol="CGRectGetHeight", optional=true) private static native @MachineSizedFloat double getHeight(@ByVal CGRect rect); /**
if(textFieldHashMap==null){ textFieldHashMap=new HashMap<>(); screenSize=UIScreen.getMainScreen().getBounds().getSize(); w=nativeTextField.getWidth()*blx; h=nativeTextField.getHeight()*bly; x= (float) textfield.getFrame().getX(); y= (float) textfield.getFrame().getY(); cgRect.setWidth(w); cgRect.setHeight(h); cgRect.setX(x); cgRect.setY(y); textfield.setFrame(cgRect); }else {
/** * @since Available in iOS 2.0 and later. */ @Bridge(symbol="CGRectGetMinX", optional=true) private static native @MachineSizedFloat double getMinX(@ByVal CGRect rect); /**
/** * @since Available in iOS 2.0 and later. */ @Bridge(symbol="CGRectGetMinY", optional=true) private static native @MachineSizedFloat double getMinY(@ByVal CGRect rect); /**
public CGRect setHeight(double h) { this.getSize().setHeight(h); return this; } }
/** * @since Available in iOS 2.0 and later. */ @Bridge(symbol="CGRectGetMaxX", optional=true) private static native @MachineSizedFloat double getMaxX(@ByVal CGRect rect); /**
/** * @since Available in iOS 2.0 and later. */ @Bridge(symbol="CGRectGetMaxY", optional=true) private static native @MachineSizedFloat double getMaxY(@ByVal CGRect rect); /**