本文整理汇总了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);
}
}
示例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);
}
}
}