@Override public void addView(View child, int index, ViewGroup.LayoutParams params) { if (sheet != null) { throw new UnsupportedOperationException("BottomSheet must only have 1 child view"); } sheet = child; sheetOffsetHelper = new ViewOffsetHelper(sheet); sheet.addOnLayoutChangeListener(sheetLayout); // force the sheet contents to be gravity bottom. This ain't a top sheet. ((LayoutParams) params).gravity = Gravity.BOTTOM | Gravity.CENTER_HORIZONTAL; super.addView(child, index, params); }
private void addListeners() { if (dependency == null) return; if (dependency instanceof TransformationView) ((TransformationView) dependency).addOnTransformationChangedListener(transformationListener); dependency.addOnLayoutChangeListener(layoutListener); }
@Override public void initViews(View rootView) { super.initViews(rootView); resizingIndicator = rootView.findViewById(R.id.resizing_indicator); fullScreenButton = rootView.findViewById(R.id.fullScreenButton); fullScreenButton.setOnClickListener(v -> onFullScreenButtonClicked()); videoPlayPause = rootView.findViewById(R.id.videoPlayPause); extraOptionsView = rootView.findViewById(R.id.extraOptionsView); closingOverlayView = rootView.findViewById(R.id.closingOverlay); rootView.addOnLayoutChangeListener(this); }
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // Inflate the layout for this fragment final View view = inflater.inflate(R.layout.fragment_map_list, container, false); if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { view.addOnLayoutChangeListener(new View.OnLayoutChangeListener() { @TargetApi(Build.VERSION_CODES.LOLLIPOP) @Override public void onLayoutChange(View v, int left, int top, int right, int bottom, int oldLeft, int oldTop, int oldRight, int oldBottom) { v.removeOnLayoutChangeListener(this); toggleInformationView(view); } }); } return view; }
@Override public void setContentView(@NonNull View view, ViewGroup.LayoutParams params) { contentView = view; contentView.addOnLayoutChangeListener((v, left, top, right, bottom, oldLeft, oldTop, oldRight, oldBottom) -> { onContentHeightChanged(contentView.getHeight()); }); container.addView(view); }
@Override public void onVideoSizeChanged( int width, int height, int unappliedRotationDegrees, float pixelWidthHeightRatio) { float videoAspectRatio = (height == 0 || width == 0) ? 1 : (width * pixelWidthHeightRatio) / height; if (surfaceView instanceof TextureView) { // Try to apply rotation transformation when our surface is a TextureView. if (unappliedRotationDegrees == 90 || unappliedRotationDegrees == 270) { // We will apply a rotation 90/270 degree to the output texture of the TextureView. // In this case, the output video's width and height will be swapped. videoAspectRatio = 1 / videoAspectRatio; } if (textureViewRotation != 0) { surfaceView.removeOnLayoutChangeListener(this); } textureViewRotation = unappliedRotationDegrees; if (textureViewRotation != 0) { // The texture view's dimensions might be changed after layout step. // So add an OnLayoutChangeListener to apply rotation after layout step. surfaceView.addOnLayoutChangeListener(this); } applyTextureViewRotation((TextureView) surfaceView, textureViewRotation); } onContentAspectRatioChanged(videoAspectRatio, contentFrame, surfaceView); }
@Override public void initListeners() { super.initListeners(); PlayerGestureListener listener = new PlayerGestureListener(); gestureDetector = new GestureDetector(context, listener); gestureDetector.setIsLongpressEnabled(false); getRootView().setOnTouchListener(listener); queueButton.setOnClickListener(this); repeatButton.setOnClickListener(this); shuffleButton.setOnClickListener(this); playPauseButton.setOnClickListener(this); playPreviousButton.setOnClickListener(this); playNextButton.setOnClickListener(this); moreOptionsButton.setOnClickListener(this); toggleOrientationButton.setOnClickListener(this); switchBackgroundButton.setOnClickListener(this); switchPopupButton.setOnClickListener(this); getRootView().addOnLayoutChangeListener((view, l, t, r, b, ol, ot, or, ob) -> { if (l != ol || t != ot || r != or || b != ob) { // Use smaller value to be consistent between screen orientations // (and to make usage easier) int width = r - l, height = b - t; maxGestureLength = (int) (Math.min(width, height) * MAX_GESTURE_LENGTH); if (DEBUG) Log.d(TAG, "maxGestureLength = " + maxGestureLength); volumeProgressBar.setMax(maxGestureLength); brightnessProgressBar.setMax(maxGestureLength); setInitialGestureValues(); } }); }
sheetView.addOnLayoutChangeListener(sheetViewOnLayoutChangeListener);
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // Inflate the layout for this fragment final View view = inflater.inflate(R.layout.fragment_map_list, container, false); if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { view.addOnLayoutChangeListener(new View.OnLayoutChangeListener() { @TargetApi(Build.VERSION_CODES.LOLLIPOP) @Override public void onLayoutChange(View v, int left, int top, int right, int bottom, int oldLeft, int oldTop, int oldRight, int oldBottom) { v.removeOnLayoutChangeListener(this); revealView(view); } }); } return view; }
@Override public boolean onPreDraw() { childView.getViewTreeObserver().removeOnPreDrawListener(this); //now we have a size if (expanded) { expand(false); } childView.addOnLayoutChangeListener(new OnLayoutChangeListener() { @Override public void onLayoutChange(View view, int left, int top, int right, int bottom, int oldLeft, int oldTop, int oldRight, int oldBottom) { if (expanded && animator == null) { final int width = right - left; post(new Runnable() { @Override public void run() { setWidth(width); } }); } } }); return false; } });
@Override public boolean onPreDraw() { childView.getViewTreeObserver().removeOnPreDrawListener(this); //now we have a size if (expanded) { expand(false); } childView.addOnLayoutChangeListener(new OnLayoutChangeListener() { @Override public void onLayoutChange(View view, int left, int top, int right, int bottom, int oldLeft, int oldTop, int oldRight, int oldBottom) { if (expanded && animator == null) { final int height = bottom - top; post(new Runnable() { @Override public void run() { setHeight(height); } }); } } }); return true; } });
final View dropDownAnchor = searchView.findViewById(searchEditText.getDropDownAnchor()); if (dropDownAnchor != null) { dropDownAnchor.addOnLayoutChangeListener(new View.OnLayoutChangeListener() { @Override public void onLayoutChange(View v, int left, int top, int right, int bottom,
mProfileInfoLayout.addOnLayoutChangeListener(new View.OnLayoutChangeListener() { @Override public void onLayoutChange(View v, int left, int top, int right, int bottom,
protected void startCameraView( View view) { if( verbose ) Log.i(TAG,"startCamera(View="+(view!=null)+")"); this.mView = view; this.mTextureView = null; view.addOnLayoutChangeListener(mViewLayoutChangeListener); }
@Override public void addView(View child, int index, ViewGroup.LayoutParams params) { if (sheet != null) { throw new UnsupportedOperationException("CurveLayout must only have 1 child view"); } sheet = child; sheet.addOnLayoutChangeListener(sheetLayout); // force the sheet contents to be gravity bottom. This ain't a top sheet. ((LayoutParams) params).gravity = Gravity.BOTTOM | Gravity.CENTER_HORIZONTAL; super.addView(child, index, params); }
private void setArrowToRef(View targetView) { if (mArrowToViewRef != null) { View oldTargetView = mArrowToViewRef.get(); if (oldTargetView != null) { oldTargetView.removeOnLayoutChangeListener(mOnLayoutChangeListener); } } mArrowToViewRef = targetView != null ? new WeakReference<>(targetView) : null; if (targetView != null) { targetView.addOnLayoutChangeListener(mOnLayoutChangeListener); } }
@Override public void addView(View child, int index, ViewGroup.LayoutParams params) { if (sheet != null) { throw new UnsupportedOperationException("CurveLayout must only have 1 child view"); } sheet = child; sheetOffsetHelper = new ViewOffsetHelper(sheet); sheet.addOnLayoutChangeListener(sheetLayout); // force the sheet contents to be gravity bottom. This ain't a top sheet. ((LayoutParams) params).gravity = Gravity.BOTTOM | Gravity.CENTER_HORIZONTAL; super.addView(child, index, params); }
public void onViewAttachedToWindow(final VH holder) { super.onViewAttachedToWindow(holder); if ((this.mContext instanceof MainActivity) && ((MainActivity) this.mContext).isLaunchAnimationInProgress()) { holder.itemView.addOnLayoutChangeListener(new OnLayoutChangeListener() { public void onLayoutChange(View v, int left, int top, int right, int bottom, int oldLeft, int oldTop, int oldRight, int oldBottom) { v.removeOnLayoutChangeListener(this); ((MainActivity) RowViewAdapter.this.mContext).includeInLaunchAnimation(holder.itemView); } }); } } }
@Override protected void onAttachedToWindow() { super.onAttachedToWindow(); if (mNavigationButton != null) mNavigationButton.addOnLayoutChangeListener(this); if (mUrlBar != null) mUrlBar.addOnLayoutChangeListener(this); if (mLocationBar != null) { mLocationBar.getContainerView().addOnLayoutChangeListener(this); } getRootView().addOnLayoutChangeListener(this); }
public FloatingActionModeHelper(FloatingActionMode mode, View target, FloatingActionMode.Callback callback, int themeResId) { mMode = mode; mTarget = target; mCallback = callback; final Context context = target.getContext(); mMenu = new FloatingMenuImpl(target.getContext()); mView = new ViewManager(context, themeResId, mode, mMenu, callback); final View root = mTarget.getRootView(); root.addOnLayoutChangeListener(this); root.addOnAttachStateChangeListener(this); mTarget.addOnAttachStateChangeListener(this); }