@Override public void performChange(@NonNull ViewGroup container, @Nullable View from, @Nullable View to, boolean isPush, @NonNull ControllerChangeCompletedListener changeListener) { if (!canceled) { if (from != null && (!isPush || removesFromViewOnPush)) { container.removeView(from); } if (to != null && to.getParent() == null) { container.addView(to); } } if (container.getWindowToken() != null) { changeListener.onChangeCompleted(); } else { this.changeListener = changeListener; this.container = container; container.addOnAttachStateChangeListener(this); } }
@TargetApi(Build.VERSION_CODES.HONEYCOMB_MR1) private static void sceneChangeRunTransition(final @Nullable ViewGroup sceneRoot, final @Nullable Transition transition) { if (transition != null && sceneRoot != null && isTransitionsAllowed()) { ViewGroupOverlayUtils.initializeOverlay(sceneRoot); MultiListener listener = new MultiListener(transition, sceneRoot); sceneRoot.addOnAttachStateChangeListener(listener); sceneRoot.getViewTreeObserver().addOnPreDrawListener(listener); } else { sPendingTransitions.remove(sceneRoot); } }
rootView.addOnAttachStateChangeListener(new View.OnAttachStateChangeListener() {
public QSAnimator(ViewGroup container, QuickQSPanel quickPanel, ViewGroup panel) { mContext = container.getContext(); mQsContainer = container; mQuickQsPanel = quickPanel; mQsPanel = panel; mQsPanel.addOnAttachStateChangeListener(this); container.addOnLayoutChangeListener(this); mPagedLayout = StatusBarHeaderHooks.qsHooks.getTileLayout(); mPagedLayout.setPageListener(this); if (ConfigUtils.qs().fix_header_space && !mReconfigureNotificationPanel) { ResourceUtils res = ResourceUtils.getInstance(container.getContext()); mQsTopAdjustment = res.getDimensionPixelSize(R.dimen.qs_margin_top) - res.getDimensionPixelSize(R.dimen.status_bar_header_height); } }
/** * Constructor returns an instance of RecentTabsPage. * * @param activity The activity this view belongs to. * @param recentTabsManager The RecentTabsManager which provides the model data. */ public RecentTabsPage(Activity activity, RecentTabsManager recentTabsManager) { mActivity = activity; mRecentTabsManager = recentTabsManager; mTitle = activity.getResources().getString(R.string.recent_tabs); mThemeColor = ApiCompatibilityUtils.getColor( activity.getResources(), R.color.default_primary_color); mRecentTabsManager.setUpdatedCallback(this); LayoutInflater inflater = LayoutInflater.from(activity); mView = (ViewGroup) inflater.inflate(R.layout.recent_tabs_page, null); mListView = (ExpandableListView) mView.findViewById(R.id.odp_listview); mAdapter = buildAdapter(activity, recentTabsManager); mListView.setAdapter(mAdapter); mListView.setOnChildClickListener(this); mListView.setGroupIndicator(null); mListView.setOnGroupCollapseListener(this); mListView.setOnGroupExpandListener(this); mListView.setOnCreateContextMenuListener(this); mView.addOnAttachStateChangeListener(this); ApplicationStatus.registerStateListenerForActivity(this, activity); // {@link #mInForeground} will be updated once the view is attached to the window. onUpdated(); }