Skip to content

Commit

Permalink
Update to 8.4.1
Browse files Browse the repository at this point in the history
  • Loading branch information
xaxtix committed Dec 30, 2021
1 parent 4a43f80 commit 9e740df
Show file tree
Hide file tree
Showing 164 changed files with 51,198 additions and 36,680 deletions.
5 changes: 3 additions & 2 deletions TMessagesProj/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ dependencies {
implementation 'com.google.android.gms:play-services-wallet:18.1.3'
implementation 'com.googlecode.mp4parser:isoparser:1.0.6'
implementation 'com.stripe:stripe-android:2.0.2'
implementation 'com.google.mlkit:language-id:16.1.1'
implementation files('libs/libgsaverification-client.aar')

coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:1.1.5'
Expand Down Expand Up @@ -299,7 +300,7 @@ android {
}
}

defaultConfig.versionCode = 2495
defaultConfig.versionCode = 2522

applicationVariants.all { variant ->
variant.outputs.all { output ->
Expand All @@ -318,7 +319,7 @@ android {
defaultConfig {
minSdkVersion 16
targetSdkVersion 30
versionName "8.3.1"
versionName "8.4.1"

vectorDrawables.generatedDensities = ['mdpi', 'hdpi', 'xhdpi', 'xxhdpi']

Expand Down
3 changes: 3 additions & 0 deletions TMessagesProj/proguard-rules.pro
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@
-keep class com.google.android.exoplayer2.metadata.flac.PictureFrame { *; }
-keep class com.google.android.exoplayer2.decoder.SimpleOutputBuffer { *; }

# https://developers.google.com/ml-kit/known-issues#android_issues
-keep class com.google.mlkit.nl.languageid.internal.LanguageIdentificationJni { *; }

# Constant folding for resource integers may mean that a resource passed to this method appears to be unused. Keep the method to prevent this from happening.
-keep class com.google.android.exoplayer2.upstream.RawResourceDataSource {
public static android.net.Uri buildRawResourceUri(int);
Expand Down
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
import android.animation.AnimatorSet;
import android.animation.ObjectAnimator;
import android.animation.ValueAnimator;
import android.os.Build;
import android.view.View;
import android.view.ViewPropertyAnimator;
import android.view.animation.Interpolator;
Expand Down Expand Up @@ -495,8 +494,9 @@ public boolean animateMove(RecyclerView.ViewHolder holder, ItemHolderInfo info,

if (group == null && params.wasDraw) {
boolean isOut = chatMessageCell.getMessageObject().isOutOwner();
if ((isOut && params.lastDrawingBackgroundRect.left != chatMessageCell.getBackgroundDrawableLeft()) ||
(!isOut && params.lastDrawingBackgroundRect.right != chatMessageCell.getBackgroundDrawableRight()) ||
boolean widthChanged = (isOut && params.lastDrawingBackgroundRect.left != chatMessageCell.getBackgroundDrawableLeft()) ||
(!isOut && params.lastDrawingBackgroundRect.right != chatMessageCell.getBackgroundDrawableRight());
if (widthChanged ||
params.lastDrawingBackgroundRect.top != chatMessageCell.getBackgroundDrawableTop() ||
params.lastDrawingBackgroundRect.bottom != chatMessageCell.getBackgroundDrawableBottom()) {
moveInfo.deltaBottom = chatMessageCell.getBackgroundDrawableBottom() - params.lastDrawingBackgroundRect.bottom;
Expand All @@ -509,6 +509,7 @@ public boolean animateMove(RecyclerView.ViewHolder holder, ItemHolderInfo info,
moveInfo.animateBackgroundOnly = true;

params.animateBackgroundBoundsInner = true;
params.animateBackgroundWidth = widthChanged;
params.deltaLeft = -moveInfo.deltaLeft;
params.deltaRight = -moveInfo.deltaRight;
params.deltaTop = -moveInfo.deltaTop;
Expand Down Expand Up @@ -1208,6 +1209,9 @@ public void groupWillTransformToSingleMessage(MessageObject.GroupedMessages grou
}

public void groupWillChanged(MessageObject.GroupedMessages groupedMessages) {
if (groupedMessages == null) {
return;
}
if (groupedMessages.messages.size() == 0) {
groupedMessages.transitionParams.drawBackgroundForDeletedItems = true;
} else {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
package com.carrotsearch.randomizedtesting;

/**
* Hash routines for primitive types. The implementation is based on the finalization step
* from Austin Appleby's <code>MurmurHash3</code>.
*
* @see "http://sites.google.com/site/murmurhash/"
*/
final class MurmurHash3
{
private MurmurHash3()
{
// no instances.
}

/**
* Hashes a 4-byte sequence (Java int).
*/
public static int hash(int k)
{
k ^= k >>> 16;
k *= 0x85ebca6b;
k ^= k >>> 13;
k *= 0xc2b2ae35;
k ^= k >>> 16;
return k;
}

/**
* Hashes an 8-byte sequence (Java long).
*/
public static long hash(long k)
{
k ^= k >>> 33;
k *= 0xff51afd7ed558ccdL;
k ^= k >>> 33;
k *= 0xc4ceb9fe1a85ec53L;
k ^= k >>> 33;

return k;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
package com.carrotsearch.randomizedtesting;

import java.util.Random;

/**
* Implements Xoroshiro128PlusRandom. Not synchronized (anywhere).
*
* @see "http://xoroshiro.di.unimi.it/"
*/
@SuppressWarnings("serial")
public class Xoroshiro128PlusRandom extends Random {
private static final double DOUBLE_UNIT = 0x1.0p-53; // 1.0 / (1L << 53);
private static final float FLOAT_UNIT = 0x1.0p-24f; // 1.0 / (1L << 24);

private long s0, s1;

public Xoroshiro128PlusRandom(long seed) {
// Must be here, the only Random constructor. Has side-effects on setSeed, see below.
super(0);

s0 = MurmurHash3.hash(seed);
s1 = MurmurHash3.hash(s0);

if (s0 == 0 && s1 == 0) {
s0 = MurmurHash3.hash(0xdeadbeefL);
s1 = MurmurHash3.hash(s0);
}
}

@Override
public void setSeed(long seed) {
// Called from super constructor and observing uninitialized state?
if (s0 == 0 && s1 == 0) {
return;
}

throw new RuntimeException("No seed set");
}

@Override
public boolean nextBoolean() {
return nextLong() >= 0;
}

@Override
public void nextBytes(byte[] bytes) {
for (int i = 0, len = bytes.length; i < len; ) {
long rnd = nextInt();
for (int n = Math.min(len - i, 8); n-- > 0; rnd >>>= 8) {
bytes[i++] = (byte) rnd;
}
}
}

@Override
public double nextDouble() {
return (nextLong() >>> 11) * DOUBLE_UNIT;
}

@Override
public float nextFloat() {
return (nextInt() >>> 8) * FLOAT_UNIT;
}

@Override
public int nextInt() {
return (int) nextLong();
}

@Override
public int nextInt(int n) {
// Leave superclass's implementation.
return super.nextInt(n);
}

@Override
public double nextGaussian() {
// Leave superclass's implementation.
return super.nextGaussian();
}

@Override
public long nextLong() {
final long s0 = this.s0;
long s1 = this.s1;
final long result = s0 + s1;
s1 ^= s0;
this.s0 = Long.rotateLeft(s0, 55) ^ s1 ^ s1 << 14;
this.s1 = Long.rotateLeft(s1, 36);
return result;
}

@Override
protected int next(int bits) {
return ((int) nextLong()) >>> (32 - bits);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,15 @@

package com.google.zxing.qrcode;

import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.drawable.Drawable;
import android.graphics.Path;
import android.graphics.RectF;
import android.graphics.Region;
import android.graphics.drawable.GradientDrawable;

import com.google.zxing.BarcodeFormat;
import com.google.zxing.EncodeHintType;
import com.google.zxing.WriterException;
import com.google.zxing.qrcode.encoder.ByteMatrix;
Expand All @@ -33,7 +34,6 @@

import org.telegram.messenger.R;
import org.telegram.messenger.SvgHelper;
import org.telegram.ui.ActionBar.Theme;
import org.telegram.ui.Components.RLottieDrawable;

import java.util.Arrays;
Expand All @@ -55,7 +55,11 @@ public final class QRCodeWriter {

private int imageSize;

public Bitmap encode(String contents, BarcodeFormat format, int width, int height, Map<EncodeHintType, ?> hints, Bitmap bitmap, Context context) throws WriterException {
public Bitmap encode(String contents, int width, int height, Map<EncodeHintType, ?> hints, Bitmap bitmap) throws WriterException {
return encode(contents, width, height, hints, bitmap, 1.0f, 0xffffffff, 0xff000000);
}

public Bitmap encode(String contents, int width, int height, Map<EncodeHintType, ?> hints, Bitmap bitmap, float radiusFactor, int backgroundColor, int color) throws WriterException {

if (contents.isEmpty()) {
throw new IllegalArgumentException("Found empty contents");
Expand Down Expand Up @@ -107,9 +111,9 @@ public Bitmap encode(String contents, BarcodeFormat format, int width, int heigh
bitmap = Bitmap.createBitmap(size, size, Bitmap.Config.ARGB_8888);
}
Canvas canvas = new Canvas(bitmap);
canvas.drawColor(0xffffffff);
canvas.drawColor(backgroundColor);
Paint blackPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
blackPaint.setColor(0xff000000);
blackPaint.setColor(color);

GradientDrawable rect = new GradientDrawable();
rect.setShape(GradientDrawable.RECTANGLE);
Expand All @@ -123,6 +127,9 @@ public Bitmap encode(String contents, BarcodeFormat format, int width, int heigh
imageSize = imageBloks * multiple - 24;
int imageX = (size - imageSize) / 2;

boolean isTransparentBackground = Color.alpha(backgroundColor) == 0;
Path clipPath = new Path();
RectF rectF = new RectF();
for (int a = 0; a < 3; a++) {
int x, y;
if (a == 0) {
Expand All @@ -136,28 +143,41 @@ public Bitmap encode(String contents, BarcodeFormat format, int width, int heigh
y = size - sideQuadSize * multiple - padding;
}

float r = (sideQuadSize * multiple) / 3.0f;
float r;
if (isTransparentBackground) {
rectF.set(x + multiple, y + multiple, x + (sideQuadSize - 1) * multiple, y + (sideQuadSize - 1) * multiple);
r = (sideQuadSize * multiple) / 4.0f * radiusFactor;
clipPath.reset();
clipPath.addRoundRect(rectF, r, r, Path.Direction.CW);
clipPath.close();
canvas.save();
canvas.clipPath(clipPath, Region.Op.DIFFERENCE);
}
r = (sideQuadSize * multiple) / 3.0f * radiusFactor;
Arrays.fill(radii, r);

rect.setColor(0xff000000);
rect.setColor(color);
rect.setBounds(x, y, x + sideQuadSize * multiple, y + sideQuadSize * multiple);
rect.draw(canvas);

canvas.drawRect(x + multiple, y + multiple, x + (sideQuadSize - 1) * multiple, y + (sideQuadSize - 1) * multiple, blackPaint);
if (isTransparentBackground) {
canvas.restore();
}

r = (sideQuadSize * multiple) / 4.0f;
Arrays.fill(radii, r);
rect.setColor(0xffffffff);
rect.setBounds(x + multiple, y + multiple, x + (sideQuadSize - 1) * multiple, y + (sideQuadSize - 1) * multiple);
rect.draw(canvas);
if (!isTransparentBackground) {
r = (sideQuadSize * multiple) / 4.0f * radiusFactor;
Arrays.fill(radii, r);
rect.setColor(backgroundColor);
rect.setBounds(x + multiple, y + multiple, x + (sideQuadSize - 1) * multiple, y + (sideQuadSize - 1) * multiple);
rect.draw(canvas);
}

r = ((sideQuadSize - 2) * multiple) / 4.0f;
r = ((sideQuadSize - 2) * multiple) / 4.0f * radiusFactor;
Arrays.fill(radii, r);
rect.setColor(0xff000000);
rect.setColor(color);
rect.setBounds(x + multiple * 2, y + multiple * 2, x + (sideQuadSize - 2) * multiple, y + (sideQuadSize - 2) * multiple);
rect.draw(canvas);
}
float r = multiple / 2.0f;
float r = multiple / 2.0f * radiusFactor;

for (int y = 0, outputY = padding; y < inputHeight; y++, outputY += multiple) {
for (int x = 0, outputX = padding; x < inputWidth; x++, outputX += multiple) {
Expand All @@ -179,7 +199,7 @@ public Bitmap encode(String contents, BarcodeFormat format, int width, int heigh
radii[2] = radii[3] = 0;
radii[4] = radii[5] = 0;
}
rect.setColor(0xff000000);
rect.setColor(color);
rect.setBounds(outputX, outputY, outputX + multiple, outputY + multiple);
rect.draw(canvas);
} else {
Expand All @@ -201,9 +221,9 @@ public Bitmap encode(String contents, BarcodeFormat format, int width, int heigh
radii[4] = radii[5] = r;
has = true;
}
if (has) {
if (has && !isTransparentBackground) {
canvas.drawRect(outputX, outputY, outputX + multiple, outputY + multiple, blackPaint);
rect.setColor(0xffffffff);
rect.setColor(backgroundColor);
rect.setBounds(outputX, outputY, outputX + multiple, outputY + multiple);
rect.draw(canvas);
}
Expand All @@ -213,10 +233,6 @@ public Bitmap encode(String contents, BarcodeFormat format, int width, int heigh

String svg = RLottieDrawable.readRes(null, R.raw.qr_logo);
Bitmap icon = SvgHelper.getBitmap(svg, imageSize, imageSize, false);

// Drawable drawable = context.getResources().getDrawable(R.drawable.ic_launcher_dr).mutate();
// drawable.setBounds(imageX, imageX, imageX + imageSize, imageX + imageSize);
// drawable.draw(canvas);
canvas.drawBitmap(icon, imageX, imageX, null);
icon.recycle();

Expand Down
Loading

0 comments on commit 9e740df

Please sign in to comment.