当前位置: 首页>>代码示例>>Java>>正文


Java ViewCompat.isAttachedToWindow方法代码示例

本文整理汇总了Java中android.support.v4.view.ViewCompat.isAttachedToWindow方法的典型用法代码示例。如果您正苦于以下问题:Java ViewCompat.isAttachedToWindow方法的具体用法?Java ViewCompat.isAttachedToWindow怎么用?Java ViewCompat.isAttachedToWindow使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在android.support.v4.view.ViewCompat的用法示例。


在下文中一共展示了ViewCompat.isAttachedToWindow方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: shouldInheritContext

import android.support.v4.view.ViewCompat; //导入方法依赖的package包/类
private boolean shouldInheritContext(ViewParent parent) {
    if (parent == null) {
        // The initial parent is null so just return false
        return false;
    }
    final View windowDecor = mAppCompatActivity.getWindow().getDecorView();
    while (true) {
        if (parent == null) {
            // Bingo. We've hit a view which has a null parent before being terminated from
            // the loop. This is (most probably) because it's the root view in an inflation
            // call, therefore we should inherit. This works as the inflated layout is only
            // added to the hierarchy at the end of the inflate() call.
            return true;
        } else if (parent == windowDecor || !(parent instanceof View)
                || ViewCompat.isAttachedToWindow((View) parent)) {
            // We have either hit the window's decor view, a parent which isn't a View
            // (i.e. ViewRootImpl), or an attached view, so we know that the original parent
            // is currently added to the view hierarchy. This means that it has not be
            // inflated in the current inflate() call and we should not inherit the context.
            return false;
        }
        parent = parent.getParent();
    }
}
 
开发者ID:wutongke,项目名称:AndroidSkinAnimator,代码行数:25,代码来源:SkinCompatDelegate.java

示例2: openMenu

import android.support.v4.view.ViewCompat; //导入方法依赖的package包/类
public void openMenu() {
    if (!ViewCompat.isAttachedToWindow(this))
        return;
    requestFocus();

    boolean showMenu = true;
    if (menuListener != null) {
        newNavigationMenu();
        showMenu = menuListener.onPrepareMenu(navigationMenu);
    }

    if (showMenu) {
        addMenuItems();
        fab.setSelected(true);
    } else {
        fab.setSelected(false);
    }
}
 
开发者ID:kranthi0987,项目名称:easyfilemanager,代码行数:19,代码来源:FabSpeedDial.java

示例3: reset

import android.support.v4.view.ViewCompat; //导入方法依赖的package包/类
/**
 * Changes the view the tracker should observe.
 * @param view The new View to observe. Set to {@code null} to completely stop observing.
 */
public void reset(@Nullable View view) {
    // Unregister the listeners for the current view.
    if (mView != null) {
        mView.removeOnAttachStateChangeListener(this);
        if (ViewCompat.isAttachedToWindow(mView)) {
            mView.getViewTreeObserver().removeOnPreDrawListener(this);
        }
    }

    // Register the listeners for the new view.
    mView = view;
    if (mView != null) {
        // Listen to onPreDraw only if view is potentially visible (attached to the window).
        mView.addOnAttachStateChangeListener(this);
        if (ViewCompat.isAttachedToWindow(mView)) {
            mView.getViewTreeObserver().addOnPreDrawListener(this);
        }
    }
}
 
开发者ID:rkshuai,项目名称:chromium-for-android-56-debug-video,代码行数:24,代码来源:ImpressionTracker.java

示例4: fromNormalToEditing

import android.support.v4.view.ViewCompat; //导入方法依赖的package包/类
private void fromNormalToEditing() {
    if (mDisplayMode == DisplayMode.SCREEN_TOOLBAR) {
        setCurrentState(SearchViewState.EDITING);
        openSearchInternal(true);
    } else if (mDisplayMode == DisplayMode.APPBAR_MENUITEM) {
        setCurrentState(SearchViewState.EDITING);
        if (ViewCompat.isAttachedToWindow(this))
            revealFromMenuItem();
        else {
            getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {
                @Override
                public void onGlobalLayout() {
                    if (Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN) {
                        getViewTreeObserver().removeGlobalOnLayoutListener(this);
                    } else {
                        getViewTreeObserver().removeOnGlobalLayoutListener(this);
                    }
                    revealFromMenuItem();
                }
            });
        }

    }
    mHomeButton.animateState(mHomeButtonOpenIconState);
}
 
开发者ID:aliumujib,项目名称:Nibo,代码行数:26,代码来源:NiboPlacesAutoCompleteSearchView.java

示例5: animateVisibility

import android.support.v4.view.ViewCompat; //导入方法依赖的package包/类
@UiThread private static void animateVisibility(@Nullable final View view, final boolean show, int visibility, int duration) {
    if (view == null) {
        return;
    }
    if (!ViewCompat.isAttachedToWindow(view)) {
        view.getViewTreeObserver().addOnPreDrawListener(new ViewTreeObserver.OnPreDrawListener() {
            @Override public boolean onPreDraw() {
                view.getViewTreeObserver().removeOnPreDrawListener(this);
                animateSafeVisibility(show, view, visibility, duration);
                return true;
            }
        });
    } else {
        animateSafeVisibility(show, view, visibility, duration);
    }
}
 
开发者ID:duyp,项目名称:mvvm-template,代码行数:17,代码来源:AnimHelper.java

示例6: setState

import android.support.v4.view.ViewCompat; //导入方法依赖的package包/类
public final void setState(final  int state) {
    if (state == mState) {
        return;
    }
    if (mViewRef == null) {
        // The view is not laid out yet; modify mState and let onLayoutChild handle it later
        if (state == STATE_COLLAPSED || state == STATE_EXPANDED ||
                (mHideable && state == STATE_HIDDEN)) {
            mState = state;
        }
        return;
    }
    final V child = mViewRef.get();
    if (child == null) {
        return;
    }
    // Start the animation; wait until a pending layout if there is one.
    ViewParent parent = child.getParent();
    if (parent != null && parent.isLayoutRequested() && ViewCompat.isAttachedToWindow(child)) {
        child.post(new Runnable() {
            @Override
            public void run() {
                startSettlingAnimation(child, state);
            }
        });
    } else {
        startSettlingAnimation(child, state);
    }
}
 
开发者ID:Krupen,项目名称:FabulousFilter,代码行数:30,代码来源:ViewPagerBottomSheetBehavior.java

示例7: closeMenu

import android.support.v4.view.ViewCompat; //导入方法依赖的package包/类
public void closeMenu() {
    if (!ViewCompat.isAttachedToWindow(this))
        return;

    if (isMenuOpen()) {
        fab.setSelected(false);
        removeFabMenuItems();
        if (menuListener != null) {
            menuListener.onMenuClosed();
        }
    }
}
 
开发者ID:medalionk,项目名称:simple-share-android,代码行数:13,代码来源:FabSpeedDial.java

示例8: hide

import android.support.v4.view.ViewCompat; //导入方法依赖的package包/类
public void hide() {
    if (!ViewCompat.isAttachedToWindow(this))
        return;

    if (isMenuOpen()) {
        closeMenu();
    }
    fab.hide();
}
 
开发者ID:kranthi0987,项目名称:easyfilemanager,代码行数:10,代码来源:FabSpeedDial.java

示例9: show

import android.support.v4.view.ViewCompat; //导入方法依赖的package包/类
public void show() {
    if (!ViewCompat.isAttachedToWindow(this))
        return;
    fab.show();
}
 
开发者ID:kranthi0987,项目名称:easyfilemanager,代码行数:6,代码来源:FabSpeedDial.java

示例10: update

import android.support.v4.view.ViewCompat; //导入方法依赖的package包/类
@Override
public void update(long bytesRead, long contentLength, boolean done) {
    if (ViewCompat.isAttachedToWindow(itemView)) {
    }
}
 
开发者ID:mingdroid,项目名称:tumbviewer,代码行数:6,代码来源:DownloadFragment.java

示例11: isVisibleToUser

import android.support.v4.view.ViewCompat; //导入方法依赖的package包/类
private boolean isVisibleToUser(View view) {
    return ViewCompat.isAttachedToWindow(view) && view.getGlobalVisibleRect(this.mVisibleRect);
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:4,代码来源:AppCompatSpinner.java

示例12: show

import android.support.v4.view.ViewCompat; //导入方法依赖的package包/类
public void show() {
    if (!ViewCompat.isAttachedToWindow(this))
        return;
    setVisibility(View.VISIBLE);
    fab.show();
}
 
开发者ID:Alcatraz323,项目名称:MaterialOCR,代码行数:7,代码来源:FabSpeedDial.java


注:本文中的android.support.v4.view.ViewCompat.isAttachedToWindow方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。