public ProgressBarView(CGRect frame) { super(frame); setOpaque(false); setBackgroundColor(UIColor.clear()); }
private void setupLabels(ProgressDialog.Builder builder) { title = new UILabel(getBounds()); title.setAdjustsFontSizeToFitWidth(false); title.setTextAlignment(NSTextAlignment.Center); title.setOpaque(false); title.setBackgroundColor(UIColor.clear()); title.setTextColor(UIColor.white()); title.setFont(UIFont.getBoldSystemFont(16)); title.setText(builder.title); addSubview(title); message = new UILabel(getBounds()); message.setAdjustsFontSizeToFitWidth(false); message.setTextAlignment(NSTextAlignment.Center); message.setOpaque(false); message.setBackgroundColor(UIColor.clear()); message.setTextColor(UIColor.white()); message.setNumberOfLines(0); message.setFont(UIFont.getBoldSystemFont(12)); message.setText(builder.message); addSubview(message); }
IOSProgressDialog(ProgressDialog.Builder builder) { super(UIScreen.getMainScreen().getBounds()); this.style = builder.style; setupLabels(builder); setupIndicators(); alertWindow = new UIWindow(UIScreen.getMainScreen().getBounds()); alertWindow.setRootViewController(new UIViewController()); alertWindow.setWindowLevel(UIWindowLevel.Alert + 1); setContentMode(UIViewContentMode.Center); setAutoresizingMask( UIViewAutoresizing.with(UIViewAutoresizing.FlexibleTopMargin, UIViewAutoresizing.FlexibleBottomMargin, UIViewAutoresizing.FlexibleLeftMargin, UIViewAutoresizing.FlexibleRightMargin)); // Transparent background setOpaque(false); setBackgroundColor(UIColor.clear()); setAlpha(0); }
private void setupIndicators() { switch (style) { case Indeterminate: indicator = new UIActivityIndicatorView(UIActivityIndicatorViewStyle.WhiteLarge); ((UIActivityIndicatorView) indicator).startAnimating(); addSubview(indicator); break; case Determinate: indicator = new ProgressBarView(); addSubview(indicator); break; case Text: indicator = new UILabel(new CGRect(0, 0, 120, 20)); ((UILabel) indicator).setAdjustsFontSizeToFitWidth(false); ((UILabel) indicator).setTextAlignment(NSTextAlignment.Center); indicator.setOpaque(false); indicator.setBackgroundColor(UIColor.clear()); ((UILabel) indicator).setTextColor(UIColor.white()); ((UILabel) indicator).setNumberOfLines(0); ((UILabel) indicator).setFont(UIFont.getBoldSystemFont(20)); ((UILabel) indicator).setText("0%"); addSubview(indicator); break; default: break; } }