List of usage examples for android.view ViewGroup FOCUS_AFTER_DESCENDANTS
int FOCUS_AFTER_DESCENDANTS
To view the source code for android.view ViewGroup FOCUS_AFTER_DESCENDANTS.
Click Source Link
From source file:com.ferdi2005.secondgram.support.widget.RecyclerView.java
public RecyclerView(Context context, @Nullable AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); if (attrs != null) { TypedArray a = context.obtainStyledAttributes(attrs, CLIP_TO_PADDING_ATTR, defStyle, 0); mClipToPadding = a.getBoolean(0, true); a.recycle();//from w ww .j a va 2 s . co m } else { mClipToPadding = true; } setScrollContainer(true); setFocusableInTouchMode(true); final ViewConfiguration vc = ViewConfiguration.get(context); mTouchSlop = vc.getScaledTouchSlop(); mMinFlingVelocity = vc.getScaledMinimumFlingVelocity(); mMaxFlingVelocity = vc.getScaledMaximumFlingVelocity(); setWillNotDraw(getOverScrollMode() == View.OVER_SCROLL_NEVER); mItemAnimator.setListener(mItemAnimatorListener); initAdapterManager(); initChildrenHelper(); // If not explicitly specified this view is important for accessibility. if (ViewCompat.getImportantForAccessibility(this) == ViewCompat.IMPORTANT_FOR_ACCESSIBILITY_AUTO) { ViewCompat.setImportantForAccessibility(this, ViewCompat.IMPORTANT_FOR_ACCESSIBILITY_YES); } mAccessibilityManager = (AccessibilityManager) getContext().getSystemService(Context.ACCESSIBILITY_SERVICE); setAccessibilityDelegateCompat(new RecyclerViewAccessibilityDelegate(this)); // Create the layoutManager if specified. boolean nestedScrollingEnabled = true; setDescendantFocusability(ViewGroup.FOCUS_AFTER_DESCENDANTS); // Re-set whether nested scrolling is enabled so that it is set on all API levels setNestedScrollingEnabled(nestedScrollingEnabled); }
From source file:android.car.ui.provider.CarDrawerLayout.java
/** * Open the drawer view by animating it into view. *//*w w w .j a v a 2s . c o m*/ public void openDrawer() { ViewGroup drawerView = (ViewGroup) findDrawerView(); mStartedOpen = false; if (hasWindowFocus()) { int left; LayoutParams drawerLp = (LayoutParams) drawerView.getLayoutParams(); if (checkDrawerViewAbsoluteGravity(drawerView, Gravity.LEFT)) { left = drawerLp.getMarginStart(); } else { left = drawerLp.getMarginStart() + getWidth() - drawerView.getWidth(); } mDragger.smoothSlideViewTo(drawerView, left, drawerView.getTop()); dispatchOnDrawerOpening(drawerView); } else { final LayoutParams lp = (LayoutParams) drawerView.getLayoutParams(); lp.onScreen = 1.f; dispatchOnDrawerOpened(drawerView); } ViewGroup contentView = (ViewGroup) findContentView(); contentView.setDescendantFocusability(ViewGroup.FOCUS_BLOCK_DESCENDANTS); drawerView.setDescendantFocusability(ViewGroup.FOCUS_AFTER_DESCENDANTS); View focusable = drawerView.getChildAt(0); if (focusable != null) { focusable.requestFocus(); } invalidate(); }
From source file:android.car.ui.provider.CarDrawerLayout.java
/** * Close the specified drawer view by animating it into view. *///from w ww .j ava 2 s . com public void closeDrawer() { ViewGroup drawerView = (ViewGroup) findDrawerView(); if (!isDrawerView(drawerView)) { throw new IllegalArgumentException("View " + drawerView + " is not a sliding drawer"); } mStartedOpen = true; // Don't trigger the close drawer animation if drawer is not open. if (hasWindowFocus() && isDrawerOpen()) { int left; LayoutParams drawerLp = (LayoutParams) drawerView.getLayoutParams(); if (checkDrawerViewAbsoluteGravity(drawerView, Gravity.LEFT)) { left = drawerLp.getMarginStart() - drawerView.getWidth(); } else { left = drawerLp.getMarginStart() + getWidth(); } mDragger.smoothSlideViewTo(drawerView, left, drawerView.getTop()); dispatchOnDrawerClosing(drawerView); } else { final LayoutParams lp = (LayoutParams) drawerView.getLayoutParams(); lp.onScreen = 0.f; dispatchOnDrawerClosed(drawerView); } ViewGroup contentView = (ViewGroup) findContentView(); drawerView.setDescendantFocusability(ViewGroup.FOCUS_BLOCK_DESCENDANTS); contentView.setDescendantFocusability(ViewGroup.FOCUS_AFTER_DESCENDANTS); if (!isInTouchMode()) { List<View> focusables = contentView.getFocusables(FOCUS_DOWN); if (focusables.size() > 0) { View candidate = focusables.get(0); candidate.requestFocus(); } } invalidate(); }
From source file:org.mozilla.gecko.BrowserApp.java
@Override public void onTabsLayoutChange(int width, int height) { int animationLength = TABS_ANIMATION_DURATION; if (mMainLayoutAnimator != null) { animationLength = Math.max(1, animationLength - (int) mMainLayoutAnimator.getRemainingTime()); mMainLayoutAnimator.stop(false); }// www .j a v a2 s .c o m if (areTabsShown()) { mTabsPanel.setDescendantFocusability(ViewGroup.FOCUS_AFTER_DESCENDANTS); // Hide the web content from accessibility tools even though it's visible // so that you can't examine it as long as the tabs are being shown. if (Versions.feature16Plus) { mLayerView.setImportantForAccessibility(View.IMPORTANT_FOR_ACCESSIBILITY_NO); } } else { if (Versions.feature16Plus) { mLayerView.setImportantForAccessibility(View.IMPORTANT_FOR_ACCESSIBILITY_YES); } } mMainLayoutAnimator = new PropertyAnimator(animationLength, sTabsInterpolator); mMainLayoutAnimator.addPropertyAnimationListener(this); mMainLayoutAnimator.attach(mMainLayout, PropertyAnimator.Property.SCROLL_Y, -height); mTabsPanel.prepareTabsAnimation(mMainLayoutAnimator); mBrowserToolbar.triggerTabsPanelTransition(mMainLayoutAnimator, areTabsShown()); // If the tabs panel is animating onto the screen, pin the dynamic // toolbar. if (mDynamicToolbar.isEnabled()) { if (width > 0 && height > 0) { mDynamicToolbar.setPinned(true, PinReason.RELAYOUT); mDynamicToolbar.setVisible(true, VisibilityTransition.ANIMATE); } else { mDynamicToolbar.setPinned(false, PinReason.RELAYOUT); } } mMainLayoutAnimator.start(); }