コード例 #1
0
  public MTLRenderPassDescriptor renderPassDescriptor() {
    CAMetalDrawable drawable = getCurrentDrawable();
    if (drawable == null) {
      Foundation.log(">> ERROR: Failed to get a drawable!");
      renderPassDescriptor = null;
    } else {
      setupRenderPassDescriptor(drawable.getTexture());
    }

    return renderPassDescriptor;
  }
コード例 #2
0
  private void setLocationAction() {
    CLLocationManager locationManager = new CLLocationManager();
    locationManager.setDelegate(
        new CLLocationManagerDelegateAdapter() {
          @Override
          public void didUpdateLocations(CLLocationManager manager, NSArray<CLLocation> locations) {
            if (locations != null && locations.size() > 0) {
              CLLocation location = locations.first();
              Flurry.setLocation(
                  location.getCoordinate().getLatitude(),
                  location.getCoordinate().getLongitude(),
                  location.getHorizontalAccuracy(),
                  location.getVerticalAccuracy());

              manager.stopUpdatingLocation();

              UIAlertView alert = new UIAlertView("Location received!", "", null, "OK");
              alert.show();
            }
          }

          @SuppressWarnings("deprecation")
          @Override
          public void didChangeAuthorizationStatus(
              CLLocationManager manager, CLAuthorizationStatus status) {
            if (status == CLAuthorizationStatus.Authorized
                || status == CLAuthorizationStatus.AuthorizedAlways
                || status == CLAuthorizationStatus.AuthorizedWhenInUse) {
              manager.startUpdatingLocation();
            }
          }
        });
    if (Foundation.getMajorSystemVersion() >= 8
        && CLLocationManager.getAuthorizationStatus()
            != CLAuthorizationStatus.AuthorizedWhenInUse) {
      locationManager.requestWhenInUseAuthorization();
    } else {
      locationManager.startUpdatingLocation();
    }
  }