Registers a sensor manager with the parallax ImageView. Should be called in onResume
or onStart lifecycle callbacks from an Activity or Fragment.

@param samplingPeriodUs the sensor sampling period rate
544251
public void registerSensorManager(int samplingPeriodUs) {
        if (getContext() == null || mSensorManager != null) return;

        // Acquires a sensor manager
        mSensorManager = (SensorManager) getContext().getSystemService(Context.SENSOR_SERVICE);

        if (mSensorManager != null) {
            mSensorManager.registerListener(this,
                    mSensorManager.getDefaultSensor(Sensor.TYPE_ROTATION_VECTOR),
                    samplingPeriodUs);
        }
    }
988497
public void registerCallback(UOWScopeCallback callback)
    {
        if (tc.isEntryEnabled()) Tr.entry(tc, "registerCallback", new Object[]{callback, this});
        
        _callbackManager.addCallback(callback);
        
        if (tc.isEntryEnabled()) Tr.exit(tc, "registerCallback");
    }
732861
@Override
    protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
        int widthMode = MeasureSpec.getMode(widthMeasureSpec);
        int widthSize;
        int heightSize;

        final int mPaddingLeft = getPaddingLeft();
        final int mPaddingTop = getPaddingTop();
        final int mPaddingRight = getPaddingRight();
        final int mPaddingBottom = getPaddingBottom();

        mSpinnerPadding.left = mPaddingLeft > mSelectionLeftPadding ? mPaddingLeft
                : mSelectionLeftPadding;
        mSpinnerPadding.top = mPaddingTop > mSelectionTopPadding ? mPaddingTop
                : mSelectionTopPadding;
        mSpinnerPadding.right = mPaddingRight > mSelectionRightPadding ? mPaddingRight
                : mSelectionRightPadding;
        mSpinnerPadding.bottom = mPaddingBottom > mSelectionBottomPadding ? mPaddingBottom
                : mSelectionBottomPadding;

        if (mDataChanged) {
            handleDataChanged();
        }

        int preferredHeight = 0;
        int preferredWidth = 0;
        boolean needsMeasuring = true;

        int selectedPosition = getSelectedItemPosition();
        if (selectedPosition >= 0 && mAdapter != null && selectedPosition < mAdapter.getCount()) {
            // Try looking in the recycler. (Maybe we were measured once already)
            View view = mRecycler.get(selectedPosition);
            if (view == null) {
                // Make a new one
                view = mAdapter.getView(selectedPosition, null, this);
            }

            if (view != null) {
                // Put in recycler for re-measuring and/or layout
                mRecycler.put(selectedPosition, view);
            }

            if (view != null) {
                if (view.getLayoutParams() == null) {
                    mBlockLayoutRequests = true;
                    view.setLayoutParams(generateDefaultLayoutParams());
                    mBlockLayoutRequests = false;
                }
                measureChild(view, widthMeasureSpec, heightMeasureSpec);

                preferredHeight = getChildHeight(view) + mSpinnerPadding.top + mSpinnerPadding.bottom;
                preferredWidth = getChildWidth(view) + mSpinnerPadding.left + mSpinnerPadding.right;

                needsMeasuring = false;
            }
        }

        if (needsMeasuring) {
            // No views -- just use padding
            preferredHeight = mSpinnerPadding.top + mSpinnerPadding.bottom;
            if (widthMode == MeasureSpec.UNSPECIFIED) {
                preferredWidth = mSpinnerPadding.left + mSpinnerPadding.right;
            }
        }

        preferredHeight = Math.max(preferredHeight, getSuggestedMinimumHeight());
        preferredWidth = Math.max(preferredWidth, getSuggestedMinimumWidth());

        if (IS_HONEYCOMB) {
            heightSize = resolveSizeAndState(preferredHeight, heightMeasureSpec, 0);
            widthSize = resolveSizeAndState(preferredWidth, widthMeasureSpec, 0);
        } else {
            heightSize = resolveSize(preferredHeight, heightMeasureSpec);
            widthSize = resolveSize(preferredWidth, widthMeasureSpec);
        }

        setMeasuredDimension(widthSize, heightSize);
        mHeightMeasureSpec = heightMeasureSpec;
        mWidthMeasureSpec = widthMeasureSpec;
    }
748860
public static void registerMacOSXApplication(MainFrame inApp) {
        if (mainApp != null) {
            throw new IllegalStateException("application already set");
        }

        mainApp = inApp;

        theApplication.addApplicationListener(theAdapter);

        theApplication.addPreferencesMenuItem();
    }
1138881
@Override
	public void register(Metric metric, String metricName, AbstractMetricGroup group) {
		synchronized (lock) {
			if (isShutdown()) {
				LOG.warn("Cannot register metric, because the MetricRegistry has already been shut down.");
			} else {
				if (reporters != null) {
					for (int i = 0; i < reporters.size(); i++) {
						MetricReporter reporter = reporters.get(i);
						try {
							if (reporter != null) {
								FrontMetricGroup front = new FrontMetricGroup<AbstractMetricGroup<?>>(i, group);
								reporter.notifyOfAddedMetric(metric, metricName, front);
							}
						} catch (Exception e) {
							LOG.warn("Error while registering metric.", e);
						}
					}
				}
				try {
					if (queryService != null) {
						queryService.addMetric(metricName, metric, group);
					}
				} catch (Exception e) {
					LOG.warn("Error while registering metric.", e);
				}
				try {
					if (metric instanceof View) {
						if (viewUpdater == null) {
							viewUpdater = new ViewUpdater(executor);
						}
						viewUpdater.notifyOfAddedView((View) metric);
					}
				} catch (Exception e) {
					LOG.warn("Error while registering metric.", e);
				}
			}
		}
	}
479689
@SuppressWarnings({"WeakerAccess", "unused"}) // For library users
    public void registerSearchView(@NonNull final Activity activity, @NonNull final SearchView searchView) {
        registerSearchView(activity, new SearchViewFacade(searchView));
    }
1292754
@Override
  public void register(Monitor<?> monitor) {
    Preconditions.checkNotNull(monitor, "monitor");
    try {
      monitors.add(monitor);
    } catch (Exception e) {
      throw new IllegalArgumentException("invalid object", e);
    }
  }
130304
public void setPlaceholderImage(int resourceId, ScalingUtils.ScaleType scaleType) {
    setPlaceholderImage(mResources.getDrawable(resourceId), scaleType);
  }
193306
@Override
    public void onBindViewHolder(GalleryAdapter.ViewHolder holder, int position, List<Object> payloads) {
        if (payloads.isEmpty()) { // If doesn't have any payload then bind the fully item
            super.onBindViewHolder(holder, position, payloads);
        } else {
            for (Object payload : payloads) {
                boolean selected = isSelected(position);
                if (SELECTION_PAYLOAD.equals(payload)) {
                    if (VIEW_TYPE_MEDIA == getItemViewType(position)) {
                        MediaViewHolder viewHolder = (MediaViewHolder) holder;
                        viewHolder.mCheckView.setChecked(selected);
                        if (selected) {
                            AnimationHelper.scaleView(holder.mImageView, SELECTED_SCALE);
                        } else {
                            AnimationHelper.scaleView(holder.mImageView, UNSELECTED_SCALE);
                        }
                    }
                }
            }
        }
    }
31280
@Override
	protected void onCameraResolutionChange( int width , int height, int sensorOrientation ) {
		super.onCameraResolutionChange(width, height,sensorOrientation);

		derivX.reshape(width, height);
		derivY.reshape(width, height);
	}
1111682
@Override
	public void sessionOpened(IoSession session) throws Exception {
		log.debug("Session opened for sensor {}.", session);
		if (this.sensorIoAdapter != null) {
			this.sensorIoAdapter.sensorConnected(session);
		}
	}
702698
def register_callback(self, sensorid, callback, user_data=None):
        """"""
        if sensorid not in self._registry:
            self._registry[sensorid] = list()
        self._registry[sensorid].append((callback, user_data))
992489
public static synchronized void sdkInitialize(Context context) {
        if (sdkInitialized == true) {
          return;
        }
        BoltsMeasurementEventListener.getInstance(context.getApplicationContext());
        sdkInitialized = true;
    }
1029476
private void addConsumerToRegisteredMonitorMap(
    MonitoredConsumer mc,
    ArrayList monitorList,
    Map registeredMonitors)
  {
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
        SibTr.entry(
          tc,
          "addConsumerToRegisteredMonitorMap",
          new Object[] { registeredMonitors,
                         mc,
                         monitorList });
    // Finally, add this consumer to the appropriate places in the registered
    // consumer monitors tables
    Iterator i = monitorList.iterator();
    while (i.hasNext())
    {
      String tExpr = (String)i.next();

      // Get the next monitor
      RegisteredCallbacks rMonitor = (RegisteredCallbacks)registeredMonitors.get(tExpr);

      // Retrieve the current list of consumers
      ArrayList matchingConsumerList = rMonitor.getMatchingConsumers();

      // There is no need to drive any callbacks as we are placing subscriptions
      // in the registrations table that correspond to existing subscriptions.
      // So simply add the new subscription to the list.
      matchingConsumerList.add(mc);
    }

    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
      SibTr.exit(tc, "addConsumerToRegisteredMonitorMap");

  }
786640
protected void onCameraResolutionChange( int cameraWidth , int cameraHeight ,
											 int orientation ) {
		if( verbose )
			Log.i(TAG,"onCameraResolutionChange( "+cameraWidth+" , "+cameraHeight+")");
	}
854079
private void fireTangoPeriodicEvent(TangoPeriodic tangoPeriodic, EventData eventData) {
        TangoPeriodicEvent tangoPeriodicEvent = new TangoPeriodicEvent(tangoPeriodic, eventData);
        // Notifying those that are interested in this event
        ArrayList<EventListener> listeners = event_listeners.getListeners(ITangoPeriodicListener.class);
        for (EventListener eventListener : listeners) {
            ((ITangoPeriodicListener) eventListener).periodic(tangoPeriodicEvent);
        }
    }
189185
protected void registerPreviewHandler() {

        if (m_previewHandlerRegistration == null) {
            NativePreviewHandler eventPreviewHandler = new NativePreviewHandler() {

                public void onPreviewNativeEvent(NativePreviewEvent event) {

                    Event nativeEvent = Event.as(event.getNativeEvent());
                    if (DOM.eventGetType(nativeEvent) == Event.ONKEYDOWN) {
                        int keyCode = nativeEvent.getKeyCode();
                        if (keyCode == KeyCodes.KEY_ESCAPE) {
                            onClickCancel();
                        } else if (keyCode == KeyCodes.KEY_ENTER) {
                            Element element = CmsDomUtil.getActiveElement();
                            boolean isTextarea = (element != null) && element.getTagName().equalsIgnoreCase("textarea");
                            if (!isTextarea) {
                                onClickOk();
                            }
                        }
                    }
                }
            };
            m_previewHandlerRegistration = Event.addNativePreviewHandler(eventPreviewHandler);
        }
    }