Java Code Examples for android.view.ViewGroup#getWindowVisibility()
The following examples show how to use
android.view.ViewGroup#getWindowVisibility() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: LayoutTransition.java From android_9.0.0_r45 with Apache License 2.0 | 5 votes |
/** * This method is called by ViewGroup when a child view is about to be added to the * container. This callback starts the process of a transition; we grab the starting * values, listen for changes to all of the children of the container, and start appropriate * animations. * * @param parent The ViewGroup to which the View is being added. * @param child The View being added to the ViewGroup. * @param changesLayout Whether the removal will cause changes in the layout of other views * in the container. INVISIBLE views becoming VISIBLE will not cause changes and thus will not * affect CHANGE_APPEARING or CHANGE_DISAPPEARING animations. */ private void addChild(ViewGroup parent, View child, boolean changesLayout) { if (parent.getWindowVisibility() != View.VISIBLE) { return; } if ((mTransitionTypes & FLAG_APPEARING) == FLAG_APPEARING) { // Want disappearing animations to finish up before proceeding cancel(DISAPPEARING); } if (changesLayout && (mTransitionTypes & FLAG_CHANGE_APPEARING) == FLAG_CHANGE_APPEARING) { // Also, cancel changing animations so that we start fresh ones from current locations cancel(CHANGE_APPEARING); cancel(CHANGING); } if (hasListeners() && (mTransitionTypes & FLAG_APPEARING) == FLAG_APPEARING) { ArrayList<TransitionListener> listeners = (ArrayList<TransitionListener>) mListeners.clone(); for (TransitionListener listener : listeners) { listener.startTransition(this, parent, child, APPEARING); } } if (changesLayout && (mTransitionTypes & FLAG_CHANGE_APPEARING) == FLAG_CHANGE_APPEARING) { runChangeTransition(parent, child, APPEARING); } if ((mTransitionTypes & FLAG_APPEARING) == FLAG_APPEARING) { runAppearingTransition(parent, child); } }
Example 2
Source File: LayoutTransition.java From android_9.0.0_r45 with Apache License 2.0 | 5 votes |
/** * This method is called by ViewGroup when there is a call to layout() on the container * with this LayoutTransition. If the CHANGING transition is enabled and if there is no other * transition currently running on the container, then this call runs a CHANGING transition. * The transition does not start immediately; it just sets up the mechanism to run if any * of the children of the container change their layout parameters (similar to * the CHANGE_APPEARING and CHANGE_DISAPPEARING transitions). * * @param parent The ViewGroup whose layout() method has been called. * * @hide */ public void layoutChange(ViewGroup parent) { if (parent.getWindowVisibility() != View.VISIBLE) { return; } if ((mTransitionTypes & FLAG_CHANGING) == FLAG_CHANGING && !isRunning()) { // This method is called for all calls to layout() in the container, including // those caused by add/remove/hide/show events, which will already have set up // transition animations. Avoid setting up CHANGING animations in this case; only // do so when there is not a transition already running on the container. runChangeTransition(parent, null, CHANGING); } }
Example 3
Source File: LayoutTransition.java From android_9.0.0_r45 with Apache License 2.0 | 5 votes |
/** * This method is called by ViewGroup when a child view is about to be removed from the * container. This callback starts the process of a transition; we grab the starting * values, listen for changes to all of the children of the container, and start appropriate * animations. * * @param parent The ViewGroup from which the View is being removed. * @param child The View being removed from the ViewGroup. * @param changesLayout Whether the removal will cause changes in the layout of other views * in the container. Views becoming INVISIBLE will not cause changes and thus will not * affect CHANGE_APPEARING or CHANGE_DISAPPEARING animations. */ private void removeChild(ViewGroup parent, View child, boolean changesLayout) { if (parent.getWindowVisibility() != View.VISIBLE) { return; } if ((mTransitionTypes & FLAG_DISAPPEARING) == FLAG_DISAPPEARING) { // Want appearing animations to finish up before proceeding cancel(APPEARING); } if (changesLayout && (mTransitionTypes & FLAG_CHANGE_DISAPPEARING) == FLAG_CHANGE_DISAPPEARING) { // Also, cancel changing animations so that we start fresh ones from current locations cancel(CHANGE_DISAPPEARING); cancel(CHANGING); } if (hasListeners() && (mTransitionTypes & FLAG_DISAPPEARING) == FLAG_DISAPPEARING) { ArrayList<TransitionListener> listeners = (ArrayList<TransitionListener>) mListeners .clone(); for (TransitionListener listener : listeners) { listener.startTransition(this, parent, child, DISAPPEARING); } } if (changesLayout && (mTransitionTypes & FLAG_CHANGE_DISAPPEARING) == FLAG_CHANGE_DISAPPEARING) { runChangeTransition(parent, child, DISAPPEARING); } if ((mTransitionTypes & FLAG_DISAPPEARING) == FLAG_DISAPPEARING) { runDisappearingTransition(parent, child); } }