mirror of
https://github.com/wrwrabbit/Partisan-Telegram-Android.git
synced 2026-05-05 15:41:02 +00:00
Update from original 8.9.0
This commit is contained in:
commit
728f13560f
3870 changed files with 26529 additions and 6343 deletions
|
|
@ -68,7 +68,6 @@ import android.transition.TransitionManager;
|
|||
import android.transition.TransitionSet;
|
||||
import android.transition.TransitionValues;
|
||||
import android.util.FloatProperty;
|
||||
import android.util.Log;
|
||||
import android.util.Property;
|
||||
import android.util.Range;
|
||||
import android.util.SparseArray;
|
||||
|
|
@ -136,7 +135,6 @@ import org.telegram.messenger.AndroidUtilities;
|
|||
import org.telegram.messenger.ApplicationLoader;
|
||||
import org.telegram.messenger.Bitmaps;
|
||||
import org.telegram.messenger.BringAppForegroundService;
|
||||
import org.telegram.messenger.BuildConfig;
|
||||
import org.telegram.messenger.BuildVars;
|
||||
import org.telegram.messenger.ChatObject;
|
||||
import org.telegram.messenger.ContactsController;
|
||||
|
|
@ -185,6 +183,8 @@ import org.telegram.ui.Adapters.MentionsAdapter;
|
|||
import org.telegram.ui.Cells.CheckBoxCell;
|
||||
import org.telegram.ui.Cells.PhotoPickerPhotoCell;
|
||||
import org.telegram.ui.Components.AlertsCreator;
|
||||
import org.telegram.ui.Components.AnimatedEmojiDrawable;
|
||||
import org.telegram.ui.Components.AnimatedEmojiSpan;
|
||||
import org.telegram.ui.Components.AnimatedFileDrawable;
|
||||
import org.telegram.ui.Components.AnimationProperties;
|
||||
import org.telegram.ui.Components.BackupImageView;
|
||||
|
|
@ -218,6 +218,7 @@ import org.telegram.ui.Components.PhotoViewerWebView;
|
|||
import org.telegram.ui.Components.PickerBottomLayoutViewer;
|
||||
import org.telegram.ui.Components.PipVideoOverlay;
|
||||
import org.telegram.ui.Components.PlayPauseDrawable;
|
||||
import org.telegram.ui.Components.Premium.LimitReachedBottomSheet;
|
||||
import org.telegram.ui.Components.RLottieDrawable;
|
||||
import org.telegram.ui.Components.RadialProgressView;
|
||||
import org.telegram.ui.Components.RecyclerListView;
|
||||
|
|
@ -2327,8 +2328,10 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat
|
|||
PhotoViewer.this.onDraw(canvas);
|
||||
|
||||
if (isStatusBarVisible() && AndroidUtilities.statusBarHeight != 0 && actionBar != null) {
|
||||
paint.setAlpha((int) (255 * actionBar.getAlpha() * 0.2f));
|
||||
canvas.drawRect(0, currentPanTranslationY, getMeasuredWidth(), currentPanTranslationY + AndroidUtilities.statusBarHeight, paint);
|
||||
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) {
|
||||
paint.setAlpha((int) (255 * actionBar.getAlpha() * 0.2f));
|
||||
canvas.drawRect(0, currentPanTranslationY, getMeasuredWidth(), currentPanTranslationY + AndroidUtilities.statusBarHeight, paint);
|
||||
}
|
||||
paint.setAlpha((int) (255 * actionBar.getAlpha() * 0.498f));
|
||||
if (getPaddingRight() > 0) {
|
||||
canvas.drawRect(getMeasuredWidth() - getPaddingRight(), 0, getMeasuredWidth(), getMeasuredHeight(), paint);
|
||||
|
|
@ -3537,7 +3540,7 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat
|
|||
}
|
||||
if (Build.VERSION.SDK_INT >= 24) {
|
||||
try {
|
||||
intent.putExtra(Intent.EXTRA_STREAM, FileProvider.getUriForFile(parentActivity, BuildConfig.APPLICATION_ID + ".provider", f));
|
||||
intent.putExtra(Intent.EXTRA_STREAM, FileProvider.getUriForFile(parentActivity, ApplicationLoader.getApplicationId() + ".provider", f));
|
||||
intent.setFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
|
||||
} catch (Exception ignore) {
|
||||
intent.putExtra(Intent.EXTRA_STREAM, Uri.fromFile(f));
|
||||
|
|
@ -6137,7 +6140,25 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat
|
|||
} else if (object instanceof MediaDataController.KeywordResult) {
|
||||
String code = ((MediaDataController.KeywordResult) object).emoji;
|
||||
captionEditText.addEmojiToRecent(code);
|
||||
captionEditText.replaceWithText(start, len, code, true);
|
||||
if (code != null && code.startsWith("animated_")) {
|
||||
try {
|
||||
long documentId = Long.parseLong(code.substring(9));
|
||||
TLRPC.Document document = AnimatedEmojiDrawable.findDocument(currentAccount, documentId);
|
||||
SpannableString emoji = new SpannableString(MessageObject.findAnimatedEmojiEmoticon(document));
|
||||
AnimatedEmojiSpan span;
|
||||
if (document != null) {
|
||||
span = new AnimatedEmojiSpan(document, captionEditText.getMessageEditText().getPaint().getFontMetricsInt());
|
||||
} else {
|
||||
span = new AnimatedEmojiSpan(documentId, captionEditText.getMessageEditText().getPaint().getFontMetricsInt());
|
||||
}
|
||||
emoji.setSpan(span, 0, emoji.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
|
||||
captionEditText.replaceWithText(start, len, emoji, false);
|
||||
} catch (Exception ignore) {
|
||||
captionEditText.replaceWithText(start, len, code, true);
|
||||
}
|
||||
} else {
|
||||
captionEditText.replaceWithText(start, len, code, true);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
|
@ -6241,6 +6262,14 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat
|
|||
}
|
||||
}
|
||||
doneButtonPressed = true;
|
||||
if (videoEditedInfo != null) {
|
||||
long sizeToCheck = (long) (videoEditedInfo.estimatedSize * 0.9f);
|
||||
if ((sizeToCheck > FileLoader.DEFAULT_MAX_FILE_SIZE && !UserConfig.getInstance(currentAccount).isPremium()) || sizeToCheck > FileLoader.DEFAULT_MAX_FILE_SIZE_PREMIUM) {
|
||||
LimitReachedBottomSheet limitReachedBottomSheet = new LimitReachedBottomSheet(parentAlert.getBaseFragment(), parentAlert.getContainer().getContext(), LimitReachedBottomSheet.TYPE_LARGE_FILE, UserConfig.selectedAccount);
|
||||
limitReachedBottomSheet.show();
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (!replace) {
|
||||
if (autoDeletable) {
|
||||
placeProvider.sendButtonPressed(currentIndex, videoEditedInfo, notify, -delay, forceDocument);
|
||||
|
|
@ -6457,6 +6486,8 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat
|
|||
}
|
||||
}
|
||||
|
||||
private Layout lastLayout;
|
||||
|
||||
@Override
|
||||
protected void onDraw(Canvas canvas) {
|
||||
canvas.save();
|
||||
|
|
@ -6466,6 +6497,34 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat
|
|||
}
|
||||
canvas.restore();
|
||||
super.onDraw(canvas);
|
||||
if (lastLayout != getLayout()) {
|
||||
animatedEmojiDrawables = AnimatedEmojiSpan.update(AnimatedEmojiDrawable.CACHE_TYPE_MESSAGES, this, animatedEmojiDrawables, getLayout());
|
||||
lastLayout = getLayout();
|
||||
}
|
||||
}
|
||||
|
||||
private AnimatedEmojiSpan.EmojiGroupedSpans animatedEmojiDrawables;
|
||||
|
||||
@Override
|
||||
protected void onDetachedFromWindow() {
|
||||
super.onDetachedFromWindow();
|
||||
AnimatedEmojiSpan.release(this, animatedEmojiDrawables);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onTextChanged(CharSequence text, int start, int lengthBefore, int lengthAfter) {
|
||||
super.onTextChanged(text, start, lengthBefore, lengthAfter);
|
||||
animatedEmojiDrawables = AnimatedEmojiSpan.update(AnimatedEmojiDrawable.CACHE_TYPE_MESSAGES, this, animatedEmojiDrawables, getLayout());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void dispatchDraw(Canvas canvas) {
|
||||
super.dispatchDraw(canvas);
|
||||
canvas.save();
|
||||
canvas.translate(getPaddingLeft(), getPaddingTop());
|
||||
canvas.clipRect(0, getScrollY(), getWidth() - getPaddingRight(), getHeight() + getScrollY() - getPaddingBottom() * .75f);
|
||||
AnimatedEmojiSpan.drawAnimatedEmojis(canvas, getLayout(), animatedEmojiDrawables, 0, null, 0, 0, 0, 1f);
|
||||
canvas.restore();
|
||||
}
|
||||
};
|
||||
ViewHelper.setPadding(textView, 16, 8, 16, 8);
|
||||
|
|
@ -6903,7 +6962,7 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat
|
|||
}
|
||||
|
||||
private void onUserLeaveHint() {
|
||||
if (pipItem.getAlpha() != 1.0f || !AndroidUtilities.checkInlinePermissions(parentActivity) || PipVideoOverlay.isVisible()) {
|
||||
if (pipItem.getAlpha() != 1.0f || !AndroidUtilities.checkInlinePermissions(parentActivity) || PipVideoOverlay.isVisible() || !isPlaying) {
|
||||
return;
|
||||
}
|
||||
if (isEmbedVideo) {
|
||||
|
|
@ -7092,6 +7151,10 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat
|
|||
selectedPhotosListView.setEnabled(false);
|
||||
photosCounterView.setRotationX(0.0f);
|
||||
isPhotosListViewVisible = false;
|
||||
if (captionEditText.getMessageEditText() != null) {
|
||||
captionEditText.getMessageEditText().invalidateEffects();
|
||||
captionEditText.getMessageEditText().setText(captionEditText.getMessageEditText().getText());
|
||||
}
|
||||
captionEditText.setTag(1);
|
||||
captionEditText.openKeyboard();
|
||||
captionEditText.setImportantForAccessibility(View.IMPORTANT_FOR_ACCESSIBILITY_AUTO);
|
||||
|
|
@ -7277,7 +7340,7 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat
|
|||
Object object = imagesArrLocals.get(currentIndex);
|
||||
if (apply) {
|
||||
CharSequence caption = captionEditText.getFieldCharSequence();
|
||||
CharSequence[] result = new CharSequence[] {caption};
|
||||
CharSequence[] result = new CharSequence[] { caption };
|
||||
|
||||
if (hasCaptionForAllMedia && !TextUtils.equals(captionForAllMedia, caption) && placeProvider.getPhotoIndex(currentIndex) != 0 && placeProvider.getSelectedCount() > 0) {
|
||||
hasCaptionForAllMedia = false;
|
||||
|
|
@ -7357,7 +7420,9 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat
|
|||
if (innerDuration < 20) {
|
||||
return;
|
||||
}
|
||||
if (progress < 0.9f && (document.size * progress >= 5 * 1024 * 1024 || progress >= 0.5f && document.size >= 2 * 1024 * 1024) && Math.abs(SystemClock.elapsedRealtime() - startedPlayTime) >= 2000) {
|
||||
boolean bigFile = document.size >= 2L * 1024 * 1024 * 1024;
|
||||
boolean autoDownload = (DownloadController.getInstance(currentAccount).getAutodownloadMask() & DownloadController.AUTODOWNLOAD_TYPE_VIDEO) != 0;
|
||||
if (autoDownload && progress < 0.9f && (document.size * progress >= 5 * 1024 * 1024 || progress >= 0.5f && document.size >= 2 * 1024 * 1024) && Math.abs(SystemClock.elapsedRealtime() - startedPlayTime) >= (bigFile ? 10000 : 3000)) {
|
||||
long duration = videoPlayer.getDuration();
|
||||
if (duration == C.TIME_UNSET) {
|
||||
Toast toast = Toast.makeText(parentActivity, LocaleController.getString("VideoDoesNotSupportStreaming", R.string.VideoDoesNotSupportStreaming), Toast.LENGTH_LONG);
|
||||
|
|
@ -11681,7 +11746,8 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat
|
|||
detectFaces();
|
||||
}
|
||||
|
||||
private void setCurrentCaption(MessageObject messageObject, final CharSequence caption, boolean animated) {
|
||||
private void setCurrentCaption(MessageObject messageObject, final CharSequence _caption, boolean animated) {
|
||||
final CharSequence caption = AnimatedEmojiSpan.cloneSpans(_caption);
|
||||
if (needCaptionLayout) {
|
||||
if (captionTextViewSwitcher.getParent() != pickerView) {
|
||||
if (captionContainer != null) {
|
||||
|
|
@ -16288,6 +16354,10 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat
|
|||
}
|
||||
|
||||
private int selectCompression() {
|
||||
//1GB
|
||||
if (originalSize > 1024L * 1024L * 1000L) {
|
||||
return compressionsCount - 1;
|
||||
}
|
||||
SharedPreferences preferences = MessagesController.getGlobalMainSettings();
|
||||
int compressionsCount = this.compressionsCount;
|
||||
int maxCompression = 2;
|
||||
|
|
@ -16494,7 +16564,7 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat
|
|||
final int index = ++gettingFrameIndex;
|
||||
Utilities.globalQueue.postRunnable(() -> {
|
||||
try {
|
||||
final AnimatedFileDrawable drawable = new AnimatedFileDrawable(new File(uri.getPath()), true, 0, null, null, null, 0, UserConfig.selectedAccount, false, AndroidUtilities.displaySize.x, AndroidUtilities.displaySize.y);
|
||||
final AnimatedFileDrawable drawable = new AnimatedFileDrawable(new File(uri.getPath()), true, 0, null, null, null, 0, UserConfig.selectedAccount, false, AndroidUtilities.displaySize.x, AndroidUtilities.displaySize.y, null);
|
||||
final Bitmap bitmap = drawable.getFrameAtTime(0);
|
||||
drawable.recycle();
|
||||
AndroidUtilities.runOnUIThread(() -> {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue