diff --git a/TMessagesProj/build.gradle b/TMessagesProj/build.gradle
index 84dc35852..cf9848807 100644
--- a/TMessagesProj/build.gradle
+++ b/TMessagesProj/build.gradle
@@ -5,11 +5,11 @@ repositories {
}
dependencies {
- compile 'com.android.support:support-v4:23.3.0'
+ compile 'com.android.support:support-v4:23.4.0'
compile "com.google.android.gms:play-services-gcm:8.4.0"
compile "com.google.android.gms:play-services-maps:8.4.0"
- compile 'net.hockeyapp.android:HockeySDK:4.0.+'
- compile 'com.googlecode.mp4parser:isoparser:1.0.+'
+ compile 'net.hockeyapp.android:HockeySDK:4.0.1'
+ compile 'com.googlecode.mp4parser:isoparser:1.0.6'
}
android {
@@ -63,7 +63,7 @@ android {
}
}
- defaultConfig.versionCode = 803
+ defaultConfig.versionCode = 821
sourceSets.main {
jniLibs.srcDir 'libs'
@@ -112,9 +112,9 @@ android {
}
defaultConfig {
- minSdkVersion 9
+ minSdkVersion 14
targetSdkVersion 23
- versionName "3.9.0"
+ versionName "3.10.1"
}
}
diff --git a/TMessagesProj/config/debug/AndroidManifest.xml b/TMessagesProj/config/debug/AndroidManifest.xml
index 9a53515fe..176edd31f 100644
--- a/TMessagesProj/config/debug/AndroidManifest.xml
+++ b/TMessagesProj/config/debug/AndroidManifest.xml
@@ -1,5 +1,6 @@
@@ -62,6 +63,22 @@
+
+
+
+
+
+
+
+
+
diff --git a/TMessagesProj/config/release/AndroidManifest.xml b/TMessagesProj/config/release/AndroidManifest.xml
index 54502f173..8bb0cb0de 100644
--- a/TMessagesProj/config/release/AndroidManifest.xml
+++ b/TMessagesProj/config/release/AndroidManifest.xml
@@ -1,5 +1,6 @@
@@ -62,6 +63,21 @@
+
+
+
+
+
+
+
+
diff --git a/TMessagesProj/google-services.json b/TMessagesProj/google-services.json
old mode 100644
new mode 100755
index 0002195c2..9403433ed
--- a/TMessagesProj/google-services.json
+++ b/TMessagesProj/google-services.json
@@ -18,22 +18,9 @@
"oauth_client": [],
"api_key": [],
"services": {
- "analytics_service": {
- "status": 1
- },
"cloud_messaging_service": {
"status": 2,
"apns_config": []
- },
- "appinvite_service": {
- "status": 1,
- "other_platform_oauth_client": []
- },
- "google_signin_service": {
- "status": 1
- },
- "ads_service": {
- "status": 1
}
}
},
@@ -50,22 +37,9 @@
"oauth_client": [],
"api_key": [],
"services": {
- "analytics_service": {
- "status": 1
- },
"cloud_messaging_service": {
"status": 2,
"apns_config": []
- },
- "appinvite_service": {
- "status": 1,
- "other_platform_oauth_client": []
- },
- "google_signin_service": {
- "status": 1
- },
- "ads_service": {
- "status": 1
}
}
}
diff --git a/TMessagesProj/jni/Android.mk b/TMessagesProj/jni/Android.mk
index d680d15d2..bbcdfab94 100755
--- a/TMessagesProj/jni/Android.mk
+++ b/TMessagesProj/jni/Android.mk
@@ -265,6 +265,8 @@ else
else
ifeq ($(TARGET_ARCH_ABI),x86)
+ LOCAL_CPPFLAGS += -Dx86fix
+ LOCAL_CFLAGS += -Dx86fix
LOCAL_ARM_MODE := arm
LOCAL_SRC_FILE += \
./libyuv/source/row_x86.asm
diff --git a/TMessagesProj/jni/libyuv/include/libyuv/convert.h b/TMessagesProj/jni/libyuv/include/libyuv/convert.h
index a8d3fa07a..a2cdc5718 100644
--- a/TMessagesProj/jni/libyuv/include/libyuv/convert.h
+++ b/TMessagesProj/jni/libyuv/include/libyuv/convert.h
@@ -12,10 +12,8 @@
#define INCLUDE_LIBYUV_CONVERT_H_
#include "libyuv/basic_types.h"
-// TODO(fbarchard): Remove the following headers includes.
-#include "libyuv/convert_from.h"
-#include "libyuv/planar_functions.h"
-#include "libyuv/rotate.h"
+
+#include "libyuv/rotate.h" // For enum RotationMode.
#ifdef __cplusplus
namespace libyuv {
diff --git a/TMessagesProj/jni/libyuv/include/libyuv/convert_argb.h b/TMessagesProj/jni/libyuv/include/libyuv/convert_argb.h
index ce4e3d075..079d273b1 100644
--- a/TMessagesProj/jni/libyuv/include/libyuv/convert_argb.h
+++ b/TMessagesProj/jni/libyuv/include/libyuv/convert_argb.h
@@ -12,10 +12,8 @@
#define INCLUDE_LIBYUV_CONVERT_ARGB_H_
#include "libyuv/basic_types.h"
-// TODO(fbarchard): Remove the following headers includes
-#include "libyuv/convert_from.h"
-#include "libyuv/planar_functions.h"
-#include "libyuv/rotate.h"
+
+#include "libyuv/rotate.h" // For enum RotationMode.
// TODO(fbarchard): This set of functions should exactly match convert.h
// TODO(fbarchard): Add tests. Create random content of right size and convert
diff --git a/TMessagesProj/jni/libyuv/include/libyuv/convert_from.h b/TMessagesProj/jni/libyuv/include/libyuv/convert_from.h
index 9fd8d4de5..39e1578a0 100644
--- a/TMessagesProj/jni/libyuv/include/libyuv/convert_from.h
+++ b/TMessagesProj/jni/libyuv/include/libyuv/convert_from.h
@@ -56,8 +56,6 @@ int I400Copy(const uint8* src_y, int src_stride_y,
uint8* dst_y, int dst_stride_y,
int width, int height);
-// TODO(fbarchard): I420ToM420
-
LIBYUV_API
int I420ToNV12(const uint8* src_y, int src_stride_y,
const uint8* src_u, int src_stride_u,
diff --git a/TMessagesProj/jni/libyuv/include/libyuv/cpu_id.h b/TMessagesProj/jni/libyuv/include/libyuv/cpu_id.h
index 2ccc3e7dd..dfb7445e2 100644
--- a/TMessagesProj/jni/libyuv/include/libyuv/cpu_id.h
+++ b/TMessagesProj/jni/libyuv/include/libyuv/cpu_id.h
@@ -62,7 +62,7 @@ static __inline int TestCpuFlag(int test_flag) {
// For testing, allow CPU flags to be disabled.
// ie MaskCpuFlags(~kCpuHasSSSE3) to disable SSSE3.
// MaskCpuFlags(-1) to enable all cpu specific optimizations.
-// MaskCpuFlags(0) to disable all cpu specific optimizations.
+// MaskCpuFlags(1) to disable all cpu specific optimizations.
LIBYUV_API
void MaskCpuFlags(int enable_flags);
diff --git a/TMessagesProj/jni/libyuv/include/libyuv/planar_functions.h b/TMessagesProj/jni/libyuv/include/libyuv/planar_functions.h
index 9c19a59df..881b0c5c6 100644
--- a/TMessagesProj/jni/libyuv/include/libyuv/planar_functions.h
+++ b/TMessagesProj/jni/libyuv/include/libyuv/planar_functions.h
@@ -288,6 +288,12 @@ int ARGBCopyAlpha(const uint8* src_argb, int src_stride_argb,
uint8* dst_argb, int dst_stride_argb,
int width, int height);
+// Extract the alpha channel from ARGB.
+LIBYUV_API
+int ARGBExtractAlpha(const uint8* src_argb, int src_stride_argb,
+ uint8* dst_a, int dst_stride_a,
+ int width, int height);
+
// Copy Y channel to Alpha of ARGB.
LIBYUV_API
int ARGBCopyYToAlpha(const uint8* src_y, int src_stride_y,
diff --git a/TMessagesProj/jni/libyuv/include/libyuv/row.h b/TMessagesProj/jni/libyuv/include/libyuv/row.h
index b5d9aaa17..8dae60166 100644
--- a/TMessagesProj/jni/libyuv/include/libyuv/row.h
+++ b/TMessagesProj/jni/libyuv/include/libyuv/row.h
@@ -104,6 +104,7 @@ extern "C" {
#define HAS_ARGBTOUVROW_SSSE3
#define HAS_ARGBTOYJROW_SSSE3
#define HAS_ARGBTOYROW_SSSE3
+#define HAS_ARGBEXTRACTALPHAROW_SSE2
#define HAS_BGRATOUVROW_SSSE3
#define HAS_BGRATOYROW_SSSE3
#define HAS_COPYROW_ERMS
@@ -179,8 +180,7 @@ extern "C" {
// The following functions fail on gcc/clang 32 bit with fpic and framepointer.
// caveat: clangcl uses row_win.cc which works.
-#if defined(NDEBUG) || !(defined(_DEBUG) && defined(__i386__)) || \
- !defined(__i386__) || defined(_MSC_VER)
+#if !defined(x86fix)
// TODO(fbarchard): fix build error on x86 debug
// https://code.google.com/p/libyuv/issues/detail?id=524
#define HAS_I411TOARGBROW_SSSE3
@@ -208,7 +208,7 @@ extern "C" {
#define HAS_COPYROW_AVX
#define HAS_H422TOARGBROW_AVX2
#define HAS_I400TOARGBROW_AVX2
-#if !(defined(_DEBUG) && defined(__i386__))
+#if !defined(x86fix)
// TODO(fbarchard): fix build error on android_full_debug=1
// https://code.google.com/p/libyuv/issues/detail?id=517
#define HAS_I422ALPHATOARGBROW_AVX2
@@ -291,6 +291,7 @@ extern "C" {
#define HAS_ARGBTOUVROW_NEON
#define HAS_ARGBTOYJROW_NEON
#define HAS_ARGBTOYROW_NEON
+#define HAS_ARGBEXTRACTALPHAROW_NEON
#define HAS_BGRATOUVROW_NEON
#define HAS_BGRATOYROW_NEON
#define HAS_COPYROW_NEON
@@ -877,6 +878,14 @@ void ARGBCopyAlphaRow_Any_SSE2(const uint8* src_argb, uint8* dst_argb,
void ARGBCopyAlphaRow_Any_AVX2(const uint8* src_argb, uint8* dst_argb,
int width);
+void ARGBExtractAlphaRow_C(const uint8* src_argb, uint8* dst_a, int width);
+void ARGBExtractAlphaRow_SSE2(const uint8* src_argb, uint8* dst_a, int width);
+void ARGBExtractAlphaRow_NEON(const uint8* src_argb, uint8* dst_a, int width);
+void ARGBExtractAlphaRow_Any_SSE2(const uint8* src_argb, uint8* dst_a,
+ int width);
+void ARGBExtractAlphaRow_Any_NEON(const uint8* src_argb, uint8* dst_a,
+ int width);
+
void ARGBCopyYToAlphaRow_C(const uint8* src_y, uint8* dst_argb, int width);
void ARGBCopyYToAlphaRow_SSE2(const uint8* src_y, uint8* dst_argb, int width);
void ARGBCopyYToAlphaRow_AVX2(const uint8* src_y, uint8* dst_argb, int width);
diff --git a/TMessagesProj/jni/libyuv/include/libyuv/version.h b/TMessagesProj/jni/libyuv/include/libyuv/version.h
index f1e6ae2f2..3a6bbe3cb 100644
--- a/TMessagesProj/jni/libyuv/include/libyuv/version.h
+++ b/TMessagesProj/jni/libyuv/include/libyuv/version.h
@@ -11,6 +11,6 @@
#ifndef INCLUDE_LIBYUV_VERSION_H_ // NOLINT
#define INCLUDE_LIBYUV_VERSION_H_
-#define LIBYUV_VERSION 1586
+#define LIBYUV_VERSION 1597
#endif // INCLUDE_LIBYUV_VERSION_H_ NOLINT
diff --git a/TMessagesProj/jni/libyuv/source/convert_argb.cc b/TMessagesProj/jni/libyuv/source/convert_argb.cc
index e586f7043..fb9582d62 100644
--- a/TMessagesProj/jni/libyuv/source/convert_argb.cc
+++ b/TMessagesProj/jni/libyuv/source/convert_argb.cc
@@ -14,6 +14,7 @@
#ifdef HAVE_JPEG
#include "libyuv/mjpeg_decoder.h"
#endif
+#include "libyuv/planar_functions.h" // For CopyPlane and ARGBShuffle.
#include "libyuv/rotate_argb.h"
#include "libyuv/row.h"
#include "libyuv/video_common.h"
diff --git a/TMessagesProj/jni/libyuv/source/convert_from.cc b/TMessagesProj/jni/libyuv/source/convert_from.cc
index 3bc9eb1be..46abdebcd 100644
--- a/TMessagesProj/jni/libyuv/source/convert_from.cc
+++ b/TMessagesProj/jni/libyuv/source/convert_from.cc
@@ -1077,7 +1077,6 @@ int ConvertFromI420(const uint8* y, int y_stride,
// Triplanar formats
// TODO(fbarchard): halfstride instead of halfwidth
case FOURCC_I420:
- case FOURCC_YU12:
case FOURCC_YV12: {
int halfwidth = (width + 1) / 2;
int halfheight = (height + 1) / 2;
diff --git a/TMessagesProj/jni/libyuv/source/convert_jpeg.cc b/TMessagesProj/jni/libyuv/source/convert_jpeg.cc
index bcb980f7f..90f550a26 100644
--- a/TMessagesProj/jni/libyuv/source/convert_jpeg.cc
+++ b/TMessagesProj/jni/libyuv/source/convert_jpeg.cc
@@ -9,6 +9,7 @@
*/
#include "libyuv/convert.h"
+#include "libyuv/convert_argb.h"
#ifdef HAVE_JPEG
#include "libyuv/mjpeg_decoder.h"
diff --git a/TMessagesProj/jni/libyuv/source/convert_to_argb.cc b/TMessagesProj/jni/libyuv/source/convert_to_argb.cc
index 7533f5010..aecdc80fd 100644
--- a/TMessagesProj/jni/libyuv/source/convert_to_argb.cc
+++ b/TMessagesProj/jni/libyuv/source/convert_to_argb.cc
@@ -176,7 +176,6 @@ int ConvertToARGB(const uint8* sample, size_t sample_size,
break;
// Triplanar formats
case FOURCC_I420:
- case FOURCC_YU12:
case FOURCC_YV12: {
const uint8* src_y = sample + (src_width * crop_y + crop_x);
const uint8* src_u;
diff --git a/TMessagesProj/jni/libyuv/source/convert_to_i420.cc b/TMessagesProj/jni/libyuv/source/convert_to_i420.cc
index 5e75369b5..e5f307c44 100644
--- a/TMessagesProj/jni/libyuv/source/convert_to_i420.cc
+++ b/TMessagesProj/jni/libyuv/source/convert_to_i420.cc
@@ -39,12 +39,13 @@ int ConvertToI420(const uint8* sample,
int aligned_src_width = (src_width + 1) & ~1;
const uint8* src;
const uint8* src_uv;
- int abs_src_height = (src_height < 0) ? -src_height : src_height;
- int inv_crop_height = (crop_height < 0) ? -crop_height : crop_height;
+ const int abs_src_height = (src_height < 0) ? -src_height : src_height;
+ // TODO(nisse): Why allow crop_height < 0?
+ const int abs_crop_height = (crop_height < 0) ? -crop_height : crop_height;
int r = 0;
LIBYUV_BOOL need_buf = (rotation && format != FOURCC_I420 &&
format != FOURCC_NV12 && format != FOURCC_NV21 &&
- format != FOURCC_YU12 && format != FOURCC_YV12) || y == sample;
+ format != FOURCC_YV12) || y == sample;
uint8* tmp_y = y;
uint8* tmp_u = u;
uint8* tmp_v = v;
@@ -52,16 +53,14 @@ int ConvertToI420(const uint8* sample,
int tmp_u_stride = u_stride;
int tmp_v_stride = v_stride;
uint8* rotate_buffer = NULL;
- int abs_crop_height = (crop_height < 0) ? -crop_height : crop_height;
+ const int inv_crop_height =
+ (src_height < 0) ? -abs_crop_height : abs_crop_height;
if (!y || !u || !v || !sample ||
src_width <= 0 || crop_width <= 0 ||
src_height == 0 || crop_height == 0) {
return -1;
}
- if (src_height < 0) {
- inv_crop_height = -inv_crop_height;
- }
// One pass rotation is available for some formats. For the rest, convert
// to I420 (with optional vertical flipping) into a temporary I420 buffer,
@@ -214,7 +213,6 @@ int ConvertToI420(const uint8* sample,
break;
// Triplanar formats
case FOURCC_I420:
- case FOURCC_YU12:
case FOURCC_YV12: {
const uint8* src_y = sample + (src_width * crop_y + crop_x);
const uint8* src_u;
diff --git a/TMessagesProj/jni/libyuv/source/planar_functions.cc b/TMessagesProj/jni/libyuv/source/planar_functions.cc
index 73fa7d284..237ab6831 100644
--- a/TMessagesProj/jni/libyuv/source/planar_functions.cc
+++ b/TMessagesProj/jni/libyuv/source/planar_functions.cc
@@ -2374,6 +2374,49 @@ int ARGBCopyAlpha(const uint8* src_argb, int src_stride_argb,
return 0;
}
+// Extract just the alpha channel from ARGB.
+LIBYUV_API
+int ARGBExtractAlpha(const uint8* src_argb, int src_stride,
+ uint8* dst_a, int dst_stride,
+ int width, int height) {
+ if (!src_argb || !dst_a || width <= 0 || height == 0) {
+ return -1;
+ }
+ // Negative height means invert the image.
+ if (height < 0) {
+ height = -height;
+ src_argb += (height - 1) * src_stride;
+ src_stride = -src_stride;
+ }
+ // Coalesce rows.
+ if (src_stride == width * 4 && dst_stride == width) {
+ width *= height;
+ height = 1;
+ src_stride = dst_stride = 0;
+ }
+ void (*ARGBExtractAlphaRow)(const uint8 *src_argb, uint8 *dst_a, int width) =
+ ARGBExtractAlphaRow_C;
+#if defined(HAS_ARGBEXTRACTALPHAROW_SSE2)
+ if (TestCpuFlag(kCpuHasSSE2)) {
+ ARGBExtractAlphaRow = IS_ALIGNED(width, 8) ? ARGBExtractAlphaRow_SSE2
+ : ARGBExtractAlphaRow_Any_SSE2;
+ }
+#endif
+#if defined(HAS_ARGBEXTRACTALPHAROW_NEON)
+ if (TestCpuFlag(kCpuHasNEON)) {
+ ARGBExtractAlphaRow = IS_ALIGNED(width, 16) ? ARGBExtractAlphaRow_NEON
+ : ARGBExtractAlphaRow_Any_NEON;
+ }
+#endif
+
+ for (int y = 0; y < height; ++y) {
+ ARGBExtractAlphaRow(src_argb, dst_a, width);
+ src_argb += src_stride;
+ dst_a += dst_stride;
+ }
+ return 0;
+}
+
// Copy a planar Y channel to the alpha channel of a destination ARGB image.
LIBYUV_API
int ARGBCopyYToAlpha(const uint8* src_y, int src_stride_y,
diff --git a/TMessagesProj/jni/libyuv/source/rotate_mips.cc b/TMessagesProj/jni/libyuv/source/rotate_mips.cc
index 23e89fbad..1e8ce2519 100644
--- a/TMessagesProj/jni/libyuv/source/rotate_mips.cc
+++ b/TMessagesProj/jni/libyuv/source/rotate_mips.cc
@@ -23,7 +23,7 @@ extern "C" {
(_MIPS_SIM == _MIPS_SIM_ABI32)
void TransposeWx8_DSPR2(const uint8* src, int src_stride,
- uint8* dst, int dst_stride, int width) {
+ uint8* dst, int dst_stride, int width) {
__asm__ __volatile__ (
".set push \n"
".set noreorder \n"
@@ -107,7 +107,7 @@ void TransposeWx8_DSPR2(const uint8* src, int src_stride,
}
void TransposeWx8_Fast_DSPR2(const uint8* src, int src_stride,
- uint8* dst, int dst_stride, int width) {
+ uint8* dst, int dst_stride, int width) {
__asm__ __volatile__ (
".set noat \n"
".set push \n"
@@ -309,9 +309,9 @@ void TransposeWx8_Fast_DSPR2(const uint8* src, int src_stride,
}
void TransposeUVWx8_DSPR2(const uint8* src, int src_stride,
- uint8* dst_a, int dst_stride_a,
- uint8* dst_b, int dst_stride_b,
- int width) {
+ uint8* dst_a, int dst_stride_a,
+ uint8* dst_b, int dst_stride_b,
+ int width) {
__asm__ __volatile__ (
".set push \n"
".set noreorder \n"
diff --git a/TMessagesProj/jni/libyuv/source/row_any.cc b/TMessagesProj/jni/libyuv/source/row_any.cc
index 29b7a343d..494164fd0 100644
--- a/TMessagesProj/jni/libyuv/source/row_any.cc
+++ b/TMessagesProj/jni/libyuv/source/row_any.cc
@@ -466,38 +466,15 @@ ANY11(ARGBUnattenuateRow_Any_AVX2, ARGBUnattenuateRow_AVX2, 0, 4, 4, 7)
#ifdef HAS_ARGBATTENUATEROW_NEON
ANY11(ARGBAttenuateRow_Any_NEON, ARGBAttenuateRow_NEON, 0, 4, 4, 7)
#endif
+#ifdef HAS_ARGBEXTRACTALPHAROW_SSE2
+ANY11(ARGBExtractAlphaRow_Any_SSE2, ARGBExtractAlphaRow_SSE2, 0, 4, 1, 7)
+#endif
+#ifdef HAS_ARGBEXTRACTALPHAROW_NEON
+ANY11(ARGBExtractAlphaRow_Any_NEON, ARGBExtractAlphaRow_NEON, 0, 4, 1, 15)
+#endif
#undef ANY11
-// Any 1 to 1 with yuvconstants
-#define ANY11C(NAMEANY, ANY_SIMD, UVSHIFT, SBPP, BPP, MASK) \
- void NAMEANY(const uint8* src_ptr, uint8* dst_ptr, \
- const struct YuvConstants* yuvconstants, int width) { \
- SIMD_ALIGNED(uint8 temp[128 * 2]); \
- memset(temp, 0, 128); /* for YUY2 and msan */ \
- int r = width & MASK; \
- int n = width & ~MASK; \
- if (n > 0) { \
- ANY_SIMD(src_ptr, dst_ptr, yuvconstants, n); \
- } \
- memcpy(temp, src_ptr + (n >> UVSHIFT) * SBPP, SS(r, UVSHIFT) * SBPP); \
- ANY_SIMD(temp, temp + 128, yuvconstants, MASK + 1); \
- memcpy(dst_ptr + n * BPP, temp + 128, r * BPP); \
- }
-#if defined(HAS_YUY2TOARGBROW_SSSE3)
-ANY11C(YUY2ToARGBRow_Any_SSSE3, YUY2ToARGBRow_SSSE3, 1, 4, 4, 15)
-ANY11C(UYVYToARGBRow_Any_SSSE3, UYVYToARGBRow_SSSE3, 1, 4, 4, 15)
-#endif
-#if defined(HAS_YUY2TOARGBROW_AVX2)
-ANY11C(YUY2ToARGBRow_Any_AVX2, YUY2ToARGBRow_AVX2, 1, 4, 4, 31)
-ANY11C(UYVYToARGBRow_Any_AVX2, UYVYToARGBRow_AVX2, 1, 4, 4, 31)
-#endif
-#if defined(HAS_YUY2TOARGBROW_NEON)
-ANY11C(YUY2ToARGBRow_Any_NEON, YUY2ToARGBRow_NEON, 1, 4, 4, 7)
-ANY11C(UYVYToARGBRow_Any_NEON, UYVYToARGBRow_NEON, 1, 4, 4, 7)
-#endif
-#undef ANY11C
-
-// Any 1 to 1 blended.
+// Any 1 to 1 blended. Destination is read, modify, write.
#define ANY11B(NAMEANY, ANY_SIMD, UVSHIFT, SBPP, BPP, MASK) \
void NAMEANY(const uint8* src_ptr, uint8* dst_ptr, int width) { \
SIMD_ALIGNED(uint8 temp[128 * 2]); \
@@ -516,7 +493,7 @@ ANY11C(UYVYToARGBRow_Any_NEON, UYVYToARGBRow_NEON, 1, 4, 4, 7)
#ifdef HAS_ARGBCOPYALPHAROW_AVX2
ANY11B(ARGBCopyAlphaRow_Any_AVX2, ARGBCopyAlphaRow_AVX2, 0, 4, 4, 15)
#endif
-#ifdef HAS_ARGBCOPYYTOALPHAROW_SSE2
+#ifdef HAS_ARGBCOPYALPHAROW_SSE2
ANY11B(ARGBCopyAlphaRow_Any_SSE2, ARGBCopyAlphaRow_SSE2, 0, 4, 4, 7)
#endif
#ifdef HAS_ARGBCOPYYTOALPHAROW_AVX2
@@ -569,6 +546,35 @@ ANY11P(ARGBShuffleRow_Any_NEON, ARGBShuffleRow_NEON, const uint8*, 4, 4, 3)
#endif
#undef ANY11P
+// Any 1 to 1 with yuvconstants
+#define ANY11C(NAMEANY, ANY_SIMD, UVSHIFT, SBPP, BPP, MASK) \
+ void NAMEANY(const uint8* src_ptr, uint8* dst_ptr, \
+ const struct YuvConstants* yuvconstants, int width) { \
+ SIMD_ALIGNED(uint8 temp[128 * 2]); \
+ memset(temp, 0, 128); /* for YUY2 and msan */ \
+ int r = width & MASK; \
+ int n = width & ~MASK; \
+ if (n > 0) { \
+ ANY_SIMD(src_ptr, dst_ptr, yuvconstants, n); \
+ } \
+ memcpy(temp, src_ptr + (n >> UVSHIFT) * SBPP, SS(r, UVSHIFT) * SBPP); \
+ ANY_SIMD(temp, temp + 128, yuvconstants, MASK + 1); \
+ memcpy(dst_ptr + n * BPP, temp + 128, r * BPP); \
+ }
+#if defined(HAS_YUY2TOARGBROW_SSSE3)
+ANY11C(YUY2ToARGBRow_Any_SSSE3, YUY2ToARGBRow_SSSE3, 1, 4, 4, 15)
+ANY11C(UYVYToARGBRow_Any_SSSE3, UYVYToARGBRow_SSSE3, 1, 4, 4, 15)
+#endif
+#if defined(HAS_YUY2TOARGBROW_AVX2)
+ANY11C(YUY2ToARGBRow_Any_AVX2, YUY2ToARGBRow_AVX2, 1, 4, 4, 31)
+ANY11C(UYVYToARGBRow_Any_AVX2, UYVYToARGBRow_AVX2, 1, 4, 4, 31)
+#endif
+#if defined(HAS_YUY2TOARGBROW_NEON)
+ANY11C(YUY2ToARGBRow_Any_NEON, YUY2ToARGBRow_NEON, 1, 4, 4, 7)
+ANY11C(UYVYToARGBRow_Any_NEON, UYVYToARGBRow_NEON, 1, 4, 4, 7)
+#endif
+#undef ANY11C
+
// Any 1 to 1 interpolate. Takes 2 rows of source via stride.
#define ANY11T(NAMEANY, ANY_SIMD, SBPP, BPP, MASK) \
void NAMEANY(uint8* dst_ptr, const uint8* src_ptr, \
diff --git a/TMessagesProj/jni/libyuv/source/row_common.cc b/TMessagesProj/jni/libyuv/source/row_common.cc
index 0c47e1016..32d2f686f 100644
--- a/TMessagesProj/jni/libyuv/source/row_common.cc
+++ b/TMessagesProj/jni/libyuv/source/row_common.cc
@@ -2381,6 +2381,19 @@ void ARGBCopyAlphaRow_C(const uint8* src, uint8* dst, int width) {
}
}
+void ARGBExtractAlphaRow_C(const uint8* src_argb, uint8* dst_a, int width) {
+ int i;
+ for (i = 0; i < width - 1; i += 2) {
+ dst_a[0] = src_argb[3];
+ dst_a[1] = src_argb[7];
+ dst_a += 2;
+ src_argb += 8;
+ }
+ if (width & 1) {
+ dst_a[0] = src_argb[3];
+ }
+}
+
void ARGBCopyYToAlphaRow_C(const uint8* src, uint8* dst, int width) {
int i;
for (i = 0; i < width - 1; i += 2) {
diff --git a/TMessagesProj/jni/libyuv/source/row_gcc.cc b/TMessagesProj/jni/libyuv/source/row_gcc.cc
index 866bded79..1ac7ef1aa 100644
--- a/TMessagesProj/jni/libyuv/source/row_gcc.cc
+++ b/TMessagesProj/jni/libyuv/source/row_gcc.cc
@@ -2936,6 +2936,33 @@ void ARGBCopyAlphaRow_AVX2(const uint8* src, uint8* dst, int width) {
}
#endif // HAS_ARGBCOPYALPHAROW_AVX2
+#ifdef HAS_ARGBEXTRACTALPHAROW_SSE2
+// width in pixels
+void ARGBExtractAlphaRow_SSE2(const uint8* src_argb, uint8* dst_a, int width) {
+ asm volatile (
+ LABELALIGN
+ "1: \n"
+ "movdqu " MEMACCESS(0) ", %%xmm0 \n"
+ "movdqu " MEMACCESS2(0x10, 0) ", %%xmm1 \n"
+ "lea " MEMLEA(0x20, 0) ", %0 \n"
+ "psrld $0x18, %%xmm0 \n"
+ "psrld $0x18, %%xmm1 \n"
+ "packssdw %%xmm1, %%xmm0 \n"
+ "packuswb %%xmm0, %%xmm0 \n"
+ "movq %%xmm0," MEMACCESS(1) " \n"
+ "lea " MEMLEA(0x8, 1) ", %1 \n"
+ "sub $0x8, %2 \n"
+ "jg 1b \n"
+ : "+r"(src_argb), // %0
+ "+r"(dst_a), // %1
+ "+rm"(width) // %2
+ :
+ : "memory", "cc"
+ , "xmm0", "xmm1"
+ );
+}
+#endif // HAS_ARGBEXTRACTALPHAROW_SSE2
+
#ifdef HAS_ARGBCOPYYTOALPHAROW_SSE2
// width in pixels
void ARGBCopyYToAlphaRow_SSE2(const uint8* src, uint8* dst, int width) {
@@ -3569,7 +3596,7 @@ void BlendPlaneRow_SSSE3(const uint8* src0, const uint8* src1,
"+r"(src1), // %1
"+r"(alpha), // %2
"+r"(dst), // %3
- "+r"(width) // %4
+ "+rm"(width) // %4
:: "memory", "cc", "eax", "xmm0", "xmm1", "xmm2", "xmm5", "xmm6", "xmm7"
);
}
@@ -3626,7 +3653,7 @@ void BlendPlaneRow_AVX2(const uint8* src0, const uint8* src1,
"+r"(src1), // %1
"+r"(alpha), // %2
"+r"(dst), // %3
- "+r"(width) // %4
+ "+rm"(width) // %4
:: "memory", "cc", "eax",
"xmm0", "xmm1", "xmm2", "xmm3", "xmm4", "xmm5", "xmm6", "xmm7"
);
@@ -4909,9 +4936,9 @@ void InterpolateRow_SSSE3(uint8* dst_ptr, const uint8* src_ptr,
"jg 100b \n"
"99: \n"
- : "+r"(dst_ptr), // %0
- "+r"(src_ptr), // %1
- "+r"(dst_width), // %2
+ : "+r"(dst_ptr), // %0
+ "+r"(src_ptr), // %1
+ "+rm"(dst_width), // %2
"+r"(source_y_fraction) // %3
: "r"((intptr_t)(src_stride)) // %4
: "memory", "cc", "eax", NACL_R14
@@ -4987,7 +5014,7 @@ void InterpolateRow_AVX2(uint8* dst_ptr, const uint8* src_ptr,
"999: \n"
: "+D"(dst_ptr), // %0
"+S"(src_ptr), // %1
- "+c"(dst_width), // %2
+ "+cm"(dst_width), // %2
"+r"(source_y_fraction) // %3
: "r"((intptr_t)(src_stride)) // %4
: "memory", "cc", "eax", NACL_R14
diff --git a/TMessagesProj/jni/libyuv/source/row_mips.cc b/TMessagesProj/jni/libyuv/source/row_mips.cc
index ca6ecce94..285f0b5ad 100644
--- a/TMessagesProj/jni/libyuv/source/row_mips.cc
+++ b/TMessagesProj/jni/libyuv/source/row_mips.cc
@@ -381,7 +381,7 @@ void CopyRow_MIPS(const uint8* src, uint8* dst, int count) {
(_MIPS_SIM == _MIPS_SIM_ABI32) && (__mips_isa_rev < 6)
void SplitUVRow_DSPR2(const uint8* src_uv, uint8* dst_u, uint8* dst_v,
- int width) {
+ int width) {
__asm__ __volatile__ (
".set push \n"
".set noreorder \n"
@@ -497,7 +497,7 @@ void MirrorRow_DSPR2(const uint8* src, uint8* dst, int width) {
}
void MirrorUVRow_DSPR2(const uint8* src_uv, uint8* dst_u, uint8* dst_v,
- int width) {
+ int width) {
int x;
int y;
__asm__ __volatile__ (
@@ -654,11 +654,11 @@ void MirrorUVRow_DSPR2(const uint8* src_uv, uint8* dst_u, uint8* dst_v,
// TODO(fbarchard): accept yuv conversion constants.
void I422ToARGBRow_DSPR2(const uint8* y_buf,
- const uint8* u_buf,
- const uint8* v_buf,
- uint8* rgb_buf,
- const struct YuvConstants* yuvconstants,
- int width) {
+ const uint8* u_buf,
+ const uint8* v_buf,
+ uint8* rgb_buf,
+ const struct YuvConstants* yuvconstants,
+ int width) {
__asm__ __volatile__ (
".set push \n"
".set noreorder \n"
@@ -717,8 +717,8 @@ void I422ToARGBRow_DSPR2(const uint8* y_buf,
// Bilinear filter 8x2 -> 8x1
void InterpolateRow_DSPR2(uint8* dst_ptr, const uint8* src_ptr,
- ptrdiff_t src_stride, int dst_width,
- int source_y_fraction) {
+ ptrdiff_t src_stride, int dst_width,
+ int source_y_fraction) {
int y0_fraction = 256 - source_y_fraction;
const uint8* src_ptr1 = src_ptr + src_stride;
diff --git a/TMessagesProj/jni/libyuv/source/row_neon.cc b/TMessagesProj/jni/libyuv/source/row_neon.cc
index 91d6aa857..909df060c 100644
--- a/TMessagesProj/jni/libyuv/source/row_neon.cc
+++ b/TMessagesProj/jni/libyuv/source/row_neon.cc
@@ -1298,6 +1298,24 @@ void ARGBToYRow_NEON(const uint8* src_argb, uint8* dst_y, int width) {
);
}
+void ARGBExtractAlphaRow_NEON(const uint8* src_argb, uint8* dst_a, int width) {
+ asm volatile (
+ "1: \n"
+ MEMACCESS(0)
+ "vld4.8 {d0, d2, d4, d6}, [%0]! \n" // load 8 ARGB pixels
+ "vld4.8 {d1, d3, d5, d7}, [%0]! \n" // load next 8 ARGB pixels
+ "subs %2, %2, #16 \n" // 16 processed per loop
+ MEMACCESS(1)
+ "vst1.8 {q3}, [%1]! \n" // store 16 A's.
+ "bgt 1b \n"
+ : "+r"(src_argb), // %0
+ "+r"(dst_a), // %1
+ "+r"(width) // %2
+ :
+ : "cc", "memory", "q0", "q1", "q2", "q3" // Clobber List
+ );
+}
+
void ARGBToYJRow_NEON(const uint8* src_argb, uint8* dst_y, int width) {
asm volatile (
"vmov.u8 d24, #15 \n" // B * 0.11400 coefficient
@@ -2565,8 +2583,6 @@ void ARGBColorMatrixRow_NEON(const uint8* src_argb, uint8* dst_argb,
);
}
-// TODO(fbarchard): fix vqshrun in ARGBMultiplyRow_NEON and reenable.
-#ifdef HAS_ARGBMULTIPLYROW_NEON
// Multiply 2 rows of ARGB pixels together, 8 pixels at a time.
void ARGBMultiplyRow_NEON(const uint8* src_argb0, const uint8* src_argb1,
uint8* dst_argb, int width) {
@@ -2598,7 +2614,6 @@ void ARGBMultiplyRow_NEON(const uint8* src_argb0, const uint8* src_argb1,
: "cc", "memory", "q0", "q1", "q2", "q3"
);
}
-#endif // HAS_ARGBMULTIPLYROW_NEON
// Add 2 rows of ARGB pixels together, 8 pixels at a time.
void ARGBAddRow_NEON(const uint8* src_argb0, const uint8* src_argb1,
diff --git a/TMessagesProj/jni/libyuv/source/row_neon64.cc b/TMessagesProj/jni/libyuv/source/row_neon64.cc
index ee42af12e..6375d4f55 100644
--- a/TMessagesProj/jni/libyuv/source/row_neon64.cc
+++ b/TMessagesProj/jni/libyuv/source/row_neon64.cc
@@ -127,7 +127,6 @@ extern "C" {
"sqshrun " #vG ".8b, " #vG ".8h, #6 \n" /* G */ \
"sqshrun " #vR ".8b, " #vR ".8h, #6 \n" /* R */ \
-#ifdef HAS_I444TOARGBROW_NEON
void I444ToARGBRow_NEON(const uint8* src_y,
const uint8* src_u,
const uint8* src_v,
@@ -157,9 +156,7 @@ void I444ToARGBRow_NEON(const uint8* src_y,
"v21", "v22", "v23", "v24", "v25", "v26", "v27", "v28", "v29", "v30"
);
}
-#endif // HAS_I444TOARGBROW_NEON
-#ifdef HAS_I422TOARGBROW_NEON
void I422ToARGBRow_NEON(const uint8* src_y,
const uint8* src_u,
const uint8* src_v,
@@ -189,9 +186,7 @@ void I422ToARGBRow_NEON(const uint8* src_y,
"v21", "v22", "v23", "v24", "v25", "v26", "v27", "v28", "v29", "v30"
);
}
-#endif // HAS_I422TOARGBROW_NEON
-#ifdef HAS_I422ALPHATOARGBROW_NEON
void I422AlphaToARGBRow_NEON(const uint8* src_y,
const uint8* src_u,
const uint8* src_v,
@@ -224,9 +219,7 @@ void I422AlphaToARGBRow_NEON(const uint8* src_y,
"v21", "v22", "v23", "v24", "v25", "v26", "v27", "v28", "v29", "v30"
);
}
-#endif // HAS_I422ALPHATOARGBROW_NEON
-#ifdef HAS_I411TOARGBROW_NEON
void I411ToARGBRow_NEON(const uint8* src_y,
const uint8* src_u,
const uint8* src_v,
@@ -256,9 +249,7 @@ void I411ToARGBRow_NEON(const uint8* src_y,
"v21", "v22", "v23", "v24", "v25", "v26", "v27", "v28", "v29", "v30"
);
}
-#endif // HAS_I411TOARGBROW_NEON
-#ifdef HAS_I422TORGBAROW_NEON
void I422ToRGBARow_NEON(const uint8* src_y,
const uint8* src_u,
const uint8* src_v,
@@ -288,9 +279,7 @@ void I422ToRGBARow_NEON(const uint8* src_y,
"v21", "v22", "v23", "v24", "v25", "v26", "v27", "v28", "v29", "v30"
);
}
-#endif // HAS_I422TORGBAROW_NEON
-#ifdef HAS_I422TORGB24ROW_NEON
void I422ToRGB24Row_NEON(const uint8* src_y,
const uint8* src_u,
const uint8* src_v,
@@ -319,7 +308,6 @@ void I422ToRGB24Row_NEON(const uint8* src_y,
"v21", "v22", "v23", "v24", "v25", "v26", "v27", "v28", "v29", "v30"
);
}
-#endif // HAS_I422TORGB24ROW_NEON
#define ARGBTORGB565 \
"shll v0.8h, v22.8b, #8 \n" /* R */ \
@@ -328,7 +316,6 @@ void I422ToRGB24Row_NEON(const uint8* src_y,
"sri v0.8h, v21.8h, #5 \n" /* RG */ \
"sri v0.8h, v20.8h, #11 \n" /* RGB */
-#ifdef HAS_I422TORGB565ROW_NEON
void I422ToRGB565Row_NEON(const uint8* src_y,
const uint8* src_u,
const uint8* src_v,
@@ -358,7 +345,6 @@ void I422ToRGB565Row_NEON(const uint8* src_y,
"v21", "v22", "v23", "v24", "v25", "v26", "v27", "v28", "v29", "v30"
);
}
-#endif // HAS_I422TORGB565ROW_NEON
#define ARGBTOARGB1555 \
"shll v0.8h, v23.8b, #8 \n" /* A */ \
@@ -369,7 +355,6 @@ void I422ToRGB565Row_NEON(const uint8* src_y,
"sri v0.8h, v21.8h, #6 \n" /* ARG */ \
"sri v0.8h, v20.8h, #11 \n" /* ARGB */
-#ifdef HAS_I422TOARGB1555ROW_NEON
void I422ToARGB1555Row_NEON(const uint8* src_y,
const uint8* src_u,
const uint8* src_v,
@@ -400,7 +385,6 @@ void I422ToARGB1555Row_NEON(const uint8* src_y,
"v21", "v22", "v23", "v24", "v25", "v26", "v27", "v28", "v29", "v30"
);
}
-#endif // HAS_I422TOARGB1555ROW_NEON
#define ARGBTOARGB4444 \
/* Input v20.8b<=B, v21.8b<=G, v22.8b<=R, v23.8b<=A, v4.8b<=0x0f */ \
@@ -412,7 +396,6 @@ void I422ToARGB1555Row_NEON(const uint8* src_y,
"orr v1.8b, v22.8b, v23.8b \n" /* RA */ \
"zip1 v0.16b, v0.16b, v1.16b \n" /* BGRA */
-#ifdef HAS_I422TOARGB4444ROW_NEON
void I422ToARGB4444Row_NEON(const uint8* src_y,
const uint8* src_u,
const uint8* src_v,
@@ -444,13 +427,10 @@ void I422ToARGB4444Row_NEON(const uint8* src_y,
"v21", "v22", "v23", "v24", "v25", "v26", "v27", "v28", "v29", "v30"
);
}
-#endif // HAS_I422TOARGB4444ROW_NEON
-#ifdef HAS_I400TOARGBROW_NEON
void I400ToARGBRow_NEON(const uint8* src_y,
uint8* dst_argb,
int width) {
- int64 width64 = (int64)(width);
asm volatile (
YUVTORGB_SETUP
"movi v23.8b, #255 \n"
@@ -463,7 +443,7 @@ void I400ToARGBRow_NEON(const uint8* src_y,
"b.gt 1b \n"
: "+r"(src_y), // %0
"+r"(dst_argb), // %1
- "+r"(width64) // %2
+ "+r"(width) // %2
: [kUVToRB]"r"(&kYuvI601Constants.kUVToRB),
[kUVToG]"r"(&kYuvI601Constants.kUVToG),
[kUVBiasBGR]"r"(&kYuvI601Constants.kUVBiasBGR),
@@ -472,9 +452,7 @@ void I400ToARGBRow_NEON(const uint8* src_y,
"v21", "v22", "v23", "v24", "v25", "v26", "v27", "v28", "v29", "v30"
);
}
-#endif // HAS_I400TOARGBROW_NEON
-#ifdef HAS_J400TOARGBROW_NEON
void J400ToARGBRow_NEON(const uint8* src_y,
uint8* dst_argb,
int width) {
@@ -496,9 +474,7 @@ void J400ToARGBRow_NEON(const uint8* src_y,
: "cc", "memory", "v20", "v21", "v22", "v23"
);
}
-#endif // HAS_J400TOARGBROW_NEON
-#ifdef HAS_NV12TOARGBROW_NEON
void NV12ToARGBRow_NEON(const uint8* src_y,
const uint8* src_uv,
uint8* dst_argb,
@@ -526,9 +502,7 @@ void NV12ToARGBRow_NEON(const uint8* src_y,
"v21", "v22", "v23", "v24", "v25", "v26", "v27", "v28", "v29", "v30"
);
}
-#endif // HAS_NV12TOARGBROW_NEON
-#ifdef HAS_NV12TOARGBROW_NEON
void NV21ToARGBRow_NEON(const uint8* src_y,
const uint8* src_vu,
uint8* dst_argb,
@@ -556,9 +530,7 @@ void NV21ToARGBRow_NEON(const uint8* src_y,
"v21", "v22", "v23", "v24", "v25", "v26", "v27", "v28", "v29", "v30"
);
}
-#endif // HAS_NV12TOARGBROW_NEON
-#ifdef HAS_NV12TORGB565ROW_NEON
void NV12ToRGB565Row_NEON(const uint8* src_y,
const uint8* src_uv,
uint8* dst_rgb565,
@@ -586,14 +558,11 @@ void NV12ToRGB565Row_NEON(const uint8* src_y,
"v21", "v22", "v23", "v24", "v25", "v26", "v27", "v28", "v29", "v30"
);
}
-#endif // HAS_NV12TORGB565ROW_NEON
-#ifdef HAS_YUY2TOARGBROW_NEON
void YUY2ToARGBRow_NEON(const uint8* src_yuy2,
uint8* dst_argb,
const struct YuvConstants* yuvconstants,
int width) {
- int64 width64 = (int64)(width);
asm volatile (
YUVTORGB_SETUP
"movi v23.8b, #255 \n"
@@ -606,7 +575,7 @@ void YUY2ToARGBRow_NEON(const uint8* src_yuy2,
"b.gt 1b \n"
: "+r"(src_yuy2), // %0
"+r"(dst_argb), // %1
- "+r"(width64) // %2
+ "+r"(width) // %2
: [kUVToRB]"r"(&yuvconstants->kUVToRB),
[kUVToG]"r"(&yuvconstants->kUVToG),
[kUVBiasBGR]"r"(&yuvconstants->kUVBiasBGR),
@@ -615,14 +584,11 @@ void YUY2ToARGBRow_NEON(const uint8* src_yuy2,
"v21", "v22", "v23", "v24", "v25", "v26", "v27", "v28", "v29", "v30"
);
}
-#endif // HAS_YUY2TOARGBROW_NEON
-#ifdef HAS_UYVYTOARGBROW_NEON
void UYVYToARGBRow_NEON(const uint8* src_uyvy,
uint8* dst_argb,
const struct YuvConstants* yuvconstants,
int width) {
- int64 width64 = (int64)(width);
asm volatile (
YUVTORGB_SETUP
"movi v23.8b, #255 \n"
@@ -635,7 +601,7 @@ void UYVYToARGBRow_NEON(const uint8* src_uyvy,
"b.gt 1b \n"
: "+r"(src_uyvy), // %0
"+r"(dst_argb), // %1
- "+r"(width64) // %2
+ "+r"(width) // %2
: [kUVToRB]"r"(&yuvconstants->kUVToRB),
[kUVToG]"r"(&yuvconstants->kUVToG),
[kUVBiasBGR]"r"(&yuvconstants->kUVBiasBGR),
@@ -644,10 +610,8 @@ void UYVYToARGBRow_NEON(const uint8* src_uyvy,
"v21", "v22", "v23", "v24", "v25", "v26", "v27", "v28", "v29", "v30"
);
}
-#endif // HAS_UYVYTOARGBROW_NEON
// Reads 16 pairs of UV and write even values to dst_u and odd to dst_v.
-#ifdef HAS_SPLITUVROW_NEON
void SplitUVRow_NEON(const uint8* src_uv, uint8* dst_u, uint8* dst_v,
int width) {
asm volatile (
@@ -668,10 +632,8 @@ void SplitUVRow_NEON(const uint8* src_uv, uint8* dst_u, uint8* dst_v,
: "cc", "memory", "v0", "v1" // Clobber List
);
}
-#endif // HAS_SPLITUVROW_NEON
// Reads 16 U's and V's and writes out 16 pairs of UV.
-#ifdef HAS_MERGEUVROW_NEON
void MergeUVRow_NEON(const uint8* src_u, const uint8* src_v, uint8* dst_uv,
int width) {
asm volatile (
@@ -693,10 +655,8 @@ void MergeUVRow_NEON(const uint8* src_u, const uint8* src_v, uint8* dst_uv,
: "cc", "memory", "v0", "v1" // Clobber List
);
}
-#endif // HAS_MERGEUVROW_NEON
// Copy multiple of 32. vld4.8 allow unaligned and is fastest on a15.
-#ifdef HAS_COPYROW_NEON
void CopyRow_NEON(const uint8* src, uint8* dst, int count) {
asm volatile (
"1: \n"
@@ -713,17 +673,16 @@ void CopyRow_NEON(const uint8* src, uint8* dst, int count) {
: "cc", "memory", "v0", "v1", "v2", "v3" // Clobber List
);
}
-#endif // HAS_COPYROW_NEON
// SetRow writes 'count' bytes using an 8 bit value repeated.
void SetRow_NEON(uint8* dst, uint8 v8, int count) {
asm volatile (
"dup v0.16b, %w2 \n" // duplicate 16 bytes
"1: \n"
- "subs %w1, %w1, #16 \n" // 16 bytes per loop
+ "subs %w1, %w1, #16 \n" // 16 bytes per loop
MEMACCESS(0)
"st1 {v0.16b}, [%0], #16 \n" // store
- "b.gt 1b \n"
+ "b.gt 1b \n"
: "+r"(dst), // %0
"+r"(count) // %1
: "r"(v8) // %2
@@ -735,10 +694,10 @@ void ARGBSetRow_NEON(uint8* dst, uint32 v32, int count) {
asm volatile (
"dup v0.4s, %w2 \n" // duplicate 4 ints
"1: \n"
- "subs %w1, %w1, #4 \n" // 4 ints per loop
+ "subs %w1, %w1, #4 \n" // 4 ints per loop
MEMACCESS(0)
"st1 {v0.16b}, [%0], #16 \n" // store
- "b.gt 1b \n"
+ "b.gt 1b \n"
: "+r"(dst), // %0
"+r"(count) // %1
: "r"(v32) // %2
@@ -746,18 +705,15 @@ void ARGBSetRow_NEON(uint8* dst, uint32 v32, int count) {
);
}
-#ifdef HAS_MIRRORROW_NEON
void MirrorRow_NEON(const uint8* src, uint8* dst, int width) {
- int64 width64 = (int64) width;
asm volatile (
// Start at end of source row.
- "add %0, %0, %2 \n"
+ "add %0, %0, %w2, sxtw \n"
"sub %0, %0, #16 \n"
-
"1: \n"
MEMACCESS(0)
"ld1 {v0.16b}, [%0], %3 \n" // src -= 16
- "subs %2, %2, #16 \n" // 16 pixels per loop.
+ "subs %w2, %w2, #16 \n" // 16 pixels per loop.
"rev64 v0.16b, v0.16b \n"
MEMACCESS(1)
"st1 {v0.D}[1], [%1], #8 \n" // dst += 16
@@ -766,26 +722,22 @@ void MirrorRow_NEON(const uint8* src, uint8* dst, int width) {
"b.gt 1b \n"
: "+r"(src), // %0
"+r"(dst), // %1
- "+r"(width64) // %2
+ "+r"(width) // %2
: "r"((ptrdiff_t)-16) // %3
: "cc", "memory", "v0"
);
}
-#endif // HAS_MIRRORROW_NEON
-#ifdef HAS_MIRRORUVROW_NEON
void MirrorUVRow_NEON(const uint8* src_uv, uint8* dst_u, uint8* dst_v,
int width) {
- int64 width64 = (int64) width;
asm volatile (
// Start at end of source row.
- "add %0, %0, %3, lsl #1 \n"
+ "add %0, %0, %w3, sxtw #1 \n"
"sub %0, %0, #16 \n"
-
"1: \n"
MEMACCESS(0)
"ld2 {v0.8b, v1.8b}, [%0], %4 \n" // src -= 16
- "subs %3, %3, #8 \n" // 8 pixels per loop.
+ "subs %w3, %w3, #8 \n" // 8 pixels per loop.
"rev64 v0.8b, v0.8b \n"
"rev64 v1.8b, v1.8b \n"
MEMACCESS(1)
@@ -796,25 +748,21 @@ void MirrorUVRow_NEON(const uint8* src_uv, uint8* dst_u, uint8* dst_v,
: "+r"(src_uv), // %0
"+r"(dst_u), // %1
"+r"(dst_v), // %2
- "+r"(width64) // %3
+ "+r"(width) // %3
: "r"((ptrdiff_t)-16) // %4
: "cc", "memory", "v0", "v1"
);
}
-#endif // HAS_MIRRORUVROW_NEON
-#ifdef HAS_ARGBMIRRORROW_NEON
void ARGBMirrorRow_NEON(const uint8* src, uint8* dst, int width) {
- int64 width64 = (int64) width;
asm volatile (
- // Start at end of source row.
- "add %0, %0, %2, lsl #2 \n"
+ // Start at end of source row.
+ "add %0, %0, %w2, sxtw #2 \n"
"sub %0, %0, #16 \n"
-
"1: \n"
MEMACCESS(0)
"ld1 {v0.16b}, [%0], %3 \n" // src -= 16
- "subs %2, %2, #4 \n" // 4 pixels per loop.
+ "subs %w2, %w2, #4 \n" // 4 pixels per loop.
"rev64 v0.4s, v0.4s \n"
MEMACCESS(1)
"st1 {v0.D}[1], [%1], #8 \n" // dst += 16
@@ -823,14 +771,12 @@ void ARGBMirrorRow_NEON(const uint8* src, uint8* dst, int width) {
"b.gt 1b \n"
: "+r"(src), // %0
"+r"(dst), // %1
- "+r"(width64) // %2
+ "+r"(width) // %2
: "r"((ptrdiff_t)-16) // %3
: "cc", "memory", "v0"
);
}
-#endif // HAS_ARGBMIRRORROW_NEON
-#ifdef HAS_RGB24TOARGBROW_NEON
void RGB24ToARGBRow_NEON(const uint8* src_rgb24, uint8* dst_argb, int width) {
asm volatile (
"movi v4.8b, #255 \n" // Alpha
@@ -843,14 +789,12 @@ void RGB24ToARGBRow_NEON(const uint8* src_rgb24, uint8* dst_argb, int width) {
"b.gt 1b \n"
: "+r"(src_rgb24), // %0
"+r"(dst_argb), // %1
- "+r"(width) // %2
+ "+r"(width) // %2
:
: "cc", "memory", "v1", "v2", "v3", "v4" // Clobber List
);
}
-#endif // HAS_RGB24TOARGBROW_NEON
-#ifdef HAS_RAWTOARGBROW_NEON
void RAWToARGBRow_NEON(const uint8* src_raw, uint8* dst_argb, int width) {
asm volatile (
"movi v5.8b, #255 \n" // Alpha
@@ -865,12 +809,11 @@ void RAWToARGBRow_NEON(const uint8* src_raw, uint8* dst_argb, int width) {
"b.gt 1b \n"
: "+r"(src_raw), // %0
"+r"(dst_argb), // %1
- "+r"(width) // %2
+ "+r"(width) // %2
:
: "cc", "memory", "v0", "v1", "v2", "v3", "v4", "v5" // Clobber List
);
}
-#endif // HAS_RAWTOARGBROW_NEON
void RAWToRGB24Row_NEON(const uint8* src_raw, uint8* dst_rgb24, int width) {
asm volatile (
@@ -904,7 +847,6 @@ void RAWToRGB24Row_NEON(const uint8* src_raw, uint8* dst_rgb24, int width) {
"orr v0.16b, v0.16b, v2.16b \n" /* R,B */ \
"dup v2.2D, v0.D[1] \n" /* R */
-#ifdef HAS_RGB565TOARGBROW_NEON
void RGB565ToARGBRow_NEON(const uint8* src_rgb565, uint8* dst_argb, int width) {
asm volatile (
"movi v3.8b, #255 \n" // Alpha
@@ -923,7 +865,6 @@ void RGB565ToARGBRow_NEON(const uint8* src_rgb565, uint8* dst_argb, int width) {
: "cc", "memory", "v0", "v1", "v2", "v3", "v4", "v6" // Clobber List
);
}
-#endif // HAS_RGB565TOARGBROW_NEON
#define ARGB1555TOARGB \
"ushr v2.8h, v0.8h, #10 \n" /* R xxxRRRRR */ \
@@ -962,7 +903,6 @@ void RGB565ToARGBRow_NEON(const uint8* src_rgb565, uint8* dst_argb, int width) {
"orr v2.16b, v1.16b, v3.16b \n" /* R */ \
"dup v1.2D, v0.D[1] \n" /* G */ \
-#ifdef HAS_ARGB1555TOARGBROW_NEON
void ARGB1555ToARGBRow_NEON(const uint8* src_argb1555, uint8* dst_argb,
int width) {
asm volatile (
@@ -982,7 +922,6 @@ void ARGB1555ToARGBRow_NEON(const uint8* src_argb1555, uint8* dst_argb,
: "cc", "memory", "v0", "v1", "v2", "v3" // Clobber List
);
}
-#endif // HAS_ARGB1555TOARGBROW_NEON
#define ARGB4444TOARGB \
"shrn v1.8b, v0.8h, #8 \n" /* v1(l) AR */ \
@@ -996,7 +935,6 @@ void ARGB1555ToARGBRow_NEON(const uint8* src_argb1555, uint8* dst_argb,
"dup v0.2D, v2.D[1] \n" \
"dup v1.2D, v3.D[1] \n"
-#ifdef HAS_ARGB4444TOARGBROW_NEON
void ARGB4444ToARGBRow_NEON(const uint8* src_argb4444, uint8* dst_argb,
int width) {
asm volatile (
@@ -1015,9 +953,7 @@ void ARGB4444ToARGBRow_NEON(const uint8* src_argb4444, uint8* dst_argb,
: "cc", "memory", "v0", "v1", "v2", "v3", "v4" // Clobber List
);
}
-#endif // HAS_ARGB4444TOARGBROW_NEON
-#ifdef HAS_ARGBTORGB24ROW_NEON
void ARGBToRGB24Row_NEON(const uint8* src_argb, uint8* dst_rgb24, int width) {
asm volatile (
"1: \n"
@@ -1034,9 +970,7 @@ void ARGBToRGB24Row_NEON(const uint8* src_argb, uint8* dst_rgb24, int width) {
: "cc", "memory", "v1", "v2", "v3", "v4" // Clobber List
);
}
-#endif // HAS_ARGBTORGB24ROW_NEON
-#ifdef HAS_ARGBTORAWROW_NEON
void ARGBToRAWRow_NEON(const uint8* src_argb, uint8* dst_raw, int width) {
asm volatile (
"1: \n"
@@ -1055,9 +989,7 @@ void ARGBToRAWRow_NEON(const uint8* src_argb, uint8* dst_raw, int width) {
: "cc", "memory", "v1", "v2", "v3", "v4", "v5" // Clobber List
);
}
-#endif // HAS_ARGBTORAWROW_NEON
-#ifdef HAS_YUY2TOYROW_NEON
void YUY2ToYRow_NEON(const uint8* src_yuy2, uint8* dst_y, int width) {
asm volatile (
"1: \n"
@@ -1074,9 +1006,7 @@ void YUY2ToYRow_NEON(const uint8* src_yuy2, uint8* dst_y, int width) {
: "cc", "memory", "v0", "v1" // Clobber List
);
}
-#endif // HAS_YUY2TOYROW_NEON
-#ifdef HAS_UYVYTOYROW_NEON
void UYVYToYRow_NEON(const uint8* src_uyvy, uint8* dst_y, int width) {
asm volatile (
"1: \n"
@@ -1093,9 +1023,7 @@ void UYVYToYRow_NEON(const uint8* src_uyvy, uint8* dst_y, int width) {
: "cc", "memory", "v0", "v1" // Clobber List
);
}
-#endif // HAS_UYVYTOYROW_NEON
-#ifdef HAS_YUY2TOUV422ROW_NEON
void YUY2ToUV422Row_NEON(const uint8* src_yuy2, uint8* dst_u, uint8* dst_v,
int width) {
asm volatile (
@@ -1116,9 +1044,7 @@ void YUY2ToUV422Row_NEON(const uint8* src_yuy2, uint8* dst_u, uint8* dst_v,
: "cc", "memory", "v0", "v1", "v2", "v3" // Clobber List
);
}
-#endif // HAS_YUY2TOUV422ROW_NEON
-#ifdef HAS_UYVYTOUV422ROW_NEON
void UYVYToUV422Row_NEON(const uint8* src_uyvy, uint8* dst_u, uint8* dst_v,
int width) {
asm volatile (
@@ -1139,9 +1065,7 @@ void UYVYToUV422Row_NEON(const uint8* src_uyvy, uint8* dst_u, uint8* dst_v,
: "cc", "memory", "v0", "v1", "v2", "v3" // Clobber List
);
}
-#endif // HAS_UYVYTOUV422ROW_NEON
-#ifdef HAS_YUY2TOUVROW_NEON
void YUY2ToUVRow_NEON(const uint8* src_yuy2, int stride_yuy2,
uint8* dst_u, uint8* dst_v, int width) {
const uint8* src_yuy2b = src_yuy2 + stride_yuy2;
@@ -1169,9 +1093,7 @@ void YUY2ToUVRow_NEON(const uint8* src_yuy2, int stride_yuy2,
"v5", "v6", "v7" // Clobber List
);
}
-#endif // HAS_YUY2TOUVROW_NEON
-#ifdef HAS_UYVYTOUVROW_NEON
void UYVYToUVRow_NEON(const uint8* src_uyvy, int stride_uyvy,
uint8* dst_u, uint8* dst_v, int width) {
const uint8* src_uyvyb = src_uyvy + stride_uyvy;
@@ -1199,10 +1121,8 @@ void UYVYToUVRow_NEON(const uint8* src_uyvy, int stride_uyvy,
"v5", "v6", "v7" // Clobber List
);
}
-#endif // HAS_UYVYTOUVROW_NEON
// For BGRAToARGB, ABGRToARGB, RGBAToARGB, and ARGBToRGBA.
-#ifdef HAS_ARGBSHUFFLEROW_NEON
void ARGBShuffleRow_NEON(const uint8* src_argb, uint8* dst_argb,
const uint8* shuffler, int width) {
asm volatile (
@@ -1223,9 +1143,7 @@ void ARGBShuffleRow_NEON(const uint8* src_argb, uint8* dst_argb,
: "cc", "memory", "v0", "v1", "v2" // Clobber List
);
}
-#endif // HAS_ARGBSHUFFLEROW_NEON
-#ifdef HAS_I422TOYUY2ROW_NEON
void I422ToYUY2Row_NEON(const uint8* src_y,
const uint8* src_u,
const uint8* src_v,
@@ -1252,9 +1170,7 @@ void I422ToYUY2Row_NEON(const uint8* src_y,
: "cc", "memory", "v0", "v1", "v2", "v3"
);
}
-#endif // HAS_I422TOYUY2ROW_NEON
-#ifdef HAS_I422TOUYVYROW_NEON
void I422ToUYVYRow_NEON(const uint8* src_y,
const uint8* src_u,
const uint8* src_v,
@@ -1281,9 +1197,7 @@ void I422ToUYVYRow_NEON(const uint8* src_y,
: "cc", "memory", "v0", "v1", "v2", "v3"
);
}
-#endif // HAS_I422TOUYVYROW_NEON
-#ifdef HAS_ARGBTORGB565ROW_NEON
void ARGBToRGB565Row_NEON(const uint8* src_argb, uint8* dst_rgb565, int width) {
asm volatile (
"1: \n"
@@ -1301,9 +1215,7 @@ void ARGBToRGB565Row_NEON(const uint8* src_argb, uint8* dst_rgb565, int width) {
: "cc", "memory", "v0", "v20", "v21", "v22", "v23"
);
}
-#endif // HAS_ARGBTORGB565ROW_NEON
-#ifdef HAS_ARGBTORGB565DITHERROW_NEON
void ARGBToRGB565DitherRow_NEON(const uint8* src_argb, uint8* dst_rgb,
const uint32 dither4, int width) {
asm volatile (
@@ -1326,9 +1238,7 @@ void ARGBToRGB565DitherRow_NEON(const uint8* src_argb, uint8* dst_rgb,
: "cc", "memory", "v0", "v1", "v20", "v21", "v22", "v23"
);
}
-#endif // HAS_ARGBTORGB565ROW_NEON
-#ifdef HAS_ARGBTOARGB1555ROW_NEON
void ARGBToARGB1555Row_NEON(const uint8* src_argb, uint8* dst_argb1555,
int width) {
asm volatile (
@@ -1347,9 +1257,7 @@ void ARGBToARGB1555Row_NEON(const uint8* src_argb, uint8* dst_argb1555,
: "cc", "memory", "v0", "v20", "v21", "v22", "v23"
);
}
-#endif // HAS_ARGBTOARGB1555ROW_NEON
-#ifdef HAS_ARGBTOARGB4444ROW_NEON
void ARGBToARGB4444Row_NEON(const uint8* src_argb, uint8* dst_argb4444,
int width) {
asm volatile (
@@ -1369,9 +1277,7 @@ void ARGBToARGB4444Row_NEON(const uint8* src_argb, uint8* dst_argb4444,
: "cc", "memory", "v0", "v1", "v4", "v20", "v21", "v22", "v23"
);
}
-#endif // HAS_ARGBTOARGB4444ROW_NEON
-#ifdef HAS_ARGBTOYROW_NEON
void ARGBToYRow_NEON(const uint8* src_argb, uint8* dst_y, int width) {
asm volatile (
"movi v4.8b, #13 \n" // B * 0.1016 coefficient
@@ -1397,9 +1303,24 @@ void ARGBToYRow_NEON(const uint8* src_argb, uint8* dst_y, int width) {
: "cc", "memory", "v0", "v1", "v2", "v3", "v4", "v5", "v6", "v7"
);
}
-#endif // HAS_ARGBTOYROW_NEON
-#ifdef HAS_ARGBTOYJROW_NEON
+void ARGBExtractAlphaRow_NEON(const uint8* src_argb, uint8* dst_a, int width) {
+ asm volatile (
+ "1: \n"
+ MEMACCESS(0)
+ "ld4 {v0.16b,v1.16b,v2.16b,v3.16b}, [%0], #64 \n" // load row 16 pixels
+ "subs %w2, %w2, #16 \n" // 16 processed per loop
+ MEMACCESS(1)
+ "st1 {v3.16b}, [%1], #16 \n" // store 16 A's.
+ "b.gt 1b \n"
+ : "+r"(src_argb), // %0
+ "+r"(dst_a), // %1
+ "+r"(width) // %2
+ :
+ : "cc", "memory", "v0", "v1", "v2", "v3" // Clobber List
+ );
+}
+
void ARGBToYJRow_NEON(const uint8* src_argb, uint8* dst_y, int width) {
asm volatile (
"movi v4.8b, #15 \n" // B * 0.11400 coefficient
@@ -1423,10 +1344,8 @@ void ARGBToYJRow_NEON(const uint8* src_argb, uint8* dst_y, int width) {
: "cc", "memory", "v0", "v1", "v2", "v3", "v4", "v5", "v6"
);
}
-#endif // HAS_ARGBTOYJROW_NEON
// 8x1 pixels.
-#ifdef HAS_ARGBTOUV444ROW_NEON
void ARGBToUV444Row_NEON(const uint8* src_argb, uint8* dst_u, uint8* dst_v,
int width) {
asm volatile (
@@ -1467,7 +1386,6 @@ void ARGBToUV444Row_NEON(const uint8* src_argb, uint8* dst_u, uint8* dst_v,
"v24", "v25", "v26", "v27", "v28", "v29"
);
}
-#endif // HAS_ARGBTOUV444ROW_NEON
#define RGBTOUV_SETUP_REG \
"movi v20.8h, #56, lsl #0 \n" /* UB/VR coefficient (0.875) / 2 */ \
@@ -1478,7 +1396,6 @@ void ARGBToUV444Row_NEON(const uint8* src_argb, uint8* dst_u, uint8* dst_v,
"movi v25.16b, #0x80 \n" /* 128.5 (0x8080 in 16-bit) */
// 32x1 pixels -> 8x1. width is number of argb pixels. e.g. 32.
-#ifdef HAS_ARGBTOUV411ROW_NEON
void ARGBToUV411Row_NEON(const uint8* src_argb, uint8* dst_u, uint8* dst_v,
int width) {
asm volatile (
@@ -1528,7 +1445,6 @@ void ARGBToUV411Row_NEON(const uint8* src_argb, uint8* dst_u, uint8* dst_v,
"v20", "v21", "v22", "v23", "v24", "v25"
);
}
-#endif // HAS_ARGBTOUV411ROW_NEON
// 16x2 pixels -> 8x1. width is number of argb pixels. e.g. 16.
#define RGBTOUV(QB, QG, QR) \
@@ -1546,7 +1462,6 @@ void ARGBToUV411Row_NEON(const uint8* src_argb, uint8* dst_u, uint8* dst_v,
// TODO(fbarchard): Consider vhadd vertical, then vpaddl horizontal, avoid shr.
// TODO(fbarchard): consider ptrdiff_t for all strides.
-#ifdef HAS_ARGBTOUVROW_NEON
void ARGBToUVRow_NEON(const uint8* src_argb, int src_stride_argb,
uint8* dst_u, uint8* dst_v, int width) {
const uint8* src_argb_1 = src_argb + src_stride_argb;
@@ -1586,10 +1501,8 @@ void ARGBToUVRow_NEON(const uint8* src_argb, int src_stride_argb,
"v20", "v21", "v22", "v23", "v24", "v25"
);
}
-#endif // HAS_ARGBTOUVROW_NEON
// TODO(fbarchard): Subsample match C code.
-#ifdef HAS_ARGBTOUVJROW_NEON
void ARGBToUVJRow_NEON(const uint8* src_argb, int src_stride_argb,
uint8* dst_u, uint8* dst_v, int width) {
const uint8* src_argb_1 = src_argb + src_stride_argb;
@@ -1633,9 +1546,7 @@ void ARGBToUVJRow_NEON(const uint8* src_argb, int src_stride_argb,
"v20", "v21", "v22", "v23", "v24", "v25"
);
}
-#endif // HAS_ARGBTOUVJROW_NEON
-#ifdef HAS_BGRATOUVROW_NEON
void BGRAToUVRow_NEON(const uint8* src_bgra, int src_stride_bgra,
uint8* dst_u, uint8* dst_v, int width) {
const uint8* src_bgra_1 = src_bgra + src_stride_bgra;
@@ -1674,9 +1585,7 @@ void BGRAToUVRow_NEON(const uint8* src_bgra, int src_stride_bgra,
"v20", "v21", "v22", "v23", "v24", "v25"
);
}
-#endif // HAS_BGRATOUVROW_NEON
-#ifdef HAS_ABGRTOUVROW_NEON
void ABGRToUVRow_NEON(const uint8* src_abgr, int src_stride_abgr,
uint8* dst_u, uint8* dst_v, int width) {
const uint8* src_abgr_1 = src_abgr + src_stride_abgr;
@@ -1715,9 +1624,7 @@ void ABGRToUVRow_NEON(const uint8* src_abgr, int src_stride_abgr,
"v20", "v21", "v22", "v23", "v24", "v25"
);
}
-#endif // HAS_ABGRTOUVROW_NEON
-#ifdef HAS_RGBATOUVROW_NEON
void RGBAToUVRow_NEON(const uint8* src_rgba, int src_stride_rgba,
uint8* dst_u, uint8* dst_v, int width) {
const uint8* src_rgba_1 = src_rgba + src_stride_rgba;
@@ -1756,9 +1663,7 @@ void RGBAToUVRow_NEON(const uint8* src_rgba, int src_stride_rgba,
"v20", "v21", "v22", "v23", "v24", "v25"
);
}
-#endif // HAS_RGBATOUVROW_NEON
-#ifdef HAS_RGB24TOUVROW_NEON
void RGB24ToUVRow_NEON(const uint8* src_rgb24, int src_stride_rgb24,
uint8* dst_u, uint8* dst_v, int width) {
const uint8* src_rgb24_1 = src_rgb24 + src_stride_rgb24;
@@ -1797,9 +1702,7 @@ void RGB24ToUVRow_NEON(const uint8* src_rgb24, int src_stride_rgb24,
"v20", "v21", "v22", "v23", "v24", "v25"
);
}
-#endif // HAS_RGB24TOUVROW_NEON
-#ifdef HAS_RAWTOUVROW_NEON
void RAWToUVRow_NEON(const uint8* src_raw, int src_stride_raw,
uint8* dst_u, uint8* dst_v, int width) {
const uint8* src_raw_1 = src_raw + src_stride_raw;
@@ -1838,10 +1741,8 @@ void RAWToUVRow_NEON(const uint8* src_raw, int src_stride_raw,
"v20", "v21", "v22", "v23", "v24", "v25"
);
}
-#endif // HAS_RAWTOUVROW_NEON
// 16x2 pixels -> 8x1. width is number of argb pixels. e.g. 16.
-#ifdef HAS_RGB565TOUVROW_NEON
void RGB565ToUVRow_NEON(const uint8* src_rgb565, int src_stride_rgb565,
uint8* dst_u, uint8* dst_v, int width) {
const uint8* src_rgb565_1 = src_rgb565 + src_stride_rgb565;
@@ -1914,10 +1815,8 @@ void RGB565ToUVRow_NEON(const uint8* src_rgb565, int src_stride_rgb565,
"v25", "v26", "v27"
);
}
-#endif // HAS_RGB565TOUVROW_NEON
// 16x2 pixels -> 8x1. width is number of argb pixels. e.g. 16.
-#ifdef HAS_ARGB1555TOUVROW_NEON
void ARGB1555ToUVRow_NEON(const uint8* src_argb1555, int src_stride_argb1555,
uint8* dst_u, uint8* dst_v, int width) {
const uint8* src_argb1555_1 = src_argb1555 + src_stride_argb1555;
@@ -1985,10 +1884,8 @@ void ARGB1555ToUVRow_NEON(const uint8* src_argb1555, int src_stride_argb1555,
"v26", "v27", "v28"
);
}
-#endif // HAS_ARGB1555TOUVROW_NEON
// 16x2 pixels -> 8x1. width is number of argb pixels. e.g. 16.
-#ifdef HAS_ARGB4444TOUVROW_NEON
void ARGB4444ToUVRow_NEON(const uint8* src_argb4444, int src_stride_argb4444,
uint8* dst_u, uint8* dst_v, int width) {
const uint8* src_argb4444_1 = src_argb4444 + src_stride_argb4444;
@@ -2057,9 +1954,7 @@ void ARGB4444ToUVRow_NEON(const uint8* src_argb4444, int src_stride_argb4444,
);
}
-#endif // HAS_ARGB4444TOUVROW_NEON
-#ifdef HAS_RGB565TOYROW_NEON
void RGB565ToYRow_NEON(const uint8* src_rgb565, uint8* dst_y, int width) {
asm volatile (
"movi v24.8b, #13 \n" // B * 0.1016 coefficient
@@ -2087,9 +1982,7 @@ void RGB565ToYRow_NEON(const uint8* src_rgb565, uint8* dst_y, int width) {
"v24", "v25", "v26", "v27"
);
}
-#endif // HAS_RGB565TOYROW_NEON
-#ifdef HAS_ARGB1555TOYROW_NEON
void ARGB1555ToYRow_NEON(const uint8* src_argb1555, uint8* dst_y, int width) {
asm volatile (
"movi v4.8b, #13 \n" // B * 0.1016 coefficient
@@ -2116,9 +2009,7 @@ void ARGB1555ToYRow_NEON(const uint8* src_argb1555, uint8* dst_y, int width) {
: "cc", "memory", "v0", "v1", "v2", "v3", "v4", "v5", "v6", "v7"
);
}
-#endif // HAS_ARGB1555TOYROW_NEON
-#ifdef HAS_ARGB4444TOYROW_NEON
void ARGB4444ToYRow_NEON(const uint8* src_argb4444, uint8* dst_y, int width) {
asm volatile (
"movi v24.8b, #13 \n" // B * 0.1016 coefficient
@@ -2145,9 +2036,7 @@ void ARGB4444ToYRow_NEON(const uint8* src_argb4444, uint8* dst_y, int width) {
: "cc", "memory", "v0", "v1", "v2", "v3", "v24", "v25", "v26", "v27"
);
}
-#endif // HAS_ARGB4444TOYROW_NEON
-#ifdef HAS_BGRATOYROW_NEON
void BGRAToYRow_NEON(const uint8* src_bgra, uint8* dst_y, int width) {
asm volatile (
"movi v4.8b, #33 \n" // R * 0.2578 coefficient
@@ -2173,9 +2062,7 @@ void BGRAToYRow_NEON(const uint8* src_bgra, uint8* dst_y, int width) {
: "cc", "memory", "v0", "v1", "v2", "v3", "v4", "v5", "v6", "v7", "v16"
);
}
-#endif // HAS_BGRATOYROW_NEON
-#ifdef HAS_ABGRTOYROW_NEON
void ABGRToYRow_NEON(const uint8* src_abgr, uint8* dst_y, int width) {
asm volatile (
"movi v4.8b, #33 \n" // R * 0.2578 coefficient
@@ -2201,9 +2088,7 @@ void ABGRToYRow_NEON(const uint8* src_abgr, uint8* dst_y, int width) {
: "cc", "memory", "v0", "v1", "v2", "v3", "v4", "v5", "v6", "v7", "v16"
);
}
-#endif // HAS_ABGRTOYROW_NEON
-#ifdef HAS_RGBATOYROW_NEON
void RGBAToYRow_NEON(const uint8* src_rgba, uint8* dst_y, int width) {
asm volatile (
"movi v4.8b, #13 \n" // B * 0.1016 coefficient
@@ -2229,9 +2114,7 @@ void RGBAToYRow_NEON(const uint8* src_rgba, uint8* dst_y, int width) {
: "cc", "memory", "v0", "v1", "v2", "v3", "v4", "v5", "v6", "v7", "v16"
);
}
-#endif // HAS_RGBATOYROW_NEON
-#ifdef HAS_RGB24TOYROW_NEON
void RGB24ToYRow_NEON(const uint8* src_rgb24, uint8* dst_y, int width) {
asm volatile (
"movi v4.8b, #13 \n" // B * 0.1016 coefficient
@@ -2257,9 +2140,7 @@ void RGB24ToYRow_NEON(const uint8* src_rgb24, uint8* dst_y, int width) {
: "cc", "memory", "v0", "v1", "v2", "v3", "v4", "v5", "v6", "v7", "v16"
);
}
-#endif // HAS_RGB24TOYROW_NEON
-#ifdef HAS_RAWTOYROW_NEON
void RAWToYRow_NEON(const uint8* src_raw, uint8* dst_y, int width) {
asm volatile (
"movi v4.8b, #33 \n" // R * 0.2578 coefficient
@@ -2285,10 +2166,8 @@ void RAWToYRow_NEON(const uint8* src_raw, uint8* dst_y, int width) {
: "cc", "memory", "v0", "v1", "v2", "v3", "v4", "v5", "v6", "v7", "v16"
);
}
-#endif // HAS_RAWTOYROW_NEON
// Bilinear filter 16x2 -> 16x1
-#ifdef HAS_INTERPOLATEROW_NEON
void InterpolateRow_NEON(uint8* dst_ptr,
const uint8* src_ptr, ptrdiff_t src_stride,
int dst_width, int source_y_fraction) {
@@ -2354,10 +2233,8 @@ void InterpolateRow_NEON(uint8* dst_ptr,
: "cc", "memory", "v0", "v1", "v3", "v4", "v5"
);
}
-#endif // HAS_INTERPOLATEROW_NEON
// dr * (256 - sa) / 256 + sr = dr - dr * sa / 256 + sr
-#ifdef HAS_ARGBBLENDROW_NEON
void ARGBBlendRow_NEON(const uint8* src_argb0, const uint8* src_argb1,
uint8* dst_argb, int width) {
asm volatile (
@@ -2426,10 +2303,8 @@ void ARGBBlendRow_NEON(const uint8* src_argb0, const uint8* src_argb1,
"v16", "v17", "v18"
);
}
-#endif // HAS_ARGBBLENDROW_NEON
// Attenuate 8 pixels at a time.
-#ifdef HAS_ARGBATTENUATEROW_NEON
void ARGBAttenuateRow_NEON(const uint8* src_argb, uint8* dst_argb, int width) {
asm volatile (
// Attenuate 8 pixels.
@@ -2453,11 +2328,9 @@ void ARGBAttenuateRow_NEON(const uint8* src_argb, uint8* dst_argb, int width) {
: "cc", "memory", "v0", "v1", "v2", "v3", "v4", "v5", "v6"
);
}
-#endif // HAS_ARGBATTENUATEROW_NEON
// Quantize 8 ARGB pixels (32 bytes).
// dst = (dst * scale >> 16) * interval_size + interval_offset;
-#ifdef HAS_ARGBQUANTIZEROW_NEON
void ARGBQuantizeRow_NEON(uint8* dst_argb, int scale, int interval_size,
int interval_offset, int width) {
asm volatile (
@@ -2497,12 +2370,10 @@ void ARGBQuantizeRow_NEON(uint8* dst_argb, int scale, int interval_size,
: "cc", "memory", "v0", "v1", "v2", "v3", "v4", "v5", "v6"
);
}
-#endif // HAS_ARGBQUANTIZEROW_NEON
// Shade 8 pixels at a time by specified value.
// NOTE vqrdmulh.s16 q10, q10, d0[0] must use a scaler register from 0 to 8.
// Rounding in vqrdmulh does +1 to high if high bit of low s16 is set.
-#ifdef HAS_ARGBSHADEROW_NEON
void ARGBShadeRow_NEON(const uint8* src_argb, uint8* dst_argb, int width,
uint32 value) {
asm volatile (
@@ -2537,12 +2408,10 @@ void ARGBShadeRow_NEON(const uint8* src_argb, uint8* dst_argb, int width,
: "cc", "memory", "v0", "v4", "v5", "v6", "v7"
);
}
-#endif // HAS_ARGBSHADEROW_NEON
// Convert 8 ARGB pixels (64 bytes) to 8 Gray ARGB pixels
// Similar to ARGBToYJ but stores ARGB.
// C code is (15 * b + 75 * g + 38 * r + 64) >> 7;
-#ifdef HAS_ARGBGRAYROW_NEON
void ARGBGrayRow_NEON(const uint8* src_argb, uint8* dst_argb, int width) {
asm volatile (
"movi v24.8b, #15 \n" // B * 0.11400 coefficient
@@ -2568,14 +2437,12 @@ void ARGBGrayRow_NEON(const uint8* src_argb, uint8* dst_argb, int width) {
: "cc", "memory", "v0", "v1", "v2", "v3", "v4", "v24", "v25", "v26"
);
}
-#endif // HAS_ARGBGRAYROW_NEON
// Convert 8 ARGB pixels (32 bytes) to 8 Sepia ARGB pixels.
// b = (r * 35 + g * 68 + b * 17) >> 7
// g = (r * 45 + g * 88 + b * 22) >> 7
// r = (r * 50 + g * 98 + b * 24) >> 7
-#ifdef HAS_ARGBSEPIAROW_NEON
void ARGBSepiaRow_NEON(uint8* dst_argb, int width) {
asm volatile (
"movi v20.8b, #17 \n" // BB coefficient
@@ -2613,12 +2480,10 @@ void ARGBSepiaRow_NEON(uint8* dst_argb, int width) {
"v20", "v21", "v22", "v24", "v25", "v26", "v28", "v29", "v30"
);
}
-#endif // HAS_ARGBSEPIAROW_NEON
// Tranform 8 ARGB pixels (32 bytes) with color matrix.
// TODO(fbarchard): Was same as Sepia except matrix is provided. This function
// needs to saturate. Consider doing a non-saturating version.
-#ifdef HAS_ARGBCOLORMATRIXROW_NEON
void ARGBColorMatrixRow_NEON(const uint8* src_argb, uint8* dst_argb,
const int8* matrix_argb, int width) {
asm volatile (
@@ -2678,11 +2543,9 @@ void ARGBColorMatrixRow_NEON(const uint8* src_argb, uint8* dst_argb,
"v18", "v19", "v22", "v23", "v24", "v25"
);
}
-#endif // HAS_ARGBCOLORMATRIXROW_NEON
// TODO(fbarchard): fix vqshrun in ARGBMultiplyRow_NEON and reenable.
// Multiply 2 rows of ARGB pixels together, 8 pixels at a time.
-#ifdef HAS_ARGBMULTIPLYROW_NEON
void ARGBMultiplyRow_NEON(const uint8* src_argb0, const uint8* src_argb1,
uint8* dst_argb, int width) {
asm volatile (
@@ -2713,10 +2576,8 @@ void ARGBMultiplyRow_NEON(const uint8* src_argb0, const uint8* src_argb1,
: "cc", "memory", "v0", "v1", "v2", "v3", "v4", "v5", "v6", "v7"
);
}
-#endif // HAS_ARGBMULTIPLYROW_NEON
// Add 2 rows of ARGB pixels together, 8 pixels at a time.
-#ifdef HAS_ARGBADDROW_NEON
void ARGBAddRow_NEON(const uint8* src_argb0, const uint8* src_argb1,
uint8* dst_argb, int width) {
asm volatile (
@@ -2743,10 +2604,8 @@ void ARGBAddRow_NEON(const uint8* src_argb0, const uint8* src_argb1,
: "cc", "memory", "v0", "v1", "v2", "v3", "v4", "v5", "v6", "v7"
);
}
-#endif // HAS_ARGBADDROW_NEON
// Subtract 2 rows of ARGB pixels, 8 pixels at a time.
-#ifdef HAS_ARGBSUBTRACTROW_NEON
void ARGBSubtractRow_NEON(const uint8* src_argb0, const uint8* src_argb1,
uint8* dst_argb, int width) {
asm volatile (
@@ -2773,14 +2632,12 @@ void ARGBSubtractRow_NEON(const uint8* src_argb0, const uint8* src_argb1,
: "cc", "memory", "v0", "v1", "v2", "v3", "v4", "v5", "v6", "v7"
);
}
-#endif // HAS_ARGBSUBTRACTROW_NEON
// Adds Sobel X and Sobel Y and stores Sobel into ARGB.
// A = 255
// R = Sobel
// G = Sobel
// B = Sobel
-#ifdef HAS_SOBELROW_NEON
void SobelRow_NEON(const uint8* src_sobelx, const uint8* src_sobely,
uint8* dst_argb, int width) {
asm volatile (
@@ -2806,10 +2663,8 @@ void SobelRow_NEON(const uint8* src_sobelx, const uint8* src_sobely,
: "cc", "memory", "v0", "v1", "v2", "v3"
);
}
-#endif // HAS_SOBELROW_NEON
// Adds Sobel X and Sobel Y and stores Sobel into plane.
-#ifdef HAS_SOBELTOPLANEROW_NEON
void SobelToPlaneRow_NEON(const uint8* src_sobelx, const uint8* src_sobely,
uint8* dst_y, int width) {
asm volatile (
@@ -2832,14 +2687,12 @@ void SobelToPlaneRow_NEON(const uint8* src_sobelx, const uint8* src_sobely,
: "cc", "memory", "v0", "v1"
);
}
-#endif // HAS_SOBELTOPLANEROW_NEON
// Mixes Sobel X, Sobel Y and Sobel into ARGB.
// A = 255
// R = Sobel X
// G = Sobel
// B = Sobel Y
-#ifdef HAS_SOBELXYROW_NEON
void SobelXYRow_NEON(const uint8* src_sobelx, const uint8* src_sobely,
uint8* dst_argb, int width) {
asm volatile (
@@ -2863,13 +2716,11 @@ void SobelXYRow_NEON(const uint8* src_sobelx, const uint8* src_sobely,
: "cc", "memory", "v0", "v1", "v2", "v3"
);
}
-#endif // HAS_SOBELXYROW_NEON
// SobelX as a matrix is
// -1 0 1
// -2 0 2
// -1 0 1
-#ifdef HAS_SOBELXROW_NEON
void SobelXRow_NEON(const uint8* src_y0, const uint8* src_y1,
const uint8* src_y2, uint8* dst_sobelx, int width) {
asm volatile (
@@ -2908,13 +2759,11 @@ void SobelXRow_NEON(const uint8* src_y0, const uint8* src_y1,
: "cc", "memory", "v0", "v1", "v2", "v3" // Clobber List
);
}
-#endif // HAS_SOBELXROW_NEON
// SobelY as a matrix is
// -1 -2 -1
// 0 0 0
// 1 2 1
-#ifdef HAS_SOBELYROW_NEON
void SobelYRow_NEON(const uint8* src_y0, const uint8* src_y1,
uint8* dst_sobely, int width) {
asm volatile (
@@ -2952,7 +2801,6 @@ void SobelYRow_NEON(const uint8* src_y0, const uint8* src_y1,
: "cc", "memory", "v0", "v1", "v2", "v3" // Clobber List
);
}
-#endif // HAS_SOBELYROW_NEON
#endif // !defined(LIBYUV_DISABLE_NEON) && defined(__aarch64__)
#ifdef __cplusplus
diff --git a/TMessagesProj/jni/libyuv/source/row_win.cc b/TMessagesProj/jni/libyuv/source/row_win.cc
index a8c16c3c1..cdb760603 100644
--- a/TMessagesProj/jni/libyuv/source/row_win.cc
+++ b/TMessagesProj/jni/libyuv/source/row_win.cc
@@ -3532,6 +3532,33 @@ void ARGBCopyAlphaRow_AVX2(const uint8* src, uint8* dst, int width) {
}
#endif // HAS_ARGBCOPYALPHAROW_AVX2
+#ifdef HAS_ARGBEXTRACTALPHAROW_SSE2
+// width in pixels
+__declspec(naked)
+void ARGBExtractAlphaRow_SSE2(const uint8* src_argb, uint8* dst_a, int width) {
+ __asm {
+ mov eax, [esp + 4] // src_argb
+ mov edx, [esp + 8] // dst_a
+ mov ecx, [esp + 12] // width
+
+ extractloop:
+ movdqu xmm0, [eax]
+ movdqu xmm1, [eax + 16]
+ lea eax, [eax + 32]
+ psrld xmm0, 24
+ psrld xmm1, 24
+ packssdw xmm0, xmm1
+ packuswb xmm0, xmm0
+ movq qword ptr [edx], xmm0
+ lea edx, [edx + 8]
+ sub ecx, 8
+ jg extractloop
+
+ ret
+ }
+}
+#endif // HAS_ARGBEXTRACTALPHAROW_SSE2
+
#ifdef HAS_ARGBCOPYYTOALPHAROW_SSE2
// width in pixels
__declspec(naked)
@@ -5248,6 +5275,7 @@ void SobelXYRow_SSE2(const uint8* src_sobelx, const uint8* src_sobely,
// dst points to pixel to store result to.
// count is number of averaged pixels to produce.
// Does 4 pixels at a time.
+// This function requires alignment on accumulation buffer pointers.
void CumulativeSumToAverageRow_SSE2(const int32* topleft, const int32* botleft,
int width, int area, uint8* dst,
int count) {
diff --git a/TMessagesProj/jni/libyuv/source/video_common.cc b/TMessagesProj/jni/libyuv/source/video_common.cc
index 379a0669a..00fb71e18 100644
--- a/TMessagesProj/jni/libyuv/source/video_common.cc
+++ b/TMessagesProj/jni/libyuv/source/video_common.cc
@@ -25,6 +25,7 @@ struct FourCCAliasEntry {
static const struct FourCCAliasEntry kFourCCAliases[] = {
{FOURCC_IYUV, FOURCC_I420},
+ {FOURCC_YU12, FOURCC_I420},
{FOURCC_YU16, FOURCC_I422},
{FOURCC_YU24, FOURCC_I444},
{FOURCC_YUYV, FOURCC_YUY2},
diff --git a/TMessagesProj/src/main/AndroidManifest.xml b/TMessagesProj/src/main/AndroidManifest.xml
index e88b0da7b..abf2f25ad 100644
--- a/TMessagesProj/src/main/AndroidManifest.xml
+++ b/TMessagesProj/src/main/AndroidManifest.xml
@@ -231,6 +231,8 @@
+
+
diff --git a/TMessagesProj/src/main/java/org/telegram/messenger/AndroidUtilities.java b/TMessagesProj/src/main/java/org/telegram/messenger/AndroidUtilities.java
index 2ecda7417..8fa36b6b8 100644
--- a/TMessagesProj/src/main/java/org/telegram/messenger/AndroidUtilities.java
+++ b/TMessagesProj/src/main/java/org/telegram/messenger/AndroidUtilities.java
@@ -8,6 +8,9 @@
package org.telegram.messenger;
+import android.animation.Animator;
+import android.animation.AnimatorSet;
+import android.animation.ObjectAnimator;
import android.annotation.SuppressLint;
import android.app.Activity;
import android.app.AlertDialog;
@@ -48,6 +51,7 @@ import android.view.Surface;
import android.view.View;
import android.view.WindowManager;
import android.view.inputmethod.InputMethodManager;
+import android.webkit.MimeTypeMap;
import android.widget.AbsListView;
import android.widget.EdgeEffect;
import android.widget.EditText;
@@ -61,10 +65,6 @@ import net.hockeyapp.android.UpdateManager;
import org.telegram.tgnet.ConnectionsManager;
import org.telegram.tgnet.TLRPC;
-import org.telegram.messenger.AnimationCompat.AnimatorListenerAdapterProxy;
-import org.telegram.messenger.AnimationCompat.AnimatorSetProxy;
-import org.telegram.messenger.AnimationCompat.ObjectAnimatorProxy;
-import org.telegram.messenger.AnimationCompat.ViewProxy;
import org.telegram.ui.ActionBar.BaseFragment;
import org.telegram.ui.Components.ForegroundDetector;
import org.telegram.ui.Components.NumberPicker;
@@ -156,11 +156,7 @@ public class AndroidUtilities {
}
}
} else if (drawable instanceof ColorDrawable) {
- if (Build.VERSION.SDK_INT >= 11) {
- bitmapColor = ((ColorDrawable) drawable).getColor();
- } else {
- bitmapColor = ApplicationLoader.applicationContext.getSharedPreferences("mainconfig", Activity.MODE_PRIVATE).getInt("selectedColor", 0xff000000);
- }
+ bitmapColor = ((ColorDrawable) drawable).getColor();
}
} catch (Exception e) {
FileLog.e("tmessages", e);
@@ -500,11 +496,7 @@ public class AndroidUtilities {
Display display = manager.getDefaultDisplay();
if (display != null) {
display.getMetrics(displayMetrics);
- if (android.os.Build.VERSION.SDK_INT < 13) {
- displaySize.set(display.getWidth(), display.getHeight());
- } else {
- display.getSize(displaySize);
- }
+ display.getSize(displaySize);
FileLog.e("tmessages", "display size = " + displaySize.x + " " + displaySize.y + " " + displayMetrics.xdpi + "x" + displayMetrics.ydpi);
}
}
@@ -685,7 +677,7 @@ public class AndroidUtilities {
}
public static void clearCursorDrawable(EditText editText) {
- if (editText == null || Build.VERSION.SDK_INT < 12) {
+ if (editText == null) {
return;
}
try {
@@ -883,6 +875,19 @@ public class AndroidUtilities {
return size;
}
+ public static CharSequence getTrimmedString(CharSequence src) {
+ if (src == null || src.length() == 0) {
+ return src;
+ }
+ while (src.length() > 0 && (src.charAt(0) == '\n' || src.charAt(0) == ' ')) {
+ src = src.subSequence(1, src.length());
+ }
+ while (src.length() > 0 && (src.charAt(src.length() - 1) == '\n' || src.charAt(src.length() - 1) == ' ')) {
+ src = src.subSequence(0, src.length() - 1);
+ }
+ return src;
+ }
+
public static void setListViewEdgeEffectColor(AbsListView listView, int color) {
if (Build.VERSION.SDK_INT >= 21) {
try {
@@ -989,14 +994,9 @@ public class AndroidUtilities {
}
public static boolean needShowPasscode(boolean reset) {
- boolean wasInBackground;
- if (Build.VERSION.SDK_INT >= 14) {
- wasInBackground = ForegroundDetector.getInstance().isWasInBackground(reset);
- if (reset) {
- ForegroundDetector.getInstance().resetBackgroundVar();
- }
- } else {
- wasInBackground = UserConfig.lastPauseTime != 0;
+ boolean wasInBackground = ForegroundDetector.getInstance().isWasInBackground(reset);
+ if (reset) {
+ ForegroundDetector.getInstance().resetBackgroundVar();
}
return UserConfig.passcodeHash.length() > 0 && wasInBackground &&
(UserConfig.appLocked || UserConfig.autoLockIn != 0 && UserConfig.lastPauseTime != 0 && !UserConfig.appLocked && (UserConfig.lastPauseTime + UserConfig.autoLockIn) <= ConnectionsManager.getInstance().getCurrentTime());
@@ -1004,24 +1004,21 @@ public class AndroidUtilities {
public static void shakeView(final View view, final float x, final int num) {
if (num == 6) {
- ViewProxy.setTranslationX(view, 0);
- view.clearAnimation();
+ view.setTranslationX(0);
return;
}
- AnimatorSetProxy animatorSetProxy = new AnimatorSetProxy();
- animatorSetProxy.playTogether(ObjectAnimatorProxy.ofFloat(view, "translationX", AndroidUtilities.dp(x)));
- animatorSetProxy.setDuration(50);
- animatorSetProxy.addListener(new AnimatorListenerAdapterProxy() {
+ AnimatorSet animatorSet = new AnimatorSet();
+ animatorSet.playTogether(ObjectAnimator.ofFloat(view, "translationX", AndroidUtilities.dp(x)));
+ animatorSet.setDuration(50);
+ animatorSet.addListener(new AnimatorListenerAdapterProxy() {
@Override
- public void onAnimationEnd(Object animation) {
+ public void onAnimationEnd(Animator animation) {
shakeView(view, num == 5 ? 0 : -x, num + 1);
}
});
- animatorSetProxy.start();
+ animatorSet.start();
}
-
-
/*public static String ellipsize(String text, int maxLines, int maxWidth, TextPaint paint) {
if (text == null || paint == null) {
return null;
@@ -1058,7 +1055,7 @@ public class AndroidUtilities {
}*/
/*public static void turnOffHardwareAcceleration(Window window) {
- if (window == null || Build.MODEL == null || Build.VERSION.SDK_INT < 11) {
+ if (window == null || Build.MODEL == null) {
return;
}
if (Build.MODEL.contains("GT-S5301") ||
@@ -1094,14 +1091,9 @@ public class AndroidUtilities {
public static void addToClipboard(CharSequence str) {
try {
- if (Build.VERSION.SDK_INT < 11) {
- android.text.ClipboardManager clipboard = (android.text.ClipboardManager) ApplicationLoader.applicationContext.getSystemService(Context.CLIPBOARD_SERVICE);
- clipboard.setText(str);
- } else {
- android.content.ClipboardManager clipboard = (android.content.ClipboardManager) ApplicationLoader.applicationContext.getSystemService(Context.CLIPBOARD_SERVICE);
- android.content.ClipData clip = android.content.ClipData.newPlainText("label", str);
- clipboard.setPrimaryClip(clip);
- }
+ android.content.ClipboardManager clipboard = (android.content.ClipboardManager) ApplicationLoader.applicationContext.getSystemService(Context.CLIPBOARD_SERVICE);
+ android.content.ClipData clip = android.content.ClipData.newPlainText("label", str);
+ clipboard.setPrimaryClip(clip);
} catch (Exception e) {
FileLog.e("tmessages", e);
}
@@ -1389,4 +1381,50 @@ public class AndroidUtilities {
System.arraycopy(sha1, 0, key_hash, 0, 16);
return key_hash;
}
+
+ public static void openForView(MessageObject message, Activity activity) throws Exception {
+ File f = null;
+ String fileName = message.getFileName();
+ if (message.messageOwner.attachPath != null && message.messageOwner.attachPath.length() != 0) {
+ f = new File(message.messageOwner.attachPath);
+ }
+ if (f == null || !f.exists()) {
+ f = FileLoader.getPathToMessage(message.messageOwner);
+ }
+ if (f != null && f.exists()) {
+ String realMimeType = null;
+ Intent intent = new Intent(Intent.ACTION_VIEW);
+ MimeTypeMap myMime = MimeTypeMap.getSingleton();
+ int idx = fileName.lastIndexOf('.');
+ if (idx != -1) {
+ String ext = fileName.substring(idx + 1);
+ realMimeType = myMime.getMimeTypeFromExtension(ext.toLowerCase());
+ if (realMimeType == null) {
+ if (message.type == 9 || message.type == 0) {
+ realMimeType = message.getDocument().mime_type;
+ }
+ if (realMimeType == null || realMimeType.length() == 0) {
+ realMimeType = null;
+ }
+ }
+ if (realMimeType != null) {
+ intent.setDataAndType(Uri.fromFile(f), realMimeType);
+ } else {
+ intent.setDataAndType(Uri.fromFile(f), "text/plain");
+ }
+ } else {
+ intent.setDataAndType(Uri.fromFile(f), "text/plain");
+ }
+ if (realMimeType != null) {
+ try {
+ activity.startActivityForResult(intent, 500);
+ } catch (Exception e) {
+ intent.setDataAndType(Uri.fromFile(f), "text/plain");
+ activity.startActivityForResult(intent, 500);
+ }
+ } else {
+ activity.startActivityForResult(intent, 500);
+ }
+ }
+ }
}
diff --git a/TMessagesProj/src/main/java/org/telegram/messenger/Animation/Animator10.java b/TMessagesProj/src/main/java/org/telegram/messenger/Animation/Animator10.java
deleted file mode 100644
index 6defed840..000000000
--- a/TMessagesProj/src/main/java/org/telegram/messenger/Animation/Animator10.java
+++ /dev/null
@@ -1,191 +0,0 @@
-/*
- * Copyright (C) 2010 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.telegram.messenger.Animation;
-
-import android.view.animation.Interpolator;
-
-import java.util.ArrayList;
-
-public abstract class Animator10 implements Cloneable {
-
- ArrayList mListeners = null;
- ArrayList mPauseListeners = null;
- boolean mPaused = false;
-
- public abstract long getStartDelay();
-
- public abstract void setStartDelay(long startDelay);
-
- public abstract Animator10 setDuration(long duration);
-
- public abstract long getDuration();
-
- public abstract void setInterpolator(Interpolator value);
-
- public abstract boolean isRunning();
-
- public void start() {
-
- }
-
- public void cancel() {
-
- }
-
- public void end() {
-
- }
-
- @SuppressWarnings("unchecked")
- public void pause() {
- if (isStarted() && !mPaused) {
- mPaused = true;
- if (mPauseListeners != null) {
- ArrayList tmpListeners = (ArrayList) mPauseListeners.clone();
- int numListeners = tmpListeners.size();
- for (AnimatorPauseListener tmpListener : tmpListeners) {
- tmpListener.onAnimationPause(this);
- }
- }
- }
- }
-
- @SuppressWarnings("unchecked")
- public void resume() {
- if (mPaused) {
- mPaused = false;
- if (mPauseListeners != null) {
- ArrayList tmpListeners = (ArrayList) mPauseListeners.clone();
- int numListeners = tmpListeners.size();
- for (AnimatorPauseListener tmpListener : tmpListeners) {
- tmpListener.onAnimationResume(this);
- }
- }
- }
- }
-
- public boolean isPaused() {
- return mPaused;
- }
-
- public boolean isStarted() {
- return isRunning();
- }
-
- public Interpolator getInterpolator() {
- return null;
- }
-
- public void addListener(AnimatorListener listener) {
- if (mListeners == null) {
- mListeners = new ArrayList();
- }
- mListeners.add(listener);
- }
-
- public void removeListener(AnimatorListener listener) {
- if (mListeners == null) {
- return;
- }
- mListeners.remove(listener);
- if (mListeners.size() == 0) {
- mListeners = null;
- }
- }
-
- public ArrayList getListeners() {
- return mListeners;
- }
-
- public void addPauseListener(AnimatorPauseListener listener) {
- if (mPauseListeners == null) {
- mPauseListeners = new ArrayList();
- }
- mPauseListeners.add(listener);
- }
-
- public void removePauseListener(AnimatorPauseListener listener) {
- if (mPauseListeners == null) {
- return;
- }
- mPauseListeners.remove(listener);
- if (mPauseListeners.size() == 0) {
- mPauseListeners = null;
- }
- }
-
- public void removeAllListeners() {
- if (mListeners != null) {
- mListeners.clear();
- mListeners = null;
- }
- if (mPauseListeners != null) {
- mPauseListeners.clear();
- mPauseListeners = null;
- }
- }
-
- @Override
- public Animator10 clone() {
- try {
- final Animator10 anim = (Animator10) super.clone();
- if (mListeners != null) {
- ArrayList oldListeners = mListeners;
- anim.mListeners = new ArrayList();
- int numListeners = oldListeners.size();
- for (AnimatorListener oldListener : oldListeners) {
- anim.mListeners.add(oldListener);
- }
- }
- if (mPauseListeners != null) {
- ArrayList oldListeners = mPauseListeners;
- anim.mPauseListeners = new ArrayList();
- int numListeners = oldListeners.size();
- for (AnimatorPauseListener oldListener : oldListeners) {
- anim.mPauseListeners.add(oldListener);
- }
- }
- return anim;
- } catch (CloneNotSupportedException e) {
- throw new AssertionError();
- }
- }
-
- public void setupStartValues() {
-
- }
-
- public void setupEndValues() {
-
- }
-
- public void setTarget(Object target) {
-
- }
-
- public interface AnimatorListener {
- void onAnimationStart(Animator10 animation);
- void onAnimationEnd(Animator10 animation);
- void onAnimationCancel(Animator10 animation);
- void onAnimationRepeat(Animator10 animation);
- }
-
- public interface AnimatorPauseListener {
- void onAnimationPause(Animator10 animation);
- void onAnimationResume(Animator10 animation);
- }
-}
diff --git a/TMessagesProj/src/main/java/org/telegram/messenger/Animation/AnimatorListenerAdapter10.java b/TMessagesProj/src/main/java/org/telegram/messenger/Animation/AnimatorListenerAdapter10.java
deleted file mode 100644
index f5aefe9a8..000000000
--- a/TMessagesProj/src/main/java/org/telegram/messenger/Animation/AnimatorListenerAdapter10.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * Copyright (C) 2010 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.telegram.messenger.Animation;
-
-public abstract class AnimatorListenerAdapter10 implements Animator10.AnimatorListener, Animator10.AnimatorPauseListener {
-
- @Override
- public void onAnimationCancel(Animator10 animation) {
-
- }
-
- @Override
- public void onAnimationEnd(Animator10 animation) {
-
- }
-
- @Override
- public void onAnimationRepeat(Animator10 animation) {
-
- }
-
- @Override
- public void onAnimationStart(Animator10 animation) {
-
- }
-
- @Override
- public void onAnimationPause(Animator10 animation) {
-
- }
-
- @Override
- public void onAnimationResume(Animator10 animation) {
-
- }
-}
diff --git a/TMessagesProj/src/main/java/org/telegram/messenger/Animation/AnimatorSet10.java b/TMessagesProj/src/main/java/org/telegram/messenger/Animation/AnimatorSet10.java
deleted file mode 100644
index 2f749f2f0..000000000
--- a/TMessagesProj/src/main/java/org/telegram/messenger/Animation/AnimatorSet10.java
+++ /dev/null
@@ -1,705 +0,0 @@
-/*
- * Copyright (C) 2010 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.telegram.messenger.Animation;
-
-import android.view.animation.Interpolator;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.List;
-
-public final class AnimatorSet10 extends Animator10 {
-
- private ArrayList mPlayingSet = new ArrayList<>();
- private HashMap mNodeMap = new HashMap<>();
- private ArrayList mNodes = new ArrayList<>();
- private ArrayList mSortedNodes = new ArrayList<>();
- private boolean mNeedsSort = true;
- private AnimatorSetListener mSetListener = null;
- boolean mTerminated = false;
- private boolean mStarted = false;
- private long mStartDelay = 0;
- private ValueAnimator mDelayAnim = null;
- private long mDuration = -1;
- private Interpolator mInterpolator = null;
-
- public void playTogether(Animator10... items) {
- if (items != null) {
- mNeedsSort = true;
- Builder builder = play(items[0]);
- for (int i = 1; i < items.length; ++i) {
- builder.with(items[i]);
- }
- }
- }
-
- public void playTogether(Collection items) {
- if (items != null && items.size() > 0) {
- mNeedsSort = true;
- Builder builder = null;
- for (Animator10 anim : items) {
- if (builder == null) {
- builder = play(anim);
- } else {
- builder.with(anim);
- }
- }
- }
- }
-
- public void playSequentially(Animator10... items) {
- if (items != null) {
- mNeedsSort = true;
- if (items.length == 1) {
- play(items[0]);
- } else {
- for (int i = 0; i < items.length - 1; ++i) {
- play(items[i]).before(items[i+1]);
- }
- }
- }
- }
-
- public void playSequentially(List items) {
- if (items != null && items.size() > 0) {
- mNeedsSort = true;
- if (items.size() == 1) {
- play(items.get(0));
- } else {
- for (int i = 0; i < items.size() - 1; ++i) {
- play(items.get(i)).before(items.get(i+1));
- }
- }
- }
- }
-
- public ArrayList getChildAnimations() {
- ArrayList childList = new ArrayList<>();
- for (Node node : mNodes) {
- childList.add(node.animation);
- }
- return childList;
- }
-
- @Override
- public void setTarget(Object target) {
- for (Node node : mNodes) {
- Animator10 animation = node.animation;
- if (animation instanceof AnimatorSet10) {
- animation.setTarget(target);
- } else if (animation instanceof ObjectAnimator10) {
- animation.setTarget(target);
- }
- }
- }
-
- @Override
- public void setInterpolator(Interpolator interpolator) {
- mInterpolator = interpolator;
- }
-
- @Override
- public Interpolator getInterpolator() {
- return mInterpolator;
- }
-
- public Builder play(Animator10 anim) {
- if (anim != null) {
- mNeedsSort = true;
- return new Builder(anim);
- }
- return null;
- }
-
- @SuppressWarnings("unchecked")
- @Override
- public void cancel() {
- mTerminated = true;
- if (isStarted()) {
- ArrayList tmpListeners = null;
- if (mListeners != null) {
- tmpListeners = (ArrayList) mListeners.clone();
- for (AnimatorListener listener : tmpListeners) {
- listener.onAnimationCancel(this);
- }
- }
- if (mDelayAnim != null && mDelayAnim.isRunning()) {
- mDelayAnim.cancel();
- } else if (mSortedNodes.size() > 0) {
- for (Node node : mSortedNodes) {
- node.animation.cancel();
- }
- }
- if (tmpListeners != null) {
- for (AnimatorListener listener : tmpListeners) {
- listener.onAnimationEnd(this);
- }
- }
- mStarted = false;
- }
- }
-
- @SuppressWarnings("unchecked")
- @Override
- public void end() {
- mTerminated = true;
- if (isStarted()) {
- if (mSortedNodes.size() != mNodes.size()) {
- // hasn't been started yet - sort the nodes now, then end them
- sortNodes();
- for (Node node : mSortedNodes) {
- if (mSetListener == null) {
- mSetListener = new AnimatorSetListener(this);
- }
- node.animation.addListener(mSetListener);
- }
- }
- if (mDelayAnim != null) {
- mDelayAnim.cancel();
- }
- if (mSortedNodes.size() > 0) {
- for (Node node : mSortedNodes) {
- node.animation.end();
- }
- }
- if (mListeners != null) {
- ArrayList tmpListeners = (ArrayList) mListeners.clone();
- for (AnimatorListener listener : tmpListeners) {
- listener.onAnimationEnd(this);
- }
- }
- mStarted = false;
- }
- }
-
- @Override
- public boolean isRunning() {
- for (Node node : mNodes) {
- if (node.animation.isRunning()) {
- return true;
- }
- }
- return false;
- }
-
- @Override
- public boolean isStarted() {
- return mStarted;
- }
-
- @Override
- public long getStartDelay() {
- return mStartDelay;
- }
-
- @Override
- public void setStartDelay(long startDelay) {
- mStartDelay = startDelay;
- }
-
- @Override
- public long getDuration() {
- return mDuration;
- }
-
- @Override
- public AnimatorSet10 setDuration(long duration) {
- if (duration < 0) {
- throw new IllegalArgumentException("duration must be a value of zero or greater");
- }
- mDuration = duration;
- return this;
- }
-
- @Override
- public void setupStartValues() {
- for (Node node : mNodes) {
- node.animation.setupStartValues();
- }
- }
-
- @Override
- public void setupEndValues() {
- for (Node node : mNodes) {
- node.animation.setupEndValues();
- }
- }
-
- @Override
- public void pause() {
- boolean previouslyPaused = mPaused;
- super.pause();
- if (!previouslyPaused && mPaused) {
- if (mDelayAnim != null) {
- mDelayAnim.pause();
- } else {
- for (Node node : mNodes) {
- node.animation.pause();
- }
- }
- }
- }
-
- @Override
- public void resume() {
- boolean previouslyPaused = mPaused;
- super.resume();
- if (previouslyPaused && !mPaused) {
- if (mDelayAnim != null) {
- mDelayAnim.resume();
- } else {
- for (Node node : mNodes) {
- node.animation.resume();
- }
- }
- }
- }
-
- @SuppressWarnings("unchecked")
- @Override
- public void start() {
- mTerminated = false;
- mStarted = true;
- mPaused = false;
-
- if (mDuration >= 0) {
- for (Node node : mNodes) {
- node.animation.setDuration(mDuration);
- }
- }
- if (mInterpolator != null) {
- for (Node node : mNodes) {
- node.animation.setInterpolator(mInterpolator);
- }
- }
-
- sortNodes();
-
- int numSortedNodes = mSortedNodes.size();
- for (Node node : mSortedNodes) {
- ArrayList oldListeners = node.animation.getListeners();
- if (oldListeners != null && oldListeners.size() > 0) {
- final ArrayList clonedListeners = new
- ArrayList<>(oldListeners);
-
- for (AnimatorListener listener : clonedListeners) {
- if (listener instanceof DependencyListener ||
- listener instanceof AnimatorSetListener) {
- node.animation.removeListener(listener);
- }
- }
- }
- }
-
- final ArrayList nodesToStart = new ArrayList<>();
- for (Node node : mSortedNodes) {
- if (mSetListener == null) {
- mSetListener = new AnimatorSetListener(this);
- }
- if (node.dependencies == null || node.dependencies.size() == 0) {
- nodesToStart.add(node);
- } else {
- int numDependencies = node.dependencies.size();
- for (int j = 0; j < numDependencies; ++j) {
- Dependency dependency = node.dependencies.get(j);
- dependency.node.animation.addListener(
- new DependencyListener(this, node, dependency.rule));
- }
- node.tmpDependencies = (ArrayList) node.dependencies.clone();
- }
- node.animation.addListener(mSetListener);
- }
-
- if (mStartDelay <= 0) {
- for (Node node : nodesToStart) {
- node.animation.start();
- mPlayingSet.add(node.animation);
- }
- } else {
- mDelayAnim = ValueAnimator.ofFloat(0f, 1f);
- mDelayAnim.setDuration(mStartDelay);
- mDelayAnim.addListener(new AnimatorListenerAdapter10() {
- boolean canceled = false;
- public void onAnimationCancel(Animator10 anim) {
- canceled = true;
- }
- public void onAnimationEnd(Animator10 anim) {
- if (!canceled) {
- int numNodes = nodesToStart.size();
- for (Node node : nodesToStart) {
- node.animation.start();
- mPlayingSet.add(node.animation);
- }
- }
- mDelayAnim = null;
- }
- });
- mDelayAnim.start();
- }
- if (mListeners != null) {
- ArrayList tmpListeners =
- (ArrayList) mListeners.clone();
- int numListeners = tmpListeners.size();
- for (AnimatorListener tmpListener : tmpListeners) {
- tmpListener.onAnimationStart(this);
- }
- }
- if (mNodes.size() == 0 && mStartDelay == 0) {
- mStarted = false;
- if (mListeners != null) {
- ArrayList tmpListeners =
- (ArrayList) mListeners.clone();
- int numListeners = tmpListeners.size();
- for (AnimatorListener tmpListener : tmpListeners) {
- tmpListener.onAnimationEnd(this);
- }
- }
- }
- }
-
- @Override
- public AnimatorSet10 clone() {
- final AnimatorSet10 anim = (AnimatorSet10) super.clone();
-
- anim.mNeedsSort = true;
- anim.mTerminated = false;
- anim.mStarted = false;
- anim.mPlayingSet = new ArrayList<>();
- anim.mNodeMap = new HashMap<>();
- anim.mNodes = new ArrayList<>();
- anim.mSortedNodes = new ArrayList<>();
-
- HashMap nodeCloneMap = new HashMap<>();
- for (Node node : mNodes) {
- Node nodeClone = node.clone();
- nodeCloneMap.put(node, nodeClone);
- anim.mNodes.add(nodeClone);
- anim.mNodeMap.put(nodeClone.animation, nodeClone);
- nodeClone.dependencies = null;
- nodeClone.tmpDependencies = null;
- nodeClone.nodeDependents = null;
- nodeClone.nodeDependencies = null;
- ArrayList cloneListeners = nodeClone.animation.getListeners();
- if (cloneListeners != null) {
- ArrayList listenersToRemove = null;
- for (AnimatorListener listener : cloneListeners) {
- if (listener instanceof AnimatorSetListener) {
- if (listenersToRemove == null) {
- listenersToRemove = new ArrayList<>();
- }
- listenersToRemove.add(listener);
- }
- }
- if (listenersToRemove != null) {
- for (AnimatorListener listener : listenersToRemove) {
- cloneListeners.remove(listener);
- }
- }
- }
- }
- for (Node node : mNodes) {
- Node nodeClone = nodeCloneMap.get(node);
- if (node.dependencies != null) {
- for (Dependency dependency : node.dependencies) {
- Node clonedDependencyNode = nodeCloneMap.get(dependency.node);
- Dependency cloneDependency = new Dependency(clonedDependencyNode, dependency.rule);
- nodeClone.addDependency(cloneDependency);
- }
- }
- }
- return anim;
- }
-
- private static class DependencyListener implements AnimatorListener {
-
- private AnimatorSet10 mAnimatorSet;
- private Node mNode;
- private int mRule;
-
- public DependencyListener(AnimatorSet10 animatorSet, Node node, int rule) {
- this.mAnimatorSet = animatorSet;
- this.mNode = node;
- this.mRule = rule;
- }
-
- public void onAnimationCancel(Animator10 animation) {
-
- }
-
- public void onAnimationEnd(Animator10 animation) {
- if (mRule == Dependency.AFTER) {
- startIfReady(animation);
- }
- }
-
- public void onAnimationRepeat(Animator10 animation) {
-
- }
-
- public void onAnimationStart(Animator10 animation) {
- if (mRule == Dependency.WITH) {
- startIfReady(animation);
- }
- }
-
- private void startIfReady(Animator10 dependencyAnimation) {
- if (mAnimatorSet.mTerminated) {
- return;
- }
- Dependency dependencyToRemove = null;
- int numDependencies = mNode.tmpDependencies.size();
- for (int i = 0; i < numDependencies; ++i) {
- Dependency dependency = mNode.tmpDependencies.get(i);
- if (dependency.rule == mRule && dependency.node.animation == dependencyAnimation) {
- dependencyToRemove = dependency;
- dependencyAnimation.removeListener(this);
- break;
- }
- }
- mNode.tmpDependencies.remove(dependencyToRemove);
- if (mNode.tmpDependencies.size() == 0) {
- mNode.animation.start();
- mAnimatorSet.mPlayingSet.add(mNode.animation);
- }
- }
- }
-
- private class AnimatorSetListener implements AnimatorListener {
-
- private AnimatorSet10 mAnimatorSet;
-
- AnimatorSetListener(AnimatorSet10 animatorSet) {
- mAnimatorSet = animatorSet;
- }
-
- public void onAnimationCancel(Animator10 animation) {
- if (!mTerminated) {
- if (mPlayingSet.size() == 0) {
- if (mListeners != null) {
- int numListeners = mListeners.size();
- for (AnimatorListener mListener : mListeners) {
- mListener.onAnimationCancel(mAnimatorSet);
- }
- }
- }
- }
- }
-
- @SuppressWarnings("unchecked")
- public void onAnimationEnd(Animator10 animation) {
- animation.removeListener(this);
- mPlayingSet.remove(animation);
- Node animNode = mAnimatorSet.mNodeMap.get(animation);
- animNode.done = true;
- if (!mTerminated) {
- ArrayList sortedNodes = mAnimatorSet.mSortedNodes;
- boolean allDone = true;
- int numSortedNodes = sortedNodes.size();
- for (Node sortedNode : sortedNodes) {
- if (!sortedNode.done) {
- allDone = false;
- break;
- }
- }
- if (allDone) {
- if (mListeners != null) {
- ArrayList tmpListeners =
- (ArrayList) mListeners.clone();
- int numListeners = tmpListeners.size();
- for (AnimatorListener tmpListener : tmpListeners) {
- tmpListener.onAnimationEnd(mAnimatorSet);
- }
- }
- mAnimatorSet.mStarted = false;
- mAnimatorSet.mPaused = false;
- }
- }
- }
-
- public void onAnimationRepeat(Animator10 animation) {
-
- }
-
- public void onAnimationStart(Animator10 animation) {
-
- }
- }
-
- private void sortNodes() {
- if (mNeedsSort) {
- mSortedNodes.clear();
- ArrayList roots = new ArrayList<>();
- int numNodes = mNodes.size();
- for (Node node : mNodes) {
- if (node.dependencies == null || node.dependencies.size() == 0) {
- roots.add(node);
- }
- }
- ArrayList tmpRoots = new ArrayList<>();
- while (roots.size() > 0) {
- int numRoots = roots.size();
- for (Node root : roots) {
- mSortedNodes.add(root);
- if (root.nodeDependents != null) {
- int numDependents = root.nodeDependents.size();
- for (int j = 0; j < numDependents; ++j) {
- Node node = root.nodeDependents.get(j);
- node.nodeDependencies.remove(root);
- if (node.nodeDependencies.size() == 0) {
- tmpRoots.add(node);
- }
- }
- }
- }
- roots.clear();
- roots.addAll(tmpRoots);
- tmpRoots.clear();
- }
- mNeedsSort = false;
- if (mSortedNodes.size() != mNodes.size()) {
- throw new IllegalStateException("Circular dependencies cannot exist in AnimatorSet");
- }
- } else {
- int numNodes = mNodes.size();
- for (Node node : mNodes) {
- if (node.dependencies != null && node.dependencies.size() > 0) {
- int numDependencies = node.dependencies.size();
- for (int j = 0; j < numDependencies; ++j) {
- Dependency dependency = node.dependencies.get(j);
- if (node.nodeDependencies == null) {
- node.nodeDependencies = new ArrayList<>();
- }
- if (!node.nodeDependencies.contains(dependency.node)) {
- node.nodeDependencies.add(dependency.node);
- }
- }
- }
- node.done = false;
- }
- }
- }
-
- private static class Dependency {
- static final int WITH = 0;
- static final int AFTER = 1;
- public Node node;
- public int rule;
-
- public Dependency(Node node, int rule) {
- this.node = node;
- this.rule = rule;
- }
- }
-
- private static class Node implements Cloneable {
- public Animator10 animation;
- public ArrayList dependencies = null;
- public ArrayList tmpDependencies = null;
- public ArrayList nodeDependencies = null;
- public ArrayList nodeDependents = null;
- public boolean done = false;
-
- public Node(Animator10 animation) {
- this.animation = animation;
- }
-
- public void addDependency(Dependency dependency) {
- if (dependencies == null) {
- dependencies = new ArrayList<>();
- nodeDependencies = new ArrayList<>();
- }
- dependencies.add(dependency);
- if (!nodeDependencies.contains(dependency.node)) {
- nodeDependencies.add(dependency.node);
- }
- Node dependencyNode = dependency.node;
- if (dependencyNode.nodeDependents == null) {
- dependencyNode.nodeDependents = new ArrayList<>();
- }
- dependencyNode.nodeDependents.add(this);
- }
-
- @Override
- public Node clone() {
- try {
- Node node = (Node) super.clone();
- node.animation = animation.clone();
- return node;
- } catch (CloneNotSupportedException e) {
- throw new AssertionError();
- }
- }
- }
-
- public class Builder {
-
- private Node mCurrentNode;
-
- Builder(Animator10 anim) {
- mCurrentNode = mNodeMap.get(anim);
- if (mCurrentNode == null) {
- mCurrentNode = new Node(anim);
- mNodeMap.put(anim, mCurrentNode);
- mNodes.add(mCurrentNode);
- }
- }
-
- public Builder with(Animator10 anim) {
- Node node = mNodeMap.get(anim);
- if (node == null) {
- node = new Node(anim);
- mNodeMap.put(anim, node);
- mNodes.add(node);
- }
- Dependency dependency = new Dependency(mCurrentNode, Dependency.WITH);
- node.addDependency(dependency);
- return this;
- }
-
- public Builder before(Animator10 anim) {
- Node node = mNodeMap.get(anim);
- if (node == null) {
- node = new Node(anim);
- mNodeMap.put(anim, node);
- mNodes.add(node);
- }
- Dependency dependency = new Dependency(mCurrentNode, Dependency.AFTER);
- node.addDependency(dependency);
- return this;
- }
-
- public Builder after(Animator10 anim) {
- Node node = mNodeMap.get(anim);
- if (node == null) {
- node = new Node(anim);
- mNodeMap.put(anim, node);
- mNodes.add(node);
- }
- Dependency dependency = new Dependency(node, Dependency.AFTER);
- mCurrentNode.addDependency(dependency);
- return this;
- }
-
- public Builder after(long delay) {
- ValueAnimator anim = ValueAnimator.ofFloat(0f, 1f);
- anim.setDuration(delay);
- after(anim);
- return this;
- }
- }
-}
diff --git a/TMessagesProj/src/main/java/org/telegram/messenger/Animation/FloatKeyframeSet.java b/TMessagesProj/src/main/java/org/telegram/messenger/Animation/FloatKeyframeSet.java
deleted file mode 100644
index e7865e05c..000000000
--- a/TMessagesProj/src/main/java/org/telegram/messenger/Animation/FloatKeyframeSet.java
+++ /dev/null
@@ -1,114 +0,0 @@
-/*
- * Copyright (C) 2010 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.telegram.messenger.Animation;
-
-import android.view.animation.Interpolator;
-
-import org.telegram.messenger.Animation.Keyframe.FloatKeyframe;
-
-import java.util.ArrayList;
-
-class FloatKeyframeSet extends KeyframeSet {
- private float firstValue;
- private float lastValue;
- private float deltaValue;
- private boolean firstTime = true;
-
- public FloatKeyframeSet(FloatKeyframe... keyframes) {
- super(keyframes);
- }
-
- @Override
- public Object getValue(float fraction) {
- return getFloatValue(fraction);
- }
-
- @Override
- public FloatKeyframeSet clone() {
- ArrayList keyframes = mKeyframes;
- int numKeyframes = mKeyframes.size();
- FloatKeyframe[] newKeyframes = new FloatKeyframe[numKeyframes];
- for (int i = 0; i < numKeyframes; ++i) {
- newKeyframes[i] = (FloatKeyframe) keyframes.get(i).clone();
- }
- return new FloatKeyframeSet(newKeyframes);
- }
-
- @SuppressWarnings("unchecked")
- public float getFloatValue(float fraction) {
- if (mNumKeyframes == 2) {
- if (firstTime) {
- firstTime = false;
- firstValue = ((FloatKeyframe) mKeyframes.get(0)).getFloatValue();
- lastValue = ((FloatKeyframe) mKeyframes.get(1)).getFloatValue();
- deltaValue = lastValue - firstValue;
- }
- if (mInterpolator != null) {
- fraction = mInterpolator.getInterpolation(fraction);
- }
- if (mEvaluator == null) {
- return firstValue + fraction * deltaValue;
- } else {
- return ((Number)mEvaluator.evaluate(fraction, firstValue, lastValue)).floatValue();
- }
- }
- if (fraction <= 0f) {
- final FloatKeyframe prevKeyframe = (FloatKeyframe) mKeyframes.get(0);
- final FloatKeyframe nextKeyframe = (FloatKeyframe) mKeyframes.get(1);
- float prevValue = prevKeyframe.getFloatValue();
- float nextValue = nextKeyframe.getFloatValue();
- float prevFraction = prevKeyframe.getFraction();
- float nextFraction = nextKeyframe.getFraction();
- final Interpolator interpolator = nextKeyframe.getInterpolator();
- if (interpolator != null) {
- fraction = interpolator.getInterpolation(fraction);
- }
- float intervalFraction = (fraction - prevFraction) / (nextFraction - prevFraction);
- return mEvaluator == null ? prevValue + intervalFraction * (nextValue - prevValue) : ((Number)mEvaluator.evaluate(intervalFraction, prevValue, nextValue)).floatValue();
- } else if (fraction >= 1f) {
- final FloatKeyframe prevKeyframe = (FloatKeyframe) mKeyframes.get(mNumKeyframes - 2);
- final FloatKeyframe nextKeyframe = (FloatKeyframe) mKeyframes.get(mNumKeyframes - 1);
- float prevValue = prevKeyframe.getFloatValue();
- float nextValue = nextKeyframe.getFloatValue();
- float prevFraction = prevKeyframe.getFraction();
- float nextFraction = nextKeyframe.getFraction();
- final Interpolator interpolator = nextKeyframe.getInterpolator();
- if (interpolator != null) {
- fraction = interpolator.getInterpolation(fraction);
- }
- float intervalFraction = (fraction - prevFraction) / (nextFraction - prevFraction);
- return mEvaluator == null ? prevValue + intervalFraction * (nextValue - prevValue) : ((Number)mEvaluator.evaluate(intervalFraction, prevValue, nextValue)).floatValue();
- }
- FloatKeyframe prevKeyframe = (FloatKeyframe) mKeyframes.get(0);
- for (int i = 1; i < mNumKeyframes; ++i) {
- FloatKeyframe nextKeyframe = (FloatKeyframe) mKeyframes.get(i);
- if (fraction < nextKeyframe.getFraction()) {
- final Interpolator interpolator = nextKeyframe.getInterpolator();
- if (interpolator != null) {
- fraction = interpolator.getInterpolation(fraction);
- }
- float intervalFraction = (fraction - prevKeyframe.getFraction()) /
- (nextKeyframe.getFraction() - prevKeyframe.getFraction());
- float prevValue = prevKeyframe.getFloatValue();
- float nextValue = nextKeyframe.getFloatValue();
- return mEvaluator == null ? prevValue + intervalFraction * (nextValue - prevValue) : ((Number)mEvaluator.evaluate(intervalFraction, prevValue, nextValue)).floatValue();
- }
- prevKeyframe = nextKeyframe;
- }
- return ((Number)mKeyframes.get(mNumKeyframes - 1).getValue()).floatValue();
- }
-}
diff --git a/TMessagesProj/src/main/java/org/telegram/messenger/Animation/IntKeyframeSet.java b/TMessagesProj/src/main/java/org/telegram/messenger/Animation/IntKeyframeSet.java
deleted file mode 100644
index 2224f2126..000000000
--- a/TMessagesProj/src/main/java/org/telegram/messenger/Animation/IntKeyframeSet.java
+++ /dev/null
@@ -1,114 +0,0 @@
-/*
- * Copyright (C) 2010 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.telegram.messenger.Animation;
-
-import android.view.animation.Interpolator;
-
-import org.telegram.messenger.Animation.Keyframe.IntKeyframe;
-
-import java.util.ArrayList;
-
-class IntKeyframeSet extends KeyframeSet {
- private int firstValue;
- private int lastValue;
- private int deltaValue;
- private boolean firstTime = true;
-
- public IntKeyframeSet(IntKeyframe... keyframes) {
- super(keyframes);
- }
-
- @Override
- public Object getValue(float fraction) {
- return getIntValue(fraction);
- }
-
- @Override
- public IntKeyframeSet clone() {
- ArrayList keyframes = mKeyframes;
- int numKeyframes = mKeyframes.size();
- IntKeyframe[] newKeyframes = new IntKeyframe[numKeyframes];
- for (int i = 0; i < numKeyframes; ++i) {
- newKeyframes[i] = (IntKeyframe) keyframes.get(i).clone();
- }
- return new IntKeyframeSet(newKeyframes);
- }
-
- @SuppressWarnings("unchecked")
- public int getIntValue(float fraction) {
- if (mNumKeyframes == 2) {
- if (firstTime) {
- firstTime = false;
- firstValue = ((IntKeyframe) mKeyframes.get(0)).getIntValue();
- lastValue = ((IntKeyframe) mKeyframes.get(1)).getIntValue();
- deltaValue = lastValue - firstValue;
- }
- if (mInterpolator != null) {
- fraction = mInterpolator.getInterpolation(fraction);
- }
- if (mEvaluator == null) {
- return firstValue + (int)(fraction * deltaValue);
- } else {
- return ((Number)mEvaluator.evaluate(fraction, firstValue, lastValue)).intValue();
- }
- }
- if (fraction <= 0f) {
- final IntKeyframe prevKeyframe = (IntKeyframe) mKeyframes.get(0);
- final IntKeyframe nextKeyframe = (IntKeyframe) mKeyframes.get(1);
- int prevValue = prevKeyframe.getIntValue();
- int nextValue = nextKeyframe.getIntValue();
- float prevFraction = prevKeyframe.getFraction();
- float nextFraction = nextKeyframe.getFraction();
- final Interpolator interpolator = nextKeyframe.getInterpolator();
- if (interpolator != null) {
- fraction = interpolator.getInterpolation(fraction);
- }
- float intervalFraction = (fraction - prevFraction) / (nextFraction - prevFraction);
- return mEvaluator == null ? prevValue + (int)(intervalFraction * (nextValue - prevValue)) : ((Number)mEvaluator.evaluate(intervalFraction, prevValue, nextValue)).intValue();
- } else if (fraction >= 1f) {
- final IntKeyframe prevKeyframe = (IntKeyframe) mKeyframes.get(mNumKeyframes - 2);
- final IntKeyframe nextKeyframe = (IntKeyframe) mKeyframes.get(mNumKeyframes - 1);
- int prevValue = prevKeyframe.getIntValue();
- int nextValue = nextKeyframe.getIntValue();
- float prevFraction = prevKeyframe.getFraction();
- float nextFraction = nextKeyframe.getFraction();
- final Interpolator interpolator = nextKeyframe.getInterpolator();
- if (interpolator != null) {
- fraction = interpolator.getInterpolation(fraction);
- }
- float intervalFraction = (fraction - prevFraction) / (nextFraction - prevFraction);
- return mEvaluator == null ? prevValue + (int)(intervalFraction * (nextValue - prevValue)) : ((Number)mEvaluator.evaluate(intervalFraction, prevValue, nextValue)).intValue();
- }
- IntKeyframe prevKeyframe = (IntKeyframe) mKeyframes.get(0);
- for (int i = 1; i < mNumKeyframes; ++i) {
- IntKeyframe nextKeyframe = (IntKeyframe) mKeyframes.get(i);
- if (fraction < nextKeyframe.getFraction()) {
- final Interpolator interpolator = nextKeyframe.getInterpolator();
- if (interpolator != null) {
- fraction = interpolator.getInterpolation(fraction);
- }
- float intervalFraction = (fraction - prevKeyframe.getFraction()) / (nextKeyframe.getFraction() - prevKeyframe.getFraction());
- int prevValue = prevKeyframe.getIntValue();
- int nextValue = nextKeyframe.getIntValue();
- return mEvaluator == null ? prevValue + (int)(intervalFraction * (nextValue - prevValue)) : ((Number)mEvaluator.evaluate(intervalFraction, prevValue, nextValue)).intValue();
- }
- prevKeyframe = nextKeyframe;
- }
- return ((Number)mKeyframes.get(mNumKeyframes - 1).getValue()).intValue();
- }
-}
-
diff --git a/TMessagesProj/src/main/java/org/telegram/messenger/Animation/Keyframe.java b/TMessagesProj/src/main/java/org/telegram/messenger/Animation/Keyframe.java
deleted file mode 100644
index b65ddaf44..000000000
--- a/TMessagesProj/src/main/java/org/telegram/messenger/Animation/Keyframe.java
+++ /dev/null
@@ -1,187 +0,0 @@
-/*
- * Copyright (C) 2010 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.telegram.messenger.Animation;
-
-import android.view.animation.Interpolator;
-
-public abstract class Keyframe implements Cloneable {
-
- float mFraction;
- Class mValueType;
- private Interpolator mInterpolator = null;
- boolean mHasValue = false;
-
- public static Keyframe ofInt(float fraction, int value) {
- return new IntKeyframe(fraction, value);
- }
-
- public static Keyframe ofInt(float fraction) {
- return new IntKeyframe(fraction);
- }
-
- public static Keyframe ofFloat(float fraction, float value) {
- return new FloatKeyframe(fraction, value);
- }
-
- public static Keyframe ofFloat(float fraction) {
- return new FloatKeyframe(fraction);
- }
-
- public static Keyframe ofObject(float fraction, Object value) {
- return new ObjectKeyframe(fraction, value);
- }
-
- public static Keyframe ofObject(float fraction) {
- return new ObjectKeyframe(fraction, null);
- }
-
- public boolean hasValue() {
- return mHasValue;
- }
-
- public abstract Object getValue();
- public abstract void setValue(Object value);
-
- public float getFraction() {
- return mFraction;
- }
-
- public void setFraction(float fraction) {
- mFraction = fraction;
- }
-
- public Interpolator getInterpolator() {
- return mInterpolator;
- }
-
- public void setInterpolator(Interpolator interpolator) {
- mInterpolator = interpolator;
- }
-
- public Class getType() {
- return mValueType;
- }
-
- @Override
- public abstract Keyframe clone();
-
- static class ObjectKeyframe extends Keyframe {
-
- Object mValue;
-
- ObjectKeyframe(float fraction, Object value) {
- mFraction = fraction;
- mValue = value;
- mHasValue = (value != null);
- mValueType = mHasValue ? value.getClass() : Object.class;
- }
-
- public Object getValue() {
- return mValue;
- }
-
- public void setValue(Object value) {
- mValue = value;
- mHasValue = (value != null);
- }
-
- @Override
- public ObjectKeyframe clone() {
- ObjectKeyframe kfClone = new ObjectKeyframe(getFraction(), mHasValue ? mValue : null);
- kfClone.setInterpolator(getInterpolator());
- return kfClone;
- }
- }
-
- static class IntKeyframe extends Keyframe {
-
- int mValue;
-
- IntKeyframe(float fraction, int value) {
- mFraction = fraction;
- mValue = value;
- mValueType = int.class;
- mHasValue = true;
- }
-
- IntKeyframe(float fraction) {
- mFraction = fraction;
- mValueType = int.class;
- }
-
- public int getIntValue() {
- return mValue;
- }
-
- public Object getValue() {
- return mValue;
- }
-
- public void setValue(Object value) {
- if (value != null && value.getClass() == Integer.class) {
- mValue = (Integer) value;
- mHasValue = true;
- }
- }
-
- @Override
- public IntKeyframe clone() {
- IntKeyframe kfClone = mHasValue ? new IntKeyframe(getFraction(), mValue) : new IntKeyframe(getFraction());
- kfClone.setInterpolator(getInterpolator());
- return kfClone;
- }
- }
-
- static class FloatKeyframe extends Keyframe {
-
- float mValue;
-
- FloatKeyframe(float fraction, float value) {
- mFraction = fraction;
- mValue = value;
- mValueType = float.class;
- mHasValue = true;
- }
-
- FloatKeyframe(float fraction) {
- mFraction = fraction;
- mValueType = float.class;
- }
-
- public float getFloatValue() {
- return mValue;
- }
-
- public Object getValue() {
- return mValue;
- }
-
- public void setValue(Object value) {
- if (value != null && value.getClass() == Float.class) {
- mValue = (Float) value;
- mHasValue = true;
- }
- }
-
- @Override
- public FloatKeyframe clone() {
- FloatKeyframe kfClone = mHasValue ? new FloatKeyframe(getFraction(), mValue) : new FloatKeyframe(getFraction());
- kfClone.setInterpolator(getInterpolator());
- return kfClone;
- }
- }
-}
diff --git a/TMessagesProj/src/main/java/org/telegram/messenger/Animation/KeyframeSet.java b/TMessagesProj/src/main/java/org/telegram/messenger/Animation/KeyframeSet.java
deleted file mode 100644
index 2e86dc876..000000000
--- a/TMessagesProj/src/main/java/org/telegram/messenger/Animation/KeyframeSet.java
+++ /dev/null
@@ -1,200 +0,0 @@
-/*
- * Copyright (C) 2010 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.telegram.messenger.Animation;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import android.util.Log;
-import android.view.animation.Interpolator;
-
-import org.telegram.messenger.Animation.Keyframe.IntKeyframe;
-import org.telegram.messenger.Animation.Keyframe.FloatKeyframe;
-import org.telegram.messenger.Animation.Keyframe.ObjectKeyframe;
-
-class KeyframeSet {
-
- int mNumKeyframes;
-
- Keyframe mFirstKeyframe;
- Keyframe mLastKeyframe;
- Interpolator mInterpolator;
- ArrayList mKeyframes;
- TypeEvaluator mEvaluator;
-
- public KeyframeSet(Keyframe... keyframes) {
- mNumKeyframes = keyframes.length;
- mKeyframes = new ArrayList();
- mKeyframes.addAll(Arrays.asList(keyframes));
- mFirstKeyframe = mKeyframes.get(0);
- mLastKeyframe = mKeyframes.get(mNumKeyframes - 1);
- mInterpolator = mLastKeyframe.getInterpolator();
- }
-
- public static KeyframeSet ofInt(int... values) {
- int numKeyframes = values.length;
- IntKeyframe keyframes[] = new IntKeyframe[Math.max(numKeyframes,2)];
- if (numKeyframes == 1) {
- keyframes[0] = (IntKeyframe) Keyframe.ofInt(0f);
- keyframes[1] = (IntKeyframe) Keyframe.ofInt(1f, values[0]);
- } else {
- keyframes[0] = (IntKeyframe) Keyframe.ofInt(0f, values[0]);
- for (int i = 1; i < numKeyframes; ++i) {
- keyframes[i] = (IntKeyframe) Keyframe.ofInt((float) i / (numKeyframes - 1), values[i]);
- }
- }
- return new IntKeyframeSet(keyframes);
- }
-
- public static KeyframeSet ofFloat(float... values) {
- boolean badValue = false;
- int numKeyframes = values.length;
- FloatKeyframe keyframes[] = new FloatKeyframe[Math.max(numKeyframes,2)];
- if (numKeyframes == 1) {
- keyframes[0] = (FloatKeyframe) Keyframe.ofFloat(0f);
- keyframes[1] = (FloatKeyframe) Keyframe.ofFloat(1f, values[0]);
- if (Float.isNaN(values[0])) {
- badValue = true;
- }
- } else {
- keyframes[0] = (FloatKeyframe) Keyframe.ofFloat(0f, values[0]);
- for (int i = 1; i < numKeyframes; ++i) {
- keyframes[i] = (FloatKeyframe) Keyframe.ofFloat((float) i / (numKeyframes - 1), values[i]);
- if (Float.isNaN(values[i])) {
- badValue = true;
- }
- }
- }
- if (badValue) {
- Log.w("Animator", "Bad value (NaN) in float animator");
- }
- return new FloatKeyframeSet(keyframes);
- }
-
- public static KeyframeSet ofKeyframe(Keyframe... keyframes) {
- int numKeyframes = keyframes.length;
- boolean hasFloat = false;
- boolean hasInt = false;
- boolean hasOther = false;
- for (Keyframe keyframe : keyframes) {
- if (keyframe instanceof FloatKeyframe) {
- hasFloat = true;
- } else if (keyframe instanceof IntKeyframe) {
- hasInt = true;
- } else {
- hasOther = true;
- }
- }
- if (hasFloat && !hasInt && !hasOther) {
- FloatKeyframe floatKeyframes[] = new FloatKeyframe[numKeyframes];
- for (int i = 0; i < numKeyframes; ++i) {
- floatKeyframes[i] = (FloatKeyframe) keyframes[i];
- }
- return new FloatKeyframeSet(floatKeyframes);
- } else if (hasInt && !hasFloat && !hasOther) {
- IntKeyframe intKeyframes[] = new IntKeyframe[numKeyframes];
- for (int i = 0; i < numKeyframes; ++i) {
- intKeyframes[i] = (IntKeyframe) keyframes[i];
- }
- return new IntKeyframeSet(intKeyframes);
- } else {
- return new KeyframeSet(keyframes);
- }
- }
-
- public static KeyframeSet ofObject(Object... values) {
- int numKeyframes = values.length;
- ObjectKeyframe keyframes[] = new ObjectKeyframe[Math.max(numKeyframes,2)];
- if (numKeyframes == 1) {
- keyframes[0] = (ObjectKeyframe) Keyframe.ofObject(0f);
- keyframes[1] = (ObjectKeyframe) Keyframe.ofObject(1f, values[0]);
- } else {
- keyframes[0] = (ObjectKeyframe) Keyframe.ofObject(0f, values[0]);
- for (int i = 1; i < numKeyframes; ++i) {
- keyframes[i] = (ObjectKeyframe) Keyframe.ofObject((float) i / (numKeyframes - 1), values[i]);
- }
- }
- return new KeyframeSet(keyframes);
- }
-
- public void setEvaluator(TypeEvaluator evaluator) {
- mEvaluator = evaluator;
- }
-
- @Override
- public KeyframeSet clone() {
- ArrayList keyframes = mKeyframes;
- int numKeyframes = mKeyframes.size();
- Keyframe[] newKeyframes = new Keyframe[numKeyframes];
- for (int i = 0; i < numKeyframes; ++i) {
- newKeyframes[i] = keyframes.get(i).clone();
- }
- return new KeyframeSet(newKeyframes);
- }
-
- @SuppressWarnings("unchecked")
- public Object getValue(float fraction) {
- if (mNumKeyframes == 2) {
- if (mInterpolator != null) {
- fraction = mInterpolator.getInterpolation(fraction);
- }
- return mEvaluator.evaluate(fraction, mFirstKeyframe.getValue(), mLastKeyframe.getValue());
- }
- if (fraction <= 0f) {
- final Keyframe nextKeyframe = mKeyframes.get(1);
- final Interpolator interpolator = nextKeyframe.getInterpolator();
- if (interpolator != null) {
- fraction = interpolator.getInterpolation(fraction);
- }
- final float prevFraction = mFirstKeyframe.getFraction();
- float intervalFraction = (fraction - prevFraction) / (nextKeyframe.getFraction() - prevFraction);
- return mEvaluator.evaluate(intervalFraction, mFirstKeyframe.getValue(), nextKeyframe.getValue());
- } else if (fraction >= 1f) {
- final Keyframe prevKeyframe = mKeyframes.get(mNumKeyframes - 2);
- final Interpolator interpolator = mLastKeyframe.getInterpolator();
- if (interpolator != null) {
- fraction = interpolator.getInterpolation(fraction);
- }
- final float prevFraction = prevKeyframe.getFraction();
- float intervalFraction = (fraction - prevFraction) / (mLastKeyframe.getFraction() - prevFraction);
- return mEvaluator.evaluate(intervalFraction, prevKeyframe.getValue(), mLastKeyframe.getValue());
- }
- Keyframe prevKeyframe = mFirstKeyframe;
- for (int i = 1; i < mNumKeyframes; ++i) {
- Keyframe nextKeyframe = mKeyframes.get(i);
- if (fraction < nextKeyframe.getFraction()) {
- final Interpolator interpolator = nextKeyframe.getInterpolator();
- if (interpolator != null) {
- fraction = interpolator.getInterpolation(fraction);
- }
- final float prevFraction = prevKeyframe.getFraction();
- float intervalFraction = (fraction - prevFraction) / (nextKeyframe.getFraction() - prevFraction);
- return mEvaluator.evaluate(intervalFraction, prevKeyframe.getValue(), nextKeyframe.getValue());
- }
- prevKeyframe = nextKeyframe;
- }
- return mLastKeyframe.getValue();
- }
-
- @Override
- public String toString() {
- String returnVal = " ";
- for (int i = 0; i < mNumKeyframes; ++i) {
- returnVal += mKeyframes.get(i).getValue() + " ";
- }
- return returnVal;
- }
-}
diff --git a/TMessagesProj/src/main/java/org/telegram/messenger/Animation/ObjectAnimator10.java b/TMessagesProj/src/main/java/org/telegram/messenger/Animation/ObjectAnimator10.java
deleted file mode 100644
index fef5f1851..000000000
--- a/TMessagesProj/src/main/java/org/telegram/messenger/Animation/ObjectAnimator10.java
+++ /dev/null
@@ -1,488 +0,0 @@
-/*
- * Copyright (C) 2010 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.telegram.messenger.Animation;
-
-import android.view.View;
-
-import java.util.HashMap;
-
-public final class ObjectAnimator10 extends ValueAnimator {
-
- private static final HashMap PROXY_PROPERTIES = new HashMap();
-
- static {
- Property ALPHA = new FloatProperty10("alpha") {
- @Override
- public void setValue(View object, float value) {
- View10.wrap(object).setAlpha(value);
- }
-
- @Override
- public Float get(View object) {
- return View10.wrap(object).getAlpha();
- }
- };
-
- Property PIVOT_X = new FloatProperty10("pivotX") {
- @Override
- public void setValue(View object, float value) {
- View10.wrap(object).setPivotX(value);
- }
-
- @Override
- public Float get(View object) {
- return View10.wrap(object).getPivotX();
- }
- };
-
- Property PIVOT_Y = new FloatProperty10("pivotY") {
- @Override
- public void setValue(View object, float value) {
- View10.wrap(object).setPivotY(value);
- }
-
- @Override
- public Float get(View object) {
- return View10.wrap(object).getPivotY();
- }
- };
-
- Property TRANSLATION_X = new FloatProperty10("translationX") {
- @Override
- public void setValue(View object, float value) {
- View10.wrap(object).setTranslationX(value);
- }
-
- @Override
- public Float get(View object) {
- return View10.wrap(object).getTranslationX();
- }
- };
-
- Property TRANSLATION_Y = new FloatProperty10("translationY") {
- @Override
- public void setValue(View object, float value) {
- View10.wrap(object).setTranslationY(value);
- }
-
- @Override
- public Float get(View object) {
- return View10.wrap(object).getTranslationY();
- }
- };
-
- Property ROTATION = new FloatProperty10("rotation") {
- @Override
- public void setValue(View object, float value) {
- View10.wrap(object).setRotation(value);
- }
-
- @Override
- public Float get(View object) {
- return View10.wrap(object).getRotation();
- }
- };
-
- Property ROTATION_X = new FloatProperty10("rotationX") {
- @Override
- public void setValue(View object, float value) {
- View10.wrap(object).setRotationX(value);
- }
-
- @Override
- public Float get(View object) {
- return View10.wrap(object).getRotationX();
- }
- };
-
- Property ROTATION_Y = new FloatProperty10("rotationY") {
- @Override
- public void setValue(View object, float value) {
- View10.wrap(object).setRotationY(value);
- }
-
- @Override
- public Float get(View object) {
- return View10.wrap(object).getRotationY();
- }
- };
-
- Property SCALE_X = new FloatProperty10("scaleX") {
- @Override
- public void setValue(View object, float value) {
- View10.wrap(object).setScaleX(value);
- }
-
- @Override
- public Float get(View object) {
- return View10.wrap(object).getScaleX();
- }
- };
-
- Property SCALE_Y = new FloatProperty10("scaleY") {
- @Override
- public void setValue(View object, float value) {
- View10.wrap(object).setScaleY(value);
- }
-
- @Override
- public Float get(View object) {
- return View10.wrap(object).getScaleY();
- }
- };
-
- Property SCROLL_X = new IntProperty("scrollX") {
- @Override
- public void setValue(View object, int value) {
- View10.wrap(object).setScrollX(value);
- }
-
- @Override
- public Integer get(View object) {
- return View10.wrap(object).getScrollX();
- }
- };
-
- Property SCROLL_Y = new IntProperty("scrollY") {
- @Override
- public void setValue(View object, int value) {
- View10.wrap(object).setScrollY(value);
- }
-
- @Override
- public Integer get(View object) {
- return View10.wrap(object).getScrollY();
- }
- };
-
- Property X = new FloatProperty10("x") {
- @Override
- public void setValue(View object, float value) {
- View10.wrap(object).setX(value);
- }
-
- @Override
- public Float get(View object) {
- return View10.wrap(object).getX();
- }
- };
-
- Property Y = new FloatProperty10("y") {
- @Override
- public void setValue(View object, float value) {
- View10.wrap(object).setY(value);
- }
-
- @Override
- public Float get(View object) {
- return View10.wrap(object).getY();
- }
- };
-
- PROXY_PROPERTIES.put("alpha", ALPHA);
- PROXY_PROPERTIES.put("pivotX", PIVOT_X);
- PROXY_PROPERTIES.put("pivotY", PIVOT_Y);
- PROXY_PROPERTIES.put("translationX", TRANSLATION_X);
- PROXY_PROPERTIES.put("translationY", TRANSLATION_Y);
- PROXY_PROPERTIES.put("rotation", ROTATION);
- PROXY_PROPERTIES.put("rotationX", ROTATION_X);
- PROXY_PROPERTIES.put("rotationY", ROTATION_Y);
- PROXY_PROPERTIES.put("scaleX", SCALE_X);
- PROXY_PROPERTIES.put("scaleY", SCALE_Y);
- PROXY_PROPERTIES.put("scrollX", SCROLL_X);
- PROXY_PROPERTIES.put("scrollY", SCROLL_Y);
- PROXY_PROPERTIES.put("x", X);
- PROXY_PROPERTIES.put("y", Y);
- }
-
- private Object mTarget;
- private String mPropertyName;
- private Property mProperty;
- private boolean mAutoCancel = false;
-
- public void setPropertyName(String propertyName) {
- if (mValues != null) {
- PropertyValuesHolder valuesHolder = mValues[0];
- String oldName = valuesHolder.getPropertyName();
- valuesHolder.setPropertyName(propertyName);
- mValuesMap.remove(oldName);
- mValuesMap.put(propertyName, valuesHolder);
- }
- mPropertyName = propertyName;
- mInitialized = false;
- }
-
- public void setProperty(Property property) {
- if (mValues != null) {
- PropertyValuesHolder valuesHolder = mValues[0];
- String oldName = valuesHolder.getPropertyName();
- valuesHolder.setProperty(property);
- mValuesMap.remove(oldName);
- mValuesMap.put(mPropertyName, valuesHolder);
- }
- if (mProperty != null) {
- mPropertyName = property.getName();
- }
- mProperty = property;
- mInitialized = false;
- }
-
- public String getPropertyName() {
- String propertyName = null;
- if (mPropertyName != null) {
- propertyName = mPropertyName;
- } else if (mProperty != null) {
- propertyName = mProperty.getName();
- } else if (mValues != null && mValues.length > 0) {
- for (int i = 0; i < mValues.length; ++i) {
- if (i == 0) {
- propertyName = "";
- } else {
- propertyName += ",";
- }
- propertyName += mValues[i].getPropertyName();
- }
- }
- return propertyName;
- }
-
- public ObjectAnimator10() {
-
- }
-
- private ObjectAnimator10(Object target, String propertyName) {
- mTarget = target;
- setPropertyName(propertyName);
- }
-
- private ObjectAnimator10(T target, Property property) {
- mTarget = target;
- setProperty(property);
- }
-
- public static ObjectAnimator10 ofInt(Object target, String propertyName, int... values) {
- ObjectAnimator10 anim = new ObjectAnimator10(target, propertyName);
- anim.setIntValues(values);
- return anim;
- }
-
- public static ObjectAnimator10 ofInt(T target, Property property, int... values) {
- ObjectAnimator10 anim = new ObjectAnimator10(target, property);
- anim.setIntValues(values);
- return anim;
- }
-
- public static ObjectAnimator10 ofFloat(Object target, String propertyName, float... values) {
- ObjectAnimator10 anim = new ObjectAnimator10(target, propertyName);
- anim.setFloatValues(values);
- return anim;
- }
-
- public static ObjectAnimator10 ofFloat(T target, Property property, float... values) {
- ObjectAnimator10 anim = new ObjectAnimator10(target, property);
- anim.setFloatValues(values);
- return anim;
- }
-
- public static ObjectAnimator10 ofObject(Object target, String propertyName, TypeEvaluator evaluator, Object... values) {
- ObjectAnimator10 anim = new ObjectAnimator10(target, propertyName);
- anim.setObjectValues(values);
- anim.setEvaluator(evaluator);
- return anim;
- }
-
- public static ObjectAnimator10 ofObject(T target, Property property, TypeEvaluator evaluator, V... values) {
- ObjectAnimator10 anim = new ObjectAnimator10(target, property);
- anim.setObjectValues(values);
- anim.setEvaluator(evaluator);
- return anim;
- }
-
- public static ObjectAnimator10 ofPropertyValuesHolder(Object target, PropertyValuesHolder... values) {
- ObjectAnimator10 anim = new ObjectAnimator10();
- anim.mTarget = target;
- anim.setValues(values);
- return anim;
- }
-
- @SuppressWarnings("unchecked")
- @Override
- public void setIntValues(int... values) {
- if (mValues == null || mValues.length == 0) {
- if (mProperty != null) {
- setValues(PropertyValuesHolder.ofInt(mProperty, values));
- } else {
- setValues(PropertyValuesHolder.ofInt(mPropertyName, values));
- }
- } else {
- super.setIntValues(values);
- }
- }
-
- @SuppressWarnings("unchecked")
- @Override
- public void setFloatValues(float... values) {
- if (mValues == null || mValues.length == 0) {
- if (mProperty != null) {
- setValues(PropertyValuesHolder.ofFloat(mProperty, values));
- } else {
- setValues(PropertyValuesHolder.ofFloat(mPropertyName, values));
- }
- } else {
- super.setFloatValues(values);
- }
- }
-
- @Override
- public void setObjectValues(Object... values) {
- if (mValues == null || mValues.length == 0) {
- if (mProperty != null) {
- setValues(PropertyValuesHolder.ofObject(mProperty, null, values));
- } else {
- setValues(PropertyValuesHolder.ofObject(mPropertyName, null, values));
- }
- } else {
- super.setObjectValues(values);
- }
- }
-
- public void setAutoCancel(boolean cancel) {
- mAutoCancel = cancel;
- }
-
- private boolean hasSameTargetAndProperties(Animator10 anim) {
- if (anim instanceof ObjectAnimator10) {
- PropertyValuesHolder[] theirValues = ((ObjectAnimator10) anim).getValues();
- if (((ObjectAnimator10) anim).getTarget() == mTarget &&
- mValues.length == theirValues.length) {
- for (int i = 0; i < mValues.length; ++i) {
- PropertyValuesHolder pvhMine = mValues[i];
- PropertyValuesHolder pvhTheirs = theirValues[i];
- if (pvhMine.getPropertyName() == null ||
- !pvhMine.getPropertyName().equals(pvhTheirs.getPropertyName())) {
- return false;
- }
- }
- return true;
- }
- }
- return false;
- }
-
- @Override
- public void start() {
- AnimationHandler handler = sAnimationHandler.get();
- if (handler != null) {
- int numAnims = handler.mAnimations.size();
- for (int i = numAnims - 1; i >= 0; i--) {
- if (handler.mAnimations.get(i) instanceof ObjectAnimator10) {
- ObjectAnimator10 anim = (ObjectAnimator10) handler.mAnimations.get(i);
- if (anim.mAutoCancel && hasSameTargetAndProperties(anim)) {
- anim.cancel();
- }
- }
- }
- numAnims = handler.mPendingAnimations.size();
- for (int i = numAnims - 1; i >= 0; i--) {
- if (handler.mPendingAnimations.get(i) instanceof ObjectAnimator10) {
- ObjectAnimator10 anim = (ObjectAnimator10) handler.mPendingAnimations.get(i);
- if (anim.mAutoCancel && hasSameTargetAndProperties(anim)) {
- anim.cancel();
- }
- }
- }
- numAnims = handler.mDelayedAnims.size();
- for (int i = numAnims - 1; i >= 0; i--) {
- if (handler.mDelayedAnims.get(i) instanceof ObjectAnimator10) {
- ObjectAnimator10 anim = (ObjectAnimator10) handler.mDelayedAnims.get(i);
- if (anim.mAutoCancel && hasSameTargetAndProperties(anim)) {
- anim.cancel();
- }
- }
- }
- }
- super.start();
- }
-
- @Override
- void initAnimation() {
- if (!mInitialized) {
- if ((mProperty == null) && (mTarget instanceof View) && PROXY_PROPERTIES.containsKey(mPropertyName)) {
- setProperty(PROXY_PROPERTIES.get(mPropertyName));
- }
- int numValues = mValues.length;
- for (PropertyValuesHolder mValue : mValues) {
- mValue.setupSetterAndGetter(mTarget);
- }
- super.initAnimation();
- }
- }
-
- @Override
- public ObjectAnimator10 setDuration(long duration) {
- super.setDuration(duration);
- return this;
- }
-
- public Object getTarget() {
- return mTarget;
- }
-
- @Override
- public void setTarget(Object target) {
- if (mTarget != target) {
- final Object oldTarget = mTarget;
- mTarget = target;
- if (oldTarget != null && target != null && oldTarget.getClass() == target.getClass()) {
- return;
- }
- mInitialized = false;
- }
- }
-
- @Override
- public void setupStartValues() {
- initAnimation();
- int numValues = mValues.length;
- for (PropertyValuesHolder mValue : mValues) {
- mValue.setupStartValue(mTarget);
- }
- }
-
- @Override
- public void setupEndValues() {
- initAnimation();
- int numValues = mValues.length;
- for (PropertyValuesHolder mValue : mValues) {
- mValue.setupEndValue(mTarget);
- }
- }
-
- @Override
- void animateValue(float fraction) {
- super.animateValue(fraction);
- int numValues = mValues.length;
- for (PropertyValuesHolder mValue : mValues) {
- mValue.setAnimatedValue(mTarget);
- }
- }
-
- @Override
- public ObjectAnimator10 clone() {
- return (ObjectAnimator10) super.clone();
- }
-}
diff --git a/TMessagesProj/src/main/java/org/telegram/messenger/Animation/Property.java b/TMessagesProj/src/main/java/org/telegram/messenger/Animation/Property.java
deleted file mode 100755
index 98983e162..000000000
--- a/TMessagesProj/src/main/java/org/telegram/messenger/Animation/Property.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * Copyright (C) 2011 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.telegram.messenger.Animation;
-
-public abstract class Property {
-
- private final String mName;
- private final Class mType;
-
- public static Property of(Class hostType, Class valueType, String name) {
- return new ReflectiveProperty(hostType, valueType, name);
- }
-
- public Property(Class type, String name) {
- mName = name;
- mType = type;
- }
-
- public boolean isReadOnly() {
- return false;
- }
-
- public void set(T object, V value) {
- throw new UnsupportedOperationException("Property " + getName() +" is read-only");
- }
-
- public abstract V get(T object);
-
- public String getName() {
- return mName;
- }
-
- public Class getType() {
- return mType;
- }
-}
diff --git a/TMessagesProj/src/main/java/org/telegram/messenger/Animation/PropertyValuesHolder.java b/TMessagesProj/src/main/java/org/telegram/messenger/Animation/PropertyValuesHolder.java
deleted file mode 100644
index c4ab83b4c..000000000
--- a/TMessagesProj/src/main/java/org/telegram/messenger/Animation/PropertyValuesHolder.java
+++ /dev/null
@@ -1,545 +0,0 @@
-/*
- * Copyright (C) 2010 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.telegram.messenger.Animation;
-
-import java.lang.reflect.Method;
-import java.util.HashMap;
-import java.util.concurrent.locks.ReentrantReadWriteLock;
-
-public class PropertyValuesHolder implements Cloneable {
-
- String mPropertyName;
- protected Property mProperty;
- Method mSetter = null;
- private Method mGetter = null;
- Class mValueType;
- KeyframeSet mKeyframeSet = null;
-
- private static final TypeEvaluator sIntEvaluator = new IntEvaluator();
- private static final TypeEvaluator sFloatEvaluator = new FloatEvaluator();
-
- private static Class[] FLOAT_VARIANTS = {float.class, Float.class, double.class, int.class, Double.class, Integer.class};
- private static Class[] INTEGER_VARIANTS = {int.class, Integer.class, float.class, double.class, Float.class, Double.class};
- private static Class[] DOUBLE_VARIANTS = {double.class, Double.class, float.class, int.class, Float.class, Integer.class};
-
- private static final HashMap> sSetterPropertyMap = new HashMap>();
- private static final HashMap> sGetterPropertyMap = new HashMap>();
-
- final ReentrantReadWriteLock mPropertyMapLock = new ReentrantReadWriteLock();
- final Object[] mTmpValueArray = new Object[1];
-
- private TypeEvaluator mEvaluator;
-
- private Object mAnimatedValue;
-
- private PropertyValuesHolder(String propertyName) {
- mPropertyName = propertyName;
- }
-
- private PropertyValuesHolder(Property property) {
- mProperty = property;
- if (property != null) {
- mPropertyName = property.getName();
- }
- }
-
- public static PropertyValuesHolder ofInt(String propertyName, int... values) {
- return new IntPropertyValuesHolder(propertyName, values);
- }
-
- public static PropertyValuesHolder ofInt(Property, Integer> property, int... values) {
- return new IntPropertyValuesHolder(property, values);
- }
-
- public static PropertyValuesHolder ofFloat(String propertyName, float... values) {
- return new FloatPropertyValuesHolder(propertyName, values);
- }
-
- public static PropertyValuesHolder ofFloat(Property, Float> property, float... values) {
- return new FloatPropertyValuesHolder(property, values);
- }
-
- public static PropertyValuesHolder ofObject(String propertyName, TypeEvaluator evaluator,
- Object... values) {
- PropertyValuesHolder pvh = new PropertyValuesHolder(propertyName);
- pvh.setObjectValues(values);
- pvh.setEvaluator(evaluator);
- return pvh;
- }
-
- public static PropertyValuesHolder ofObject(Property property,
- TypeEvaluator evaluator, V... values) {
- PropertyValuesHolder pvh = new PropertyValuesHolder(property);
- pvh.setObjectValues(values);
- pvh.setEvaluator(evaluator);
- return pvh;
- }
-
- public static PropertyValuesHolder ofKeyframe(String propertyName, Keyframe... values) {
- KeyframeSet keyframeSet = KeyframeSet.ofKeyframe(values);
- if (keyframeSet instanceof IntKeyframeSet) {
- return new IntPropertyValuesHolder(propertyName, (IntKeyframeSet) keyframeSet);
- } else if (keyframeSet instanceof FloatKeyframeSet) {
- return new FloatPropertyValuesHolder(propertyName, (FloatKeyframeSet) keyframeSet);
- } else {
- PropertyValuesHolder pvh = new PropertyValuesHolder(propertyName);
- pvh.mKeyframeSet = keyframeSet;
- pvh.mValueType = values[0].getType();
- return pvh;
- }
- }
-
- public static PropertyValuesHolder ofKeyframe(Property property, Keyframe... values) {
- KeyframeSet keyframeSet = KeyframeSet.ofKeyframe(values);
- if (keyframeSet instanceof IntKeyframeSet) {
- return new IntPropertyValuesHolder(property, (IntKeyframeSet) keyframeSet);
- } else if (keyframeSet instanceof FloatKeyframeSet) {
- return new FloatPropertyValuesHolder(property, (FloatKeyframeSet) keyframeSet);
- } else {
- PropertyValuesHolder pvh = new PropertyValuesHolder(property);
- pvh.mKeyframeSet = keyframeSet;
- pvh.mValueType = values[0].getType();
- return pvh;
- }
- }
-
- public void setIntValues(int... values) {
- mValueType = int.class;
- mKeyframeSet = KeyframeSet.ofInt(values);
- }
-
- public void setFloatValues(float... values) {
- mValueType = float.class;
- mKeyframeSet = KeyframeSet.ofFloat(values);
- }
-
- public void setKeyframes(Keyframe... values) {
- int numKeyframes = values.length;
- Keyframe keyframes[] = new Keyframe[Math.max(numKeyframes, 2)];
- mValueType = values[0].getType();
- System.arraycopy(values, 0, keyframes, 0, numKeyframes);
- mKeyframeSet = new KeyframeSet(keyframes);
- }
-
- public void setObjectValues(Object... values) {
- mValueType = values[0].getClass();
- mKeyframeSet = KeyframeSet.ofObject(values);
- }
-
- @SuppressWarnings("unchecked")
- private Method getPropertyFunction(Class targetClass, String prefix, Class valueType) {
- Method returnVal = null;
- String methodName = getMethodName(prefix, mPropertyName);
- Class args[] = null;
- if (valueType == null) {
- try {
- returnVal = targetClass.getMethod(methodName);
- } catch (Throwable e) {
- try {
- returnVal = targetClass.getDeclaredMethod(methodName);
- returnVal.setAccessible(true);
- } catch (Throwable e2) {
- e2.printStackTrace();
- }
- }
- } else {
- args = new Class[1];
- Class typeVariants[];
- if (mValueType.equals(Float.class)) {
- typeVariants = FLOAT_VARIANTS;
- } else if (mValueType.equals(Integer.class)) {
- typeVariants = INTEGER_VARIANTS;
- } else if (mValueType.equals(Double.class)) {
- typeVariants = DOUBLE_VARIANTS;
- } else {
- typeVariants = new Class[1];
- typeVariants[0] = mValueType;
- }
- for (Class typeVariant : typeVariants) {
- args[0] = typeVariant;
- try {
- returnVal = targetClass.getMethod(methodName, args);
- mValueType = typeVariant;
- return returnVal;
- } catch (Throwable e) {
- try {
- returnVal = targetClass.getDeclaredMethod(methodName, args);
- returnVal.setAccessible(true);
- mValueType = typeVariant;
- return returnVal;
- } catch (Throwable e2) {
- // Swallow the error and keep trying other variants
- }
- }
- }
- }
-
- return returnVal;
- }
-
- private Method setupSetterOrGetter(Class targetClass, HashMap> propertyMapMap, String prefix, Class valueType) {
- Method setterOrGetter = null;
- try {
- mPropertyMapLock.writeLock().lock();
- HashMap propertyMap = propertyMapMap.get(targetClass);
- if (propertyMap != null) {
- setterOrGetter = propertyMap.get(mPropertyName);
- }
- if (setterOrGetter == null) {
- setterOrGetter = getPropertyFunction(targetClass, prefix, valueType);
- if (propertyMap == null) {
- propertyMap = new HashMap();
- propertyMapMap.put(targetClass, propertyMap);
- }
- propertyMap.put(mPropertyName, setterOrGetter);
- }
- } finally {
- mPropertyMapLock.writeLock().unlock();
- }
- return setterOrGetter;
- }
-
- void setupSetter(Class targetClass) {
- mSetter = setupSetterOrGetter(targetClass, sSetterPropertyMap, "set", mValueType);
- }
-
- private void setupGetter(Class targetClass) {
- mGetter = setupSetterOrGetter(targetClass, sGetterPropertyMap, "get", null);
- }
-
- @SuppressWarnings("unchecked")
- void setupSetterAndGetter(Object target) {
- if (mProperty != null) {
- try {
- Object testValue = mProperty.get(target);
- for (Keyframe kf : mKeyframeSet.mKeyframes) {
- if (!kf.hasValue()) {
- kf.setValue(mProperty.get(target));
- }
- }
- return;
- } catch (Throwable e) {
- mProperty = null;
- }
- }
- Class targetClass = target.getClass();
- if (mSetter == null) {
- setupSetter(targetClass);
- }
- for (Keyframe kf : mKeyframeSet.mKeyframes) {
- if (!kf.hasValue()) {
- if (mGetter == null) {
- setupGetter(targetClass);
- if (mGetter == null) {
- return;
- }
- }
- try {
- kf.setValue(mGetter.invoke(target));
- } catch (Throwable e) {
- e.printStackTrace();
- }
- }
- }
- }
-
- @SuppressWarnings("unchecked")
- private void setupValue(Object target, Keyframe kf) {
- if (mProperty != null) {
- kf.setValue(mProperty.get(target));
- }
- try {
- if (mGetter == null) {
- Class targetClass = target.getClass();
- setupGetter(targetClass);
- if (mGetter == null) {
- return;
- }
- }
- kf.setValue(mGetter.invoke(target));
- } catch (Throwable e) {
- e.printStackTrace();
- }
- }
-
- void setupStartValue(Object target) {
- setupValue(target, mKeyframeSet.mKeyframes.get(0));
- }
-
- void setupEndValue(Object target) {
- setupValue(target, mKeyframeSet.mKeyframes.get(mKeyframeSet.mKeyframes.size() - 1));
- }
-
- @Override
- public PropertyValuesHolder clone() {
- try {
- PropertyValuesHolder newPVH = (PropertyValuesHolder) super.clone();
- newPVH.mPropertyName = mPropertyName;
- newPVH.mProperty = mProperty;
- newPVH.mKeyframeSet = mKeyframeSet.clone();
- newPVH.mEvaluator = mEvaluator;
- return newPVH;
- } catch (CloneNotSupportedException e) {
- return null;
- }
- }
-
- @SuppressWarnings("unchecked")
- void setAnimatedValue(Object target) {
- if (mProperty != null) {
- mProperty.set(target, getAnimatedValue());
- }
- if (mSetter != null) {
- try {
- mTmpValueArray[0] = getAnimatedValue();
- mSetter.invoke(target, mTmpValueArray);
- } catch (Throwable e) {
- e.printStackTrace();
- }
- }
- }
-
- void init() {
- if (mEvaluator == null) {
- mEvaluator = (mValueType == Integer.class) ? sIntEvaluator : (mValueType == Float.class) ? sFloatEvaluator : null;
- }
- if (mEvaluator != null) {
- mKeyframeSet.setEvaluator(mEvaluator);
- }
- }
-
- public void setEvaluator(TypeEvaluator evaluator) {
- mEvaluator = evaluator;
- mKeyframeSet.setEvaluator(evaluator);
- }
-
- void calculateValue(float fraction) {
- mAnimatedValue = mKeyframeSet.getValue(fraction);
- }
-
- public void setPropertyName(String propertyName) {
- mPropertyName = propertyName;
- }
-
- public void setProperty(Property property) {
- mProperty = property;
- }
-
- public String getPropertyName() {
- return mPropertyName;
- }
-
- Object getAnimatedValue() {
- return mAnimatedValue;
- }
-
- @Override
- public String toString() {
- return mPropertyName + ": " + mKeyframeSet.toString();
- }
-
- static String getMethodName(String prefix, String propertyName) {
- if (propertyName == null || propertyName.length() == 0) {
- return prefix;
- }
- char firstLetter = Character.toUpperCase(propertyName.charAt(0));
- String theRest = propertyName.substring(1);
- return prefix + firstLetter + theRest;
- }
-
- static class IntPropertyValuesHolder extends PropertyValuesHolder {
- private static final HashMap> sJNISetterPropertyMap = new HashMap>();
- private IntProperty mIntProperty;
-
- IntKeyframeSet mIntKeyframeSet;
- int mIntAnimatedValue;
-
- public IntPropertyValuesHolder(String propertyName, IntKeyframeSet keyframeSet) {
- super(propertyName);
- mValueType = int.class;
- mKeyframeSet = keyframeSet;
- mIntKeyframeSet = (IntKeyframeSet) mKeyframeSet;
- }
-
- public IntPropertyValuesHolder(Property property, IntKeyframeSet keyframeSet) {
- super(property);
- mValueType = int.class;
- mKeyframeSet = keyframeSet;
- mIntKeyframeSet = (IntKeyframeSet) mKeyframeSet;
- if (property instanceof IntProperty) {
- mIntProperty = (IntProperty) mProperty;
- }
- }
-
- public IntPropertyValuesHolder(String propertyName, int... values) {
- super(propertyName);
- setIntValues(values);
- }
-
- public IntPropertyValuesHolder(Property property, int... values) {
- super(property);
- setIntValues(values);
- if (property instanceof IntProperty) {
- mIntProperty = (IntProperty) mProperty;
- }
- }
-
- @Override
- public void setIntValues(int... values) {
- super.setIntValues(values);
- mIntKeyframeSet = (IntKeyframeSet) mKeyframeSet;
- }
-
- @Override
- void calculateValue(float fraction) {
- mIntAnimatedValue = mIntKeyframeSet.getIntValue(fraction);
- }
-
- @Override
- Object getAnimatedValue() {
- return mIntAnimatedValue;
- }
-
- @Override
- public IntPropertyValuesHolder clone() {
- IntPropertyValuesHolder newPVH = (IntPropertyValuesHolder) super.clone();
- newPVH.mIntKeyframeSet = (IntKeyframeSet) newPVH.mKeyframeSet;
- return newPVH;
- }
-
- @SuppressWarnings("unchecked")
- @Override
- void setAnimatedValue(Object target) {
- if (mIntProperty != null) {
- mIntProperty.setValue(target, mIntAnimatedValue);
- return;
- }
- if (mProperty != null) {
- mProperty.set(target, mIntAnimatedValue);
- return;
- }
- if (mSetter != null) {
- try {
- mTmpValueArray[0] = mIntAnimatedValue;
- mSetter.invoke(target, mTmpValueArray);
- } catch (Throwable e) {
- e.printStackTrace();
- }
- }
- }
-
- @Override
- void setupSetter(Class targetClass) {
- if (mProperty != null) {
- return;
- }
-
- super.setupSetter(targetClass);
- }
- }
-
- static class FloatPropertyValuesHolder extends PropertyValuesHolder {
-
- private static final HashMap> sJNISetterPropertyMap = new HashMap>();
- private FloatProperty10 mFloatProperty;
-
- FloatKeyframeSet mFloatKeyframeSet;
- float mFloatAnimatedValue;
-
- public FloatPropertyValuesHolder(String propertyName, FloatKeyframeSet keyframeSet) {
- super(propertyName);
- mValueType = float.class;
- mKeyframeSet = keyframeSet;
- mFloatKeyframeSet = (FloatKeyframeSet) mKeyframeSet;
- }
-
- public FloatPropertyValuesHolder(Property property, FloatKeyframeSet keyframeSet) {
- super(property);
- mValueType = float.class;
- mKeyframeSet = keyframeSet;
- mFloatKeyframeSet = (FloatKeyframeSet) mKeyframeSet;
- if (property instanceof FloatProperty10) {
- mFloatProperty = (FloatProperty10) mProperty;
- }
- }
-
- public FloatPropertyValuesHolder(String propertyName, float... values) {
- super(propertyName);
- setFloatValues(values);
- }
-
- public FloatPropertyValuesHolder(Property property, float... values) {
- super(property);
- setFloatValues(values);
- if (property instanceof FloatProperty10) {
- mFloatProperty = (FloatProperty10) mProperty;
- }
- }
-
- @Override
- public void setFloatValues(float... values) {
- super.setFloatValues(values);
- mFloatKeyframeSet = (FloatKeyframeSet) mKeyframeSet;
- }
-
- @Override
- void calculateValue(float fraction) {
- mFloatAnimatedValue = mFloatKeyframeSet.getFloatValue(fraction);
- }
-
- @Override
- Object getAnimatedValue() {
- return mFloatAnimatedValue;
- }
-
- @Override
- public FloatPropertyValuesHolder clone() {
- FloatPropertyValuesHolder newPVH = (FloatPropertyValuesHolder) super.clone();
- newPVH.mFloatKeyframeSet = (FloatKeyframeSet) newPVH.mKeyframeSet;
- return newPVH;
- }
-
- @SuppressWarnings("unchecked")
- @Override
- void setAnimatedValue(Object target) {
- if (mFloatProperty != null) {
- mFloatProperty.setValue(target, mFloatAnimatedValue);
- return;
- }
- if (mProperty != null) {
- mProperty.set(target, mFloatAnimatedValue);
- return;
- }
- if (mSetter != null) {
- try {
- mTmpValueArray[0] = mFloatAnimatedValue;
- mSetter.invoke(target, mTmpValueArray);
- } catch (Throwable e) {
- e.printStackTrace();
- }
- }
- }
-
- @Override
- void setupSetter(Class targetClass) {
- if (mProperty != null) {
- return;
- }
- super.setupSetter(targetClass);
- }
- }
-}
\ No newline at end of file
diff --git a/TMessagesProj/src/main/java/org/telegram/messenger/Animation/ReflectiveProperty.java b/TMessagesProj/src/main/java/org/telegram/messenger/Animation/ReflectiveProperty.java
deleted file mode 100755
index 47b65aac9..000000000
--- a/TMessagesProj/src/main/java/org/telegram/messenger/Animation/ReflectiveProperty.java
+++ /dev/null
@@ -1,182 +0,0 @@
-/*
- * Copyright (C) 2011 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.telegram.messenger.Animation;
-
-import java.lang.reflect.Field;
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-
-/**
- * Internal class to automatically generate a Property for a given class/name pair, given the
- * specification of {@link Property#of(java.lang.Class, java.lang.Class, java.lang.String)}
- */
-class ReflectiveProperty extends Property {
-
- private static final String PREFIX_GET = "get";
- private static final String PREFIX_IS = "is";
- private static final String PREFIX_SET = "set";
- private Method mSetter;
- private Method mGetter;
- private Field mField;
-
- /**
- * For given property name 'name', look for getName/isName method or 'name' field.
- * Also look for setName method (optional - could be readonly). Failing method getters and
- * field results in throwing NoSuchPropertyException.
- *
- * @param propertyHolder The class on which the methods or field are found
- * @param name The name of the property, where this name is capitalized and appended to
- * "get" and "is to search for the appropriate methods. If the get/is methods are not found,
- * the constructor will search for a field with that exact name.
- */
- public ReflectiveProperty(Class propertyHolder, Class valueType, String name) {
- // TODO: cache reflection info for each new class/name pair
- super(valueType, name);
- char firstLetter = Character.toUpperCase(name.charAt(0));
- String theRest = name.substring(1);
- String capitalizedName = firstLetter + theRest;
- String getterName = PREFIX_GET + capitalizedName;
- try {
- mGetter = propertyHolder.getMethod(getterName, (Class>[]) null);
- } catch (NoSuchMethodException e) {
- try {
- /* The native implementation uses JNI to do reflection, which allows access to private methods.
- * getDeclaredMethod(..) does not find superclass methods, so it's implemented as a fallback.
- */
- mGetter = propertyHolder.getDeclaredMethod(getterName, (Class>[]) null);
- mGetter.setAccessible(true);
- } catch (NoSuchMethodException e2) {
- // getName() not available - try isName() instead
- getterName = PREFIX_IS + capitalizedName;
- try {
- mGetter = propertyHolder.getMethod(getterName, (Class>[]) null);
- } catch (NoSuchMethodException e3) {
- try {
- /* The native implementation uses JNI to do reflection, which allows access to private methods.
- * getDeclaredMethod(..) does not find superclass methods, so it's implemented as a fallback.
- */
- mGetter = propertyHolder.getDeclaredMethod(getterName, (Class>[]) null);
- mGetter.setAccessible(true);
- } catch (NoSuchMethodException e4) {
- // Try public field instead
- try {
- mField = propertyHolder.getField(name);
- Class fieldType = mField.getType();
- if (!typesMatch(valueType, fieldType)) {
- throw new NoSuchPropertyException("Underlying type (" + fieldType + ") " +
- "does not match Property type (" + valueType + ")");
- }
- return;
- } catch (NoSuchFieldException e5) {
- // no way to access property - throw appropriate exception
- throw new NoSuchPropertyException("No accessor method or field found for"
- + " property with name " + name);
- }
- }
- }
- }
- }
- Class getterType = mGetter.getReturnType();
- // Check to make sure our getter type matches our valueType
- if (!typesMatch(valueType, getterType)) {
- throw new NoSuchPropertyException("Underlying type (" + getterType + ") " +
- "does not match Property type (" + valueType + ")");
- }
- String setterName = PREFIX_SET + capitalizedName;
- try {
- // mSetter = propertyHolder.getMethod(setterName, getterType);
- // The native implementation uses JNI to do reflection, which allows access to private methods.
- mSetter = propertyHolder.getDeclaredMethod(setterName, getterType);
- mSetter.setAccessible(true);
- } catch (NoSuchMethodException ignored) {
- // Okay to not have a setter - just a readonly property
- }
- }
-
- /**
- * Utility method to check whether the type of the underlying field/method on the target
- * object matches the type of the Property. The extra checks for primitive types are because
- * generics will force the Property type to be a class, whereas the type of the underlying
- * method/field will probably be a primitive type instead. Accept float as matching Float,
- * etc.
- */
- private boolean typesMatch(Class valueType, Class getterType) {
- if (getterType != valueType) {
- if (getterType.isPrimitive()) {
- return (getterType == float.class && valueType == Float.class) ||
- (getterType == int.class && valueType == Integer.class) ||
- (getterType == boolean.class && valueType == Boolean.class) ||
- (getterType == long.class && valueType == Long.class) ||
- (getterType == double.class && valueType == Double.class) ||
- (getterType == short.class && valueType == Short.class) ||
- (getterType == byte.class && valueType == Byte.class) ||
- (getterType == char.class && valueType == Character.class);
- }
- return false;
- }
- return true;
- }
-
- @Override
- public void set(T object, V value) {
- if (mSetter != null) {
- try {
- mSetter.invoke(object, value);
- } catch (IllegalAccessException e) {
- throw new AssertionError();
- } catch (InvocationTargetException e) {
- throw new RuntimeException(e.getCause());
- }
- } else if (mField != null) {
- try {
- mField.set(object, value);
- } catch (IllegalAccessException e) {
- throw new AssertionError();
- }
- } else {
- throw new UnsupportedOperationException("Property " + getName() +" is read-only");
- }
- }
-
- @Override
- public V get(T object) {
- if (mGetter != null) {
- try {
- return (V) mGetter.invoke(object, (Object[])null);
- } catch (IllegalAccessException e) {
- throw new AssertionError();
- } catch (InvocationTargetException e) {
- throw new RuntimeException(e.getCause());
- }
- } else if (mField != null) {
- try {
- return (V) mField.get(object);
- } catch (IllegalAccessException e) {
- throw new AssertionError();
- }
- }
- // Should not get here: there should always be a non-null getter or field
- throw new AssertionError();
- }
-
- /**
- * Returns false if there is no setter or public field underlying this Property.
- */
- @Override
- public boolean isReadOnly() {
- return (mSetter == null && mField == null);
- }
-}
diff --git a/TMessagesProj/src/main/java/org/telegram/messenger/Animation/ValueAnimator.java b/TMessagesProj/src/main/java/org/telegram/messenger/Animation/ValueAnimator.java
deleted file mode 100644
index ec4648883..000000000
--- a/TMessagesProj/src/main/java/org/telegram/messenger/Animation/ValueAnimator.java
+++ /dev/null
@@ -1,675 +0,0 @@
-/*
- * Copyright (C) 2010 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.telegram.messenger.Animation;
-
-import android.os.Looper;
-import android.util.AndroidRuntimeException;
-import android.view.animation.AccelerateDecelerateInterpolator;
-import android.view.animation.AnimationUtils;
-import android.view.animation.Interpolator;
-import android.view.animation.LinearInterpolator;
-
-import org.telegram.messenger.AndroidUtilities;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-
-public class ValueAnimator extends Animator10 {
-
- private static float sDurationScale = 1.0f;
- static final int STOPPED = 0;
- static final int RUNNING = 1;
- static final int SEEKED = 2;
-
- long mStartTime;
- long mSeekTime = -1;
- private long mPauseTime;
- private boolean mResumed = false;
- protected static ThreadLocal sAnimationHandler = new ThreadLocal();
- private static final Interpolator sDefaultInterpolator = new AccelerateDecelerateInterpolator();
- private boolean mPlayingBackwards = false;
- private int mCurrentIteration = 0;
- private float mCurrentFraction = 0f;
- private boolean mStartedDelay = false;
- private long mDelayStartTime;
- int mPlayingState = STOPPED;
- private boolean mRunning = false;
- private boolean mStarted = false;
- private boolean mStartListenersCalled = false;
- boolean mInitialized = false;
-
- private long mDuration = (long)(300 * sDurationScale);
- private long mUnscaledDuration = 300;
- private long mStartDelay = 0;
- private long mUnscaledStartDelay = 0;
- private int mRepeatCount = 0;
- private int mRepeatMode = RESTART;
- private Interpolator mInterpolator = sDefaultInterpolator;
- private ArrayList mUpdateListeners = null;
- PropertyValuesHolder[] mValues;
- HashMap mValuesMap;
-
- public static final int RESTART = 1;
- public static final int REVERSE = 2;
- public static final int INFINITE = -1;
-
- public static void setDurationScale(float durationScale) {
- sDurationScale = durationScale;
- }
-
- public static float getDurationScale() {
- return sDurationScale;
- }
-
- public ValueAnimator() {
-
- }
-
- public static ValueAnimator ofInt(int... values) {
- ValueAnimator anim = new ValueAnimator();
- anim.setIntValues(values);
- return anim;
- }
-
- public static ValueAnimator ofFloat(float... values) {
- ValueAnimator anim = new ValueAnimator();
- anim.setFloatValues(values);
- return anim;
- }
-
- public static ValueAnimator ofPropertyValuesHolder(PropertyValuesHolder... values) {
- ValueAnimator anim = new ValueAnimator();
- anim.setValues(values);
- return anim;
- }
-
- public static ValueAnimator ofObject(TypeEvaluator evaluator, Object... values) {
- ValueAnimator anim = new ValueAnimator();
- anim.setObjectValues(values);
- anim.setEvaluator(evaluator);
- return anim;
- }
-
- public void setIntValues(int... values) {
- if (values == null || values.length == 0) {
- return;
- }
- if (mValues == null || mValues.length == 0) {
- setValues(PropertyValuesHolder.ofInt("", values));
- } else {
- PropertyValuesHolder valuesHolder = mValues[0];
- valuesHolder.setIntValues(values);
- }
- mInitialized = false;
- }
-
- public void setFloatValues(float... values) {
- if (values == null || values.length == 0) {
- return;
- }
- if (mValues == null || mValues.length == 0) {
- setValues(PropertyValuesHolder.ofFloat("", values));
- } else {
- PropertyValuesHolder valuesHolder = mValues[0];
- valuesHolder.setFloatValues(values);
- }
- mInitialized = false;
- }
-
- public void setObjectValues(Object... values) {
- if (values == null || values.length == 0) {
- return;
- }
- if (mValues == null || mValues.length == 0) {
- setValues(PropertyValuesHolder.ofObject("", null, values));
- } else {
- PropertyValuesHolder valuesHolder = mValues[0];
- valuesHolder.setObjectValues(values);
- }
- mInitialized = false;
- }
-
- public void setValues(PropertyValuesHolder... values) {
- int numValues = values.length;
- mValues = values;
- mValuesMap = new HashMap(numValues);
- for (PropertyValuesHolder valuesHolder : values) {
- mValuesMap.put(valuesHolder.getPropertyName(), valuesHolder);
- }
- mInitialized = false;
- }
-
- public PropertyValuesHolder[] getValues() {
- return mValues;
- }
-
- void initAnimation() {
- if (!mInitialized) {
- int numValues = mValues.length;
- for (PropertyValuesHolder mValue : mValues) {
- mValue.init();
- }
- mInitialized = true;
- }
- }
-
- public ValueAnimator setDuration(long duration) {
- if (duration < 0) {
- throw new IllegalArgumentException("Animators cannot have negative duration: " + duration);
- }
- mUnscaledDuration = duration;
- mDuration = (long)(duration * sDurationScale);
- return this;
- }
-
- public long getDuration() {
- return mUnscaledDuration;
- }
-
- public void setCurrentPlayTime(long playTime) {
- initAnimation();
- long currentTime = AnimationUtils.currentAnimationTimeMillis();
- if (mPlayingState != RUNNING) {
- mSeekTime = playTime;
- mPlayingState = SEEKED;
- }
- mStartTime = currentTime - playTime;
- doAnimationFrame(currentTime);
- }
-
- public long getCurrentPlayTime() {
- if (!mInitialized || mPlayingState == STOPPED) {
- return 0;
- }
- return AnimationUtils.currentAnimationTimeMillis() - mStartTime;
- }
-
- @SuppressWarnings("unchecked")
- protected static class AnimationHandler implements Runnable {
-
- protected final ArrayList mAnimations = new ArrayList();
- private final ArrayList mTmpAnimations = new ArrayList();
- protected final ArrayList mPendingAnimations = new ArrayList();
- protected final ArrayList mDelayedAnims = new ArrayList();
- private final ArrayList mEndingAnims = new ArrayList();
- private final ArrayList mReadyAnims = new ArrayList();
-
- private boolean mAnimationScheduled;
-
- public void start() {
- scheduleAnimation();
- }
-
- private void doAnimationFrame(long frameTime) {
- while (mPendingAnimations.size() > 0) {
- ArrayList pendingCopy = (ArrayList) mPendingAnimations.clone();
- mPendingAnimations.clear();
- int count = pendingCopy.size();
- for (ValueAnimator anim : pendingCopy) {
- if (anim.mStartDelay == 0) {
- anim.startAnimation(this);
- } else {
- mDelayedAnims.add(anim);
- }
- }
- }
-
- int numDelayedAnims = mDelayedAnims.size();
- for (ValueAnimator anim : mDelayedAnims) {
- if (anim.delayedAnimationFrame(frameTime)) {
- mReadyAnims.add(anim);
- }
- }
- int numReadyAnims = mReadyAnims.size();
- if (numReadyAnims > 0) {
- for (ValueAnimator anim : mReadyAnims) {
- anim.startAnimation(this);
- anim.mRunning = true;
- mDelayedAnims.remove(anim);
- }
- mReadyAnims.clear();
- }
-
- int numAnims = mAnimations.size();
- for (ValueAnimator mAnimation : mAnimations) {
- mTmpAnimations.add(mAnimation);
- }
- for (int i = 0; i < numAnims; ++i) {
- ValueAnimator anim = mTmpAnimations.get(i);
- if (mAnimations.contains(anim) && anim.doAnimationFrame(frameTime)) {
- mEndingAnims.add(anim);
- }
- }
- mTmpAnimations.clear();
- if (mEndingAnims.size() > 0) {
- for (ValueAnimator mEndingAnim : mEndingAnims) {
- mEndingAnim.endAnimation(this);
- }
- mEndingAnims.clear();
- }
-
- if (!mAnimations.isEmpty() || !mDelayedAnims.isEmpty()) {
- scheduleAnimation();
- }
- }
-
- @Override
- public void run() {
- mAnimationScheduled = false;
- doAnimationFrame(System.nanoTime() / 1000000);
- }
-
- private void scheduleAnimation() {
- if (!mAnimationScheduled) {
- AndroidUtilities.runOnUIThread(this);
- mAnimationScheduled = true;
- }
- }
- }
-
- public long getStartDelay() {
- return mUnscaledStartDelay;
- }
-
- public void setStartDelay(long startDelay) {
- this.mStartDelay = (long)(startDelay * sDurationScale);
- mUnscaledStartDelay = startDelay;
- }
-
- public Object getAnimatedValue() {
- if (mValues != null && mValues.length > 0) {
- return mValues[0].getAnimatedValue();
- }
- return null;
- }
-
- public Object getAnimatedValue(String propertyName) {
- PropertyValuesHolder valuesHolder = mValuesMap.get(propertyName);
- if (valuesHolder != null) {
- return valuesHolder.getAnimatedValue();
- } else {
- return null;
- }
- }
-
- public void setRepeatCount(int value) {
- mRepeatCount = value;
- }
-
- public int getRepeatCount() {
- return mRepeatCount;
- }
-
- public void setRepeatMode(int value) {
- mRepeatMode = value;
- }
-
- public int getRepeatMode() {
- return mRepeatMode;
- }
-
- public void addUpdateListener(AnimatorUpdateListener listener) {
- if (mUpdateListeners == null) {
- mUpdateListeners = new ArrayList();
- }
- mUpdateListeners.add(listener);
- }
-
- public void removeAllUpdateListeners() {
- if (mUpdateListeners == null) {
- return;
- }
- mUpdateListeners.clear();
- mUpdateListeners = null;
- }
-
- public void removeUpdateListener(AnimatorUpdateListener listener) {
- if (mUpdateListeners == null) {
- return;
- }
- mUpdateListeners.remove(listener);
- if (mUpdateListeners.size() == 0) {
- mUpdateListeners = null;
- }
- }
-
- @Override
- public void setInterpolator(Interpolator value) {
- if (value != null) {
- mInterpolator = value;
- } else {
- mInterpolator = new LinearInterpolator();
- }
- }
-
- @Override
- public Interpolator getInterpolator() {
- return mInterpolator;
- }
-
- public void setEvaluator(TypeEvaluator value) {
- if (value != null && mValues != null && mValues.length > 0) {
- mValues[0].setEvaluator(value);
- }
- }
-
- @SuppressWarnings("unchecked")
- private void notifyStartListeners() {
- if (mListeners != null && !mStartListenersCalled) {
- ArrayList tmpListeners = (ArrayList) mListeners.clone();
- int numListeners = tmpListeners.size();
- for (AnimatorListener tmpListener : tmpListeners) {
- tmpListener.onAnimationStart(this);
- }
- }
- mStartListenersCalled = true;
- }
-
- private void start(boolean playBackwards) {
- if (Looper.myLooper() == null) {
- throw new AndroidRuntimeException("Animators may only be run on Looper threads");
- }
- mPlayingBackwards = playBackwards;
- mCurrentIteration = 0;
- mPlayingState = STOPPED;
- mStarted = true;
- mStartedDelay = false;
- mPaused = false;
- AnimationHandler animationHandler = getOrCreateAnimationHandler();
- animationHandler.mPendingAnimations.add(this);
- if (mStartDelay == 0) {
- setCurrentPlayTime(0);
- mPlayingState = STOPPED;
- mRunning = true;
- notifyStartListeners();
- }
- animationHandler.start();
- }
-
- @Override
- public void start() {
- start(false);
- }
-
- @SuppressWarnings("unchecked")
- @Override
- public void cancel() {
- AnimationHandler handler = getOrCreateAnimationHandler();
- if (mPlayingState != STOPPED || handler.mPendingAnimations.contains(this) || handler.mDelayedAnims.contains(this)) {
- if ((mStarted || mRunning) && mListeners != null) {
- if (!mRunning) {
- notifyStartListeners();
- }
- ArrayList tmpListeners = (ArrayList) mListeners.clone();
- for (AnimatorListener listener : tmpListeners) {
- listener.onAnimationCancel(this);
- }
- }
- endAnimation(handler);
- }
- }
-
- @Override
- public void end() {
- AnimationHandler handler = getOrCreateAnimationHandler();
- if (!handler.mAnimations.contains(this) && !handler.mPendingAnimations.contains(this)) {
- mStartedDelay = false;
- startAnimation(handler);
- mStarted = true;
- } else if (!mInitialized) {
- initAnimation();
- }
- animateValue(mPlayingBackwards ? 0f : 1f);
- endAnimation(handler);
- }
-
- @Override
- public void resume() {
- if (mPaused) {
- mResumed = true;
- }
- super.resume();
- }
-
- @Override
- public void pause() {
- boolean previouslyPaused = mPaused;
- super.pause();
- if (!previouslyPaused && mPaused) {
- mPauseTime = -1;
- mResumed = false;
- }
- }
-
- @Override
- public boolean isRunning() {
- return (mPlayingState == RUNNING || mRunning);
- }
-
- @Override
- public boolean isStarted() {
- return mStarted;
- }
-
- public void reverse() {
- mPlayingBackwards = !mPlayingBackwards;
- if (mPlayingState == RUNNING) {
- long currentTime = AnimationUtils.currentAnimationTimeMillis();
- long currentPlayTime = currentTime - mStartTime;
- long timeLeft = mDuration - currentPlayTime;
- mStartTime = currentTime - timeLeft;
- } else if (mStarted) {
- end();
- } else {
- start(true);
- }
- }
-
- @SuppressWarnings("unchecked")
- private void endAnimation(AnimationHandler handler) {
- handler.mAnimations.remove(this);
- handler.mPendingAnimations.remove(this);
- handler.mDelayedAnims.remove(this);
- mPlayingState = STOPPED;
- mPaused = false;
- if ((mStarted || mRunning) && mListeners != null) {
- if (!mRunning) {
- notifyStartListeners();
- }
- ArrayList tmpListeners = (ArrayList) mListeners.clone();
- int numListeners = tmpListeners.size();
- for (AnimatorListener tmpListener : tmpListeners) {
- tmpListener.onAnimationEnd(this);
- }
- }
- mRunning = false;
- mStarted = false;
- mStartListenersCalled = false;
- mPlayingBackwards = false;
- }
-
- private void startAnimation(AnimationHandler handler) {
- initAnimation();
- handler.mAnimations.add(this);
- if (mStartDelay > 0 && mListeners != null) {
- notifyStartListeners();
- }
- }
-
- private boolean delayedAnimationFrame(long currentTime) {
- if (!mStartedDelay) {
- mStartedDelay = true;
- mDelayStartTime = currentTime;
- } else {
- if (mPaused) {
- if (mPauseTime < 0) {
- mPauseTime = currentTime;
- }
- return false;
- } else if (mResumed) {
- mResumed = false;
- if (mPauseTime > 0) {
- mDelayStartTime += (currentTime - mPauseTime);
- }
- }
- long deltaTime = currentTime - mDelayStartTime;
- if (deltaTime > mStartDelay) {
- mStartTime = currentTime - (deltaTime - mStartDelay);
- mPlayingState = RUNNING;
- return true;
- }
- }
- return false;
- }
-
- boolean animationFrame(long currentTime) {
- boolean done = false;
- switch (mPlayingState) {
- case RUNNING:
- case SEEKED:
- float fraction = mDuration > 0 ? (float)(currentTime - mStartTime) / mDuration : 1f;
- if (fraction >= 1f) {
- if (mCurrentIteration < mRepeatCount || mRepeatCount == INFINITE) {
- if (mListeners != null) {
- int numListeners = mListeners.size();
- for (AnimatorListener mListener : mListeners) {
- mListener.onAnimationRepeat(this);
- }
- }
- if (mRepeatMode == REVERSE) {
- mPlayingBackwards = !mPlayingBackwards;
- }
- mCurrentIteration += (int)fraction;
- fraction = fraction % 1f;
- mStartTime += mDuration;
- } else {
- done = true;
- fraction = Math.min(fraction, 1.0f);
- }
- }
- if (mPlayingBackwards) {
- fraction = 1f - fraction;
- }
- animateValue(fraction);
- break;
- }
-
- return done;
- }
-
- final boolean doAnimationFrame(long frameTime) {
- if (mPlayingState == STOPPED) {
- mPlayingState = RUNNING;
- if (mSeekTime < 0) {
- mStartTime = frameTime;
- } else {
- mStartTime = frameTime - mSeekTime;
- mSeekTime = -1;
- }
- }
- if (mPaused) {
- if (mPauseTime < 0) {
- mPauseTime = frameTime;
- }
- return false;
- } else if (mResumed) {
- mResumed = false;
- if (mPauseTime > 0) {
- mStartTime += (frameTime - mPauseTime);
- }
- }
- final long currentTime = Math.max(frameTime, mStartTime);
- return animationFrame(currentTime);
- }
-
- public float getAnimatedFraction() {
- return mCurrentFraction;
- }
-
- void animateValue(float fraction) {
- fraction = mInterpolator.getInterpolation(fraction);
- mCurrentFraction = fraction;
- int numValues = mValues.length;
- for (PropertyValuesHolder mValue : mValues) {
- mValue.calculateValue(fraction);
- }
- if (mUpdateListeners != null) {
- int numListeners = mUpdateListeners.size();
- for (AnimatorUpdateListener mUpdateListener : mUpdateListeners) {
- mUpdateListener.onAnimationUpdate(this);
- }
- }
- }
-
- @Override
- public ValueAnimator clone() {
- final ValueAnimator anim = (ValueAnimator) super.clone();
- if (mUpdateListeners != null) {
- ArrayList oldListeners = mUpdateListeners;
- anim.mUpdateListeners = new ArrayList();
- int numListeners = oldListeners.size();
- for (AnimatorUpdateListener oldListener : oldListeners) {
- anim.mUpdateListeners.add(oldListener);
- }
- }
- anim.mSeekTime = -1;
- anim.mPlayingBackwards = false;
- anim.mCurrentIteration = 0;
- anim.mInitialized = false;
- anim.mPlayingState = STOPPED;
- anim.mStartedDelay = false;
- PropertyValuesHolder[] oldValues = mValues;
- if (oldValues != null) {
- int numValues = oldValues.length;
- anim.mValues = new PropertyValuesHolder[numValues];
- anim.mValuesMap = new HashMap(numValues);
- for (int i = 0; i < numValues; ++i) {
- PropertyValuesHolder newValuesHolder = oldValues[i].clone();
- anim.mValues[i] = newValuesHolder;
- anim.mValuesMap.put(newValuesHolder.getPropertyName(), newValuesHolder);
- }
- }
- return anim;
- }
-
- public interface AnimatorUpdateListener {
- void onAnimationUpdate(ValueAnimator animation);
- }
-
- public static int getCurrentAnimationsCount() {
- AnimationHandler handler = sAnimationHandler.get();
- return handler != null ? handler.mAnimations.size() : 0;
- }
-
- public static void clearAllAnimations() {
- AnimationHandler handler = sAnimationHandler.get();
- if (handler != null) {
- handler.mAnimations.clear();
- handler.mPendingAnimations.clear();
- handler.mDelayedAnims.clear();
- }
- }
-
- private static AnimationHandler getOrCreateAnimationHandler() {
- AnimationHandler handler = sAnimationHandler.get();
- if (handler == null) {
- handler = new AnimationHandler();
- sAnimationHandler.set(handler);
- }
- return handler;
- }
-}
diff --git a/TMessagesProj/src/main/java/org/telegram/messenger/Animation/View10.java b/TMessagesProj/src/main/java/org/telegram/messenger/Animation/View10.java
deleted file mode 100644
index 540b61a95..000000000
--- a/TMessagesProj/src/main/java/org/telegram/messenger/Animation/View10.java
+++ /dev/null
@@ -1,349 +0,0 @@
-/*
- Copyright 2012 Jake Wharton
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
- */
-
-package org.telegram.messenger.Animation;
-
-import android.graphics.Camera;
-import android.graphics.Matrix;
-import android.graphics.RectF;
-import android.os.Build;
-import android.view.View;
-import android.view.animation.Animation;
-import android.view.animation.Transformation;
-
-import java.lang.ref.WeakReference;
-import java.util.WeakHashMap;
-
-public class View10 extends Animation {
-
- public static boolean NEED_PROXY = Build.VERSION.SDK_INT < 11;
-
- private static final WeakHashMap PROXIES = new WeakHashMap<>();
-
- public static View10 wrap(View view) {
- View10 proxy = PROXIES.get(view);
- Animation animation = view.getAnimation();
- if (proxy == null || proxy != animation && animation != null) {
- proxy = new View10(view);
- PROXIES.put(view, proxy);
- } else if (animation == null) {
- view.setAnimation(proxy);
- }
- return proxy;
- }
-
- private final WeakReference mView;
- private final Camera mCamera = new Camera();
- private boolean mHasPivot;
-
- private float mAlpha = 1;
- private float mPivotX;
- private float mPivotY;
- private float mRotationX;
- private float mRotationY;
- private float mRotationZ;
- private float mScaleX = 1;
- private float mScaleY = 1;
- private float mTranslationX;
- private float mTranslationY;
-
- private final RectF mBefore = new RectF();
- private final RectF mAfter = new RectF();
- private final Matrix mTempMatrix = new Matrix();
-
- private View10(View view) {
- setDuration(0);
- setFillAfter(true);
- view.setAnimation(this);
- mView = new WeakReference<>(view);
- }
-
- public float getAlpha() {
- return mAlpha;
- }
-
- public void setAlpha(float alpha) {
- if (mAlpha != alpha) {
- mAlpha = alpha;
- View view = mView.get();
- if (view != null) {
- view.invalidate();
- }
- }
- }
-
- public float getPivotX() {
- return mPivotX;
- }
-
- public void setPivotX(float pivotX) {
- if (!mHasPivot || mPivotX != pivotX) {
- prepareForUpdate();
- mHasPivot = true;
- mPivotX = pivotX;
- invalidateAfterUpdate();
- }
- }
-
- public float getPivotY() {
- return mPivotY;
- }
-
- public void setPivotY(float pivotY) {
- if (!mHasPivot || mPivotY != pivotY) {
- prepareForUpdate();
- mHasPivot = true;
- mPivotY = pivotY;
- invalidateAfterUpdate();
- }
- }
-
- public float getRotation() {
- return mRotationZ;
- }
-
- public void setRotation(float rotation) {
- if (mRotationZ != rotation) {
- prepareForUpdate();
- mRotationZ = rotation;
- invalidateAfterUpdate();
- }
- }
-
- public float getRotationX() {
- return mRotationX;
- }
-
- public void setRotationX(float rotationX) {
- if (mRotationX != rotationX) {
- prepareForUpdate();
- mRotationX = rotationX;
- invalidateAfterUpdate();
- }
- }
-
- public float getRotationY() {
- return mRotationY;
- }
-
- public void setRotationY(float rotationY) {
- if (mRotationY != rotationY) {
- prepareForUpdate();
- mRotationY = rotationY;
- invalidateAfterUpdate();
- }
- }
-
- public float getScaleX() {
- return mScaleX;
- }
-
- public void setScaleX(float scaleX) {
- if (mScaleX != scaleX) {
- prepareForUpdate();
- mScaleX = scaleX;
- invalidateAfterUpdate();
- }
- }
-
- public float getScaleY() {
- return mScaleY;
- }
-
- public void setScaleY(float scaleY) {
- if (mScaleY != scaleY) {
- prepareForUpdate();
- mScaleY = scaleY;
- invalidateAfterUpdate();
- }
- }
-
- public int getScrollX() {
- View view = mView.get();
- if (view == null) {
- return 0;
- }
- return view.getScrollX();
- }
-
- public void setScrollX(int value) {
- View view = mView.get();
- if (view != null) {
- view.scrollTo(value, view.getScrollY());
- }
- }
-
- public int getScrollY() {
- View view = mView.get();
- if (view == null) {
- return 0;
- }
- return view.getScrollY();
- }
-
- public void setScrollY(int value) {
- View view = mView.get();
- if (view != null) {
- view.scrollTo(view.getScrollX(), value);
- }
- }
-
- public float getTranslationX() {
- return mTranslationX;
- }
-
- public void setTranslationX(float translationX) {
- if (mTranslationX != translationX) {
- prepareForUpdate();
- mTranslationX = translationX;
- invalidateAfterUpdate();
- }
- }
-
- public float getTranslationY() {
- return mTranslationY;
- }
-
- public void setTranslationY(float translationY) {
- if (mTranslationY != translationY) {
- prepareForUpdate();
- mTranslationY = translationY;
- invalidateAfterUpdate();
- }
- }
-
- public float getX() {
- View view = mView.get();
- if (view == null) {
- return 0;
- }
- return view.getLeft() + mTranslationX;
- }
-
- public void setX(float x) {
- View view = mView.get();
- if (view != null) {
- setTranslationX(x - view.getLeft());
- }
- }
-
- public float getY() {
- View view = mView.get();
- if (view == null) {
- return 0;
- }
- return view.getTop() + mTranslationY;
- }
-
- public void setY(float y) {
- View view = mView.get();
- if (view != null) {
- setTranslationY(y - view.getTop());
- }
- }
-
- private void prepareForUpdate() {
- View view = mView.get();
- if (view != null) {
- computeRect(mBefore, view);
- }
- }
-
- private void invalidateAfterUpdate() {
- View view = mView.get();
- if (view == null || view.getParent() == null) {
- return;
- }
-
- final RectF after = mAfter;
- computeRect(after, view);
- after.union(mBefore);
-
- ((View) view.getParent()).invalidate(
- (int) Math.floor(after.left),
- (int) Math.floor(after.top),
- (int) Math.ceil(after.right),
- (int) Math.ceil(after.bottom));
- }
-
- private void computeRect(final RectF r, View view) {
- final float w = view.getWidth();
- final float h = view.getHeight();
-
- r.set(0, 0, w, h);
-
- final Matrix m = mTempMatrix;
- m.reset();
- transformMatrix(m, view);
- mTempMatrix.mapRect(r);
-
- r.offset(view.getLeft(), view.getTop());
-
- if (r.right < r.left) {
- final float f = r.right;
- r.right = r.left;
- r.left = f;
- }
- if (r.bottom < r.top) {
- final float f = r.top;
- r.top = r.bottom;
- r.bottom = f;
- }
- }
-
- private void transformMatrix(Matrix m, View view) {
- final float w = view.getWidth();
- final float h = view.getHeight();
- final boolean hasPivot = mHasPivot;
- final float pX = hasPivot ? mPivotX : w / 2f;
- final float pY = hasPivot ? mPivotY : h / 2f;
-
- final float rX = mRotationX;
- final float rY = mRotationY;
- final float rZ = mRotationZ;
- if ((rX != 0) || (rY != 0) || (rZ != 0)) {
- final Camera camera = mCamera;
- camera.save();
- camera.rotateX(rX);
- camera.rotateY(rY);
- camera.rotateZ(-rZ);
- camera.getMatrix(m);
- camera.restore();
- m.preTranslate(-pX, -pY);
- m.postTranslate(pX, pY);
- }
-
- final float sX = mScaleX;
- final float sY = mScaleY;
- if ((sX != 1.0f) || (sY != 1.0f)) {
- m.postScale(sX, sY);
- final float sPX = -(pX / w) * ((sX * w) - w);
- final float sPY = -(pY / h) * ((sY * h) - h);
- m.postTranslate(sPX, sPY);
- }
-
- m.postTranslate(mTranslationX, mTranslationY);
- }
-
- @Override
- protected void applyTransformation(float interpolatedTime, Transformation t) {
- View view = mView.get();
- if (view != null) {
- t.setAlpha(mAlpha);
- transformMatrix(t.getMatrix(), view);
- }
- }
-}
diff --git a/TMessagesProj/src/main/java/org/telegram/messenger/AnimationCompat/AnimatorListenerAdapterProxy.java b/TMessagesProj/src/main/java/org/telegram/messenger/AnimationCompat/AnimatorListenerAdapterProxy.java
deleted file mode 100644
index 4a5c55a17..000000000
--- a/TMessagesProj/src/main/java/org/telegram/messenger/AnimationCompat/AnimatorListenerAdapterProxy.java
+++ /dev/null
@@ -1,112 +0,0 @@
-/*
- * This is the source code of Telegram for Android v. 3.x.x.
- * It is licensed under GNU GPL v. 2 or later.
- * You should have received a copy of the license in this archive (see LICENSE).
- *
- * Copyright Nikolai Kudashov, 2013-2016.
- */
-
-package org.telegram.messenger.AnimationCompat;
-
-import android.animation.Animator;
-import android.animation.AnimatorListenerAdapter;
-
-import org.telegram.messenger.Animation.Animator10;
-import org.telegram.messenger.Animation.AnimatorListenerAdapter10;
-import org.telegram.messenger.Animation.View10;
-
-public class AnimatorListenerAdapterProxy {
- protected Object animatorListenerAdapter;
-
- public AnimatorListenerAdapterProxy() {
- if (View10.NEED_PROXY) {
- animatorListenerAdapter = new AnimatorListenerAdapter10() {
- @Override
- public void onAnimationCancel(Animator10 animation) {
- AnimatorListenerAdapterProxy.this.onAnimationCancel(animation);
- }
-
- @Override
- public void onAnimationEnd(Animator10 animation) {
- AnimatorListenerAdapterProxy.this.onAnimationEnd(animation);
- }
-
- @Override
- public void onAnimationRepeat(Animator10 animation) {
- AnimatorListenerAdapterProxy.this.onAnimationRepeat(animation);
- }
-
- @Override
- public void onAnimationStart(Animator10 animation) {
- AnimatorListenerAdapterProxy.this.onAnimationStart(animation);
- }
-
- @Override
- public void onAnimationPause(Animator10 animation) {
- AnimatorListenerAdapterProxy.this.onAnimationPause(animation);
- }
-
- @Override
- public void onAnimationResume(Animator10 animation) {
- AnimatorListenerAdapterProxy.this.onAnimationResume(animation);
- }
- };
- } else {
- animatorListenerAdapter = new AnimatorListenerAdapter() {
- @Override
- public void onAnimationCancel(Animator animation) {
- AnimatorListenerAdapterProxy.this.onAnimationCancel(animation);
- }
-
- @Override
- public void onAnimationEnd(Animator animation) {
- AnimatorListenerAdapterProxy.this.onAnimationEnd(animation);
- }
-
- @Override
- public void onAnimationRepeat(Animator animation) {
- AnimatorListenerAdapterProxy.this.onAnimationRepeat(animation);
- }
-
- @Override
- public void onAnimationStart(Animator animation) {
- AnimatorListenerAdapterProxy.this.onAnimationStart(animation);
- }
-
- @Override
- public void onAnimationPause(Animator animation) {
- AnimatorListenerAdapterProxy.this.onAnimationPause(animation);
- }
-
- @Override
- public void onAnimationResume(Animator animation) {
- AnimatorListenerAdapterProxy.this.onAnimationResume(animation);
- }
- };
- }
- }
-
- public void onAnimationCancel(Object animation) {
-
- }
-
- public void onAnimationEnd(Object animation) {
-
- }
-
- public void onAnimationRepeat(Object animation) {
-
- }
-
- public void onAnimationStart(Object animation) {
-
- }
-
- public void onAnimationPause(Object animation) {
-
- }
-
- public void onAnimationResume(Object animation) {
-
- }
-}
diff --git a/TMessagesProj/src/main/java/org/telegram/messenger/AnimationCompat/AnimatorSetProxy.java b/TMessagesProj/src/main/java/org/telegram/messenger/AnimationCompat/AnimatorSetProxy.java
deleted file mode 100644
index e6cccb0a2..000000000
--- a/TMessagesProj/src/main/java/org/telegram/messenger/AnimationCompat/AnimatorSetProxy.java
+++ /dev/null
@@ -1,137 +0,0 @@
-/*
- * This is the source code of Telegram for Android v. 3.x.x.
- * It is licensed under GNU GPL v. 2 or later.
- * You should have received a copy of the license in this archive (see LICENSE).
- *
- * Copyright Nikolai Kudashov, 2013-2016.
- */
-
-package org.telegram.messenger.AnimationCompat;
-
-import android.animation.Animator;
-import android.animation.AnimatorListenerAdapter;
-import android.animation.AnimatorSet;
-import android.view.animation.Interpolator;
-
-import org.telegram.messenger.Animation.Animator10;
-import org.telegram.messenger.Animation.AnimatorListenerAdapter10;
-import org.telegram.messenger.Animation.AnimatorSet10;
-import org.telegram.messenger.Animation.View10;
-
-import java.lang.reflect.Array;
-import java.util.ArrayList;
-
-public class AnimatorSetProxy {
-
- private Object animatorSet;
-
- public static T[] copyOf(U[] original, int newLength, Class extends T[]> newType) {
- return copyOfRange(original, 0, newLength, newType);
- }
-
- @SuppressWarnings("unchecked")
- public static T[] copyOfRange(U[] original, int start, int end, Class extends T[]> newType) {
- if (start > end) {
- throw new IllegalArgumentException();
- }
- int originalLength = original.length;
- if (start < 0 || start > originalLength) {
- throw new ArrayIndexOutOfBoundsException();
- }
- int resultLength = end - start;
- int copyLength = Math.min(resultLength, originalLength - start);
- T[] result = (T[]) Array.newInstance(newType.getComponentType(), resultLength);
- System.arraycopy(original, start, result, 0, copyLength);
- return result;
- }
-
- public AnimatorSetProxy() {
- if (View10.NEED_PROXY) {
- animatorSet = new AnimatorSet10();
- } else {
- animatorSet = new AnimatorSet();
- }
- }
-
- @SuppressWarnings("unchecked")
- public void playTogether(Object... items) {
- if (View10.NEED_PROXY) {
- Animator10[] animators = copyOf(items, items.length, Animator10[].class);
- ((AnimatorSet10) animatorSet).playTogether(animators);
- } else {
- Animator[] animators = copyOf(items, items.length, Animator[].class);
- ((AnimatorSet) animatorSet).playTogether(animators);
- }
- }
-
- public void playTogether(ArrayList