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


Java FloatingActionButton.OnVisibilityChangedListener方法代码示例

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


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

示例1: mimicFabVisibility

import android.support.design.widget.FloatingActionButton; //导入方法依赖的package包/类
@UiThread public static void mimicFabVisibility(boolean show, @NonNull View view,
                                                @Nullable FloatingActionButton.OnVisibilityChangedListener listener) {
    if (show) {
        view.animate().cancel();
        if (ViewCompat.isLaidOut(view)) {
            if (view.getVisibility() != View.VISIBLE) {
                view.setAlpha(0f);
                view.setScaleY(0f);
                view.setScaleX(0f);
            }
            view.animate()
                    .scaleX(1f)
                    .scaleY(1f)
                    .alpha(1f)
                    .setDuration(200)
                    .setInterpolator(LINEAR_OUT_SLOW_IN_INTERPOLATOR)
                    .withStartAction(() -> {
                        view.setVisibility(View.VISIBLE);
                        if (listener != null) listener.onShown(null);
                    });
        } else {
            view.setVisibility(View.VISIBLE);
            view.setAlpha(1f);
            view.setScaleY(1f);
            view.setScaleX(1f);
            if (listener != null) listener.onShown(null);
        }
    } else {
        view.animate()
                .scaleX(0f)
                .scaleY(0f)
                .alpha(0f)
                .setDuration(40)
                .setInterpolator(FAST_OUT_LINEAR_IN_INTERPOLATOR);
        view.setVisibility(View.GONE);
        if (listener != null) listener.onHidden(null);
    }
}
 
开发者ID:duyp,项目名称:mvvm-template,代码行数:39,代码来源:AnimHelper.java

示例2: handleOrcStatusChangedEvent

import android.support.design.widget.FloatingActionButton; //导入方法依赖的package包/类
@Override
public void handleOrcStatusChangedEvent(OcrStatusChangedEvent statusChangedEvent) {
    Log.d(TAG, "onStatusChanged: status=" + statusChangedEvent);

    Status newStatus = statusChangedEvent.getNewStatus();

    boolean shouldAnimate = true;

    mStatusText.setText(newStatus.getDescription());

    int nextIcon = 0;
    View.OnClickListener clickListener = null;

    if (statusChangedEvent.isStoppingEvent()) {
        Log.d(TAG, "handleOrcStatusChangedEvent: isStoppingEvent");
        mDetectingRedDot.setVisibility(View.INVISIBLE);
        mDetectingRedDot.clearAnimation();

        nextIcon = R.drawable.ic_filter_center_focus_white_24dp;
        clickListener = mScanPresenter.getStartProcessorClickListener();

    } else if (statusChangedEvent.isStartingEvent()) {
        Log.d(TAG, "handleOrcStatusChangedEvent: isStartingEvent");
        mDetectingRedDot.setAlpha(1.0f);
        mDetectingRedDot.startAnimation(mBlinkAnimation);

        nextIcon = R.drawable.ic_stop_white_24dp;
        clickListener = mScanPresenter.getStopProcessorClickListener();

    } else if (newStatus == Status.LOADING) {
        Log.d(TAG, "handleOrcStatusChangedEvent: LOADING");
        nextIcon = R.drawable.ic_clear_white_24dp;
        clickListener = mScanPresenter.getStopLoadingPreviewClickListener();
        shouldAnimate = false;
    }

    if (nextIcon != 0) {
        final int finalNextIcon = nextIcon;
        FloatingActionButton.OnVisibilityChangedListener listener = new FloatingActionButton
                .OnVisibilityChangedListener() {

            @Override
            public void onHidden(final FloatingActionButton fab) {
                super.onHidden(fab);
                fab.setImageDrawable(ContextCompat.getDrawable(getContext(), finalNextIcon));
                fab.show();
            }
        };

        if (clickListener != null) {
            mFab.setOnClickListener(clickListener);
        }

        if (mFab.isShown() && shouldAnimate) {
            mFab.hide(listener);
        } else {
            listener.onHidden(mFab);
        }
    }
}
 
开发者ID:dvdciri,项目名称:DeepImagePreview-Project,代码行数:61,代码来源:ScanFragment.java


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