Example #1
0
 public MenuController addNavigation(String title, String storyboardId) {
   alert.addAction(
       new UIAlertAction(
           title,
           UIAlertActionStyle.Default,
           s ->
               parent
                   .getNavigationController()
                   .pushViewController(
                       parent.getStoryboard().instantiateViewController(storyboardId), true)));
   return this;
 }
  @Override
  public void viewDidLoad() {
    super.viewDidLoad();

    this.setTitle("");
    this.setupTextView();
  }
  @Override
  public void viewDidDisappear(boolean animated) {
    super.viewDidDisappear(animated);

    NSNotificationCenter.getDefaultCenter().removeObserver(UIKit.KeyboardWillShowNotification());
    NSNotificationCenter.getDefaultCenter().removeObserver(UIKit.KeyboardWillHideNotification());
  }
 @Override
 public void viewWillAppear(boolean animated) {
   super.viewWillAppear(animated);
   Selector willShow = Selector.register("keyboardWillShow:");
   Selector willHide = Selector.register("keyboardWillHide:");
   NSNotificationCenter center = NSNotificationCenter.getDefaultCenter();
   center.addObserver(this, willShow, UIKit.KeyboardWillShowNotification(), null);
   center.addObserver(this, willHide, UIKit.KeyboardWillHideNotification(), null);
 }
  @Override
  public void didFinishLaunching(UIApplication application) {
    window = new UIWindow(UIScreen.getMainScreen().getBounds());
    window.makeKeyAndVisible();

    UIViewController viewController = new UIViewController();

    UIButton boton = new UIButton(new CGRect(10, 10, 200, 30));
    boton.setBackgroundColor(new UIColor(1, 0, 0, 0.5f));
    boton.setTitle("Send Mail", UIControlState.Normal);
    boton.addOnTouchUpInsideListener(
        new OnTouchUpInsideListener() {
          @Override
          public void onTouchUpInside(UIControl control, UIEvent event) {
            sendMail();
          }
        });
    viewController.setView(boton);

    window.setRootViewController(viewController);
  }
  @Override
  public void viewDidLoad() {
    super.viewDidLoad();

    modelController = new ModelController();

    // Do any additional setup after loading the view, typically from a nib.
    // Configure the page view controller and add it as a child view
    // controller.
    pageViewController =
        new UIPageViewController(
            UIPageViewControllerTransitionStyle.PageCurl,
            UIPageViewControllerNavigationOrientation.Horizontal,
            null);
    pageViewController.setDelegate(this);

    modelController.setPageData(photosToShow);

    UIStoryboard storyboard = new UIStoryboard("Main", null);
    DataViewController startingViewController =
        modelController.getViewControllerAtIndex(0, storyboard);

    NSArray<UIViewController> viewControllers =
        new NSArray<UIViewController>(startingViewController);
    pageViewController.setViewControllers(
        viewControllers, UIPageViewControllerNavigationDirection.Forward, false, null);

    updateNavBarTitle();

    pageViewController.setDataSource(modelController);

    addChildViewController(pageViewController);
    getView().addSubview(pageViewController.getView());
    pageViewController.didMoveToParentViewController(this);

    // add the page view controller's gesture recognizers to the book view
    // controller's view
    // so that the gestures are started more easily
    getView().setGestureRecognizers(pageViewController.getGestureRecognizers());

    pageAnimationFinished = true;
  }
  @Override
  public void viewDidLoad() {
    super.viewDidLoad();

    // set the badge value in our test field and tabbar item
    String badgeValue = NSUserDefaults.getStandardUserDefaults().getString(BADGE_VALUE_PREF_KEY);

    doneButton =
        new UIBarButtonItem(
            UIBarButtonSystemItem.Done,
            new UIBarButtonItem.OnClickListener() {
              @Override
              public void onClick(UIBarButtonItem barButtonItem) {
                // dismiss the keyboard by resigning our badge edit field as
                // first responder
                badgeField.resignFirstResponder();

                // set the badge value to our tab item (but only if a valid
                // string)
                if (badgeField.getText() != null && badgeField.getText().length() > 0) {
                  // a value was entered,
                  // because we are inside a navigation controller,
                  // we must access its tabBarItem to set the badgeValue
                  getNavigationController().getTabBarItem().setBadgeValue(badgeField.getText());
                } else {
                  // no value was entered
                  getNavigationController().getTabBarItem().setBadgeValue(null);
                }

                NSUserDefaults.getStandardUserDefaults()
                    .put(BADGE_VALUE_PREF_KEY, badgeField.getText());
              }
            });

    if (badgeValue != null && badgeValue.length() > 0) {
      badgeField.setText(badgeValue);
      getNavigationController().getTabBarItem().setBadgeValue(badgeField.getText());
    }
  }
  @Override
  public void viewDidLoad() {
    super.viewDidLoad();

    // Set a list of colors that correspond to the selected page.
    colors =
        new UIColor[] {
          UIColor.black(),
          UIColor.gray(),
          UIColor.red(),
          UIColor.green(),
          UIColor.blue(),
          UIColor.cyan(),
          UIColor.yellow(),
          UIColor.magenta(),
          UIColor.orange(),
          UIColor.purple()
        };

    configurePageControl();
    onValueChanged(null);
  }
  @Override
  public void viewDidLoad() {
    super.viewDidLoad();

    configureToolbar();
  }
Example #10
0
 public void present() {
   parent.presentViewController(alert, true, null);
 }
 @Override
 public void viewDidLoad() {
   super.viewDidLoad();
   configureCaptureSession();
   configureVideoPreviewLayer();
 }