@Override public void layoutSubviews() { super.layoutSubviews(); CGRect bounds = getBounds(); CGRect frame = name.getFrame(); frame.setWidth(bounds.getWidth() - (PRICE_WIDTH + PADDING * 2)); frame.setX(PADDING); frame.setY(PADDING); name.setFrame(frame); frame = price.getFrame(); frame.setY(PADDING + (name.getFrame().getHeight() - frame.getHeight()) / 2); frame.setX(name.getFrame().getX() + name.getFrame().getWidth() + PADDING); frame.setWidth(PRICE_WIDTH); price.setFrame(frame); frame = bounds; frame.setY(name.getFrame().getY() + name.getFrame().getHeight()); frame.setX(PADDING); frame.setWidth(frame.getWidth() - PADDING * 2); frame.setHeight(frame.getHeight() - frame.getY()); descriptionLabel.setFrame(frame); }
/** * Modifies keyboards size to fit screen * * @param showKeyboard * @param notificationInfo */ private void adjustViewForKeyboardReveal( boolean showKeyboard, NSDictionary<NSString, ?> notificationInfo) { // notificationInfo:(NSDictionary // *)notificationInfo // the keyboard is showing so resize the table's height CGRect keyboardRect = NSValueExtensions.getRectValue( (NSValue) notificationInfo.get(UIKit.KeyboardFrameEndUserInfoKey())); double animationDuration = ((NSNumber) notificationInfo.get(UIKit.KeyboardAnimationDurationUserInfoKey())) .doubleValue(); CGRect frame = this.textView.getFrame(); // the keyboard rect's width and height are reversed in landscape double adjustDelta = isPortrait(this.getInterfaceOrientation()) ? keyboardRect.getHeight() : keyboardRect.getWidth(); if (showKeyboard) { frame.size().height(frame.size().height() - adjustDelta); } else { frame.size().height(frame.size().height() + adjustDelta); } UIView.beginAnimations("ResizeForKeyboard", null); UIView.setDurationForAnimation(animationDuration); this.textView.setFrame(frame); UIView.commitAnimations(); }
@Override public void viewDidLayoutSubviews() { super.viewDidLayoutSubviews(); CGRect bounds = getView().getBounds(); bounds.setY(bounds.getY() + bounds.getHeight() - BottomButtonView.HEIGHT); bounds.setHeight(BottomButtonView.HEIGHT); bottomView.setFrame(bounds); }