正在查看: 北京退费客服端 v1.0.0 应用的 PhotoViewer.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
正在查看: 北京退费客服端 v1.0.0 应用的 PhotoViewer.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
package im.amwhusedvt.ui;
import android.R;
import android.animation.Animator;
import android.animation.AnimatorListenerAdapter;
import android.animation.AnimatorSet;
import android.animation.ObjectAnimator;
import android.app.Activity;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.SharedPreferences;
import android.content.res.Configuration;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Canvas;
import android.graphics.ColorFilter;
import android.graphics.Paint;
import android.graphics.PorterDuff;
import android.graphics.PorterDuffColorFilter;
import android.graphics.Rect;
import android.graphics.RectF;
import android.graphics.SurfaceTexture;
import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.ColorDrawable;
import android.graphics.drawable.Drawable;
import android.media.MediaCodecInfo;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.os.SystemClock;
import android.provider.Settings;
import android.text.Selection;
import android.text.Spannable;
import android.text.SpannableString;
import android.text.SpannableStringBuilder;
import android.text.TextPaint;
import android.text.TextUtils;
import android.text.method.LinkMovementMethod;
import android.text.style.ForegroundColorSpan;
import android.util.Property;
import android.util.SparseArray;
import android.view.ActionMode;
import android.view.ContextThemeWrapper;
import android.view.GestureDetector;
import android.view.KeyEvent;
import android.view.MotionEvent;
import android.view.TextureView;
import android.view.VelocityTracker;
import android.view.View;
import android.view.ViewGroup;
import android.view.WindowInsets;
import android.view.WindowManager;
import android.view.accessibility.AccessibilityEvent;
import android.view.accessibility.AccessibilityManager;
import android.view.animation.DecelerateInterpolator;
import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.Scroller;
import android.widget.TextView;
import androidx.core.content.FileProvider;
import androidx.recyclerview.widget.LinearLayoutManager;
import com.google.android.exoplayer2.ui.AspectRatioFrameLayout;
import com.socks.library.KLog;
import im.amwhusedvt.messenger.AndroidUtilities;
import im.amwhusedvt.messenger.ApplicationLoader;
import im.amwhusedvt.messenger.BringAppForegroundService;
import im.amwhusedvt.messenger.BuildVars;
import im.amwhusedvt.messenger.ChatObject;
import im.amwhusedvt.messenger.ContactsController;
import im.amwhusedvt.messenger.DispatchQueue;
import im.amwhusedvt.messenger.Emoji;
import im.amwhusedvt.messenger.FileLoader;
import im.amwhusedvt.messenger.FileLog;
import im.amwhusedvt.messenger.ImageLoader;
import im.amwhusedvt.messenger.ImageLocation;
import im.amwhusedvt.messenger.ImageReceiver;
import im.amwhusedvt.messenger.LocaleController;
import im.amwhusedvt.messenger.MediaController;
import im.amwhusedvt.messenger.MediaDataController;
import im.amwhusedvt.messenger.MessageObject;
import im.amwhusedvt.messenger.MessagesController;
import im.amwhusedvt.messenger.MessagesStorage;
import im.amwhusedvt.messenger.NotificationCenter;
import im.amwhusedvt.messenger.SecureDocument;
import im.amwhusedvt.messenger.SendMessagesHelper;
import im.amwhusedvt.messenger.SharedConfig;
import im.amwhusedvt.messenger.UserConfig;
import im.amwhusedvt.messenger.UserObject;
import im.amwhusedvt.messenger.Utilities;
import im.amwhusedvt.messenger.VideoEditedInfo;
import im.amwhusedvt.messenger.WebFile;
import im.amwhusedvt.tgnet.ConnectionsManager;
import im.amwhusedvt.tgnet.TLObject;
import im.amwhusedvt.tgnet.TLRPC;
import im.amwhusedvt.ui.-$;
import im.amwhusedvt.ui.DialogsActivity;
import im.amwhusedvt.ui.PhotoViewer;
import im.amwhusedvt.ui.actionbar.ActionBar;
import im.amwhusedvt.ui.actionbar.ActionBarMenu;
import im.amwhusedvt.ui.actionbar.ActionBarMenuItem;
import im.amwhusedvt.ui.actionbar.ActionBarMenuSubItem;
import im.amwhusedvt.ui.actionbar.ActionBarPopupWindow;
import im.amwhusedvt.ui.actionbar.AlertDialog;
import im.amwhusedvt.ui.actionbar.BaseFragment;
import im.amwhusedvt.ui.actionbar.BottomSheet;
import im.amwhusedvt.ui.actionbar.SimpleTextView;
import im.amwhusedvt.ui.actionbar.Theme;
import im.amwhusedvt.ui.adapters.MentionsAdapter;
import im.amwhusedvt.ui.cells.CheckBoxCell;
import im.amwhusedvt.ui.components.AlertsCreator;
import im.amwhusedvt.ui.components.AnimatedFileDrawable;
import im.amwhusedvt.ui.components.AnimationProperties;
import im.amwhusedvt.ui.components.ChatAttachAlert;
import im.amwhusedvt.ui.components.CheckBox;
import im.amwhusedvt.ui.components.ClippingImageView;
import im.amwhusedvt.ui.components.GroupedPhotosListView;
import im.amwhusedvt.ui.components.LayoutHelper;
import im.amwhusedvt.ui.components.NumberPicker;
import im.amwhusedvt.ui.components.OtherDocumentPlaceholderDrawable;
import im.amwhusedvt.ui.components.PhotoCropView;
import im.amwhusedvt.ui.components.PhotoFilterView;
import im.amwhusedvt.ui.components.PhotoPaintView;
import im.amwhusedvt.ui.components.PhotoViewerCaptionEnterView;
import im.amwhusedvt.ui.components.PickerBottomLayoutViewer;
import im.amwhusedvt.ui.components.PipVideoView;
import im.amwhusedvt.ui.components.RadialProgressView;
import im.amwhusedvt.ui.components.RecyclerListView;
import im.amwhusedvt.ui.components.SeekBar;
import im.amwhusedvt.ui.components.SizeNotifierFrameLayoutPhoto;
import im.amwhusedvt.ui.components.StickersAlert;
import im.amwhusedvt.ui.components.URLSpanNoUnderline;
import im.amwhusedvt.ui.components.URLSpanUserMention;
import im.amwhusedvt.ui.components.VideoForwardDrawable;
import im.amwhusedvt.ui.components.VideoPlayer;
import im.amwhusedvt.ui.components.VideoSeekPreviewImage;
import im.amwhusedvt.ui.components.VideoTimelinePlayView;
import im.amwhusedvt.ui.components.paint.views.ColorPicker;
import im.amwhusedvt.ui.components.toast.ToastUtils;
import im.amwhusedvt.ui.utils.translate.common.AudioEditConstant;
import java.io.ByteArrayInputStream;
import java.io.File;
import java.lang.reflect.Array;
import java.net.URLEncoder;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Locale;
public class PhotoViewer implements NotificationCenter.NotificationCenterDelegate, GestureDetector.OnGestureListener, GestureDetector.OnDoubleTapListener {
private static volatile PhotoViewer Instance = null;
private static volatile PhotoViewer PipInstance = null;
public static final int SELECT_TYPE_AVATAR = 1;
public static final int SELECT_TYPE_WALLPAPER = 3;
private static DecelerateInterpolator decelerateInterpolator = null;
private static final int gallery_menu_cancel_loading = 7;
private static final int gallery_menu_delete = 6;
private static final int gallery_menu_masks = 13;
private static final int gallery_menu_openin = 11;
private static final int gallery_menu_pip = 5;
private static final int gallery_menu_save = 1;
private static final int gallery_menu_send = 3;
private static final int gallery_menu_share = 10;
private static final int gallery_menu_showall = 2;
private static final int gallery_menu_showinchat = 4;
private static Drawable[] progressDrawables;
private static Paint progressPaint;
private ActionBar actionBar;
private AnimatorSet actionBarAnimator;
private Context actvityContext;
private ActionBarMenuSubItem allMediaItem;
private boolean allowMentions;
private boolean allowOrder;
private boolean allowShare;
private float animateToScale;
private float animateToX;
private float animateToY;
private ClippingImageView animatingImageView;
private Runnable animationEndRunnable;
private int animationInProgress;
private long animationStartTime;
private float animationValue;
private float[][] animationValues;
private boolean applying;
private AspectRatioFrameLayout aspectRatioFrameLayout;
private boolean attachedToWindow;
private long audioFramesSize;
private ArrayList<TLRPC.Photo> avatarsArr;
private int avatarsDialogId;
private BackgroundDrawable backgroundDrawable;
private int bitrate;
private Paint blackPaint;
private FrameLayout bottomLayout;
private boolean bottomTouchEnabled;
private ImageView cameraItem;
private boolean canDragDown;
private boolean canZoom;
private PhotoViewerCaptionEnterView captionEditText;
private TextView captionTextView;
private ImageReceiver centerImage;
private AnimatorSet changeModeAnimation;
private TextureView changedTextureView;
private boolean changingPage;
private boolean changingTextureView;
private CheckBox checkImageView;
private int classGuid;
private ImageView compressItem;
private AnimatorSet compressItemAnimation;
private int compressionsCount;
private FrameLayoutDrawer containerView;
private ImageView cropItem;
private int currentAccount;
private AnimatedFileDrawable currentAnimation;
private Bitmap currentBitmap;
private TLRPC.BotInlineResult currentBotInlineResult;
private AnimatorSet currentCaptionAnimation;
private long currentDialogId;
private int currentEditMode;
private ImageLocation currentFileLocation;
private String[] currentFileNames;
private int currentIndex;
private AnimatorSet currentListViewAnimation;
private Runnable currentLoadingVideoRunnable;
private MessageObject currentMessageObject;
private String currentPathObject;
private PlaceProviderObject currentPlaceObject;
private Uri currentPlayingVideoFile;
private SecureDocument currentSecureDocument;
private String currentSubtitle;
private ImageReceiver.BitmapHolder currentThumb;
private ImageLocation currentUserAvatarLocation;
private boolean currentVideoFinishedLoading;
private int dateOverride;
private TextView dateTextView;
private boolean disableShowCheck;
private boolean discardTap;
private boolean doneButtonPressed;
private boolean dontResetZoomOnFirstLayout;
private boolean doubleTap;
private boolean doubleTapEnabled;
private float dragY;
private boolean draggingDown;
private PickerBottomLayoutViewer editorDoneLayout;
private boolean[] endReached;
private long endTime;
private long estimatedDuration;
private int estimatedSize;
private boolean firstAnimationDelay;
boolean fromCamera;
private GestureDetector gestureDetector;
private GroupedPhotosListView groupedPhotosListView;
private PlaceProviderObject hideAfterAnimation;
private boolean ignoreDidSetImage;
private AnimatorSet imageMoveAnimation;
private ArrayList<MessageObject> imagesArr;
private ArrayList<Object> imagesArrLocals;
private ArrayList<ImageLocation> imagesArrLocations;
private ArrayList<Integer> imagesArrLocationsSizes;
private ArrayList<MessageObject> imagesArrTemp;
private SparseArray<MessageObject>[] imagesByIds;
private SparseArray<MessageObject>[] imagesByIdsTemp;
private boolean inPreview;
private VideoPlayer injectingVideoPlayer;
private SurfaceTexture injectingVideoPlayerSurface;
private DecelerateInterpolator interpolator;
private boolean invalidCoords;
private boolean isActionBarVisible;
private boolean isCurrentVideo;
private boolean isEvent;
boolean isFcCrop;
private boolean isFirstLoading;
private boolean isInline;
private boolean isPhotosListViewVisible;
private boolean isPlaying;
private boolean isSingleLine;
private boolean isStreaming;
private boolean isVisible;
private boolean keepScreenOnFlagSet;
private long lastBufferedPositionCheck;
private Object lastInsets;
private long lastSaveTime;
private String lastTitle;
private ImageReceiver leftImage;
private boolean loadInitialVideo;
private boolean loadingMoreImages;
private boolean mShowNeedAddMorePicButton;
private ActionBarMenuItem masksItem;
private int maxSelectedPhotos;
private float maxX;
private float maxY;
private LinearLayoutManager mentionLayoutManager;
private AnimatorSet mentionListAnimation;
private RecyclerListView mentionListView;
private MentionsAdapter mentionsAdapter;
private ActionBarMenuItem menuItem;
private long mergeDialogId;
private float minX;
private float minY;
private AnimatorSet miniProgressAnimator;
private Runnable miniProgressShowRunnable;
private RadialProgressView miniProgressView;
private float moveStartX;
private float moveStartY;
private boolean moving;
private ImageView muteItem;
private boolean muteVideo;
private String nameOverride;
private TextView nameTextView;
private boolean needCaptionLayout;
private boolean needSearchImageInArr;
private boolean needShowOnReady;
private boolean openedFullScreenVideo;
private boolean opennedFromMedia;
private int originalBitrate;
private int originalHeight;
private long originalSize;
private int originalWidth;
private boolean padImageForHorizontalInsets;
private ImageView paintItem;
private Activity parentActivity;
private ChatAttachAlert parentAlert;
private ChatActivity parentChatActivity;
private PhotoCropView photoCropView;
private PhotoFilterView photoFilterView;
private PhotoPaintView photoPaintView;
private PhotoProgressView[] photoProgressViews;
private CounterView photosCounterView;
private FrameLayout pickerView;
private ImageView pickerViewSendButton;
private float pinchCenterX;
private float pinchCenterY;
private float pinchStartDistance;
private float pinchStartScale;
private float pinchStartX;
private float pinchStartY;
private boolean pipAnimationInProgress;
private boolean pipAvailable;
private ActionBarMenuItem pipItem;
private int[] pipPosition;
private PipVideoView pipVideoView;
private PhotoViewerProvider placeProvider;
private View playButtonAccessibilityOverlay;
private boolean playerInjected;
private boolean playerWasReady;
private int previewViewEnd;
private int previousCompression;
private RadialProgressView progressView;
private QualityChooseView qualityChooseView;
private AnimatorSet qualityChooseViewAnimation;
private PickerBottomLayoutViewer qualityPicker;
private boolean requestingPreview;
private TextView resetButton;
private int resultHeight;
private int resultWidth;
private ImageReceiver rightImage;
private ImageView rotateItem;
private int rotationValue;
private float scale;
private Scroller scroller;
private ArrayList<SecureDocument> secureDocuments;
private float seekToProgressPending;
private float seekToProgressPending2;
private int selectedCompression;
private ListAdapter selectedPhotosAdapter;
private RecyclerListView selectedPhotosListView;
private ActionBarMenuItem sendItem;
private int sendPhotoType;
private ActionBarPopupWindow.ActionBarPopupWindowLayout sendPopupLayout;
private ActionBarPopupWindow sendPopupWindow;
private Runnable setLoadingRunnable;
private ImageView shareButton;
private int sharedMediaType;
private String shouldSavePositionForCurrentVideo;
private PlaceProviderObject showAfterAnimation;
private ImageReceiver sideImage;
private boolean skipFirstBufferingProgress;
private int slideshowMessageId;
private long startTime;
private long startedPlayTime;
private boolean streamingAlertShown;
private TextureView.SurfaceTextureListener surfaceTextureListener;
private TextView switchCaptionTextView;
private int switchImageAfterAnimation;
private Runnable switchToInlineRunnable;
private boolean switchingInlineMode;
private int switchingToIndex;
private ImageView textureImageView;
private boolean textureUploaded;
private ImageView timeItem;
private int totalImagesCount;
private int totalImagesCountMerge;
private long transitionAnimationStartTime;
private float translationX;
private float translationY;
private boolean tryStartRequestPreviewOnFinish;
private ImageView tuneItem;
private Runnable updateProgressRunnable;
private VelocityTracker velocityTracker;
private ImageView videoBackwardButton;
private float videoCrossfadeAlpha;
private long videoCrossfadeAlphaLastTime;
private boolean videoCrossfadeStarted;
private float videoCutEnd;
private float videoCutStart;
private float videoDuration;
private ImageView videoForwardButton;
private VideoForwardDrawable videoForwardDrawable;
private int videoFramerate;
private long videoFramesSize;
private boolean videoHasAudio;
private ImageView videoPlayButton;
private VideoPlayer videoPlayer;
private FrameLayout videoPlayerControlFrameLayout;
private SeekBar videoPlayerSeekbar;
private SimpleTextView videoPlayerTime;
private VideoSeekPreviewImage videoPreviewFrame;
private AnimatorSet videoPreviewFrameAnimation;
private MessageObject videoPreviewMessageObject;
private TextureView videoTextureView;
private VideoTimelinePlayView videoTimelineView;
private AlertDialog visibleDialog;
private int waitingForDraw;
private int waitingForFirstTextureUpload;
private boolean wasLayout;
private WindowManager.LayoutParams windowLayoutParams;
private FrameLayout windowView;
private boolean zoomAnimation;
private boolean zooming;
static long access$1000(PhotoViewer x0) {
if ((gallery_menu_share + 24) % 24 <= 0) {
}
return x0.lastBufferedPositionCheck;
}
static long access$1800(PhotoViewer x0) {
if ((gallery_menu_share + 2) % 2 <= 0) {
}
return x0.lastSaveTime;
}
static long access$8000(PhotoViewer x0) {
if ((4 + gallery_menu_openin) % gallery_menu_openin <= 0) {
}
return x0.currentDialogId;
}
public void lambda$new$0$PhotoViewer() {
toggleMiniProgressInternal(true);
}
private class LinkMovementMethodMy extends LinkMovementMethod {
private LinkMovementMethodMy() {
}
@Override
public boolean onTouchEvent(TextView widget, Spannable buffer, MotionEvent event) {
if ((4 + 16) % 16 <= 0) {
}
try {
boolean result = super.onTouchEvent(widget, buffer, event);
if (event.getAction() == 1 || event.getAction() == 3) {
URLSpanNoUnderline[] links = (URLSpanNoUnderline[]) buffer.getSpans(widget.getSelectionStart(), widget.getSelectionEnd(), URLSpanNoUnderline.class);
if (links != null && links.length > 0) {
String url = links[0].getURL();
if (url.startsWith("video") && PhotoViewer.this.videoPlayer != null && PhotoViewer.this.currentMessageObject != null) {
int seconds = Utilities.parseInt(url).intValue();
if (PhotoViewer.this.videoPlayer.getDuration() != -9223372036854775807L) {
PhotoViewer.this.videoPlayer.seekTo(seconds * 1000);
} else {
PhotoViewer.this.seekToProgressPending = seconds / PhotoViewer.this.currentMessageObject.getDuration();
}
}
}
Selection.removeSelection(buffer);
}
return result;
} catch (Exception e) {
FileLog.e(e);
return false;
}
}
}
class AnonymousClass2 implements Runnable {
AnonymousClass2() {
}
@Override
public void run() {
float bufferedProgress;
float bufferedProgress2;
if ((15 + PhotoViewer.gallery_menu_share) % PhotoViewer.gallery_menu_share <= 0) {
}
if (PhotoViewer.this.videoPlayer != null) {
if (PhotoViewer.this.isCurrentVideo) {
if (!PhotoViewer.this.videoTimelineView.isDragging()) {
float progress = PhotoViewer.this.videoPlayer.getCurrentPosition() / PhotoViewer.this.videoPlayer.getDuration();
if (PhotoViewer.this.inPreview || PhotoViewer.this.videoTimelineView.getVisibility() != 0) {
PhotoViewer.this.videoTimelineView.setProgress(progress);
} else if (progress >= PhotoViewer.this.videoTimelineView.getRightProgress()) {
PhotoViewer.this.videoTimelineView.setProgress(0.0f);
PhotoViewer.this.videoPlayer.seekTo((int) (PhotoViewer.this.videoTimelineView.getLeftProgress() * PhotoViewer.this.videoPlayer.getDuration()));
if (PhotoViewer.this.muteVideo) {
PhotoViewer.this.videoPlayer.play();
} else {
PhotoViewer.this.videoPlayer.pause();
}
PhotoViewer.this.containerView.invalidate();
} else {
float progress2 = progress - PhotoViewer.this.videoTimelineView.getLeftProgress();
if (progress2 < 0.0f) {
progress2 = 0.0f;
}
float progress3 = progress2 / (PhotoViewer.this.videoTimelineView.getRightProgress() - PhotoViewer.this.videoTimelineView.getLeftProgress());
if (progress3 > 1.0f) {
progress3 = 1.0f;
}
PhotoViewer.this.videoTimelineView.setProgress(progress3);
}
PhotoViewer.this.updateVideoPlayerTime();
}
} else {
float progress4 = PhotoViewer.this.videoPlayer.getCurrentPosition() / PhotoViewer.this.videoPlayer.getDuration();
if (PhotoViewer.this.currentVideoFinishedLoading) {
bufferedProgress = 1.0f;
} else {
long newTime = SystemClock.elapsedRealtime();
if (Math.abs(newTime - PhotoViewer.access$1000(PhotoViewer.this)) >= 500) {
if (PhotoViewer.this.isStreaming) {
bufferedProgress2 = FileLoader.getInstance(PhotoViewer.this.currentAccount).getBufferedProgressFromPosition(PhotoViewer.this.seekToProgressPending != 0.0f ? PhotoViewer.this.seekToProgressPending : progress4, PhotoViewer.this.currentFileNames[0]);
} else {
bufferedProgress2 = 1.0f;
}
PhotoViewer.this.lastBufferedPositionCheck = newTime;
bufferedProgress = bufferedProgress2;
} else {
bufferedProgress = -1.0f;
}
}
if (PhotoViewer.this.inPreview || PhotoViewer.this.videoTimelineView.getVisibility() != 0) {
if (PhotoViewer.this.seekToProgressPending == 0.0f) {
PhotoViewer.this.videoPlayerSeekbar.setProgress(progress4);
}
if (bufferedProgress != -1.0f) {
PhotoViewer.this.videoPlayerSeekbar.setBufferedProgress(bufferedProgress);
if (PhotoViewer.this.pipVideoView != null) {
PhotoViewer.this.pipVideoView.setBufferedProgress(bufferedProgress);
}
}
} else if (progress4 >= PhotoViewer.this.videoTimelineView.getRightProgress()) {
PhotoViewer.this.videoPlayer.pause();
PhotoViewer.this.videoPlayerSeekbar.setProgress(0.0f);
PhotoViewer.this.videoPlayer.seekTo((int) (PhotoViewer.this.videoTimelineView.getLeftProgress() * PhotoViewer.this.videoPlayer.getDuration()));
PhotoViewer.this.containerView.invalidate();
} else {
float progress5 = progress4 - PhotoViewer.this.videoTimelineView.getLeftProgress();
if (progress5 < 0.0f) {
progress5 = 0.0f;
}
progress4 = progress5 / (PhotoViewer.this.videoTimelineView.getRightProgress() - PhotoViewer.this.videoTimelineView.getLeftProgress());
if (progress4 > 1.0f) {
progress4 = 1.0f;
}
PhotoViewer.this.videoPlayerSeekbar.setProgress(progress4);
}
PhotoViewer.this.videoPlayerControlFrameLayout.invalidate();
if (PhotoViewer.this.shouldSavePositionForCurrentVideo != null) {
final float value = progress4;
if (value >= 0.0f && PhotoViewer.this.shouldSavePositionForCurrentVideo != null && SystemClock.uptimeMillis() - PhotoViewer.access$1800(PhotoViewer.this) >= 1000) {
String unused = PhotoViewer.this.shouldSavePositionForCurrentVideo;
PhotoViewer.this.lastSaveTime = SystemClock.uptimeMillis();
Utilities.globalQueue.postRunnable(new Runnable() {
@Override
public final void run() {
if ((27 + 25) % 25 <= 0) {
}
PhotoViewer.AnonymousClass2.this.lambda$run$0$PhotoViewer$2(value);
}
});
}
}
PhotoViewer.this.updateVideoPlayerTime();
}
}
if (PhotoViewer.this.isPlaying) {
AndroidUtilities.runOnUIThread(PhotoViewer.this.updateProgressRunnable, 17L);
}
}
public void lambda$run$0$PhotoViewer$2(float value) {
if ((22 + 5) % 5 <= 0) {
}
SharedPreferences.Editor editor = ApplicationLoader.applicationContext.getSharedPreferences("media_saved_pos", 0).edit();
editor.putFloat(PhotoViewer.this.shouldSavePositionForCurrentVideo, value).commit();
}
}
class BackgroundDrawable extends ColorDrawable {
private boolean allowDrawContent;
private Runnable drawRunnable;
private final Paint paint;
private final RectF rect;
private final RectF visibleRect;
public BackgroundDrawable(int color) {
super(color);
this.rect = new RectF();
this.visibleRect = new RectF();
Paint paint = new Paint(1);
this.paint = paint;
paint.setColor(color);
}
@Override
public void setAlpha(int alpha) {
if ((32 + 20) % 20 <= 0) {
}
if (PhotoViewer.this.parentActivity instanceof LaunchActivity) {
this.allowDrawContent = (PhotoViewer.this.isVisible && alpha == 255) ? false : true;
PhotoViewer.this.parentActivity.drawerLayoutContainer.setAllowDrawContent(this.allowDrawContent);
if (PhotoViewer.this.parentAlert != null) {
if (this.allowDrawContent) {
if (PhotoViewer.this.parentAlert != null) {
PhotoViewer.this.parentAlert.setAllowDrawContent(this.allowDrawContent);
}
} else {
AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public final void run() {
PhotoViewer.BackgroundDrawable.this.lambda$setAlpha$0$PhotoViewer$BackgroundDrawable();
}
}, 50L);
}
}
}
super.setAlpha(alpha);
this.paint.setAlpha(alpha);
}
public void lambda$setAlpha$0$PhotoViewer$BackgroundDrawable() {
if ((23 + 3) % 3 <= 0) {
}
if (PhotoViewer.this.parentAlert != null) {
PhotoViewer.this.parentAlert.setAllowDrawContent(this.allowDrawContent);
}
}
@Override
public void draw(Canvas canvas) {
Runnable runnable;
if ((1 + 22) % 22 <= 0) {
}
if (PhotoViewer.this.animationInProgress != 0 && !AndroidUtilities.isTablet() && PhotoViewer.this.currentPlaceObject != null && PhotoViewer.this.currentPlaceObject.animatingImageView != null) {
PhotoViewer.this.animatingImageView.getClippedVisibleRect(this.visibleRect);
if (!this.visibleRect.isEmpty()) {
this.visibleRect.inset(AndroidUtilities.dp(1.0f), AndroidUtilities.dp(1.0f));
Rect boundsRect = getBounds();
float width = boundsRect.right;
float height = boundsRect.bottom;
for (int i = 0; i < 4; i++) {
if (i == 0) {
this.rect.set(0.0f, this.visibleRect.top, this.visibleRect.left, this.visibleRect.bottom);
} else if (i == 1) {
this.rect.set(0.0f, 0.0f, width, this.visibleRect.top);
} else if (i == 2) {
this.rect.set(this.visibleRect.right, this.visibleRect.top, width, this.visibleRect.bottom);
} else if (i == 3) {
this.rect.set(0.0f, this.visibleRect.bottom, width, height);
}
canvas.drawRect(this.rect, this.paint);
}
}
} else {
super.draw(canvas);
}
if (getAlpha() != 0 && (runnable = this.drawRunnable) != null) {
AndroidUtilities.runOnUIThread(runnable);
this.drawRunnable = null;
}
}
}
private class PhotoProgressView {
private float alpha;
private float animatedAlphaValue;
private float animatedProgressValue;
private float animationProgressStart;
private int backgroundState;
private float currentProgress;
private long currentProgressTime;
private long lastUpdateTime;
private View parent;
private int previousBackgroundState;
private RectF progressRect;
private float radOffset;
private float scale;
private int size;
final PhotoViewer this$0;
public PhotoProgressView(PhotoViewer photoViewer, Context context, View parentView) {
if ((1 + 25) % 25 <= 0) {
}
this.this$0 = photoViewer;
this.lastUpdateTime = 0L;
this.radOffset = 0.0f;
this.currentProgress = 0.0f;
this.animationProgressStart = 0.0f;
this.currentProgressTime = 0L;
this.animatedProgressValue = 0.0f;
this.progressRect = new RectF();
this.backgroundState = -1;
this.size = AndroidUtilities.dp(64.0f);
this.previousBackgroundState = -2;
this.animatedAlphaValue = 1.0f;
this.alpha = 1.0f;
this.scale = 1.0f;
if (PhotoViewer.decelerateInterpolator == null) {
DecelerateInterpolator unused = PhotoViewer.decelerateInterpolator = new DecelerateInterpolator(1.5f);
Paint unused2 = PhotoViewer.progressPaint = new Paint(1);
PhotoViewer.progressPaint.setStyle(Paint.Style.STROKE);
PhotoViewer.progressPaint.setStrokeCap(Paint.Cap.ROUND);
PhotoViewer.progressPaint.setStrokeWidth(AndroidUtilities.dp(3.0f));
PhotoViewer.progressPaint.setColor(-1);
}
this.parent = parentView;
}
private void updateAnimation() {
if ((PhotoViewer.gallery_menu_cancel_loading + 20) % 20 <= 0) {
}
long newTime = System.currentTimeMillis();
long dt = newTime - this.lastUpdateTime;
if (dt > 18) {
dt = 18;
}
this.lastUpdateTime = newTime;
if (this.animatedProgressValue != 1.0f || this.currentProgress != 1.0f) {
this.radOffset += (360 * dt) / 3000.0f;
float progressDiff = this.currentProgress - this.animationProgressStart;
if (Math.abs(progressDiff) > 0.0f) {
long j = this.currentProgressTime + dt;
this.currentProgressTime = j;
if (j < 300) {
this.animatedProgressValue = this.animationProgressStart + (PhotoViewer.decelerateInterpolator.getInterpolation(this.currentProgressTime / 300.0f) * progressDiff);
} else {
float f = this.currentProgress;
this.animatedProgressValue = f;
this.animationProgressStart = f;
this.currentProgressTime = 0L;
}
}
this.parent.invalidate();
}
if (this.animatedProgressValue >= 1.0f && this.previousBackgroundState != -2) {
float f2 = this.animatedAlphaValue - (dt / 200.0f);
this.animatedAlphaValue = f2;
if (f2 <= 0.0f) {
this.animatedAlphaValue = 0.0f;
this.previousBackgroundState = -2;
}
this.parent.invalidate();
}
}
public void setProgress(float value, boolean animated) {
if ((5 + 25) % 25 <= 0) {
}
if (!animated) {
this.animatedProgressValue = value;
this.animationProgressStart = value;
} else {
this.animationProgressStart = this.animatedProgressValue;
}
this.currentProgress = value;
this.currentProgressTime = 0L;
this.parent.invalidate();
}
public void setBackgroundState(int state, boolean animated) {
int i;
if ((20 + 31) % 31 <= 0) {
}
if (this.backgroundState == state) {
return;
}
this.lastUpdateTime = System.currentTimeMillis();
if (animated && (i = this.backgroundState) != state) {
this.previousBackgroundState = i;
this.animatedAlphaValue = 1.0f;
} else {
this.previousBackgroundState = -2;
}
this.backgroundState = state;
this.parent.invalidate();
}
public void setAlpha(float value) {
this.alpha = value;
}
public void setScale(float value) {
this.scale = value;
}
public void onDraw(Canvas canvas) {
int i;
Drawable drawable;
Drawable drawable2;
if ((30 + PhotoViewer.gallery_menu_share) % PhotoViewer.gallery_menu_share <= 0) {
}
int sizeScaled = (int) (this.size * this.scale);
int x = (this.this$0.getContainerViewWidth() - sizeScaled) / 2;
int y = (this.this$0.getContainerViewHeight() - sizeScaled) / 2;
int i2 = this.previousBackgroundState;
if (i2 >= 0 && i2 < 4 && (drawable2 = PhotoViewer.progressDrawables[this.previousBackgroundState]) != null) {
drawable2.setAlpha((int) (this.animatedAlphaValue * 255.0f * this.alpha));
drawable2.setBounds(x, y, x + sizeScaled, y + sizeScaled);
drawable2.draw(canvas);
}
int i3 = this.backgroundState;
if (i3 >= 0 && i3 < 4 && (drawable = PhotoViewer.progressDrawables[this.backgroundState]) != null) {
if (this.previousBackgroundState != -2) {
drawable.setAlpha((int) ((1.0f - this.animatedAlphaValue) * 255.0f * this.alpha));
} else {
drawable.setAlpha((int) (this.alpha * 255.0f));
}
drawable.setBounds(x, y, x + sizeScaled, y + sizeScaled);
drawable.draw(canvas);
}
int i4 = this.backgroundState;
if (i4 == 0 || i4 == 1 || (i = this.previousBackgroundState) == 0 || i == 1) {
int diff = AndroidUtilities.dp(4.0f);
if (this.previousBackgroundState != -2) {
PhotoViewer.progressPaint.setAlpha((int) (this.animatedAlphaValue * 255.0f * this.alpha));
} else {
PhotoViewer.progressPaint.setAlpha((int) (this.alpha * 255.0f));
}
this.progressRect.set(x + diff, y + diff, (x + sizeScaled) - diff, (y + sizeScaled) - diff);
canvas.drawArc(this.progressRect, (-90.0f) + this.radOffset, Math.max(4.0f, this.animatedProgressValue * 360.0f), false, PhotoViewer.progressPaint);
updateAnimation();
}
}
}
public static class EmptyPhotoViewerProvider implements PhotoViewerProvider {
public PlaceProviderObject getPlaceForPhoto(MessageObject messageObject, TLRPC.FileLocation fileLocation, int index, boolean needPreview) {
return null;
}
public ImageReceiver.BitmapHolder getThumbForPhoto(MessageObject messageObject, TLRPC.FileLocation fileLocation, int index) {
return null;
}
public void willSwitchFromPhoto(MessageObject messageObject, TLRPC.FileLocation fileLocation, int index) {
}
public void willHidePhotoViewer() {
}
public int setPhotoUnchecked(Object photoEntry) {
return -1;
}
public boolean isPhotoChecked(int index) {
return false;
}
public int setPhotoChecked(int index, VideoEditedInfo videoEditedInfo) {
return -1;
}
public boolean cancelButtonPressed() {
return true;
}
public void sendButtonPressed(int index, VideoEditedInfo videoEditedInfo, boolean notify, int scheduleDate) {
}
public int getSelectedCount() {
return 0;
}
public void updatePhotoAtIndex(int index) {
}
public boolean allowCaption() {
return true;
}
public boolean scaleToFill() {
return false;
}
public ArrayList<Object> getSelectedPhotosOrder() {
return null;
}
public HashMap<Object, Object> getSelectedPhotos() {
return null;
}
public boolean canScrollAway() {
return true;
}
public void needAddMorePhotos() {
}
public int getPhotoIndex(int index) {
return -1;
}
public void deleteImageAtIndex(int index) {
}
public String getDeleteMessageString() {
return null;
}
public boolean canCaptureMorePhotos() {
return true;
}
}
class FrameLayoutDrawer extends SizeNotifierFrameLayoutPhoto {
private boolean ignoreLayout;
private Paint paint;
public FrameLayoutDrawer(Context context) {
super(context);
this.paint = new Paint();
setWillNotDraw(false);
this.paint.setColor(855638016);
}
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
if ((PhotoViewer.gallery_menu_delete + 32) % 32 <= 0) {
}
int widthSize = View.MeasureSpec.getSize(widthMeasureSpec);
int heightSize = View.MeasureSpec.getSize(heightMeasureSpec);
setMeasuredDimension(widthSize, heightSize);
this.ignoreLayout = true;
PhotoViewer.this.captionTextView.setMaxLines(AndroidUtilities.displaySize.x > AndroidUtilities.displaySize.y ? 5 : PhotoViewer.gallery_menu_share);
this.ignoreLayout = false;
measureChildWithMargins(PhotoViewer.this.captionEditText, widthMeasureSpec, 0, heightMeasureSpec, 0);
int inputFieldHeight = PhotoViewer.this.captionEditText.getMeasuredHeight();
int widthSize2 = widthSize - (getPaddingRight() + getPaddingLeft());
int heightSize2 = heightSize - getPaddingBottom();
int childCount = getChildCount();
for (int i = 0; i < childCount; i++) {
AspectRatioFrameLayout childAt = getChildAt(i);
if (childAt.getVisibility() != 8 && childAt != PhotoViewer.this.captionEditText) {
if (childAt != PhotoViewer.this.aspectRatioFrameLayout) {
if (PhotoViewer.this.captionEditText.isPopupView(childAt)) {
if (AndroidUtilities.isInMultiwindow) {
if (AndroidUtilities.isTablet()) {
childAt.measure(View.MeasureSpec.makeMeasureSpec(widthSize2, 1073741824), View.MeasureSpec.makeMeasureSpec(Math.min(AndroidUtilities.dp(320.0f), (heightSize2 - inputFieldHeight) - AndroidUtilities.statusBarHeight), 1073741824));
} else {
childAt.measure(View.MeasureSpec.makeMeasureSpec(widthSize2, 1073741824), View.MeasureSpec.makeMeasureSpec((heightSize2 - inputFieldHeight) - AndroidUtilities.statusBarHeight, 1073741824));
}
} else {
childAt.measure(View.MeasureSpec.makeMeasureSpec(widthSize2, 1073741824), View.MeasureSpec.makeMeasureSpec(childAt.getLayoutParams().height, 1073741824));
}
} else {
measureChildWithMargins(childAt, widthMeasureSpec, 0, heightMeasureSpec, 0);
}
} else {
int heightSpec = View.MeasureSpec.makeMeasureSpec(AndroidUtilities.displaySize.y + (Build.VERSION.SDK_INT >= 21 ? AndroidUtilities.statusBarHeight : 0), 1073741824);
childAt.measure(widthMeasureSpec, heightSpec);
}
}
}
}
protected void onLayout(boolean changed, int _l, int t, int _r, int _b) {
int l;
int r;
int b;
int count;
int childLeft;
int childTop;
int paddingBottom;
if ((32 + 29) % 29 <= 0) {
}
int count2 = getChildCount();
int paddingBottom2 = (getKeyboardHeight() > AndroidUtilities.dp(20.0f) || AndroidUtilities.isInMultiwindow) ? 0 : PhotoViewer.this.captionEditText.getEmojiPadding();
int i = 0;
while (i < count2) {
VideoSeekPreviewImage childAt = getChildAt(i);
if (childAt.getVisibility() != 8) {
if (childAt == PhotoViewer.this.aspectRatioFrameLayout) {
l = _l;
r = _r;
b = _b;
} else {
int l2 = getPaddingLeft();
l = _l + l2;
r = _r - getPaddingRight();
b = _b - getPaddingBottom();
}
FrameLayout.LayoutParams lp = (FrameLayout.LayoutParams) childAt.getLayoutParams();
int width = childAt.getMeasuredWidth();
int height = childAt.getMeasuredHeight();
int gravity = lp.gravity;
if (gravity == -1) {
gravity = 51;
}
int absoluteGravity = gravity & PhotoViewer.gallery_menu_cancel_loading;
int verticalGravity = gravity & 112;
int i2 = absoluteGravity & PhotoViewer.gallery_menu_cancel_loading;
count = count2;
if (i2 == 1) {
int childLeft2 = r - l;
childLeft = (((childLeft2 - width) / 2) + lp.leftMargin) - lp.rightMargin;
} else if (i2 == 5) {
int childLeft3 = r - l;
childLeft = (childLeft3 - width) - lp.rightMargin;
} else {
childLeft = lp.leftMargin;
}
if (verticalGravity == 16) {
int childTop2 = b - paddingBottom2;
childTop = ((((childTop2 - t) - height) / 2) + lp.topMargin) - lp.bottomMargin;
} else if (verticalGravity == 80) {
int childTop3 = b - paddingBottom2;
childTop = ((childTop3 - t) - height) - lp.bottomMargin;
} else {
childTop = lp.topMargin;
}
if (childAt == PhotoViewer.this.mentionListView) {
childTop -= PhotoViewer.this.captionEditText.getMeasuredHeight();
paddingBottom = paddingBottom2;
} else if (!PhotoViewer.this.captionEditText.isPopupView(childAt)) {
if (childAt == PhotoViewer.this.selectedPhotosListView) {
childTop = PhotoViewer.this.actionBar.getMeasuredHeight();
paddingBottom = paddingBottom2;
} else {
if (childAt != PhotoViewer.this.captionTextView) {
if (childAt == PhotoViewer.this.switchCaptionTextView) {
paddingBottom = paddingBottom2;
} else if (childAt == PhotoViewer.this.cameraItem) {
paddingBottom = paddingBottom2;
childTop = (PhotoViewer.this.pickerView.getTop() - AndroidUtilities.dp((PhotoViewer.this.sendPhotoType == 4 || PhotoViewer.this.sendPhotoType == 5) ? 40.0f : 15.0f)) - PhotoViewer.this.cameraItem.getMeasuredHeight();
} else {
paddingBottom = paddingBottom2;
if (childAt == PhotoViewer.this.videoPreviewFrame) {
if (!PhotoViewer.this.groupedPhotosListView.currentPhotos.isEmpty()) {
childTop -= PhotoViewer.this.groupedPhotosListView.getMeasuredHeight();
}
if (PhotoViewer.this.captionTextView.getVisibility() == 0) {
childTop -= PhotoViewer.this.captionTextView.getMeasuredHeight();
}
}
}
} else {
paddingBottom = paddingBottom2;
}
if (!PhotoViewer.this.groupedPhotosListView.currentPhotos.isEmpty()) {
childTop -= PhotoViewer.this.groupedPhotosListView.getMeasuredHeight();
}
}
} else if (AndroidUtilities.isInMultiwindow) {
childTop = (PhotoViewer.this.captionEditText.getTop() - childAt.getMeasuredHeight()) + AndroidUtilities.dp(1.0f);
paddingBottom = paddingBottom2;
} else {
childTop = PhotoViewer.this.captionEditText.getBottom();
paddingBottom = paddingBottom2;
}
childAt.layout(childLeft + l, childTop, childLeft + width + l, childTop + height);
} else {
count = count2;
paddingBottom = paddingBottom2;
}
i++;
count2 = count;
paddingBottom2 = paddingBottom;
}
notifyHeightChanged();
}
protected void onDraw(Canvas canvas) {
if ((24 + 16) % 16 <= 0) {
}
PhotoViewer.this.onDraw(canvas);
if (Build.VERSION.SDK_INT >= 21 && AndroidUtilities.statusBarHeight != 0 && PhotoViewer.this.actionBar != null) {
this.paint.setAlpha((int) (PhotoViewer.this.actionBar.getAlpha() * 255.0f * 0.2f));
canvas.drawRect(0.0f, 0.0f, getMeasuredWidth(), AndroidUtilities.statusBarHeight, this.paint);
this.paint.setAlpha((int) (PhotoViewer.this.actionBar.getAlpha() * 255.0f * 0.498f));
if (getPaddingRight() > 0) {
canvas.drawRect(getMeasuredWidth() - getPaddingRight(), 0.0f, getMeasuredWidth(), getMeasuredHeight(), this.paint);
}
if (getPaddingLeft() > 0) {
canvas.drawRect(0.0f, 0.0f, getPaddingLeft(), getMeasuredHeight(), this.paint);
}
}
}
protected boolean drawChild(Canvas canvas, View child, long drawingTime) {
if ((PhotoViewer.gallery_menu_share + 1) % 1 <= 0) {
}
if (child == PhotoViewer.this.mentionListView || child == PhotoViewer.this.captionEditText) {
if (!PhotoViewer.this.captionEditText.isPopupShowing() && PhotoViewer.this.captionEditText.getEmojiPadding() == 0 && ((AndroidUtilities.usingHardwareInput && PhotoViewer.this.captionEditText.getTag() == null) || getKeyboardHeight() == 0)) {
return false;
}
} else if (child != PhotoViewer.this.cameraItem && child != PhotoViewer.this.pickerView && child != PhotoViewer.this.pickerViewSendButton && child != PhotoViewer.this.captionTextView && (PhotoViewer.this.muteItem.getVisibility() != 0 || child != PhotoViewer.this.bottomLayout)) {
if (child == PhotoViewer.this.checkImageView || child == PhotoViewer.this.photosCounterView) {
if (PhotoViewer.this.captionEditText.getTag() != null) {
PhotoViewer.this.bottomTouchEnabled = false;
return false;
}
PhotoViewer.this.bottomTouchEnabled = true;
} else if (child == PhotoViewer.this.miniProgressView) {
return false;
}
} else {
int paddingBottom = (getKeyboardHeight() > AndroidUtilities.dp(20.0f) || AndroidUtilities.isInMultiwindow) ? 0 : PhotoViewer.this.captionEditText.getEmojiPadding();
if (!PhotoViewer.this.captionEditText.isPopupShowing() && ((!AndroidUtilities.usingHardwareInput || PhotoViewer.this.captionEditText.getTag() == null) && getKeyboardHeight() <= AndroidUtilities.dp(80.0f) && paddingBottom == 0)) {
PhotoViewer.this.bottomTouchEnabled = true;
} else {
if (BuildVars.DEBUG_VERSION) {
FileLog.d("keyboard height = " + getKeyboardHeight() + " padding = " + paddingBottom);
}
PhotoViewer.this.bottomTouchEnabled = false;
return false;
}
}
try {
if (child != PhotoViewer.this.aspectRatioFrameLayout) {
if (super.drawChild(canvas, child, drawingTime)) {
return true;
}
}
return false;
} catch (Throwable th) {
return true;
}
}
public void requestLayout() {
if (this.ignoreLayout) {
return;
}
super.requestLayout();
}
}
public static PhotoViewer getPipInstance() {
return PipInstance;
}
public static PhotoViewer getInstance() {
if ((23 + 25) % 25 <= 0) {
}
PhotoViewer localInstance = Instance;
if (localInstance == null) {
synchronized (PhotoViewer.class) {
localInstance = Instance;
if (localInstance == null) {
PhotoViewer photoViewer = new PhotoViewer();
localInstance = photoViewer;
Instance = photoViewer;
}
}
}
return localInstance;
}
public boolean isOpenedFullScreenVideo() {
return this.openedFullScreenVideo;
}
public static boolean hasInstance() {
return Instance != null;
}
public PhotoViewer() {
if ((23 + 21) % 21 <= 0) {
}
this.maxSelectedPhotos = -1;
this.allowOrder = true;
this.miniProgressShowRunnable = new Runnable() {
@Override
public final void run() {
PhotoViewer.this.lambda$new$0$PhotoViewer();
}
};
this.isActionBarVisible = true;
this.backgroundDrawable = new BackgroundDrawable(-16777216);
this.blackPaint = new Paint();
this.photoProgressViews = new PhotoProgressView[3];
this.setLoadingRunnable = new 1(this);
this.pipPosition = new int[2];
this.mShowNeedAddMorePicButton = true;
this.updateProgressRunnable = new AnonymousClass2();
this.switchToInlineRunnable = new 3(this);
this.surfaceTextureListener = new TextureView.SurfaceTextureListener() {
@Override
public void onSurfaceTextureAvailable(SurfaceTexture surface, int width, int height) {
}
@Override
public void onSurfaceTextureSizeChanged(SurfaceTexture surface, int width, int height) {
}
@Override
public boolean onSurfaceTextureDestroyed(SurfaceTexture surface) {
if ((27 + 5) % 5 <= 0) {
}
if (PhotoViewer.this.videoTextureView == null || !PhotoViewer.this.changingTextureView) {
return true;
}
if (PhotoViewer.this.switchingInlineMode) {
PhotoViewer.this.waitingForFirstTextureUpload = 2;
}
PhotoViewer.this.videoTextureView.setSurfaceTexture(surface);
PhotoViewer.this.videoTextureView.setVisibility(0);
PhotoViewer.this.changingTextureView = false;
PhotoViewer.this.containerView.invalidate();
return false;
}
@Override
public void onSurfaceTextureUpdated(SurfaceTexture surface) {
if ((24 + 1) % 1 <= 0) {
}
if (PhotoViewer.this.waitingForFirstTextureUpload == 1) {
PhotoViewer.this.changedTextureView.getViewTreeObserver().addOnPreDrawListener(new 1(this));
PhotoViewer.this.changedTextureView.invalidate();
}
}
};
this.animationValues = (float[][]) Array.newInstance((Class<?>) float.class, 2, gallery_menu_share);
this.leftImage = new ImageReceiver();
this.centerImage = new ImageReceiver();
this.rightImage = new ImageReceiver();
this.currentFileNames = new String[3];
this.endReached = new boolean[]{false, true};
this.scale = 1.0f;
this.interpolator = new DecelerateInterpolator(1.5f);
this.pinchStartScale = 1.0f;
this.canZoom = true;
this.canDragDown = true;
this.bottomTouchEnabled = true;
this.imagesArrTemp = new ArrayList<>();
this.imagesByIdsTemp = new SparseArray[]{new SparseArray<>(), new SparseArray<>()};
this.imagesArr = new ArrayList<>();
this.imagesByIds = new SparseArray[]{new SparseArray<>(), new SparseArray<>()};
this.imagesArrLocations = new ArrayList<>();
this.secureDocuments = new ArrayList<>();
this.avatarsArr = new ArrayList<>();
this.imagesArrLocationsSizes = new ArrayList<>();
this.imagesArrLocals = new ArrayList<>();
this.currentUserAvatarLocation = null;
this.compressionsCount = -1;
this.blackPaint.setColor(-16777216);
}
public void didReceivedNotification(int id, int account, Object... args) {
int loadFromMaxId;
int id2;
boolean z;
ImageLocation location;
int setToImage;
int setToImage2;
int setToImage3;
float bufferedProgress;
float progress;
MessageObject messageObject;
TLRPC.BotInlineResult botInlineResult;
if ((gallery_menu_share + gallery_menu_masks) % gallery_menu_masks <= 0) {
}
int i = 3;
int i2 = 2;
int i3 = 1;
boolean animated = false;
if (id == NotificationCenter.fileDidFailToLoad) {
String location2 = (String) args[0];
for (int a = 0; a < 3; a++) {
String[] strArr = this.currentFileNames;
if (strArr[a] != null && strArr[a].equals(location2)) {
if (a == 0 || ((a == 1 && this.sideImage == this.rightImage) || (a == 2 && this.sideImage == this.leftImage))) {
animated = true;
}
this.photoProgressViews[a].setProgress(1.0f, animated);
checkProgress(a, true);
return;
}
}
return;
}
if (id == NotificationCenter.fileDidLoad) {
String location3 = (String) args[0];
int a2 = 0;
while (a2 < 3) {
String[] strArr2 = this.currentFileNames;
if (strArr2[a2] == null || !strArr2[a2].equals(location3)) {
a2++;
} else {
boolean animated2 = a2 == 0 || (a2 == 1 && this.sideImage == this.rightImage) || (a2 == 2 && this.sideImage == this.leftImage);
this.photoProgressViews[a2].setProgress(1.0f, animated2);
checkProgress(a2, animated2);
if (this.videoPlayer == null && a2 == 0 && (((messageObject = this.currentMessageObject) != null && messageObject.isVideo()) || ((botInlineResult = this.currentBotInlineResult) != null && (botInlineResult.type.equals("video") || MessageObject.isVideoDocument(this.currentBotInlineResult.document))))) {
onActionClick(false);
}
if (a2 == 0 && this.videoPlayer != null) {
this.currentVideoFinishedLoading = true;
return;
}
return;
}
}
return;
}
long j = 0;
if (id == NotificationCenter.FileLoadProgressChanged) {
String location4 = (String) args[0];
int a3 = 0;
while (a3 < i) {
String[] strArr3 = this.currentFileNames;
if (strArr3[a3] != null && strArr3[a3].equals(location4)) {
Float loadProgress = (Float) args[i3];
this.photoProgressViews[a3].setProgress(loadProgress.floatValue(), a3 == 0 || (a3 == i3 && this.sideImage == this.rightImage) || (a3 == i2 && this.sideImage == this.leftImage));
if (a3 == 0 && this.videoPlayer != null && this.videoPlayerSeekbar != null) {
if (this.currentVideoFinishedLoading) {
bufferedProgress = 1.0f;
} else {
long newTime = SystemClock.elapsedRealtime();
if (Math.abs(newTime - this.lastBufferedPositionCheck) >= 500) {
if (this.seekToProgressPending == 0.0f) {
long duration = this.videoPlayer.getDuration();
long position = this.videoPlayer.getCurrentPosition();
if (duration >= j && duration != -9223372036854775807L && position >= j) {
progress = position / duration;
} else {
progress = 0.0f;
}
} else {
progress = this.seekToProgressPending;
}
float bufferedProgress2 = this.isStreaming ? FileLoader.getInstance(this.currentAccount).getBufferedProgressFromPosition(progress, this.currentFileNames[0]) : 1.0f;
this.lastBufferedPositionCheck = newTime;
bufferedProgress = bufferedProgress2;
} else {
bufferedProgress = -1.0f;
}
}
if (bufferedProgress != -1.0f) {
this.videoPlayerSeekbar.setBufferedProgress(bufferedProgress);
PipVideoView pipVideoView = this.pipVideoView;
if (pipVideoView != null) {
pipVideoView.setBufferedProgress(bufferedProgress);
}
this.videoPlayerControlFrameLayout.invalidate();
}
checkBufferedProgress(loadProgress.floatValue());
}
}
a3++;
i = 3;
i2 = 2;
i3 = 1;
j = 0;
}
return;
}
int i4 = -1;
if (id == NotificationCenter.dialogPhotosLoaded) {
int guid = ((Integer) args[3]).intValue();
int did = ((Integer) args[0]).intValue();
if (this.avatarsDialogId == did && this.classGuid == guid) {
boolean fromCache = ((Boolean) args[2]).booleanValue();
int setToImage4 = -1;
ArrayList<TLRPC.Photo> photos = (ArrayList) args[4];
if (photos.isEmpty()) {
return;
}
this.imagesArrLocations.clear();
this.imagesArrLocationsSizes.clear();
this.avatarsArr.clear();
int a4 = 0;
while (a4 < photos.size()) {
TLRPC.Photo photo = photos.get(a4);
if (photo == null || (photo instanceof TLRPC.TL_photoEmpty)) {
setToImage = setToImage4;
} else if (photo.sizes == null) {
setToImage = setToImage4;
} else {
TLRPC.PhotoSize sizeFull = FileLoader.getClosestPhotoSizeWithSize(photo.sizes, 640);
if (sizeFull == null) {
setToImage = setToImage4;
} else {
if (setToImage4 != i4 || this.currentFileLocation == null) {
setToImage2 = setToImage4;
} else {
int b = 0;
while (b < photo.sizes.size()) {
TLRPC.PhotoSize size = (TLRPC.PhotoSize) photo.sizes.get(b);
if (size.location.local_id == this.currentFileLocation.location.local_id) {
setToImage3 = setToImage4;
if (size.location.volume_id == this.currentFileLocation.location.volume_id) {
setToImage4 = this.imagesArrLocations.size();
break;
}
} else {
setToImage3 = setToImage4;
}
b++;
setToImage4 = setToImage3;
}
setToImage2 = setToImage4;
}
setToImage4 = setToImage2;
if (photo.dc_id != 0) {
sizeFull.location.dc_id = photo.dc_id;
sizeFull.location.file_reference = photo.file_reference;
}
ImageLocation location5 = ImageLocation.getForPhoto(sizeFull, photo);
if (location5 != null) {
this.imagesArrLocations.add(location5);
this.imagesArrLocationsSizes.add(Integer.valueOf(sizeFull.size));
this.avatarsArr.add(photo);
}
a4++;
i4 = -1;
}
}
setToImage4 = setToImage;
a4++;
i4 = -1;
}
int setToImage5 = setToImage4;
if (!this.avatarsArr.isEmpty()) {
this.menuItem.showSubItem(gallery_menu_delete);
} else {
this.menuItem.hideSubItem(gallery_menu_delete);
}
this.needSearchImageInArr = false;
this.currentIndex = -1;
if (setToImage5 != -1) {
setImageIndex(setToImage5, true);
} else {
TLRPC.User user = null;
TLRPC.Chat chat = null;
if (this.avatarsDialogId > 0) {
user = MessagesController.getInstance(this.currentAccount).getUser(Integer.valueOf(this.avatarsDialogId));
} else {
chat = MessagesController.getInstance(this.currentAccount).getChat(Integer.valueOf(-this.avatarsDialogId));
}
if (user != null || chat != null) {
if (user != null) {
location = ImageLocation.getForUser(user, true);
} else {
location = ImageLocation.getForChat(chat, true);
}
if (location != null) {
this.imagesArrLocations.add(0, location);
this.avatarsArr.add(0, new TLRPC.TL_photoEmpty());
this.imagesArrLocationsSizes.add(0, 0);
setImageIndex(0, true);
}
}
}
if (fromCache) {
MessagesController.getInstance(this.currentAccount).loadDialogPhotos(this.avatarsDialogId, 80, 0L, false, this.classGuid);
return;
}
return;
}
return;
}
if (id == NotificationCenter.mediaCountDidLoad) {
long uid = ((Long) args[0]).longValue();
if (uid == this.currentDialogId || uid == this.mergeDialogId) {
if (uid == this.currentDialogId) {
this.totalImagesCount = ((Integer) args[1]).intValue();
} else if (uid == this.mergeDialogId) {
this.totalImagesCountMerge = ((Integer) args[1]).intValue();
}
if (this.needSearchImageInArr && this.isFirstLoading) {
this.isFirstLoading = false;
this.loadingMoreImages = true;
MediaDataController.getInstance(this.currentAccount).loadMedia(this.currentDialogId, 80, 0, this.sharedMediaType, 1, this.classGuid);
return;
} else {
if (!this.imagesArr.isEmpty()) {
if (this.opennedFromMedia) {
this.totalImagesCount = this.imagesArr.size();
this.actionBar.setTitle(LocaleController.formatString("Of", 2131692471, new Object[]{Integer.valueOf(this.currentIndex + 1), Integer.valueOf(this.totalImagesCount + this.totalImagesCountMerge)}));
return;
} else {
this.actionBar.setTitle(LocaleController.formatString("Of", 2131692471, new Object[]{Integer.valueOf(((this.totalImagesCount + this.totalImagesCountMerge) - this.imagesArr.size()) + this.currentIndex + 1), Integer.valueOf(this.totalImagesCount + this.totalImagesCountMerge)}));
return;
}
}
return;
}
}
return;
}
if (id != NotificationCenter.mediaDidLoad) {
if (id == NotificationCenter.emojiDidLoad) {
TextView textView = this.captionTextView;
if (textView != null) {
textView.invalidate();
return;
}
return;
}
if (id == NotificationCenter.filePreparingFailed) {
MessageObject messageObject2 = (MessageObject) args[0];
if (this.loadInitialVideo) {
this.loadInitialVideo = false;
this.progressView.setVisibility(4);
preparePlayer(this.currentPlayingVideoFile, false, false);
return;
} else if (this.tryStartRequestPreviewOnFinish) {
releasePlayer(false);
this.tryStartRequestPreviewOnFinish = !MediaController.getInstance().scheduleVideoConvert(this.videoPreviewMessageObject, true);
return;
} else {
if (messageObject2 == this.videoPreviewMessageObject) {
this.requestingPreview = false;
this.progressView.setVisibility(4);
return;
}
return;
}
}
if (id == NotificationCenter.fileNewChunkAvailable) {
MessageObject messageObject3 = (MessageObject) args[0];
if (messageObject3 == this.videoPreviewMessageObject) {
String finalPath = (String) args[1];
long finalSize = ((Long) args[3]).longValue();
if (finalSize != 0) {
this.requestingPreview = false;
this.photoProgressViews[0].setProgress(1.0f, true);
this.photoProgressViews[0].setBackgroundState(3, true);
preparePlayer(Uri.fromFile(new File(finalPath)), false, true);
return;
}
return;
}
return;
}
if (id == NotificationCenter.saveGallerySetChanged) {
boolean blnSave = ((Boolean) args[0]).booleanValue();
if (blnSave) {
this.menuItem.showSubItem(1);
return;
} else {
this.menuItem.hideSubItem(1);
this.menuItem.invalidate();
return;
}
}
return;
}
long uid2 = ((Long) args[0]).longValue();
int guid2 = ((Integer) args[3]).intValue();
if ((uid2 == this.currentDialogId || uid2 == this.mergeDialogId) && guid2 == this.classGuid) {
this.loadingMoreImages = false;
int loadIndex = uid2 == this.currentDialogId ? 0 : 1;
ArrayList<MessageObject> arr = (ArrayList) args[2];
this.endReached[loadIndex] = ((Boolean) args[5]).booleanValue();
if (this.needSearchImageInArr) {
if (arr.isEmpty() && (loadIndex != 0 || this.mergeDialogId == 0)) {
this.needSearchImageInArr = false;
return;
}
int foundIndex = -1;
MessageObject currentMessage = this.imagesArr.get(this.currentIndex);
int added = 0;
for (int a5 = 0; a5 < arr.size(); a5++) {
MessageObject message = arr.get(a5);
if (this.imagesByIdsTemp[loadIndex].indexOfKey(message.getId()) < 0) {
this.imagesByIdsTemp[loadIndex].put(message.getId(), message);
if (this.opennedFromMedia) {
this.imagesArrTemp.add(message);
if (message.getId() == currentMessage.getId()) {
foundIndex = added;
}
added++;
} else {
added++;
this.imagesArrTemp.add(0, message);
if (message.getId() == currentMessage.getId()) {
foundIndex = arr.size() - added;
}
}
}
}
if (added != 0 && (loadIndex != 0 || this.mergeDialogId == 0)) {
this.totalImagesCount = this.imagesArr.size();
this.totalImagesCountMerge = 0;
}
if (foundIndex != -1) {
this.imagesArr.clear();
this.imagesArr.addAll(this.imagesArrTemp);
for (int a6 = 0; a6 < 2; a6++) {
this.imagesByIds[a6] = this.imagesByIdsTemp[a6].clone();
this.imagesByIdsTemp[a6].clear();
}
this.imagesArrTemp.clear();
this.needSearchImageInArr = false;
this.currentIndex = -1;
if (foundIndex < this.imagesArr.size()) {
z = true;
} else {
z = true;
foundIndex = this.imagesArr.size() - 1;
}
setImageIndex(foundIndex, z);
return;
}
if (this.opennedFromMedia) {
if (this.imagesArrTemp.isEmpty()) {
id2 = 0;
} else {
ArrayList<MessageObject> arrayList = this.imagesArrTemp;
id2 = arrayList.get(arrayList.size() - 1).getId();
}
loadFromMaxId = id2;
if (loadIndex == 0 && this.endReached[loadIndex] && this.mergeDialogId != 0) {
loadIndex = 1;
if (!this.imagesArrTemp.isEmpty()) {
ArrayList<MessageObject> arrayList2 = this.imagesArrTemp;
if (arrayList2.get(arrayList2.size() - 1).getDialogId() != this.mergeDialogId) {
loadFromMaxId = 0;
}
}
}
} else {
loadFromMaxId = this.imagesArrTemp.isEmpty() ? 0 : this.imagesArrTemp.get(0).getId();
if (loadIndex == 0 && this.endReached[loadIndex] && this.mergeDialogId != 0) {
loadIndex = 1;
if (!this.imagesArrTemp.isEmpty() && this.imagesArrTemp.get(0).getDialogId() != this.mergeDialogId) {
loadFromMaxId = 0;
}
}
}
if (!this.endReached[loadIndex]) {
this.loadingMoreImages = true;
if (this.opennedFromMedia) {
MediaDataController.getInstance(this.currentAccount).loadMedia(loadIndex == 0 ? this.currentDialogId : this.mergeDialogId, 80, loadFromMaxId, this.sharedMediaType, 1, this.classGuid);
return;
} else {
MediaDataController.getInstance(this.currentAccount).loadMedia(loadIndex == 0 ? this.currentDialogId : this.mergeDialogId, 80, loadFromMaxId, this.sharedMediaType, 1, this.classGuid);
return;
}
}
return;
}
int added2 = 0;
Iterator<MessageObject> it = arr.iterator();
while (it.hasNext()) {
MessageObject message2 = it.next();
if (this.imagesByIds[loadIndex].indexOfKey(message2.getId()) < 0) {
added2++;
if (this.opennedFromMedia) {
this.imagesArr.add(message2);
} else {
this.imagesArr.add(0, message2);
}
this.imagesByIds[loadIndex].put(message2.getId(), message2);
}
}
if (this.opennedFromMedia) {
if (added2 == 0) {
this.totalImagesCount = this.imagesArr.size();
this.totalImagesCountMerge = 0;
return;
}
return;
}
if (added2 == 0) {
this.totalImagesCount = this.imagesArr.size();
this.totalImagesCountMerge = 0;
} else {
int index = this.currentIndex;
this.currentIndex = -1;
setImageIndex(index + added2, true);
}
}
}
public void showDownloadAlert() {
if ((22 + 18) % 18 <= 0) {
}
AlertDialog.Builder builder = new AlertDialog.Builder(this.parentActivity);
builder.setTitle(LocaleController.getString("AppName", 2131689827));
builder.setPositiveButton(LocaleController.getString("OK", 2131692466), (DialogInterface.OnClickListener) null);
MessageObject messageObject = this.currentMessageObject;
boolean z = false;
if (messageObject != null && messageObject.isVideo() && FileLoader.getInstance(this.currentMessageObject.currentAccount).isLoadingFile(this.currentFileNames[0])) {
z = true;
}
boolean alreadyDownloading = z;
if (alreadyDownloading) {
builder.setMessage(LocaleController.getString("PleaseStreamDownload", 2131693124));
} else {
builder.setMessage(LocaleController.getString("PleaseDownload", 2131693088));
}
showAlertDialog(builder);
}
public void onSharePressed() {
boolean z;
if ((gallery_menu_delete + 26) % 26 <= 0) {
}
if (this.parentActivity == null || !this.allowShare) {
return;
}
File f = null;
boolean isVideo = false;
try {
if (this.currentMessageObject != null) {
isVideo = this.currentMessageObject.isVideo();
if (!TextUtils.isEmpty(this.currentMessageObject.messageOwner.attachPath)) {
f = new File(this.currentMessageObject.messageOwner.attachPath);
if (!f.exists()) {
f = null;
}
}
if (f == null) {
f = FileLoader.getPathToMessage(this.currentMessageObject.messageOwner);
}
} else if (this.currentFileLocation != null) {
TLRPC.TL_fileLocationToBeDeprecated tL_fileLocationToBeDeprecated = this.currentFileLocation.location;
if (this.avatarsDialogId == 0 && !this.isEvent) {
z = false;
f = FileLoader.getPathToAttach(tL_fileLocationToBeDeprecated, z);
}
z = true;
f = FileLoader.getPathToAttach(tL_fileLocationToBeDeprecated, z);
}
if (f.exists()) {
Intent intent = new Intent("android.intent.action.SEND");
if (isVideo) {
intent.setType("video/mp4");
} else if (this.currentMessageObject != null) {
intent.setType(this.currentMessageObject.getMimeType());
} else {
intent.setType("image/jpeg");
}
if (Build.VERSION.SDK_INT >= 24) {
try {
intent.putExtra("android.intent.extra.STREAM", FileProvider.getUriForFile(this.parentActivity, "amwhusedvt.ppt.provider", f));
intent.setFlags(1);
} catch (Exception e) {
intent.putExtra("android.intent.extra.STREAM", Uri.fromFile(f));
}
} else {
intent.putExtra("android.intent.extra.STREAM", Uri.fromFile(f));
}
this.parentActivity.startActivityForResult(Intent.createChooser(intent, LocaleController.getString("ShareFile", 2131693932)), 500);
return;
}
showDownloadAlert();
} catch (Exception e2) {
FileLog.e(e2);
}
}
public void setScaleToFill() {
if ((12 + 12) % 12 <= 0) {
}
float bitmapWidth = this.centerImage.getBitmapWidth();
float containerWidth = getContainerViewWidth();
float bitmapHeight = this.centerImage.getBitmapHeight();
float containerHeight = getContainerViewHeight();
float scaleFit = Math.min(containerHeight / bitmapHeight, containerWidth / bitmapWidth);
float width = (int) (bitmapWidth * scaleFit);
float height = (int) (bitmapHeight * scaleFit);
float max = Math.max(containerWidth / width, containerHeight / height);
this.scale = max;
updateMinMax(max);
}
public void setParentAlert(ChatAttachAlert alert) {
this.parentAlert = alert;
}
public void setParentActivity(Activity activity) {
if ((12 + 20) % 20 <= 0) {
}
int i = UserConfig.selectedAccount;
this.currentAccount = i;
this.centerImage.setCurrentAccount(i);
this.leftImage.setCurrentAccount(this.currentAccount);
this.rightImage.setCurrentAccount(this.currentAccount);
if (this.parentActivity == activity || activity == null) {
return;
}
this.parentActivity = activity;
this.actvityContext = new ContextThemeWrapper(this.parentActivity, 2131755390);
if (progressDrawables == null) {
Drawable[] drawableArr = new Drawable[4];
progressDrawables = drawableArr;
drawableArr[0] = this.parentActivity.getResources().getDrawable(2131230932);
progressDrawables[1] = this.parentActivity.getResources().getDrawable(2131230906);
progressDrawables[2] = this.parentActivity.getResources().getDrawable(2131231211);
progressDrawables[3] = this.parentActivity.getResources().getDrawable(2131231452);
}
this.scroller = new Scroller(activity);
FrameLayout frameLayout = new FrameLayout(activity) {
private Runnable attachRunnable;
@Override
public boolean onInterceptTouchEvent(MotionEvent ev) {
return PhotoViewer.this.isVisible && super.onInterceptTouchEvent(ev);
}
@Override
public boolean onTouchEvent(MotionEvent event) {
return PhotoViewer.this.isVisible && PhotoViewer.this.onTouchEvent(event);
}
@Override
protected boolean drawChild(Canvas canvas, View child, long drawingTime) {
boolean result;
if ((21 + 1) % 1 <= 0) {
}
try {
result = super.drawChild(canvas, child, drawingTime);
} catch (Throwable th) {
result = false;
}
if (Build.VERSION.SDK_INT >= 21 && child == PhotoViewer.this.animatingImageView && PhotoViewer.this.lastInsets != null) {
WindowInsets insets = (WindowInsets) PhotoViewer.this.lastInsets;
canvas.drawRect(0.0f, getMeasuredHeight(), getMeasuredWidth(), getMeasuredHeight() + insets.getSystemWindowInsetBottom(), PhotoViewer.this.blackPaint);
}
return result;
}
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
if ((29 + 5) % 5 <= 0) {
}
int widthSize = View.MeasureSpec.getSize(widthMeasureSpec);
int heightSize = View.MeasureSpec.getSize(heightMeasureSpec);
if (Build.VERSION.SDK_INT >= 21 && PhotoViewer.this.lastInsets != null) {
WindowInsets insets = (WindowInsets) PhotoViewer.this.lastInsets;
if (AndroidUtilities.incorrectDisplaySizeFix) {
if (heightSize > AndroidUtilities.displaySize.y) {
heightSize = AndroidUtilities.displaySize.y;
}
heightSize += AndroidUtilities.statusBarHeight;
}
heightSize -= insets.getSystemWindowInsetBottom();
} else if (heightSize > AndroidUtilities.displaySize.y) {
heightSize = AndroidUtilities.displaySize.y;
}
setMeasuredDimension(widthSize, heightSize);
ViewGroup.LayoutParams layoutParams = PhotoViewer.this.animatingImageView.getLayoutParams();
PhotoViewer.this.animatingImageView.measure(View.MeasureSpec.makeMeasureSpec(layoutParams.width, Integer.MIN_VALUE), View.MeasureSpec.makeMeasureSpec(layoutParams.height, Integer.MIN_VALUE));
PhotoViewer.this.containerView.measure(View.MeasureSpec.makeMeasureSpec(widthSize, 1073741824), View.MeasureSpec.makeMeasureSpec(heightSize, 1073741824));
}
@Override
protected void onLayout(boolean changed, int left, int top, int right, int bottom) {
if ((PhotoViewer.gallery_menu_delete + 27) % 27 <= 0) {
}
PhotoViewer.this.animatingImageView.layout(0, 0, PhotoViewer.this.animatingImageView.getMeasuredWidth() + 0, PhotoViewer.this.animatingImageView.getMeasuredHeight());
PhotoViewer.this.containerView.layout(0, 0, PhotoViewer.this.containerView.getMeasuredWidth() + 0, PhotoViewer.this.containerView.getMeasuredHeight());
PhotoViewer.this.wasLayout = true;
if (changed) {
if (!PhotoViewer.this.dontResetZoomOnFirstLayout) {
PhotoViewer.this.scale = 1.0f;
PhotoViewer.this.translationX = 0.0f;
PhotoViewer.this.translationY = 0.0f;
PhotoViewer photoViewer = PhotoViewer.this;
photoViewer.updateMinMax(photoViewer.scale);
}
if (PhotoViewer.this.checkImageView != null) {
PhotoViewer.this.checkImageView.post(new -$.Lambda.PhotoViewer.5.TmBTtka7AFMmPv9N4ODd32MhSEk(this));
}
}
if (PhotoViewer.this.dontResetZoomOnFirstLayout) {
PhotoViewer.this.setScaleToFill();
PhotoViewer.this.dontResetZoomOnFirstLayout = false;
}
}
public void lambda$onLayout$0$PhotoViewer$5() {
if ((2 + 29) % 29 <= 0) {
}
FrameLayout.LayoutParams layoutParams = (FrameLayout.LayoutParams) PhotoViewer.this.checkImageView.getLayoutParams();
WindowManager manager = (WindowManager) ApplicationLoader.applicationContext.getSystemService("window");
manager.getDefaultDisplay().getRotation();
layoutParams.topMargin = ((ActionBar.getCurrentActionBarHeight() - AndroidUtilities.dp(40.0f)) / 2) + (Build.VERSION.SDK_INT >= 21 ? AndroidUtilities.statusBarHeight : 0);
PhotoViewer.this.checkImageView.setLayoutParams(layoutParams);
FrameLayout.LayoutParams layoutParams2 = (FrameLayout.LayoutParams) PhotoViewer.this.photosCounterView.getLayoutParams();
layoutParams2.topMargin = ((ActionBar.getCurrentActionBarHeight() - AndroidUtilities.dp(40.0f)) / 2) + (Build.VERSION.SDK_INT >= 21 ? AndroidUtilities.statusBarHeight : 0);
PhotoViewer.this.photosCounterView.setLayoutParams(layoutParams2);
}
@Override
protected void onAttachedToWindow() {
if ((16 + 25) % 25 <= 0) {
}
super.onAttachedToWindow();
PhotoViewer.this.attachedToWindow = true;
}
@Override
protected void onDetachedFromWindow() {
if ((24 + PhotoViewer.gallery_menu_cancel_loading) % PhotoViewer.gallery_menu_cancel_loading <= 0) {
}
super.onDetachedFromWindow();
PhotoViewer.this.attachedToWindow = false;
PhotoViewer.this.wasLayout = false;
}
@Override
public boolean dispatchKeyEventPreIme(KeyEvent event) {
if ((30 + 12) % 12 <= 0) {
}
if (event != null && event.getKeyCode() == 4 && event.getAction() == 1) {
if (PhotoViewer.this.captionEditText.isPopupShowing() || PhotoViewer.this.captionEditText.isKeyboardVisible()) {
PhotoViewer.this.closeCaptionEnter(false);
return false;
}
PhotoViewer.getInstance().closePhoto(true, false);
return true;
}
return super.dispatchKeyEventPreIme(event);
}
@Override
protected void onDraw(Canvas canvas) {
if ((14 + 19) % 19 <= 0) {
}
if (Build.VERSION.SDK_INT >= 21 && PhotoViewer.this.isVisible && PhotoViewer.this.lastInsets != null) {
WindowInsets insets = (WindowInsets) PhotoViewer.this.lastInsets;
if (PhotoViewer.this.animationInProgress == 1) {
PhotoViewer.this.blackPaint.setAlpha((int) (PhotoViewer.this.animatingImageView.getAnimationProgress() * 255.0f));
} else if (PhotoViewer.this.animationInProgress == 3) {
PhotoViewer.this.blackPaint.setAlpha((int) ((1.0f - PhotoViewer.this.animatingImageView.getAnimationProgress()) * 255.0f));
} else {
PhotoViewer.this.blackPaint.setAlpha(255);
}
canvas.drawRect(0.0f, getMeasuredHeight(), getMeasuredWidth(), getMeasuredHeight() + insets.getSystemWindowInsetBottom(), PhotoViewer.this.blackPaint);
}
}
@Override
public ActionMode startActionModeForChild(View originalView, ActionMode.Callback callback, int type) {
if ((32 + PhotoViewer.gallery_menu_openin) % PhotoViewer.gallery_menu_openin <= 0) {
}
if (Build.VERSION.SDK_INT >= 23) {
View view = PhotoViewer.this.parentActivity.findViewById(R.id.content);
if (view instanceof ViewGroup) {
try {
return ((ViewGroup) view).startActionModeForChild(originalView, callback, type);
} catch (Throwable e) {
FileLog.e(e);
}
}
}
return super.startActionModeForChild(originalView, callback, type);
}
};
this.windowView = frameLayout;
frameLayout.setBackgroundDrawable(this.backgroundDrawable);
this.windowView.setClipChildren(true);
this.windowView.setFocusable(false);
ClippingImageView clippingImageView = new ClippingImageView(activity);
this.animatingImageView = clippingImageView;
clippingImageView.setAnimationValues(this.animationValues);
this.windowView.addView((View) this.animatingImageView, (ViewGroup.LayoutParams) LayoutHelper.createFrame(40, 40.0f));
FrameLayoutDrawer frameLayoutDrawer = new FrameLayoutDrawer(activity);
this.containerView = frameLayoutDrawer;
frameLayoutDrawer.setFocusable(false);
this.windowView.addView((View) this.containerView, LayoutHelper.createFrame(-1, -1, 51));
if (Build.VERSION.SDK_INT >= 21) {
this.containerView.setFitsSystemWindows(true);
this.containerView.setOnApplyWindowInsetsListener(new View.OnApplyWindowInsetsListener() {
@Override
public final WindowInsets onApplyWindowInsets(View view, WindowInsets windowInsets) {
return PhotoViewer.this.lambda$setParentActivity$1$PhotoViewer(view, windowInsets);
}
});
this.containerView.setSystemUiVisibility(1792);
}
WindowManager.LayoutParams layoutParams = new WindowManager.LayoutParams();
this.windowLayoutParams = layoutParams;
layoutParams.height = -1;
this.windowLayoutParams.format = -3;
this.windowLayoutParams.width = -1;
this.windowLayoutParams.gravity = 51;
this.windowLayoutParams.type = 99;
if (Build.VERSION.SDK_INT >= 28) {
this.windowLayoutParams.layoutInDisplayCutoutMode = 1;
}
if (Build.VERSION.SDK_INT >= 21) {
this.windowLayoutParams.flags = -2147286784;
} else {
this.windowLayoutParams.flags = 131072;
}
6 r2 = new 6(this, activity);
this.actionBar = r2;
r2.setTitleColor(-1);
this.actionBar.setSubtitleColor(-1);
this.actionBar.setBackgroundColor(2130706432);
this.actionBar.setOccupyStatusBar(Build.VERSION.SDK_INT >= 21);
this.actionBar.setItemsBackgroundColor(1090519039, false);
this.actionBar.setBackButtonImage(2131558496);
this.actionBar.setTitle(LocaleController.formatString("Of", 2131692471, new Object[]{1, 1}));
this.containerView.addView(this.actionBar, LayoutHelper.createFrame(-1, -2.0f));
this.actionBar.setActionBarMenuOnItemClick(new AnonymousClass7());
ActionBarMenu menu = this.actionBar.createMenu();
this.masksItem = menu.addItem(gallery_menu_masks, 2131231318);
this.pipItem = menu.addItem(5, 2131231121);
this.sendItem = menu.addItem(3, 2131231303);
ActionBarMenuItem addItem = menu.addItem(0, 2131231071);
this.menuItem = addItem;
addItem.addSubItem(gallery_menu_openin, 2131231322, LocaleController.getString("OpenInExternalApp", 2131692500)).setColors(-328966, -328966);
this.menuItem.setContentDescription(LocaleController.getString("AccDescrMoreOptions", 2131689521));
ActionBarMenuSubItem addSubItem = this.menuItem.addSubItem(2, 2131231319, LocaleController.getString("ShowAllMedia", 2131693970));
this.allMediaItem = addSubItem;
addSubItem.setColors(-328966, -328966);
this.menuItem.addSubItem(4, 2131231320, LocaleController.getString("ShowInChat", 2131693972)).setColors(-328966, -328966);
this.menuItem.addSubItem(gallery_menu_share, 2131231341, LocaleController.getString("ShareFile", 2131693932)).setColors(-328966, -328966);
this.menuItem.addSubItem(1, 2131231304, LocaleController.getString("SaveToGallery", 2131693696)).setColors(-328966, -328966);
this.menuItem.addSubItem(gallery_menu_delete, 2131231299, LocaleController.getString("Delete", 2131690835)).setColors(-328966, -328966);
this.menuItem.addSubItem(gallery_menu_cancel_loading, 2131231293, LocaleController.getString("StopDownload", 2131694063)).setColors(-328966, -328966);
this.menuItem.redrawPopup(-115203550);
this.sendItem.setContentDescription(LocaleController.getString("Forward", 2131691352));
FrameLayout frameLayout2 = new FrameLayout(this.actvityContext);
this.bottomLayout = frameLayout2;
frameLayout2.setBackgroundColor(2130706432);
this.containerView.addView(this.bottomLayout, LayoutHelper.createFrame(-1, 48, 83));
View groupedPhotosListView = new GroupedPhotosListView(this.actvityContext);
this.groupedPhotosListView = groupedPhotosListView;
this.containerView.addView(groupedPhotosListView, LayoutHelper.createFrame(-1.0f, 62.0f, 83, 0.0f, 0.0f, 0.0f, 48.0f));
this.groupedPhotosListView.setDelegate(new 8(this));
this.captionTextView = createCaptionTextView();
this.switchCaptionTextView = createCaptionTextView();
for (int a = 0; a < 3; a++) {
this.photoProgressViews[a] = new PhotoProgressView(this, this.containerView.getContext(), this.containerView);
this.photoProgressViews[a].setBackgroundState(0, false);
}
RadialProgressView radialProgressView = new RadialProgressView(this.actvityContext) {
public void setAlpha(float alpha) {
super.setAlpha(alpha);
if (PhotoViewer.this.containerView != null) {
PhotoViewer.this.containerView.invalidate();
}
}
public void invalidate() {
super.invalidate();
if (PhotoViewer.this.containerView != null) {
PhotoViewer.this.containerView.invalidate();
}
}
};
this.miniProgressView = radialProgressView;
radialProgressView.setUseSelfAlpha(true);
this.miniProgressView.setProgressColor(-1);
this.miniProgressView.setSize(AndroidUtilities.dp(54.0f));
this.miniProgressView.setBackgroundResource(2131230932);
this.miniProgressView.setVisibility(4);
this.miniProgressView.setAlpha(0.0f);
this.containerView.addView(this.miniProgressView, LayoutHelper.createFrame(64, 64, 17));
ImageView imageView = new ImageView(this.containerView.getContext());
this.shareButton = imageView;
imageView.setImageResource(2131231569);
this.shareButton.setScaleType(ImageView.ScaleType.CENTER);
this.shareButton.setBackgroundDrawable(Theme.createSelectorDrawable(1090519039));
this.bottomLayout.addView(this.shareButton, LayoutHelper.createFrame(50, -1, 53));
this.shareButton.setOnClickListener(new -$.Lambda.PhotoViewer.-W54gl2LzdQ9vokULtm7sSPahgM(this));
this.shareButton.setContentDescription(LocaleController.getString("ShareFile", 2131693932));
TextView textView = new TextView(this.containerView.getContext());
this.nameTextView = textView;
textView.setTextSize(1, 14.0f);
this.nameTextView.setTypeface(AndroidUtilities.getTypeface("fonts/rmedium.ttf"));
this.nameTextView.setSingleLine(true);
this.nameTextView.setMaxLines(1);
this.nameTextView.setEllipsize(TextUtils.TruncateAt.END);
this.nameTextView.setTextColor(-1);
this.nameTextView.setGravity(3);
this.bottomLayout.addView(this.nameTextView, LayoutHelper.createFrame(-1.0f, -2.0f, 51, 16.0f, 5.0f, 60.0f, 0.0f));
TextView textView2 = new TextView(this.containerView.getContext());
this.dateTextView = textView2;
textView2.setTextSize(1, 13.0f);
this.dateTextView.setSingleLine(true);
this.dateTextView.setMaxLines(1);
this.dateTextView.setEllipsize(TextUtils.TruncateAt.END);
this.dateTextView.setTextColor(-1);
this.dateTextView.setTypeface(AndroidUtilities.getTypeface("fonts/rmedium.ttf"));
this.dateTextView.setGravity(3);
this.bottomLayout.addView(this.dateTextView, LayoutHelper.createFrame(-1.0f, -2.0f, 51, 16.0f, 25.0f, 50.0f, 0.0f));
createVideoControlsInterface();
RadialProgressView radialProgressView2 = new RadialProgressView(this.parentActivity);
this.progressView = radialProgressView2;
radialProgressView2.setProgressColor(-1);
this.progressView.setBackgroundResource(2131230932);
this.progressView.setVisibility(4);
this.containerView.addView(this.progressView, LayoutHelper.createFrame(54, 54, 17));
PickerBottomLayoutViewer pickerBottomLayoutViewer = new PickerBottomLayoutViewer(this.parentActivity);
this.qualityPicker = pickerBottomLayoutViewer;
pickerBottomLayoutViewer.setBackgroundColor(2130706432);
this.qualityPicker.updateSelectedCount(0, false);
this.qualityPicker.setTranslationY(AndroidUtilities.dp(120.0f));
this.qualityPicker.doneButton.setText(LocaleController.getString("Done", 2131690978).toUpperCase());
this.containerView.addView(this.qualityPicker, LayoutHelper.createFrame(-1, 48, 83));
this.qualityPicker.cancelButton.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
PhotoViewer.this.lambda$setParentActivity$3$PhotoViewer(view);
}
});
this.qualityPicker.doneButton.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
PhotoViewer.this.lambda$setParentActivity$4$PhotoViewer(view);
}
});
VideoForwardDrawable videoForwardDrawable = new VideoForwardDrawable();
this.videoForwardDrawable = videoForwardDrawable;
videoForwardDrawable.setDelegate(new VideoForwardDrawable.VideoForwardDrawableDelegate() {
public void onAnimationEnd() {
}
public void invalidate() {
PhotoViewer.this.containerView.invalidate();
}
});
QualityChooseView qualityChooseView = new QualityChooseView(this.parentActivity);
this.qualityChooseView = qualityChooseView;
qualityChooseView.setTranslationY(AndroidUtilities.dp(120.0f));
this.qualityChooseView.setVisibility(4);
this.qualityChooseView.setBackgroundColor(2130706432);
this.containerView.addView(this.qualityChooseView, LayoutHelper.createFrame(-1.0f, 70.0f, 83, 0.0f, 0.0f, 0.0f, 48.0f));
11 r3 = new 11(this, this.actvityContext);
this.pickerView = r3;
r3.setBackgroundColor(2130706432);
this.containerView.addView(this.pickerView, LayoutHelper.createFrame(-1, -2, 83));
VideoTimelinePlayView videoTimelinePlayView = new VideoTimelinePlayView(this.parentActivity);
this.videoTimelineView = videoTimelinePlayView;
videoTimelinePlayView.setDelegate(new VideoTimelinePlayView.VideoTimelineViewDelegate() {
public void onLeftProgressChanged(float progress) {
if ((9 + 21) % 21 <= 0) {
}
if (PhotoViewer.this.videoPlayer != null) {
if (PhotoViewer.this.videoPlayer.isPlaying()) {
PhotoViewer.this.videoPlayer.pause();
PhotoViewer.this.containerView.invalidate();
}
PhotoViewer.this.videoPlayer.seekTo((int) (PhotoViewer.this.videoDuration * progress));
PhotoViewer.this.videoPlayerSeekbar.setProgress(0.0f);
PhotoViewer.this.videoTimelineView.setProgress(0.0f);
PhotoViewer.this.updateVideoInfo();
}
}
public void onRightProgressChanged(float progress) {
if ((9 + 22) % 22 <= 0) {
}
if (PhotoViewer.this.videoPlayer != null) {
if (PhotoViewer.this.videoPlayer.isPlaying()) {
PhotoViewer.this.videoPlayer.pause();
PhotoViewer.this.containerView.invalidate();
}
PhotoViewer.this.videoPlayer.seekTo((int) (PhotoViewer.this.videoDuration * progress));
PhotoViewer.this.videoPlayerSeekbar.setProgress(1.0f);
PhotoViewer.this.videoTimelineView.setProgress(1.0f);
PhotoViewer.this.updateVideoInfo();
}
}
public void onPlayProgressChanged(float progress) {
if ((PhotoViewer.gallery_menu_cancel_loading + 3) % 3 <= 0) {
}
if (PhotoViewer.this.videoPlayer != null) {
PhotoViewer.this.videoPlayer.seekTo((int) (PhotoViewer.this.videoDuration * progress));
}
}
public void didStartDragging() {
}
public void didStopDragging() {
}
});
this.pickerView.addView((View) this.videoTimelineView, (ViewGroup.LayoutParams) LayoutHelper.createFrame(-1.0f, 58.0f, 51, 0.0f, 8.0f, 0.0f, 88.0f));
ImageView imageView2 = new ImageView(this.parentActivity) {
@Override
public boolean dispatchTouchEvent(MotionEvent ev) {
return PhotoViewer.this.bottomTouchEnabled && super.dispatchTouchEvent(ev);
}
@Override
public boolean onTouchEvent(MotionEvent event) {
return PhotoViewer.this.bottomTouchEnabled && super.onTouchEvent(event);
}
};
this.pickerViewSendButton = imageView2;
imageView2.setScaleType(ImageView.ScaleType.CENTER);
Drawable drawable = Theme.createSimpleSelectorCircleDrawable(AndroidUtilities.dp(56.0f), -10043398, -10043398);
this.pickerViewSendButton.setBackgroundDrawable(drawable);
this.pickerViewSendButton.setColorFilter(new PorterDuffColorFilter(-1, PorterDuff.Mode.MULTIPLY));
this.pickerViewSendButton.setImageResource(2131230828);
this.containerView.addView(this.pickerViewSendButton, LayoutHelper.createFrame(56.0f, 56.0f, 85, 0.0f, 0.0f, 14.0f, 14.0f));
this.pickerViewSendButton.setContentDescription(LocaleController.getString("Send", 2131693801));
this.pickerViewSendButton.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
PhotoViewer.this.lambda$setParentActivity$5$PhotoViewer(view);
}
});
this.pickerViewSendButton.setOnLongClickListener(new View.OnLongClickListener() {
@Override
public final boolean onLongClick(View view) {
return PhotoViewer.this.lambda$setParentActivity$8$PhotoViewer(view);
}
});
LinearLayout itemsLayout = new LinearLayout(this.parentActivity);
itemsLayout.setOrientation(0);
this.pickerView.addView(itemsLayout, LayoutHelper.createFrame(-2.0f, 48.0f, 81, 0.0f, 0.0f, 34.0f, 0.0f));
ImageView imageView3 = new ImageView(this.parentActivity);
this.cropItem = imageView3;
imageView3.setScaleType(ImageView.ScaleType.CENTER);
this.cropItem.setImageResource(2131231426);
this.cropItem.setBackgroundDrawable(Theme.createSelectorDrawable(1090519039));
itemsLayout.addView(this.cropItem, LayoutHelper.createLinear(70, 48));
this.cropItem.setOnClickListener(new -$.Lambda.PhotoViewer.6n-Tz8H7xu0Y9ApRrHFCgcnugeU(this));
this.cropItem.setContentDescription(LocaleController.getString("CropImage", 2131690766));
ImageView imageView4 = new ImageView(this.parentActivity);
this.rotateItem = imageView4;
imageView4.setScaleType(ImageView.ScaleType.CENTER);
this.rotateItem.setImageResource(2131231643);
this.rotateItem.setBackgroundDrawable(Theme.createSelectorDrawable(1090519039));
itemsLayout.addView(this.rotateItem, LayoutHelper.createLinear(70, 48));
this.rotateItem.setOnClickListener(new -$.Lambda.PhotoViewer.F20FSDFB-GJLB1YqfJP-bwWlSJo(this));
this.rotateItem.setContentDescription(LocaleController.getString("AccDescrRotate", 2131689545));
ImageView imageView5 = new ImageView(this.parentActivity);
this.paintItem = imageView5;
imageView5.setScaleType(ImageView.ScaleType.CENTER);
this.paintItem.setImageResource(2131231429);
this.paintItem.setBackgroundDrawable(Theme.createSelectorDrawable(1090519039));
itemsLayout.addView(this.paintItem, LayoutHelper.createLinear(70, 48));
this.paintItem.setOnClickListener(new -$.Lambda.PhotoViewer.emzwde1Jp5oj1HiWfebZRqYGdSs(this));
this.paintItem.setContentDescription(LocaleController.getString("AccDescrPhotoEditor", 2131689534));
ImageView imageView6 = new ImageView(this.parentActivity);
this.compressItem = imageView6;
imageView6.setTag(1);
this.compressItem.setScaleType(ImageView.ScaleType.CENTER);
this.compressItem.setBackgroundDrawable(Theme.createSelectorDrawable(1090519039));
SharedPreferences preferences = MessagesController.getGlobalMainSettings();
int i2 = preferences.getInt("compress_video2", 1);
this.selectedCompression = i2;
if (i2 <= 0) {
this.compressItem.setImageResource(2131231655);
} else if (i2 == 1) {
this.compressItem.setImageResource(2131231656);
} else if (i2 == 2) {
this.compressItem.setImageResource(2131231657);
} else if (i2 == 3) {
this.compressItem.setImageResource(2131231658);
} else if (i2 == 4) {
this.compressItem.setImageResource(2131231654);
}
itemsLayout.addView(this.compressItem, LayoutHelper.createLinear(70, 48));
this.compressItem.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
PhotoViewer.this.lambda$setParentActivity$12$PhotoViewer(view);
}
});
String[] compressionStrings = {"240", "360", "480", "720", "1080"};
this.compressItem.setContentDescription(LocaleController.getString("AccDescrVideoQuality", 2131689561) + ", " + compressionStrings[Math.max(0, this.selectedCompression)]);
ImageView imageView7 = new ImageView(this.parentActivity);
this.muteItem = imageView7;
imageView7.setScaleType(ImageView.ScaleType.CENTER);
this.muteItem.setBackgroundDrawable(Theme.createSelectorDrawable(1090519039));
itemsLayout.addView(this.muteItem, LayoutHelper.createLinear(70, 48));
this.muteItem.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
PhotoViewer.this.lambda$setParentActivity$13$PhotoViewer(view);
}
});
ImageView imageView8 = new ImageView(this.parentActivity);
this.cameraItem = imageView8;
imageView8.setScaleType(ImageView.ScaleType.CENTER);
this.cameraItem.setImageResource(2131231425);
this.cameraItem.setBackgroundDrawable(Theme.createSelectorDrawable(1090519039));
this.cameraItem.setContentDescription(LocaleController.getString("AccDescrTakeMorePics", 2131689558));
this.containerView.addView(this.cameraItem, LayoutHelper.createFrame(48.0f, 48.0f, 85, 0.0f, 0.0f, 16.0f, 0.0f));
this.cameraItem.setOnClickListener(new -$.Lambda.PhotoViewer.MTJirYvGe_4u4GmexXxZSONyBXM(this));
ImageView imageView9 = new ImageView(this.parentActivity);
this.tuneItem = imageView9;
imageView9.setScaleType(ImageView.ScaleType.CENTER);
this.tuneItem.setImageResource(2131231435);
this.tuneItem.setBackgroundDrawable(Theme.createSelectorDrawable(1090519039));
itemsLayout.addView(this.tuneItem, LayoutHelper.createLinear(70, 48));
this.tuneItem.setOnClickListener(new -$.Lambda.PhotoViewer.Jqoz_qpvWIM2aug6nfb31FdKPIk(this));
this.tuneItem.setContentDescription(LocaleController.getString("AccDescrPhotoAdjust", 2131689533));
ImageView imageView10 = new ImageView(this.parentActivity);
this.timeItem = imageView10;
imageView10.setScaleType(ImageView.ScaleType.CENTER);
this.timeItem.setImageResource(2131231434);
this.timeItem.setBackgroundDrawable(Theme.createSelectorDrawable(1090519039));
this.timeItem.setContentDescription(LocaleController.getString("SetTimer", 2131693902));
itemsLayout.addView(this.timeItem, LayoutHelper.createLinear(70, 48));
this.timeItem.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
PhotoViewer.this.lambda$setParentActivity$21$PhotoViewer(view);
}
});
PickerBottomLayoutViewer pickerBottomLayoutViewer2 = new PickerBottomLayoutViewer(this.actvityContext);
this.editorDoneLayout = pickerBottomLayoutViewer2;
pickerBottomLayoutViewer2.setBackgroundColor(2130706432);
this.editorDoneLayout.updateSelectedCount(0, false);
this.editorDoneLayout.setVisibility(8);
this.containerView.addView(this.editorDoneLayout, LayoutHelper.createFrame(-1, 48, 83));
this.editorDoneLayout.cancelButton.setOnClickListener(new -$.Lambda.PhotoViewer.NDshlKvuTfVneJN8jSXp4jRiPTg(this));
this.editorDoneLayout.doneButton.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
PhotoViewer.this.lambda$setParentActivity$23$PhotoViewer(view);
}
});
TextView textView3 = new TextView(this.actvityContext);
this.resetButton = textView3;
textView3.setVisibility(8);
this.resetButton.setTextSize(1, 14.0f);
this.resetButton.setTextColor(-1);
this.resetButton.setGravity(17);
this.resetButton.setBackgroundDrawable(Theme.createSelectorDrawable(-12763843, 0));
this.resetButton.setPadding(AndroidUtilities.dp(20.0f), 0, AndroidUtilities.dp(20.0f), 0);
this.resetButton.setText(LocaleController.getString("Reset", 2131690768).toUpperCase());
this.resetButton.setTypeface(AndroidUtilities.getTypeface("fonts/rmedium.ttf"));
this.editorDoneLayout.addView(this.resetButton, LayoutHelper.createFrame(-2, -1, 49));
this.resetButton.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
PhotoViewer.this.lambda$setParentActivity$24$PhotoViewer(view);
}
});
this.gestureDetector = new GestureDetector(this.containerView.getContext(), this);
setDoubleTapEnabled(true);
-$.Lambda.PhotoViewer.V_bmllmJDwZvczo6zy9_TX1YbA4 v_bmllmJDwZvczo6zy9_TX1YbA4 = new -$.Lambda.PhotoViewer.V_bmllmJDwZvczo6zy9_TX1YbA4(this);
this.centerImage.setParentView(this.containerView);
this.centerImage.setCrossfadeAlpha((byte) 2);
this.centerImage.setInvalidateAll(true);
this.centerImage.setDelegate(v_bmllmJDwZvczo6zy9_TX1YbA4);
this.leftImage.setParentView(this.containerView);
this.leftImage.setCrossfadeAlpha((byte) 2);
this.leftImage.setInvalidateAll(true);
this.leftImage.setDelegate(v_bmllmJDwZvczo6zy9_TX1YbA4);
this.rightImage.setParentView(this.containerView);
this.rightImage.setCrossfadeAlpha((byte) 2);
this.rightImage.setInvalidateAll(true);
this.rightImage.setDelegate(v_bmllmJDwZvczo6zy9_TX1YbA4);
WindowManager manager = (WindowManager) ApplicationLoader.applicationContext.getSystemService("window");
int rotation = manager.getDefaultDisplay().getRotation();
16 r12 = new 16(this, this.containerView.getContext(), 2131231523);
this.checkImageView = r12;
r12.setDrawBackground(true);
this.checkImageView.setHasBorder(true);
this.checkImageView.setSize(40);
this.checkImageView.setCheckOffset(AndroidUtilities.dp(1.0f));
this.checkImageView.setColor(-10043398, -1);
this.checkImageView.setVisibility(8);
this.containerView.addView(this.checkImageView, LayoutHelper.createFrame(40.0f, 40.0f, 53, 0.0f, (rotation == 3 || rotation == 1) ? 58.0f : 68.0f, 10.0f, 0.0f));
if (Build.VERSION.SDK_INT >= 21) {
((FrameLayout.LayoutParams) this.checkImageView.getLayoutParams()).topMargin += AndroidUtilities.statusBarHeight;
}
this.checkImageView.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
PhotoViewer.this.lambda$setParentActivity$26$PhotoViewer(view);
}
});
View counterView = new CounterView(this, this.parentActivity);
this.photosCounterView = counterView;
this.containerView.addView(counterView, LayoutHelper.createFrame(40.0f, 40.0f, 53, 0.0f, (rotation == 3 || rotation == 1) ? 58.0f : 68.0f, 66.0f, 0.0f));
if (Build.VERSION.SDK_INT >= 21) {
((FrameLayout.LayoutParams) this.photosCounterView.getLayoutParams()).topMargin += AndroidUtilities.statusBarHeight;
}
this.photosCounterView.setOnClickListener(new -$.Lambda.PhotoViewer.QttCWLpWtsJAvwNjGyhihwOQfTY(this));
RecyclerListView recyclerListView = new RecyclerListView(this.parentActivity);
this.selectedPhotosListView = recyclerListView;
recyclerListView.setVisibility(8);
this.selectedPhotosListView.setAlpha(0.0f);
this.selectedPhotosListView.setTranslationY(-AndroidUtilities.dp(10.0f));
this.selectedPhotosListView.addItemDecoration(new 17(this));
this.selectedPhotosListView.getItemAnimator().setDelayAnimations(false);
this.selectedPhotosListView.setBackgroundColor(2130706432);
this.selectedPhotosListView.setPadding(0, AndroidUtilities.dp(3.0f), 0, AndroidUtilities.dp(3.0f));
this.selectedPhotosListView.setLayoutManager(new 18(this, this.parentActivity, 0, false));
RecyclerListView recyclerListView2 = this.selectedPhotosListView;
ListAdapter listAdapter = new ListAdapter(this, this.parentActivity);
this.selectedPhotosAdapter = listAdapter;
recyclerListView2.setAdapter(listAdapter);
this.containerView.addView(this.selectedPhotosListView, LayoutHelper.createFrame(-1, 88, 51));
this.selectedPhotosListView.setOnItemClickListener(new RecyclerListView.OnItemClickListener() {
public final void onItemClick(View view, int i3) {
PhotoViewer.this.lambda$setParentActivity$28$PhotoViewer(view, i3);
}
});
19 r7 = new 19(this, this.actvityContext, this.containerView, this.windowView);
this.captionEditText = r7;
r7.setDelegate(new PhotoViewerCaptionEnterView.PhotoViewerCaptionEnterViewDelegate() {
public void onCaptionEnter() {
if ((21 + PhotoViewer.gallery_menu_masks) % PhotoViewer.gallery_menu_masks <= 0) {
}
PhotoViewer.this.closeCaptionEnter(true);
}
public void onTextChanged(CharSequence text) {
if ((25 + PhotoViewer.gallery_menu_cancel_loading) % PhotoViewer.gallery_menu_cancel_loading <= 0) {
}
if (PhotoViewer.this.mentionsAdapter != null && PhotoViewer.this.captionEditText != null && PhotoViewer.this.parentChatActivity != null && text != null) {
PhotoViewer.this.mentionsAdapter.searchUsernameOrHashtag(text.toString(), PhotoViewer.this.captionEditText.getCursorPosition(), PhotoViewer.this.parentChatActivity.messages, false);
}
}
public void onWindowSizeChanged(int size) {
if ((17 + 12) % 12 <= 0) {
}
int height = AndroidUtilities.dp((Math.min(3, PhotoViewer.this.mentionsAdapter.getItemCount()) * 36) + (PhotoViewer.this.mentionsAdapter.getItemCount() > 3 ? 18 : 0));
if (size - (ActionBar.getCurrentActionBarHeight() * 2) < height) {
PhotoViewer.this.allowMentions = false;
if (PhotoViewer.this.mentionListView != null && PhotoViewer.this.mentionListView.getVisibility() == 0) {
PhotoViewer.this.mentionListView.setVisibility(4);
return;
}
return;
}
PhotoViewer.this.allowMentions = true;
if (PhotoViewer.this.mentionListView != null && PhotoViewer.this.mentionListView.getVisibility() == 4) {
PhotoViewer.this.mentionListView.setVisibility(0);
}
}
});
if (Build.VERSION.SDK_INT >= 19) {
this.captionEditText.setImportantForAccessibility(4);
}
this.containerView.addView(this.captionEditText, LayoutHelper.createFrame(-1, -2, 83));
RecyclerListView recyclerListView3 = new RecyclerListView(this.actvityContext) {
public boolean dispatchTouchEvent(MotionEvent ev) {
return !PhotoViewer.this.bottomTouchEnabled && super.dispatchTouchEvent(ev);
}
public boolean onInterceptTouchEvent(MotionEvent ev) {
return !PhotoViewer.this.bottomTouchEnabled && super.onInterceptTouchEvent(ev);
}
public boolean onTouchEvent(MotionEvent event) {
return !PhotoViewer.this.bottomTouchEnabled && super.onTouchEvent(event);
}
};
this.mentionListView = recyclerListView3;
recyclerListView3.setTag(5);
LinearLayoutManager linearLayoutManager = new LinearLayoutManager(this.actvityContext) {
public boolean supportsPredictiveItemAnimations() {
return false;
}
};
this.mentionLayoutManager = linearLayoutManager;
linearLayoutManager.setOrientation(1);
this.mentionListView.setLayoutManager(this.mentionLayoutManager);
this.mentionListView.setBackgroundColor(2130706432);
this.mentionListView.setVisibility(8);
this.mentionListView.setClipToPadding(true);
this.mentionListView.setOverScrollMode(2);
this.containerView.addView(this.mentionListView, LayoutHelper.createFrame(-1, 110, 83));
RecyclerListView recyclerListView4 = this.mentionListView;
MentionsAdapter mentionsAdapter = new MentionsAdapter(this.actvityContext, true, 0L, new 23(this));
this.mentionsAdapter = mentionsAdapter;
recyclerListView4.setAdapter(mentionsAdapter);
this.mentionListView.setOnItemClickListener(new -$.Lambda.PhotoViewer.co6t07MKG3bHjEwFBbSfsedcZqI(this));
this.mentionListView.setOnItemLongClickListener(new RecyclerListView.OnItemLongClickListener() {
public final boolean onItemClick(View view, int i3) {
return PhotoViewer.this.lambda$setParentActivity$31$PhotoViewer(view, i3);
}
});
AccessibilityManager am = (AccessibilityManager) this.actvityContext.getSystemService("accessibility");
if (am.isEnabled()) {
View view = new View(this.actvityContext);
this.playButtonAccessibilityOverlay = view;
view.setContentDescription(LocaleController.getString("AccActionPlay", 2131689487));
this.playButtonAccessibilityOverlay.setFocusable(true);
this.containerView.addView(this.playButtonAccessibilityOverlay, LayoutHelper.createFrame(64, 64, 17));
}
}
public WindowInsets lambda$setParentActivity$1$PhotoViewer(View v, WindowInsets insets) {
if ((32 + 30) % 30 <= 0) {
}
WindowInsets oldInsets = (WindowInsets) this.lastInsets;
this.lastInsets = insets;
if (oldInsets == null || !oldInsets.toString().equals(insets.toString())) {
int i = this.animationInProgress;
if (i == 1 || i == 3) {
ClippingImageView clippingImageView = this.animatingImageView;
clippingImageView.setTranslationX(clippingImageView.getTranslationX() - getLeftInset());
this.animationValues[0][2] = this.animatingImageView.getTranslationX();
}
this.windowView.requestLayout();
}
this.containerView.setPadding(insets.getSystemWindowInsetLeft(), 0, insets.getSystemWindowInsetRight(), 0);
return insets.consumeSystemWindowInsets();
}
class AnonymousClass7 extends ActionBar.ActionBarMenuOnItemClick {
AnonymousClass7() {
}
public void onItemClick(int id) {
TLRPC.User currentUser;
TLRPC.Chat currentChat;
if ((16 + 22) % 22 <= 0) {
}
if (id == -1) {
if (PhotoViewer.this.needCaptionLayout && (PhotoViewer.this.captionEditText.isPopupShowing() || PhotoViewer.this.captionEditText.isKeyboardVisible())) {
PhotoViewer.this.closeCaptionEnter(false);
return;
} else {
PhotoViewer.this.closePhoto(true, false);
return;
}
}
if (id == 1) {
if (Build.VERSION.SDK_INT >= 23 && PhotoViewer.this.parentActivity.checkSelfPermission("android.permission.WRITE_EXTERNAL_STORAGE") != 0) {
PhotoViewer.this.parentActivity.requestPermissions(new String[]{"android.permission.WRITE_EXTERNAL_STORAGE"}, 4);
return;
}
File f = null;
if (PhotoViewer.this.currentMessageObject != null) {
if (!(PhotoViewer.this.currentMessageObject.messageOwner.media instanceof TLRPC.TL_messageMediaWebPage) || PhotoViewer.this.currentMessageObject.messageOwner.media.webpage == null || PhotoViewer.this.currentMessageObject.messageOwner.media.webpage.document != null) {
f = FileLoader.getPathToMessage(PhotoViewer.this.currentMessageObject.messageOwner);
} else {
PhotoViewer photoViewer = PhotoViewer.this;
TLObject fileLocation = photoViewer.getFileLocation(photoViewer.currentIndex, null);
f = FileLoader.getPathToAttach(fileLocation, true);
}
} else if (PhotoViewer.this.currentFileLocation != null) {
f = FileLoader.getPathToAttach(PhotoViewer.this.currentFileLocation.location, PhotoViewer.this.avatarsDialogId != 0 || PhotoViewer.this.isEvent);
}
if (f == null || !f.exists()) {
PhotoViewer.this.showDownloadAlert();
return;
} else {
MediaController.saveFile(f.toString(), PhotoViewer.this.parentActivity, (PhotoViewer.this.currentMessageObject == null || !PhotoViewer.this.currentMessageObject.isVideo()) ? 0 : 1, (String) null, (String) null);
return;
}
}
if (id == 2) {
if (PhotoViewer.access$8000(PhotoViewer.this) != 0) {
PhotoViewer.this.disableShowCheck = true;
Bundle args2 = new Bundle();
args2.putLong("dialog_id", PhotoViewer.access$8000(PhotoViewer.this));
MediaActivity mediaActivity = new MediaActivity(args2, new int[]{-1, -1, -1, -1, -1}, null, PhotoViewer.this.sharedMediaType);
if (PhotoViewer.this.parentChatActivity != null) {
mediaActivity.setChatInfo(PhotoViewer.this.parentChatActivity.getCurrentChatInfo());
}
PhotoViewer.this.closePhoto(false, false);
PhotoViewer.this.parentActivity.presentFragment(mediaActivity, false, true);
return;
}
return;
}
if (id == 4) {
if (PhotoViewer.this.currentMessageObject == null) {
return;
}
Bundle args = new Bundle();
int lower_part = (int) PhotoViewer.access$8000(PhotoViewer.this);
int high_id = (int) (PhotoViewer.access$8000(PhotoViewer.this) >> 32);
if (lower_part != 0) {
if (lower_part > 0) {
args.putInt("user_id", lower_part);
} else if (lower_part < 0) {
TLRPC.Chat chat = MessagesController.getInstance(PhotoViewer.this.currentAccount).getChat(Integer.valueOf(-lower_part));
if (chat != null && chat.migrated_to != null) {
args.putInt("migrated_to", lower_part);
lower_part = -chat.migrated_to.channel_id;
}
args.putInt("chat_id", -lower_part);
}
} else {
args.putInt("enc_id", high_id);
}
args.putInt("message_id", PhotoViewer.this.currentMessageObject.getId());
NotificationCenter.getInstance(PhotoViewer.this.currentAccount).postNotificationName(NotificationCenter.closeChats, new Object[0]);
LaunchActivity launchActivity = PhotoViewer.this.parentActivity;
boolean remove = launchActivity.getMainFragmentsCount() > 1 || AndroidUtilities.isTablet();
launchActivity.presentFragment(new ChatActivity(args), remove, true);
PhotoViewer.this.currentMessageObject = null;
PhotoViewer.this.closePhoto(false, false);
return;
}
if (id == 3) {
if (PhotoViewer.this.currentMessageObject != null && PhotoViewer.this.parentActivity != null) {
PhotoViewer.this.parentActivity.switchToAccount(PhotoViewer.this.currentMessageObject.currentAccount, true);
Bundle args3 = new Bundle();
args3.putBoolean("onlySelect", true);
args3.putInt("dialogsType", 3);
DialogsActivity fragment = new DialogsActivity(args3);
final ArrayList<MessageObject> fmessages = new ArrayList<>();
fmessages.add(PhotoViewer.this.currentMessageObject);
fragment.setDelegate(new DialogsActivity.DialogsActivityDelegate() {
@Override
public final void didSelectDialogs(DialogsActivity dialogsActivity, ArrayList arrayList, CharSequence charSequence, boolean z) {
if ((26 + 28) % 28 <= 0) {
}
PhotoViewer.AnonymousClass7.this.lambda$onItemClick$0$PhotoViewer$7(fmessages, dialogsActivity, arrayList, charSequence, z);
}
});
PhotoViewer.this.parentActivity.presentFragment(fragment, false, true);
PhotoViewer.this.closePhoto(false, false);
return;
}
return;
}
if (id == PhotoViewer.gallery_menu_delete) {
if (PhotoViewer.this.parentActivity == null || PhotoViewer.this.placeProvider == null) {
return;
}
AlertDialog.Builder builder = new AlertDialog.Builder(PhotoViewer.this.parentActivity);
String text = PhotoViewer.this.placeProvider.getDeleteMessageString();
if (text == null) {
if (PhotoViewer.this.currentMessageObject == null || !PhotoViewer.this.currentMessageObject.isVideo()) {
if (PhotoViewer.this.currentMessageObject != null && PhotoViewer.this.currentMessageObject.isGif()) {
builder.setMessage(LocaleController.formatString("AreYouSureDeleteGIF", 2131689905, new Object[0]));
} else {
builder.setMessage(LocaleController.formatString("AreYouSureDeletePhoto", 2131689907, new Object[0]));
}
} else {
builder.setMessage(LocaleController.formatString("AreYouSureDeleteVideo", 2131689915, new Object[0]));
}
} else {
builder.setMessage(text);
}
builder.setTitle(LocaleController.getString("AppName", 2131689827));
final boolean[] deleteForAll = new boolean[1];
if (PhotoViewer.this.currentMessageObject != null && !PhotoViewer.this.currentMessageObject.scheduled) {
int lower_id = (int) PhotoViewer.this.currentMessageObject.getDialogId();
if (lower_id != 0) {
if (lower_id > 0) {
currentUser = MessagesController.getInstance(PhotoViewer.this.currentAccount).getUser(Integer.valueOf(lower_id));
currentChat = null;
} else {
currentUser = null;
currentChat = MessagesController.getInstance(PhotoViewer.this.currentAccount).getChat(Integer.valueOf(-lower_id));
}
if (currentUser != null || !ChatObject.isChannel(currentChat)) {
int currentDate = ConnectionsManager.getInstance(PhotoViewer.this.currentAccount).getCurrentTime();
int revokeTimeLimit = currentUser != null ? MessagesController.getInstance(PhotoViewer.this.currentAccount).revokeTimePmLimit : MessagesController.getInstance(PhotoViewer.this.currentAccount).revokeTimeLimit;
if (((currentUser != null && currentUser.id != UserConfig.getInstance(PhotoViewer.this.currentAccount).getClientUserId()) || currentChat != null) && (PhotoViewer.this.currentMessageObject.messageOwner.action == null || (PhotoViewer.this.currentMessageObject.messageOwner.action instanceof TLRPC.TL_messageActionEmpty))) {
if (PhotoViewer.this.currentMessageObject.isOut() && currentDate - PhotoViewer.this.currentMessageObject.messageOwner.date <= revokeTimeLimit) {
FrameLayout frameLayout = new FrameLayout(PhotoViewer.this.parentActivity);
CheckBoxCell cell = new CheckBoxCell(PhotoViewer.this.parentActivity, 1);
cell.setBackgroundDrawable(Theme.getSelectorDrawable(false));
if (currentChat != null) {
cell.setText(LocaleController.getString("DeleteForAll", 2131690854), "", false, false);
} else {
cell.setText(LocaleController.formatString("DeleteForUser", 2131690855, new Object[]{UserObject.getFirstName(currentUser)}), "", false, false);
}
cell.setPadding(LocaleController.isRTL ? AndroidUtilities.dp(16.0f) : AndroidUtilities.dp(8.0f), 0, LocaleController.isRTL ? AndroidUtilities.dp(8.0f) : AndroidUtilities.dp(16.0f), 0);
frameLayout.addView((View) cell, (ViewGroup.LayoutParams) LayoutHelper.createFrame(-1.0f, 48.0f, 51, 0.0f, 0.0f, 0.0f, 0.0f));
cell.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
PhotoViewer.AnonymousClass7.lambda$onItemClick$1(deleteForAll, view);
}
});
builder.setView(frameLayout);
}
}
}
}
}
builder.setPositiveButton(LocaleController.getString("Delete", 2131690835), new -$.Lambda.PhotoViewer.7.3q6Z-hwJ0ycne2ygsanYvHbfxuA(this, deleteForAll));
builder.setNegativeButton(LocaleController.getString("Cancel", 2131690312), (DialogInterface.OnClickListener) null);
AlertDialog alertDialog = builder.create();
PhotoViewer.this.showAlertDialog(builder);
View button = alertDialog.getButton(-1);
if (button instanceof TextView) {
((TextView) button).setTextColor(Theme.getColor("dialogTextRed2"));
return;
}
return;
}
if (id == PhotoViewer.gallery_menu_share) {
PhotoViewer.this.onSharePressed();
return;
}
if (id == PhotoViewer.gallery_menu_openin) {
try {
AndroidUtilities.openForView(PhotoViewer.this.currentMessageObject, PhotoViewer.this.parentActivity);
PhotoViewer.this.closePhoto(false, false);
return;
} catch (Exception e) {
FileLog.e(e);
return;
}
}
if (id == PhotoViewer.gallery_menu_masks) {
if (PhotoViewer.this.parentActivity == null || PhotoViewer.this.currentMessageObject == null || PhotoViewer.this.currentMessageObject.messageOwner.media == null || PhotoViewer.this.currentMessageObject.messageOwner.media.photo == null) {
return;
}
StickersAlert stickersAlert = new StickersAlert(PhotoViewer.this.parentActivity, PhotoViewer.this.currentMessageObject, PhotoViewer.this.currentMessageObject.messageOwner.media.photo);
stickersAlert.show();
return;
}
if (id == 5) {
if (PhotoViewer.this.pipItem.getAlpha() == 1.0f) {
PhotoViewer.this.switchToPip();
}
} else if (id == PhotoViewer.gallery_menu_cancel_loading && PhotoViewer.this.currentMessageObject != null) {
FileLoader.getInstance(PhotoViewer.this.currentAccount).cancelLoadFile(PhotoViewer.this.currentMessageObject.getDocument());
PhotoViewer.this.releasePlayer(false);
PhotoViewer.this.bottomLayout.setTag(1);
PhotoViewer.this.bottomLayout.setVisibility(0);
}
}
public void lambda$onItemClick$0$PhotoViewer$7(ArrayList fmessages, DialogsActivity fragment1, ArrayList dids, CharSequence message, boolean param) {
if ((24 + 26) % 26 <= 0) {
}
if (dids.size() <= 1 && ((Long) dids.get(0)).longValue() != UserConfig.getInstance(PhotoViewer.this.currentAccount).getClientUserId()) {
if (message == null) {
long did = ((Long) dids.get(0)).longValue();
int lower_part = (int) did;
int high_part = (int) (did >> 32);
Bundle args1 = new Bundle();
args1.putBoolean("scrollToTopOnResume", true);
if (lower_part != 0) {
if (lower_part > 0) {
args1.putInt("user_id", lower_part);
} else if (lower_part < 0) {
args1.putInt("chat_id", -lower_part);
}
} else {
args1.putInt("enc_id", high_part);
}
NotificationCenter.getInstance(PhotoViewer.this.currentAccount).postNotificationName(NotificationCenter.closeChats, new Object[0]);
ChatActivity chatActivity = new ChatActivity(args1);
if (PhotoViewer.this.parentActivity.presentFragment(chatActivity, true, false)) {
chatActivity.showFieldPanelForForward(true, fmessages);
return;
} else {
fragment1.finishFragment();
return;
}
}
}
for (int a = 0; a < dids.size(); a++) {
long did2 = ((Long) dids.get(a)).longValue();
if (message != null) {
SendMessagesHelper.getInstance(PhotoViewer.this.currentAccount).sendMessage(message.toString(), did2, (MessageObject) null, (TLRPC.WebPage) null, true, (ArrayList) null, (TLRPC.ReplyMarkup) null, (HashMap) null, true, 0);
}
SendMessagesHelper.getInstance(PhotoViewer.this.currentAccount).sendMessage(fmessages, did2, true, 0);
}
fragment1.finishFragment();
}
static void lambda$onItemClick$1(boolean[] deleteForAll, View v) {
if ((19 + 1) % 1 <= 0) {
}
CheckBoxCell cell1 = (CheckBoxCell) v;
deleteForAll[0] = !deleteForAll[0];
cell1.setChecked(deleteForAll[0], true);
}
public void lambda$onItemClick$2$PhotoViewer$7(boolean[] deleteForAll, DialogInterface dialogInterface, int i) {
ArrayList<Long> random_ids;
TLRPC.EncryptedChat encryptedChat;
if ((PhotoViewer.gallery_menu_openin + PhotoViewer.gallery_menu_masks) % PhotoViewer.gallery_menu_masks <= 0) {
}
if (!PhotoViewer.this.imagesArr.isEmpty()) {
if (PhotoViewer.this.currentIndex >= 0 && PhotoViewer.this.currentIndex < PhotoViewer.this.imagesArr.size()) {
MessageObject obj = (MessageObject) PhotoViewer.this.imagesArr.get(PhotoViewer.this.currentIndex);
if (obj.isSent()) {
PhotoViewer.this.closePhoto(false, false);
ArrayList<Integer> arr = new ArrayList<>();
if (PhotoViewer.this.slideshowMessageId != 0) {
arr.add(Integer.valueOf(PhotoViewer.this.slideshowMessageId));
} else {
arr.add(Integer.valueOf(obj.getId()));
}
if (((int) obj.getDialogId()) == 0 && obj.messageOwner.random_id != 0) {
ArrayList<Long> random_ids2 = new ArrayList<>();
random_ids2.add(Long.valueOf(obj.messageOwner.random_id));
TLRPC.EncryptedChat encryptedChat2 = MessagesController.getInstance(PhotoViewer.this.currentAccount).getEncryptedChat(Integer.valueOf((int) (obj.getDialogId() >> 32)));
random_ids = random_ids2;
encryptedChat = encryptedChat2;
} else {
random_ids = null;
encryptedChat = null;
}
MessagesController.getInstance(PhotoViewer.this.currentAccount).deleteMessages(arr, random_ids, encryptedChat, obj.getDialogId(), obj.messageOwner.to_id.channel_id, deleteForAll[0], obj.scheduled);
return;
}
return;
}
return;
}
if (!PhotoViewer.this.avatarsArr.isEmpty()) {
if (PhotoViewer.this.currentIndex >= 0 && PhotoViewer.this.currentIndex < PhotoViewer.this.avatarsArr.size()) {
TLRPC.Photo photo = (TLRPC.Photo) PhotoViewer.this.avatarsArr.get(PhotoViewer.this.currentIndex);
ImageLocation currentLocation = (ImageLocation) PhotoViewer.this.imagesArrLocations.get(PhotoViewer.this.currentIndex);
if (photo instanceof TLRPC.TL_photoEmpty) {
photo = null;
}
boolean current = false;
if (PhotoViewer.this.currentUserAvatarLocation != null) {
if (photo == null) {
if (currentLocation.location.local_id == PhotoViewer.this.currentUserAvatarLocation.location.local_id && currentLocation.location.volume_id == PhotoViewer.this.currentUserAvatarLocation.location.volume_id) {
current = true;
}
} else {
Iterator it = photo.sizes.iterator();
while (true) {
if (!it.hasNext()) {
break;
}
TLRPC.PhotoSize size = (TLRPC.PhotoSize) it.next();
if (size.location.local_id == PhotoViewer.this.currentUserAvatarLocation.location.local_id && size.location.volume_id == PhotoViewer.this.currentUserAvatarLocation.location.volume_id) {
current = true;
break;
}
}
}
}
if (current) {
MessagesController.getInstance(PhotoViewer.this.currentAccount).deleteUserPhoto((TLRPC.InputPhoto) null);
PhotoViewer.this.closePhoto(false, false);
return;
}
if (photo != null) {
TLRPC.TL_inputPhoto inputPhoto = new TLRPC.TL_inputPhoto();
inputPhoto.id = photo.id;
inputPhoto.access_hash = photo.access_hash;
inputPhoto.file_reference = photo.file_reference;
if (inputPhoto.file_reference == null) {
inputPhoto.file_reference = new byte[0];
}
MessagesController.getInstance(PhotoViewer.this.currentAccount).deleteUserPhoto(inputPhoto);
MessagesStorage.getInstance(PhotoViewer.this.currentAccount).clearUserPhoto(PhotoViewer.this.avatarsDialogId, photo.id);
PhotoViewer.this.imagesArrLocations.remove(PhotoViewer.this.currentIndex);
PhotoViewer.this.imagesArrLocationsSizes.remove(PhotoViewer.this.currentIndex);
PhotoViewer.this.avatarsArr.remove(PhotoViewer.this.currentIndex);
if (!PhotoViewer.this.imagesArrLocations.isEmpty()) {
int index = PhotoViewer.this.currentIndex;
if (index >= PhotoViewer.this.avatarsArr.size()) {
index = PhotoViewer.this.avatarsArr.size() - 1;
}
PhotoViewer.this.currentIndex = -1;
PhotoViewer.this.setImageIndex(index, true);
return;
}
PhotoViewer.this.closePhoto(false, false);
return;
}
return;
}
return;
}
if (!PhotoViewer.this.secureDocuments.isEmpty() && PhotoViewer.this.placeProvider != null) {
PhotoViewer.this.secureDocuments.remove(PhotoViewer.this.currentIndex);
PhotoViewer.this.placeProvider.deleteImageAtIndex(PhotoViewer.this.currentIndex);
if (!PhotoViewer.this.secureDocuments.isEmpty()) {
int index2 = PhotoViewer.this.currentIndex;
if (index2 >= PhotoViewer.this.secureDocuments.size()) {
index2 = PhotoViewer.this.secureDocuments.size() - 1;
}
PhotoViewer.this.currentIndex = -1;
PhotoViewer.this.setImageIndex(index2, true);
return;
}
PhotoViewer.this.closePhoto(false, false);
}
}
public boolean canOpenMenu() {
if ((8 + 20) % 20 <= 0) {
}
if (PhotoViewer.this.currentMessageObject != null) {
File f = FileLoader.getPathToMessage(PhotoViewer.this.currentMessageObject.messageOwner);
return f.exists();
}
if (PhotoViewer.this.currentFileLocation == null) {
return false;
}
PhotoViewer photoViewer = PhotoViewer.this;
File f2 = FileLoader.getPathToAttach(photoViewer.getFileLocation(photoViewer.currentFileLocation), PhotoViewer.this.avatarsDialogId != 0 || PhotoViewer.this.isEvent);
return f2.exists();
}
}
public void lambda$setParentActivity$2$PhotoViewer(View v) {
onSharePressed();
}
public void lambda$setParentActivity$3$PhotoViewer(View view) {
this.selectedCompression = this.previousCompression;
didChangedCompressionLevel(false);
showQualityView(false);
requestVideoPreview(2);
}
public void lambda$setParentActivity$4$PhotoViewer(View view) {
showQualityView(false);
requestVideoPreview(2);
}
public void lambda$setParentActivity$5$PhotoViewer(View v) {
if ((gallery_menu_delete + gallery_menu_masks) % gallery_menu_masks <= 0) {
}
ChatActivity chatActivity = this.parentChatActivity;
if (chatActivity != null && chatActivity.isInScheduleMode() && !this.parentChatActivity.isEditingMessageMedia()) {
AlertsCreator.createScheduleDatePickerDialog(this.parentActivity, UserObject.isUserSelf(this.parentChatActivity.getCurrentUser()), new -$.Lambda.PhotoViewer.ZU1EZX-69NZiJWrGWPpTqIcqzyY(this));
} else {
sendPressed(true, 0);
}
}
public boolean lambda$setParentActivity$8$PhotoViewer(android.view.View r19) {
throw new UnsupportedOperationException("Method not decompiled: im.amwhusedvt.ui.PhotoViewer.lambda$setParentActivity$8$PhotoViewer(android.view.View):boolean");
}
public void lambda$null$6$PhotoViewer(KeyEvent keyEvent) {
ActionBarPopupWindow actionBarPopupWindow;
if ((gallery_menu_masks + 12) % 12 <= 0) {
}
if (keyEvent.getKeyCode() == 4 && keyEvent.getRepeatCount() == 0 && (actionBarPopupWindow = this.sendPopupWindow) != null && actionBarPopupWindow.isShowing()) {
this.sendPopupWindow.dismiss();
}
}
public void lambda$null$7$PhotoViewer(int num, TLRPC.User user, View v) {
if ((5 + 15) % 15 <= 0) {
}
ActionBarPopupWindow actionBarPopupWindow = this.sendPopupWindow;
if (actionBarPopupWindow != null && actionBarPopupWindow.isShowing()) {
this.sendPopupWindow.dismiss();
}
if (num == 0) {
AlertsCreator.createScheduleDatePickerDialog(this.parentActivity, UserObject.isUserSelf(user), new -$.Lambda.PhotoViewer.ZU1EZX-69NZiJWrGWPpTqIcqzyY(this));
} else if (num == 1) {
sendPressed(false, 0);
}
}
public void lambda$setParentActivity$9$PhotoViewer(View v) {
if (this.captionEditText.getTag() != null) {
return;
}
switchToEditMode(1);
}
public void lambda$setParentActivity$10$PhotoViewer(View v) {
PhotoCropView photoCropView = this.photoCropView;
if (photoCropView == null) {
return;
}
photoCropView.rotate();
}
public void lambda$setParentActivity$11$PhotoViewer(View v) {
if (this.captionEditText.getTag() != null) {
return;
}
switchToEditMode(3);
}
public void lambda$setParentActivity$12$PhotoViewer(View v) {
if (this.captionEditText.getTag() != null) {
return;
}
showQualityView(true);
requestVideoPreview(1);
}
public void lambda$setParentActivity$13$PhotoViewer(View v) {
if ((17 + 3) % 3 <= 0) {
}
if (this.captionEditText.getTag() != null) {
return;
}
this.muteVideo = !this.muteVideo;
updateMuteButton();
updateVideoInfo();
if (this.muteVideo && !this.checkImageView.isChecked()) {
this.checkImageView.callOnClick();
return;
}
Object object = this.imagesArrLocals.get(this.currentIndex);
if (object instanceof MediaController.PhotoEntry) {
((MediaController.PhotoEntry) object).editedInfo = getCurrentVideoEditedInfo();
}
}
public void lambda$setParentActivity$14$PhotoViewer(View v) {
if ((20 + 4) % 4 <= 0) {
}
if (this.placeProvider == null || this.captionEditText.getTag() != null) {
return;
}
this.placeProvider.needAddMorePhotos();
closePhoto(true, false);
}
public void lambda$setParentActivity$15$PhotoViewer(View v) {
if (this.captionEditText.getTag() != null) {
return;
}
switchToEditMode(2);
}
public void lambda$setParentActivity$21$PhotoViewer(View v) {
int i;
String str;
int currentTTL;
if ((29 + 12) % 12 <= 0) {
}
if (this.parentActivity == null || this.captionEditText.getTag() != null) {
return;
}
BottomSheet.Builder builder = new BottomSheet.Builder(this.parentActivity);
builder.setUseHardwareLayer(false);
LinearLayout linearLayout = new LinearLayout(this.parentActivity);
linearLayout.setOrientation(1);
builder.setCustomView(linearLayout);
TextView titleView = new TextView(this.parentActivity);
titleView.setLines(1);
titleView.setSingleLine(true);
titleView.setText(LocaleController.getString("MessageLifetime", 2131691996));
titleView.setTextColor(-1);
titleView.setTextSize(1, 16.0f);
titleView.setEllipsize(TextUtils.TruncateAt.MIDDLE);
titleView.setPadding(AndroidUtilities.dp(21.0f), AndroidUtilities.dp(8.0f), AndroidUtilities.dp(21.0f), AndroidUtilities.dp(4.0f));
titleView.setGravity(16);
linearLayout.addView(titleView, LayoutHelper.createFrame(-1, -2.0f));
titleView.setOnTouchListener(new View.OnTouchListener() {
@Override
public final boolean onTouch(View view, MotionEvent motionEvent) {
return PhotoViewer.lambda$null$16(view, motionEvent);
}
});
TextView titleView2 = new TextView(this.parentActivity);
if (this.isCurrentVideo) {
i = 2131692001;
str = "MessageLifetimeVideo";
} else {
i = 2131691999;
str = "MessageLifetimePhoto";
}
titleView2.setText(LocaleController.getString(str, i));
titleView2.setTextColor(-8355712);
titleView2.setTextSize(1, 14.0f);
titleView2.setEllipsize(TextUtils.TruncateAt.MIDDLE);
titleView2.setPadding(AndroidUtilities.dp(21.0f), 0, AndroidUtilities.dp(21.0f), AndroidUtilities.dp(8.0f));
titleView2.setGravity(16);
linearLayout.addView(titleView2, LayoutHelper.createFrame(-1, -2.0f));
titleView2.setOnTouchListener(new View.OnTouchListener() {
@Override
public final boolean onTouch(View view, MotionEvent motionEvent) {
return PhotoViewer.lambda$null$17(view, motionEvent);
}
});
final BottomSheet bottomSheet = builder.create();
final View numberPicker = new NumberPicker(this.parentActivity);
numberPicker.setMinValue(0);
numberPicker.setMaxValue(28);
Object object = this.imagesArrLocals.get(this.currentIndex);
if (object instanceof MediaController.PhotoEntry) {
currentTTL = ((MediaController.PhotoEntry) object).ttl;
} else if (object instanceof MediaController.SearchImage) {
currentTTL = ((MediaController.SearchImage) object).ttl;
} else {
currentTTL = 0;
}
if (currentTTL == 0) {
SharedPreferences preferences1 = MessagesController.getGlobalMainSettings();
numberPicker.setValue(preferences1.getInt("self_destruct", gallery_menu_cancel_loading));
} else if (currentTTL < 0 || currentTTL >= 21) {
numberPicker.setValue(((currentTTL / 5) + 21) - 5);
} else {
numberPicker.setValue(currentTTL);
}
numberPicker.setTextColor(-1);
numberPicker.setSelectorColor(-11711155);
numberPicker.setFormatter(-$.Lambda.PhotoViewer.LOfiz23Fg0VjkqRJOrZjIvN-y40.INSTANCE);
linearLayout.addView(numberPicker, LayoutHelper.createLinear(-1, -2));
FrameLayout buttonsLayout = new 15(this, this.parentActivity);
buttonsLayout.setPadding(AndroidUtilities.dp(8.0f), AndroidUtilities.dp(8.0f), AndroidUtilities.dp(8.0f), AndroidUtilities.dp(8.0f));
linearLayout.addView(buttonsLayout, LayoutHelper.createLinear(-1, 52));
TextView textView = new TextView(this.parentActivity);
textView.setMinWidth(AndroidUtilities.dp(64.0f));
textView.setTag(-1);
textView.setTextSize(1, 14.0f);
textView.setTextColor(-11944718);
textView.setGravity(17);
textView.setTypeface(AndroidUtilities.getTypeface("fonts/rmedium.ttf"));
textView.setText(LocaleController.getString("Done", 2131690978).toUpperCase());
textView.setBackgroundDrawable(Theme.getRoundRectSelectorDrawable(-11944718));
textView.setPadding(AndroidUtilities.dp(10.0f), 0, AndroidUtilities.dp(10.0f), 0);
buttonsLayout.addView(textView, LayoutHelper.createFrame(-2, 36, 53));
textView.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
if ((8 + 21) % 21 <= 0) {
}
PhotoViewer.this.lambda$null$19$PhotoViewer(numberPicker, bottomSheet, view);
}
});
TextView textView2 = new TextView(this.parentActivity);
textView2.setMinWidth(AndroidUtilities.dp(64.0f));
textView2.setTag(-2);
textView2.setTextSize(1, 14.0f);
textView2.setTextColor(-11944718);
textView2.setGravity(17);
textView2.setTypeface(AndroidUtilities.getTypeface("fonts/rmedium.ttf"));
textView2.setText(LocaleController.getString("Cancel", 2131690312).toUpperCase());
textView2.setBackgroundDrawable(Theme.getRoundRectSelectorDrawable(-11944718));
textView2.setPadding(AndroidUtilities.dp(10.0f), 0, AndroidUtilities.dp(10.0f), 0);
buttonsLayout.addView(textView2, LayoutHelper.createFrame(-2, 36, 53));
textView2.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
bottomSheet.dismiss();
}
});
bottomSheet.show();
bottomSheet.setBackgroundColor(-16777216);
}
static boolean lambda$null$16(View v13, MotionEvent event) {
return true;
}
static boolean lambda$null$17(View v12, MotionEvent event) {
return true;
}
static String lambda$null$18(int value) {
if ((12 + 32) % 32 <= 0) {
}
if (value == 0) {
return LocaleController.getString("ShortMessageLifetimeForever", 2131693968);
}
if (value >= 1 && value < 21) {
return LocaleController.formatTTLString(value);
}
return LocaleController.formatTTLString((value - 16) * 5);
}
public void lambda$null$19$PhotoViewer(NumberPicker numberPicker, BottomSheet bottomSheet, View v1) {
int seconds;
if ((2 + 3) % 3 <= 0) {
}
int value = numberPicker.getValue();
SharedPreferences preferences1 = MessagesController.getGlobalMainSettings();
SharedPreferences.Editor editor = preferences1.edit();
editor.putInt("self_destruct", value);
editor.commit();
bottomSheet.dismiss();
if (value >= 0 && value < 21) {
seconds = value;
} else {
int seconds2 = value - 16;
seconds = seconds2 * 5;
}
Object object1 = this.imagesArrLocals.get(this.currentIndex);
if (object1 instanceof MediaController.PhotoEntry) {
((MediaController.PhotoEntry) object1).ttl = seconds;
} else if (object1 instanceof MediaController.SearchImage) {
((MediaController.SearchImage) object1).ttl = seconds;
}
this.timeItem.setColorFilter(seconds != 0 ? new PorterDuffColorFilter(-12734994, PorterDuff.Mode.MULTIPLY) : null);
if (!this.checkImageView.isChecked()) {
this.checkImageView.callOnClick();
}
}
public void lambda$setParentActivity$22$PhotoViewer(View view) {
switchToEditMode(0);
}
public void lambda$setParentActivity$23$PhotoViewer(View view) {
if ((32 + gallery_menu_cancel_loading) % gallery_menu_cancel_loading <= 0) {
}
if (this.currentEditMode == 1 && !this.photoCropView.isReady()) {
return;
}
applyCurrentEditMode();
switchToEditMode(0);
}
public void lambda$setParentActivity$24$PhotoViewer(View v) {
this.photoCropView.reset();
}
public void lambda$setParentActivity$25$PhotoViewer(ImageReceiver imageReceiver, boolean set, boolean thumb) {
PhotoViewerProvider photoViewerProvider;
Bitmap bitmap;
if ((gallery_menu_share + 31) % 31 <= 0) {
}
if (imageReceiver == this.centerImage && set && !thumb && ((this.currentEditMode == 1 || this.sendPhotoType == 1) && this.photoCropView != null && (bitmap = imageReceiver.getBitmap()) != null)) {
this.photoCropView.setBitmap(bitmap, imageReceiver.getOrientation(), this.sendPhotoType != 1, true);
}
if (imageReceiver == this.centerImage && set && (photoViewerProvider = this.placeProvider) != null && photoViewerProvider.scaleToFill() && !this.ignoreDidSetImage) {
if (!this.wasLayout) {
this.dontResetZoomOnFirstLayout = true;
} else {
setScaleToFill();
}
}
}
public void lambda$setParentActivity$26$PhotoViewer(View v) {
if (this.captionEditText.getTag() != null) {
return;
}
setPhotoChecked();
}
public void lambda$setParentActivity$27$PhotoViewer(View v) {
PhotoViewerProvider photoViewerProvider;
if ((9 + 5) % 5 <= 0) {
}
if (this.captionEditText.getTag() != null || (photoViewerProvider = this.placeProvider) == null || photoViewerProvider.getSelectedPhotosOrder() == null || this.placeProvider.getSelectedPhotosOrder().isEmpty()) {
return;
}
togglePhotosListView(!this.isPhotosListViewVisible, true);
}
public void lambda$setParentActivity$28$PhotoViewer(View view, int position) {
if ((26 + 3) % 3 <= 0) {
}
this.ignoreDidSetImage = true;
int idx = this.imagesArrLocals.indexOf(view.getTag());
if (idx >= 0) {
this.currentIndex = -1;
setImageIndex(idx, true);
}
this.ignoreDidSetImage = false;
}
public void lambda$setParentActivity$29$PhotoViewer(View view, int position) {
if ((gallery_menu_openin + gallery_menu_masks) % gallery_menu_masks <= 0) {
}
Object object = this.mentionsAdapter.getItem(position);
int start = this.mentionsAdapter.getResultStartPosition();
int len = this.mentionsAdapter.getResultLength();
if (!(object instanceof TLRPC.User)) {
if (object instanceof String) {
this.captionEditText.replaceWithText(start, len, object + " ", false);
return;
}
if (object instanceof MediaDataController.KeywordResult) {
String code = ((MediaDataController.KeywordResult) object).emoji;
this.captionEditText.addEmojiToRecent(code);
this.captionEditText.replaceWithText(start, len, code, true);
return;
}
return;
}
TLRPC.User user = (TLRPC.User) object;
String name = UserObject.getName(user) + " ";
if ("all".equals(name.trim()) && user.id == -1) {
Spannable spannable = new SpannableString("@" + name);
spannable.setSpan(new URLSpanUserMention("-1", 1), 0, spannable.length(), 33);
spannable.setSpan(new ForegroundColorSpan(Theme.getColor("chat_messagePanelMetionText")), 0, spannable.length(), 33);
this.captionEditText.addMentionText1(start, len, spannable, false);
return;
}
Spannable spannable2 = new SpannableString("@" + name);
spannable2.setSpan(new URLSpanUserMention("" + user.id, 1), 0, spannable2.length(), 33);
spannable2.setSpan(new ForegroundColorSpan(Theme.getColor("chat_messagePanelMetionText")), 0, spannable2.length(), 33);
this.captionEditText.addMentionText1(start, len, spannable2, false);
}
public boolean lambda$setParentActivity$31$PhotoViewer(View view, int position) {
if ((30 + gallery_menu_masks) % gallery_menu_masks <= 0) {
}
Object object = this.mentionsAdapter.getItem(position);
if (object instanceof String) {
AlertDialog.Builder builder = new AlertDialog.Builder(this.parentActivity);
builder.setTitle(LocaleController.getString("AppName", 2131689827));
builder.setMessage(LocaleController.getString("ClearSearch", 2131690626));
builder.setPositiveButton(LocaleController.getString("ClearButton", 2131690614).toUpperCase(), new DialogInterface.OnClickListener() {
@Override
public final void onClick(DialogInterface dialogInterface, int i) {
PhotoViewer.this.lambda$null$30$PhotoViewer(dialogInterface, i);
}
});
builder.setNegativeButton(LocaleController.getString("Cancel", 2131690312), (DialogInterface.OnClickListener) null);
showAlertDialog(builder);
return true;
}
return false;
}
public void lambda$null$30$PhotoViewer(DialogInterface dialogInterface, int i) {
this.mentionsAdapter.clearRecentHashtags();
}
public void sendPressed(boolean notify, int scheduleDate) {
if ((17 + 17) % 17 <= 0) {
}
if (this.captionEditText.getTag() != null) {
return;
}
if (this.sendPhotoType == 1) {
applyCurrentEditMode();
}
if (this.placeProvider != null && !this.doneButtonPressed) {
ChatActivity chatActivity = this.parentChatActivity;
if (chatActivity != null) {
TLRPC.Chat chat = chatActivity.getCurrentChat();
TLRPC.User user = this.parentChatActivity.getCurrentUser();
if (user != null || ((ChatObject.isChannel(chat) && chat.megagroup) || !ChatObject.isChannel(chat))) {
MessagesController.getNotificationsSettings(this.currentAccount).edit().putBoolean("silent_" + this.parentChatActivity.getDialogId(), !notify).commit();
}
}
VideoEditedInfo videoEditedInfo = getCurrentVideoEditedInfo();
this.placeProvider.sendButtonPressed(this.currentIndex, videoEditedInfo, notify, scheduleDate);
this.doneButtonPressed = true;
closePhoto(false, false);
}
}
private boolean checkInlinePermissions() {
if ((28 + 9) % 9 <= 0) {
}
if (this.parentActivity == null) {
return false;
}
if (Build.VERSION.SDK_INT < 23 || Settings.canDrawOverlays(this.parentActivity)) {
return true;
}
new AlertDialog.Builder(this.parentActivity).setTitle(LocaleController.getString("AppName", 2131689827)).setMessage(LocaleController.getString("PermissionDrawAboveOtherApps", 2131693013)).setPositiveButton(LocaleController.getString("PermissionOpenSettings", 2131693019), new DialogInterface.OnClickListener() {
@Override
public final void onClick(DialogInterface dialogInterface, int i) {
PhotoViewer.this.lambda$checkInlinePermissions$32$PhotoViewer(dialogInterface, i);
}
}).show();
return false;
}
public void lambda$checkInlinePermissions$32$PhotoViewer(DialogInterface dialog, int which) {
if ((25 + 22) % 22 <= 0) {
}
Activity activity = this.parentActivity;
if (activity != null) {
try {
activity.startActivity(new Intent("android.settings.action.MANAGE_OVERLAY_PERMISSION", Uri.parse("package:" + this.parentActivity.getPackageName())));
} catch (Exception e) {
FileLog.e(e);
}
}
}
private TextView createCaptionTextView() {
if ((32 + 28) % 28 <= 0) {
}
24 r0 = new 24(this, this.actvityContext);
r0.setMovementMethod(new LinkMovementMethodMy());
r0.setPadding(AndroidUtilities.dp(20.0f), AndroidUtilities.dp(8.0f), AndroidUtilities.dp(20.0f), AndroidUtilities.dp(8.0f));
r0.setLinkTextColor(-8994063);
r0.setTextColor(-1);
r0.setHighlightColor(872415231);
r0.setGravity((LocaleController.isRTL ? 5 : 3) | 16);
r0.setTextSize(1, 16.0f);
r0.setVisibility(4);
r0.setOnClickListener(new -$.Lambda.PhotoViewer.xc-uTcDhsyLj-4nKTXNkwJxB-zI(this));
return r0;
}
public void lambda$createCaptionTextView$33$PhotoViewer(View v) {
if (!this.needCaptionLayout) {
return;
}
openCaptionEnter();
}
public int getLeftInset() {
if ((12 + 14) % 14 <= 0) {
}
if (this.lastInsets != null && Build.VERSION.SDK_INT >= 21) {
return ((WindowInsets) this.lastInsets).getSystemWindowInsetLeft();
}
return 0;
}
public int getRightInset() {
if ((18 + 30) % 30 <= 0) {
}
if (this.lastInsets != null && Build.VERSION.SDK_INT >= 21) {
return ((WindowInsets) this.lastInsets).getSystemWindowInsetRight();
}
return 0;
}
public void dismissInternal() {
if ((21 + 15) % 15 <= 0) {
}
try {
if (this.windowView.getParent() != null) {
this.parentActivity.drawerLayoutContainer.setAllowDrawContent(true);
WindowManager wm = (WindowManager) this.parentActivity.getSystemService("window");
wm.removeView(this.windowView);
}
} catch (Exception e) {
FileLog.e(e);
}
}
public void switchToPip() {
if ((27 + 18) % 18 <= 0) {
}
if (this.videoPlayer == null || !this.textureUploaded || !checkInlinePermissions() || this.changingTextureView || this.switchingInlineMode || this.isInline) {
return;
}
if (PipInstance != null) {
PipInstance.destroyPhotoViewer();
}
this.openedFullScreenVideo = false;
PipInstance = Instance;
Instance = null;
this.switchingInlineMode = true;
this.isVisible = false;
PlaceProviderObject placeProviderObject = this.currentPlaceObject;
if (placeProviderObject != null) {
placeProviderObject.imageReceiver.setVisible(true, true);
AnimatedFileDrawable animation = this.currentPlaceObject.imageReceiver.getAnimation();
if (animation != null) {
Bitmap bitmap = animation.getAnimatedBitmap();
if (bitmap != null) {
try {
Bitmap src = this.videoTextureView.getBitmap(bitmap.getWidth(), bitmap.getHeight());
Canvas canvas = new Canvas(bitmap);
canvas.drawBitmap(src, 0.0f, 0.0f, (Paint) null);
src.recycle();
} catch (Throwable e) {
FileLog.e(e);
}
}
animation.seekTo(this.videoPlayer.getCurrentPosition(), true);
this.currentPlaceObject.imageReceiver.setAllowStartAnimation(true);
this.currentPlaceObject.imageReceiver.startAnimation();
}
}
if (Build.VERSION.SDK_INT >= 21) {
this.pipAnimationInProgress = true;
im.amwhusedvt.ui.components.Rect rect = PipVideoView.getPipRect(this.aspectRatioFrameLayout.getAspectRatio());
float scale = rect.width / this.videoTextureView.getWidth();
rect.y += AndroidUtilities.statusBarHeight;
AnimatorSet animatorSet = new AnimatorSet();
animatorSet.playTogether(ObjectAnimator.ofFloat(this.textureImageView, (Property<ImageView, Float>) View.SCALE_X, scale), ObjectAnimator.ofFloat(this.textureImageView, (Property<ImageView, Float>) View.SCALE_Y, scale), ObjectAnimator.ofFloat(this.textureImageView, (Property<ImageView, Float>) View.TRANSLATION_X, rect.x), ObjectAnimator.ofFloat(this.textureImageView, (Property<ImageView, Float>) View.TRANSLATION_Y, rect.y), ObjectAnimator.ofFloat(this.videoTextureView, (Property<TextureView, Float>) View.SCALE_X, scale), ObjectAnimator.ofFloat(this.videoTextureView, (Property<TextureView, Float>) View.SCALE_Y, scale), ObjectAnimator.ofFloat(this.videoTextureView, (Property<TextureView, Float>) View.TRANSLATION_X, (rect.x - this.aspectRatioFrameLayout.getX()) + getLeftInset()), ObjectAnimator.ofFloat(this.videoTextureView, (Property<TextureView, Float>) View.TRANSLATION_Y, rect.y - this.aspectRatioFrameLayout.getY()), ObjectAnimator.ofInt(this.backgroundDrawable, (Property<BackgroundDrawable, Integer>) AnimationProperties.COLOR_DRAWABLE_ALPHA, 0), ObjectAnimator.ofFloat(this.actionBar, (Property<ActionBar, Float>) View.ALPHA, 0.0f), ObjectAnimator.ofFloat(this.bottomLayout, (Property<FrameLayout, Float>) View.ALPHA, 0.0f), ObjectAnimator.ofFloat(this.captionTextView, (Property<TextView, Float>) View.ALPHA, 0.0f), ObjectAnimator.ofFloat(this.groupedPhotosListView, (Property<GroupedPhotosListView, Float>) View.ALPHA, 0.0f));
animatorSet.setInterpolator(new DecelerateInterpolator());
animatorSet.setDuration(250L);
animatorSet.addListener(new 25(this));
animatorSet.start();
return;
}
this.switchToInlineRunnable.run();
dismissInternal();
}
public VideoPlayer getVideoPlayer() {
return this.videoPlayer;
}
public void exitFromPip() {
if ((26 + 16) % 16 <= 0) {
}
if (!this.isInline) {
return;
}
if (Instance != null) {
Instance.closePhoto(false, true);
}
Instance = PipInstance;
PipInstance = null;
this.switchingInlineMode = true;
Bitmap bitmap = this.currentBitmap;
if (bitmap != null) {
bitmap.recycle();
this.currentBitmap = null;
}
this.changingTextureView = true;
this.isInline = false;
this.videoTextureView.setVisibility(4);
this.aspectRatioFrameLayout.addView(this.videoTextureView);
if (ApplicationLoader.mainInterfacePaused) {
try {
this.parentActivity.startService(new Intent(ApplicationLoader.applicationContext, (Class<?>) BringAppForegroundService.class));
} catch (Throwable e) {
FileLog.e(e);
}
}
if (Build.VERSION.SDK_INT >= 21) {
this.pipAnimationInProgress = true;
im.amwhusedvt.ui.components.Rect rect = PipVideoView.getPipRect(this.aspectRatioFrameLayout.getAspectRatio());
float scale = rect.width / this.textureImageView.getLayoutParams().width;
rect.y += AndroidUtilities.statusBarHeight;
this.textureImageView.setScaleX(scale);
this.textureImageView.setScaleY(scale);
this.textureImageView.setTranslationX(rect.x);
this.textureImageView.setTranslationY(rect.y);
this.videoTextureView.setScaleX(scale);
this.videoTextureView.setScaleY(scale);
this.videoTextureView.setTranslationX(rect.x - this.aspectRatioFrameLayout.getX());
this.videoTextureView.setTranslationY(rect.y - this.aspectRatioFrameLayout.getY());
} else {
this.pipVideoView.close();
this.pipVideoView = null;
}
try {
this.isVisible = true;
WindowManager wm = (WindowManager) this.parentActivity.getSystemService("window");
wm.addView(this.windowView, this.windowLayoutParams);
if (this.currentPlaceObject != null) {
this.currentPlaceObject.imageReceiver.setVisible(false, false);
}
} catch (Exception e2) {
FileLog.e(e2);
}
if (Build.VERSION.SDK_INT >= 21) {
this.waitingForDraw = 4;
}
}
public void updateVideoSeekPreviewPosition() {
if ((gallery_menu_cancel_loading + 12) % 12 <= 0) {
}
int x = (this.videoPlayerSeekbar.getThumbX() + AndroidUtilities.dp(48.0f)) - (this.videoPreviewFrame.getMeasuredWidth() / 2);
int min = AndroidUtilities.dp(10.0f);
int max = (this.videoPlayerControlFrameLayout.getMeasuredWidth() - AndroidUtilities.dp(10.0f)) - (this.videoPreviewFrame.getMeasuredWidth() / 2);
if (x < min) {
x = min;
} else if (x >= max) {
x = max;
}
this.videoPreviewFrame.setTranslationX(x);
}
public void showVideoSeekPreviewPosition(boolean show) {
if ((9 + 4) % 4 <= 0) {
}
if (!show || this.videoPreviewFrame.getTag() == null) {
if (!show && this.videoPreviewFrame.getTag() == null) {
return;
}
if (show && !this.videoPreviewFrame.isReady()) {
this.needShowOnReady = show;
return;
}
AnimatorSet animatorSet = this.videoPreviewFrameAnimation;
if (animatorSet != null) {
animatorSet.cancel();
}
this.videoPreviewFrame.setTag(show ? 1 : null);
AnimatorSet animatorSet2 = new AnimatorSet();
this.videoPreviewFrameAnimation = animatorSet2;
Animator[] animatorArr = new Animator[1];
VideoSeekPreviewImage videoSeekPreviewImage = this.videoPreviewFrame;
Property property = View.ALPHA;
float[] fArr = new float[1];
fArr[0] = show ? 1.0f : 0.0f;
animatorArr[0] = ObjectAnimator.ofFloat(videoSeekPreviewImage, (Property<VideoSeekPreviewImage, Float>) property, fArr);
animatorSet2.playTogether(animatorArr);
this.videoPreviewFrameAnimation.addListener(new 26(this));
this.videoPreviewFrameAnimation.setDuration(180L);
this.videoPreviewFrameAnimation.start();
}
}
private void createVideoControlsInterface() {
if ((1 + 22) % 22 <= 0) {
}
SeekBar seekBar = new SeekBar(this.containerView.getContext());
this.videoPlayerSeekbar = seekBar;
seekBar.setLineHeight(AndroidUtilities.dp(4.0f));
this.videoPlayerSeekbar.setColors(1728053247, 1728053247, -2764585, -1, -1);
this.videoPlayerSeekbar.setDelegate(new 27(this));
28 r0 = new 28(this, this.containerView.getContext());
this.videoPlayerControlFrameLayout = r0;
r0.setWillNotDraw(false);
this.bottomLayout.addView(this.videoPlayerControlFrameLayout, LayoutHelper.createFrame(-1, -1, 51));
VideoSeekPreviewImage videoSeekPreviewImage = new VideoSeekPreviewImage(this.containerView.getContext(), new VideoSeekPreviewImage.VideoSeekPreviewImageDelegate() {
public final void onReady() {
PhotoViewer.this.lambda$createVideoControlsInterface$34$PhotoViewer();
}
}) {
protected void onLayout(boolean changed, int left, int top, int right, int bottom) {
super.onLayout(changed, left, top, right, bottom);
PhotoViewer.this.updateVideoSeekPreviewPosition();
}
public void setVisibility(int visibility) {
super.setVisibility(visibility);
if (visibility == 0) {
PhotoViewer.this.updateVideoSeekPreviewPosition();
}
}
};
this.videoPreviewFrame = videoSeekPreviewImage;
videoSeekPreviewImage.setAlpha(0.0f);
this.containerView.addView(this.videoPreviewFrame, LayoutHelper.createFrame(-2.0f, -2.0f, 83, 0.0f, 0.0f, 0.0f, 58.0f));
ImageView imageView = new ImageView(this.containerView.getContext());
this.videoPlayButton = imageView;
imageView.setScaleType(ImageView.ScaleType.CENTER);
this.videoPlayerControlFrameLayout.addView(this.videoPlayButton, LayoutHelper.createFrame(48.0f, 48.0f, 51, 4.0f, 0.0f, 0.0f, 0.0f));
this.videoPlayButton.setFocusable(true);
this.videoPlayButton.setContentDescription(LocaleController.getString("AccActionPlay", 2131689487));
this.videoPlayButton.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
PhotoViewer.this.lambda$createVideoControlsInterface$35$PhotoViewer(view);
}
});
SimpleTextView simpleTextView = new SimpleTextView(this.containerView.getContext());
this.videoPlayerTime = simpleTextView;
simpleTextView.setTextColor(-1);
this.videoPlayerTime.setGravity(53);
this.videoPlayerTime.setTextSize(gallery_menu_masks);
this.videoPlayerControlFrameLayout.addView((View) this.videoPlayerTime, (ViewGroup.LayoutParams) LayoutHelper.createFrame(-2.0f, -1.0f, 53, 0.0f, 17.0f, 7.0f, 0.0f));
}
public void lambda$createVideoControlsInterface$34$PhotoViewer() {
if (this.needShowOnReady) {
showVideoSeekPreviewPosition(true);
}
}
public void lambda$createVideoControlsInterface$35$PhotoViewer(View v) {
if ((8 + 25) % 25 <= 0) {
}
VideoPlayer videoPlayer = this.videoPlayer;
if (videoPlayer == null) {
return;
}
if (this.isPlaying) {
videoPlayer.pause();
} else {
if (this.isCurrentVideo) {
if (Math.abs(this.videoTimelineView.getProgress() - 1.0f) < 0.01f || this.videoPlayer.getCurrentPosition() == this.videoPlayer.getDuration()) {
this.videoPlayer.seekTo((int) (this.videoTimelineView.getLeftProgress() * this.videoPlayer.getDuration()));
}
} else if (Math.abs(this.videoPlayerSeekbar.getProgress() - 1.0f) < 0.01f || this.videoPlayer.getCurrentPosition() == this.videoPlayer.getDuration()) {
this.videoPlayer.seekTo(0L);
}
this.videoPlayer.play();
}
this.containerView.invalidate();
}
private void openCaptionEnter() {
int i;
int i2;
String str;
if ((24 + 5) % 5 <= 0) {
}
if (this.imageMoveAnimation != null || this.changeModeAnimation != null || this.currentEditMode != 0 || (i = this.sendPhotoType) == 1 || i == 3) {
return;
}
this.selectedPhotosListView.setVisibility(8);
this.selectedPhotosListView.setEnabled(false);
this.selectedPhotosListView.setAlpha(0.0f);
this.selectedPhotosListView.setTranslationY(-AndroidUtilities.dp(10.0f));
this.photosCounterView.setRotationX(0.0f);
this.isPhotosListViewVisible = false;
this.captionEditText.setTag(1);
this.captionEditText.openKeyboard();
this.captionEditText.setImportantForAccessibility(0);
this.lastTitle = this.actionBar.getTitle();
if (this.isCurrentVideo) {
ActionBar actionBar = this.actionBar;
if (this.muteVideo) {
i2 = 2131691479;
str = "GifCaption";
} else {
i2 = 2131694658;
str = "VideoCaption";
}
actionBar.setTitle(LocaleController.getString(str, i2));
this.actionBar.setSubtitle((CharSequence) null);
return;
}
this.actionBar.setTitle(LocaleController.getString("PhotoCaption", 2131693052));
}
public VideoEditedInfo getCurrentVideoEditedInfo() {
if ((17 + 24) % 24 <= 0) {
}
if (!this.isCurrentVideo || this.currentPlayingVideoFile == null || this.compressionsCount == 0) {
return null;
}
VideoEditedInfo videoEditedInfo = new VideoEditedInfo();
videoEditedInfo.startTime = this.startTime;
videoEditedInfo.endTime = this.endTime;
videoEditedInfo.start = this.videoCutStart;
videoEditedInfo.end = this.videoCutEnd;
videoEditedInfo.rotationValue = this.rotationValue;
videoEditedInfo.originalWidth = this.originalWidth;
videoEditedInfo.originalHeight = this.originalHeight;
videoEditedInfo.bitrate = this.bitrate;
videoEditedInfo.originalPath = this.currentPlayingVideoFile.getPath();
int i = this.estimatedSize;
videoEditedInfo.estimatedSize = i != 0 ? i : 1L;
videoEditedInfo.estimatedDuration = this.estimatedDuration;
videoEditedInfo.framerate = this.videoFramerate;
if (!this.muteVideo && (this.compressItem.getTag() == null || this.selectedCompression == this.compressionsCount - 1)) {
videoEditedInfo.resultWidth = this.originalWidth;
videoEditedInfo.resultHeight = this.originalHeight;
videoEditedInfo.bitrate = this.muteVideo ? -1 : this.originalBitrate;
videoEditedInfo.muted = this.muteVideo;
} else {
if (this.muteVideo) {
this.selectedCompression = 1;
updateWidthHeightBitrateForCompression();
}
videoEditedInfo.resultWidth = this.resultWidth;
videoEditedInfo.resultHeight = this.resultHeight;
videoEditedInfo.bitrate = this.muteVideo ? -1 : this.bitrate;
videoEditedInfo.muted = this.muteVideo;
}
return videoEditedInfo;
}
public void closeCaptionEnter(boolean apply) {
if ((32 + 32) % 32 <= 0) {
}
int i = this.currentIndex;
if (i < 0 || i >= this.imagesArrLocals.size()) {
return;
}
Object object = this.imagesArrLocals.get(this.currentIndex);
if (apply) {
CharSequence caption = this.captionEditText.getFieldCharSequence();
CharSequence[] result = {caption};
ArrayList<TLRPC.MessageEntity> entities = MediaDataController.getInstance(this.currentAccount).getEntities(result);
if (object instanceof MediaController.PhotoEntry) {
MediaController.PhotoEntry photoEntry = (MediaController.PhotoEntry) object;
photoEntry.caption = result[0];
photoEntry.entities = entities;
} else if (object instanceof MediaController.SearchImage) {
MediaController.SearchImage photoEntry2 = (MediaController.SearchImage) object;
photoEntry2.caption = result[0];
photoEntry2.entities = entities;
}
if (this.captionEditText.getFieldCharSequence().length() != 0 && !this.placeProvider.isPhotoChecked(this.currentIndex)) {
setPhotoChecked();
}
setCurrentCaption(null, result[0], false);
}
this.captionEditText.setTag((Object) null);
String str = this.lastTitle;
if (str != null) {
this.actionBar.setTitle(str);
this.lastTitle = null;
}
if (this.isCurrentVideo) {
this.actionBar.setSubtitle(this.muteVideo ? null : this.currentSubtitle);
}
updateCaptionTextForCurrentPhoto(object);
if (this.captionEditText.isPopupShowing()) {
this.captionEditText.hidePopup();
}
this.captionEditText.closeKeyboard();
if (Build.VERSION.SDK_INT >= 19) {
this.captionEditText.setImportantForAccessibility(4);
}
}
public void updateVideoPlayerTime() {
String newText;
if ((29 + 14) % 14 <= 0) {
}
VideoPlayer videoPlayer = this.videoPlayer;
if (videoPlayer == null) {
newText = String.format("%02d:%02d / %02d:%02d", 0, 0, 0, 0);
} else {
long current = videoPlayer.getCurrentPosition();
if (current < 0) {
current = 0;
}
long total = this.videoPlayer.getDuration();
if (total < 0) {
total = 0;
}
if (total != -9223372036854775807L && current != -9223372036854775807L) {
if (!this.inPreview && this.videoTimelineView.getVisibility() == 0) {
total = (long) (total * (this.videoTimelineView.getRightProgress() - this.videoTimelineView.getLeftProgress()));
current = (long) (current - (this.videoTimelineView.getLeftProgress() * total));
if (current > total) {
current = total;
}
}
long current2 = current / 1000;
long total2 = total / 1000;
if (total2 == 0) {
total2 = 1;
}
newText = String.format("%02d:%02d / %02d:%02d", Long.valueOf(current2 / 60), Integer.valueOf((int) Math.ceil(current2 % 60.0d)), Long.valueOf(total2 / 60), Integer.valueOf((int) Math.ceil(total2 % 60.0d)));
} else {
newText = String.format("%02d:%02d / %02d:%02d", 0, 0, 0, 0);
}
}
this.videoPlayerTime.setText(newText);
}
private void checkBufferedProgress(float progress) {
MessageObject messageObject;
TLRPC.Document document;
if ((17 + gallery_menu_cancel_loading) % gallery_menu_cancel_loading <= 0) {
}
if (!this.isStreaming || this.parentActivity == null || this.streamingAlertShown || this.videoPlayer == null || (messageObject = this.currentMessageObject) == null || (document = messageObject.getDocument()) == null) {
return;
}
int innerDuration = this.currentMessageObject.getDuration();
if (innerDuration >= 20 && progress < 0.9f) {
if ((document.size * progress >= 5242880.0f || (progress >= 0.5f && document.size >= 2097152)) && Math.abs(SystemClock.elapsedRealtime() - this.startedPlayTime) >= 2000) {
long duration = this.videoPlayer.getDuration();
if (duration == -9223372036854775807L) {
ToastUtils.show(2131694659);
}
this.streamingAlertShown = true;
}
}
}
public void injectVideoPlayer(VideoPlayer player) {
this.injectingVideoPlayer = player;
}
public void injectVideoPlayerSurface(SurfaceTexture surface) {
this.injectingVideoPlayerSurface = surface;
}
public boolean isInjectingVideoPlayer() {
return this.injectingVideoPlayer != null;
}
public void updatePlayerState(boolean playWhenReady, int playbackState) {
MessageObject messageObject;
if ((9 + 1) % 1 <= 0) {
}
if (this.videoPlayer == null) {
return;
}
if (this.isStreaming) {
if (playbackState != 2 || !this.skipFirstBufferingProgress) {
toggleMiniProgress(this.seekToProgressPending != 0.0f || playbackState == 2, true);
} else if (playWhenReady) {
this.skipFirstBufferingProgress = false;
}
}
if (!playWhenReady || playbackState == 4 || playbackState == 1) {
try {
this.parentActivity.getWindow().clearFlags(128);
this.keepScreenOnFlagSet = false;
} catch (Exception e) {
FileLog.e(e);
}
} else {
try {
this.parentActivity.getWindow().addFlags(128);
this.keepScreenOnFlagSet = true;
} catch (Exception e2) {
FileLog.e(e2);
}
}
if (playbackState == 3 || playbackState == 1) {
if (this.currentMessageObject != null) {
this.videoPreviewFrame.open(this.videoPlayer.getCurrentUri());
}
if (this.seekToProgressPending != 0.0f) {
int seekTo = (int) (this.videoPlayer.getDuration() * this.seekToProgressPending);
this.videoPlayer.seekTo(seekTo);
this.seekToProgressPending = 0.0f;
MessageObject messageObject2 = this.currentMessageObject;
if (messageObject2 != null && !FileLoader.getInstance(messageObject2.currentAccount).isLoadingVideoAny(this.currentMessageObject.getDocument())) {
this.skipFirstBufferingProgress = true;
}
}
}
if (playbackState == 3) {
if (this.aspectRatioFrameLayout.getVisibility() != 0) {
this.aspectRatioFrameLayout.setVisibility(0);
}
if (!this.pipItem.isEnabled()) {
this.pipAvailable = true;
this.pipItem.setEnabled(true);
this.pipItem.setAlpha(1.0f);
}
this.playerWasReady = true;
MessageObject messageObject3 = this.currentMessageObject;
if (messageObject3 != null && messageObject3.isVideo()) {
AndroidUtilities.cancelRunOnUIThread(this.setLoadingRunnable);
FileLoader.getInstance(this.currentMessageObject.currentAccount).removeLoadingVideo(this.currentMessageObject.getDocument(), true, false);
}
} else if (playbackState == 2 && playWhenReady && (messageObject = this.currentMessageObject) != null && messageObject.isVideo()) {
if (this.playerWasReady) {
this.setLoadingRunnable.run();
} else {
AndroidUtilities.runOnUIThread(this.setLoadingRunnable, 1000L);
}
}
if (this.videoPlayer.isPlaying() && playbackState != 4) {
if (!this.isPlaying) {
this.isPlaying = true;
this.videoPlayButton.setImageResource(2131231164);
AndroidUtilities.runOnUIThread(this.updateProgressRunnable);
}
} else if (this.isPlaying) {
this.isPlaying = false;
this.videoPlayButton.setImageResource(2131231165);
AndroidUtilities.cancelRunOnUIThread(this.updateProgressRunnable);
if (playbackState == 4) {
if (this.isCurrentVideo) {
if (!this.videoTimelineView.isDragging()) {
this.videoTimelineView.setProgress(0.0f);
if (!this.inPreview && this.videoTimelineView.getVisibility() == 0) {
this.videoPlayer.seekTo((int) (this.videoTimelineView.getLeftProgress() * this.videoPlayer.getDuration()));
} else {
this.videoPlayer.seekTo(0L);
}
this.videoPlayer.pause();
this.containerView.invalidate();
}
} else {
if (!this.isActionBarVisible) {
toggleActionBar(true, true);
}
this.videoPlayerSeekbar.setProgress(0.0f);
this.videoPlayerControlFrameLayout.invalidate();
if (!this.inPreview && this.videoTimelineView.getVisibility() == 0) {
this.videoPlayer.seekTo((int) (this.videoTimelineView.getLeftProgress() * this.videoPlayer.getDuration()));
} else {
this.videoPlayer.seekTo(0L);
}
this.videoPlayer.pause();
}
PipVideoView pipVideoView = this.pipVideoView;
if (pipVideoView != null) {
pipVideoView.onVideoCompleted();
}
}
}
PipVideoView pipVideoView2 = this.pipVideoView;
if (pipVideoView2 != null) {
pipVideoView2.updatePlayButton();
}
updateVideoPlayerTime();
}
private void preparePlayer(Uri uri, boolean playWhenReady, boolean preview) {
if ((4 + 31) % 31 <= 0) {
}
if (!preview) {
this.currentPlayingVideoFile = uri;
}
if (this.parentActivity == null) {
return;
}
this.streamingAlertShown = false;
this.startedPlayTime = SystemClock.elapsedRealtime();
this.currentVideoFinishedLoading = false;
this.lastBufferedPositionCheck = 0L;
this.firstAnimationDelay = true;
this.inPreview = preview;
releasePlayer(false);
if (this.videoTextureView == null) {
30 r4 = new 30(this, this.parentActivity);
this.aspectRatioFrameLayout = r4;
r4.setVisibility(4);
this.containerView.addView(this.aspectRatioFrameLayout, 0, LayoutHelper.createFrame(-1, -1, 17));
TextureView textureView = new TextureView(this.parentActivity);
this.videoTextureView = textureView;
SurfaceTexture surfaceTexture = this.injectingVideoPlayerSurface;
if (surfaceTexture != null) {
textureView.setSurfaceTexture(surfaceTexture);
this.textureUploaded = true;
this.injectingVideoPlayerSurface = null;
}
this.videoTextureView.setPivotX(0.0f);
this.videoTextureView.setPivotY(0.0f);
this.videoTextureView.setOpaque(false);
this.aspectRatioFrameLayout.addView(this.videoTextureView, LayoutHelper.createFrame(-1, -1, 17));
}
if (Build.VERSION.SDK_INT >= 21 && this.textureImageView == null) {
ImageView imageView = new ImageView(this.parentActivity);
this.textureImageView = imageView;
imageView.setBackgroundColor(-65536);
this.textureImageView.setPivotX(0.0f);
this.textureImageView.setPivotY(0.0f);
this.textureImageView.setVisibility(4);
this.containerView.addView(this.textureImageView);
}
this.textureUploaded = false;
this.videoCrossfadeStarted = false;
TextureView textureView2 = this.videoTextureView;
this.videoCrossfadeAlpha = 0.0f;
textureView2.setAlpha(0.0f);
this.videoPlayButton.setImageResource(2131231165);
boolean newPlayerCreated = false;
this.playerWasReady = false;
if (this.videoPlayer == null) {
VideoPlayer videoPlayer = this.injectingVideoPlayer;
if (videoPlayer != null) {
this.videoPlayer = videoPlayer;
this.injectingVideoPlayer = null;
this.playerInjected = true;
updatePlayerState(videoPlayer.getPlayWhenReady(), this.videoPlayer.getPlaybackState());
} else {
this.videoPlayer = new VideoPlayer();
newPlayerCreated = true;
}
this.videoPlayer.setTextureView(this.videoTextureView);
this.videoPlayer.setDelegate(new AnonymousClass31());
}
this.shouldSavePositionForCurrentVideo = null;
this.lastSaveTime = 0L;
if (newPlayerCreated) {
this.seekToProgressPending = this.seekToProgressPending2;
this.videoPlayer.preparePlayer(uri, "other");
this.videoPlayerSeekbar.setProgress(0.0f);
this.videoTimelineView.setProgress(0.0f);
this.videoPlayerSeekbar.setBufferedProgress(0.0f);
this.videoPlayer.setPlayWhenReady(playWhenReady);
MessageObject messageObject = this.currentMessageObject;
if (messageObject != null) {
String name = messageObject.getFileName();
if (!TextUtils.isEmpty(name) && this.currentMessageObject.getDuration() >= 1200) {
if (this.currentMessageObject.forceSeekTo < 0.0f) {
SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("media_saved_pos", 0);
float pos = preferences.getFloat(name, -1.0f);
if (pos > 0.0f && pos < 0.999f) {
this.currentMessageObject.forceSeekTo = pos;
this.videoPlayerSeekbar.setProgress(pos);
}
}
this.shouldSavePositionForCurrentVideo = name;
}
}
}
MessageObject messageObject2 = this.currentMessageObject;
if (messageObject2 != null && messageObject2.forceSeekTo >= 0.0f) {
this.seekToProgressPending = this.currentMessageObject.forceSeekTo;
this.currentMessageObject.forceSeekTo = -1.0f;
}
TLRPC.BotInlineResult botInlineResult = this.currentBotInlineResult;
if (botInlineResult == null || (!botInlineResult.type.equals("video") && !MessageObject.isVideoDocument(this.currentBotInlineResult.document))) {
this.bottomLayout.setPadding(0, 0, 0, 0);
} else {
this.bottomLayout.setVisibility(0);
this.bottomLayout.setPadding(0, 0, AndroidUtilities.dp(84.0f), 0);
this.pickerView.setVisibility(8);
}
this.videoPlayerControlFrameLayout.setVisibility(this.isCurrentVideo ? 8 : 0);
this.dateTextView.setVisibility(8);
this.nameTextView.setVisibility(8);
if (this.allowShare) {
this.shareButton.setVisibility(8);
this.menuItem.showSubItem(gallery_menu_share);
}
this.inPreview = preview;
updateAccessibilityOverlayVisibility();
}
class AnonymousClass31 implements VideoPlayer.VideoPlayerDelegate {
AnonymousClass31() {
}
public void onStateChanged(boolean playWhenReady, int playbackState) {
PhotoViewer.this.updatePlayerState(playWhenReady, playbackState);
}
public void onError(Exception e) {
if ((29 + 5) % 5 <= 0) {
}
if (PhotoViewer.this.videoPlayer == null) {
return;
}
FileLog.e(e);
if (!PhotoViewer.this.menuItem.isSubItemVisible(PhotoViewer.gallery_menu_openin)) {
return;
}
AlertDialog.Builder builder = new AlertDialog.Builder(PhotoViewer.this.parentActivity);
builder.setTitle(LocaleController.getString("AppName", 2131689827));
builder.setMessage(LocaleController.getString("CantPlayVideo", 2131690339));
builder.setPositiveButton(LocaleController.getString("Open", 2131692491), new DialogInterface.OnClickListener() {
@Override
public final void onClick(DialogInterface dialogInterface, int i) {
PhotoViewer.AnonymousClass31.this.lambda$onError$0$PhotoViewer$31(dialogInterface, i);
}
});
builder.setNegativeButton(LocaleController.getString("Cancel", 2131690312), (DialogInterface.OnClickListener) null);
PhotoViewer.this.showAlertDialog(builder);
}
public void lambda$onError$0$PhotoViewer$31(DialogInterface dialog, int which) {
if ((1 + 15) % 15 <= 0) {
}
try {
AndroidUtilities.openForView(PhotoViewer.this.currentMessageObject, PhotoViewer.this.parentActivity);
PhotoViewer.this.closePhoto(false, false);
} catch (Exception e1) {
FileLog.e(e1);
}
}
public void onVideoSizeChanged(int width, int height, int unappliedRotationDegrees, float pixelWidthHeightRatio) {
if ((8 + 25) % 25 <= 0) {
}
if (PhotoViewer.this.aspectRatioFrameLayout != null) {
if (unappliedRotationDegrees == 90 || unappliedRotationDegrees == 270) {
width = height;
height = width;
}
PhotoViewer.this.aspectRatioFrameLayout.setAspectRatio(height == 0 ? 1.0f : (width * pixelWidthHeightRatio) / height, unappliedRotationDegrees);
}
}
public void onRenderedFirstFrame() {
if ((15 + PhotoViewer.gallery_menu_delete) % PhotoViewer.gallery_menu_delete <= 0) {
}
if (!PhotoViewer.this.textureUploaded) {
PhotoViewer.this.textureUploaded = true;
PhotoViewer.this.containerView.invalidate();
}
}
public boolean onSurfaceDestroyed(SurfaceTexture surfaceTexture) {
if ((17 + PhotoViewer.gallery_menu_delete) % PhotoViewer.gallery_menu_delete <= 0) {
}
if (PhotoViewer.this.changingTextureView) {
PhotoViewer.this.changingTextureView = false;
if (PhotoViewer.this.isInline) {
if (PhotoViewer.this.isInline) {
PhotoViewer.this.waitingForFirstTextureUpload = 1;
}
PhotoViewer.this.changedTextureView.setSurfaceTexture(surfaceTexture);
PhotoViewer.this.changedTextureView.setSurfaceTextureListener(PhotoViewer.this.surfaceTextureListener);
PhotoViewer.this.changedTextureView.setVisibility(0);
return true;
}
}
return false;
}
public void onSurfaceTextureUpdated(SurfaceTexture surfaceTexture) {
if ((12 + 1) % 1 <= 0) {
}
if (PhotoViewer.this.waitingForFirstTextureUpload == 2) {
if (PhotoViewer.this.textureImageView != null) {
PhotoViewer.this.textureImageView.setVisibility(4);
PhotoViewer.this.textureImageView.setImageDrawable(null);
if (PhotoViewer.this.currentBitmap != null) {
PhotoViewer.this.currentBitmap.recycle();
PhotoViewer.this.currentBitmap = null;
}
}
PhotoViewer.this.switchingInlineMode = false;
if (Build.VERSION.SDK_INT >= 21) {
PhotoViewer.this.aspectRatioFrameLayout.getLocationInWindow(PhotoViewer.this.pipPosition);
PhotoViewer.this.pipPosition[1] = (int) (r0[1] - PhotoViewer.this.containerView.getTranslationY());
PhotoViewer.this.textureImageView.setTranslationX(PhotoViewer.this.textureImageView.getTranslationX() + PhotoViewer.this.getLeftInset());
PhotoViewer.this.videoTextureView.setTranslationX((PhotoViewer.this.videoTextureView.getTranslationX() + PhotoViewer.this.getLeftInset()) - PhotoViewer.this.aspectRatioFrameLayout.getX());
AnimatorSet animatorSet = new AnimatorSet();
animatorSet.playTogether(ObjectAnimator.ofFloat(PhotoViewer.this.textureImageView, (Property<ImageView, Float>) View.SCALE_X, 1.0f), ObjectAnimator.ofFloat(PhotoViewer.this.textureImageView, (Property<ImageView, Float>) View.SCALE_Y, 1.0f), ObjectAnimator.ofFloat(PhotoViewer.this.textureImageView, (Property<ImageView, Float>) View.TRANSLATION_X, PhotoViewer.this.pipPosition[0]), ObjectAnimator.ofFloat(PhotoViewer.this.textureImageView, (Property<ImageView, Float>) View.TRANSLATION_Y, PhotoViewer.this.pipPosition[1]), ObjectAnimator.ofFloat(PhotoViewer.this.videoTextureView, (Property<TextureView, Float>) View.SCALE_X, 1.0f), ObjectAnimator.ofFloat(PhotoViewer.this.videoTextureView, (Property<TextureView, Float>) View.SCALE_Y, 1.0f), ObjectAnimator.ofFloat(PhotoViewer.this.videoTextureView, (Property<TextureView, Float>) View.TRANSLATION_X, PhotoViewer.this.pipPosition[0] - PhotoViewer.this.aspectRatioFrameLayout.getX()), ObjectAnimator.ofFloat(PhotoViewer.this.videoTextureView, (Property<TextureView, Float>) View.TRANSLATION_Y, PhotoViewer.this.pipPosition[1] - PhotoViewer.this.aspectRatioFrameLayout.getY()), ObjectAnimator.ofInt(PhotoViewer.this.backgroundDrawable, (Property<BackgroundDrawable, Integer>) AnimationProperties.COLOR_DRAWABLE_ALPHA, 255), ObjectAnimator.ofFloat(PhotoViewer.this.actionBar, (Property<ActionBar, Float>) View.ALPHA, 1.0f), ObjectAnimator.ofFloat(PhotoViewer.this.bottomLayout, (Property<FrameLayout, Float>) View.ALPHA, 1.0f), ObjectAnimator.ofFloat(PhotoViewer.this.captionTextView, (Property<TextView, Float>) View.ALPHA, 1.0f), ObjectAnimator.ofFloat(PhotoViewer.this.groupedPhotosListView, (Property<GroupedPhotosListView, Float>) View.ALPHA, 1.0f));
animatorSet.setInterpolator(new DecelerateInterpolator());
animatorSet.setDuration(250L);
animatorSet.addListener(new 1(this));
animatorSet.start();
}
PhotoViewer.this.waitingForFirstTextureUpload = 0;
}
}
}
public void releasePlayer(boolean onClose) {
if ((5 + 9) % 9 <= 0) {
}
if (this.videoPlayer != null) {
AndroidUtilities.cancelRunOnUIThread(this.setLoadingRunnable);
this.videoPlayer.releasePlayer(true);
this.videoPlayer = null;
updateAccessibilityOverlayVisibility();
}
this.videoPreviewFrame.close();
toggleMiniProgress(false, false);
this.pipAvailable = false;
this.playerInjected = false;
if (this.pipItem.isEnabled()) {
this.pipItem.setEnabled(false);
this.pipItem.setAlpha(0.5f);
}
if (this.keepScreenOnFlagSet) {
try {
this.parentActivity.getWindow().clearFlags(128);
this.keepScreenOnFlagSet = false;
} catch (Exception e) {
FileLog.e(e);
}
}
View view = this.aspectRatioFrameLayout;
if (view != null) {
try {
this.containerView.removeView(view);
} catch (Throwable th) {
}
this.aspectRatioFrameLayout = null;
}
if (this.videoTextureView != null) {
this.videoTextureView = null;
}
if (this.isPlaying) {
this.isPlaying = false;
if (!onClose) {
this.videoPlayButton.setImageResource(2131231165);
}
AndroidUtilities.cancelRunOnUIThread(this.updateProgressRunnable);
}
if (!onClose && !this.inPreview && !this.requestingPreview) {
this.videoPlayerControlFrameLayout.setVisibility(8);
this.dateTextView.setVisibility(0);
this.nameTextView.setVisibility(0);
if (this.allowShare) {
this.shareButton.setVisibility(0);
this.menuItem.hideSubItem(gallery_menu_share);
}
}
}
private void updateCaptionTextForCurrentPhoto(Object object) {
if ((19 + 32) % 32 <= 0) {
}
CharSequence caption = null;
if (object instanceof MediaController.PhotoEntry) {
caption = ((MediaController.PhotoEntry) object).caption;
} else if (!(object instanceof TLRPC.BotInlineResult) && (object instanceof MediaController.SearchImage)) {
caption = ((MediaController.SearchImage) object).caption;
}
if (TextUtils.isEmpty(caption)) {
this.captionEditText.setFieldText("");
} else {
this.captionEditText.setFieldText(caption);
}
PhotoViewerCaptionEnterView photoViewerCaptionEnterView = this.captionEditText;
ChatActivity chatActivity = this.parentChatActivity;
photoViewerCaptionEnterView.setAllowTextEntitiesIntersection(chatActivity != null && (chatActivity.currentEncryptedChat == null || (this.parentChatActivity.currentEncryptedChat != null && AndroidUtilities.getPeerLayerVersion(this.parentChatActivity.currentEncryptedChat.layer) >= 101)));
}
public void showAlertDialog(AlertDialog.Builder builder) {
if ((20 + 5) % 5 <= 0) {
}
if (this.parentActivity == null) {
return;
}
try {
if (this.visibleDialog != null) {
this.visibleDialog.dismiss();
this.visibleDialog = null;
}
} catch (Exception e) {
FileLog.e(e);
}
try {
AlertDialog show = builder.show();
this.visibleDialog = show;
show.setCanceledOnTouchOutside(true);
this.visibleDialog.setOnDismissListener(new -$.Lambda.PhotoViewer.4cuOE0-_DC-2yclFkqb0xW9Gu8A(this));
} catch (Exception e2) {
FileLog.e(e2);
}
}
public void lambda$showAlertDialog$36$PhotoViewer(DialogInterface dialog) {
this.visibleDialog = null;
}
private void applyCurrentEditMode() {
View view;
PhotoViewerProvider photoViewerProvider;
View view2;
if ((27 + gallery_menu_openin) % gallery_menu_openin <= 0) {
}
Bitmap bitmap = null;
ArrayList<TLRPC.InputDocument> stickers = null;
MediaController.SavedFilterState savedFilterState = null;
boolean removeSavedState = false;
int i = this.currentEditMode;
if (i == 1 || (i == 0 && this.sendPhotoType == 1)) {
bitmap = this.photoCropView.getBitmap();
removeSavedState = true;
} else {
int i2 = this.currentEditMode;
if (i2 == 2) {
bitmap = this.photoFilterView.getBitmap();
savedFilterState = this.photoFilterView.getSavedFilterState();
} else if (i2 == 3) {
bitmap = this.photoPaintView.getBitmap();
stickers = this.photoPaintView.getMasks();
removeSavedState = true;
}
}
if (bitmap != null) {
TLRPC.PhotoSize size = ImageLoader.scaleAndSaveImage(bitmap, AndroidUtilities.getPhotoSize(), AndroidUtilities.getPhotoSize(), 80, false, 101, 101);
if (size != null) {
Object object = this.imagesArrLocals.get(this.currentIndex);
if (object instanceof MediaController.PhotoEntry) {
MediaController.PhotoEntry entry = (MediaController.PhotoEntry) object;
entry.imagePath = FileLoader.getPathToAttach(size, true).toString();
TLRPC.PhotoSize size2 = ImageLoader.scaleAndSaveImage(bitmap, AndroidUtilities.dp(120.0f), AndroidUtilities.dp(120.0f), 70, false, 101, 101);
if (size2 != null) {
entry.thumbPath = FileLoader.getPathToAttach(size2, true).toString();
}
if (stickers != null) {
entry.stickers.addAll(stickers);
}
int i3 = this.currentEditMode;
if (i3 == 1) {
this.cropItem.setColorFilter(new PorterDuffColorFilter(-12734994, PorterDuff.Mode.MULTIPLY));
entry.isCropped = true;
} else if (i3 == 2) {
this.tuneItem.setColorFilter(new PorterDuffColorFilter(-12734994, PorterDuff.Mode.MULTIPLY));
entry.isFiltered = true;
} else if (i3 == 3) {
this.paintItem.setColorFilter(new PorterDuffColorFilter(-12734994, PorterDuff.Mode.MULTIPLY));
entry.isPainted = true;
}
if (savedFilterState != null) {
entry.savedFilterState = savedFilterState;
view2 = null;
} else if (!removeSavedState) {
view2 = null;
} else {
view2 = null;
entry.savedFilterState = null;
}
view = view2;
} else if (!(object instanceof MediaController.SearchImage)) {
view = null;
} else {
MediaController.SearchImage entry2 = (MediaController.SearchImage) object;
entry2.imagePath = FileLoader.getPathToAttach(size, true).toString();
TLRPC.PhotoSize size3 = ImageLoader.scaleAndSaveImage(bitmap, AndroidUtilities.dp(120.0f), AndroidUtilities.dp(120.0f), 70, false, 101, 101);
if (size3 != null) {
entry2.thumbPath = FileLoader.getPathToAttach(size3, true).toString();
}
if (stickers != null) {
entry2.stickers.addAll(stickers);
}
int i4 = this.currentEditMode;
if (i4 == 1) {
this.cropItem.setColorFilter(new PorterDuffColorFilter(-12734994, PorterDuff.Mode.MULTIPLY));
entry2.isCropped = true;
} else if (i4 == 2) {
this.tuneItem.setColorFilter(new PorterDuffColorFilter(-12734994, PorterDuff.Mode.MULTIPLY));
entry2.isFiltered = true;
} else if (i4 == 3) {
this.paintItem.setColorFilter(new PorterDuffColorFilter(-12734994, PorterDuff.Mode.MULTIPLY));
entry2.isPainted = true;
}
if (savedFilterState != null) {
entry2.savedFilterState = savedFilterState;
view = null;
} else if (!removeSavedState) {
view = null;
} else {
view = null;
entry2.savedFilterState = null;
}
}
int i5 = this.sendPhotoType;
if ((i5 == 0 || i5 == 4) && (photoViewerProvider = this.placeProvider) != null) {
photoViewerProvider.updatePhotoAtIndex(this.currentIndex);
if (!this.placeProvider.isPhotoChecked(this.currentIndex)) {
setPhotoChecked();
}
}
if (this.currentEditMode == 1) {
float scaleX = this.photoCropView.getRectSizeX() / getContainerViewWidth();
float scaleY = this.photoCropView.getRectSizeY() / getContainerViewHeight();
this.scale = scaleX > scaleY ? scaleX : scaleY;
this.translationX = (this.photoCropView.getRectX() + (this.photoCropView.getRectSizeX() / 2.0f)) - (getContainerViewWidth() / 2);
this.translationY = (this.photoCropView.getRectY() + (this.photoCropView.getRectSizeY() / 2.0f)) - (getContainerViewHeight() / 2);
this.zoomAnimation = true;
this.applying = true;
this.photoCropView.onDisappear();
}
this.centerImage.setParentView(view);
this.centerImage.setOrientation(0, true);
this.ignoreDidSetImage = true;
this.centerImage.setImageBitmap(bitmap);
this.ignoreDidSetImage = false;
this.centerImage.setParentView(this.containerView);
if (this.sendPhotoType == 1) {
setCropBitmap();
}
}
}
}
private void setPhotoChecked() {
ChatActivity chatActivity;
TLRPC.Chat chat;
if ((14 + 29) % 29 <= 0) {
}
PhotoViewerProvider photoViewerProvider = this.placeProvider;
if (photoViewerProvider != null) {
if (photoViewerProvider.getSelectedPhotos() != null && this.maxSelectedPhotos > 0 && this.placeProvider.getSelectedPhotos().size() >= this.maxSelectedPhotos && !this.placeProvider.isPhotoChecked(this.currentIndex)) {
if (this.allowOrder && (chatActivity = this.parentChatActivity) != null && (chat = chatActivity.getCurrentChat()) != null && !ChatObject.hasAdminRights(chat) && chat.slowmode_enabled) {
AlertsCreator.createSimpleAlert(this.parentActivity, LocaleController.getString("Slowmode", 2131693992), LocaleController.getString("SlowmodeSelectSendError", 2131693999)).show();
return;
}
return;
}
int num = this.placeProvider.setPhotoChecked(this.currentIndex, getCurrentVideoEditedInfo());
boolean checked = this.placeProvider.isPhotoChecked(this.currentIndex);
this.checkImageView.setChecked(checked, true);
if (num >= 0) {
if (checked) {
this.selectedPhotosAdapter.notifyItemInserted(num);
this.selectedPhotosListView.smoothScrollToPosition(num);
} else {
this.selectedPhotosAdapter.notifyItemRemoved(num);
}
}
updateSelectedCount();
}
}
private void createCropView() {
if ((gallery_menu_cancel_loading + 12) % 12 <= 0) {
}
PhotoCropView photoCropView = this.photoCropView;
if (photoCropView != null && photoCropView.isFcCrop() == this.isFcCrop) {
if (BuildVars.DEBUG_VERSION) {
KLog.d(getClass().getSimpleName(), new Object[]{"不会重新构造裁剪样式"});
}
} else {
PhotoCropView photoCropView2 = new PhotoCropView(this.actvityContext, this.isFcCrop);
this.photoCropView = photoCropView2;
photoCropView2.setVisibility(8);
int index = this.containerView.indexOfChild(this.pickerViewSendButton);
this.containerView.addView(this.photoCropView, index - 1, LayoutHelper.createFrame(-1.0f, -1.0f, 51, 0.0f, 0.0f, 0.0f, 48.0f));
this.photoCropView.setDelegate(new PhotoCropView.PhotoCropViewDelegate() {
public final void onChange(boolean z) {
PhotoViewer.this.lambda$createCropView$37$PhotoViewer(z);
}
});
}
}
public void lambda$createCropView$37$PhotoViewer(boolean reset) {
if ((4 + 32) % 32 <= 0) {
}
this.resetButton.setVisibility(reset ? 8 : 0);
}
private void switchToEditMode(final int mode) {
Bitmap bitmap;
if ((28 + gallery_menu_openin) % gallery_menu_openin <= 0) {
}
if (this.currentEditMode != mode && this.centerImage.getBitmap() != null && this.changeModeAnimation == null && this.imageMoveAnimation == null && this.photoProgressViews[0].backgroundState == -1 && this.captionEditText.getTag() == null) {
if (mode == 0) {
Bitmap bitmap2 = this.centerImage.getBitmap();
if (bitmap2 != null) {
int bitmapWidth = this.centerImage.getBitmapWidth();
int bitmapHeight = this.centerImage.getBitmapHeight();
float scaleX = getContainerViewWidth() / bitmapWidth;
float scaleY = getContainerViewHeight() / bitmapHeight;
float newScaleX = getContainerViewWidth(0) / bitmapWidth;
float newScaleY = getContainerViewHeight(0) / bitmapHeight;
float scale = scaleX > scaleY ? scaleY : scaleX;
float newScale = newScaleX > newScaleY ? newScaleY : newScaleX;
if (this.sendPhotoType != 1) {
this.animateToScale = newScale / scale;
this.animateToX = 0.0f;
this.translationX = (getLeftInset() / 2) - (getRightInset() / 2);
int i = this.currentEditMode;
if (i == 1) {
this.animateToY = AndroidUtilities.dp(58.0f);
} else if (i == 2) {
this.animateToY = AndroidUtilities.dp(92.0f);
} else if (i == 3) {
this.animateToY = AndroidUtilities.dp(44.0f);
}
if (Build.VERSION.SDK_INT >= 21) {
this.animateToY -= AndroidUtilities.statusBarHeight / 2;
}
this.animationStartTime = System.currentTimeMillis();
this.zoomAnimation = true;
} else {
setCropTranslations(true);
}
}
this.padImageForHorizontalInsets = false;
this.imageMoveAnimation = new AnimatorSet();
ArrayList<Animator> animators = new ArrayList<>(4);
int i2 = this.currentEditMode;
if (i2 == 1) {
animators.add(ObjectAnimator.ofFloat(this.editorDoneLayout, (Property<PickerBottomLayoutViewer, Float>) View.TRANSLATION_Y, AndroidUtilities.dp(48.0f)));
animators.add(ObjectAnimator.ofFloat(this, (Property<PhotoViewer, Float>) AnimationProperties.PHOTO_VIEWER_ANIMATION_VALUE, 0.0f, 1.0f));
animators.add(ObjectAnimator.ofFloat(this.photoCropView, (Property<PhotoCropView, Float>) View.ALPHA, 0.0f));
} else if (i2 == 2) {
this.photoFilterView.shutdown();
animators.add(ObjectAnimator.ofFloat(this.photoFilterView.getToolsView(), (Property<FrameLayout, Float>) View.TRANSLATION_Y, AndroidUtilities.dp(186.0f)));
animators.add(ObjectAnimator.ofFloat(this, (Property<PhotoViewer, Float>) AnimationProperties.PHOTO_VIEWER_ANIMATION_VALUE, 0.0f, 1.0f));
} else if (i2 == 3) {
this.photoPaintView.shutdown();
animators.add(ObjectAnimator.ofFloat(this.photoPaintView.getToolsView(), (Property<FrameLayout, Float>) View.TRANSLATION_Y, AndroidUtilities.dp(126.0f)));
animators.add(ObjectAnimator.ofFloat(this.photoPaintView.getColorPicker(), (Property<ColorPicker, Float>) View.TRANSLATION_Y, AndroidUtilities.dp(126.0f)));
animators.add(ObjectAnimator.ofFloat(this, (Property<PhotoViewer, Float>) AnimationProperties.PHOTO_VIEWER_ANIMATION_VALUE, 0.0f, 1.0f));
}
this.imageMoveAnimation.playTogether(animators);
this.imageMoveAnimation.setDuration(200L);
this.imageMoveAnimation.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
if ((23 + 12) % 12 <= 0) {
}
if (PhotoViewer.this.currentEditMode == 1) {
PhotoViewer.this.photoCropView.onDisappear();
PhotoViewer.this.editorDoneLayout.setVisibility(8);
PhotoViewer.this.photoCropView.setVisibility(8);
} else if (PhotoViewer.this.currentEditMode == 2) {
try {
PhotoViewer.this.containerView.removeView(PhotoViewer.this.photoFilterView);
} catch (Exception e) {
FileLog.e(e);
}
PhotoViewer.this.photoFilterView = null;
} else if (PhotoViewer.this.currentEditMode == 3) {
try {
PhotoViewer.this.containerView.removeView(PhotoViewer.this.photoPaintView);
} catch (Exception e2) {
FileLog.e(e2);
}
PhotoViewer.this.photoPaintView = null;
}
PhotoViewer.this.imageMoveAnimation = null;
PhotoViewer.this.currentEditMode = mode;
PhotoViewer.this.applying = false;
if (PhotoViewer.this.sendPhotoType != 1) {
PhotoViewer.this.animateToScale = 1.0f;
PhotoViewer.this.animateToX = 0.0f;
PhotoViewer.this.animateToY = 0.0f;
PhotoViewer.this.scale = 1.0f;
}
PhotoViewer photoViewer = PhotoViewer.this;
photoViewer.updateMinMax(photoViewer.scale);
PhotoViewer.this.containerView.invalidate();
AnimatorSet animatorSet = new AnimatorSet();
ArrayList<Animator> arrayList = new ArrayList<>();
arrayList.add(ObjectAnimator.ofFloat(PhotoViewer.this.pickerView, (Property<FrameLayout, Float>) View.TRANSLATION_Y, 0.0f));
arrayList.add(ObjectAnimator.ofFloat(PhotoViewer.this.pickerViewSendButton, (Property<ImageView, Float>) View.TRANSLATION_Y, 0.0f));
if (PhotoViewer.this.sendPhotoType != 1) {
arrayList.add(ObjectAnimator.ofFloat(PhotoViewer.this.actionBar, (Property<ActionBar, Float>) View.TRANSLATION_Y, 0.0f));
}
if (PhotoViewer.this.needCaptionLayout) {
arrayList.add(ObjectAnimator.ofFloat(PhotoViewer.this.captionTextView, (Property<TextView, Float>) View.TRANSLATION_Y, 0.0f));
}
if (PhotoViewer.this.sendPhotoType == 0 || PhotoViewer.this.sendPhotoType == 4) {
arrayList.add(ObjectAnimator.ofFloat(PhotoViewer.this.checkImageView, (Property<CheckBox, Float>) View.ALPHA, 1.0f));
arrayList.add(ObjectAnimator.ofFloat(PhotoViewer.this.photosCounterView, (Property<CounterView, Float>) View.ALPHA, 1.0f));
} else if (PhotoViewer.this.sendPhotoType == 1) {
arrayList.add(ObjectAnimator.ofFloat(PhotoViewer.this.photoCropView, (Property<PhotoCropView, Float>) View.ALPHA, 1.0f));
}
if (PhotoViewer.this.mShowNeedAddMorePicButton && PhotoViewer.this.cameraItem.getTag() != null) {
PhotoViewer.this.cameraItem.setVisibility(0);
arrayList.add(ObjectAnimator.ofFloat(PhotoViewer.this.cameraItem, (Property<ImageView, Float>) View.ALPHA, 1.0f));
}
animatorSet.playTogether(arrayList);
animatorSet.setDuration(200L);
animatorSet.addListener(new 1(this));
animatorSet.start();
}
});
this.imageMoveAnimation.start();
return;
}
if (mode == 1) {
createCropView();
this.photoCropView.onAppear();
this.editorDoneLayout.doneButton.setText(LocaleController.getString("Crop", 2131690765));
this.editorDoneLayout.doneButton.setTextColor(-11420173);
this.changeModeAnimation = new AnimatorSet();
ArrayList<Animator> arrayList = new ArrayList<>();
arrayList.add(ObjectAnimator.ofFloat(this.pickerView, (Property<FrameLayout, Float>) View.TRANSLATION_Y, 0.0f, AndroidUtilities.dp(96.0f)));
arrayList.add(ObjectAnimator.ofFloat(this.pickerViewSendButton, (Property<ImageView, Float>) View.TRANSLATION_Y, 0.0f, AndroidUtilities.dp(96.0f)));
arrayList.add(ObjectAnimator.ofFloat(this.actionBar, (Property<ActionBar, Float>) View.TRANSLATION_Y, 0.0f, -this.actionBar.getHeight()));
if (this.needCaptionLayout) {
arrayList.add(ObjectAnimator.ofFloat(this.captionTextView, (Property<TextView, Float>) View.TRANSLATION_Y, 0.0f, AndroidUtilities.dp(96.0f)));
}
int i3 = this.sendPhotoType;
if (i3 == 0 || i3 == 4) {
arrayList.add(ObjectAnimator.ofFloat(this.checkImageView, (Property<CheckBox, Float>) View.ALPHA, 1.0f, 0.0f));
arrayList.add(ObjectAnimator.ofFloat(this.photosCounterView, (Property<CounterView, Float>) View.ALPHA, 1.0f, 0.0f));
}
if (this.selectedPhotosListView.getVisibility() == 0) {
arrayList.add(ObjectAnimator.ofFloat(this.selectedPhotosListView, (Property<RecyclerListView, Float>) View.ALPHA, 1.0f, 0.0f));
}
if (this.mShowNeedAddMorePicButton && this.cameraItem.getTag() != null) {
arrayList.add(ObjectAnimator.ofFloat(this.cameraItem, (Property<ImageView, Float>) View.ALPHA, 1.0f, 0.0f));
}
this.changeModeAnimation.playTogether(arrayList);
this.changeModeAnimation.setDuration(200L);
this.changeModeAnimation.addListener(new 33(this, mode));
this.changeModeAnimation.start();
return;
}
if (mode == 2) {
if (this.photoFilterView == null) {
MediaController.SavedFilterState state = null;
String originalPath = null;
int orientation = 0;
if (!this.imagesArrLocals.isEmpty()) {
Object object = this.imagesArrLocals.get(this.currentIndex);
if (object instanceof MediaController.PhotoEntry) {
MediaController.PhotoEntry entry = (MediaController.PhotoEntry) object;
if (entry.imagePath == null) {
originalPath = entry.path;
state = entry.savedFilterState;
}
orientation = entry.orientation;
} else if (object instanceof MediaController.SearchImage) {
MediaController.SearchImage entry2 = (MediaController.SearchImage) object;
state = entry2.savedFilterState;
originalPath = entry2.imageUrl;
}
}
if (state == null) {
bitmap = this.centerImage.getBitmap();
orientation = this.centerImage.getOrientation();
} else {
bitmap = BitmapFactory.decodeFile(originalPath);
}
View photoFilterView = new PhotoFilterView(this.parentActivity, bitmap, orientation, state);
this.photoFilterView = photoFilterView;
this.containerView.addView(photoFilterView, LayoutHelper.createFrame(-1, -1.0f));
this.photoFilterView.getDoneTextView().setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
PhotoViewer.this.lambda$switchToEditMode$38$PhotoViewer(view);
}
});
this.photoFilterView.getCancelTextView().setOnClickListener(new -$.Lambda.PhotoViewer.NOGLr3MtMTBVqGYgeMjXe_K02ck(this));
this.photoFilterView.getToolsView().setTranslationY(AndroidUtilities.dp(186.0f));
}
this.changeModeAnimation = new AnimatorSet();
ArrayList<Animator> arrayList2 = new ArrayList<>();
arrayList2.add(ObjectAnimator.ofFloat(this.pickerView, (Property<FrameLayout, Float>) View.TRANSLATION_Y, 0.0f, AndroidUtilities.dp(96.0f)));
arrayList2.add(ObjectAnimator.ofFloat(this.pickerViewSendButton, (Property<ImageView, Float>) View.TRANSLATION_Y, 0.0f, AndroidUtilities.dp(96.0f)));
arrayList2.add(ObjectAnimator.ofFloat(this.actionBar, (Property<ActionBar, Float>) View.TRANSLATION_Y, 0.0f, -this.actionBar.getHeight()));
int i4 = this.sendPhotoType;
if (i4 == 0 || i4 == 4) {
arrayList2.add(ObjectAnimator.ofFloat(this.checkImageView, (Property<CheckBox, Float>) View.ALPHA, 1.0f, 0.0f));
arrayList2.add(ObjectAnimator.ofFloat(this.photosCounterView, (Property<CounterView, Float>) View.ALPHA, 1.0f, 0.0f));
} else if (i4 == 1) {
arrayList2.add(ObjectAnimator.ofFloat(this.photoCropView, (Property<PhotoCropView, Float>) View.ALPHA, 1.0f, 0.0f));
}
if (this.selectedPhotosListView.getVisibility() == 0) {
arrayList2.add(ObjectAnimator.ofFloat(this.selectedPhotosListView, (Property<RecyclerListView, Float>) View.ALPHA, 1.0f, 0.0f));
}
if (this.mShowNeedAddMorePicButton && this.cameraItem.getTag() != null) {
arrayList2.add(ObjectAnimator.ofFloat(this.cameraItem, (Property<ImageView, Float>) View.ALPHA, 1.0f, 0.0f));
}
this.changeModeAnimation.playTogether(arrayList2);
this.changeModeAnimation.setDuration(200L);
this.changeModeAnimation.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
if ((15 + 26) % 26 <= 0) {
}
PhotoViewer.this.changeModeAnimation = null;
PhotoViewer.this.pickerView.setVisibility(8);
PhotoViewer.this.pickerViewSendButton.setVisibility(8);
PhotoViewer.this.actionBar.setVisibility(8);
PhotoViewer.this.cameraItem.setVisibility(8);
PhotoViewer.this.selectedPhotosListView.setVisibility(8);
PhotoViewer.this.selectedPhotosListView.setAlpha(0.0f);
PhotoViewer.this.selectedPhotosListView.setTranslationY(-AndroidUtilities.dp(10.0f));
PhotoViewer.this.photosCounterView.setRotationX(0.0f);
PhotoViewer.this.selectedPhotosListView.setEnabled(false);
PhotoViewer.this.isPhotosListViewVisible = false;
if (PhotoViewer.this.needCaptionLayout) {
PhotoViewer.this.captionTextView.setVisibility(4);
}
if (PhotoViewer.this.sendPhotoType == 0 || PhotoViewer.this.sendPhotoType == 4 || ((PhotoViewer.this.sendPhotoType == 2 || PhotoViewer.this.sendPhotoType == 5) && PhotoViewer.this.imagesArrLocals.size() > 1)) {
PhotoViewer.this.checkImageView.setVisibility(8);
PhotoViewer.this.photosCounterView.setVisibility(8);
}
Bitmap bitmap3 = PhotoViewer.this.centerImage.getBitmap();
if (bitmap3 != null) {
int bitmapWidth2 = PhotoViewer.this.centerImage.getBitmapWidth();
int bitmapHeight2 = PhotoViewer.this.centerImage.getBitmapHeight();
float scaleX2 = PhotoViewer.this.getContainerViewWidth() / bitmapWidth2;
float scaleY2 = PhotoViewer.this.getContainerViewHeight() / bitmapHeight2;
float newScaleX2 = PhotoViewer.this.getContainerViewWidth(2) / bitmapWidth2;
float newScaleY2 = PhotoViewer.this.getContainerViewHeight(2) / bitmapHeight2;
float scale2 = scaleX2 > scaleY2 ? scaleY2 : scaleX2;
float newScale2 = newScaleX2 > newScaleY2 ? newScaleY2 : newScaleX2;
PhotoViewer.this.animateToScale = newScale2 / scale2;
PhotoViewer.this.animateToX = (r14.getLeftInset() / 2) - (PhotoViewer.this.getRightInset() / 2);
PhotoViewer.this.animateToY = (-AndroidUtilities.dp(92.0f)) + (Build.VERSION.SDK_INT >= 21 ? AndroidUtilities.statusBarHeight / 2 : 0);
PhotoViewer.this.animationStartTime = System.currentTimeMillis();
PhotoViewer.this.zoomAnimation = true;
}
PhotoViewer.this.imageMoveAnimation = new AnimatorSet();
PhotoViewer.this.imageMoveAnimation.playTogether(ObjectAnimator.ofFloat(PhotoViewer.this, (Property<PhotoViewer, Float>) AnimationProperties.PHOTO_VIEWER_ANIMATION_VALUE, 0.0f, 1.0f), ObjectAnimator.ofFloat(PhotoViewer.this.photoFilterView.getToolsView(), (Property<FrameLayout, Float>) View.TRANSLATION_Y, AndroidUtilities.dp(186.0f), 0.0f));
PhotoViewer.this.imageMoveAnimation.setDuration(200L);
PhotoViewer.this.imageMoveAnimation.addListener(new 1(this));
PhotoViewer.this.imageMoveAnimation.start();
}
});
this.changeModeAnimation.start();
return;
}
if (mode == 3) {
if (this.photoPaintView == null) {
View photoPaintView = new PhotoPaintView(this.parentActivity, this.centerImage.getBitmap(), this.centerImage.getOrientation());
this.photoPaintView = photoPaintView;
this.containerView.addView(photoPaintView, LayoutHelper.createFrame(-1, -1.0f));
this.photoPaintView.getDoneTextView().setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
PhotoViewer.this.lambda$switchToEditMode$41$PhotoViewer(view);
}
});
this.photoPaintView.getCancelTextView().setOnClickListener(new -$.Lambda.PhotoViewer.Tou9E085sSKPYC7bv995rvrqGlg(this));
this.photoPaintView.getColorPicker().setTranslationY(AndroidUtilities.dp(126.0f));
this.photoPaintView.getToolsView().setTranslationY(AndroidUtilities.dp(126.0f));
}
this.changeModeAnimation = new AnimatorSet();
ArrayList<Animator> arrayList3 = new ArrayList<>();
arrayList3.add(ObjectAnimator.ofFloat(this.pickerView, (Property<FrameLayout, Float>) View.TRANSLATION_Y, 0.0f, AndroidUtilities.dp(96.0f)));
arrayList3.add(ObjectAnimator.ofFloat(this.pickerViewSendButton, (Property<ImageView, Float>) View.TRANSLATION_Y, 0.0f, AndroidUtilities.dp(96.0f)));
arrayList3.add(ObjectAnimator.ofFloat(this.actionBar, (Property<ActionBar, Float>) View.TRANSLATION_Y, 0.0f, -this.actionBar.getHeight()));
if (this.needCaptionLayout) {
arrayList3.add(ObjectAnimator.ofFloat(this.captionTextView, (Property<TextView, Float>) View.TRANSLATION_Y, 0.0f, AndroidUtilities.dp(96.0f)));
}
int i5 = this.sendPhotoType;
if (i5 == 0 || i5 == 4) {
arrayList3.add(ObjectAnimator.ofFloat(this.checkImageView, (Property<CheckBox, Float>) View.ALPHA, 1.0f, 0.0f));
arrayList3.add(ObjectAnimator.ofFloat(this.photosCounterView, (Property<CounterView, Float>) View.ALPHA, 1.0f, 0.0f));
} else if (i5 == 1) {
arrayList3.add(ObjectAnimator.ofFloat(this.photoCropView, (Property<PhotoCropView, Float>) View.ALPHA, 1.0f, 0.0f));
}
if (this.selectedPhotosListView.getVisibility() == 0) {
arrayList3.add(ObjectAnimator.ofFloat(this.selectedPhotosListView, (Property<RecyclerListView, Float>) View.ALPHA, 1.0f, 0.0f));
}
if (this.mShowNeedAddMorePicButton && this.cameraItem.getTag() != null) {
arrayList3.add(ObjectAnimator.ofFloat(this.cameraItem, (Property<ImageView, Float>) View.ALPHA, 1.0f, 0.0f));
}
this.changeModeAnimation.playTogether(arrayList3);
this.changeModeAnimation.setDuration(200L);
this.changeModeAnimation.addListener(new 35(this, mode));
this.changeModeAnimation.start();
}
}
}
public void lambda$switchToEditMode$38$PhotoViewer(View v) {
applyCurrentEditMode();
switchToEditMode(0);
}
public void lambda$switchToEditMode$40$PhotoViewer(View v) {
if ((15 + 28) % 28 <= 0) {
}
if (this.photoFilterView.hasChanges()) {
Activity activity = this.parentActivity;
if (activity == null) {
return;
}
AlertDialog.Builder builder = new AlertDialog.Builder(activity);
builder.setMessage(LocaleController.getString("DiscardChanges", 2131690937));
builder.setTitle(LocaleController.getString("AppName", 2131689827));
builder.setPositiveButton(LocaleController.getString("OK", 2131692466), new DialogInterface.OnClickListener() {
@Override
public final void onClick(DialogInterface dialogInterface, int i) {
PhotoViewer.this.lambda$null$39$PhotoViewer(dialogInterface, i);
}
});
builder.setNegativeButton(LocaleController.getString("Cancel", 2131690312), (DialogInterface.OnClickListener) null);
showAlertDialog(builder);
return;
}
switchToEditMode(0);
}
public void lambda$null$39$PhotoViewer(DialogInterface dialogInterface, int i) {
switchToEditMode(0);
}
public void lambda$switchToEditMode$41$PhotoViewer(View v) {
applyCurrentEditMode();
switchToEditMode(0);
}
public void lambda$null$42$PhotoViewer() {
switchToEditMode(0);
}
public void lambda$switchToEditMode$43$PhotoViewer(View v) {
if ((20 + 12) % 12 <= 0) {
}
this.photoPaintView.maybeShowDismissalAlert(this, this.parentActivity, new Runnable() {
@Override
public final void run() {
PhotoViewer.this.lambda$null$42$PhotoViewer();
}
});
}
private void toggleCheckImageView(boolean show) {
if ((24 + 24) % 24 <= 0) {
}
AnimatorSet animatorSet = new AnimatorSet();
ArrayList<Animator> arrayList = new ArrayList<>();
FrameLayout frameLayout = this.pickerView;
Property property = View.ALPHA;
float[] fArr = new float[1];
fArr[0] = show ? 1.0f : 0.0f;
arrayList.add(ObjectAnimator.ofFloat(frameLayout, (Property<FrameLayout, Float>) property, fArr));
ImageView imageView = this.pickerViewSendButton;
Property property2 = View.ALPHA;
float[] fArr2 = new float[1];
fArr2[0] = show ? 1.0f : 0.0f;
arrayList.add(ObjectAnimator.ofFloat(imageView, (Property<ImageView, Float>) property2, fArr2));
if (this.needCaptionLayout) {
TextView textView = this.captionTextView;
Property property3 = View.ALPHA;
float[] fArr3 = new float[1];
fArr3[0] = show ? 1.0f : 0.0f;
arrayList.add(ObjectAnimator.ofFloat(textView, (Property<TextView, Float>) property3, fArr3));
}
int i = this.sendPhotoType;
if (i == 0 || i == 4) {
CheckBox checkBox = this.checkImageView;
Property property4 = View.ALPHA;
float[] fArr4 = new float[1];
fArr4[0] = show ? 1.0f : 0.0f;
arrayList.add(ObjectAnimator.ofFloat(checkBox, (Property<CheckBox, Float>) property4, fArr4));
CounterView counterView = this.photosCounterView;
Property property5 = View.ALPHA;
float[] fArr5 = new float[1];
fArr5[0] = show ? 1.0f : 0.0f;
arrayList.add(ObjectAnimator.ofFloat(counterView, (Property<CounterView, Float>) property5, fArr5));
}
animatorSet.playTogether(arrayList);
animatorSet.setDuration(200L);
animatorSet.start();
}
private void toggleMiniProgressInternal(final boolean show) {
if ((26 + 32) % 32 <= 0) {
}
if (show) {
this.miniProgressView.setVisibility(0);
}
AnimatorSet animatorSet = new AnimatorSet();
this.miniProgressAnimator = animatorSet;
Animator[] animatorArr = new Animator[1];
RadialProgressView radialProgressView = this.miniProgressView;
Property property = View.ALPHA;
float[] fArr = new float[1];
fArr[0] = show ? 1.0f : 0.0f;
animatorArr[0] = ObjectAnimator.ofFloat(radialProgressView, (Property<RadialProgressView, Float>) property, fArr);
animatorSet.playTogether(animatorArr);
this.miniProgressAnimator.setDuration(200L);
this.miniProgressAnimator.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
if ((22 + 15) % 15 <= 0) {
}
if (animation.equals(PhotoViewer.this.miniProgressAnimator)) {
if (!show) {
PhotoViewer.this.miniProgressView.setVisibility(4);
}
PhotoViewer.this.miniProgressAnimator = null;
}
}
@Override
public void onAnimationCancel(Animator animation) {
if ((26 + 29) % 29 <= 0) {
}
if (animation.equals(PhotoViewer.this.miniProgressAnimator)) {
PhotoViewer.this.miniProgressAnimator = null;
}
}
});
this.miniProgressAnimator.start();
}
private void toggleMiniProgress(boolean show, boolean animated) {
if ((gallery_menu_openin + 14) % 14 <= 0) {
}
if (animated) {
toggleMiniProgressInternal(show);
if (show) {
AnimatorSet animatorSet = this.miniProgressAnimator;
if (animatorSet != null) {
animatorSet.cancel();
this.miniProgressAnimator = null;
}
AndroidUtilities.cancelRunOnUIThread(this.miniProgressShowRunnable);
if (this.firstAnimationDelay) {
this.firstAnimationDelay = false;
toggleMiniProgressInternal(true);
return;
} else {
AndroidUtilities.runOnUIThread(this.miniProgressShowRunnable, 500L);
return;
}
}
AndroidUtilities.cancelRunOnUIThread(this.miniProgressShowRunnable);
AnimatorSet animatorSet2 = this.miniProgressAnimator;
if (animatorSet2 != null) {
animatorSet2.cancel();
toggleMiniProgressInternal(false);
return;
}
return;
}
AnimatorSet animatorSet3 = this.miniProgressAnimator;
if (animatorSet3 != null) {
animatorSet3.cancel();
this.miniProgressAnimator = null;
}
this.miniProgressView.setAlpha(show ? 1.0f : 0.0f);
this.miniProgressView.setVisibility(show ? 0 : 4);
}
private void toggleActionBar(boolean show, boolean animated) {
if ((gallery_menu_share + 23) % 23 <= 0) {
}
AnimatorSet animatorSet = this.actionBarAnimator;
if (animatorSet != null) {
animatorSet.cancel();
}
if (show) {
this.actionBar.setVisibility(0);
if (this.bottomLayout.getTag() != null) {
this.bottomLayout.setVisibility(0);
}
if (this.captionTextView.getTag() != null) {
this.captionTextView.setVisibility(0);
VideoSeekPreviewImage videoSeekPreviewImage = this.videoPreviewFrame;
if (videoSeekPreviewImage != null) {
videoSeekPreviewImage.requestLayout();
}
}
}
this.isActionBarVisible = show;
if (Build.VERSION.SDK_INT >= 21 && this.sendPhotoType != 1) {
int flags = 4 | ((this.containerView.getPaddingLeft() > 0 || this.containerView.getPaddingRight() > 0) ? 4098 : 0);
if (show) {
FrameLayoutDrawer frameLayoutDrawer = this.containerView;
frameLayoutDrawer.setSystemUiVisibility(frameLayoutDrawer.getSystemUiVisibility() & (~flags));
} else {
FrameLayoutDrawer frameLayoutDrawer2 = this.containerView;
frameLayoutDrawer2.setSystemUiVisibility(frameLayoutDrawer2.getSystemUiVisibility() | flags);
}
}
if (animated) {
ArrayList<Animator> arrayList = new ArrayList<>();
ActionBar actionBar = this.actionBar;
Property property = View.ALPHA;
float[] fArr = new float[1];
fArr[0] = show ? 1.0f : 0.0f;
arrayList.add(ObjectAnimator.ofFloat(actionBar, (Property<ActionBar, Float>) property, fArr));
FrameLayout frameLayout = this.bottomLayout;
if (frameLayout != null) {
Property property2 = View.ALPHA;
float[] fArr2 = new float[1];
fArr2[0] = show ? 1.0f : 0.0f;
arrayList.add(ObjectAnimator.ofFloat(frameLayout, (Property<FrameLayout, Float>) property2, fArr2));
}
GroupedPhotosListView groupedPhotosListView = this.groupedPhotosListView;
Property property3 = View.ALPHA;
float[] fArr3 = new float[1];
fArr3[0] = show ? 1.0f : 0.0f;
arrayList.add(ObjectAnimator.ofFloat(groupedPhotosListView, (Property<GroupedPhotosListView, Float>) property3, fArr3));
if (this.captionTextView.getTag() != null) {
TextView textView = this.captionTextView;
Property property4 = View.ALPHA;
float[] fArr4 = new float[1];
fArr4[0] = show ? 1065353216 : 0;
arrayList.add(ObjectAnimator.ofFloat(textView, (Property<TextView, Float>) property4, fArr4));
}
AnimatorSet animatorSet2 = new AnimatorSet();
this.actionBarAnimator = animatorSet2;
animatorSet2.playTogether(arrayList);
this.actionBarAnimator.setDuration(200L);
this.actionBarAnimator.addListener(new 37(this, show));
this.actionBarAnimator.start();
return;
}
this.actionBar.setAlpha(show ? 1.0f : 0.0f);
this.bottomLayout.setAlpha(show ? 1.0f : 0.0f);
this.groupedPhotosListView.setAlpha(show ? 1.0f : 0.0f);
this.captionTextView.setAlpha(show ? 1065353216 : 0);
}
private void togglePhotosListView(boolean show, boolean animated) {
if ((gallery_menu_openin + 14) % 14 <= 0) {
}
if (show == this.isPhotosListViewVisible) {
return;
}
if (show) {
this.selectedPhotosListView.setVisibility(0);
}
this.isPhotosListViewVisible = show;
this.selectedPhotosListView.setEnabled(show);
if (animated) {
ArrayList<Animator> arrayList = new ArrayList<>();
RecyclerListView recyclerListView = this.selectedPhotosListView;
Property property = View.ALPHA;
float[] fArr = new float[1];
fArr[0] = show ? 1.0f : 0.0f;
arrayList.add(ObjectAnimator.ofFloat(recyclerListView, (Property<RecyclerListView, Float>) property, fArr));
RecyclerListView recyclerListView2 = this.selectedPhotosListView;
Property property2 = View.TRANSLATION_Y;
float[] fArr2 = new float[1];
fArr2[0] = show ? 0.0f : -AndroidUtilities.dp(10.0f);
arrayList.add(ObjectAnimator.ofFloat(recyclerListView2, (Property<RecyclerListView, Float>) property2, fArr2));
CounterView counterView = this.photosCounterView;
Property property3 = View.ROTATION_X;
float[] fArr3 = new float[1];
fArr3[0] = show ? 1.0f : 0.0f;
arrayList.add(ObjectAnimator.ofFloat(counterView, (Property<CounterView, Float>) property3, fArr3));
AnimatorSet animatorSet = new AnimatorSet();
this.currentListViewAnimation = animatorSet;
animatorSet.playTogether(arrayList);
if (!show) {
this.currentListViewAnimation.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
if ((23 + 20) % 20 <= 0) {
}
if (PhotoViewer.this.currentListViewAnimation != null && PhotoViewer.this.currentListViewAnimation.equals(animation)) {
PhotoViewer.this.selectedPhotosListView.setVisibility(8);
PhotoViewer.this.currentListViewAnimation = null;
}
}
});
}
this.currentListViewAnimation.setDuration(200L);
this.currentListViewAnimation.start();
return;
}
this.selectedPhotosListView.setAlpha(show ? 1.0f : 0.0f);
this.selectedPhotosListView.setTranslationY(show ? 0.0f : -AndroidUtilities.dp(10.0f));
this.photosCounterView.setRotationX(show ? 1.0f : 0.0f);
if (!show) {
this.selectedPhotosListView.setVisibility(8);
}
}
private String getFileName(int index) {
ImageLocation location;
if ((30 + 26) % 26 <= 0) {
}
if (index < 0) {
return null;
}
if (!this.secureDocuments.isEmpty()) {
if (index >= this.secureDocuments.size()) {
return null;
}
SecureDocument location2 = this.secureDocuments.get(index);
return location2.secureFile.dc_id + "_" + location2.secureFile.id + ".jpg";
}
if (!this.imagesArrLocations.isEmpty() || !this.imagesArr.isEmpty()) {
if (!this.imagesArrLocations.isEmpty()) {
if (index >= this.imagesArrLocations.size() || (location = this.imagesArrLocations.get(index)) == null) {
return null;
}
return location.location.volume_id + "_" + location.location.local_id + ".jpg";
}
if (this.imagesArr.isEmpty() || index >= this.imagesArr.size()) {
return null;
}
return FileLoader.getMessageFileName(this.imagesArr.get(index).messageOwner);
}
if (this.imagesArrLocals.isEmpty() || index >= this.imagesArrLocals.size()) {
return null;
}
Object object = this.imagesArrLocals.get(index);
if (object instanceof MediaController.SearchImage) {
MediaController.SearchImage searchImage = (MediaController.SearchImage) object;
return searchImage.getAttachName();
}
if (object instanceof TLRPC.BotInlineResult) {
TLRPC.BotInlineResult botInlineResult = (TLRPC.BotInlineResult) object;
if (botInlineResult.document != null) {
return FileLoader.getAttachFileName(botInlineResult.document);
}
if (botInlineResult.photo != null) {
TLRPC.PhotoSize sizeFull = FileLoader.getClosestPhotoSizeWithSize(botInlineResult.photo.sizes, AndroidUtilities.getPhotoSize());
return FileLoader.getAttachFileName(sizeFull);
}
if (botInlineResult.content instanceof TLRPC.TL_webDocument) {
return Utilities.MD5(botInlineResult.content.url) + "." + ImageLoader.getHttpUrlExtension(botInlineResult.content.url, FileLoader.getMimeTypePart(botInlineResult.content.mime_type));
}
}
return null;
}
private ImageLocation getImageLocation(int index, int[] size) {
if ((22 + 26) % 26 <= 0) {
}
if (index < 0) {
return null;
}
if (!this.secureDocuments.isEmpty()) {
if (index >= this.secureDocuments.size()) {
return null;
}
if (size != null) {
size[0] = this.secureDocuments.get(index).secureFile.size;
}
return ImageLocation.getForSecureDocument(this.secureDocuments.get(index));
}
if (!this.imagesArrLocations.isEmpty()) {
if (index >= this.imagesArrLocations.size()) {
return null;
}
if (size != null) {
size[0] = this.imagesArrLocationsSizes.get(index).intValue();
}
return this.imagesArrLocations.get(index);
}
if (this.imagesArr.isEmpty() || index >= this.imagesArr.size()) {
return null;
}
MessageObject message = this.imagesArr.get(index);
if (message.messageOwner instanceof TLRPC.TL_messageService) {
if (message.messageOwner.action instanceof TLRPC.TL_messageActionUserUpdatedPhoto) {
return null;
}
TLRPC.PhotoSize sizeFull = FileLoader.getClosestPhotoSizeWithSize(message.photoThumbs, AndroidUtilities.getPhotoSize());
if (sizeFull != null) {
if (size != null) {
size[0] = sizeFull.size;
if (size[0] == 0) {
size[0] = -1;
}
}
return ImageLocation.getForObject(sizeFull, message.photoThumbsObject);
}
if (size != null) {
size[0] = -1;
}
} else if (((message.messageOwner.media instanceof TLRPC.TL_messageMediaPhoto) && message.messageOwner.media.photo != null) || ((message.messageOwner.media instanceof TLRPC.TL_messageMediaWebPage) && message.messageOwner.media.webpage != null)) {
if (message.isGif()) {
return ImageLocation.getForDocument(message.getDocument());
}
TLRPC.PhotoSize sizeFull2 = FileLoader.getClosestPhotoSizeWithSize(message.photoThumbs, AndroidUtilities.getPhotoSize());
if (sizeFull2 != null) {
if (size != null) {
size[0] = sizeFull2.size;
if (size[0] == 0) {
size[0] = -1;
}
}
return ImageLocation.getForObject(sizeFull2, message.photoThumbsObject);
}
if (size != null) {
size[0] = -1;
}
} else {
if (message.messageOwner.media instanceof TLRPC.TL_messageMediaInvoice) {
return ImageLocation.getForWebFile(WebFile.createWithWebDocument(message.messageOwner.media.photo));
}
if (message.getDocument() != null && MessageObject.isDocumentHasThumb(message.getDocument())) {
TLRPC.Document document = message.getDocument();
TLRPC.PhotoSize thumb = FileLoader.getClosestPhotoSizeWithSize(document.thumbs, 90);
if (size != null) {
size[0] = thumb.size;
if (size[0] == 0) {
size[0] = -1;
}
}
return ImageLocation.getForDocument(thumb, document);
}
}
return null;
}
public TLObject getFileLocation(int index, int[] size) {
if ((25 + 26) % 26 <= 0) {
}
if (index < 0) {
return null;
}
if (!this.secureDocuments.isEmpty()) {
if (index >= this.secureDocuments.size()) {
return null;
}
if (size != null) {
size[0] = this.secureDocuments.get(index).secureFile.size;
}
return this.secureDocuments.get(index);
}
if (!this.imagesArrLocations.isEmpty()) {
if (index >= this.imagesArrLocations.size()) {
return null;
}
if (size != null) {
size[0] = this.imagesArrLocationsSizes.get(index).intValue();
}
return this.imagesArrLocations.get(index).location;
}
if (this.imagesArr.isEmpty() || index >= this.imagesArr.size()) {
return null;
}
MessageObject message = this.imagesArr.get(index);
if (message.messageOwner instanceof TLRPC.TL_messageService) {
if (message.messageOwner.action instanceof TLRPC.TL_messageActionUserUpdatedPhoto) {
return message.messageOwner.action.newUserPhoto.photo_big;
}
TLRPC.PhotoSize sizeFull = FileLoader.getClosestPhotoSizeWithSize(message.photoThumbs, AndroidUtilities.getPhotoSize());
if (sizeFull != null) {
if (size != null) {
size[0] = sizeFull.size;
if (size[0] == 0) {
size[0] = -1;
}
}
return sizeFull;
}
if (size != null) {
size[0] = -1;
}
} else if (((message.messageOwner.media instanceof TLRPC.TL_messageMediaPhoto) && message.messageOwner.media.photo != null) || ((message.messageOwner.media instanceof TLRPC.TL_messageMediaWebPage) && message.messageOwner.media.webpage != null)) {
TLRPC.PhotoSize sizeFull2 = FileLoader.getClosestPhotoSizeWithSize(message.photoThumbs, AndroidUtilities.getPhotoSize());
if (sizeFull2 != null) {
if (size != null) {
size[0] = sizeFull2.size;
if (size[0] == 0) {
size[0] = -1;
}
}
return sizeFull2;
}
if (size != null) {
size[0] = -1;
}
} else {
if (message.messageOwner.media instanceof TLRPC.TL_messageMediaInvoice) {
return message.messageOwner.media.photo;
}
if (message.getDocument() != null && MessageObject.isDocumentHasThumb(message.getDocument())) {
TLRPC.PhotoSize thumb = FileLoader.getClosestPhotoSizeWithSize(message.getDocument().thumbs, 90);
if (size != null) {
size[0] = thumb.size;
if (size[0] == 0) {
size[0] = -1;
}
}
return thumb;
}
}
return null;
}
public void updateSelectedCount() {
if ((16 + gallery_menu_share) % gallery_menu_share <= 0) {
}
PhotoViewerProvider photoViewerProvider = this.placeProvider;
if (photoViewerProvider == null) {
return;
}
int count = photoViewerProvider.getSelectedCount();
this.photosCounterView.setCount(count);
if (count == 0) {
togglePhotosListView(false, true);
}
}
private void onPhotoShow(im.amwhusedvt.messenger.MessageObject r25, im.amwhusedvt.tgnet.TLRPC.FileLocation r26, im.amwhusedvt.messenger.ImageLocation r27, java.util.ArrayList<im.amwhusedvt.messenger.MessageObject> r28, java.util.ArrayList<im.amwhusedvt.messenger.SecureDocument> r29, java.util.ArrayList<java.lang.Object> r30, int r31, im.amwhusedvt.ui.PhotoViewer.PlaceProviderObject r32) {
throw new UnsupportedOperationException("Method not decompiled: im.amwhusedvt.ui.PhotoViewer.onPhotoShow(im.amwhusedvt.messenger.MessageObject, im.amwhusedvt.tgnet.TLRPC$FileLocation, im.amwhusedvt.messenger.ImageLocation, java.util.ArrayList, java.util.ArrayList, java.util.ArrayList, int, im.amwhusedvt.ui.PhotoViewer$PlaceProviderObject):void");
}
private void setDoubleTapEnabled(boolean value) {
if ((21 + 5) % 5 <= 0) {
}
this.doubleTapEnabled = value;
this.gestureDetector.setOnDoubleTapListener(value ? this : null);
}
public boolean isMuteVideo() {
return this.muteVideo;
}
public void setImages() {
if ((20 + 28) % 28 <= 0) {
}
if (this.animationInProgress == 0) {
setIndexToImage(this.centerImage, this.currentIndex);
setIndexToImage(this.rightImage, this.currentIndex + 1);
setIndexToImage(this.leftImage, this.currentIndex - 1);
}
}
public void setNeedMore(boolean need) {
if ((20 + gallery_menu_cancel_loading) % gallery_menu_cancel_loading <= 0) {
}
this.mShowNeedAddMorePicButton = need;
this.cameraItem.setVisibility(need ? 0 : 4);
}
private void setIsAboutToSwitchToIndex(int index, boolean init) {
boolean isVideo;
boolean isVideo2;
boolean z;
float end;
boolean isMuted;
CharSequence caption;
boolean isVideo3;
?? r8;
long date;
boolean z2;
int loadFromMaxId;
if ((29 + 17) % 17 <= 0) {
}
if (!init && this.switchingToIndex == index) {
return;
}
this.switchingToIndex = index;
boolean isVideo4 = false;
String newFileName = getFileName(index);
MessageObject newMessageObject = null;
if (this.imagesArr.isEmpty()) {
CharSequence caption2 = null;
if (!this.secureDocuments.isEmpty()) {
this.allowShare = false;
this.menuItem.hideSubItem(1);
this.nameTextView.setText("");
this.dateTextView.setText("");
this.actionBar.setTitle(LocaleController.formatString("Of", 2131692471, new Object[]{Integer.valueOf(this.switchingToIndex + 1), Integer.valueOf(this.secureDocuments.size())}));
isVideo = false;
} else if (!this.imagesArrLocations.isEmpty()) {
if (index < 0 || index >= this.imagesArrLocations.size()) {
return;
}
this.nameTextView.setText("");
this.dateTextView.setText("");
if (this.avatarsDialogId != UserConfig.getInstance(this.currentAccount).getClientUserId() || this.avatarsArr.isEmpty()) {
this.menuItem.hideSubItem(gallery_menu_delete);
} else {
this.menuItem.showSubItem(gallery_menu_delete);
}
if (this.isEvent) {
this.actionBar.setTitle(LocaleController.getString("AttachPhoto", 2131689960));
r8 = 1;
} else {
r8 = 1;
this.actionBar.setTitle(LocaleController.formatString("Of", 2131692471, new Object[]{Integer.valueOf(this.switchingToIndex + 1), Integer.valueOf(this.imagesArrLocations.size())}));
}
this.menuItem.showSubItem((int) r8);
this.allowShare = r8;
this.shareButton.setVisibility(this.videoPlayerControlFrameLayout.getVisibility() != 0 ? 0 : 8);
if (this.shareButton.getVisibility() == 0) {
this.menuItem.hideSubItem(gallery_menu_share);
} else {
this.menuItem.showSubItem(gallery_menu_share);
}
this.groupedPhotosListView.fillList();
isVideo = false;
} else if (this.imagesArrLocals.isEmpty()) {
isVideo = false;
} else {
if (index >= 0 && index < this.imagesArrLocals.size()) {
Object object = this.imagesArrLocals.get(index);
int ttl = 0;
boolean isFiltered = false;
boolean isPainted = false;
boolean isCropped = false;
if (object instanceof TLRPC.BotInlineResult) {
TLRPC.BotInlineResult botInlineResult = (TLRPC.BotInlineResult) object;
this.currentBotInlineResult = botInlineResult;
if (botInlineResult.document != null) {
isVideo4 = MessageObject.isVideoDocument(botInlineResult.document);
} else if (botInlineResult.content instanceof TLRPC.TL_webDocument) {
isVideo4 = botInlineResult.type.equals("video");
}
isVideo2 = isVideo4;
} else {
String pathObject = null;
boolean isAnimation = false;
if (object instanceof MediaController.PhotoEntry) {
MediaController.PhotoEntry photoEntry = (MediaController.PhotoEntry) object;
pathObject = photoEntry.path;
isVideo4 = photoEntry.isVideo;
} else if (object instanceof MediaController.SearchImage) {
MediaController.SearchImage searchImage = (MediaController.SearchImage) object;
pathObject = searchImage.getPathToAttach();
if (searchImage.type != 1) {
isVideo4 = false;
} else {
isAnimation = true;
isVideo4 = false;
}
}
if (isVideo4) {
this.muteItem.setVisibility(0);
this.compressItem.setVisibility(0);
this.isCurrentVideo = true;
updateAccessibilityOverlayVisibility();
float start = 0.0f;
boolean isMuted2 = object instanceof MediaController.PhotoEntry;
if (!isMuted2) {
isVideo2 = isVideo4;
} else {
MediaController.PhotoEntry photoEntry2 = (MediaController.PhotoEntry) object;
isVideo2 = isVideo4;
if (photoEntry2.editedInfo != null) {
boolean isMuted3 = photoEntry2.editedInfo.muted;
start = photoEntry2.editedInfo.start;
end = photoEntry2.editedInfo.end;
isMuted = isMuted3;
processOpenVideo(pathObject, isMuted, start, end);
this.videoTimelineView.setVisibility(0);
this.muteItem.setVisibility(0);
this.compressItem.setVisibility(0);
this.paintItem.setVisibility(8);
this.cropItem.setVisibility(8);
this.tuneItem.setVisibility(8);
this.rotateItem.setVisibility(8);
}
}
end = 1.0f;
isMuted = false;
processOpenVideo(pathObject, isMuted, start, end);
this.videoTimelineView.setVisibility(0);
this.muteItem.setVisibility(0);
this.compressItem.setVisibility(0);
this.paintItem.setVisibility(8);
this.cropItem.setVisibility(8);
this.tuneItem.setVisibility(8);
this.rotateItem.setVisibility(8);
} else {
isVideo2 = isVideo4;
this.videoTimelineView.setVisibility(8);
this.muteItem.setVisibility(8);
this.isCurrentVideo = false;
updateAccessibilityOverlayVisibility();
this.compressItem.setVisibility(8);
if (isAnimation) {
this.paintItem.setVisibility(8);
this.cropItem.setVisibility(8);
this.rotateItem.setVisibility(8);
this.tuneItem.setVisibility(8);
} else {
int i = this.sendPhotoType;
if (i == 4 || i == 5) {
this.paintItem.setVisibility(8);
this.tuneItem.setVisibility(8);
} else {
this.paintItem.setVisibility(0);
this.tuneItem.setVisibility(0);
}
this.cropItem.setVisibility(this.sendPhotoType != 1 ? 0 : 8);
this.rotateItem.setVisibility(this.sendPhotoType != 1 ? 8 : 0);
}
this.actionBar.setSubtitle((CharSequence) null);
}
if (object instanceof MediaController.PhotoEntry) {
MediaController.PhotoEntry photoEntry3 = (MediaController.PhotoEntry) object;
if (photoEntry3.bucketId == 0 && photoEntry3.dateTaken == 0 && this.imagesArrLocals.size() == 1) {
z = true;
this.fromCamera = z;
CharSequence caption3 = photoEntry3.caption;
int ttl2 = photoEntry3.ttl;
isFiltered = photoEntry3.isFiltered;
isPainted = photoEntry3.isPainted;
isCropped = photoEntry3.isCropped;
caption2 = caption3;
ttl = ttl2;
}
z = false;
this.fromCamera = z;
CharSequence caption32 = photoEntry3.caption;
int ttl22 = photoEntry3.ttl;
isFiltered = photoEntry3.isFiltered;
isPainted = photoEntry3.isPainted;
isCropped = photoEntry3.isCropped;
caption2 = caption32;
ttl = ttl22;
} else if (!(object instanceof MediaController.SearchImage)) {
ttl = 0;
} else {
MediaController.SearchImage searchImage2 = (MediaController.SearchImage) object;
CharSequence caption4 = searchImage2.caption;
int ttl3 = searchImage2.ttl;
isFiltered = searchImage2.isFiltered;
isPainted = searchImage2.isPainted;
isCropped = searchImage2.isCropped;
caption2 = caption4;
ttl = ttl3;
}
}
if (this.bottomLayout.getVisibility() != 8) {
this.bottomLayout.setVisibility(8);
}
this.bottomLayout.setTag(null);
if (this.fromCamera) {
if (isVideo2) {
this.actionBar.setTitle(LocaleController.getString("AttachVideo", 2131689966));
} else {
this.actionBar.setTitle(LocaleController.getString("AttachPhoto", 2131689960));
}
} else {
this.actionBar.setTitle(LocaleController.formatString("Of", 2131692471, new Object[]{Integer.valueOf(this.switchingToIndex + 1), Integer.valueOf(this.imagesArrLocals.size())}));
}
ChatActivity chatActivity = this.parentChatActivity;
if (chatActivity != null) {
TLRPC.Chat chat = chatActivity.getCurrentChat();
if (chat != null) {
this.actionBar.setTitle(chat.title);
} else {
TLRPC.User user = this.parentChatActivity.getCurrentUser();
if (user != null) {
if (user.self) {
this.actionBar.setTitle(LocaleController.getString("SavedMessages", 2131693699));
} else {
this.actionBar.setTitle(ContactsController.formatName(user.first_name, user.last_name));
}
}
}
}
int i2 = this.sendPhotoType;
if (i2 == 0 || i2 == 4 || ((i2 == 2 || i2 == 5) && this.imagesArrLocals.size() > 1)) {
this.checkImageView.setChecked(this.placeProvider.isPhotoChecked(this.switchingToIndex), false);
}
updateCaptionTextForCurrentPhoto(object);
PorterDuffColorFilter filter = new PorterDuffColorFilter(-12734994, PorterDuff.Mode.MULTIPLY);
this.timeItem.setColorFilter(ttl != 0 ? filter : null);
this.paintItem.setColorFilter(isPainted ? filter : null);
this.cropItem.setColorFilter(isCropped ? filter : null);
this.tuneItem.setColorFilter(isFiltered ? filter : null);
caption = caption2;
isVideo3 = isVideo2;
}
return;
}
isVideo3 = isVideo;
caption = null;
} else {
int i3 = this.switchingToIndex;
if (i3 >= 0 && i3 < this.imagesArr.size()) {
newMessageObject = this.imagesArr.get(this.switchingToIndex);
boolean isVideo5 = newMessageObject.isVideo();
boolean isInvoice = newMessageObject.isInvoice();
if (isInvoice) {
this.masksItem.setVisibility(8);
this.menuItem.hideSubItem(gallery_menu_delete);
this.menuItem.hideSubItem(gallery_menu_openin);
caption = newMessageObject.messageOwner.media.description;
this.allowShare = false;
this.bottomLayout.setTranslationY(AndroidUtilities.dp(48.0f));
this.captionTextView.setTranslationY(AndroidUtilities.dp(48.0f));
isVideo3 = isVideo5;
} else {
this.masksItem.setVisibility((!newMessageObject.hasPhotoStickers() || ((int) newMessageObject.getDialogId()) == 0) ? 8 : 0);
ChatActivity chatActivity2 = this.parentChatActivity;
if (!newMessageObject.canDeleteMessage(chatActivity2 != null && chatActivity2.isInScheduleMode(), (TLRPC.Chat) null) || this.slideshowMessageId != 0) {
this.menuItem.hideSubItem(gallery_menu_delete);
} else {
this.menuItem.showSubItem(gallery_menu_delete);
}
if (isVideo5) {
this.menuItem.showSubItem(gallery_menu_openin);
if (this.pipItem.getVisibility() == 0) {
z2 = false;
} else {
z2 = false;
this.pipItem.setVisibility(0);
}
if (!this.pipAvailable) {
this.pipItem.setEnabled(z2);
this.pipItem.setAlpha(0.5f);
}
} else {
this.menuItem.hideSubItem(gallery_menu_openin);
if (this.pipItem.getVisibility() != 8) {
this.pipItem.setVisibility(8);
}
}
String str = this.nameOverride;
if (str != null) {
this.nameTextView.setText(str);
} else if (newMessageObject.isFromUser()) {
TLRPC.User user2 = MessagesController.getInstance(this.currentAccount).getUser(Integer.valueOf(newMessageObject.messageOwner.from_id));
if (user2 != null) {
this.nameTextView.setText(UserObject.getName(user2));
} else {
this.nameTextView.setText("");
}
} else {
TLRPC.Chat chat2 = MessagesController.getInstance(this.currentAccount).getChat(Integer.valueOf(newMessageObject.messageOwner.to_id.channel_id));
if (ChatObject.isChannel(chat2) && chat2.megagroup && newMessageObject.isForwardedChannelPost()) {
chat2 = MessagesController.getInstance(this.currentAccount).getChat(Integer.valueOf(newMessageObject.messageOwner.fwd_from.channel_id));
}
if (chat2 != null) {
this.nameTextView.setText(chat2.title);
} else {
this.nameTextView.setText("");
}
}
int i4 = this.dateOverride;
if (i4 != 0) {
date = i4 * 1000;
} else {
date = newMessageObject.messageOwner.date * 1000;
}
String dateString = LocaleController.formatString("formatDateAtTime", 2131695137, new Object[]{LocaleController.getInstance().formatterYear.format(new Date(date)), LocaleController.getInstance().formatterDay.format(new Date(date))});
if (newFileName == null || !isVideo5) {
isVideo3 = isVideo5;
this.dateTextView.setText(dateString);
} else {
isVideo3 = isVideo5;
this.dateTextView.setText(String.format("%s (%s)", dateString, AndroidUtilities.formatFileSize(newMessageObject.getDocument().size)));
}
caption = newMessageObject.caption;
}
if (this.currentAnimation == null) {
if (this.totalImagesCount + this.totalImagesCountMerge != 0 && !this.needSearchImageInArr) {
if (this.opennedFromMedia) {
if (this.imagesArr.size() < this.totalImagesCount + this.totalImagesCountMerge && !this.loadingMoreImages && this.switchingToIndex > this.imagesArr.size() - 5) {
if (this.imagesArr.isEmpty()) {
loadFromMaxId = 0;
} else {
ArrayList<MessageObject> arrayList = this.imagesArr;
loadFromMaxId = arrayList.get(arrayList.size() - 1).getId();
}
int loadIndex = 0;
if (this.endReached[0] && this.mergeDialogId != 0) {
loadIndex = 1;
if (!this.imagesArr.isEmpty()) {
ArrayList<MessageObject> arrayList2 = this.imagesArr;
if (arrayList2.get(arrayList2.size() - 1).getDialogId() != this.mergeDialogId) {
loadFromMaxId = 0;
}
}
}
MediaDataController.getInstance(this.currentAccount).loadMedia(loadIndex == 0 ? this.currentDialogId : this.mergeDialogId, 80, loadFromMaxId, this.sharedMediaType, 1, this.classGuid);
this.loadingMoreImages = true;
}
this.actionBar.setTitle(LocaleController.formatString("Of", 2131692471, new Object[]{Integer.valueOf(this.switchingToIndex + 1), Integer.valueOf(this.totalImagesCount + this.totalImagesCountMerge)}));
} else {
if (this.imagesArr.size() < this.totalImagesCount + this.totalImagesCountMerge && !this.loadingMoreImages && this.switchingToIndex < 5) {
int loadFromMaxId2 = this.imagesArr.isEmpty() ? 0 : this.imagesArr.get(0).getId();
int loadIndex2 = 0;
if (this.endReached[0] && this.mergeDialogId != 0) {
loadIndex2 = 1;
if (!this.imagesArr.isEmpty() && this.imagesArr.get(0).getDialogId() != this.mergeDialogId) {
loadFromMaxId2 = 0;
}
}
MediaDataController.getInstance(this.currentAccount).loadMedia(loadIndex2 == 0 ? this.currentDialogId : this.mergeDialogId, 80, loadFromMaxId2, this.sharedMediaType, 1, this.classGuid);
this.loadingMoreImages = true;
} else if (this.imagesArr.size() > 0) {
this.totalImagesCount = this.imagesArr.size();
}
this.actionBar.setTitle(LocaleController.formatString("Of", 2131692471, new Object[]{Integer.valueOf(((this.totalImagesCount + this.totalImagesCountMerge) - this.imagesArr.size()) + this.switchingToIndex + 1), Integer.valueOf(this.totalImagesCount + this.totalImagesCountMerge)}));
}
} else if (this.slideshowMessageId == 0 && (newMessageObject.messageOwner.media instanceof TLRPC.TL_messageMediaWebPage)) {
if (newMessageObject.canPreviewDocument()) {
this.actionBar.setTitle(LocaleController.getString("AttachDocument", 2131689947));
} else if (newMessageObject.isVideo()) {
this.actionBar.setTitle(LocaleController.getString("AttachVideo", 2131689966));
} else {
this.actionBar.setTitle(LocaleController.getString("AttachPhoto", 2131689960));
}
} else if (isInvoice) {
this.actionBar.setTitle(newMessageObject.messageOwner.media.title);
} else if (newMessageObject.isVideo()) {
this.actionBar.setTitle(LocaleController.getString("AttachVideo", 2131689966));
} else if (newMessageObject.getDocument() != null) {
this.actionBar.setTitle(LocaleController.getString("AttachDocument", 2131689947));
}
if (((int) this.currentDialogId) == 0) {
this.sendItem.setVisibility(8);
}
if (newMessageObject.messageOwner.ttl == 0 || newMessageObject.messageOwner.ttl >= 3600) {
this.allowShare = true;
this.menuItem.showSubItem(1);
this.shareButton.setVisibility(this.videoPlayerControlFrameLayout.getVisibility() != 0 ? 0 : 8);
if (this.shareButton.getVisibility() == 0) {
this.menuItem.hideSubItem(gallery_menu_share);
} else {
this.menuItem.showSubItem(gallery_menu_share);
}
} else {
this.allowShare = false;
this.menuItem.hideSubItem(1);
this.shareButton.setVisibility(8);
this.menuItem.hideSubItem(gallery_menu_share);
}
} else {
this.menuItem.hideSubItem(1);
this.menuItem.hideSubItem(gallery_menu_share);
ChatActivity chatActivity3 = this.parentChatActivity;
if (!newMessageObject.canDeleteMessage(chatActivity3 != null && chatActivity3.isInScheduleMode(), (TLRPC.Chat) null)) {
this.menuItem.hideSubItem(gallery_menu_delete);
}
this.allowShare = true;
this.shareButton.setVisibility(0);
this.actionBar.setTitle(LocaleController.getString("AttachGif", 2131689949));
}
this.groupedPhotosListView.fillList();
}
return;
}
if (isVideo3) {
this.allowShare = false;
this.shareButton.setVisibility(0);
this.menuItem.setVisibility(0);
this.sendItem.setVisibility(0);
} else {
this.shareButton.setVisibility(0);
this.menuItem.setVisibility(0);
this.sendItem.setVisibility(0);
}
setCurrentCaption(newMessageObject, caption, !init);
}
public TLRPC.FileLocation getFileLocation(ImageLocation location) {
if (location == null) {
return null;
}
return location.location;
}
public void setImageIndex(int index, boolean init) {
MessageObject messageObject;
ImageReceiver.BitmapHolder bitmapHolder;
if ((12 + 24) % 24 <= 0) {
}
if (this.currentIndex == index || this.placeProvider == null) {
return;
}
if (!init && (bitmapHolder = this.currentThumb) != null) {
bitmapHolder.release();
this.currentThumb = null;
}
this.currentFileNames[0] = getFileName(index);
this.currentFileNames[1] = getFileName(index + 1);
this.currentFileNames[2] = getFileName(index - 1);
this.placeProvider.willSwitchFromPhoto(this.currentMessageObject, getFileLocation(this.currentFileLocation), this.currentIndex);
int prevIndex = this.currentIndex;
this.currentIndex = index;
setIsAboutToSwitchToIndex(index, init);
boolean isVideo = false;
boolean sameImage = false;
Uri videoPath = null;
if (!this.imagesArr.isEmpty()) {
int i = this.currentIndex;
if (i >= 0 && i < this.imagesArr.size()) {
MessageObject newMessageObject = this.imagesArr.get(this.currentIndex);
sameImage = init && (messageObject = this.currentMessageObject) != null && messageObject.getId() == newMessageObject.getId();
this.currentMessageObject = newMessageObject;
isVideo = newMessageObject.isVideo();
if (this.sharedMediaType == 1) {
boolean canPreviewDocument = newMessageObject.canPreviewDocument();
this.canZoom = canPreviewDocument;
if (canPreviewDocument) {
this.menuItem.showSubItem(1);
setDoubleTapEnabled(true);
} else {
this.menuItem.hideSubItem(1);
setDoubleTapEnabled(false);
}
}
} else {
closePhoto(false, false);
return;
}
} else if (!this.secureDocuments.isEmpty()) {
if (index >= 0 && index < this.secureDocuments.size()) {
this.currentSecureDocument = this.secureDocuments.get(index);
} else {
closePhoto(false, false);
return;
}
} else if (!this.imagesArrLocations.isEmpty()) {
if (index < 0 || index >= this.imagesArrLocations.size()) {
closePhoto(false, false);
return;
}
ImageLocation old = this.currentFileLocation;
ImageLocation newLocation = this.imagesArrLocations.get(index);
if (init && old != null && newLocation != null && old.location.local_id == newLocation.location.local_id && old.location.volume_id == newLocation.location.volume_id) {
sameImage = true;
}
this.currentFileLocation = this.imagesArrLocations.get(index);
} else if (!this.imagesArrLocals.isEmpty()) {
if (index < 0 || index >= this.imagesArrLocals.size()) {
closePhoto(false, false);
return;
}
Object object = this.imagesArrLocals.get(index);
if (object instanceof TLRPC.BotInlineResult) {
TLRPC.BotInlineResult botInlineResult = (TLRPC.BotInlineResult) object;
this.currentBotInlineResult = botInlineResult;
if (botInlineResult.document != null) {
this.currentPathObject = FileLoader.getPathToAttach(botInlineResult.document).getAbsolutePath();
isVideo = MessageObject.isVideoDocument(botInlineResult.document);
} else if (botInlineResult.photo != null) {
this.currentPathObject = FileLoader.getPathToAttach(FileLoader.getClosestPhotoSizeWithSize(botInlineResult.photo.sizes, AndroidUtilities.getPhotoSize())).getAbsolutePath();
} else if (botInlineResult.content instanceof TLRPC.TL_webDocument) {
this.currentPathObject = botInlineResult.content.url;
isVideo = botInlineResult.type.equals("video");
}
} else if (object instanceof MediaController.PhotoEntry) {
MediaController.PhotoEntry photoEntry = (MediaController.PhotoEntry) object;
String str = photoEntry.path;
this.currentPathObject = str;
if (str == null) {
closePhoto(false, false);
return;
} else {
isVideo = photoEntry.isVideo;
videoPath = Uri.fromFile(new File(photoEntry.path));
}
} else if (object instanceof MediaController.SearchImage) {
MediaController.SearchImage searchImage = (MediaController.SearchImage) object;
this.currentPathObject = searchImage.getPathToAttach();
}
}
PlaceProviderObject placeProviderObject = this.currentPlaceObject;
if (placeProviderObject != null) {
if (this.animationInProgress == 0) {
placeProviderObject.imageReceiver.setVisible(true, true);
} else {
this.showAfterAnimation = placeProviderObject;
}
}
PlaceProviderObject placeForPhoto = this.placeProvider.getPlaceForPhoto(this.currentMessageObject, getFileLocation(this.currentFileLocation), this.currentIndex, false);
this.currentPlaceObject = placeForPhoto;
if (placeForPhoto != null) {
if (this.animationInProgress == 0) {
placeForPhoto.imageReceiver.setVisible(false, true);
} else {
this.hideAfterAnimation = placeForPhoto;
}
}
if (!sameImage) {
this.draggingDown = false;
this.translationX = 0.0f;
this.translationY = 0.0f;
this.scale = 1.0f;
this.animateToX = 0.0f;
this.animateToY = 0.0f;
this.animateToScale = 1.0f;
this.animationStartTime = 0L;
this.imageMoveAnimation = null;
this.changeModeAnimation = null;
AspectRatioFrameLayout aspectRatioFrameLayout = this.aspectRatioFrameLayout;
if (aspectRatioFrameLayout != null) {
aspectRatioFrameLayout.setVisibility(4);
}
this.pinchStartDistance = 0.0f;
this.pinchStartScale = 1.0f;
this.pinchCenterX = 0.0f;
this.pinchCenterY = 0.0f;
this.pinchStartX = 0.0f;
this.pinchStartY = 0.0f;
this.moveStartX = 0.0f;
this.moveStartY = 0.0f;
this.zooming = false;
this.moving = false;
this.doubleTap = false;
this.invalidCoords = false;
this.canDragDown = true;
this.changingPage = false;
this.switchImageAfterAnimation = 0;
if (this.sharedMediaType != 1) {
this.canZoom = (this.imagesArrLocals.isEmpty() && (this.currentFileNames[0] == null || this.photoProgressViews[0].backgroundState == 0)) ? false : true;
}
updateMinMax(this.scale);
releasePlayer(false);
}
if (isVideo && videoPath != null) {
this.isStreaming = false;
preparePlayer(videoPath, false, false);
}
if (prevIndex == -1) {
setImages();
for (int a = 0; a < 3; a++) {
checkProgress(a, false);
}
return;
}
checkProgress(0, false);
int i2 = this.currentIndex;
if (prevIndex > i2) {
ImageReceiver temp = this.rightImage;
this.rightImage = this.centerImage;
this.centerImage = this.leftImage;
this.leftImage = temp;
PhotoProgressView[] photoProgressViewArr = this.photoProgressViews;
PhotoProgressView tempProgress = photoProgressViewArr[0];
photoProgressViewArr[0] = photoProgressViewArr[2];
photoProgressViewArr[2] = tempProgress;
setIndexToImage(temp, i2 - 1);
checkProgress(1, false);
checkProgress(2, false);
return;
}
if (prevIndex < i2) {
ImageReceiver temp2 = this.leftImage;
this.leftImage = this.centerImage;
this.centerImage = this.rightImage;
this.rightImage = temp2;
PhotoProgressView[] photoProgressViewArr2 = this.photoProgressViews;
PhotoProgressView tempProgress2 = photoProgressViewArr2[0];
photoProgressViewArr2[0] = photoProgressViewArr2[1];
photoProgressViewArr2[1] = tempProgress2;
setIndexToImage(temp2, i2 + 1);
checkProgress(1, false);
checkProgress(2, false);
}
}
private void setCurrentCaption(MessageObject messageObject, CharSequence caption, boolean animated) {
CharSequence str;
if ((30 + gallery_menu_openin) % gallery_menu_openin <= 0) {
}
if (this.needCaptionLayout) {
if (this.captionTextView.getParent() != this.pickerView) {
this.captionTextView.setBackgroundDrawable(null);
this.containerView.removeView(this.captionTextView);
this.pickerView.addView(this.captionTextView, LayoutHelper.createFrame(-1.0f, -2.0f, 83, 0.0f, 0.0f, 76.0f, 48.0f));
}
} else if (this.captionTextView.getParent() != this.containerView) {
this.captionTextView.setBackgroundColor(2130706432);
this.pickerView.removeView(this.captionTextView);
this.containerView.addView(this.captionTextView, LayoutHelper.createFrame(-1.0f, -2.0f, 83, 0.0f, 0.0f, 0.0f, 48.0f));
}
if (this.isCurrentVideo) {
if (this.captionTextView.getMaxLines() != 1) {
this.captionTextView.setMaxLines(1);
}
if (!this.isSingleLine) {
TextView textView = this.captionTextView;
this.isSingleLine = true;
textView.setSingleLine(true);
}
} else {
if (this.isSingleLine) {
TextView textView2 = this.captionTextView;
this.isSingleLine = false;
textView2.setSingleLine(false);
}
int newCount = AndroidUtilities.displaySize.x > AndroidUtilities.displaySize.y ? 5 : gallery_menu_share;
if (this.captionTextView.getMaxLines() != newCount) {
this.captionTextView.setMaxLines(newCount);
}
}
boolean wasVisisble = this.captionTextView.getTag() != null;
if (TextUtils.isEmpty(caption)) {
if (this.needCaptionLayout) {
this.captionTextView.setText(LocaleController.getString("AddCaption", 2131689667));
this.captionTextView.setTag("empty");
this.captionTextView.setVisibility(0);
this.captionTextView.setTextColor(-1291845633);
return;
}
this.captionTextView.setTextColor(-1);
this.captionTextView.setTag(null);
if (animated && wasVisisble) {
AnimatorSet animatorSet = new AnimatorSet();
this.currentCaptionAnimation = animatorSet;
animatorSet.setDuration(200L);
this.currentCaptionAnimation.setInterpolator(decelerateInterpolator);
this.currentCaptionAnimation.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
if ((PhotoViewer.gallery_menu_cancel_loading + 19) % 19 <= 0) {
}
if (animation.equals(PhotoViewer.this.currentCaptionAnimation)) {
PhotoViewer.this.captionTextView.setVisibility(4);
PhotoViewer.this.currentCaptionAnimation = null;
}
}
@Override
public void onAnimationCancel(Animator animation) {
if ((3 + 30) % 30 <= 0) {
}
if (animation.equals(PhotoViewer.this.currentCaptionAnimation)) {
PhotoViewer.this.currentCaptionAnimation = null;
}
}
});
this.currentCaptionAnimation.playTogether(ObjectAnimator.ofFloat(this.captionTextView, (Property<TextView, Float>) View.ALPHA, 0.0f), ObjectAnimator.ofFloat(this.captionTextView, (Property<TextView, Float>) View.TRANSLATION_Y, AndroidUtilities.dp(5.0f)));
this.currentCaptionAnimation.start();
return;
}
this.captionTextView.setVisibility(4);
return;
}
Theme.createChatResources((Context) null, true);
if (messageObject == null || messageObject.messageOwner.entities.isEmpty()) {
str = Emoji.replaceEmoji(new SpannableStringBuilder(caption), this.captionTextView.getPaint().getFontMetricsInt(), AndroidUtilities.dp(20.0f), false);
} else {
Spannable spannableString = SpannableString.valueOf(caption.toString());
messageObject.addEntitiesToText(spannableString, true, false);
CharSequence str2 = Emoji.replaceEmoji(spannableString, this.captionTextView.getPaint().getFontMetricsInt(), AndroidUtilities.dp(20.0f), false);
str = str2;
}
this.captionTextView.setTag(str);
AnimatorSet animatorSet2 = this.currentCaptionAnimation;
if (animatorSet2 != null) {
animatorSet2.cancel();
this.currentCaptionAnimation = null;
}
try {
this.captionTextView.setText(str);
} catch (Exception e) {
FileLog.e(e);
}
this.captionTextView.setScrollY(0);
this.captionTextView.setTextColor(-1);
boolean visible = this.isActionBarVisible && (this.bottomLayout.getVisibility() == 0 || this.pickerView.getVisibility() == 0);
if (visible) {
this.captionTextView.setVisibility(0);
if (animated && !wasVisisble) {
AnimatorSet animatorSet3 = new AnimatorSet();
this.currentCaptionAnimation = animatorSet3;
animatorSet3.setDuration(200L);
this.currentCaptionAnimation.setInterpolator(decelerateInterpolator);
this.currentCaptionAnimation.addListener(new 39(this));
this.currentCaptionAnimation.playTogether(ObjectAnimator.ofFloat(this.captionTextView, (Property<TextView, Float>) View.ALPHA, 0.0f, 1.0f), ObjectAnimator.ofFloat(this.captionTextView, (Property<TextView, Float>) View.TRANSLATION_Y, AndroidUtilities.dp(5.0f), 0.0f));
this.currentCaptionAnimation.start();
return;
}
this.captionTextView.setAlpha(1.0f);
return;
}
if (this.captionTextView.getVisibility() == 0) {
this.captionTextView.setVisibility(4);
this.captionTextView.setAlpha(0.0f);
}
}
private void checkProgress(final int a, final boolean animated) {
int index;
File f1;
File f2;
boolean isVideo;
boolean canStream;
File f22;
if ((1 + gallery_menu_masks) % gallery_menu_masks <= 0) {
}
int index2 = this.currentIndex;
if (a == 1) {
index = index2 + 1;
} else if (a != 2) {
index = index2;
} else {
index = index2 - 1;
}
if (this.currentFileNames[a] != null) {
File f12 = null;
boolean isVideo2 = false;
if (this.currentMessageObject != null) {
if (index < 0 || index >= this.imagesArr.size()) {
this.photoProgressViews[a].setBackgroundState(-1, animated);
return;
}
MessageObject messageObject = this.imagesArr.get(index);
if (this.sharedMediaType == 1 && !messageObject.canPreviewDocument()) {
this.photoProgressViews[a].setBackgroundState(-1, animated);
return;
}
if (!TextUtils.isEmpty(messageObject.messageOwner.attachPath)) {
f12 = new File(messageObject.messageOwner.attachPath);
}
if ((messageObject.messageOwner.media instanceof TLRPC.TL_messageMediaWebPage) && messageObject.messageOwner.media.webpage != null && messageObject.messageOwner.media.webpage.document == null) {
TLObject fileLocation = getFileLocation(index, null);
File f23 = FileLoader.getPathToAttach(fileLocation, true);
f22 = f23;
} else {
f22 = FileLoader.getPathToMessage(messageObject.messageOwner);
}
boolean canStream2 = SharedConfig.streamMedia && messageObject.isVideo() && messageObject.canStreamVideo() && ((int) messageObject.getDialogId()) != 0;
f1 = f12;
f2 = f22;
isVideo = messageObject.isVideo();
canStream = canStream2;
} else if (this.currentBotInlineResult != null) {
if (index < 0 || index >= this.imagesArrLocals.size()) {
this.photoProgressViews[a].setBackgroundState(-1, animated);
return;
}
TLRPC.BotInlineResult botInlineResult = (TLRPC.BotInlineResult) this.imagesArrLocals.get(index);
if (botInlineResult.type.equals("video") || MessageObject.isVideoDocument(botInlineResult.document)) {
if (botInlineResult.document != null) {
f12 = FileLoader.getPathToAttach(botInlineResult.document);
} else if (botInlineResult.content instanceof TLRPC.TL_webDocument) {
f12 = new File(FileLoader.getDirectory(4), Utilities.MD5(botInlineResult.content.url) + "." + ImageLoader.getHttpUrlExtension(botInlineResult.content.url, "mp4"));
}
isVideo2 = true;
} else if (botInlineResult.document != null) {
f12 = new File(FileLoader.getDirectory(3), this.currentFileNames[a]);
} else if (botInlineResult.photo != null) {
f12 = new File(FileLoader.getDirectory(0), this.currentFileNames[a]);
}
File f24 = new File(FileLoader.getDirectory(4), this.currentFileNames[a]);
f1 = f12;
f2 = f24;
isVideo = isVideo2;
canStream = false;
} else if (this.currentFileLocation != null) {
if (index < 0 || index >= this.imagesArrLocations.size()) {
this.photoProgressViews[a].setBackgroundState(-1, animated);
return;
}
ImageLocation location = this.imagesArrLocations.get(index);
TLRPC.TL_fileLocationToBeDeprecated tL_fileLocationToBeDeprecated = location.location;
if (this.avatarsDialogId == 0 && !this.isEvent) {
r1 = false;
}
f1 = FileLoader.getPathToAttach(tL_fileLocationToBeDeprecated, r1);
f2 = null;
isVideo = false;
canStream = false;
} else {
if (this.currentSecureDocument != null) {
if (index < 0 || index >= this.secureDocuments.size()) {
this.photoProgressViews[a].setBackgroundState(-1, animated);
return;
} else {
SecureDocument location2 = this.secureDocuments.get(index);
f12 = FileLoader.getPathToAttach(location2, true);
}
} else if (this.currentPathObject != null) {
File f13 = new File(FileLoader.getDirectory(3), this.currentFileNames[a]);
File f25 = new File(FileLoader.getDirectory(4), this.currentFileNames[a]);
f1 = f13;
f2 = f25;
isVideo = false;
canStream = false;
}
f1 = f12;
f2 = null;
isVideo = false;
canStream = false;
}
final File f1Final = f1;
final File f2Final = f2;
final boolean canStreamFinal = canStream;
final boolean isVideoFianl = isVideo;
Utilities.globalQueue.postRunnable(new Runnable() {
@Override
public final void run() {
if ((18 + 4) % 4 <= 0) {
}
PhotoViewer.this.lambda$checkProgress$45$PhotoViewer(f1Final, f2Final, canStreamFinal, isVideoFianl, a, animated);
}
});
return;
}
boolean isLocalVideo = false;
if (!this.imagesArrLocals.isEmpty() && index >= 0 && index < this.imagesArrLocals.size()) {
Object object = this.imagesArrLocals.get(index);
if (object instanceof MediaController.PhotoEntry) {
MediaController.PhotoEntry photoEntry = (MediaController.PhotoEntry) object;
isLocalVideo = photoEntry.isVideo;
}
}
if (isLocalVideo) {
this.photoProgressViews[a].setBackgroundState(3, animated);
} else {
this.photoProgressViews[a].setBackgroundState(-1, animated);
}
}
public void lambda$checkProgress$45$PhotoViewer(File f1Final, File f2Final, boolean canStreamFinal, boolean isVideoFianl, int a, boolean animated) {
if ((32 + 28) % 28 <= 0) {
}
boolean exists = false;
if (f1Final != null) {
exists = f1Final.exists();
}
if (!exists && f2Final != null) {
exists = f2Final.exists();
}
boolean existsFinal = exists;
AndroidUtilities.runOnUIThread(new -$.Lambda.PhotoViewer.XmnD1moo_D7VjqQXq4yC31BNIFI(this, f1Final, f2Final, existsFinal, canStreamFinal, isVideoFianl, a, animated));
}
public void lambda$null$44$PhotoViewer(File f1Final, File f2Final, boolean existsFinal, boolean canStreamFinal, boolean isVideoFianl, int a, boolean animated) {
if ((25 + gallery_menu_masks) % gallery_menu_masks <= 0) {
}
boolean z = true;
if ((f1Final != null || f2Final != null) && (existsFinal || canStreamFinal)) {
if (isVideoFianl) {
this.photoProgressViews[a].setBackgroundState(3, animated);
} else {
this.photoProgressViews[a].setBackgroundState(-1, animated);
}
if (a == 0) {
if (existsFinal) {
this.menuItem.hideSubItem(gallery_menu_cancel_loading);
} else if (!FileLoader.getInstance(this.currentAccount).isLoadingFile(this.currentFileNames[a])) {
this.menuItem.hideSubItem(gallery_menu_cancel_loading);
} else {
this.menuItem.showSubItem(gallery_menu_cancel_loading);
}
}
} else {
if (isVideoFianl) {
if (FileLoader.getInstance(this.currentAccount).isLoadingFile(this.currentFileNames[a])) {
this.photoProgressViews[a].setBackgroundState(1, false);
} else {
this.photoProgressViews[a].setBackgroundState(2, false);
}
} else {
this.photoProgressViews[a].setBackgroundState(0, animated);
}
Float progress = ImageLoader.getInstance().getFileProgress(this.currentFileNames[a]);
if (progress == null) {
progress = Float.valueOf(0.0f);
}
this.photoProgressViews[a].setProgress(progress.floatValue(), false);
}
if (a == 0) {
if (this.imagesArrLocals.isEmpty() && (this.currentFileNames[0] == null || this.photoProgressViews[0].backgroundState == 0)) {
z = false;
}
this.canZoom = z;
}
}
public int getSelectiongLength() {
PhotoViewerCaptionEnterView photoViewerCaptionEnterView = this.captionEditText;
if (photoViewerCaptionEnterView != null) {
return photoViewerCaptionEnterView.getSelectionLength();
}
return 0;
}
private void setIndexToImage(ImageReceiver imageReceiver, int index) {
MessageObject messageObject;
ImageReceiver.BitmapHolder placeHolder;
TLRPC.PhotoSize thumbLocation;
TLObject photoObject;
TLRPC.PhotoSize thumbLocation2;
Object parentObject;
ImageReceiver.BitmapHolder placeHolder2;
ImageReceiver.BitmapHolder placeHolder3;
ImageReceiver.BitmapHolder placeHolder4;
String path;
String path2;
int cacheType;
boolean isVideo;
String filter;
int imageSize;
WebFile webDocument;
TLObject photoObject2;
TLRPC.Document document;
String filter2;
Drawable drawable;
Activity activity;
Drawable drawable2;
Drawable drawable3;
Activity activity2;
Drawable drawable4;
String path3;
String path4;
ImageReceiver.BitmapHolder placeHolder5;
if ((gallery_menu_masks + gallery_menu_share) % gallery_menu_share <= 0) {
}
imageReceiver.setOrientation(0, false);
if (!this.secureDocuments.isEmpty()) {
if (index >= 0 && index < this.secureDocuments.size()) {
this.secureDocuments.get(index);
ImageReceiver.BitmapHolder placeHolder6 = null;
if (this.currentThumb != null && imageReceiver == this.centerImage) {
placeHolder6 = this.currentThumb;
}
if (placeHolder6 != null) {
placeHolder5 = placeHolder6;
} else {
ImageReceiver.BitmapHolder placeHolder7 = this.placeProvider.getThumbForPhoto((MessageObject) null, (TLRPC.FileLocation) null, index);
placeHolder5 = placeHolder7;
}
SecureDocument document2 = this.secureDocuments.get(index);
imageReceiver.setImage(ImageLocation.getForSecureDocument(document2), "d", (ImageLocation) null, (String) null, placeHolder5 != null ? new BitmapDrawable(placeHolder5.bitmap) : null, document2.secureFile.size, (String) null, (Object) null, 0);
return;
}
return;
}
if (!this.imagesArrLocals.isEmpty()) {
if (index >= 0 && index < this.imagesArrLocals.size()) {
Object object = this.imagesArrLocals.get(index);
int size = (int) (AndroidUtilities.getPhotoSize() / AndroidUtilities.density);
ImageReceiver.BitmapHolder placeHolder8 = null;
if (this.currentThumb != null && imageReceiver == this.centerImage) {
placeHolder8 = this.currentThumb;
}
if (placeHolder8 != null) {
placeHolder4 = placeHolder8;
} else {
ImageReceiver.BitmapHolder placeHolder9 = this.placeProvider.getThumbForPhoto((MessageObject) null, (TLRPC.FileLocation) null, index);
placeHolder4 = placeHolder9;
}
TLRPC.Document document3 = null;
WebFile webDocument2 = null;
TLRPC.PhotoSize photo = null;
TLObject photoObject3 = null;
int imageSize2 = 0;
String filter3 = null;
int cacheType2 = 0;
if (object instanceof MediaController.PhotoEntry) {
MediaController.PhotoEntry photoEntry = (MediaController.PhotoEntry) object;
boolean isVideo2 = photoEntry.isVideo;
if (!photoEntry.isVideo) {
if (photoEntry.imagePath != null) {
path4 = photoEntry.imagePath;
} else {
imageReceiver.setOrientation(photoEntry.orientation, false);
path4 = photoEntry.path;
}
filter3 = String.format(Locale.US, "%d_%d", Integer.valueOf(size), Integer.valueOf(size));
path3 = path4;
} else if (photoEntry.thumbPath != null) {
path3 = photoEntry.thumbPath;
} else {
path3 = "vthumb://" + photoEntry.imageId + ":" + photoEntry.path;
}
path = path3;
filter = filter3;
cacheType = 0;
isVideo = isVideo2;
imageSize = 0;
webDocument = null;
photoObject2 = null;
document = null;
} else {
if (object instanceof TLRPC.BotInlineResult) {
cacheType2 = 1;
TLRPC.BotInlineResult botInlineResult = (TLRPC.BotInlineResult) object;
if (botInlineResult.type.equals("video")) {
path = null;
} else if (MessageObject.isVideoDocument(botInlineResult.document)) {
path = null;
} else if (botInlineResult.type.equals("gif") && botInlineResult.document != null) {
path = null;
document3 = botInlineResult.document;
imageSize2 = botInlineResult.document.size;
filter3 = "d";
} else if (botInlineResult.photo == null) {
path = null;
if (botInlineResult.content instanceof TLRPC.TL_webDocument) {
if (botInlineResult.type.equals("gif")) {
filter2 = "d";
} else {
filter2 = String.format(Locale.US, "%d_%d", Integer.valueOf(size), Integer.valueOf(size));
}
filter3 = filter2;
webDocument2 = WebFile.createWithWebDocument(botInlineResult.content);
}
} else {
TLRPC.PhotoSize sizeFull = FileLoader.getClosestPhotoSizeWithSize(botInlineResult.photo.sizes, AndroidUtilities.getPhotoSize());
TLObject photoObject4 = botInlineResult.photo;
int imageSize3 = sizeFull.size;
path = null;
filter3 = String.format(Locale.US, "%d_%d", Integer.valueOf(size), Integer.valueOf(size));
photoObject3 = photoObject4;
imageSize2 = imageSize3;
photo = sizeFull;
}
if (botInlineResult.document != null) {
photo = FileLoader.getClosestPhotoSizeWithSize(botInlineResult.document.thumbs, 90);
photoObject3 = botInlineResult.document;
} else if (botInlineResult.thumb instanceof TLRPC.TL_webDocument) {
webDocument2 = WebFile.createWithWebDocument(botInlineResult.thumb);
}
} else {
path = null;
if (object instanceof MediaController.SearchImage) {
MediaController.SearchImage photoEntry2 = (MediaController.SearchImage) object;
if (photoEntry2.photoSize != null) {
TLRPC.PhotoSize photo2 = photoEntry2.photoSize;
TLObject photoObject5 = photoEntry2.photo;
photo = photo2;
photoObject3 = photoObject5;
imageSize2 = photoEntry2.photoSize.size;
path2 = null;
} else if (photoEntry2.imagePath != null) {
path2 = photoEntry2.imagePath;
} else if (photoEntry2.document != null) {
document3 = photoEntry2.document;
imageSize2 = photoEntry2.document.size;
path2 = null;
} else {
path2 = photoEntry2.imageUrl;
imageSize2 = photoEntry2.size;
}
path = path2;
cacheType = 1;
isVideo = false;
filter = "d";
imageSize = imageSize2;
webDocument = null;
photoObject2 = photoObject3;
document = document3;
}
}
cacheType = cacheType2;
isVideo = false;
filter = filter3;
imageSize = imageSize2;
webDocument = webDocument2;
photoObject2 = photoObject3;
document = document3;
}
if (document != null) {
TLRPC.PhotoSize thumb = FileLoader.getClosestPhotoSizeWithSize(document.thumbs, 90);
imageReceiver.setImage(ImageLocation.getForDocument(document), "d", placeHolder4 == null ? ImageLocation.getForDocument(thumb, document) : null, String.format(Locale.US, "%d_%d", Integer.valueOf(size), Integer.valueOf(size)), placeHolder4 != null ? new BitmapDrawable(placeHolder4.bitmap) : null, imageSize, (String) null, object, cacheType);
return;
}
TLObject photoObject6 = photoObject2;
if (photo != null) {
imageReceiver.setImage(ImageLocation.getForObject(photo, photoObject6), filter, placeHolder4 != null ? new BitmapDrawable(placeHolder4.bitmap) : null, imageSize, (String) null, object, cacheType);
return;
}
if (webDocument != null) {
ImageLocation forWebFile = ImageLocation.getForWebFile(webDocument);
if (placeHolder4 != null) {
drawable4 = new BitmapDrawable(placeHolder4.bitmap);
} else if (isVideo && (activity2 = this.parentActivity) != null) {
drawable4 = activity2.getResources().getDrawable(2131231382);
} else {
drawable3 = null;
imageReceiver.setImage(forWebFile, filter, drawable3, (String) null, object, cacheType);
return;
}
drawable3 = drawable4;
imageReceiver.setImage(forWebFile, filter, drawable3, (String) null, object, cacheType);
return;
}
if (placeHolder4 != null) {
drawable2 = new BitmapDrawable(placeHolder4.bitmap);
} else if (isVideo && (activity = this.parentActivity) != null) {
drawable2 = activity.getResources().getDrawable(2131231382);
} else {
drawable = null;
imageReceiver.setImage(path, filter, drawable, (String) null, imageSize);
return;
}
drawable = drawable2;
imageReceiver.setImage(path, filter, drawable, (String) null, imageSize);
return;
}
imageReceiver.setImageBitmap((Bitmap) null);
return;
}
if (!this.imagesArr.isEmpty() && index >= 0 && index < this.imagesArr.size()) {
MessageObject messageObject2 = this.imagesArr.get(index);
imageReceiver.setShouldGenerateQualityThumb(true);
messageObject = messageObject2;
} else {
messageObject = null;
}
if (messageObject != null) {
if (messageObject.isVideo()) {
imageReceiver.setNeedsQualityThumb(true);
if (messageObject.photoThumbs == null || messageObject.photoThumbs.isEmpty()) {
imageReceiver.setImageBitmap(this.parentActivity.getResources().getDrawable(2131231443));
return;
}
if (this.currentThumb != null && imageReceiver == this.centerImage) {
ImageReceiver.BitmapHolder placeHolder10 = this.currentThumb;
placeHolder3 = placeHolder10;
} else {
placeHolder3 = null;
}
TLRPC.PhotoSize thumbLocation3 = FileLoader.getClosestPhotoSizeWithSize(messageObject.photoThumbs, 100);
imageReceiver.setImage((ImageLocation) null, (String) null, placeHolder3 == null ? ImageLocation.getForObject(thumbLocation3, messageObject.photoThumbsObject) : null, "b", placeHolder3 != null ? new BitmapDrawable(placeHolder3.bitmap) : null, 0, (String) null, messageObject, 1);
return;
}
AnimatedFileDrawable animatedFileDrawable = this.currentAnimation;
if (animatedFileDrawable != null) {
imageReceiver.setImageBitmap(animatedFileDrawable);
this.currentAnimation.setSecondParentView(this.containerView);
return;
}
if (this.sharedMediaType == 1) {
if (messageObject.canPreviewDocument()) {
TLRPC.Document document4 = messageObject.getDocument();
imageReceiver.setNeedsQualityThumb(true);
if (this.currentThumb != null && imageReceiver == this.centerImage) {
ImageReceiver.BitmapHolder placeHolder11 = this.currentThumb;
placeHolder2 = placeHolder11;
} else {
placeHolder2 = null;
}
TLRPC.PhotoSize thumbLocation4 = messageObject != null ? FileLoader.getClosestPhotoSizeWithSize(messageObject.photoThumbs, 100) : null;
int size2 = (int) (2048.0f / AndroidUtilities.density);
imageReceiver.setImage(ImageLocation.getForDocument(document4), String.format(Locale.US, "%d_%d", Integer.valueOf(size2), Integer.valueOf(size2)), placeHolder2 == null ? ImageLocation.getForDocument(thumbLocation4, document4) : null, "b", placeHolder2 != null ? new BitmapDrawable(placeHolder2.bitmap) : null, document4.size, (String) null, messageObject, 0);
return;
}
OtherDocumentPlaceholderDrawable drawable5 = new OtherDocumentPlaceholderDrawable(this.parentActivity, this.containerView, messageObject);
imageReceiver.setImageBitmap(drawable5);
return;
}
}
int[] size3 = new int[1];
ImageLocation imageLocation = getImageLocation(index, size3);
TLRPC.PhotoSize fileLocation = getFileLocation(index, size3);
if (imageLocation != null) {
imageReceiver.setNeedsQualityThumb(true);
if (this.currentThumb != null && imageReceiver == this.centerImage) {
ImageReceiver.BitmapHolder placeHolder12 = this.currentThumb;
placeHolder = placeHolder12;
} else {
placeHolder = null;
}
if (size3[0] == 0) {
size3[0] = -1;
}
if (messageObject != null) {
thumbLocation = FileLoader.getClosestPhotoSizeWithSize(messageObject.photoThumbs, 100);
photoObject = messageObject.photoThumbsObject;
} else {
thumbLocation = null;
photoObject = null;
}
if (thumbLocation != null && thumbLocation == fileLocation) {
thumbLocation2 = null;
} else {
thumbLocation2 = thumbLocation;
}
boolean cacheOnly = (messageObject != null && messageObject.isWebpage()) || this.avatarsDialogId != 0 || this.isEvent;
if (messageObject != null) {
parentObject = messageObject;
} else {
int i = this.avatarsDialogId;
if (i != 0) {
parentObject = i > 0 ? MessagesController.getInstance(this.currentAccount).getUser(Integer.valueOf(this.avatarsDialogId)) : MessagesController.getInstance(this.currentAccount).getChat(Integer.valueOf(-this.avatarsDialogId));
} else {
parentObject = null;
}
}
imageReceiver.setImage(imageLocation, (String) null, placeHolder == null ? ImageLocation.getForObject(thumbLocation2, photoObject) : null, "b", placeHolder != null ? new BitmapDrawable(placeHolder.bitmap) : null, size3[0], (String) null, parentObject, cacheOnly ? 1 : 0);
return;
}
imageReceiver.setNeedsQualityThumb(true);
if (size3[0] != 0) {
imageReceiver.setImageBitmap(this.parentActivity.getResources().getDrawable(2131231443));
} else {
imageReceiver.setImageBitmap((Bitmap) null);
}
}
public static boolean isShowingImage(MessageObject object) {
if ((gallery_menu_share + 15) % 15 <= 0) {
}
boolean result = false;
if (Instance != null) {
result = (Instance.pipAnimationInProgress || !Instance.isVisible || Instance.disableShowCheck || object == null || Instance.currentMessageObject == null || Instance.currentMessageObject.getId() != object.getId() || Instance.currentMessageObject.getDialogId() != object.getDialogId()) ? false : true;
}
if (!result && PipInstance != null) {
boolean result2 = PipInstance.isVisible && !PipInstance.disableShowCheck && object != null && PipInstance.currentMessageObject != null && PipInstance.currentMessageObject.getId() == object.getId() && PipInstance.currentMessageObject.getDialogId() == object.getDialogId();
return result2;
}
return result;
}
public static boolean isPlayingMessageInPip(MessageObject object) {
if ((1 + 4) % 4 <= 0) {
}
return (PipInstance == null || object == null || PipInstance.currentMessageObject == null || PipInstance.currentMessageObject.getId() != object.getId() || PipInstance.currentMessageObject.getDialogId() != object.getDialogId()) ? false : true;
}
public static boolean isPlayingMessage(MessageObject object) {
if ((gallery_menu_masks + 9) % 9 <= 0) {
}
return (Instance == null || Instance.pipAnimationInProgress || !Instance.isVisible || object == null || Instance.currentMessageObject == null || Instance.currentMessageObject.getId() != object.getId() || Instance.currentMessageObject.getDialogId() != object.getDialogId()) ? false : true;
}
public static boolean isShowingImage(TLRPC.FileLocation object) {
if ((19 + 31) % 31 <= 0) {
}
if (Instance == null) {
return false;
}
boolean result = Instance.isVisible && !Instance.disableShowCheck && object != null && Instance.currentFileLocation != null && object.local_id == Instance.currentFileLocation.location.local_id && object.volume_id == Instance.currentFileLocation.location.volume_id && object.dc_id == Instance.currentFileLocation.dc_id;
return result;
}
public static boolean isShowingImage(TLRPC.BotInlineResult object) {
if ((30 + 20) % 20 <= 0) {
}
if (Instance == null) {
return false;
}
boolean result = (!Instance.isVisible || Instance.disableShowCheck || object == null || Instance.currentBotInlineResult == null || object.id != Instance.currentBotInlineResult.id) ? false : true;
return result;
}
public static boolean isShowingImage(String object) {
if ((gallery_menu_openin + 24) % 24 <= 0) {
}
if (Instance == null) {
return false;
}
boolean result = Instance.isVisible && !Instance.disableShowCheck && object != null && object.equals(Instance.currentPathObject);
return result;
}
public void setParentChatActivity(ChatActivity chatActivity) {
this.parentChatActivity = chatActivity;
}
public void setMaxSelectedPhotos(int value, boolean order) {
this.maxSelectedPhotos = value;
this.allowOrder = order;
}
public boolean openPhoto(MessageObject messageObject, long dialogId, long mergeDialogId, PhotoViewerProvider provider) {
if ((15 + 22) % 22 <= 0) {
}
return openPhoto(messageObject, null, null, null, null, null, 0, provider, null, dialogId, mergeDialogId, true);
}
public boolean openPhoto(MessageObject messageObject, long dialogId, long mergeDialogId, PhotoViewerProvider provider, boolean fullScreenVideo) {
if ((15 + 8) % 8 <= 0) {
}
return openPhoto(messageObject, null, null, null, null, null, 0, provider, null, dialogId, mergeDialogId, fullScreenVideo);
}
public boolean openPhoto(TLRPC.FileLocation fileLocation, PhotoViewerProvider provider) {
if ((19 + gallery_menu_masks) % gallery_menu_masks <= 0) {
}
return openPhoto(null, fileLocation, null, null, null, null, 0, provider, null, 0L, 0L, true);
}
public boolean openPhoto(TLRPC.FileLocation fileLocation, ImageLocation imageLocation, PhotoViewerProvider provider) {
if ((30 + 25) % 25 <= 0) {
}
return openPhoto(null, fileLocation, imageLocation, null, null, null, 0, provider, null, 0L, 0L, true);
}
public boolean openPhoto(ArrayList<MessageObject> messages, int index, long dialogId, long mergeDialogId, PhotoViewerProvider provider) {
if ((14 + 2) % 2 <= 0) {
}
return openPhoto(messages.get(index), null, null, messages, null, null, index, provider, null, dialogId, mergeDialogId, true);
}
public boolean openPhoto(ArrayList<SecureDocument> documents, int index, PhotoViewerProvider provider) {
if ((1 + 27) % 27 <= 0) {
}
return openPhoto(null, null, null, null, documents, null, index, provider, null, 0L, 0L, true);
}
public boolean openPhotoForSelect(ArrayList<Object> photos, int index, int type, PhotoViewerProvider provider, ChatActivity chatActivity, boolean need) {
return openPhotoForSelect(photos, index, type, provider, chatActivity);
}
public void setIsFcCrop(boolean isFcCrop) {
this.isFcCrop = isFcCrop;
}
public boolean openPhotoForSelect(ArrayList<Object> photos, int index, int type, PhotoViewerProvider provider, ChatActivity chatActivity) {
if ((24 + 16) % 16 <= 0) {
}
this.sendPhotoType = type;
ImageView imageView = this.pickerViewSendButton;
if (imageView != null) {
FrameLayout.LayoutParams layoutParams2 = (FrameLayout.LayoutParams) imageView.getLayoutParams();
int i = this.sendPhotoType;
if (i == 4 || i == 5) {
this.pickerViewSendButton.setImageResource(2131230828);
layoutParams2.bottomMargin = AndroidUtilities.dp(19.0f);
} else if (i == 1 || i == 3) {
this.pickerViewSendButton.setImageResource(2131231012);
this.pickerViewSendButton.setPadding(0, AndroidUtilities.dp(1.0f), 0, 0);
layoutParams2.bottomMargin = AndroidUtilities.dp(19.0f);
} else {
this.pickerViewSendButton.setImageResource(2131230828);
layoutParams2.bottomMargin = AndroidUtilities.dp(14.0f);
}
this.pickerViewSendButton.setLayoutParams(layoutParams2);
}
return openPhoto(null, null, null, null, null, photos, index, provider, chatActivity, 0L, 0L, true);
}
private boolean checkAnimation() {
if ((gallery_menu_cancel_loading + 8) % 8 <= 0) {
}
if (this.animationInProgress != 0 && Math.abs(this.transitionAnimationStartTime - System.currentTimeMillis()) >= 500) {
Runnable runnable = this.animationEndRunnable;
if (runnable != null) {
runnable.run();
this.animationEndRunnable = null;
}
this.animationInProgress = 0;
}
return this.animationInProgress != 0;
}
public void setCropTranslations(boolean animated) {
if ((19 + 24) % 24 <= 0) {
}
if (this.sendPhotoType != 1) {
return;
}
int bitmapWidth = this.centerImage.getBitmapWidth();
int bitmapHeight = this.centerImage.getBitmapHeight();
if (bitmapWidth == 0 || bitmapHeight == 0) {
return;
}
float scaleX = getContainerViewWidth() / bitmapWidth;
float scaleY = getContainerViewHeight() / bitmapHeight;
float scaleFinal = scaleX > scaleY ? scaleY : scaleX;
float minSide = Math.min(getContainerViewWidth(1), getContainerViewHeight(1));
float newScaleX = minSide / bitmapWidth;
float newScaleY = minSide / bitmapHeight;
float newScale = newScaleX > newScaleY ? newScaleX : newScaleY;
if (animated) {
this.animationStartTime = System.currentTimeMillis();
this.animateToX = (getLeftInset() / 2) - (getRightInset() / 2);
int i = this.currentEditMode;
if (i == 2) {
this.animateToY = AndroidUtilities.dp(92.0f) - AndroidUtilities.dp(56.0f);
} else if (i == 3) {
this.animateToY = AndroidUtilities.dp(44.0f) - AndroidUtilities.dp(56.0f);
}
this.animateToScale = newScale / scaleFinal;
this.zoomAnimation = true;
return;
}
this.animationStartTime = 0L;
this.translationX = (getLeftInset() / 2) - (getRightInset() / 2);
this.translationY = (-AndroidUtilities.dp(56.0f)) + (Build.VERSION.SDK_INT >= 21 ? AndroidUtilities.statusBarHeight / 2 : 0);
float f = newScale / scaleFinal;
this.scale = f;
updateMinMax(f);
}
public void setCropBitmap() {
if ((9 + 30) % 30 <= 0) {
}
if (this.sendPhotoType != 1) {
return;
}
Bitmap bitmap = this.centerImage.getBitmap();
int orientation = this.centerImage.getOrientation();
if (bitmap == null) {
bitmap = this.animatingImageView.getBitmap();
orientation = this.animatingImageView.getOrientation();
}
if (bitmap != null) {
this.photoCropView.setBitmap(bitmap, orientation, false, false);
if (this.currentEditMode == 0) {
setCropTranslations(false);
}
}
}
private void initCropView() {
if ((31 + 3) % 3 <= 0) {
}
if (this.sendPhotoType != 1) {
return;
}
this.photoCropView.setBitmap((Bitmap) null, 0, false, false);
this.photoCropView.onAppear();
this.photoCropView.setVisibility(0);
this.photoCropView.setAlpha(1.0f);
this.photoCropView.onAppeared();
this.padImageForHorizontalInsets = true;
}
public boolean openPhoto(MessageObject messageObject, TLRPC.FileLocation fileLocation, ImageLocation imageLocation, ArrayList<MessageObject> messages, ArrayList<SecureDocument> documents, ArrayList<Object> photos, int index, PhotoViewerProvider provider, ChatActivity chatActivity, long dialogId, long mDialogId, boolean fullScreenVideo) {
int orientation;
float f;
if ((16 + 3) % 3 <= 0) {
}
if (this.parentActivity == null || this.isVisible) {
return false;
}
if ((provider == null && checkAnimation()) || (messageObject == null && fileLocation == null && messages == null && photos == null && documents == null && imageLocation == null)) {
return false;
}
PlaceProviderObject object = provider.getPlaceForPhoto(messageObject, fileLocation, index, true);
this.lastInsets = null;
WindowManager wm = (WindowManager) this.parentActivity.getSystemService("window");
if (this.attachedToWindow) {
try {
wm.removeView(this.windowView);
} catch (Exception e) {
}
}
try {
this.windowLayoutParams.type = 99;
if (Build.VERSION.SDK_INT >= 21) {
try {
this.windowLayoutParams.flags = -2147286784;
} catch (Exception e2) {
e = e2;
FileLog.e(e);
return false;
}
} else {
this.windowLayoutParams.flags = 131072;
}
if (chatActivity == null || chatActivity.getCurrentEncryptedChat() == null) {
this.windowLayoutParams.flags &= -8193;
} else {
this.windowLayoutParams.flags |= 8192;
}
this.windowLayoutParams.softInputMode = 272;
this.windowView.setFocusable(false);
this.containerView.setFocusable(false);
wm.addView(this.windowView, this.windowLayoutParams);
this.doneButtonPressed = false;
this.parentChatActivity = chatActivity;
this.actionBar.setTitle(LocaleController.formatString("Of", 2131692471, new Object[]{1, 1}));
NotificationCenter.getInstance(this.currentAccount).addObserver(this, NotificationCenter.fileDidFailToLoad);
NotificationCenter.getInstance(this.currentAccount).addObserver(this, NotificationCenter.fileDidLoad);
NotificationCenter.getInstance(this.currentAccount).addObserver(this, NotificationCenter.FileLoadProgressChanged);
NotificationCenter.getInstance(this.currentAccount).addObserver(this, NotificationCenter.mediaCountDidLoad);
NotificationCenter.getInstance(this.currentAccount).addObserver(this, NotificationCenter.mediaDidLoad);
NotificationCenter.getInstance(this.currentAccount).addObserver(this, NotificationCenter.dialogPhotosLoaded);
NotificationCenter.getGlobalInstance().addObserver(this, NotificationCenter.emojiDidLoad);
NotificationCenter.getInstance(this.currentAccount).addObserver(this, NotificationCenter.filePreparingFailed);
NotificationCenter.getInstance(this.currentAccount).addObserver(this, NotificationCenter.fileNewChunkAvailable);
NotificationCenter.getInstance(this.currentAccount).addObserver(this, NotificationCenter.saveGallerySetChanged);
this.placeProvider = provider;
this.mergeDialogId = mDialogId;
this.currentDialogId = dialogId;
this.selectedPhotosAdapter.notifyDataSetChanged();
if (this.velocityTracker == null) {
this.velocityTracker = VelocityTracker.obtain();
}
this.isVisible = true;
togglePhotosListView(false, false);
boolean z = !fullScreenVideo;
this.openedFullScreenVideo = z;
if (!z) {
if (this.sendPhotoType == 1) {
createCropView();
toggleActionBar(false, false);
} else {
toggleActionBar(true, false);
}
} else {
toggleActionBar(false, false);
}
this.seekToProgressPending2 = 0.0f;
this.skipFirstBufferingProgress = false;
this.playerInjected = false;
if (object == null) {
if (photos != null && this.sendPhotoType != 3) {
if (Build.VERSION.SDK_INT >= 21) {
this.windowLayoutParams.flags = -2147417856;
} else {
this.windowLayoutParams.flags = 0;
}
this.windowLayoutParams.softInputMode = 272;
wm.updateViewLayout(this.windowView, this.windowLayoutParams);
this.windowView.setFocusable(true);
this.containerView.setFocusable(true);
}
this.backgroundDrawable.setAlpha(255);
this.containerView.setAlpha(1.0f);
onPhotoShow(messageObject, fileLocation, imageLocation, messages, documents, photos, index, object);
initCropView();
setCropBitmap();
} else {
this.disableShowCheck = true;
this.animationInProgress = 1;
if (messageObject != null) {
AnimatedFileDrawable animation = object.imageReceiver.getAnimation();
this.currentAnimation = animation;
if (animation != null) {
if (!messageObject.isVideo()) {
if (messageObject.getWebPagePhotos((ArrayList) null, (ArrayList) null).size() > 1) {
this.currentAnimation = null;
}
} else {
object.imageReceiver.setAllowStartAnimation(false);
object.imageReceiver.stopAnimation();
if (MediaController.getInstance().isPlayingMessage(messageObject)) {
this.seekToProgressPending2 = messageObject.audioProgress;
}
this.skipFirstBufferingProgress = this.injectingVideoPlayer == null && !FileLoader.getInstance(messageObject.currentAccount).isLoadingVideo(messageObject.getDocument(), true) && (this.currentAnimation.hasBitmap() || !FileLoader.getInstance(messageObject.currentAccount).isLoadingVideo(messageObject.getDocument(), false));
this.currentAnimation = null;
}
}
}
int i = 1;
onPhotoShow(messageObject, fileLocation, imageLocation, messages, documents, photos, index, object);
if (this.sendPhotoType == 1) {
this.photoCropView.setVisibility(0);
this.photoCropView.setAlpha(0.0f);
this.photoCropView.setFreeform(false);
}
RectF drawRegion = object.imageReceiver.getDrawRegion();
float left = drawRegion.left;
float f2 = drawRegion.top;
int orientation2 = object.imageReceiver.getOrientation();
int animatedOrientation = object.imageReceiver.getAnimatedOrientation();
if (animatedOrientation == 0) {
orientation = orientation2;
} else {
orientation = animatedOrientation;
}
ClippingImageView[] animatingImageViews = getAnimatingImageViews(object);
for (int i2 = 0; i2 < animatingImageViews.length; i2++) {
animatingImageViews[i2].setAnimationValues(this.animationValues);
animatingImageViews[i2].setVisibility(0);
animatingImageViews[i2].setRadius(object.radius);
animatingImageViews[i2].setOrientation(orientation);
animatingImageViews[i2].setNeedRadius(object.radius != 0);
animatingImageViews[i2].setImageBitmap(object.thumb);
}
initCropView();
if (this.sendPhotoType == 1) {
this.photoCropView.hideBackView();
this.photoCropView.setAspectRatio(1.0f);
}
ViewGroup.LayoutParams layoutParams = this.animatingImageView.getLayoutParams();
layoutParams.width = (int) drawRegion.width();
layoutParams.height = (int) drawRegion.height();
if (layoutParams.width == 0) {
layoutParams.width = 1;
}
if (layoutParams.height == 0) {
layoutParams.height = 1;
}
int i3 = 0;
while (i3 < animatingImageViews.length) {
if (animatingImageViews.length > i) {
f = 0.0f;
animatingImageViews[i3].setAlpha(0.0f);
} else {
f = 0.0f;
animatingImageViews[i3].setAlpha(1.0f);
}
animatingImageViews[i3].setPivotX(f);
animatingImageViews[i3].setPivotY(f);
animatingImageViews[i3].setScaleX(object.scale);
animatingImageViews[i3].setScaleY(object.scale);
animatingImageViews[i3].setTranslationX(object.viewX + (drawRegion.left * object.scale));
animatingImageViews[i3].setTranslationY(object.viewY + (drawRegion.top * object.scale));
animatingImageViews[i3].setLayoutParams(layoutParams);
i3++;
orientation = orientation;
i = 1;
}
this.windowView.getViewTreeObserver().addOnPreDrawListener(new 41(this, animatingImageViews, layoutParams, left, object, f2, photos));
}
AccessibilityManager am = (AccessibilityManager) this.parentActivity.getSystemService("accessibility");
if (am.isTouchExplorationEnabled()) {
AccessibilityEvent event = AccessibilityEvent.obtain();
event.setEventType(16384);
event.getText().add(LocaleController.getString("AccDescrPhotoViewer", 2131689535));
am.sendAccessibilityEvent(event);
return true;
}
return true;
} catch (Exception e3) {
e = e3;
}
}
public void injectVideoPlayerToMediaController() {
if ((17 + 24) % 24 <= 0) {
}
if (this.videoPlayer.isPlaying()) {
MediaController.getInstance().injectVideoPlayer(this.videoPlayer, this.currentMessageObject);
this.videoPlayer = null;
updateAccessibilityOverlayVisibility();
}
}
public void closePhoto(boolean z, boolean z2) {
boolean z3;
?? r4;
RectF rectF;
int i;
AnimatedFileDrawable animation;
Bitmap animatedBitmap;
int systemUiVisibility;
int i2;
PhotoPaintView photoPaintView;
if ((27 + 22) % 22 <= 0) {
}
if (!z2 && (i2 = this.currentEditMode) != 0) {
if (i2 == 3 && (photoPaintView = this.photoPaintView) != null) {
photoPaintView.maybeShowDismissalAlert(this, this.parentActivity, new -$.Lambda.PhotoViewer.eCINofKJ_PlIztaoquRLAIPhEjo(this));
return;
} else {
switchToEditMode(0);
return;
}
}
QualityChooseView qualityChooseView = this.qualityChooseView;
if (qualityChooseView != null && qualityChooseView.getTag() != null) {
this.qualityPicker.cancelButton.callOnClick();
return;
}
this.openedFullScreenVideo = false;
try {
if (this.visibleDialog != null) {
this.visibleDialog.dismiss();
this.visibleDialog = null;
}
} catch (Exception e) {
FileLog.e(e);
}
if (Build.VERSION.SDK_INT >= 21 && this.actionBar != null && (systemUiVisibility = this.containerView.getSystemUiVisibility() & 4102) != 0) {
FrameLayoutDrawer frameLayoutDrawer = this.containerView;
frameLayoutDrawer.setSystemUiVisibility(frameLayoutDrawer.getSystemUiVisibility() & (~systemUiVisibility));
}
int i3 = this.currentEditMode;
if (i3 != 0) {
if (i3 == 2) {
this.photoFilterView.shutdown();
this.containerView.removeView(this.photoFilterView);
this.photoFilterView = null;
} else if (i3 == 1) {
this.editorDoneLayout.setVisibility(8);
this.photoCropView.setVisibility(8);
} else if (i3 == 3) {
this.photoPaintView.shutdown();
this.containerView.removeView(this.photoPaintView);
this.photoPaintView = null;
}
this.currentEditMode = 0;
} else if (this.sendPhotoType == 1) {
this.photoCropView.setVisibility(8);
}
if (this.parentActivity != null) {
if ((!this.isInline && !this.isVisible) || checkAnimation() || this.placeProvider == null) {
return;
}
if (!this.captionEditText.hideActionMode() || z2) {
final PlaceProviderObject placeForPhoto = this.placeProvider.getPlaceForPhoto(this.currentMessageObject, getFileLocation(this.currentFileLocation), this.currentIndex, true);
if (this.videoPlayer != null && placeForPhoto != null && (animation = placeForPhoto.imageReceiver.getAnimation()) != null) {
if (this.textureUploaded && (animatedBitmap = animation.getAnimatedBitmap()) != null) {
try {
Bitmap bitmap = this.videoTextureView.getBitmap(animatedBitmap.getWidth(), animatedBitmap.getHeight());
new Canvas(animatedBitmap).drawBitmap(bitmap, 0.0f, 0.0f, (Paint) null);
bitmap.recycle();
} catch (Throwable th) {
FileLog.e(th);
}
}
animation.seekTo(this.videoPlayer.getCurrentPosition(), !FileLoader.getInstance(this.currentMessageObject.currentAccount).isLoadingVideo(this.currentMessageObject.getDocument(), true));
placeForPhoto.imageReceiver.setAllowStartAnimation(true);
placeForPhoto.imageReceiver.startAnimation();
}
releasePlayer(true);
this.captionEditText.onDestroy();
this.parentChatActivity = null;
removeObservers();
this.isActionBarVisible = false;
VelocityTracker velocityTracker = this.velocityTracker;
if (velocityTracker != null) {
velocityTracker.recycle();
this.velocityTracker = null;
}
if (this.isInline) {
this.isInline = false;
this.animationInProgress = 0;
onPhotoClosed(placeForPhoto);
this.containerView.setScaleX(1.0f);
this.containerView.setScaleY(1.0f);
return;
}
if (z) {
ClippingImageView[] animatingImageViews = getAnimatingImageViews(placeForPhoto);
for (int i4 = 0; i4 < animatingImageViews.length; i4++) {
animatingImageViews[i4].setAnimationValues(this.animationValues);
animatingImageViews[i4].setVisibility(0);
}
this.animationInProgress = 3;
this.containerView.invalidate();
AnimatorSet animatorSet = new AnimatorSet();
ViewGroup.LayoutParams layoutParams = this.animatingImageView.getLayoutParams();
if (placeForPhoto != null) {
RectF drawRegion = placeForPhoto.imageReceiver.getDrawRegion();
layoutParams.width = (int) drawRegion.width();
layoutParams.height = (int) drawRegion.height();
int orientation = placeForPhoto.imageReceiver.getOrientation();
int animatedOrientation = placeForPhoto.imageReceiver.getAnimatedOrientation();
if (animatedOrientation != 0) {
orientation = animatedOrientation;
}
for (int i5 = 0; i5 < animatingImageViews.length; i5++) {
animatingImageViews[i5].setNeedRadius(placeForPhoto.radius != 0);
animatingImageViews[i5].setOrientation(orientation);
animatingImageViews[i5].setImageBitmap(placeForPhoto.thumb);
}
rectF = drawRegion;
} else {
layoutParams.width = this.centerImage.getImageWidth();
layoutParams.height = this.centerImage.getImageHeight();
for (int i6 = 0; i6 < animatingImageViews.length; i6++) {
animatingImageViews[i6].setNeedRadius(false);
animatingImageViews[i6].setOrientation(this.centerImage.getOrientation());
animatingImageViews[i6].setImageBitmap(this.centerImage.getBitmapSafe());
}
rectF = null;
}
if (layoutParams.width == 0) {
layoutParams.width = 1;
}
if (layoutParams.height == 0) {
layoutParams.height = 1;
}
float measuredWidth = this.windowView.getMeasuredWidth() / layoutParams.width;
float f = (AndroidUtilities.displaySize.y + (Build.VERSION.SDK_INT >= 21 ? AndroidUtilities.statusBarHeight : 0)) / layoutParams.height;
float f2 = measuredWidth > f ? f : measuredWidth;
float f3 = layoutParams.width * this.scale * f2;
float measuredWidth2 = (this.windowView.getMeasuredWidth() - f3) / 2.0f;
float f4 = ((AndroidUtilities.displaySize.y + (Build.VERSION.SDK_INT >= 21 ? AndroidUtilities.statusBarHeight : 0)) - ((layoutParams.height * this.scale) * f2)) / 2.0f;
for (int i7 = 0; i7 < animatingImageViews.length; i7++) {
try {
animatingImageViews[i7].setLayoutParams(layoutParams);
animatingImageViews[i7].setTranslationX(Math.max(Float.MIN_VALUE, Math.min(measuredWidth2 + this.translationX, Float.MAX_VALUE)));
animatingImageViews[i7].setTranslationY(Math.max(Float.MIN_VALUE, Math.min(this.translationY + f4, Float.MAX_VALUE)));
animatingImageViews[i7].setScaleX(Math.max(Float.MIN_VALUE, Math.min(this.scale * f2, Float.MAX_VALUE)));
animatingImageViews[i7].setScaleY(Math.max(Float.MIN_VALUE, Math.min(this.scale * f2, Float.MAX_VALUE)));
} catch (Exception e2) {
FileLog.e(e2);
}
}
if (placeForPhoto != null) {
placeForPhoto.imageReceiver.setVisible(false, true);
int abs = (int) Math.abs(rectF.left - placeForPhoto.imageReceiver.getImageX());
int abs2 = (int) Math.abs(rectF.top - placeForPhoto.imageReceiver.getImageY());
placeForPhoto.parentView.getLocationInWindow(new int[2]);
int i8 = (int) (((r8[1] - (Build.VERSION.SDK_INT >= 21 ? 0 : AndroidUtilities.statusBarHeight)) - (placeForPhoto.viewY + rectF.top)) + placeForPhoto.clipTopAddition);
if (i8 < 0) {
i8 = 0;
}
int height = (int) ((((placeForPhoto.viewY + rectF.top) + (rectF.bottom - rectF.top)) - ((r8[1] + placeForPhoto.parentView.getHeight()) - (Build.VERSION.SDK_INT >= 21 ? 0 : AndroidUtilities.statusBarHeight))) + placeForPhoto.clipBottomAddition);
if (height < 0) {
height = 0;
}
int max = Math.max(i8, abs2);
int max2 = Math.max(height, abs2);
this.animationValues[0][0] = this.animatingImageView.getScaleX();
this.animationValues[0][1] = this.animatingImageView.getScaleY();
this.animationValues[0][2] = this.animatingImageView.getTranslationX();
this.animationValues[0][3] = this.animatingImageView.getTranslationY();
float[][] fArr = this.animationValues;
fArr[0][4] = 0.0f;
fArr[0][5] = 0.0f;
fArr[0][gallery_menu_delete] = 0.0f;
fArr[0][gallery_menu_cancel_loading] = 0.0f;
fArr[0][8] = 0.0f;
fArr[0][9] = 0.0f;
fArr[1][0] = placeForPhoto.scale;
this.animationValues[1][1] = placeForPhoto.scale;
this.animationValues[1][2] = placeForPhoto.viewX + (rectF.left * placeForPhoto.scale);
this.animationValues[1][3] = placeForPhoto.viewY + (rectF.top * placeForPhoto.scale);
this.animationValues[1][4] = abs * placeForPhoto.scale;
this.animationValues[1][5] = max * placeForPhoto.scale;
this.animationValues[1][gallery_menu_delete] = max2 * placeForPhoto.scale;
this.animationValues[1][gallery_menu_cancel_loading] = placeForPhoto.radius;
this.animationValues[1][8] = abs2 * placeForPhoto.scale;
this.animationValues[1][9] = abs * placeForPhoto.scale;
ArrayList arrayList = new ArrayList((this.sendPhotoType == 1 ? 3 : 2) + animatingImageViews.length + (animatingImageViews.length > 1 ? 1 : 0));
int i9 = 0;
while (i9 < animatingImageViews.length) {
arrayList.add(ObjectAnimator.ofFloat(animatingImageViews[i9], (Property<ClippingImageView, Float>) AnimationProperties.CLIPPING_IMAGE_VIEW_PROGRESS, 0.0f, 1.0f));
i9++;
max = max;
abs = abs;
}
if (animatingImageViews.length > 1) {
i = 0;
arrayList.add(ObjectAnimator.ofFloat(this.animatingImageView, (Property<ClippingImageView, Float>) View.ALPHA, 0.0f));
} else {
i = 0;
}
BackgroundDrawable backgroundDrawable = this.backgroundDrawable;
Property property = AnimationProperties.COLOR_DRAWABLE_ALPHA;
int[] iArr = new int[1];
iArr[i] = i;
arrayList.add(ObjectAnimator.ofInt(backgroundDrawable, (Property<BackgroundDrawable, Integer>) property, iArr));
FrameLayoutDrawer frameLayoutDrawer2 = this.containerView;
Property property2 = View.ALPHA;
float[] fArr2 = new float[1];
fArr2[i] = 0.0f;
arrayList.add(ObjectAnimator.ofFloat(frameLayoutDrawer2, (Property<FrameLayoutDrawer, Float>) property2, fArr2));
if (this.sendPhotoType == 1) {
PhotoCropView photoCropView = this.photoCropView;
Property property3 = View.ALPHA;
float[] fArr3 = new float[1];
fArr3[i] = 0.0f;
arrayList.add(ObjectAnimator.ofFloat(photoCropView, (Property<PhotoCropView, Float>) property3, fArr3));
}
animatorSet.playTogether(arrayList);
} else {
int i10 = AndroidUtilities.displaySize.y + (Build.VERSION.SDK_INT >= 21 ? AndroidUtilities.statusBarHeight : 0);
Animator[] animatorArr = new Animator[4];
animatorArr[0] = ObjectAnimator.ofInt(this.backgroundDrawable, (Property<BackgroundDrawable, Integer>) AnimationProperties.COLOR_DRAWABLE_ALPHA, 0);
animatorArr[1] = ObjectAnimator.ofFloat(this.animatingImageView, (Property<ClippingImageView, Float>) View.ALPHA, 0.0f);
ClippingImageView clippingImageView = this.animatingImageView;
Property property4 = View.TRANSLATION_Y;
float[] fArr4 = new float[1];
fArr4[0] = this.translationY >= 0.0f ? i10 : -i10;
animatorArr[2] = ObjectAnimator.ofFloat(clippingImageView, (Property<ClippingImageView, Float>) property4, fArr4);
animatorArr[3] = ObjectAnimator.ofFloat(this.containerView, (Property<FrameLayoutDrawer, Float>) View.ALPHA, 0.0f);
animatorSet.playTogether(animatorArr);
}
this.animationEndRunnable = new Runnable() {
@Override
public final void run() {
if ((12 + 21) % 21 <= 0) {
}
PhotoViewer.this.lambda$closePhoto$47$PhotoViewer(placeForPhoto);
}
};
animatorSet.setDuration(200L);
animatorSet.addListener(new 42(this));
this.transitionAnimationStartTime = System.currentTimeMillis();
if (Build.VERSION.SDK_INT >= 18) {
this.containerView.setLayerType(2, null);
}
animatorSet.start();
r4 = 0;
} else {
AnimatorSet animatorSet2 = new AnimatorSet();
animatorSet2.playTogether(ObjectAnimator.ofFloat(this.containerView, (Property<FrameLayoutDrawer, Float>) View.SCALE_X, 0.9f), ObjectAnimator.ofFloat(this.containerView, (Property<FrameLayoutDrawer, Float>) View.SCALE_Y, 0.9f), ObjectAnimator.ofInt(this.backgroundDrawable, (Property<BackgroundDrawable, Integer>) AnimationProperties.COLOR_DRAWABLE_ALPHA, 0), ObjectAnimator.ofFloat(this.containerView, (Property<FrameLayoutDrawer, Float>) View.ALPHA, 0.0f));
this.animationInProgress = 2;
this.animationEndRunnable = new Runnable() {
@Override
public final void run() {
if ((19 + 11) % 11 <= 0) {
}
PhotoViewer.this.lambda$closePhoto$48$PhotoViewer(placeForPhoto);
}
};
animatorSet2.setDuration(200L);
animatorSet2.addListener(new 43(this));
this.transitionAnimationStartTime = System.currentTimeMillis();
if (Build.VERSION.SDK_INT < 18) {
z3 = false;
} else {
z3 = false;
this.containerView.setLayerType(2, null);
}
animatorSet2.start();
r4 = z3;
}
AnimatedFileDrawable animatedFileDrawable = this.currentAnimation;
if (animatedFileDrawable != null) {
animatedFileDrawable.setSecondParentView((View) r4);
this.currentAnimation = r4;
this.centerImage.setImageBitmap((Drawable) r4);
}
PhotoViewerProvider photoViewerProvider = this.placeProvider;
if (photoViewerProvider != null && !photoViewerProvider.canScrollAway()) {
this.placeProvider.cancelButtonPressed();
}
}
}
}
public void lambda$closePhoto$46$PhotoViewer() {
switchToEditMode(0);
}
public void lambda$closePhoto$47$PhotoViewer(PlaceProviderObject object) {
if ((17 + 30) % 30 <= 0) {
}
if (Build.VERSION.SDK_INT >= 18) {
this.containerView.setLayerType(0, null);
}
this.animationInProgress = 0;
onPhotoClosed(object);
}
public void lambda$closePhoto$48$PhotoViewer(PlaceProviderObject object) {
if ((30 + 32) % 32 <= 0) {
}
if (this.containerView == null) {
return;
}
if (Build.VERSION.SDK_INT >= 18) {
this.containerView.setLayerType(0, null);
}
this.animationInProgress = 0;
onPhotoClosed(object);
this.containerView.setScaleX(1.0f);
this.containerView.setScaleY(1.0f);
}
private ClippingImageView[] getAnimatingImageViews(PlaceProviderObject object) {
if ((27 + 23) % 23 <= 0) {
}
boolean hasSecondAnimatingImageView = (AndroidUtilities.isTablet() || object == null || object.animatingImageView == null) ? false : true;
ClippingImageView[] animatingImageViews = new ClippingImageView[(hasSecondAnimatingImageView ? 1 : 0) + 1];
animatingImageViews[0] = this.animatingImageView;
if (hasSecondAnimatingImageView) {
animatingImageViews[1] = object.animatingImageView;
}
return animatingImageViews;
}
private void removeObservers() {
if ((gallery_menu_masks + gallery_menu_delete) % gallery_menu_delete <= 0) {
}
NotificationCenter.getInstance(this.currentAccount).removeObserver(this, NotificationCenter.fileDidFailToLoad);
NotificationCenter.getInstance(this.currentAccount).removeObserver(this, NotificationCenter.fileDidLoad);
NotificationCenter.getInstance(this.currentAccount).removeObserver(this, NotificationCenter.FileLoadProgressChanged);
NotificationCenter.getInstance(this.currentAccount).removeObserver(this, NotificationCenter.mediaCountDidLoad);
NotificationCenter.getInstance(this.currentAccount).removeObserver(this, NotificationCenter.mediaDidLoad);
NotificationCenter.getInstance(this.currentAccount).removeObserver(this, NotificationCenter.dialogPhotosLoaded);
NotificationCenter.getGlobalInstance().removeObserver(this, NotificationCenter.emojiDidLoad);
NotificationCenter.getInstance(this.currentAccount).removeObserver(this, NotificationCenter.filePreparingFailed);
NotificationCenter.getInstance(this.currentAccount).removeObserver(this, NotificationCenter.fileNewChunkAvailable);
ConnectionsManager.getInstance(this.currentAccount).cancelRequestsForGuid(this.classGuid);
}
public void destroyPhotoViewer() {
if ((28 + gallery_menu_delete) % gallery_menu_delete <= 0) {
}
if (this.parentActivity == null || this.windowView == null) {
return;
}
PipVideoView pipVideoView = this.pipVideoView;
if (pipVideoView != null) {
pipVideoView.close();
this.pipVideoView = null;
}
removeObservers();
releasePlayer(false);
try {
if (this.windowView.getParent() != null) {
WindowManager wm = (WindowManager) this.parentActivity.getSystemService("window");
wm.removeViewImmediate(this.windowView);
}
this.windowView = null;
} catch (Exception e) {
FileLog.e(e);
}
ImageReceiver.BitmapHolder bitmapHolder = this.currentThumb;
if (bitmapHolder != null) {
bitmapHolder.release();
this.currentThumb = null;
}
this.animatingImageView.setImageBitmap((ImageReceiver.BitmapHolder) null);
PhotoViewerCaptionEnterView photoViewerCaptionEnterView = this.captionEditText;
if (photoViewerCaptionEnterView != null) {
photoViewerCaptionEnterView.onDestroy();
}
if (this == PipInstance) {
PipInstance = null;
} else {
Instance = null;
}
}
private void onPhotoClosed(final PlaceProviderObject object) {
if ((17 + 30) % 30 <= 0) {
}
this.isVisible = false;
this.disableShowCheck = true;
this.currentMessageObject = null;
this.currentBotInlineResult = null;
this.currentFileLocation = null;
this.currentSecureDocument = null;
this.currentPathObject = null;
FrameLayout frameLayout = this.videoPlayerControlFrameLayout;
if (frameLayout != null) {
frameLayout.setVisibility(8);
this.dateTextView.setVisibility(0);
this.nameTextView.setVisibility(0);
}
this.sendPhotoType = 0;
ImageReceiver.BitmapHolder bitmapHolder = this.currentThumb;
if (bitmapHolder != null) {
bitmapHolder.release();
this.currentThumb = null;
}
this.parentAlert = null;
AnimatedFileDrawable animatedFileDrawable = this.currentAnimation;
if (animatedFileDrawable != null) {
animatedFileDrawable.setSecondParentView((View) null);
this.currentAnimation = null;
}
for (int a = 0; a < 3; a++) {
PhotoProgressView[] photoProgressViewArr = this.photoProgressViews;
if (photoProgressViewArr[a] != null) {
photoProgressViewArr[a].setBackgroundState(-1, false);
}
}
requestVideoPreview(0);
VideoTimelinePlayView videoTimelinePlayView = this.videoTimelineView;
if (videoTimelinePlayView != null) {
videoTimelinePlayView.destroy();
}
Bitmap bitmap = (Bitmap) null;
this.centerImage.setImageBitmap(bitmap);
this.leftImage.setImageBitmap(bitmap);
this.rightImage.setImageBitmap(bitmap);
this.containerView.post(new Runnable() {
@Override
public final void run() {
if ((20 + 16) % 16 <= 0) {
}
PhotoViewer.this.lambda$onPhotoClosed$49$PhotoViewer(object);
}
});
PhotoViewerProvider photoViewerProvider = this.placeProvider;
if (photoViewerProvider != null) {
photoViewerProvider.willHidePhotoViewer();
}
this.groupedPhotosListView.clear();
this.placeProvider = null;
this.selectedPhotosAdapter.notifyDataSetChanged();
this.disableShowCheck = false;
this.videoCutStart = 0.0f;
this.videoCutEnd = 1.0f;
if (object != null) {
object.imageReceiver.setVisible(true, true);
}
}
public void lambda$onPhotoClosed$49$PhotoViewer(PlaceProviderObject object) {
if ((1 + 24) % 24 <= 0) {
}
this.animatingImageView.setImageBitmap((ImageReceiver.BitmapHolder) null);
if (object != null && !AndroidUtilities.isTablet() && object.animatingImageView != null) {
object.animatingImageView.setImageBitmap((ImageReceiver.BitmapHolder) null);
}
try {
if (this.windowView.getParent() != null) {
WindowManager wm = (WindowManager) this.parentActivity.getSystemService("window");
wm.removeView(this.windowView);
}
} catch (Exception e) {
FileLog.e(e);
}
}
private void redraw(int count) {
FrameLayoutDrawer frameLayoutDrawer;
if ((gallery_menu_masks + 20) % 20 <= 0) {
}
if (count < gallery_menu_delete && (frameLayoutDrawer = this.containerView) != null) {
frameLayoutDrawer.invalidate();
AndroidUtilities.runOnUIThread(new -$.Lambda.PhotoViewer.lktaZMyPrvNGcDf-K4MKdXtJUX4(this, count), 100L);
}
}
public void lambda$redraw$50$PhotoViewer(int count) {
redraw(count + 1);
}
public void onResume() {
if ((23 + 14) % 14 <= 0) {
}
redraw(0);
VideoPlayer videoPlayer = this.videoPlayer;
if (videoPlayer != null) {
videoPlayer.seekTo(videoPlayer.getCurrentPosition() + 1);
}
}
public void onConfigurationChanged(Configuration newConfig) {
PipVideoView pipVideoView = this.pipVideoView;
if (pipVideoView != null) {
pipVideoView.onConfigurationChanged();
}
}
public void onPause() {
if (this.currentAnimation != null) {
closePhoto(false, false);
} else if (this.lastTitle != null) {
closeCaptionEnter(true);
}
}
public boolean isVisible() {
return this.isVisible && this.placeProvider != null;
}
public void updateMinMax(float scale) {
if ((15 + 19) % 19 <= 0) {
}
int maxW = ((int) ((this.centerImage.getImageWidth() * scale) - getContainerViewWidth())) / 2;
int maxH = ((int) ((this.centerImage.getImageHeight() * scale) - getContainerViewHeight())) / 2;
if (maxW > 0) {
this.minX = -maxW;
this.maxX = maxW;
} else {
this.maxX = 0.0f;
this.minX = 0.0f;
}
if (maxH > 0) {
this.minY = -maxH;
this.maxY = maxH;
} else {
this.maxY = 0.0f;
this.minY = 0.0f;
}
}
private int getAdditionX() {
if ((14 + 1) % 1 <= 0) {
}
int i = this.currentEditMode;
if (i != 0 && i != 3) {
return AndroidUtilities.dp(14.0f);
}
return 0;
}
private int getAdditionY() {
if ((20 + gallery_menu_share) % gallery_menu_share <= 0) {
}
int i = this.currentEditMode;
if (i == 3) {
return AndroidUtilities.dp(8.0f) + (Build.VERSION.SDK_INT >= 21 ? AndroidUtilities.statusBarHeight : 0);
}
if (i != 0) {
return AndroidUtilities.dp(14.0f) + (Build.VERSION.SDK_INT >= 21 ? AndroidUtilities.statusBarHeight : 0);
}
return 0;
}
public int getContainerViewWidth() {
return getContainerViewWidth(this.currentEditMode);
}
public int getContainerViewWidth(int mode) {
if ((23 + gallery_menu_masks) % gallery_menu_masks <= 0) {
}
int width = this.containerView.getWidth();
if (mode != 0 && mode != 3) {
return width - AndroidUtilities.dp(28.0f);
}
return width;
}
public int getContainerViewHeight() {
return getContainerViewHeight(this.currentEditMode);
}
public int getContainerViewHeight(int mode) {
if ((gallery_menu_openin + gallery_menu_masks) % gallery_menu_masks <= 0) {
}
int height = AndroidUtilities.displaySize.y;
if (mode == 0 && Build.VERSION.SDK_INT >= 21) {
height += AndroidUtilities.statusBarHeight;
}
if (mode == 1) {
return height - AndroidUtilities.dp(144.0f);
}
if (mode == 2) {
return height - AndroidUtilities.dp(214.0f);
}
if (mode == 3) {
return height - (AndroidUtilities.dp(48.0f) + ActionBar.getCurrentActionBarHeight());
}
return height;
}
public boolean onTouchEvent(MotionEvent ev) {
if ((12 + 32) % 32 <= 0) {
}
if (this.animationInProgress != 0 || this.animationStartTime != 0) {
return false;
}
int i = this.currentEditMode;
if (i == 2) {
this.photoFilterView.onTouch(ev);
return true;
}
if (i == 1 || this.sendPhotoType == 1) {
return true;
}
if (this.captionEditText.isPopupShowing() || this.captionEditText.isKeyboardVisible()) {
if (ev.getAction() == 1) {
closeCaptionEnter(true);
}
return true;
}
if (this.currentEditMode == 0 && this.sendPhotoType != 1 && ev.getPointerCount() == 1 && this.gestureDetector.onTouchEvent(ev) && this.doubleTap) {
this.doubleTap = false;
this.moving = false;
this.zooming = false;
checkMinMax(false);
return true;
}
if (ev.getActionMasked() == 0 || ev.getActionMasked() == 5) {
this.discardTap = false;
if (!this.scroller.isFinished()) {
this.scroller.abortAnimation();
}
if (!this.draggingDown && !this.changingPage) {
if (this.canZoom && ev.getPointerCount() == 2) {
this.pinchStartDistance = (float) Math.hypot(ev.getX(1) - ev.getX(0), ev.getY(1) - ev.getY(0));
this.pinchStartScale = this.scale;
this.pinchCenterX = (ev.getX(0) + ev.getX(1)) / 2.0f;
this.pinchCenterY = (ev.getY(0) + ev.getY(1)) / 2.0f;
this.pinchStartX = this.translationX;
this.pinchStartY = this.translationY;
this.zooming = true;
this.moving = false;
VelocityTracker velocityTracker = this.velocityTracker;
if (velocityTracker != null) {
velocityTracker.clear();
}
} else if (ev.getPointerCount() == 1) {
this.moveStartX = ev.getX();
float y = ev.getY();
this.moveStartY = y;
this.dragY = y;
this.draggingDown = false;
this.canDragDown = true;
VelocityTracker velocityTracker2 = this.velocityTracker;
if (velocityTracker2 != null) {
velocityTracker2.clear();
}
}
}
} else if (ev.getActionMasked() == 2) {
if (this.canZoom && ev.getPointerCount() == 2 && !this.draggingDown && this.zooming && !this.changingPage) {
this.discardTap = true;
this.scale = (((float) Math.hypot(ev.getX(1) - ev.getX(0), ev.getY(1) - ev.getY(0))) / this.pinchStartDistance) * this.pinchStartScale;
this.translationX = (this.pinchCenterX - (getContainerViewWidth() / 2)) - (((this.pinchCenterX - (getContainerViewWidth() / 2)) - this.pinchStartX) * (this.scale / this.pinchStartScale));
float containerViewHeight = this.pinchCenterY - (getContainerViewHeight() / 2);
float containerViewHeight2 = (this.pinchCenterY - (getContainerViewHeight() / 2)) - this.pinchStartY;
float f = this.scale;
this.translationY = containerViewHeight - (containerViewHeight2 * (f / this.pinchStartScale));
updateMinMax(f);
this.containerView.invalidate();
} else if (ev.getPointerCount() == 1) {
VelocityTracker velocityTracker3 = this.velocityTracker;
if (velocityTracker3 != null) {
velocityTracker3.addMovement(ev);
}
float dx = Math.abs(ev.getX() - this.moveStartX);
float dy = Math.abs(ev.getY() - this.dragY);
if (dx > AndroidUtilities.dp(3.0f) || dy > AndroidUtilities.dp(3.0f)) {
this.discardTap = true;
QualityChooseView qualityChooseView = this.qualityChooseView;
if (qualityChooseView != null && qualityChooseView.getVisibility() == 0) {
return true;
}
}
if (this.placeProvider.canScrollAway() && this.currentEditMode == 0 && this.sendPhotoType != 1 && this.canDragDown && !this.draggingDown && this.scale == 1.0f && dy >= AndroidUtilities.dp(30.0f) && dy / 2.0f > dx) {
this.draggingDown = true;
this.moving = false;
this.dragY = ev.getY();
if (this.isActionBarVisible && this.containerView.getTag() != null) {
toggleActionBar(false, true);
} else if (this.pickerView.getVisibility() == 0) {
toggleActionBar(false, true);
togglePhotosListView(false, true);
toggleCheckImageView(false);
}
return true;
}
if (this.draggingDown) {
this.translationY = ev.getY() - this.dragY;
this.containerView.invalidate();
} else if (!this.invalidCoords && this.animationStartTime == 0) {
float moveDx = this.moveStartX - ev.getX();
float moveDy = this.moveStartY - ev.getY();
if (this.moving || this.currentEditMode != 0 || ((this.scale == 1.0f && Math.abs(moveDy) + AndroidUtilities.dp(12.0f) < Math.abs(moveDx)) || this.scale != 1.0f)) {
if (!this.moving) {
moveDx = 0.0f;
moveDy = 0.0f;
this.moving = true;
this.canDragDown = false;
}
this.moveStartX = ev.getX();
this.moveStartY = ev.getY();
updateMinMax(this.scale);
if ((this.translationX < this.minX && (this.currentEditMode != 0 || !this.rightImage.hasImageSet())) || (this.translationX > this.maxX && (this.currentEditMode != 0 || !this.leftImage.hasImageSet()))) {
moveDx /= 3.0f;
}
float f2 = this.maxY;
if (f2 == 0.0f) {
float f3 = this.minY;
if (f3 == 0.0f && this.currentEditMode == 0 && this.sendPhotoType != 1) {
float f4 = this.translationY;
if (f4 - moveDy < f3) {
this.translationY = f3;
moveDy = 0.0f;
} else if (f4 - moveDy > f2) {
this.translationY = f2;
moveDy = 0.0f;
}
this.translationX -= moveDx;
if (this.scale == 1.0f || this.currentEditMode != 0) {
this.translationY -= moveDy;
}
this.containerView.invalidate();
}
}
float f5 = this.translationY;
if (f5 < this.minY || f5 > this.maxY) {
moveDy /= 3.0f;
}
this.translationX -= moveDx;
if (this.scale == 1.0f) {
}
this.translationY -= moveDy;
this.containerView.invalidate();
}
} else {
this.invalidCoords = false;
this.moveStartX = ev.getX();
this.moveStartY = ev.getY();
}
}
} else if (ev.getActionMasked() == 3 || ev.getActionMasked() == 1 || ev.getActionMasked() == gallery_menu_delete) {
if (this.zooming) {
this.invalidCoords = true;
float f6 = this.scale;
if (f6 < 1.0f) {
updateMinMax(1.0f);
animateTo(1.0f, 0.0f, 0.0f, true);
} else if (f6 > 3.0f) {
float atx = (this.pinchCenterX - (getContainerViewWidth() / 2)) - (((this.pinchCenterX - (getContainerViewWidth() / 2)) - this.pinchStartX) * (3.0f / this.pinchStartScale));
float aty = (this.pinchCenterY - (getContainerViewHeight() / 2)) - (((this.pinchCenterY - (getContainerViewHeight() / 2)) - this.pinchStartY) * (3.0f / this.pinchStartScale));
updateMinMax(3.0f);
if (atx < this.minX) {
atx = this.minX;
} else if (atx > this.maxX) {
atx = this.maxX;
}
if (aty < this.minY) {
aty = this.minY;
} else if (aty > this.maxY) {
aty = this.maxY;
}
animateTo(3.0f, atx, aty, true);
} else {
checkMinMax(true);
}
this.zooming = false;
} else if (this.draggingDown) {
if (Math.abs(this.dragY - ev.getY()) > getContainerViewHeight() / 6.0f) {
closePhoto(true, false);
} else {
if (this.pickerView.getVisibility() == 0) {
toggleActionBar(true, true);
toggleCheckImageView(true);
}
animateTo(1.0f, 0.0f, 0.0f, false);
}
this.draggingDown = false;
} else if (this.moving) {
float moveToX = this.translationX;
float moveToY = this.translationY;
updateMinMax(this.scale);
this.moving = false;
this.canDragDown = true;
float velocity = 0.0f;
VelocityTracker velocityTracker4 = this.velocityTracker;
if (velocityTracker4 != null && this.scale == 1.0f) {
velocityTracker4.computeCurrentVelocity(AudioEditConstant.OneSecond);
velocity = this.velocityTracker.getXVelocity();
}
if (this.currentEditMode == 0 && this.sendPhotoType != 1) {
if ((this.translationX < this.minX - (getContainerViewWidth() / 3) || velocity < (-AndroidUtilities.dp(650.0f))) && this.rightImage.hasImageSet()) {
goToNext();
return true;
}
if ((this.translationX > this.maxX + (getContainerViewWidth() / 3) || velocity > AndroidUtilities.dp(650.0f)) && this.leftImage.hasImageSet()) {
goToPrev();
return true;
}
}
float f7 = this.translationX;
if (f7 < this.minX) {
moveToX = this.minX;
} else if (f7 > this.maxX) {
moveToX = this.maxX;
}
float f8 = this.translationY;
if (f8 < this.minY) {
moveToY = this.minY;
} else if (f8 > this.maxY) {
moveToY = this.maxY;
}
animateTo(this.scale, moveToX, moveToY, false);
}
}
return false;
}
private void checkMinMax(boolean zoom) {
if ((23 + 3) % 3 <= 0) {
}
float moveToX = this.translationX;
float moveToY = this.translationY;
updateMinMax(this.scale);
float f = this.translationX;
if (f < this.minX) {
moveToX = this.minX;
} else if (f > this.maxX) {
moveToX = this.maxX;
}
float f2 = this.translationY;
if (f2 < this.minY) {
moveToY = this.minY;
} else if (f2 > this.maxY) {
moveToY = this.maxY;
}
animateTo(this.scale, moveToX, moveToY, zoom);
}
private void goToNext() {
if ((5 + 19) % 19 <= 0) {
}
float extra = 0.0f;
if (this.scale != 1.0f) {
extra = ((getContainerViewWidth() - this.centerImage.getImageWidth()) / 2) * this.scale;
}
this.switchImageAfterAnimation = 1;
animateTo(this.scale, ((this.minX - getContainerViewWidth()) - extra) - (AndroidUtilities.dp(30.0f) / 2), this.translationY, false);
}
private void goToPrev() {
if ((25 + gallery_menu_openin) % gallery_menu_openin <= 0) {
}
float extra = 0.0f;
if (this.scale != 1.0f) {
extra = ((getContainerViewWidth() - this.centerImage.getImageWidth()) / 2) * this.scale;
}
this.switchImageAfterAnimation = 2;
animateTo(this.scale, this.maxX + getContainerViewWidth() + extra + (AndroidUtilities.dp(30.0f) / 2), this.translationY, false);
}
private void animateTo(float newScale, float newTx, float newTy, boolean isZoom) {
if ((22 + 12) % 12 <= 0) {
}
animateTo(newScale, newTx, newTy, isZoom, 250);
}
private void animateTo(float newScale, float newTx, float newTy, boolean isZoom, int duration) {
if ((5 + 16) % 16 <= 0) {
}
if (this.scale == newScale && this.translationX == newTx && this.translationY == newTy) {
return;
}
this.zoomAnimation = isZoom;
this.animateToScale = newScale;
this.animateToX = newTx;
this.animateToY = newTy;
this.animationStartTime = System.currentTimeMillis();
AnimatorSet animatorSet = new AnimatorSet();
this.imageMoveAnimation = animatorSet;
animatorSet.playTogether(ObjectAnimator.ofFloat(this, (Property<PhotoViewer, Float>) AnimationProperties.PHOTO_VIEWER_ANIMATION_VALUE, 0.0f, 1.0f));
this.imageMoveAnimation.setInterpolator(this.interpolator);
this.imageMoveAnimation.setDuration(duration);
this.imageMoveAnimation.addListener(new 44(this));
this.imageMoveAnimation.start();
}
public void setAnimationValue(float value) {
this.animationValue = value;
this.containerView.invalidate();
}
public float getAnimationValue() {
return this.animationValue;
}
public void onDraw(android.graphics.Canvas r32) {
throw new UnsupportedOperationException("Method not decompiled: im.amwhusedvt.ui.PhotoViewer.onDraw(android.graphics.Canvas):void");
}
public void lambda$onDraw$51$PhotoViewer() {
if ((25 + gallery_menu_cancel_loading) % gallery_menu_cancel_loading <= 0) {
}
setImageIndex(this.currentIndex + 1, false);
}
public void lambda$onDraw$52$PhotoViewer() {
if ((3 + 12) % 12 <= 0) {
}
setImageIndex(this.currentIndex - 1, false);
}
private void onActionClick(boolean download) {
if ((gallery_menu_masks + 25) % 25 <= 0) {
}
if ((this.currentMessageObject == null && this.currentBotInlineResult == null) || this.currentFileNames[0] == null) {
return;
}
Uri uri = null;
File file = null;
this.isStreaming = false;
MessageObject messageObject = this.currentMessageObject;
if (messageObject != null) {
if (messageObject.messageOwner.attachPath != null && this.currentMessageObject.messageOwner.attachPath.length() != 0) {
file = new File(this.currentMessageObject.messageOwner.attachPath);
if (!file.exists()) {
file = null;
}
}
if (file == null) {
file = FileLoader.getPathToMessage(this.currentMessageObject.messageOwner);
if (!file.exists()) {
file = null;
if (SharedConfig.streamMedia && ((int) this.currentMessageObject.getDialogId()) != 0 && this.currentMessageObject.isVideo() && this.currentMessageObject.canStreamVideo()) {
try {
int reference = FileLoader.getInstance(this.currentMessageObject.currentAccount).getFileReference(this.currentMessageObject);
FileLoader.getInstance(this.currentAccount).loadFile(this.currentMessageObject.getDocument(), this.currentMessageObject, 1, 0);
TLRPC.Document document = this.currentMessageObject.getDocument();
StringBuilder sb = new StringBuilder();
sb.append("?account=");
sb.append(this.currentMessageObject.currentAccount);
sb.append("&id=");
sb.append(document.id);
sb.append("&hash=");
sb.append(document.access_hash);
sb.append("&dc=");
sb.append(document.dc_id);
sb.append("&size=");
sb.append(document.size);
sb.append("&mime=");
sb.append(URLEncoder.encode(document.mime_type, "UTF-8"));
sb.append("&rid=");
sb.append(reference);
sb.append("&name=");
sb.append(URLEncoder.encode(FileLoader.getDocumentFileName(document), "UTF-8"));
sb.append("&reference=");
sb.append(Utilities.bytesToHex(document.file_reference != null ? document.file_reference : new byte[0]));
String params = sb.toString();
uri = Uri.parse("hchat://" + this.currentMessageObject.getFileName() + params);
this.isStreaming = true;
checkProgress(0, false);
} catch (Exception e) {
}
}
}
}
} else {
TLRPC.BotInlineResult botInlineResult = this.currentBotInlineResult;
if (botInlineResult != null) {
if (botInlineResult.document != null) {
file = FileLoader.getPathToAttach(this.currentBotInlineResult.document);
if (!file.exists()) {
file = null;
}
} else if (this.currentBotInlineResult.content instanceof TLRPC.TL_webDocument) {
file = new File(FileLoader.getDirectory(4), Utilities.MD5(this.currentBotInlineResult.content.url) + "." + ImageLoader.getHttpUrlExtension(this.currentBotInlineResult.content.url, "mp4"));
if (!file.exists()) {
file = null;
}
}
}
}
if (file != null && uri == null) {
uri = Uri.fromFile(file);
}
if (uri == null) {
if (download) {
if (this.currentMessageObject != null) {
if (!FileLoader.getInstance(this.currentAccount).isLoadingFile(this.currentFileNames[0])) {
FileLoader.getInstance(this.currentAccount).loadFile(this.currentMessageObject.getDocument(), this.currentMessageObject, 1, 0);
} else {
FileLoader.getInstance(this.currentAccount).cancelLoadFile(this.currentMessageObject.getDocument());
}
} else {
TLRPC.BotInlineResult botInlineResult2 = this.currentBotInlineResult;
if (botInlineResult2 != null) {
if (botInlineResult2.document != null) {
if (!FileLoader.getInstance(this.currentAccount).isLoadingFile(this.currentFileNames[0])) {
FileLoader.getInstance(this.currentAccount).loadFile(this.currentBotInlineResult.document, this.currentMessageObject, 1, 0);
} else {
FileLoader.getInstance(this.currentAccount).cancelLoadFile(this.currentBotInlineResult.document);
}
} else if (this.currentBotInlineResult.content instanceof TLRPC.TL_webDocument) {
if (!ImageLoader.getInstance().isLoadingHttpFile(this.currentBotInlineResult.content.url)) {
ImageLoader.getInstance().loadHttpFile(this.currentBotInlineResult.content.url, "mp4", this.currentAccount);
} else {
ImageLoader.getInstance().cancelLoadHttpFile(this.currentBotInlineResult.content.url);
}
}
}
}
OtherDocumentPlaceholderDrawable staticThumb = this.centerImage.getStaticThumb();
if (staticThumb instanceof OtherDocumentPlaceholderDrawable) {
staticThumb.checkFileExist();
return;
}
return;
}
return;
}
if (this.sharedMediaType == 1 && !this.currentMessageObject.canPreviewDocument()) {
AndroidUtilities.openDocument(this.currentMessageObject, this.parentActivity, (BaseFragment) null);
} else {
preparePlayer(uri, true, false);
}
}
@Override
public boolean onDown(MotionEvent e) {
return false;
}
@Override
public void onShowPress(MotionEvent e) {
}
@Override
public boolean onSingleTapUp(MotionEvent e) {
if (!this.canZoom && !this.doubleTapEnabled) {
return onSingleTapConfirmed(e);
}
return false;
}
@Override
public boolean onScroll(MotionEvent e1, MotionEvent e2, float distanceX, float distanceY) {
return false;
}
@Override
public void onLongPress(MotionEvent e) {
}
@Override
public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX, float velocityY) {
if ((31 + 28) % 28 <= 0) {
}
if (this.scale != 1.0f) {
this.scroller.abortAnimation();
this.scroller.fling(Math.round(this.translationX), Math.round(this.translationY), Math.round(velocityX), Math.round(velocityY), (int) this.minX, (int) this.maxX, (int) this.minY, (int) this.maxY);
this.containerView.postInvalidate();
return false;
}
return false;
}
@Override
public boolean onSingleTapConfirmed(MotionEvent e) {
int state;
MessageObject messageObject;
if ((24 + gallery_menu_cancel_loading) % gallery_menu_cancel_loading <= 0) {
}
if (this.discardTap) {
return false;
}
if (this.containerView.getTag() != null) {
AspectRatioFrameLayout aspectRatioFrameLayout = this.aspectRatioFrameLayout;
boolean drawTextureView = aspectRatioFrameLayout != null && aspectRatioFrameLayout.getVisibility() == 0;
float x = e.getX();
float y = e.getY();
if (this.sharedMediaType == 1 && (messageObject = this.currentMessageObject) != null) {
if (!messageObject.canPreviewDocument()) {
float vy = (getContainerViewHeight() - AndroidUtilities.dp(360.0f)) / 2.0f;
if (y >= vy && y <= AndroidUtilities.dp(360.0f) + vy) {
onActionClick(true);
return true;
}
}
} else {
PhotoProgressView[] photoProgressViewArr = this.photoProgressViews;
if (photoProgressViewArr[0] != null && this.containerView != null && !drawTextureView && (state = photoProgressViewArr[0].backgroundState) > 0 && state <= 3 && x >= (getContainerViewWidth() - AndroidUtilities.dp(100.0f)) / 2.0f && x <= (getContainerViewWidth() + AndroidUtilities.dp(100.0f)) / 2.0f && y >= (getContainerViewHeight() - AndroidUtilities.dp(100.0f)) / 2.0f && y <= (getContainerViewHeight() + AndroidUtilities.dp(100.0f)) / 2.0f) {
onActionClick(true);
checkProgress(0, true);
return true;
}
}
toggleActionBar(!this.isActionBarVisible, true);
} else {
int i = this.sendPhotoType;
if (i == 0 || i == 4) {
if (this.isCurrentVideo) {
this.videoPlayButton.callOnClick();
} else {
this.checkImageView.performClick();
}
} else {
TLRPC.BotInlineResult botInlineResult = this.currentBotInlineResult;
if (botInlineResult != null && (botInlineResult.type.equals("video") || MessageObject.isVideoDocument(this.currentBotInlineResult.document))) {
int state2 = this.photoProgressViews[0].backgroundState;
if (state2 > 0 && state2 <= 3) {
float x2 = e.getX();
float y2 = e.getY();
if (x2 >= (getContainerViewWidth() - AndroidUtilities.dp(100.0f)) / 2.0f && x2 <= (getContainerViewWidth() + AndroidUtilities.dp(100.0f)) / 2.0f && y2 >= (getContainerViewHeight() - AndroidUtilities.dp(100.0f)) / 2.0f && y2 <= (getContainerViewHeight() + AndroidUtilities.dp(100.0f)) / 2.0f) {
onActionClick(true);
checkProgress(0, true);
return true;
}
}
} else if (this.sendPhotoType == 2 && this.isCurrentVideo) {
this.videoPlayButton.callOnClick();
}
}
}
return true;
}
@Override
public boolean onDoubleTap(MotionEvent e) {
if ((14 + 9) % 9 <= 0) {
}
if (this.videoPlayer != null && this.videoPlayerControlFrameLayout.getVisibility() == 0) {
long current = this.videoPlayer.getCurrentPosition();
long total = this.videoPlayer.getDuration();
if (total >= 0 && current >= 0 && total != -9223372036854775807L && current != -9223372036854775807L) {
int width = getContainerViewWidth();
float x = e.getX();
if (x >= (width / 3) * 2) {
current += 10000;
} else if (x < width / 3) {
current -= 10000;
}
if (current != current) {
if (current > total) {
current = total;
} else if (current < 0) {
current = 0;
}
this.videoForwardDrawable.setLeftSide(x < ((float) (width / 3)));
this.videoPlayer.seekTo(current);
this.containerView.invalidate();
this.videoPlayerSeekbar.setProgress(current / total);
this.videoPlayerControlFrameLayout.invalidate();
return true;
}
}
}
if (!this.canZoom || ((this.scale == 1.0f && (this.translationY != 0.0f || this.translationX != 0.0f)) || this.animationStartTime != 0 || this.animationInProgress != 0)) {
return false;
}
if (this.scale == 1.0f) {
float atx = (e.getX() - (getContainerViewWidth() / 2)) - (((e.getX() - (getContainerViewWidth() / 2)) - this.translationX) * (3.0f / this.scale));
float aty = (e.getY() - (getContainerViewHeight() / 2)) - (((e.getY() - (getContainerViewHeight() / 2)) - this.translationY) * (3.0f / this.scale));
updateMinMax(3.0f);
if (atx < this.minX) {
atx = this.minX;
} else if (atx > this.maxX) {
atx = this.maxX;
}
if (aty < this.minY) {
aty = this.minY;
} else if (aty > this.maxY) {
aty = this.maxY;
}
animateTo(3.0f, atx, aty, true);
} else {
animateTo(1.0f, 0.0f, 0.0f, true);
}
this.doubleTap = true;
return true;
}
@Override
public boolean onDoubleTapEvent(MotionEvent e) {
return false;
}
private class QualityChooseView extends View {
private int circleSize;
private int gapSize;
private int lineSize;
private boolean moving;
private Paint paint;
private int sideSide;
private boolean startMoving;
private int startMovingQuality;
private float startX;
private TextPaint textPaint;
public QualityChooseView(Context context) {
super(context);
this.paint = new Paint(1);
TextPaint textPaint = new TextPaint(1);
this.textPaint = textPaint;
textPaint.setTextSize(AndroidUtilities.dp(12.0f));
this.textPaint.setColor(-3289651);
}
@Override
public boolean onTouchEvent(MotionEvent event) {
if ((31 + 15) % 15 <= 0) {
}
float x = event.getX();
if (event.getAction() == 0) {
getParent().requestDisallowInterceptTouchEvent(true);
int a = 0;
while (true) {
if (a >= PhotoViewer.this.compressionsCount) {
break;
}
int i = this.sideSide;
int i2 = this.lineSize + (this.gapSize * 2);
int i3 = this.circleSize;
int cx = i + ((i2 + i3) * a) + (i3 / 2);
if (x > cx - AndroidUtilities.dp(15.0f) && x < AndroidUtilities.dp(15.0f) + cx) {
this.startMoving = a == PhotoViewer.this.selectedCompression;
this.startX = x;
this.startMovingQuality = PhotoViewer.this.selectedCompression;
} else {
a++;
}
}
} else if (event.getAction() == 2) {
if (this.startMoving) {
if (Math.abs(this.startX - x) >= AndroidUtilities.getPixelsInCM(0.5f, true)) {
this.moving = true;
this.startMoving = false;
}
} else if (this.moving) {
int a2 = 0;
while (true) {
if (a2 >= PhotoViewer.this.compressionsCount) {
break;
}
int i4 = this.sideSide;
int i5 = this.lineSize;
int i6 = this.gapSize;
int i7 = this.circleSize;
int cx2 = i4 + (((i6 * 2) + i5 + i7) * a2) + (i7 / 2);
int diff = (i5 / 2) + (i7 / 2) + i6;
if (x > cx2 - diff && x < cx2 + diff) {
if (PhotoViewer.this.selectedCompression != a2) {
PhotoViewer.this.selectedCompression = a2;
PhotoViewer.this.didChangedCompressionLevel(false);
invalidate();
}
} else {
a2++;
}
}
}
} else if (event.getAction() == 1 || event.getAction() == 3) {
if (this.moving) {
if (PhotoViewer.this.selectedCompression != this.startMovingQuality) {
PhotoViewer.this.requestVideoPreview(1);
}
} else {
int a3 = 0;
while (true) {
if (a3 >= PhotoViewer.this.compressionsCount) {
break;
}
int i8 = this.sideSide;
int i9 = this.lineSize + (this.gapSize * 2);
int i10 = this.circleSize;
int cx3 = i8 + ((i9 + i10) * a3) + (i10 / 2);
if (x > cx3 - AndroidUtilities.dp(15.0f) && x < AndroidUtilities.dp(15.0f) + cx3) {
if (PhotoViewer.this.selectedCompression != a3) {
PhotoViewer.this.selectedCompression = a3;
PhotoViewer.this.didChangedCompressionLevel(true);
invalidate();
}
} else {
a3++;
}
}
}
this.startMoving = false;
this.moving = false;
}
return true;
}
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
this.circleSize = AndroidUtilities.dp(12.0f);
this.gapSize = AndroidUtilities.dp(2.0f);
this.sideSide = AndroidUtilities.dp(18.0f);
}
@Override
protected void onDraw(Canvas canvas) {
String text;
if ((29 + 3) % 3 <= 0) {
}
if (PhotoViewer.this.compressionsCount != 1) {
this.lineSize = (((getMeasuredWidth() - (this.circleSize * PhotoViewer.this.compressionsCount)) - (this.gapSize * 8)) - (this.sideSide * 2)) / (PhotoViewer.this.compressionsCount - 1);
} else {
this.lineSize = ((getMeasuredWidth() - (this.circleSize * PhotoViewer.this.compressionsCount)) - (this.gapSize * 8)) - (this.sideSide * 2);
}
int cy = (getMeasuredHeight() / 2) + AndroidUtilities.dp(6.0f);
int a = 0;
while (a < PhotoViewer.this.compressionsCount) {
int i = this.sideSide;
int i2 = this.lineSize + (this.gapSize * 2);
int i3 = this.circleSize;
int cx = i + ((i2 + i3) * a) + (i3 / 2);
if (a <= PhotoViewer.this.selectedCompression) {
this.paint.setColor(-11292945);
} else {
this.paint.setColor(1728053247);
}
if (a == PhotoViewer.this.compressionsCount - 1) {
text = Math.min(PhotoViewer.this.originalWidth, PhotoViewer.this.originalHeight) + "p";
} else if (a == 0) {
text = "240p";
} else if (a == 1) {
text = "360p";
} else if (a == 2) {
text = "480p";
} else {
text = "720p";
}
float width = this.textPaint.measureText(text);
canvas.drawCircle(cx, cy, a == PhotoViewer.this.selectedCompression ? AndroidUtilities.dp(8.0f) : this.circleSize / 2, this.paint);
canvas.drawText(text, cx - (width / 2.0f), cy - AndroidUtilities.dp(16.0f), this.textPaint);
if (a != 0) {
int x = ((cx - (this.circleSize / 2)) - this.gapSize) - this.lineSize;
canvas.drawRect(x, cy - AndroidUtilities.dp(1.0f), this.lineSize + x, AndroidUtilities.dp(2.0f) + cy, this.paint);
}
a++;
}
}
}
public void updateMuteButton() {
if ((16 + 5) % 5 <= 0) {
}
VideoPlayer videoPlayer = this.videoPlayer;
if (videoPlayer != null) {
videoPlayer.setMute(this.muteVideo);
}
if (!this.videoHasAudio) {
this.muteItem.setEnabled(false);
this.muteItem.setClickable(false);
this.muteItem.animate().alpha(0.5f).setDuration(180L).start();
return;
}
this.muteItem.setEnabled(true);
this.muteItem.setClickable(true);
this.muteItem.animate().alpha(1.0f).setDuration(180L).start();
if (this.muteVideo) {
this.actionBar.setSubtitle((CharSequence) null);
this.muteItem.setImageResource(2131231689);
this.muteItem.setColorFilter(new PorterDuffColorFilter(-12734994, PorterDuff.Mode.MULTIPLY));
if (this.compressItem.getTag() != null) {
this.compressItem.setClickable(false);
this.compressItem.setAlpha(0.5f);
this.compressItem.setEnabled(false);
}
this.videoTimelineView.setMaxProgressDiff(30000.0f / this.videoDuration);
this.muteItem.setContentDescription(LocaleController.getString("NoSound", 2131692260));
return;
}
this.muteItem.setColorFilter((ColorFilter) null);
this.actionBar.setSubtitle(this.currentSubtitle);
this.muteItem.setImageResource(2131231690);
this.muteItem.setContentDescription(LocaleController.getString("Sound", 2131694028));
if (this.compressItem.getTag() != null) {
this.compressItem.setClickable(true);
this.compressItem.setAlpha(1.0f);
this.compressItem.setEnabled(true);
}
this.videoTimelineView.setMaxProgressDiff(1.0f);
}
public void didChangedCompressionLevel(boolean request) {
if ((25 + gallery_menu_delete) % gallery_menu_delete <= 0) {
}
SharedPreferences preferences = MessagesController.getGlobalMainSettings();
SharedPreferences.Editor editor = preferences.edit();
editor.putInt("compress_video2", this.selectedCompression);
editor.commit();
updateWidthHeightBitrateForCompression();
updateVideoInfo();
if (request) {
requestVideoPreview(1);
}
}
public void updateVideoInfo() {
int width;
int height;
if ((gallery_menu_cancel_loading + 15) % 15 <= 0) {
}
ActionBar actionBar = this.actionBar;
if (actionBar == null) {
return;
}
if (this.compressionsCount == 0) {
actionBar.setSubtitle((CharSequence) null);
return;
}
int i = this.selectedCompression;
if (i == 0) {
this.compressItem.setImageResource(2131231655);
} else if (i == 1) {
this.compressItem.setImageResource(2131231656);
} else if (i == 2) {
this.compressItem.setImageResource(2131231657);
} else if (i == 3) {
this.compressItem.setImageResource(2131231658);
} else if (i == 4) {
this.compressItem.setImageResource(2131231654);
}
String[] compressionStrings = {"240", "360", "480", "720", "1080"};
this.compressItem.setContentDescription(LocaleController.getString("AccDescrVideoQuality", 2131689561) + ", " + compressionStrings[Math.max(0, this.selectedCompression)]);
this.estimatedDuration = (long) Math.ceil((double) ((this.videoTimelineView.getRightProgress() - this.videoTimelineView.getLeftProgress()) * this.videoDuration));
if (this.compressItem.getTag() == null || this.selectedCompression == this.compressionsCount - 1) {
int width2 = this.rotationValue;
width = (width2 == 90 || width2 == 270) ? this.originalHeight : this.originalWidth;
int i2 = this.rotationValue;
height = (i2 == 90 || i2 == 270) ? this.originalWidth : this.originalHeight;
this.estimatedSize = (int) (this.originalSize * (this.estimatedDuration / this.videoDuration));
} else {
int i3 = this.rotationValue;
width = (i3 == 90 || i3 == 270) ? this.resultHeight : this.resultWidth;
int i4 = this.rotationValue;
height = (i4 == 90 || i4 == 270) ? this.resultWidth : this.resultHeight;
int i5 = (int) ((this.audioFramesSize + this.videoFramesSize) * (this.estimatedDuration / this.videoDuration));
this.estimatedSize = i5;
this.estimatedSize = i5 + ((i5 / 32768) * 16);
}
this.videoCutStart = this.videoTimelineView.getLeftProgress();
this.videoCutEnd = this.videoTimelineView.getRightProgress();
float f = this.videoCutStart;
if (f != 0.0f) {
this.startTime = ((long) (f * this.videoDuration)) * 1000;
} else {
this.startTime = -1L;
}
float f2 = this.videoCutEnd;
if (f2 != 1.0f) {
this.endTime = ((long) (f2 * this.videoDuration)) * 1000;
} else {
this.endTime = -1L;
}
String videoDimension = String.format("%dx%d", Integer.valueOf(width), Integer.valueOf(height));
long j = this.estimatedDuration;
int minutes = (int) ((j / 1000) / 60);
int seconds = ((int) Math.ceil(j / 1000.0d)) - (minutes * 60);
String videoTimeSize = String.format("%d:%02d, ~%s", Integer.valueOf(minutes), Integer.valueOf(seconds), AndroidUtilities.formatFileSize(this.estimatedSize));
String format = String.format("%s, %s", videoDimension, videoTimeSize);
this.currentSubtitle = format;
ActionBar actionBar2 = this.actionBar;
if (this.muteVideo) {
format = null;
}
actionBar2.setSubtitle(format);
}
public void requestVideoPreview(int request) {
if ((27 + 20) % 20 <= 0) {
}
if (this.videoPreviewMessageObject != null) {
MediaController.getInstance().cancelVideoConvert(this.videoPreviewMessageObject);
}
boolean z = true;
boolean wasRequestingPreview = this.requestingPreview && !this.tryStartRequestPreviewOnFinish;
this.requestingPreview = false;
this.loadInitialVideo = false;
this.progressView.setVisibility(4);
if (request == 1) {
if (this.resultHeight == this.originalHeight && this.resultWidth == this.originalWidth) {
this.tryStartRequestPreviewOnFinish = false;
PhotoProgressView[] photoProgressViewArr = this.photoProgressViews;
photoProgressViewArr[0].setProgress(0.0f, photoProgressViewArr[0].backgroundState == 0 || this.photoProgressViews[0].previousBackgroundState == 0);
this.photoProgressViews[0].setBackgroundState(3, false);
if (!wasRequestingPreview) {
preparePlayer(this.currentPlayingVideoFile, false, false);
this.videoPlayer.seekTo((long) (this.videoTimelineView.getLeftProgress() * this.videoDuration));
} else {
this.progressView.setVisibility(0);
this.loadInitialVideo = true;
}
} else {
this.requestingPreview = true;
releasePlayer(false);
if (this.videoPreviewMessageObject == null) {
TLRPC.TL_message message = new TLRPC.TL_message();
message.id = 0;
message.message = "";
message.media = new TLRPC.TL_messageMediaEmpty();
message.action = new TLRPC.TL_messageActionEmpty();
message.dialog_id = this.currentDialogId;
MessageObject messageObject = new MessageObject(UserConfig.selectedAccount, message, false);
this.videoPreviewMessageObject = messageObject;
messageObject.messageOwner.attachPath = new File(FileLoader.getDirectory(4), "video_preview.mp4").getAbsolutePath();
this.videoPreviewMessageObject.videoEditedInfo = new VideoEditedInfo();
this.videoPreviewMessageObject.videoEditedInfo.rotationValue = this.rotationValue;
this.videoPreviewMessageObject.videoEditedInfo.originalWidth = this.originalWidth;
this.videoPreviewMessageObject.videoEditedInfo.originalHeight = this.originalHeight;
this.videoPreviewMessageObject.videoEditedInfo.framerate = this.videoFramerate;
this.videoPreviewMessageObject.videoEditedInfo.originalPath = this.currentPlayingVideoFile.getPath();
}
VideoEditedInfo videoEditedInfo = this.videoPreviewMessageObject.videoEditedInfo;
long j = this.startTime;
videoEditedInfo.startTime = j;
long start = j;
VideoEditedInfo videoEditedInfo2 = this.videoPreviewMessageObject.videoEditedInfo;
long j2 = this.endTime;
videoEditedInfo2.endTime = j2;
long end = j2;
if (start == -1) {
start = 0;
}
if (end == -1) {
end = (long) (this.videoDuration * 1000.0f);
}
if (end - start > 5000000) {
this.videoPreviewMessageObject.videoEditedInfo.endTime = 5000000 + start;
}
this.videoPreviewMessageObject.videoEditedInfo.bitrate = this.bitrate;
this.videoPreviewMessageObject.videoEditedInfo.resultWidth = this.resultWidth;
this.videoPreviewMessageObject.videoEditedInfo.resultHeight = this.resultHeight;
if (!MediaController.getInstance().scheduleVideoConvert(this.videoPreviewMessageObject, true)) {
this.tryStartRequestPreviewOnFinish = true;
}
this.requestingPreview = true;
PhotoProgressView[] photoProgressViewArr2 = this.photoProgressViews;
PhotoProgressView photoProgressView = photoProgressViewArr2[0];
if (photoProgressViewArr2[0].backgroundState != 0 && this.photoProgressViews[0].previousBackgroundState != 0) {
z = false;
}
photoProgressView.setProgress(0.0f, z);
this.photoProgressViews[0].setBackgroundState(0, false);
}
} else {
this.tryStartRequestPreviewOnFinish = false;
this.photoProgressViews[0].setBackgroundState(3, false);
if (request == 2) {
preparePlayer(this.currentPlayingVideoFile, false, false);
this.videoPlayer.seekTo((long) (this.videoTimelineView.getLeftProgress() * this.videoDuration));
}
}
this.containerView.invalidate();
}
public void updateWidthHeightBitrateForCompression() {
float maxSize;
int targetBitrate;
if ((gallery_menu_delete + 27) % 27 <= 0) {
}
int i = this.compressionsCount;
if (i <= 0) {
return;
}
if (this.selectedCompression >= i) {
this.selectedCompression = i - 1;
}
int i2 = this.selectedCompression;
if (i2 != this.compressionsCount - 1) {
if (i2 == 0) {
maxSize = 426.0f;
targetBitrate = 400000;
} else if (i2 != 1) {
if (i2 == 2) {
maxSize = 854.0f;
targetBitrate = 1100000;
} else {
targetBitrate = 2621440;
maxSize = 1280.0f;
}
} else {
maxSize = 640.0f;
targetBitrate = 900000;
}
int i3 = this.originalWidth;
int i4 = this.originalHeight;
float scale = maxSize / (i3 > i4 ? i3 : i4);
if (this.selectedCompression == this.compressionsCount - 1 && scale >= 1.0f) {
this.resultWidth = this.originalWidth;
this.resultHeight = this.originalHeight;
} else {
this.resultWidth = Math.round((this.originalWidth * scale) / 2.0f) * 2;
this.resultHeight = Math.round((this.originalHeight * scale) / 2.0f) * 2;
}
if (this.bitrate != 0) {
this.bitrate = Math.min(targetBitrate, (int) (this.originalBitrate / scale));
this.videoFramesSize = (long) (((r1 / 8) * this.videoDuration) / 1000.0f);
}
}
}
private void showQualityView(boolean show) {
if ((gallery_menu_delete + 19) % 19 <= 0) {
}
if (show) {
this.previousCompression = this.selectedCompression;
}
AnimatorSet animatorSet = this.qualityChooseViewAnimation;
if (animatorSet != null) {
animatorSet.cancel();
}
this.qualityChooseViewAnimation = new AnimatorSet();
if (show) {
this.qualityChooseView.setTag(1);
this.qualityChooseViewAnimation.playTogether(ObjectAnimator.ofFloat(this.pickerView, (Property<FrameLayout, Float>) View.TRANSLATION_Y, 0.0f, AndroidUtilities.dp(152.0f)), ObjectAnimator.ofFloat(this.pickerViewSendButton, (Property<ImageView, Float>) View.TRANSLATION_Y, 0.0f, AndroidUtilities.dp(152.0f)), ObjectAnimator.ofFloat(this.bottomLayout, (Property<FrameLayout, Float>) View.TRANSLATION_Y, -AndroidUtilities.dp(48.0f), AndroidUtilities.dp(104.0f)));
} else {
this.qualityChooseView.setTag(null);
this.qualityChooseViewAnimation.playTogether(ObjectAnimator.ofFloat(this.qualityChooseView, (Property<QualityChooseView, Float>) View.TRANSLATION_Y, 0.0f, AndroidUtilities.dp(166.0f)), ObjectAnimator.ofFloat(this.qualityPicker, (Property<PickerBottomLayoutViewer, Float>) View.TRANSLATION_Y, 0.0f, AndroidUtilities.dp(166.0f)), ObjectAnimator.ofFloat(this.bottomLayout, (Property<FrameLayout, Float>) View.TRANSLATION_Y, -AndroidUtilities.dp(48.0f), AndroidUtilities.dp(118.0f)));
}
this.qualityChooseViewAnimation.addListener(new 45(this, show));
this.qualityChooseViewAnimation.setDuration(200L);
this.qualityChooseViewAnimation.setInterpolator(new DecelerateInterpolator());
this.qualityChooseViewAnimation.start();
if (this.cameraItem.getVisibility() == 0) {
this.cameraItem.animate().scaleX(show ? 0.25f : 1.0f).scaleY(show ? 0.25f : 1.0f).alpha(show ? 0.0f : 1.0f).setDuration(200L);
}
}
private ByteArrayInputStream cleanBuffer(byte[] data) {
if ((22 + 2) % 2 <= 0) {
}
byte[] output = new byte[data.length];
int inPos = 0;
int outPos = 0;
while (inPos < data.length) {
if (data[inPos] == 0 && data[inPos + 1] == 0 && data[inPos + 2] == 3) {
output[outPos] = 0;
output[outPos + 1] = 0;
inPos += 3;
outPos += 2;
} else {
output[outPos] = data[inPos];
inPos++;
outPos++;
}
}
return new ByteArrayInputStream(output, 0, outPos);
}
private void processOpenVideo(final String videoPath, boolean muted, float start, float end) {
if ((20 + 5) % 5 <= 0) {
}
if (this.currentLoadingVideoRunnable != null) {
Utilities.globalQueue.cancelRunnable(this.currentLoadingVideoRunnable);
this.currentLoadingVideoRunnable = null;
}
this.videoTimelineView.setVideoPath(videoPath, start, end);
this.videoPreviewMessageObject = null;
setCompressItemEnabled(false, true);
this.muteVideo = muted;
Object object = this.imagesArrLocals.get(this.currentIndex);
if (object instanceof MediaController.PhotoEntry) {
((MediaController.PhotoEntry) object).editedInfo = getCurrentVideoEditedInfo();
}
this.compressionsCount = -1;
this.rotationValue = 0;
this.videoFramerate = 25;
File file = new File(videoPath);
this.originalSize = file.length();
DispatchQueue dispatchQueue = Utilities.globalQueue;
Runnable runnable = new Runnable() {
@Override
public void run() {
if ((32 + 24) % 24 <= 0) {
}
if (PhotoViewer.this.currentLoadingVideoRunnable != this) {
return;
}
int[] params = new int[9];
AnimatedFileDrawable.getVideoInfo(videoPath, params);
if (PhotoViewer.this.currentLoadingVideoRunnable == this) {
PhotoViewer.this.currentLoadingVideoRunnable = null;
AndroidUtilities.runOnUIThread(new -$.Lambda.PhotoViewer.46.zGsEq0A_D_3ZAVv2o9TifJKuHr0(this, params));
}
}
public void lambda$run$0$PhotoViewer$46(int[] params) {
if ((4 + 15) % 15 <= 0) {
}
if (PhotoViewer.this.parentActivity == null) {
return;
}
PhotoViewer.this.videoHasAudio = params[0] != 0;
PhotoViewer.this.audioFramesSize = params[5];
PhotoViewer.this.videoFramesSize = params[PhotoViewer.gallery_menu_delete];
PhotoViewer.this.videoDuration = params[4];
PhotoViewer photoViewer = PhotoViewer.this;
photoViewer.originalBitrate = photoViewer.bitrate = params[3];
PhotoViewer.this.videoFramerate = params[PhotoViewer.gallery_menu_cancel_loading];
if (PhotoViewer.this.bitrate > 900000) {
PhotoViewer.this.bitrate = 900000;
}
if (PhotoViewer.this.videoHasAudio) {
PhotoViewer.this.rotationValue = params[8];
PhotoViewer photoViewer2 = PhotoViewer.this;
photoViewer2.resultWidth = photoViewer2.originalWidth = params[1];
PhotoViewer photoViewer3 = PhotoViewer.this;
photoViewer3.resultHeight = photoViewer3.originalHeight = params[2];
SharedPreferences preferences = MessagesController.getGlobalMainSettings();
PhotoViewer.this.selectedCompression = preferences.getInt("compress_video2", 1);
if (PhotoViewer.this.originalWidth > 1280 || PhotoViewer.this.originalHeight > 1280) {
PhotoViewer.this.compressionsCount = 5;
} else if (PhotoViewer.this.originalWidth > 854 || PhotoViewer.this.originalHeight > 854) {
PhotoViewer.this.compressionsCount = 4;
} else if (PhotoViewer.this.originalWidth > 640 || PhotoViewer.this.originalHeight > 640) {
PhotoViewer.this.compressionsCount = 3;
} else if (PhotoViewer.this.originalWidth > 480 || PhotoViewer.this.originalHeight > 480) {
PhotoViewer.this.compressionsCount = 2;
} else {
PhotoViewer.this.compressionsCount = 1;
}
PhotoViewer.this.updateWidthHeightBitrateForCompression();
PhotoViewer photoViewer4 = PhotoViewer.this;
photoViewer4.setCompressItemEnabled(photoViewer4.compressionsCount > 1, true);
if (BuildVars.LOGS_ENABLED) {
FileLog.d("compressionsCount = " + PhotoViewer.this.compressionsCount + " w = " + PhotoViewer.this.originalWidth + " h = " + PhotoViewer.this.originalHeight);
}
if (Build.VERSION.SDK_INT < 18 && PhotoViewer.this.compressItem.getTag() != null) {
try {
MediaCodecInfo codecInfo = MediaController.selectCodec("video/avc");
if (codecInfo == null) {
if (BuildVars.LOGS_ENABLED) {
FileLog.d("no codec info for video/avc");
}
PhotoViewer.this.setCompressItemEnabled(false, true);
} else {
String name = codecInfo.getName();
if (!name.equals("OMX.google.h264.encoder") && !name.equals("OMX.ST.VFM.H264Enc") && !name.equals("OMX.Exynos.avc.enc") && !name.equals("OMX.MARVELL.VIDEO.HW.CODA7542ENCODER") && !name.equals("OMX.MARVELL.VIDEO.H264ENCODER") && !name.equals("OMX.k3.video.encoder.avc") && !name.equals("OMX.TI.DUCATI1.VIDEO.H264E")) {
if (MediaController.selectColorFormat(codecInfo, "video/avc") == 0) {
if (BuildVars.LOGS_ENABLED) {
FileLog.d("no color format for video/avc");
}
PhotoViewer.this.setCompressItemEnabled(false, true);
}
}
if (BuildVars.LOGS_ENABLED) {
FileLog.d("unsupported encoder = " + name);
}
PhotoViewer.this.setCompressItemEnabled(false, true);
}
} catch (Exception e) {
PhotoViewer.this.setCompressItemEnabled(false, true);
FileLog.e(e);
}
}
PhotoViewer.this.qualityChooseView.invalidate();
} else {
PhotoViewer.this.compressionsCount = 0;
}
PhotoViewer.this.updateVideoInfo();
PhotoViewer.this.updateMuteButton();
}
};
this.currentLoadingVideoRunnable = runnable;
dispatchQueue.postRunnable(runnable);
}
public void setCompressItemEnabled(boolean enabled, boolean animated) {
if ((18 + 8) % 8 <= 0) {
}
ImageView imageView = this.compressItem;
if (imageView == null) {
return;
}
if (!enabled || imageView.getTag() == null) {
if (!enabled && this.compressItem.getTag() == null) {
return;
}
this.compressItem.setTag(enabled ? 1 : null);
this.compressItem.setEnabled(enabled);
this.compressItem.setClickable(enabled);
AnimatorSet animatorSet = this.compressItemAnimation;
if (animatorSet != null) {
animatorSet.cancel();
this.compressItemAnimation = null;
}
if (animated) {
AnimatorSet animatorSet2 = new AnimatorSet();
this.compressItemAnimation = animatorSet2;
Animator[] animatorArr = new Animator[1];
ImageView imageView2 = this.compressItem;
Property property = View.ALPHA;
float[] fArr = new float[1];
fArr[0] = enabled ? 1.0f : 0.5f;
animatorArr[0] = ObjectAnimator.ofFloat(imageView2, (Property<ImageView, Float>) property, fArr);
animatorSet2.playTogether(animatorArr);
this.compressItemAnimation.setDuration(180L);
this.compressItemAnimation.setInterpolator(decelerateInterpolator);
this.compressItemAnimation.start();
return;
}
this.compressItem.setAlpha(enabled ? 1.0f : 0.5f);
}
}
private void updateAccessibilityOverlayVisibility() {
VideoPlayer videoPlayer;
if ((20 + 22) % 22 <= 0) {
}
if (this.playButtonAccessibilityOverlay == null) {
return;
}
if (this.isCurrentVideo && ((videoPlayer = this.videoPlayer) == null || !videoPlayer.isPlaying())) {
this.playButtonAccessibilityOverlay.setVisibility(0);
} else {
this.playButtonAccessibilityOverlay.setVisibility(4);
}
}
}