use of org.telegram.ui.Components.BluredView in project Telegram-FOSS by Telegram-FOSS-Team.
the class ChatActivity method checkShowBlur.
private void checkShowBlur(boolean animated) {
boolean show = (parentLayout != null && parentLayout.isInPreviewMode() && !inPreviewMode) || (forwardingPreviewView != null && forwardingPreviewView.isShowing());
if (show && (blurredView == null || blurredView.getTag() == null)) {
if (blurredView == null) {
blurredView = new BluredView(fragmentView.getContext(), fragmentView, themeDelegate) {
@Override
public void setAlpha(float alpha) {
super.setAlpha(alpha);
fragmentView.invalidate();
}
@Override
public void setVisibility(int visibility) {
super.setVisibility(visibility);
fragmentView.invalidate();
}
};
contentView.addView(blurredView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.MATCH_PARENT));
} else {
int idx = contentView.indexOfChild(blurredView);
if (idx != contentView.getChildCount() - 1) {
contentView.removeView(blurredView);
contentView.addView(blurredView);
}
blurredView.update();
blurredView.setVisibility(View.VISIBLE);
}
blurredView.setAlpha(0.0f);
blurredView.animate().setListener(null).cancel();
blurredView.animate().alpha(1f).setListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
super.onAnimationEnd(animation);
chatListView.invalidate();
fragmentView.invalidate();
}
}).start();
blurredView.setTag(1);
} else if (!show && blurredView != null && blurredView.getTag() != null) {
blurredView.animate().setListener(null).cancel();
blurredView.animate().setListener(new HideViewAfterAnimation(blurredView)).alpha(0).start();
blurredView.setTag(null);
chatListView.invalidate();
fragmentView.invalidate();
}
}
Aggregations