Java Code Examples for android.view.ViewGroup#addOnAttachStateChangeListener()
The following examples show how to use
android.view.ViewGroup#addOnAttachStateChangeListener() .
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: RecentTabsPage.java From delion with Apache License 2.0 | 6 votes |
/** * 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(); }
Example 2
Source File: RecentTabsPage.java From AndroidChromium with Apache License 2.0 | 6 votes |
/** * 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(); }
Example 3
Source File: TransitionManager.java From android_9.0.0_r45 with Apache License 2.0 | 5 votes |
private static void sceneChangeRunTransition(final ViewGroup sceneRoot, final Transition transition) { if (transition != null && sceneRoot != null) { MultiListener listener = new MultiListener(transition, sceneRoot); sceneRoot.addOnAttachStateChangeListener(listener); sceneRoot.getViewTreeObserver().addOnPreDrawListener(listener); } }
Example 4
Source File: ActivityTransitionCoordinator.java From android_9.0.0_r45 with Apache License 2.0 | 5 votes |
protected void moveSharedElementsToOverlay() { if (mWindow == null || !mWindow.getSharedElementsUseOverlay()) { return; } setSharedElementMatrices(); int numSharedElements = mSharedElements.size(); ViewGroup decor = getDecor(); if (decor != null) { boolean moveWithParent = moveSharedElementWithParent(); Matrix tempMatrix = new Matrix(); for (int i = 0; i < numSharedElements; i++) { View view = mSharedElements.get(i); if (view.isAttachedToWindow()) { tempMatrix.reset(); mSharedElementParentMatrices.get(i).invert(tempMatrix); GhostView.addGhost(view, decor, tempMatrix); ViewGroup parent = (ViewGroup) view.getParent(); if (moveWithParent && !isInTransitionGroup(parent, decor)) { GhostViewListeners listener = new GhostViewListeners(view, parent, decor); parent.getViewTreeObserver().addOnPreDrawListener(listener); parent.addOnAttachStateChangeListener(listener); mGhostViewListeners.add(listener); } } } } }
Example 5
Source File: SuperPagerHolder.java From DialogUtil with Apache License 2.0 | 5 votes |
public SuperPagerHolder(Context context){ int layoutRes = setLayoutRes(); if(layoutRes !=0){ rootView = (ViewGroup) View.inflate(context,setLayoutRes(),null); }else { rootView = setRootView(context); } rootView.addOnAttachStateChangeListener(this); //ButterKnife.bind(this,rootView); findViews(); }
Example 6
Source File: RecentTabsPage.java From 365browser with Apache License 2.0 | 5 votes |
/** * 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(ChromeActivity 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 = new RecentTabsRowAdapter(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. if (activity.getBottomSheet() != null) { View recentTabsRoot = mView.findViewById(R.id.recent_tabs_root); ApiCompatibilityUtils.setPaddingRelative(recentTabsRoot, ApiCompatibilityUtils.getPaddingStart(recentTabsRoot), 0, ApiCompatibilityUtils.getPaddingEnd(recentTabsRoot), activity.getResources().getDimensionPixelSize( R.dimen.bottom_control_container_height)); } onUpdated(); }
Example 7
Source File: TransitionManager.java From Transitions-Everywhere with Apache License 2.0 | 5 votes |
@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); } }