android.widget.ImageButton# getVisibility ( ) 源码实例Demo

下面列出了android.widget.ImageButton# getVisibility ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: Jreader   文件: MyGridView.java

@Override
public void run() {
    isDrag = true; //设置可以拖拽
    mVibrator.vibrate(50); //震动一下
    mStartDragItemView.setVisibility(View.INVISIBLE);//隐藏该item
    for (int i = 0;i < getChildCount();i++) {
        final View mGridItemView = getChildAt(i);
        mDeleteButton = (ImageButton) mGridItemView.findViewById(R.id.item_close_Im);
        mDeleteButton.setOnClickListener(MyGridView.this);
        if(mDeleteButton.getVisibility()!=VISIBLE) {
            //   mDeleteButton.setVisibility(VISIBLE);
        }

    }
    //根据我们按下的点显示item镜像
    createDragImage(mDragBitmap, mDownX, mDownY);

  //  setIsShowDeleteButton(true);


}
 
源代码2 项目: Jreader   文件: DragGridView.java

@Override
public void run() {
    isDrag = true; //设置可以拖拽
    mVibrator.vibrate(50); //震动一下
    mStartDragItemView.setVisibility(View.INVISIBLE);//隐藏该item

    //根据我们按下的点显示item镜像
    createDragImage(mDragBitmap, mDownX, mDownY);

    setIsShowDeleteButton(true);
    for (int i = 0;i < getChildCount();i++) {
        final View mGridItemView = getChildAt(i);
        mDeleteButton = (ImageButton) mGridItemView.findViewById(R.id.item_close_Im);
        mDeleteButton.setOnClickListener(DragGridView.this);
        if(mDeleteButton.getVisibility()!=VISIBLE) {
         //   mDeleteButton.setVisibility(VISIBLE);
        }

    }

}
 
源代码3 项目: SuntimesWidget   文件: ViewUtils.java

public static void fadeInButton(final ImageButton button, final int duration)
{
    if (Build.VERSION.SDK_INT >= 12)
    {
        button.clearAnimation();

        if (button.getVisibility() != View.VISIBLE) {
            button.setAlpha(0f);
            button.setVisibility(View.VISIBLE);
        }
        if (button.getAlpha() != 1f) {
            button.animate().setDuration(duration).alpha(1f);
        }

    } else {
        button.setVisibility(View.VISIBLE);
    }
}
 
源代码4 项目: Camera2   文件: ButtonManager.java

/**
 * Initialize a known button with a click listener and a drawable resource id,
 * and a content description resource id.
 * Sets the button visible.
 */
public void initializePushButton(int buttonId, View.OnClickListener cb,
                                 int imageId, int contentDescriptionId)
{
    ImageButton button = getImageButtonOrError(buttonId);
    button.setOnClickListener(cb);
    if (imageId != NO_RESOURCE)
    {
        button.setImageResource(imageId);
    }
    if (contentDescriptionId != NO_RESOURCE)
    {
        button.setContentDescription(mAppController
                .getAndroidContext().getResources().getString(contentDescriptionId));
    }

    if (!button.isEnabled())
    {
        button.setEnabled(true);
        if (mListener != null)
        {
            mListener.onButtonEnabledChanged(this, buttonId);
        }
    }
    button.setTag(R.string.tag_enabled_id, buttonId);

    if (button.getVisibility() != View.VISIBLE)
    {
        button.setVisibility(View.VISIBLE);
        if (mListener != null)
        {
            mListener.onButtonVisibilityChanged(this, buttonId);
        }
    }
}
 
源代码5 项目: delion   文件: ToolbarTablet.java

@Override
public void onFinishInflate() {
    super.onFinishInflate();
    mLocationBar = (LocationBarTablet) findViewById(R.id.location_bar);

    mHomeButton = (TintedImageButton) findViewById(R.id.home_button);
    mBackButton = (TintedImageButton) findViewById(R.id.back_button);
    mForwardButton = (TintedImageButton) findViewById(R.id.forward_button);
    mReloadButton = (TintedImageButton) findViewById(R.id.refresh_button);
    mShowTabStack = DeviceClassManager.isAccessibilityModeEnabled(getContext())
            || CommandLine.getInstance().hasSwitch(ChromeSwitches.ENABLE_TABLET_TAB_STACK);

    mTabSwitcherButtonDrawable =
            TabSwitcherDrawable.createTabSwitcherDrawable(getResources(), false);
    mTabSwitcherButtonDrawableLight =
            TabSwitcherDrawable.createTabSwitcherDrawable(getResources(), true);

    mAccessibilitySwitcherButton = (ImageButton) findViewById(R.id.tab_switcher_button);
    mAccessibilitySwitcherButton.setImageDrawable(mTabSwitcherButtonDrawable);
    updateSwitcherButtonVisibility(mShowTabStack);

    mBookmarkButton = (TintedImageButton) findViewById(R.id.bookmark_button);

    mMenuButton = (TintedImageButton) findViewById(R.id.menu_button);
    mMenuButtonWrapper.setVisibility(
            shouldShowMenuButton() ? View.VISIBLE : View.GONE);

    if (mAccessibilitySwitcherButton.getVisibility() == View.GONE
            && mMenuButtonWrapper.getVisibility() == View.GONE) {
        ApiCompatibilityUtils.setPaddingRelative((View) mMenuButtonWrapper.getParent(), 0, 0,
                getResources().getDimensionPixelSize(R.dimen.tablet_toolbar_end_padding), 0);
    }

    // Initialize values needed for showing/hiding toolbar buttons when the activity size
    // changes.
    mShouldAnimateButtonVisibilityChange = false;
    mToolbarButtonsVisible = true;
    mToolbarButtons = new TintedImageButton[] {mBackButton, mForwardButton, mReloadButton};
}
 
源代码6 项目: AndroidChromium   文件: ToolbarTablet.java

@Override
public void onFinishInflate() {
    super.onFinishInflate();
    mLocationBar = (LocationBarTablet) findViewById(R.id.location_bar);

    mHomeButton = (TintedImageButton) findViewById(R.id.home_button);
    mBackButton = (TintedImageButton) findViewById(R.id.back_button);
    mForwardButton = (TintedImageButton) findViewById(R.id.forward_button);
    mReloadButton = (TintedImageButton) findViewById(R.id.refresh_button);
    mShowTabStack = DeviceClassManager.isAccessibilityModeEnabled(getContext())
            || CommandLine.getInstance().hasSwitch(ChromeSwitches.ENABLE_TABLET_TAB_STACK);

    mTabSwitcherButtonDrawable =
            TabSwitcherDrawable.createTabSwitcherDrawable(getResources(), false);
    mTabSwitcherButtonDrawableLight =
            TabSwitcherDrawable.createTabSwitcherDrawable(getResources(), true);

    mAccessibilitySwitcherButton = (ImageButton) findViewById(R.id.tab_switcher_button);
    mAccessibilitySwitcherButton.setImageDrawable(mTabSwitcherButtonDrawable);
    updateSwitcherButtonVisibility(mShowTabStack);

    mBookmarkButton = (TintedImageButton) findViewById(R.id.bookmark_button);

    mMenuButton = (TintedImageButton) findViewById(R.id.menu_button);
    mMenuButtonWrapper.setVisibility(View.VISIBLE);

    if (mAccessibilitySwitcherButton.getVisibility() == View.GONE
            && mMenuButtonWrapper.getVisibility() == View.GONE) {
        ApiCompatibilityUtils.setPaddingRelative((View) mMenuButtonWrapper.getParent(), 0, 0,
                getResources().getDimensionPixelSize(R.dimen.tablet_toolbar_end_padding), 0);
    }

    mSaveOfflineButton = (TintedImageButton) findViewById(R.id.save_offline_button);

    // Initialize values needed for showing/hiding toolbar buttons when the activity size
    // changes.
    mShouldAnimateButtonVisibilityChange = false;
    mToolbarButtonsVisible = true;
    mToolbarButtons = new TintedImageButton[] {mBackButton, mForwardButton, mReloadButton};
}
 
源代码7 项目: LoyalNativeSlider   文件: ZoomableView.java

private void cover_off(LinearLayout cover, final ImageButton cornerButton) {
    if (bottomFadeDescription && Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB_MR1)
        cover.animate().alpha(0f);

    if (animateCloseButton && cornerButton.getVisibility() != View.GONE && Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN)
        cornerButton.animate().alpha(0f).withEndAction(new Runnable() {
            @Override
            public void run() {
                cornerButton.setEnabled(false);
            }
        });
}
 
源代码8 项目: LoyalNativeSlider   文件: ZoomableView.java

private void cover_on(LinearLayout cover, final ImageButton cornerButton) {
    if (bottomFadeDescription && Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB_MR1)
        cover.animate().alpha(1f);

    if (animateCloseButton && cornerButton.getVisibility() != View.GONE && Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN)
        cornerButton.animate().alpha(1f).withEndAction(new Runnable() {
            @Override
            public void run() {
                cornerButton.setEnabled(true);
            }
        });

}
 
源代码9 项目: 365browser   文件: ToolbarTablet.java

@Override
public void onFinishInflate() {
    super.onFinishInflate();
    mLocationBar = (LocationBarTablet) findViewById(R.id.location_bar);

    mHomeButton = (TintedImageButton) findViewById(R.id.home_button);
    mBackButton = (TintedImageButton) findViewById(R.id.back_button);
    mForwardButton = (TintedImageButton) findViewById(R.id.forward_button);
    mReloadButton = (TintedImageButton) findViewById(R.id.refresh_button);
    mSecurityButton = (TintedImageButton) findViewById(R.id.security_button);
    mShowTabStack = AccessibilityUtil.isAccessibilityEnabled();

    mTabSwitcherButtonDrawable =
            TabSwitcherDrawable.createTabSwitcherDrawable(getResources(), false);
    mTabSwitcherButtonDrawableLight =
            TabSwitcherDrawable.createTabSwitcherDrawable(getResources(), true);

    mAccessibilitySwitcherButton = (ImageButton) findViewById(R.id.tab_switcher_button);
    mAccessibilitySwitcherButton.setImageDrawable(mTabSwitcherButtonDrawable);
    updateSwitcherButtonVisibility(mShowTabStack);

    mBookmarkButton = (TintedImageButton) findViewById(R.id.bookmark_button);

    mMenuButton = (TintedImageButton) findViewById(R.id.menu_button);
    mMenuButtonWrapper.setVisibility(View.VISIBLE);

    if (mAccessibilitySwitcherButton.getVisibility() == View.GONE
            && mMenuButtonWrapper.getVisibility() == View.GONE) {
        ApiCompatibilityUtils.setPaddingRelative((View) mMenuButtonWrapper.getParent(), 0, 0,
                getResources().getDimensionPixelSize(R.dimen.tablet_toolbar_end_padding), 0);
    }

    mSaveOfflineButton = (TintedImageButton) findViewById(R.id.save_offline_button);

    // Initialize values needed for showing/hiding toolbar buttons when the activity size
    // changes.
    mShouldAnimateButtonVisibilityChange = false;
    mToolbarButtonsVisible = true;
    mToolbarButtons = new TintedImageButton[] {mBackButton, mForwardButton, mReloadButton};
}
 
源代码10 项目: SuntimesWidget   文件: ViewUtils.java

public static void fadeOutButton(final ImageButton button, final int duration)
{
    if (button.getVisibility() != View.GONE)
    {
        if (Build.VERSION.SDK_INT >= 12)
        {
            button.clearAnimation();
            if (button.getAlpha() == 0f) {
                button.setVisibility(View.GONE);

            } else {
                button.setAlpha(1f);
                button.animate().setDuration(duration).alpha(0f).setListener(new AnimatorListenerAdapter()
                {
                    @Override
                    public void onAnimationEnd(Animator animation)
                    {
                        super.onAnimationEnd(animation);
                        button.setVisibility(View.GONE);
                        //noinspection ConstantConditions
                        if (Build.VERSION.SDK_INT >= 12)
                        {
                            button.setAlpha(1f);
                            button.animate().setListener(null);
                            button.clearAnimation();
                        }
                    }
                });
            }

        } else {
            button.setVisibility(View.GONE);
        }
    }
}
 
源代码11 项目: Jreader   文件: MyGridView.java

@Override
public boolean onItemLongClick(AdapterView<?> parent, View view, int position, long id) {
    Log.d("MyGridView","onItemLongClick");
    isDrag = true; //设置可以拖拽
    setIsShowDeleteButton(true);
   // mDragAdapter.nitifyDataRefresh();
    mVibrator.vibrate(50); //震动一下

    for (int i = 0;i < getChildCount();i++) {
        final View mGridItemView = getChildAt(i);
        mDeleteButton = (ImageButton) mGridItemView.findViewById(R.id.item_close_Im);
        mDeleteButton.setOnClickListener(MyGridView.this);
        if(mDeleteButton.getVisibility()!=VISIBLE) {
          //  mDeleteButton.setVisibility(VISIBLE);
        }
    }
    mDragPosition = position;
    //根据position获取该item所对应的View
    mStartDragItemView = getChildAt(mDragPosition - getFirstVisiblePosition());

    //
    mPoint2ItemTop = mDownY - mStartDragItemView.getTop();
    mPoint2ItemLeft = mDownX - mStartDragItemView.getLeft();

    mOffset2Top = (int)( downRawY - mDownY);
    mOffset2Left = (int) (downRawX - mDownX);
    //获取DragGridView自动向上滚动的偏移量,小于这个值,DragGridView向下滚动
    mDownScrollBorder = getHeight() / 5;
    //获取DragGridView自动向下滚动的偏移量,大于这个值,DragGridView向上滚动
    mUpScrollBorder = getHeight() * 4/5;

    //开启mDragItemView绘图缓存
    mStartDragItemView.setDrawingCacheEnabled(true);

    //获取mDragItemView在缓存中的Bitmap对象
    mDragBitmap = Bitmap.createBitmap(mStartDragItemView.getDrawingCache());
    //这一步很关键,释放绘图缓存,避免出现重复的镜像
    mStartDragItemView.destroyDrawingCache();

    mStartDragItemView.setVisibility(View.INVISIBLE);//隐藏该item
    //根据我们按下的点显示item镜像
    createDragImage(mDragBitmap, mDownX, mDownY);

    return true;
}