use of org.telegram.ui.Cells.PhotoAttachCameraCell in project Telegram-FOSS by Telegram-FOSS-Team.
the class ChatAttachAlertPhotoLayout method onHide.
@Override
public void onHide() {
isHidden = true;
dropDownContainer.setVisibility(GONE);
int count = gridView.getChildCount();
for (int a = 0; a < count; a++) {
View child = gridView.getChildAt(a);
if (child instanceof PhotoAttachCameraCell) {
PhotoAttachCameraCell cell = (PhotoAttachCameraCell) child;
child.setVisibility(View.VISIBLE);
saveLastCameraBitmap();
cell.updateBitmap();
break;
}
}
}
use of org.telegram.ui.Cells.PhotoAttachCameraCell in project Telegram-FOSS by Telegram-FOSS-Team.
the class ChatAttachAlertPhotoLayout method checkColors.
@Override
void checkColors() {
if (cameraIcon != null) {
cameraIcon.invalidate();
}
String textColor = forceDarkTheme ? Theme.key_voipgroup_actionBarItems : Theme.key_dialogTextBlack;
Theme.setDrawableColor(cameraDrawable, getThemedColor(Theme.key_dialogCameraIcon));
progressView.setTextColor(getThemedColor(Theme.key_emptyListPlaceholder));
gridView.setGlowColor(getThemedColor(Theme.key_dialogScrollGlow));
RecyclerView.ViewHolder holder = gridView.findViewHolderForAdapterPosition(0);
if (holder != null && holder.itemView instanceof PhotoAttachCameraCell) {
((PhotoAttachCameraCell) holder.itemView).getImageView().setColorFilter(new PorterDuffColorFilter(getThemedColor(Theme.key_dialogCameraIcon), PorterDuff.Mode.MULTIPLY));
}
dropDown.setTextColor(getThemedColor(textColor));
dropDownContainer.setPopupItemsColor(getThemedColor(forceDarkTheme ? Theme.key_voipgroup_actionBarItems : Theme.key_actionBarDefaultSubmenuItem), false);
dropDownContainer.setPopupItemsColor(getThemedColor(forceDarkTheme ? Theme.key_voipgroup_actionBarItems : Theme.key_actionBarDefaultSubmenuItem), true);
dropDownContainer.redrawPopup(getThemedColor(forceDarkTheme ? Theme.key_voipgroup_actionBarUnscrolled : Theme.key_actionBarDefaultSubmenuBackground));
Theme.setDrawableColor(dropDownDrawable, getThemedColor(textColor));
}
use of org.telegram.ui.Cells.PhotoAttachCameraCell in project Telegram-FOSS by Telegram-FOSS-Team.
the class ChatAttachAlertPhotoLayout method onShown.
@Override
void onShown() {
isHidden = false;
if (cameraView != null) {
cameraView.setVisibility(VISIBLE);
}
if (cameraIcon != null) {
cameraIcon.setVisibility(VISIBLE);
}
if (cameraView != null) {
int count = gridView.getChildCount();
for (int a = 0; a < count; a++) {
View child = gridView.getChildAt(a);
if (child instanceof PhotoAttachCameraCell) {
child.setVisibility(View.INVISIBLE);
break;
}
}
}
if (checkCameraWhenShown) {
checkCameraWhenShown = false;
checkCamera(true);
}
}
use of org.telegram.ui.Cells.PhotoAttachCameraCell in project Telegram-FOSS by Telegram-FOSS-Team.
the class ChatAttachAlertPhotoLayout method checkCameraViewPosition.
private void checkCameraViewPosition() {
if (Build.VERSION.SDK_INT >= 21) {
if (cameraView != null) {
cameraView.invalidateOutline();
}
RecyclerView.ViewHolder holder = gridView.findViewHolderForAdapterPosition(itemsPerRow - 1);
if (holder != null) {
holder.itemView.invalidateOutline();
}
if (!adapter.needCamera || !deviceHasGoodCamera || selectedAlbumEntry != galleryAlbumEntry) {
holder = gridView.findViewHolderForAdapterPosition(0);
if (holder != null) {
holder.itemView.invalidateOutline();
}
}
}
if (cameraView != null) {
cameraView.invalidate();
}
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M && recordTime != null) {
MarginLayoutParams params = (MarginLayoutParams) recordTime.getLayoutParams();
params.topMargin = (getRootWindowInsets() == null ? AndroidUtilities.dp(16) : getRootWindowInsets().getSystemWindowInsetTop() + AndroidUtilities.dp(2));
}
if (!deviceHasGoodCamera) {
return;
}
int count = gridView.getChildCount();
for (int a = 0; a < count; a++) {
View child = gridView.getChildAt(a);
if (child instanceof PhotoAttachCameraCell) {
if (Build.VERSION.SDK_INT >= 19) {
if (!child.isAttachedToWindow()) {
break;
}
}
float topLocal = child.getY() + gridView.getY() + getY();
float top = topLocal + parentAlert.getSheetContainer().getY();
float left = child.getX() + gridView.getX() + getX() + parentAlert.getSheetContainer().getX();
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
left -= getRootWindowInsets().getSystemWindowInsetLeft();
}
float maxY = (Build.VERSION.SDK_INT >= 21 && !parentAlert.inBubbleMode ? AndroidUtilities.statusBarHeight : 0) + ActionBar.getCurrentActionBarHeight();
float newCameraViewOffsetY;
if (topLocal < maxY) {
newCameraViewOffsetY = maxY - topLocal;
} else {
newCameraViewOffsetY = 0;
}
if (newCameraViewOffsetY != cameraViewOffsetY) {
cameraViewOffsetY = newCameraViewOffsetY;
if (cameraView != null) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
cameraView.invalidateOutline();
} else {
cameraView.invalidate();
}
}
if (cameraIcon != null) {
cameraIcon.invalidate();
}
}
int containerHeight = parentAlert.getSheetContainer().getMeasuredHeight();
maxY = (int) (containerHeight - parentAlert.buttonsRecyclerView.getMeasuredHeight() + parentAlert.buttonsRecyclerView.getTranslationY());
if (topLocal + child.getMeasuredHeight() > maxY) {
cameraViewOffsetBottomY = topLocal + child.getMeasuredHeight() - maxY;
} else {
cameraViewOffsetBottomY = 0;
}
cameraViewLocation[0] = left;
cameraViewLocation[1] = top;
applyCameraViewPosition();
return;
}
}
if (cameraViewOffsetY != 0 || cameraViewOffsetX != 0) {
cameraViewOffsetX = 0;
cameraViewOffsetY = 0;
if (cameraView != null) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
cameraView.invalidateOutline();
} else {
cameraView.invalidate();
}
}
if (cameraIcon != null) {
cameraIcon.invalidate();
}
}
cameraViewLocation[0] = AndroidUtilities.dp(-400);
cameraViewLocation[1] = 0;
applyCameraViewPosition();
}
use of org.telegram.ui.Cells.PhotoAttachCameraCell in project Telegram-FOSS by Telegram-FOSS-Team.
the class ChatAttachAlertPhotoLayout method setTranslationY.
@Override
public void setTranslationY(float translationY) {
if (parentAlert.getSheetAnimationType() == 1) {
float scale = -0.1f * (translationY / 40.0f);
for (int a = 0, N = gridView.getChildCount(); a < N; a++) {
View child = gridView.getChildAt(a);
if (child instanceof PhotoAttachCameraCell) {
PhotoAttachCameraCell cell = (PhotoAttachCameraCell) child;
cell.getImageView().setScaleX(1.0f + scale);
cell.getImageView().setScaleY(1.0f + scale);
} else if (child instanceof PhotoAttachPhotoCell) {
PhotoAttachPhotoCell cell = (PhotoAttachPhotoCell) child;
cell.getCheckBox().setScaleX(1.0f + scale);
cell.getCheckBox().setScaleY(1.0f + scale);
}
}
}
super.setTranslationY(translationY);
parentAlert.getSheetContainer().invalidate();
invalidate();
}
Aggregations