diff --git a/TMessagesProj/build.gradle b/TMessagesProj/build.gradle
index 9242c3d0c..665d9d496 100644
--- a/TMessagesProj/build.gradle
+++ b/TMessagesProj/build.gradle
@@ -3,7 +3,7 @@ buildscript {
mavenCentral()
}
dependencies {
- classpath 'com.android.tools.build:gradle:0.10.+'
+ classpath 'com.android.tools.build:gradle:0.11.+'
}
}
apply plugin: 'android'
@@ -18,7 +18,6 @@ tasks.withType(JavaCompile) {
dependencies {
compile 'com.android.support:support-v4:19.0.+'
- compile 'com.android.support:appcompat-v7:19.0.+'
compile 'com.google.android.gms:play-services:4.1.+'
compile 'net.hockeyapp.android:HockeySDK:3.0.1'
}
@@ -82,7 +81,7 @@ android {
defaultConfig {
minSdkVersion 8
targetSdkVersion 19
- versionCode 240
+ versionCode 243
versionName "1.4.15"
}
}
diff --git a/TMessagesProj/src/main/AndroidManifest.xml b/TMessagesProj/src/main/AndroidManifest.xml
index 158676b00..71e7bb9cc 100644
--- a/TMessagesProj/src/main/AndroidManifest.xml
+++ b/TMessagesProj/src/main/AndroidManifest.xml
@@ -100,11 +100,6 @@
android:configChanges="keyboard|keyboardHidden|orientation|screenSize"
android:screenOrientation="portrait">
-
-
diff --git a/TMessagesProj/src/main/assets/emoji/emoji2.0x.jpg b/TMessagesProj/src/main/assets/emoji/emoji2.0x.jpg
deleted file mode 100644
index 204ad9fea..000000000
Binary files a/TMessagesProj/src/main/assets/emoji/emoji2.0x.jpg and /dev/null differ
diff --git a/TMessagesProj/src/main/assets/emoji/emoji2.0x_0.jpg b/TMessagesProj/src/main/assets/emoji/emoji2.0x_0.jpg
new file mode 100644
index 000000000..1cf58511e
Binary files /dev/null and b/TMessagesProj/src/main/assets/emoji/emoji2.0x_0.jpg differ
diff --git a/TMessagesProj/src/main/assets/emoji/emoji2.0x_1.jpg b/TMessagesProj/src/main/assets/emoji/emoji2.0x_1.jpg
new file mode 100644
index 000000000..f5a3bd8a3
Binary files /dev/null and b/TMessagesProj/src/main/assets/emoji/emoji2.0x_1.jpg differ
diff --git a/TMessagesProj/src/main/assets/emoji/emoji2.0x_2.jpg b/TMessagesProj/src/main/assets/emoji/emoji2.0x_2.jpg
new file mode 100644
index 000000000..d0db3e171
Binary files /dev/null and b/TMessagesProj/src/main/assets/emoji/emoji2.0x_2.jpg differ
diff --git a/TMessagesProj/src/main/assets/emoji/emoji2.0x_3.jpg b/TMessagesProj/src/main/assets/emoji/emoji2.0x_3.jpg
new file mode 100644
index 000000000..225f2b8c5
Binary files /dev/null and b/TMessagesProj/src/main/assets/emoji/emoji2.0x_3.jpg differ
diff --git a/TMessagesProj/src/main/assets/emoji/emoji2.0x_4.jpg b/TMessagesProj/src/main/assets/emoji/emoji2.0x_4.jpg
new file mode 100644
index 000000000..453875c0d
Binary files /dev/null and b/TMessagesProj/src/main/assets/emoji/emoji2.0x_4.jpg differ
diff --git a/TMessagesProj/src/main/assets/emoji/emoji2.0x_a.jpg b/TMessagesProj/src/main/assets/emoji/emoji2.0x_a.jpg
deleted file mode 100644
index a0203fe2f..000000000
Binary files a/TMessagesProj/src/main/assets/emoji/emoji2.0x_a.jpg and /dev/null differ
diff --git a/TMessagesProj/src/main/assets/emoji/emoji2.0x_a_0.jpg b/TMessagesProj/src/main/assets/emoji/emoji2.0x_a_0.jpg
new file mode 100644
index 000000000..53416f240
Binary files /dev/null and b/TMessagesProj/src/main/assets/emoji/emoji2.0x_a_0.jpg differ
diff --git a/TMessagesProj/src/main/assets/emoji/emoji2.0x_a_1.jpg b/TMessagesProj/src/main/assets/emoji/emoji2.0x_a_1.jpg
new file mode 100644
index 000000000..8b7a562ea
Binary files /dev/null and b/TMessagesProj/src/main/assets/emoji/emoji2.0x_a_1.jpg differ
diff --git a/TMessagesProj/src/main/assets/emoji/emoji2.0x_a_2.jpg b/TMessagesProj/src/main/assets/emoji/emoji2.0x_a_2.jpg
new file mode 100644
index 000000000..48424203e
Binary files /dev/null and b/TMessagesProj/src/main/assets/emoji/emoji2.0x_a_2.jpg differ
diff --git a/TMessagesProj/src/main/assets/emoji/emoji2.0x_a_3.jpg b/TMessagesProj/src/main/assets/emoji/emoji2.0x_a_3.jpg
new file mode 100644
index 000000000..98cef882c
Binary files /dev/null and b/TMessagesProj/src/main/assets/emoji/emoji2.0x_a_3.jpg differ
diff --git a/TMessagesProj/src/main/assets/emoji/emoji2.0x_a_4.jpg b/TMessagesProj/src/main/assets/emoji/emoji2.0x_a_4.jpg
new file mode 100644
index 000000000..0f8980a81
Binary files /dev/null and b/TMessagesProj/src/main/assets/emoji/emoji2.0x_a_4.jpg differ
diff --git a/TMessagesProj/src/main/assets/emoji/emoji3.0x.jpg b/TMessagesProj/src/main/assets/emoji/emoji3.0x.jpg
deleted file mode 100644
index e5a20b173..000000000
Binary files a/TMessagesProj/src/main/assets/emoji/emoji3.0x.jpg and /dev/null differ
diff --git a/TMessagesProj/src/main/assets/emoji/emoji3.0x_0.jpg b/TMessagesProj/src/main/assets/emoji/emoji3.0x_0.jpg
new file mode 100644
index 000000000..e09c30c59
Binary files /dev/null and b/TMessagesProj/src/main/assets/emoji/emoji3.0x_0.jpg differ
diff --git a/TMessagesProj/src/main/assets/emoji/emoji3.0x_1.jpg b/TMessagesProj/src/main/assets/emoji/emoji3.0x_1.jpg
new file mode 100644
index 000000000..e0b0752ed
Binary files /dev/null and b/TMessagesProj/src/main/assets/emoji/emoji3.0x_1.jpg differ
diff --git a/TMessagesProj/src/main/assets/emoji/emoji3.0x_2.jpg b/TMessagesProj/src/main/assets/emoji/emoji3.0x_2.jpg
new file mode 100644
index 000000000..ffd3c8480
Binary files /dev/null and b/TMessagesProj/src/main/assets/emoji/emoji3.0x_2.jpg differ
diff --git a/TMessagesProj/src/main/assets/emoji/emoji3.0x_3.jpg b/TMessagesProj/src/main/assets/emoji/emoji3.0x_3.jpg
new file mode 100644
index 000000000..dd229d2a5
Binary files /dev/null and b/TMessagesProj/src/main/assets/emoji/emoji3.0x_3.jpg differ
diff --git a/TMessagesProj/src/main/assets/emoji/emoji3.0x_4.jpg b/TMessagesProj/src/main/assets/emoji/emoji3.0x_4.jpg
new file mode 100644
index 000000000..9127912ff
Binary files /dev/null and b/TMessagesProj/src/main/assets/emoji/emoji3.0x_4.jpg differ
diff --git a/TMessagesProj/src/main/assets/emoji/emoji3.0x_a.jpg b/TMessagesProj/src/main/assets/emoji/emoji3.0x_a.jpg
deleted file mode 100644
index 12d55cdbc..000000000
Binary files a/TMessagesProj/src/main/assets/emoji/emoji3.0x_a.jpg and /dev/null differ
diff --git a/TMessagesProj/src/main/assets/emoji/emoji3.0x_a_0.jpg b/TMessagesProj/src/main/assets/emoji/emoji3.0x_a_0.jpg
new file mode 100644
index 000000000..e0e9339ec
Binary files /dev/null and b/TMessagesProj/src/main/assets/emoji/emoji3.0x_a_0.jpg differ
diff --git a/TMessagesProj/src/main/assets/emoji/emoji3.0x_a_1.jpg b/TMessagesProj/src/main/assets/emoji/emoji3.0x_a_1.jpg
new file mode 100644
index 000000000..f5e831aec
Binary files /dev/null and b/TMessagesProj/src/main/assets/emoji/emoji3.0x_a_1.jpg differ
diff --git a/TMessagesProj/src/main/assets/emoji/emoji3.0x_a_2.jpg b/TMessagesProj/src/main/assets/emoji/emoji3.0x_a_2.jpg
new file mode 100644
index 000000000..d04659d6a
Binary files /dev/null and b/TMessagesProj/src/main/assets/emoji/emoji3.0x_a_2.jpg differ
diff --git a/TMessagesProj/src/main/assets/emoji/emoji3.0x_a_3.jpg b/TMessagesProj/src/main/assets/emoji/emoji3.0x_a_3.jpg
new file mode 100644
index 000000000..1a3372391
Binary files /dev/null and b/TMessagesProj/src/main/assets/emoji/emoji3.0x_a_3.jpg differ
diff --git a/TMessagesProj/src/main/assets/emoji/emoji3.0x_a_4.jpg b/TMessagesProj/src/main/assets/emoji/emoji3.0x_a_4.jpg
new file mode 100644
index 000000000..7ce611f72
Binary files /dev/null and b/TMessagesProj/src/main/assets/emoji/emoji3.0x_a_4.jpg differ
diff --git a/TMessagesProj/src/main/java/org/telegram/messenger/ConnectionsManager.java b/TMessagesProj/src/main/java/org/telegram/messenger/ConnectionsManager.java
index 54ee368f9..88454987c 100644
--- a/TMessagesProj/src/main/java/org/telegram/messenger/ConnectionsManager.java
+++ b/TMessagesProj/src/main/java/org/telegram/messenger/ConnectionsManager.java
@@ -184,10 +184,10 @@ public class ConnectionsManager implements Action.ActionDelegate, TcpConnection.
if (paused) {
ApplicationLoader.lastPauseTime = System.currentTimeMillis();
nextSleepTimeout = 30000;
- FileLog.e("tmessages", "wakeup network in background by recieved push");
+ FileLog.e("tmessages", "wakeup network in background by received push");
} else if (ApplicationLoader.lastPauseTime != 0) {
ApplicationLoader.lastPauseTime = System.currentTimeMillis();
- FileLog.e("tmessages", "reset sleep timeout by recieved push");
+ FileLog.e("tmessages", "reset sleep timeout by received push");
}
}
});
@@ -849,7 +849,16 @@ public class ConnectionsManager implements Action.ActionDelegate, TcpConnection.
public static boolean isNetworkOnline() {
try {
ConnectivityManager cm = (ConnectivityManager)ApplicationLoader.applicationContext.getSystemService(Context.CONNECTIVITY_SERVICE);
- NetworkInfo netInfo = cm.getNetworkInfo(ConnectivityManager.TYPE_MOBILE);
+ NetworkInfo netInfo = cm.getActiveNetworkInfo();
+ if (netInfo != null && netInfo.isConnected()) {
+ return true;
+ }
+
+ netInfo = cm.getNetworkInfo(ConnectivityManager.TYPE_MOBILE);
+ if (netInfo.isConnected()) {
+ return true;
+ }
+
if (netInfo != null && netInfo.getState() == NetworkInfo.State.CONNECTED) {
return true;
} else {
diff --git a/TMessagesProj/src/main/java/org/telegram/messenger/Emoji.java b/TMessagesProj/src/main/java/org/telegram/messenger/Emoji.java
index d27606f4f..45c5586e6 100644
--- a/TMessagesProj/src/main/java/org/telegram/messenger/Emoji.java
+++ b/TMessagesProj/src/main/java/org/telegram/messenger/Emoji.java
@@ -34,8 +34,12 @@ public class Emoji {
private static int drawImgSize, bigImgSize;
private static boolean inited = false;
private static Paint placeholderPaint;
- private static Bitmap emojiBmp = null;
- private static boolean loadingEmoji = false;
+ private static Bitmap emojiBmp[] = new Bitmap[5];
+ private static boolean loadingEmoji[] = new boolean[5];
+
+ private static final int[] cols = {
+ 13, 10, 15, 10, 14
+ };
private static final char[] emojiChars = {
0x00A9, 0x00AE, 0x203C, 0x2049, 0x2122, 0x2139, 0x2194, 0x2195, 0x2196, 0x2197,
@@ -199,19 +203,17 @@ public class Emoji {
drawImgSize = Utilities.dp(20);
bigImgSize = Utilities.dp(30);
- int num = 0;
for (int j = 1; j < data.length; j++) {
for (int i = 0; i < data[j].length; i++) {
- Rect rect = new Rect((num % 29) * imgSize, (num / 29) * imgSize, (num % 29 + 1) * imgSize, (num / 29 + 1) * imgSize);
- rects.put(data[j][i], new DrawableInfo(rect));
- num++;
+ Rect rect = new Rect((i % cols[j - 1]) * imgSize, (i / cols[j - 1]) * imgSize, (i % cols[j - 1] + 1) * imgSize, (i / cols[j - 1] + 1) * imgSize);
+ rects.put(data[j][i], new DrawableInfo(rect, (byte)(j - 1)));
}
}
placeholderPaint = new Paint();
- placeholderPaint.setColor(0x55000000);
+ placeholderPaint.setColor(0x00000000);
}
- private static Bitmap loadEmoji() {
+ private static Bitmap loadEmoji(final int page) {
try {
float scale = 1.0f;
int imageResize = 1;
@@ -227,7 +229,7 @@ public class Emoji {
scale = 3.0f;
}
- String imageName = String.format(Locale.US, "emoji%.01fx.jpg", scale);
+ String imageName = String.format(Locale.US, "emoji%.01fx_%d.jpg", scale, page);
File imageFile = ApplicationLoader.applicationContext.getFileStreamPath(imageName);
if (!imageFile.exists()) {
InputStream is = ApplicationLoader.applicationContext.getAssets().open("emoji/" + imageName);
@@ -242,7 +244,7 @@ public class Emoji {
final Bitmap colorsBitmap = Bitmap.createBitmap(opts.outWidth / imageResize, opts.outHeight / imageResize, Bitmap.Config.ARGB_8888);
Utilities.loadBitmap(imageFile.getAbsolutePath(), colorsBitmap, imageResize);
- imageName = String.format(Locale.US, "emoji%.01fx_a.jpg", scale);
+ imageName = String.format(Locale.US, "emoji%.01fx_a_%d.jpg", scale, page);
imageFile = ApplicationLoader.applicationContext.getFileStreamPath(imageName);
if (!imageFile.exists()) {
InputStream is = ApplicationLoader.applicationContext.getAssets().open("emoji/" + imageName);
@@ -255,7 +257,7 @@ public class Emoji {
Utilities.RunOnUIThread(new Runnable() {
@Override
public void run() {
- emojiBmp = colorsBitmap;
+ emojiBmp[page] = colorsBitmap;
NotificationCenter.getInstance().postNotificationName(999);
}
});
@@ -267,15 +269,15 @@ public class Emoji {
return null;
}
- private static void loadEmojiAsync() {
- if (loadingEmoji) {
+ private static void loadEmojiAsync(final int page) {
+ if (loadingEmoji[page]) {
return;
}
- loadingEmoji = true;
+ loadingEmoji[page] = true;
new Thread(new Runnable() {
public void run() {
- loadEmoji();
- loadingEmoji = false;
+ loadEmoji(page);
+ loadingEmoji[page] = false;
}
}).start();
}
@@ -313,7 +315,7 @@ public class Emoji {
}
public static class EmojiDrawable extends Drawable {
- Rect rect;
+ private DrawableInfo info;
boolean fullSize = false;
private static Paint paint;
@@ -322,14 +324,14 @@ public class Emoji {
paint.setFlags(Paint.FILTER_BITMAP_FLAG | Paint.ANTI_ALIAS_FLAG);
}
- public EmojiDrawable(DrawableInfo info) {
- rect = info.rect;
+ public EmojiDrawable(DrawableInfo i) {
+ info = i;
}
@Override
public void draw(Canvas canvas) {
- if (emojiBmp == null) {
- loadEmojiAsync();
+ if (emojiBmp[info.page] == null) {
+ loadEmojiAsync(info.page);
canvas.drawRect(getBounds(), placeholderPaint);
return;
}
@@ -340,7 +342,7 @@ public class Emoji {
b.top = cY - (fullSize ? bigImgSize : drawImgSize) / 2;
b.bottom = cY + (fullSize ? bigImgSize : drawImgSize) / 2;
if (!canvas.quickReject(b.left, b.top, b.right, b.bottom, Canvas.EdgeType.AA)) {
- canvas.drawBitmap(emojiBmp, rect, b, paint);
+ canvas.drawBitmap(emojiBmp[info.page], info.rect, b, paint);
}
}
@@ -361,9 +363,12 @@ public class Emoji {
}
private static class DrawableInfo {
- Rect rect;
- public DrawableInfo(Rect rect) {
- this.rect = rect;
+ public Rect rect;
+ public byte page;
+
+ public DrawableInfo(Rect r, byte p) {
+ rect = r;
+ page = p;
}
}
diff --git a/TMessagesProj/src/main/java/org/telegram/messenger/FileLoadOperation.java b/TMessagesProj/src/main/java/org/telegram/messenger/FileLoadOperation.java
index 0c87667d5..1a2b32b63 100644
--- a/TMessagesProj/src/main/java/org/telegram/messenger/FileLoadOperation.java
+++ b/TMessagesProj/src/main/java/org/telegram/messenger/FileLoadOperation.java
@@ -93,12 +93,7 @@ public class FileLoadOperation {
}
public FileLoadOperation(TLRPC.Audio audioLocation) {
- if (audioLocation instanceof TLRPC.TL_audio) {
- location = new TLRPC.TL_inputAudioFileLocation();
- datacenter_id = audioLocation.dc_id;
- location.id = audioLocation.id;
- location.access_hash = audioLocation.access_hash;
- } else if (audioLocation instanceof TLRPC.TL_audioEncrypted) {
+ if (audioLocation instanceof TLRPC.TL_audioEncrypted) {
location = new TLRPC.TL_inputEncryptedFileLocation();
location.id = audioLocation.id;
location.access_hash = audioLocation.access_hash;
@@ -106,6 +101,11 @@ public class FileLoadOperation {
iv = new byte[32];
System.arraycopy(audioLocation.iv, 0, iv, 0, iv.length);
key = audioLocation.key;
+ } else if (audioLocation instanceof TLRPC.TL_audio) {
+ location = new TLRPC.TL_inputAudioFileLocation();
+ datacenter_id = audioLocation.dc_id;
+ location.id = audioLocation.id;
+ location.access_hash = audioLocation.access_hash;
}
ext = ".m4a";
}
diff --git a/TMessagesProj/src/main/java/org/telegram/messenger/FileLoader.java b/TMessagesProj/src/main/java/org/telegram/messenger/FileLoader.java
index afb2cad56..97a0289e7 100644
--- a/TMessagesProj/src/main/java/org/telegram/messenger/FileLoader.java
+++ b/TMessagesProj/src/main/java/org/telegram/messenger/FileLoader.java
@@ -20,7 +20,6 @@ import android.os.ParcelFileDescriptor;
import org.telegram.objects.MessageObject;
import org.telegram.ui.ApplicationLoader;
-import org.telegram.ui.Views.BackupImageView;
import org.telegram.ui.Views.ImageReceiver;
import java.io.ByteArrayOutputStream;
@@ -34,6 +33,7 @@ import java.util.HashMap;
import java.util.LinkedList;
import java.util.Queue;
import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.Semaphore;
public class FileLoader {
public LruCache memCache;
@@ -132,10 +132,10 @@ public class FileLoader {
private class CacheImage {
public String key;
- final public ArrayList