Commit 7545dfe2 authored by DrKLO's avatar DrKLO

Merge branch 'dev'

parents 331a0bb7 8f7652bb
...@@ -18,7 +18,7 @@ tasks.withType(JavaCompile) { ...@@ -18,7 +18,7 @@ tasks.withType(JavaCompile) {
dependencies { dependencies {
compile 'com.android.support:support-v4:19.0.+' compile 'com.android.support:support-v4:19.0.+'
compile 'com.google.android.gms:play-services:4.1.+' compile 'com.google.android.gms:play-services:3.2.+'
compile 'net.hockeyapp.android:HockeySDK:3.0.1' compile 'net.hockeyapp.android:HockeySDK:3.0.1'
compile 'com.googlecode.mp4parser:isoparser:1.0.+' compile 'com.googlecode.mp4parser:isoparser:1.0.+'
} }
...@@ -83,7 +83,7 @@ android { ...@@ -83,7 +83,7 @@ android {
defaultConfig { defaultConfig {
minSdkVersion 8 minSdkVersion 8
targetSdkVersion 19 targetSdkVersion 19
versionCode 288 versionCode 307
versionName "1.6.1" versionName "1.7.0"
} }
} }
...@@ -28,7 +28,6 @@ ...@@ -28,7 +28,6 @@
android:largeHeap="true"> android:largeHeap="true">
<meta-data android:name="com.google.android.maps.v2.API_KEY" android:value="AIzaSyCTNmNqbWovP9ETcAob98YlrfOQEAC0CJ4" /> <meta-data android:name="com.google.android.maps.v2.API_KEY" android:value="AIzaSyCTNmNqbWovP9ETcAob98YlrfOQEAC0CJ4" />
<meta-data android:name="com.google.android.gms.version" android:value="@integer/google_play_services_version" />
<activity android:name="net.hockeyapp.android.UpdateActivity" /> <activity android:name="net.hockeyapp.android.UpdateActivity" />
......
...@@ -28,7 +28,6 @@ ...@@ -28,7 +28,6 @@
android:largeHeap="true"> android:largeHeap="true">
<meta-data android:name="com.google.android.maps.v2.API_KEY" android:value="AIzaSyA-t0jLPjUt2FxrA8VPK2EiYHcYcboIR6k" /> <meta-data android:name="com.google.android.maps.v2.API_KEY" android:value="AIzaSyA-t0jLPjUt2FxrA8VPK2EiYHcYcboIR6k" />
<meta-data android:name="com.google.android.gms.version" android:value="@integer/google_play_services_version" />
<activity android:name="net.hockeyapp.android.UpdateActivity" /> <activity android:name="net.hockeyapp.android.UpdateActivity" />
......
...@@ -8,6 +8,7 @@ LOCAL_CFLAGS += -Drestrict='' -D__EMX__ -DOPUS_BUILD -DFIXED_POINT -DUSE_ALLOCA ...@@ -8,6 +8,7 @@ LOCAL_CFLAGS += -Drestrict='' -D__EMX__ -DOPUS_BUILD -DFIXED_POINT -DUSE_ALLOCA
LOCAL_CFLAGS += -DANDROID_NDK -DDISABLE_IMPORTGL -fno-strict-aliasing -fprefetch-loop-arrays -DAVOID_TABLES -DANDROID_TILE_BASED_DECODE -DANDROID_ARMV6_IDCT LOCAL_CFLAGS += -DANDROID_NDK -DDISABLE_IMPORTGL -fno-strict-aliasing -fprefetch-loop-arrays -DAVOID_TABLES -DANDROID_TILE_BASED_DECODE -DANDROID_ARMV6_IDCT
LOCAL_CPPFLAGS := -DBSD=1 -ffast-math -O2 -funroll-loops LOCAL_CPPFLAGS := -DBSD=1 -ffast-math -O2 -funroll-loops
#LOCAL_LDLIBS := -llog #LOCAL_LDLIBS := -llog
LOCAL_LDLIBS := -ljnigraphics
LOCAL_SRC_FILES := \ LOCAL_SRC_FILES := \
./opus/src/opus.c \ ./opus/src/opus.c \
......
...@@ -2,5 +2,5 @@ ...@@ -2,5 +2,5 @@
void fakeFunction() { void fakeFunction() {
printf("some androids has buggy native loader, so i should check size of libs in java to know that native library is correct. So each changed native library should has diffrent size in different app versions. This function will increase lib size for few bytes :)"); printf("some androids has buggy native loader, so i should check size of libs in java to know that native library is correct. So each changed native library should has diffrent size in different app versions. This function will increase lib size for few bytes :)");
printf("bla blablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablabla"); printf("bla blablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablablabla");
} }
This diff is collapsed.
...@@ -2,8 +2,101 @@ ...@@ -2,8 +2,101 @@
#include <stdio.h> #include <stdio.h>
#include <setjmp.h> #include <setjmp.h>
#include <libjpeg/jpeglib.h> #include <libjpeg/jpeglib.h>
#include <android/bitmap.h>
#include "utils.h" #include "utils.h"
static inline uint64_t get_colors (const uint8_t *p) {
return p[0] + (p[1] << 16) + ((uint64_t)p[2] << 32);
}
static void fastBlur(int imageWidth, int imageHeight, int imageStride, void *pixels) {
uint8_t *pix = (uint8_t *)pixels;
const int w = imageWidth;
const int h = imageHeight;
const int stride = imageStride;
const int radius = 3;
const int r1 = radius + 1;
const int div = radius * 2 + 1;
if (radius > 15 || div >= w || div >= h) {
return;
}
uint64_t rgb[imageStride * imageHeight];
int x, y, i;
int yw = 0;
const int we = w - r1;
for (y = 0; y < h; y++) {
uint64_t cur = get_colors (&pix[yw]);
uint64_t rgballsum = -radius * cur;
uint64_t rgbsum = cur * ((r1 * (r1 + 1)) >> 1);
for (i = 1; i <= radius; i++) {
uint64_t cur = get_colors (&pix[yw + i * 4]);
rgbsum += cur * (r1 - i);
rgballsum += cur;
}
x = 0;
#define update(start, middle, end) \
rgb[y * w + x] = (rgbsum >> 4) & 0x00FF00FF00FF00FFLL; \
rgballsum += get_colors (&pix[yw + (start) * 4]) - 2 * get_colors (&pix[yw + (middle) * 4]) + get_colors (&pix[yw + (end) * 4]); \
rgbsum += rgballsum; \
x++; \
while (x < r1) {
update (0, x, x + r1);
}
while (x < we) {
update (x - r1, x, x + r1);
}
while (x < w) {
update (x - r1, x, w - 1);
}
#undef update
yw += stride;
}
const int he = h - r1;
for (x = 0; x < w; x++) {
uint64_t rgballsum = -radius * rgb[x];
uint64_t rgbsum = rgb[x] * ((r1 * (r1 + 1)) >> 1);
for (i = 1; i <= radius; i++) {
rgbsum += rgb[i * w + x] * (r1 - i);
rgballsum += rgb[i * w + x];
}
y = 0;
int yi = x * 4;
#define update(start, middle, end) \
int64_t res = rgbsum >> 4; \
pix[yi] = res; \
pix[yi + 1] = res >> 16; \
pix[yi + 2] = res >> 32; \
rgballsum += rgb[x + (start) * w] - 2 * rgb[x + (middle) * w] + rgb[x + (end) * w]; \
rgbsum += rgballsum; \
y++; \
yi += stride;
while (y < r1) {
update (0, y, y + r1);
}
while (y < he) {
update (y - r1, y, y + r1);
}
while (y < h) {
update (y - r1, y, h - 1);
}
#undef update
}
}
typedef struct my_error_mgr { typedef struct my_error_mgr {
struct jpeg_error_mgr pub; struct jpeg_error_mgr pub;
jmp_buf setjmp_buffer; jmp_buf setjmp_buffer;
...@@ -16,6 +109,15 @@ METHODDEF(void) my_error_exit(j_common_ptr cinfo) { ...@@ -16,6 +109,15 @@ METHODDEF(void) my_error_exit(j_common_ptr cinfo) {
longjmp(myerr->setjmp_buffer, 1); longjmp(myerr->setjmp_buffer, 1);
} }
JNIEXPORT void Java_org_telegram_messenger_Utilities_blurBitmap(JNIEnv *env, jclass class, jobject bitmap, int width, int height, int stride) {
void *pixels = 0;
if (AndroidBitmap_lockPixels(env, bitmap, &pixels) < 0) {
return;
}
fastBlur(width, height, stride, pixels);
AndroidBitmap_unlockPixels(env, bitmap);
}
JNIEXPORT void Java_org_telegram_messenger_Utilities_loadBitmap(JNIEnv *env, jclass class, jstring path, jintArray bitmap, int scale, int format, int width, int height) { JNIEXPORT void Java_org_telegram_messenger_Utilities_loadBitmap(JNIEnv *env, jclass class, jstring path, jintArray bitmap, int scale, int format, int width, int height) {
int i; int i;
......
...@@ -221,4 +221,8 @@ public class AndroidUtilities { ...@@ -221,4 +221,8 @@ public class AndroidUtilities {
FileLog.e("tmessages", e); FileLog.e("tmessages", e);
} }
} }
public static long makeBroadcastId(int id) {
return 0x0000000100000000L | ((long)id & 0x00000000FFFFFFFFL);
}
} }
...@@ -47,10 +47,7 @@ public class ContactsController { ...@@ -47,10 +47,7 @@ public class ContactsController {
private final Integer observerLock = 1; private final Integer observerLock = 1;
public boolean contactsLoaded = false; public boolean contactsLoaded = false;
private boolean contactsBookLoaded = false; private boolean contactsBookLoaded = false;
private int lastContactsPhonesCount = -1; private String lastContactsVersions = "";
private int lastContactsPhonesMaxId = -1;
private int lastContactsNamesCount = -1;
private int lastContactsNamesMaxId = -1;
private ArrayList<Integer> delayedContactsUpdate = new ArrayList<Integer>(); private ArrayList<Integer> delayedContactsUpdate = new ArrayList<Integer>();
public static class Contact { public static class Contact {
...@@ -119,10 +116,7 @@ public class ContactsController { ...@@ -119,10 +116,7 @@ public class ContactsController {
contactsSyncInProgress = false; contactsSyncInProgress = false;
contactsLoaded = false; contactsLoaded = false;
contactsBookLoaded = false; contactsBookLoaded = false;
lastContactsPhonesCount = -1; lastContactsVersions = "";
lastContactsPhonesMaxId = -1;
lastContactsNamesCount = -1;
lastContactsNamesMaxId = -1;
} }
public void checkAppAccount() { public void checkAppAccount() {
...@@ -191,70 +185,17 @@ public class ContactsController { ...@@ -191,70 +185,17 @@ public class ContactsController {
ContentResolver cr = ApplicationLoader.applicationContext.getContentResolver(); ContentResolver cr = ApplicationLoader.applicationContext.getContentResolver();
Cursor pCur = null; Cursor pCur = null;
try { try {
pCur = cr.query(ContactsContract.CommonDataKinds.Phone.CONTENT_URI, new String[]{ContactsContract.CommonDataKinds.Phone._ID}, null, null, ContactsContract.CommonDataKinds.Phone._ID + " desc LIMIT 1"); pCur = cr.query(ContactsContract.RawContacts.CONTENT_URI, new String[]{ContactsContract.RawContacts.VERSION}, null, null, null);
if (pCur != null) { StringBuilder currentVersion = new StringBuilder();
if (pCur.getCount() > 0 && pCur.moveToFirst()) { while (pCur.moveToNext()) {
int value = pCur.getInt(0); int col = pCur.getColumnIndex(ContactsContract.RawContacts.VERSION);
if (lastContactsPhonesMaxId != -1 && value != lastContactsPhonesMaxId) { currentVersion.append(pCur.getString(col));
reload = true;
}
lastContactsPhonesMaxId = value;
}
}
} catch (Exception e) {
FileLog.e("tmessages", e);
} finally {
if (pCur != null) {
pCur.close();
}
}
try {
pCur = cr.query(ContactsContract.CommonDataKinds.Phone.CONTENT_URI, new String[]{ContactsContract.CommonDataKinds.Phone._COUNT}, null, null, null);
if (pCur != null) {
if (pCur.getCount() > 0 && pCur.moveToFirst()) {
int value = pCur.getInt(0);
if (lastContactsPhonesCount != -1 && value != lastContactsPhonesCount) {
reload = true;
}
lastContactsPhonesCount = value;
}
}
} catch (Exception e) {
FileLog.e("tmessages", e);
} finally {
if (pCur != null) {
pCur.close();
}
}
try {
pCur = cr.query(ContactsContract.Data.CONTENT_URI, new String[]{ContactsContract.Data._COUNT}, ContactsContract.Data.MIMETYPE + " = '" + ContactsContract.CommonDataKinds.StructuredName.CONTENT_ITEM_TYPE + "'", null, null);
if (pCur != null) {
if (pCur.getCount() > 0 && pCur.moveToFirst()) {
int value = pCur.getInt(0);
if (lastContactsNamesCount != -1 && value != lastContactsNamesCount) {
reload = true;
}
lastContactsNamesCount = value;
}
}
} catch (Exception e) {
FileLog.e("tmessages", e);
} finally {
if (pCur != null) {
pCur.close();
}
} }
try { String newContactsVersion = currentVersion.toString();
pCur = cr.query(ContactsContract.Data.CONTENT_URI, new String[]{ContactsContract.Data._ID}, ContactsContract.Data.MIMETYPE + " = '" + ContactsContract.CommonDataKinds.StructuredName.CONTENT_ITEM_TYPE + "'", null, ContactsContract.Data._ID + " desc LIMIT 1"); if (lastContactsVersions.length() != 0 && !lastContactsVersions.equals(newContactsVersion)) {
if (pCur != null) {
if (pCur.getCount() > 0 && pCur.moveToFirst()) {
int value = pCur.getInt(0);
if (lastContactsNamesMaxId != -1 && value != lastContactsNamesMaxId) {
reload = true; reload = true;
} }
lastContactsNamesMaxId = value; lastContactsVersions = newContactsVersion;
}
}
} catch (Exception e) { } catch (Exception e) {
FileLog.e("tmessages", e); FileLog.e("tmessages", e);
} finally { } finally {
...@@ -368,7 +309,7 @@ public class ContactsController { ...@@ -368,7 +309,7 @@ public class ContactsController {
String sname2 = pCur.getString(3); String sname2 = pCur.getString(3);
String mname = pCur.getString(4); String mname = pCur.getString(4);
Contact contact = contactsMap.get(id); Contact contact = contactsMap.get(id);
if (contact != null) { if (contact != null && contact.first_name.length() == 0 && contact.last_name.length() == 0) {
contact.first_name = fname; contact.first_name = fname;
contact.last_name = sname; contact.last_name = sname;
if (contact.first_name == null) { if (contact.first_name == null) {
...@@ -535,7 +476,8 @@ public class ContactsController { ...@@ -535,7 +476,8 @@ public class ContactsController {
} }
} }
if (existing == null || existing != null && (!existing.first_name.equals(value.first_name) || !existing.last_name.equals(value.last_name))) { boolean nameChanged = existing != null && (!existing.first_name.equals(value.first_name) || !existing.last_name.equals(value.last_name));
if (existing == null || nameChanged) {
for (int a = 0; a < value.phones.size(); a++) { for (int a = 0; a < value.phones.size(); a++) {
String sphone = value.shortPhones.get(a); String sphone = value.shortPhones.get(a);
contactsBookShort.put(sphone, value); contactsBookShort.put(sphone, value);
...@@ -550,7 +492,7 @@ public class ContactsController { ...@@ -550,7 +492,7 @@ public class ContactsController {
} }
} }
if (request) { if (request) {
if (contactsByPhone.containsKey(sphone)) { if (!nameChanged && contactsByPhone.containsKey(sphone)) {
continue; continue;
} }
......
...@@ -24,9 +24,9 @@ import java.util.zip.ZipFile; ...@@ -24,9 +24,9 @@ import java.util.zip.ZipFile;
public class NativeLoader { public class NativeLoader {
private static final long sizes[] = new long[] { private static final long sizes[] = new long[] {
799376, //armeabi 803472, //armeabi
848548, //armeabi-v7a 856740, //armeabi-v7a
1246260, //x86 1250356, //x86
0, //mips 0, //mips
}; };
......
...@@ -183,6 +183,8 @@ public class NotificationsController { ...@@ -183,6 +183,8 @@ public class NotificationsController {
} }
msg = LocaleController.formatString("NotificationGroupKickMember", R.string.NotificationGroupKickMember, Utilities.formatName(user.first_name, user.last_name), chat.title, Utilities.formatName(u2.first_name, u2.last_name)); msg = LocaleController.formatString("NotificationGroupKickMember", R.string.NotificationGroupKickMember, Utilities.formatName(user.first_name, user.last_name), chat.title, Utilities.formatName(u2.first_name, u2.last_name));
} }
} else if (messageObject.messageOwner.action instanceof TLRPC.TL_messageActionChatCreate) {
msg = messageObject.messageText.toString();
} }
} else { } else {
if (messageObject.messageOwner.media instanceof TLRPC.TL_messageMediaEmpty) { if (messageObject.messageOwner.media instanceof TLRPC.TL_messageMediaEmpty) {
...@@ -305,11 +307,13 @@ public class NotificationsController { ...@@ -305,11 +307,13 @@ public class NotificationsController {
intent.setAction("com.tmessages.openchat" + Math.random() + Integer.MAX_VALUE); intent.setAction("com.tmessages.openchat" + Math.random() + Integer.MAX_VALUE);
intent.setFlags(32768); intent.setFlags(32768);
if ((int)dialog_id != 0) { if ((int)dialog_id != 0) {
if (pushDialogs.size() == 1) {
if (chat_id != 0) { if (chat_id != 0) {
intent.putExtra("chatId", chat_id); intent.putExtra("chatId", chat_id);
} else if (user_id != 0) { } else if (user_id != 0) {
intent.putExtra("userId", user_id); intent.putExtra("userId", user_id);
} }
}
if (pushDialogs.size() == 1) { if (pushDialogs.size() == 1) {
if (chat != null) { if (chat != null) {
if (chat.photo != null && chat.photo.photo_small != null && chat.photo.photo_small.volume_id != 0 && chat.photo.photo_small.local_id != 0) { if (chat.photo != null && chat.photo.photo_small != null && chat.photo.photo_small.volume_id != 0 && chat.photo.photo_small.local_id != 0) {
...@@ -322,7 +326,9 @@ public class NotificationsController { ...@@ -322,7 +326,9 @@ public class NotificationsController {
} }
} }
} else { } else {
intent.putExtra("encId", (int)(dialog_id >> 32)); if (pushDialogs.size() == 1) {
intent.putExtra("encId", (int) (dialog_id >> 32));
}
} }
PendingIntent contentIntent = PendingIntent.getActivity(ApplicationLoader.applicationContext, 0, intent, PendingIntent.FLAG_ONE_SHOT); PendingIntent contentIntent = PendingIntent.getActivity(ApplicationLoader.applicationContext, 0, intent, PendingIntent.FLAG_ONE_SHOT);
...@@ -350,7 +356,6 @@ public class NotificationsController { ...@@ -350,7 +356,6 @@ public class NotificationsController {
.setContentTitle(name) .setContentTitle(name)
.setSmallIcon(R.drawable.notification) .setSmallIcon(R.drawable.notification)
.setAutoCancel(true) .setAutoCancel(true)
.setContentText(detailText)
.setContentIntent(contentIntent); .setContentIntent(contentIntent);
String lastMessage = null; String lastMessage = null;
...@@ -366,8 +371,10 @@ public class NotificationsController { ...@@ -366,8 +371,10 @@ public class NotificationsController {
message = message.replace(name + ": ", "").replace(name + " ", ""); message = message.replace(name + ": ", "").replace(name + " ", "");
} }
} }
mBuilder.setContentText(message);
mBuilder.setStyle(new NotificationCompat.BigTextStyle().bigText(message)); mBuilder.setStyle(new NotificationCompat.BigTextStyle().bigText(message));
} else { } else {
mBuilder.setContentText(detailText);
NotificationCompat.InboxStyle inboxStyle = new NotificationCompat.InboxStyle(); NotificationCompat.InboxStyle inboxStyle = new NotificationCompat.InboxStyle();
inboxStyle.setBigContentTitle(name); inboxStyle.setBigContentTitle(name);
int count = Math.min(10, pushMessages.size()); int count = Math.min(10, pushMessages.size());
...@@ -395,7 +402,7 @@ public class NotificationsController { ...@@ -395,7 +402,7 @@ public class NotificationsController {
} }
if (photoPath != null) { if (photoPath != null) {
Bitmap img = FileLoader.getInstance().getImageFromMemory(photoPath, null, null, "50_50", false); Bitmap img = FileLoader.getInstance().getImageFromMemory(photoPath, null, null, "50_50");
if (img != null) { if (img != null) {
mBuilder.setLargeIcon(img); mBuilder.setLargeIcon(img);
} }
...@@ -417,6 +424,8 @@ public class NotificationsController { ...@@ -417,6 +424,8 @@ public class NotificationsController {
} }
if (needVibrate) { if (needVibrate) {
mBuilder.setVibrate(new long[]{0, 100, 0, 100}); mBuilder.setVibrate(new long[]{0, 100, 0, 100});
} else {
mBuilder.setVibrate(new long[]{0, 0});
} }
} else { } else {
mBuilder.setVibrate(new long[]{0, 0}); mBuilder.setVibrate(new long[]{0, 0});
...@@ -485,7 +494,7 @@ public class NotificationsController { ...@@ -485,7 +494,7 @@ public class NotificationsController {
remove = true; remove = true;
} }
} else { } else {
if (messageObject.messageOwner.id <= max_id) { if (messageObject.messageOwner.id <= max_id || max_id < 0) {
remove = true; remove = true;
} }
} }
...@@ -501,9 +510,6 @@ public class NotificationsController { ...@@ -501,9 +510,6 @@ public class NotificationsController {
if (oldCount != popupMessages.size()) { if (oldCount != popupMessages.size()) {
NotificationCenter.getInstance().postNotificationName(pushMessagesUpdated); NotificationCenter.getInstance().postNotificationName(pushMessagesUpdated);
} }
// if (readMessages != null || oldCount2 != pushMessages.size() || readMessages == null && dialog_id == 0) {
// showOrUpdateNotification(notifyCheck);
// }
} }
public void processNewMessages(ArrayList<MessageObject> messageObjects, boolean isLast) { public void processNewMessages(ArrayList<MessageObject> messageObjects, boolean isLast) {
...@@ -529,7 +535,7 @@ public class NotificationsController { ...@@ -529,7 +535,7 @@ public class NotificationsController {
Boolean value = settingsCache.get(dialog_id); Boolean value = settingsCache.get(dialog_id);
boolean isChat = (int)dialog_id < 0; boolean isChat = (int)dialog_id < 0;
popup = preferences.getInt(isChat ? "popupGroup" : "popupAll", 0); popup = (int)dialog_id == 0 ? 0 : preferences.getInt(isChat ? "popupGroup" : "popupAll", 0);
if (value == null) { if (value == null) {
int notify_override = preferences.getInt("notify2_" + dialog_id, 0); int notify_override = preferences.getInt("notify2_" + dialog_id, 0);
value = !(notify_override == 2 || (!preferences.getBoolean("EnableAll", true) || isChat && !preferences.getBoolean("EnableGroup", true)) && notify_override == 0); value = !(notify_override == 2 || (!preferences.getBoolean("EnableAll", true) || isChat && !preferences.getBoolean("EnableGroup", true)) && notify_override == 0);
...@@ -569,7 +575,8 @@ public class NotificationsController { ...@@ -569,7 +575,8 @@ public class NotificationsController {
int notify_override = preferences.getInt("notify2_" + dialog_id, 0); int notify_override = preferences.getInt("notify2_" + dialog_id, 0);
boolean isChat = (int)dialog_id < 0; boolean isChat = (int)dialog_id < 0;
Integer currentCount = pushDialogs.get(dialog_id); Integer currentCount = pushDialogs.get(dialog_id);
if (!(notify_override == 2 || (!preferences.getBoolean("EnableAll", true) || isChat && !preferences.getBoolean("EnableGroup", true)) && notify_override == 0)) { boolean canAddValue = !(notify_override == 2 || (!preferences.getBoolean("EnableAll", true) || isChat && !preferences.getBoolean("EnableGroup", true)) && notify_override == 0);
Integer newCount = entry.getValue(); Integer newCount = entry.getValue();
if (replace) { if (replace) {
if (currentCount != null) { if (currentCount != null) {
...@@ -577,11 +584,20 @@ public class NotificationsController { ...@@ -577,11 +584,20 @@ public class NotificationsController {
} }
if (newCount == 0) { if (newCount == 0) {
pushDialogs.remove(dialog_id); pushDialogs.remove(dialog_id);
} else { for (int a = 0; a < pushMessages.size(); a++) {
MessageObject messageObject = pushMessages.get(a);
if (messageObject.getDialogId() == dialog_id) {
pushMessages.remove(a);
a--;
pushMessagesDict.remove(messageObject.messageOwner.id);
popupMessages.remove(messageObject);
}
}
} else if (canAddValue) {
total_unread_count += newCount; total_unread_count += newCount;
pushDialogs.put(dialog_id, newCount); pushDialogs.put(dialog_id, newCount);
} }
} else { } else if (canAddValue) {
if (currentCount == null) { if (currentCount == null) {
currentCount = 0; currentCount = 0;
} }
...@@ -590,11 +606,10 @@ public class NotificationsController { ...@@ -590,11 +606,10 @@ public class NotificationsController {
pushDialogs.put(dialog_id, currentCount); pushDialogs.put(dialog_id, currentCount);
} }
} }
}
if (old_unread_count != total_unread_count) { if (old_unread_count != total_unread_count) {
showOrUpdateNotification(notifyCheck); showOrUpdateNotification(notifyCheck);
notifyCheck = false;
} }
notifyCheck = false;
if (preferences.getBoolean("badgeNumber", true)) { if (preferences.getBoolean("badgeNumber", true)) {
setBadge(ApplicationLoader.applicationContext, total_unread_count); setBadge(ApplicationLoader.applicationContext, total_unread_count);
} }
...@@ -604,7 +619,6 @@ public class NotificationsController { ...@@ -604,7 +619,6 @@ public class NotificationsController {
pushDialogs.clear(); pushDialogs.clear();
total_unread_count = 0; total_unread_count = 0;
SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("Notifications", Context.MODE_PRIVATE); SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("Notifications", Context.MODE_PRIVATE);
String dialogsToLoad = "";
for (HashMap.Entry<Long, Integer> entry : dialogs.entrySet()) { for (HashMap.Entry<Long, Integer> entry : dialogs.entrySet()) {
long dialog_id = entry.getKey(); long dialog_id = entry.getKey();
int notify_override = preferences.getInt("notify2_" + dialog_id, 0); int notify_override = preferences.getInt("notify2_" + dialog_id, 0);
...@@ -612,10 +626,6 @@ public class NotificationsController { ...@@ -612,10 +626,6 @@ public class NotificationsController {
if (!(notify_override == 2 || (!preferences.getBoolean("EnableAll", true) || isChat && !preferences.getBoolean("EnableGroup", true)) && notify_override == 0)) { if (!(notify_override == 2 || (!preferences.getBoolean("EnableAll", true) || isChat && !preferences.getBoolean("EnableGroup", true)) && notify_override == 0)) {
pushDialogs.put(dialog_id, entry.getValue()); pushDialogs.put(dialog_id, entry.getValue());
total_unread_count += entry.getValue(); total_unread_count += entry.getValue();
if (dialogsToLoad.length() != 0) {
dialogsToLoad += ",";
}
dialogsToLoad += "" + dialog_id;
} }
} }
if (total_unread_count == 0) { if (total_unread_count == 0) {
......
...@@ -781,6 +781,7 @@ public class ConnectionsManager implements Action.ActionDelegate, TcpConnection. ...@@ -781,6 +781,7 @@ public class ConnectionsManager implements Action.ActionDelegate, TcpConnection.
processRequestQueue(RPCRequest.RPCRequestClassTransportMask, 0); processRequestQueue(RPCRequest.RPCRequestClassTransportMask, 0);
} }
MessagesController.getInstance().updateConfig(config);
} }
updatingDcSettings = false; updatingDcSettings = false;
} }
...@@ -850,7 +851,7 @@ public class ConnectionsManager implements Action.ActionDelegate, TcpConnection. ...@@ -850,7 +851,7 @@ public class ConnectionsManager implements Action.ActionDelegate, TcpConnection.
} }
public long performRpc(final TLObject rpc, final RPCRequest.RPCRequestDelegate completionBlock, final RPCRequest.RPCQuickAckDelegate quickAckBlock, final boolean requiresCompletion, final int requestClass, final int datacenterId, final boolean runQueue) { public long performRpc(final TLObject rpc, final RPCRequest.RPCRequestDelegate completionBlock, final RPCRequest.RPCQuickAckDelegate quickAckBlock, final boolean requiresCompletion, final int requestClass, final int datacenterId, final boolean runQueue) {
if (!UserConfig.isClientActivated() && (requestClass & RPCRequest.RPCRequestClassWithoutLogin) == 0) { if (rpc == null || !UserConfig.isClientActivated() && (requestClass & RPCRequest.RPCRequestClassWithoutLogin) == 0) {
FileLog.e("tmessages", "can't do request without login " + rpc); FileLog.e("tmessages", "can't do request without login " + rpc);
return 0; return 0;
} }
...@@ -1752,7 +1753,7 @@ public class ConnectionsManager implements Action.ActionDelegate, TcpConnection. ...@@ -1752,7 +1753,7 @@ public class ConnectionsManager implements Action.ActionDelegate, TcpConnection.
} }
private void registerForPush() { private void registerForPush() {
if (registeringForPush) { if (registeringForPush || !UserConfig.isClientActivated()) {
return; return;
} }
UserConfig.registeredForInternalPush = false; UserConfig.registeredForInternalPush = false;
...@@ -1805,6 +1806,8 @@ public class ConnectionsManager implements Action.ActionDelegate, TcpConnection. ...@@ -1805,6 +1806,8 @@ public class ConnectionsManager implements Action.ActionDelegate, TcpConnection.
UserConfig.saveConfig(false); UserConfig.saveConfig(false);
saveSession(); saveSession();
FileLog.e("tmessages", "registered for internal push"); FileLog.e("tmessages", "registered for internal push");
} else {
UserConfig.registeredForInternalPush = false;
} }
registeringForPush = false; registeringForPush = false;
} }
......
...@@ -64,7 +64,7 @@ public class FileLoader { ...@@ -64,7 +64,7 @@ public class FileLoader {
private long lastProgressUpdateTime = 0; private long lastProgressUpdateTime = 0;
private HashMap<String, Integer> BitmapUseCounts = new HashMap<String, Integer>(); private HashMap<String, Integer> BitmapUseCounts = new HashMap<String, Integer>();
int lastImageNum; private int lastImageNum = 0;
public static final int FileDidUpload = 10000; public static final int FileDidUpload = 10000;
public static final int FileDidFailUpload = 10001; public static final int FileDidFailUpload = 10001;
...@@ -717,15 +717,15 @@ public class FileLoader { ...@@ -717,15 +717,15 @@ public class FileLoader {
}); });
} }
public Bitmap getImageFromMemory(TLRPC.FileLocation url, ImageReceiver imageView, String filter, boolean cancel) { public Bitmap getImageFromMemory(TLRPC.FileLocation url, ImageReceiver imageView, String filter) {
return getImageFromMemory(url, null, imageView, filter, cancel); return getImageFromMemory(url, null, imageView, filter);
} }
public Bitmap getImageFromMemory(String url, ImageReceiver imageView, String filter, boolean cancel) { public Bitmap getImageFromMemory(String url, ImageReceiver imageView, String filter) {
return getImageFromMemory(null, url, imageView, filter, cancel); return getImageFromMemory(null, url, imageView, filter);
} }
public Bitmap getImageFromMemory(TLRPC.FileLocation url, String httpUrl, ImageReceiver imageView, String filter, boolean cancel) { public Bitmap getImageFromMemory(TLRPC.FileLocation url, String httpUrl, ImageReceiver imageView, String filter) {
if (url == null && httpUrl == null) { if (url == null && httpUrl == null) {
return null; return null;
} }
...@@ -739,11 +739,7 @@ public class FileLoader { ...@@ -739,11 +739,7 @@ public class FileLoader {
key += "@" + filter; key += "@" + filter;
} }
Bitmap img = imageFromKey(key); return imageFromKey(key);
if (imageView != null && img != null && cancel) {
cancelLoadingForImageView(imageView);
}
return img;
} }
private void performReplace(String oldKey, String newKey) { private void performReplace(String oldKey, String newKey) {
...@@ -1105,8 +1101,13 @@ public class FileLoader { ...@@ -1105,8 +1101,13 @@ public class FileLoader {
return null; return null;
} }
float scaleFactor = Math.max(photoW / maxWidth, photoH / maxHeight); float scaleFactor = Math.max(photoW / maxWidth, photoH / maxHeight);
int w = (int)(photoW / scaleFactor);
int h = (int)(photoH / scaleFactor);
if (h == 0 || w == 0) {
return null;
}
Bitmap scaledBitmap = Bitmap.createScaledBitmap(bitmap, (int)(photoW / scaleFactor), (int)(photoH / scaleFactor), true); Bitmap scaledBitmap = Bitmap.createScaledBitmap(bitmap, w, h, true);
TLRPC.TL_fileLocation location = new TLRPC.TL_fileLocation(); TLRPC.TL_fileLocation location = new TLRPC.TL_fileLocation();
location.volume_id = Integer.MIN_VALUE; location.volume_id = Integer.MIN_VALUE;
......
...@@ -63,12 +63,12 @@ public class FileLog { ...@@ -63,12 +63,12 @@ public class FileLog {
e.printStackTrace(); e.printStackTrace();
} }
try { try {
logQueue = new DispatchQueue("logQueue");
currentFile.createNewFile(); currentFile.createNewFile();
FileOutputStream stream = new FileOutputStream(currentFile); FileOutputStream stream = new FileOutputStream(currentFile);
streamWriter = new OutputStreamWriter(stream); streamWriter = new OutputStreamWriter(stream);
streamWriter.write("-----start log " + dateFormat.format(System.currentTimeMillis()) + "-----\n"); streamWriter.write("-----start log " + dateFormat.format(System.currentTimeMillis()) + "-----\n");
streamWriter.flush(); streamWriter.flush();
logQueue = new DispatchQueue("logQueue");
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} }
......
...@@ -439,6 +439,7 @@ public class TLClassStore { ...@@ -439,6 +439,7 @@ public class TLClassStore {
classStore.put(TLRPC.TL_decryptedMessageMediaAudio_old.constructor, TLRPC.TL_decryptedMessageMediaAudio_old.class); classStore.put(TLRPC.TL_decryptedMessageMediaAudio_old.constructor, TLRPC.TL_decryptedMessageMediaAudio_old.class);
classStore.put(TLRPC.TL_audio_old.constructor, TLRPC.TL_audio_old.class); classStore.put(TLRPC.TL_audio_old.constructor, TLRPC.TL_audio_old.class);
classStore.put(TLRPC.TL_video_old.constructor, TLRPC.TL_video_old.class); classStore.put(TLRPC.TL_video_old.constructor, TLRPC.TL_video_old.class);
classStore.put(TLRPC.TL_messageActionCreatedBroadcastList.constructor, TLRPC.TL_messageActionCreatedBroadcastList.class);
} }
static TLClassStore store = null; static TLClassStore store = null;
......
...@@ -8996,6 +8996,17 @@ public class TLRPC { ...@@ -8996,6 +8996,17 @@ public class TLRPC {
} }
} }
public static class TL_messageActionCreatedBroadcastList extends MessageAction {
public static int constructor = 0x55555557;
public void readParams(AbsSerializedData stream) {
}
public void serializeToStream(AbsSerializedData stream) {
stream.writeInt32(constructor);
}
}
public static class TL_documentEncrypted extends TL_document { public static class TL_documentEncrypted extends TL_document {
public static int constructor = 0x55555556; public static int constructor = 0x55555556;
......
...@@ -24,6 +24,7 @@ public class UserConfig { ...@@ -24,6 +24,7 @@ public class UserConfig {
public static String pushString = ""; public static String pushString = "";
public static int lastSendMessageId = -210000; public static int lastSendMessageId = -210000;
public static int lastLocalId = -210000; public static int lastLocalId = -210000;
public static int lastBroadcastId = -1;
public static String contactsHash = ""; public static String contactsHash = "";
public static String importHash = ""; public static String importHash = "";
private final static Integer sync = 1; private final static Integer sync = 1;
...@@ -56,6 +57,7 @@ public class UserConfig { ...@@ -56,6 +57,7 @@ public class UserConfig {
editor.putString("importHash", importHash); editor.putString("importHash", importHash);
editor.putBoolean("saveIncomingPhotos", saveIncomingPhotos); editor.putBoolean("saveIncomingPhotos", saveIncomingPhotos);
editor.putInt("contactsVersion", contactsVersion); editor.putInt("contactsVersion", contactsVersion);
editor.putInt("lastBroadcastId", lastBroadcastId);
editor.putBoolean("registeredForInternalPush", registeredForInternalPush); editor.putBoolean("registeredForInternalPush", registeredForInternalPush);
if (currentUser != null) { if (currentUser != null) {
if (withFile) { if (withFile) {
...@@ -174,6 +176,7 @@ public class UserConfig { ...@@ -174,6 +176,7 @@ public class UserConfig {
importHash = preferences.getString("importHash", ""); importHash = preferences.getString("importHash", "");
saveIncomingPhotos = preferences.getBoolean("saveIncomingPhotos", false); saveIncomingPhotos = preferences.getBoolean("saveIncomingPhotos", false);
contactsVersion = preferences.getInt("contactsVersion", 0); contactsVersion = preferences.getInt("contactsVersion", 0);
lastBroadcastId = preferences.getInt("lastBroadcastId", -1);
registeredForInternalPush = preferences.getBoolean("registeredForInternalPush", false); registeredForInternalPush = preferences.getBoolean("registeredForInternalPush", false);
String user = preferences.getString("user", null); String user = preferences.getString("user", null);
if (user != null) { if (user != null) {
...@@ -196,6 +199,7 @@ public class UserConfig { ...@@ -196,6 +199,7 @@ public class UserConfig {
lastLocalId = -210000; lastLocalId = -210000;
lastSendMessageId = -210000; lastSendMessageId = -210000;
contactsVersion = 1; contactsVersion = 1;
lastBroadcastId = -1;
saveIncomingPhotos = false; saveIncomingPhotos = false;
saveConfig(true); saveConfig(true);
} }
......
...@@ -132,6 +132,7 @@ public class Utilities { ...@@ -132,6 +132,7 @@ public class Utilities {
public native static long doPQNative(long _what); public native static long doPQNative(long _what);
public native static void loadBitmap(String path, int[] bitmap, int scale, int format, int width, int height); public native static void loadBitmap(String path, int[] bitmap, int scale, int format, int width, int height);
public native static void blurBitmap(Object bitmap, int width, int height, int stride);
private native static void aesIgeEncryption(ByteBuffer buffer, byte[] key, byte[] iv, boolean encrypt, int offset, int length); private native static void aesIgeEncryption(ByteBuffer buffer, byte[] key, byte[] iv, boolean encrypt, int offset, int length);
public static void aesIgeEncryption(ByteBuffer buffer, byte[] key, byte[] iv, boolean encrypt, boolean changeIv, int offset, int length) { public static void aesIgeEncryption(ByteBuffer buffer, byte[] key, byte[] iv, boolean encrypt, boolean changeIv, int offset, int length) {
...@@ -139,6 +140,9 @@ public class Utilities { ...@@ -139,6 +140,9 @@ public class Utilities {
} }
public static Integer parseInt(String value) { public static Integer parseInt(String value) {
if (value == null) {
return 0;
}
Integer val = 0; Integer val = 0;
try { try {
Matcher matcher = pattern.matcher(value); Matcher matcher = pattern.matcher(value);
...@@ -548,7 +552,7 @@ public class Utilities { ...@@ -548,7 +552,7 @@ public class Utilities {
} }
public static int getGroupAvatarForId(int id) { public static int getGroupAvatarForId(int id) {
return arrGroupsAvatars[getColorIndex(-id)]; return arrGroupsAvatars[getColorIndex(-Math.abs(id))];
} }
public static String MD5(String md5) { public static String MD5(String md5) {
......
...@@ -39,7 +39,6 @@ public class MessageObject { ...@@ -39,7 +39,6 @@ public class MessageObject {
public int contentType; public int contentType;
public ArrayList<PhotoObject> photoThumbs; public ArrayList<PhotoObject> photoThumbs;
public Bitmap imagePreview; public Bitmap imagePreview;
public PhotoObject previewPhoto;
public String dateKey; public String dateKey;
public boolean deleted = false; public boolean deleted = false;
public float audioProgress; public float audioProgress;
...@@ -63,6 +62,10 @@ public class MessageObject { ...@@ -63,6 +62,10 @@ public class MessageObject {
public ArrayList<TextLayoutBlock> textLayoutBlocks; public ArrayList<TextLayoutBlock> textLayoutBlocks;
public MessageObject(TLRPC.Message message, AbstractMap<Integer, TLRPC.User> users) { public MessageObject(TLRPC.Message message, AbstractMap<Integer, TLRPC.User> users) {
this(message, users, 1);
}
public MessageObject(TLRPC.Message message, AbstractMap<Integer, TLRPC.User> users, int preview) {
if (textPaint == null) { if (textPaint == null) {
textPaint = new TextPaint(Paint.ANTI_ALIAS_FLAG); textPaint = new TextPaint(Paint.ANTI_ALIAS_FLAG);
textPaint.setColor(0xff000000); textPaint.setColor(0xff000000);
...@@ -134,10 +137,6 @@ public class MessageObject { ...@@ -134,10 +137,6 @@ public class MessageObject {
messageText = LocaleController.getString("ActionAddUser", R.string.ActionAddUser).replace("un2", "").replace("un1", ""); messageText = LocaleController.getString("ActionAddUser", R.string.ActionAddUser).replace("un2", "").replace("un1", "");
} }
} else if (message.action instanceof TLRPC.TL_messageActionChatEditPhoto) { } else if (message.action instanceof TLRPC.TL_messageActionChatEditPhoto) {
photoThumbs = new ArrayList<PhotoObject>();
for (TLRPC.PhotoSize size : message.action.photo.sizes) {
photoThumbs.add(new PhotoObject(size));
}
if (isFromMe()) { if (isFromMe()) {
messageText = LocaleController.getString("ActionYouChangedPhoto", R.string.ActionYouChangedPhoto); messageText = LocaleController.getString("ActionYouChangedPhoto", R.string.ActionYouChangedPhoto);
} else { } else {
...@@ -232,26 +231,14 @@ public class MessageObject { ...@@ -232,26 +231,14 @@ public class MessageObject {
} }
} }
} }
} else if (message.action instanceof TLRPC.TL_messageActionCreatedBroadcastList) {
messageText = LocaleController.formatString("YouCreatedBroadcastList", R.string.YouCreatedBroadcastList);
} }
} }
} else if (message.media != null && !(message.media instanceof TLRPC.TL_messageMediaEmpty)) { } else if (message.media != null && !(message.media instanceof TLRPC.TL_messageMediaEmpty)) {
if (message.media instanceof TLRPC.TL_messageMediaPhoto) { if (message.media instanceof TLRPC.TL_messageMediaPhoto) {
photoThumbs = new ArrayList<PhotoObject>();
for (TLRPC.PhotoSize size : message.media.photo.sizes) {
PhotoObject obj = new PhotoObject(size);
photoThumbs.add(obj);
if (imagePreview == null && obj.image != null) {
imagePreview = obj.image;
}
}
messageText = LocaleController.getString("AttachPhoto", R.string.AttachPhoto); messageText = LocaleController.getString("AttachPhoto", R.string.AttachPhoto);
} else if (message.media instanceof TLRPC.TL_messageMediaVideo) { } else if (message.media instanceof TLRPC.TL_messageMediaVideo) {
photoThumbs = new ArrayList<PhotoObject>();
PhotoObject obj = new PhotoObject(message.media.video.thumb);
photoThumbs.add(obj);
if (imagePreview == null && obj.image != null) {
imagePreview = obj.image;
}
messageText = LocaleController.getString("AttachVideo", R.string.AttachVideo); messageText = LocaleController.getString("AttachVideo", R.string.AttachVideo);
} else if (message.media instanceof TLRPC.TL_messageMediaGeo) { } else if (message.media instanceof TLRPC.TL_messageMediaGeo) {
messageText = LocaleController.getString("AttachLocation", R.string.AttachLocation); messageText = LocaleController.getString("AttachLocation", R.string.AttachLocation);
...@@ -260,11 +247,6 @@ public class MessageObject { ...@@ -260,11 +247,6 @@ public class MessageObject {
} else if (message.media instanceof TLRPC.TL_messageMediaUnsupported) { } else if (message.media instanceof TLRPC.TL_messageMediaUnsupported) {
messageText = LocaleController.getString("UnsuppotedMedia", R.string.UnsuppotedMedia); messageText = LocaleController.getString("UnsuppotedMedia", R.string.UnsuppotedMedia);
} else if (message.media instanceof TLRPC.TL_messageMediaDocument) { } else if (message.media instanceof TLRPC.TL_messageMediaDocument) {
if (!(message.media.document.thumb instanceof TLRPC.TL_photoSizeEmpty)) {
photoThumbs = new ArrayList<PhotoObject>();
PhotoObject obj = new PhotoObject(message.media.document.thumb);
photoThumbs.add(obj);
}
messageText = LocaleController.getString("AttachDocument", R.string.AttachDocument); messageText = LocaleController.getString("AttachDocument", R.string.AttachDocument);
} else if (message.media instanceof TLRPC.TL_messageMediaAudio) { } else if (message.media instanceof TLRPC.TL_messageMediaAudio) {
messageText = LocaleController.getString("AttachAudio", R.string.AttachAudio); messageText = LocaleController.getString("AttachAudio", R.string.AttachAudio);
...@@ -329,6 +311,80 @@ public class MessageObject { ...@@ -329,6 +311,80 @@ public class MessageObject {
dateKey = String.format("%d_%02d_%02d", dateYear, dateMonth, dateDay); dateKey = String.format("%d_%02d_%02d", dateYear, dateMonth, dateDay);
generateLayout(); generateLayout();
generateThumbs(false, preview);
}
public void generateThumbs(boolean update, int preview) {
if (messageOwner instanceof TLRPC.TL_messageService) {
if (messageOwner.action instanceof TLRPC.TL_messageActionChatEditPhoto) {
if (!update) {
photoThumbs = new ArrayList<PhotoObject>();
for (TLRPC.PhotoSize size : messageOwner.action.photo.sizes) {
photoThumbs.add(new PhotoObject(size, preview));
}
} else if (photoThumbs != null && !photoThumbs.isEmpty()) {
for (PhotoObject photoObject : photoThumbs) {
for (TLRPC.PhotoSize size : messageOwner.action.photo.sizes) {
if (size instanceof TLRPC.TL_photoSizeEmpty) {
continue;
}
if (size.type.equals(photoObject.photoOwner.type)) {
photoObject.photoOwner.location = size.location;
break;
}
}
}
}
}
} else if (messageOwner.media != null && !(messageOwner.media instanceof TLRPC.TL_messageMediaEmpty)) {
if (messageOwner.media instanceof TLRPC.TL_messageMediaPhoto) {
if (!update) {
photoThumbs = new ArrayList<PhotoObject>();
for (TLRPC.PhotoSize size : messageOwner.media.photo.sizes) {
PhotoObject obj = new PhotoObject(size, preview);
photoThumbs.add(obj);
if (imagePreview == null && obj.image != null) {
imagePreview = obj.image;
}
}
} else if (photoThumbs != null && !photoThumbs.isEmpty()) {
for (PhotoObject photoObject : photoThumbs) {
for (TLRPC.PhotoSize size : messageOwner.media.photo.sizes) {
if (size instanceof TLRPC.TL_photoSizeEmpty) {
continue;
}
if (size.type.equals(photoObject.photoOwner.type)) {
photoObject.photoOwner.location = size.location;
break;
}
}
}
}
} else if (messageOwner.media instanceof TLRPC.TL_messageMediaVideo) {
if (!update) {
photoThumbs = new ArrayList<PhotoObject>();
PhotoObject obj = new PhotoObject(messageOwner.media.video.thumb, preview);
photoThumbs.add(obj);
if (imagePreview == null && obj.image != null) {
imagePreview = obj.image;
}
} else if (photoThumbs != null && !photoThumbs.isEmpty() && messageOwner.media.video.thumb != null) {
PhotoObject photoObject = photoThumbs.get(0);
photoObject.photoOwner.location = messageOwner.media.video.thumb.location;
}
} if (messageOwner.media instanceof TLRPC.TL_messageMediaDocument) {
if (!(messageOwner.media.document.thumb instanceof TLRPC.TL_photoSizeEmpty)) {
if (!update) {
photoThumbs = new ArrayList<PhotoObject>();
PhotoObject obj = new PhotoObject(messageOwner.media.document.thumb, preview);
photoThumbs.add(obj);
} else if (photoThumbs != null && !photoThumbs.isEmpty() && messageOwner.media.document.thumb != null) {
PhotoObject photoObject = photoThumbs.get(0);
photoObject.photoOwner.location = messageOwner.media.document.thumb.location;
}
}
}
}
} }
public String getFileName() { public String getFileName() {
......
...@@ -13,6 +13,7 @@ import android.graphics.BitmapFactory; ...@@ -13,6 +13,7 @@ import android.graphics.BitmapFactory;
import org.telegram.messenger.TLRPC; import org.telegram.messenger.TLRPC;
import org.telegram.messenger.FileLoader; import org.telegram.messenger.FileLoader;
import org.telegram.messenger.Utilities;
import java.util.ArrayList; import java.util.ArrayList;
...@@ -20,21 +21,26 @@ public class PhotoObject { ...@@ -20,21 +21,26 @@ public class PhotoObject {
public TLRPC.PhotoSize photoOwner; public TLRPC.PhotoSize photoOwner;
public Bitmap image; public Bitmap image;
public PhotoObject(TLRPC.PhotoSize photo) { public PhotoObject(TLRPC.PhotoSize photo, int preview) {
photoOwner = photo; photoOwner = photo;
if (photo instanceof TLRPC.TL_photoCachedSize) { if (preview != 0 && photo instanceof TLRPC.TL_photoCachedSize) {
BitmapFactory.Options opts = new BitmapFactory.Options(); BitmapFactory.Options opts = new BitmapFactory.Options();
opts.inPreferredConfig = Bitmap.Config.RGB_565; opts.inPreferredConfig = Bitmap.Config.ARGB_8888;
opts.inDither = false; opts.inDither = false;
opts.outWidth = photo.w; opts.outWidth = photo.w;
opts.outHeight = photo.h; opts.outHeight = photo.h;
image = BitmapFactory.decodeByteArray(photoOwner.bytes, 0, photoOwner.bytes.length, opts); image = BitmapFactory.decodeByteArray(photoOwner.bytes, 0, photoOwner.bytes.length, opts);
if (image != null && FileLoader.getInstance().runtimeHack != null) { if (image != null) {
if (preview == 2) {
Utilities.blurBitmap(image, image.getWidth(), image.getHeight(), image.getRowBytes());
}
if (FileLoader.getInstance().runtimeHack != null) {
FileLoader.getInstance().runtimeHack.trackFree(image.getRowBytes() * image.getHeight()); FileLoader.getInstance().runtimeHack.trackFree(image.getRowBytes() * image.getHeight());
} }
} }
} }
}
public static PhotoObject getClosestImageWithSize(ArrayList<PhotoObject> arr, int width, int height) { public static PhotoObject getClosestImageWithSize(ArrayList<PhotoObject> arr, int width, int height) {
if (arr == null) { if (arr == null) {
......
...@@ -8,7 +8,6 @@ ...@@ -8,7 +8,6 @@
package org.telegram.ui; package org.telegram.ui;
import android.app.Activity;
import android.app.AlarmManager; import android.app.AlarmManager;
import android.app.Application; import android.app.Application;
import android.app.PendingIntent; import android.app.PendingIntent;
...@@ -93,34 +92,6 @@ public class ApplicationLoader extends Application { ...@@ -93,34 +92,6 @@ public class ApplicationLoader extends Application {
UserConfig.loadConfig(); UserConfig.loadConfig();
if (UserConfig.getCurrentUser() != null) { if (UserConfig.getCurrentUser() != null) {
boolean changed = false;
SharedPreferences preferences = applicationContext.getSharedPreferences("Notifications", MODE_PRIVATE);
int v = preferences.getInt("v", 0);
if (v != 1) {
SharedPreferences preferences2 = ApplicationLoader.applicationContext.getSharedPreferences("mainconfig", Activity.MODE_PRIVATE);
SharedPreferences.Editor editor = preferences2.edit();
if (preferences.contains("view_animations")) {
editor.putBoolean("view_animations", preferences.getBoolean("view_animations", false));
}
if (preferences.contains("selectedBackground")) {
editor.putInt("selectedBackground", preferences.getInt("selectedBackground", 1000001));
}
if (preferences.contains("selectedColor")) {
editor.putInt("selectedColor", preferences.getInt("selectedColor", 0));
}
if (preferences.contains("fons_size")) {
editor.putInt("fons_size", preferences.getInt("fons_size", 16));
}
editor.commit();
editor = preferences.edit();
editor.putInt("v", 1);
editor.remove("view_animations");
editor.remove("selectedBackground");
editor.remove("selectedColor");
editor.remove("fons_size");
editor.commit();
}
MessagesController.getInstance().users.put(UserConfig.getClientUserId(), UserConfig.getCurrentUser()); MessagesController.getInstance().users.put(UserConfig.getClientUserId(), UserConfig.getCurrentUser());
ConnectionsManager.getInstance().applyCountryPortNumber(UserConfig.getCurrentUser().phone); ConnectionsManager.getInstance().applyCountryPortNumber(UserConfig.getCurrentUser().phone);
ConnectionsManager.getInstance().initPushConnection(); ConnectionsManager.getInstance().initPushConnection();
......
...@@ -60,9 +60,11 @@ public class ChatBaseCell extends BaseCell { ...@@ -60,9 +60,11 @@ public class ChatBaseCell extends BaseCell {
private static Drawable checkDrawable; private static Drawable checkDrawable;
private static Drawable halfCheckDrawable; private static Drawable halfCheckDrawable;
private static Drawable clockDrawable; private static Drawable clockDrawable;
private static Drawable broadcastDrawable;
private static Drawable checkMediaDrawable; private static Drawable checkMediaDrawable;
private static Drawable halfCheckMediaDrawable; private static Drawable halfCheckMediaDrawable;
private static Drawable clockMediaDrawable; private static Drawable clockMediaDrawable;
private static Drawable broadcastMediaDrawable;
private static Drawable errorDrawable; private static Drawable errorDrawable;
protected static Drawable mediaBackgroundDrawable; protected static Drawable mediaBackgroundDrawable;
private static TextPaint timePaintIn; private static TextPaint timePaintIn;
...@@ -177,6 +179,8 @@ public class ChatBaseCell extends BaseCell { ...@@ -177,6 +179,8 @@ public class ChatBaseCell extends BaseCell {
clockMediaDrawable = getResources().getDrawable(R.drawable.msg_clock_photo); clockMediaDrawable = getResources().getDrawable(R.drawable.msg_clock_photo);
errorDrawable = getResources().getDrawable(R.drawable.msg_warning); errorDrawable = getResources().getDrawable(R.drawable.msg_warning);
mediaBackgroundDrawable = getResources().getDrawable(R.drawable.phototime); mediaBackgroundDrawable = getResources().getDrawable(R.drawable.phototime);
broadcastDrawable = getResources().getDrawable(R.drawable.broadcast3);
broadcastMediaDrawable = getResources().getDrawable(R.drawable.broadcast4);
timePaintIn = new TextPaint(TextPaint.ANTI_ALIAS_FLAG); timePaintIn = new TextPaint(TextPaint.ANTI_ALIAS_FLAG);
timePaintIn.setTextSize(AndroidUtilities.dp(12)); timePaintIn.setTextSize(AndroidUtilities.dp(12));
...@@ -569,6 +573,7 @@ public class ChatBaseCell extends BaseCell { ...@@ -569,6 +573,7 @@ public class ChatBaseCell extends BaseCell {
boolean drawCheck2 = false; boolean drawCheck2 = false;
boolean drawClock = false; boolean drawClock = false;
boolean drawError = false; boolean drawError = false;
boolean isBroadcast = (int)(currentMessageObject.getDialogId() >> 32) == 1;
if (currentMessageObject.messageOwner.send_state == MessagesController.MESSAGE_SEND_STATE_SENDING) { if (currentMessageObject.messageOwner.send_state == MessagesController.MESSAGE_SEND_STATE_SENDING) {
drawCheck1 = false; drawCheck1 = false;
...@@ -601,6 +606,17 @@ public class ChatBaseCell extends BaseCell { ...@@ -601,6 +606,17 @@ public class ChatBaseCell extends BaseCell {
clockMediaDrawable.draw(canvas); clockMediaDrawable.draw(canvas);
} }
} }
if (isBroadcast) {
if (drawCheck1 || drawCheck2) {
if (!media) {
setDrawableBounds(broadcastDrawable, layoutWidth - AndroidUtilities.dpf(20.5f) - broadcastDrawable.getIntrinsicWidth(), layoutHeight - AndroidUtilities.dpf(8.0f) - broadcastDrawable.getIntrinsicHeight());
broadcastDrawable.draw(canvas);
} else {
setDrawableBounds(broadcastMediaDrawable, layoutWidth - AndroidUtilities.dpf(24.0f) - broadcastMediaDrawable.getIntrinsicWidth(), layoutHeight - AndroidUtilities.dpf(13.0f) - broadcastMediaDrawable.getIntrinsicHeight());
broadcastMediaDrawable.draw(canvas);
}
}
} else {
if (drawCheck2) { if (drawCheck2) {
if (!media) { if (!media) {
if (drawCheck1) { if (drawCheck1) {
...@@ -627,6 +643,7 @@ public class ChatBaseCell extends BaseCell { ...@@ -627,6 +643,7 @@ public class ChatBaseCell extends BaseCell {
halfCheckMediaDrawable.draw(canvas); halfCheckMediaDrawable.draw(canvas);
} }
} }
}
if (drawError) { if (drawError) {
if (!media) { if (!media) {
setDrawableBounds(errorDrawable, layoutWidth - AndroidUtilities.dp(18) - errorDrawable.getIntrinsicWidth(), layoutHeight - AndroidUtilities.dpf(6.5f) - errorDrawable.getIntrinsicHeight()); setDrawableBounds(errorDrawable, layoutWidth - AndroidUtilities.dp(18) - errorDrawable.getIntrinsicWidth(), layoutHeight - AndroidUtilities.dpf(6.5f) - errorDrawable.getIntrinsicHeight());
......
...@@ -31,7 +31,7 @@ import org.telegram.objects.PhotoObject; ...@@ -31,7 +31,7 @@ import org.telegram.objects.PhotoObject;
import org.telegram.ui.PhotoViewer; import org.telegram.ui.PhotoViewer;
import org.telegram.ui.Views.GifDrawable; import org.telegram.ui.Views.GifDrawable;
import org.telegram.ui.Views.ImageReceiver; import org.telegram.ui.Views.ImageReceiver;
import org.telegram.ui.Views.ProgressView; import org.telegram.ui.Views.RoundProgressView;
import java.io.File; import java.io.File;
import java.util.Locale; import java.util.Locale;
...@@ -45,7 +45,7 @@ public class ChatMediaCell extends ChatBaseCell implements MediaController.FileD ...@@ -45,7 +45,7 @@ public class ChatMediaCell extends ChatBaseCell implements MediaController.FileD
private static Drawable placeholderInDrawable; private static Drawable placeholderInDrawable;
private static Drawable placeholderOutDrawable; private static Drawable placeholderOutDrawable;
private static Drawable videoIconDrawable; private static Drawable videoIconDrawable;
private static Drawable[][] buttonStatesDrawables = new Drawable[4][2]; private static Drawable[] buttonStatesDrawables = new Drawable[4];
private static TextPaint infoPaint; private static TextPaint infoPaint;
private static MessageObject lastDownloadedGifMessage = null; private static MessageObject lastDownloadedGifMessage = null;
...@@ -57,10 +57,11 @@ public class ChatMediaCell extends ChatBaseCell implements MediaController.FileD ...@@ -57,10 +57,11 @@ public class ChatMediaCell extends ChatBaseCell implements MediaController.FileD
private String currentUrl; private String currentUrl;
private String currentPhotoFilter; private String currentPhotoFilter;
private ImageReceiver photoImage; private ImageReceiver photoImage;
private ProgressView progressView; private RoundProgressView progressView;
public int downloadPhotos = 0; public int downloadPhotos = 0;
private boolean progressVisible = false; private boolean progressVisible = false;
private boolean photoNotSet = false; private boolean photoNotSet = false;
private boolean cancelLoading = false;
private int TAG; private int TAG;
...@@ -83,14 +84,10 @@ public class ChatMediaCell extends ChatBaseCell implements MediaController.FileD ...@@ -83,14 +84,10 @@ public class ChatMediaCell extends ChatBaseCell implements MediaController.FileD
if (placeholderInDrawable == null) { if (placeholderInDrawable == null) {
placeholderInDrawable = getResources().getDrawable(R.drawable.photo_placeholder_in); placeholderInDrawable = getResources().getDrawable(R.drawable.photo_placeholder_in);
placeholderOutDrawable = getResources().getDrawable(R.drawable.photo_placeholder_out); placeholderOutDrawable = getResources().getDrawable(R.drawable.photo_placeholder_out);
buttonStatesDrawables[0][0] = getResources().getDrawable(R.drawable.photoload); buttonStatesDrawables[0] = getResources().getDrawable(R.drawable.photoload);
buttonStatesDrawables[0][1] = getResources().getDrawable(R.drawable.photoload_pressed); buttonStatesDrawables[1] = getResources().getDrawable(R.drawable.photocancel);
buttonStatesDrawables[1][0] = getResources().getDrawable(R.drawable.photocancel); buttonStatesDrawables[2] = getResources().getDrawable(R.drawable.photogif);
buttonStatesDrawables[1][1] = getResources().getDrawable(R.drawable.photocancel_pressed); buttonStatesDrawables[3] = getResources().getDrawable(R.drawable.playvideo);
buttonStatesDrawables[2][0] = getResources().getDrawable(R.drawable.photogif);
buttonStatesDrawables[2][1] = getResources().getDrawable(R.drawable.photogif_pressed);
buttonStatesDrawables[3][0] = getResources().getDrawable(R.drawable.playvideo);
buttonStatesDrawables[3][1] = getResources().getDrawable(R.drawable.playvideo_pressed);
videoIconDrawable = getResources().getDrawable(R.drawable.ic_video); videoIconDrawable = getResources().getDrawable(R.drawable.ic_video);
infoPaint = new TextPaint(Paint.ANTI_ALIAS_FLAG); infoPaint = new TextPaint(Paint.ANTI_ALIAS_FLAG);
...@@ -102,8 +99,7 @@ public class ChatMediaCell extends ChatBaseCell implements MediaController.FileD ...@@ -102,8 +99,7 @@ public class ChatMediaCell extends ChatBaseCell implements MediaController.FileD
photoImage = new ImageReceiver(); photoImage = new ImageReceiver();
photoImage.parentView = this; photoImage.parentView = this;
progressView = new ProgressView(); progressView = new RoundProgressView();
progressView.setProgressColors(0x802a2a2a, 0xffffffff);
} }
public void clearGifImage() { public void clearGifImage() {
...@@ -225,6 +221,7 @@ public class ChatMediaCell extends ChatBaseCell implements MediaController.FileD ...@@ -225,6 +221,7 @@ public class ChatMediaCell extends ChatBaseCell implements MediaController.FileD
private void didPressedButton() { private void didPressedButton() {
if (buttonState == 0) { if (buttonState == 0) {
cancelLoading = false;
if (currentMessageObject.type == 1) { if (currentMessageObject.type == 1) {
if (currentMessageObject.imagePreview != null) { if (currentMessageObject.imagePreview != null) {
photoImage.setImage(currentPhotoObject.photoOwner.location, currentPhotoFilter, new BitmapDrawable(currentMessageObject.imagePreview), currentPhotoObject.photoOwner.size); photoImage.setImage(currentPhotoObject.photoOwner.location, currentPhotoFilter, new BitmapDrawable(currentMessageObject.imagePreview), currentPhotoObject.photoOwner.size);
...@@ -246,6 +243,7 @@ public class ChatMediaCell extends ChatBaseCell implements MediaController.FileD ...@@ -246,6 +243,7 @@ public class ChatMediaCell extends ChatBaseCell implements MediaController.FileD
delegate.didPressedCancelSendButton(this); delegate.didPressedCancelSendButton(this);
} }
} else { } else {
cancelLoading = true;
if (currentMessageObject.type == 1) { if (currentMessageObject.type == 1) {
FileLoader.getInstance().cancelLoadingForImageView(photoImage); FileLoader.getInstance().cancelLoadingForImageView(photoImage);
} else if (currentMessageObject.type == 8) { } else if (currentMessageObject.type == 8) {
...@@ -304,6 +302,7 @@ public class ChatMediaCell extends ChatBaseCell implements MediaController.FileD ...@@ -304,6 +302,7 @@ public class ChatMediaCell extends ChatBaseCell implements MediaController.FileD
public void setMessageObject(MessageObject messageObject) { public void setMessageObject(MessageObject messageObject) {
if (currentMessageObject != messageObject || isPhotoDataChanged(messageObject) || isUserDataChanged()) { if (currentMessageObject != messageObject || isPhotoDataChanged(messageObject) || isUserDataChanged()) {
super.setMessageObject(messageObject); super.setMessageObject(messageObject);
cancelLoading = false;
progressVisible = false; progressVisible = false;
buttonState = -1; buttonState = -1;
...@@ -395,6 +394,9 @@ public class ChatMediaCell extends ChatBaseCell implements MediaController.FileD ...@@ -395,6 +394,9 @@ public class ChatMediaCell extends ChatBaseCell implements MediaController.FileD
photoHeight = h; photoHeight = h;
backgroundWidth = w + AndroidUtilities.dp(12); backgroundWidth = w + AndroidUtilities.dp(12);
currentPhotoFilter = String.format(Locale.US, "%d_%d", (int) (w / AndroidUtilities.density), (int) (h / AndroidUtilities.density)); currentPhotoFilter = String.format(Locale.US, "%d_%d", (int) (w / AndroidUtilities.density), (int) (h / AndroidUtilities.density));
if (messageObject.photoThumbs.size() > 1 || messageObject.type == 3 || messageObject.type == 8) {
currentPhotoFilter += "_b";
}
if (currentPhotoObject.image != null) { if (currentPhotoObject.image != null) {
photoImage.setImageBitmap(currentPhotoObject.image); photoImage.setImageBitmap(currentPhotoObject.image);
...@@ -485,20 +487,16 @@ public class ChatMediaCell extends ChatBaseCell implements MediaController.FileD ...@@ -485,20 +487,16 @@ public class ChatMediaCell extends ChatBaseCell implements MediaController.FileD
if (!cacheFile.exists()) { if (!cacheFile.exists()) {
MediaController.getInstance().addLoadingFileObserver(fileName, this); MediaController.getInstance().addLoadingFileObserver(fileName, this);
if (!FileLoader.getInstance().isLoadingFile(fileName)) { if (!FileLoader.getInstance().isLoadingFile(fileName)) {
if (currentMessageObject.type != 1 || downloadPhotos == 1 || downloadPhotos == 2 && !ConnectionsManager.isConnectedToWiFi()) { if (cancelLoading || currentMessageObject.type != 1 || downloadPhotos == 1 || downloadPhotos == 2 && !ConnectionsManager.isConnectedToWiFi()) {
buttonState = 0; buttonState = 0;
progressVisible = false; progressVisible = false;
} else { } else {
buttonState = -1; buttonState = 1;
progressVisible = true; progressVisible = true;
} }
progressView.setProgress(0); progressView.setProgress(0);
} else { } else {
if (currentMessageObject.type != 1 || downloadPhotos == 1 || downloadPhotos == 2 && !ConnectionsManager.isConnectedToWiFi()) {
buttonState = 1; buttonState = 1;
} else {
buttonState = -1;
}
progressVisible = true; progressVisible = true;
Float progress = FileLoader.getInstance().fileProgresses.get(fileName); Float progress = FileLoader.getInstance().fileProgresses.get(fileName);
if (progress != null) { if (progress != null) {
...@@ -544,13 +542,10 @@ public class ChatMediaCell extends ChatBaseCell implements MediaController.FileD ...@@ -544,13 +542,10 @@ public class ChatMediaCell extends ChatBaseCell implements MediaController.FileD
photoImage.imageW = photoWidth; photoImage.imageW = photoWidth;
photoImage.imageH = photoHeight; photoImage.imageH = photoHeight;
progressView.width = timeX - photoImage.imageX - AndroidUtilities.dpf(23.0f);
progressView.height = AndroidUtilities.dp(3);
progressView.progressHeight = AndroidUtilities.dp(3);
int size = AndroidUtilities.dp(44); int size = AndroidUtilities.dp(44);
buttonX = (int)(photoImage.imageX + (photoWidth - size) / 2.0f); buttonX = (int)(photoImage.imageX + (photoWidth - size) / 2.0f);
buttonY = (int)(photoImage.imageY + (photoHeight - size) / 2.0f); buttonY = (int)(photoImage.imageY + (photoHeight - size) / 2.0f);
progressView.rect.set(buttonX + AndroidUtilities.dp(2), buttonY + AndroidUtilities.dp(2), buttonX + AndroidUtilities.dp(42), buttonY + AndroidUtilities.dp(42));
} }
@Override @Override
...@@ -566,22 +561,16 @@ public class ChatMediaCell extends ChatBaseCell implements MediaController.FileD ...@@ -566,22 +561,16 @@ public class ChatMediaCell extends ChatBaseCell implements MediaController.FileD
drawTime = photoImage.getVisible(); drawTime = photoImage.getVisible();
} }
if (progressVisible) {
setDrawableBounds(mediaBackgroundDrawable, photoImage.imageX + AndroidUtilities.dp(4), layoutHeight - AndroidUtilities.dpf(27.5f), progressView.width + AndroidUtilities.dp(12), AndroidUtilities.dpf(16.5f));
mediaBackgroundDrawable.draw(canvas);
canvas.save();
canvas.translate(photoImage.imageX + AndroidUtilities.dp(10), layoutHeight - AndroidUtilities.dpf(21.0f));
progressView.draw(canvas);
canvas.restore();
}
if (buttonState >= 0 && buttonState < 4) { if (buttonState >= 0 && buttonState < 4) {
Drawable currentButtonDrawable = buttonStatesDrawables[buttonState][buttonPressed]; Drawable currentButtonDrawable = buttonStatesDrawables[buttonState];
setDrawableBounds(currentButtonDrawable, buttonX, buttonY); setDrawableBounds(currentButtonDrawable, buttonX, buttonY);
currentButtonDrawable.draw(canvas); currentButtonDrawable.draw(canvas);
} }
if (progressVisible) {
progressView.draw(canvas);
}
if (infoLayout != null && (buttonState == 1 || buttonState == 0 || buttonState == 3)) { if (infoLayout != null && (buttonState == 1 || buttonState == 0 || buttonState == 3)) {
setDrawableBounds(mediaBackgroundDrawable, photoImage.imageX + AndroidUtilities.dp(4), photoImage.imageY + AndroidUtilities.dp(4), infoWidth + AndroidUtilities.dp(8) + infoOffset, AndroidUtilities.dpf(16.5f)); setDrawableBounds(mediaBackgroundDrawable, photoImage.imageX + AndroidUtilities.dp(4), photoImage.imageY + AndroidUtilities.dp(4), infoWidth + AndroidUtilities.dp(8) + infoOffset, AndroidUtilities.dpf(16.5f));
mediaBackgroundDrawable.draw(canvas); mediaBackgroundDrawable.draw(canvas);
......
...@@ -35,6 +35,8 @@ public class ChatOrUserCell extends BaseCell { ...@@ -35,6 +35,8 @@ public class ChatOrUserCell extends BaseCell {
private static TextPaint offlinePaint; private static TextPaint offlinePaint;
private static Drawable lockDrawable; private static Drawable lockDrawable;
private static Drawable broadcastDrawable;
private static Drawable groupDrawable;
private static Paint linePaint; private static Paint linePaint;
private CharSequence currentName; private CharSequence currentName;
...@@ -93,6 +95,14 @@ public class ChatOrUserCell extends BaseCell { ...@@ -93,6 +95,14 @@ public class ChatOrUserCell extends BaseCell {
linePaint.setColor(0xffdcdcdc); linePaint.setColor(0xffdcdcdc);
} }
if (broadcastDrawable == null) {
broadcastDrawable = getResources().getDrawable(R.drawable.broadcast);
}
if (groupDrawable == null) {
groupDrawable = getResources().getDrawable(R.drawable.grouplist);
}
if (avatarImage == null) { if (avatarImage == null) {
avatarImage = new ImageReceiver(); avatarImage = new ImageReceiver();
avatarImage.parentView = this; avatarImage.parentView = this;
...@@ -230,6 +240,12 @@ public class ChatOrUserCell extends BaseCell { ...@@ -230,6 +240,12 @@ public class ChatOrUserCell extends BaseCell {
if (cellLayout.drawNameLock) { if (cellLayout.drawNameLock) {
setDrawableBounds(lockDrawable, cellLayout.nameLockLeft, cellLayout.nameLockTop); setDrawableBounds(lockDrawable, cellLayout.nameLockLeft, cellLayout.nameLockTop);
lockDrawable.draw(canvas); lockDrawable.draw(canvas);
} else if (cellLayout.drawNameGroup) {
setDrawableBounds(groupDrawable, cellLayout.nameLockLeft, cellLayout.nameLockTop);
groupDrawable.draw(canvas);
} else if (cellLayout.drawNameBroadcast) {
setDrawableBounds(broadcastDrawable, cellLayout.nameLockLeft, cellLayout.nameLockTop);
broadcastDrawable.draw(canvas);
} }
canvas.save(); canvas.save();
...@@ -262,8 +278,10 @@ public class ChatOrUserCell extends BaseCell { ...@@ -262,8 +278,10 @@ public class ChatOrUserCell extends BaseCell {
private int nameWidth; private int nameWidth;
private StaticLayout nameLayout; private StaticLayout nameLayout;
private boolean drawNameLock; private boolean drawNameLock;
private boolean drawNameBroadcast;
private boolean drawNameGroup;
private int nameLockLeft; private int nameLockLeft;
private int nameLockTop = AndroidUtilities.dp(15); private int nameLockTop;
private int onlineLeft; private int onlineLeft;
private int onlineTop = AndroidUtilities.dp(36); private int onlineTop = AndroidUtilities.dp(36);
...@@ -277,6 +295,10 @@ public class ChatOrUserCell extends BaseCell { ...@@ -277,6 +295,10 @@ public class ChatOrUserCell extends BaseCell {
CharSequence nameString = ""; CharSequence nameString = "";
TextPaint currentNamePaint; TextPaint currentNamePaint;
drawNameBroadcast = false;
drawNameLock = false;
drawNameGroup = false;
if (encryptedChat != null) { if (encryptedChat != null) {
drawNameLock = true; drawNameLock = true;
if (!LocaleController.isRTL) { if (!LocaleController.isRTL) {
...@@ -286,14 +308,30 @@ public class ChatOrUserCell extends BaseCell { ...@@ -286,14 +308,30 @@ public class ChatOrUserCell extends BaseCell {
nameLockLeft = width - AndroidUtilities.dp(63 + (usePadding ? 11 : 0)) - lockDrawable.getIntrinsicWidth(); nameLockLeft = width - AndroidUtilities.dp(63 + (usePadding ? 11 : 0)) - lockDrawable.getIntrinsicWidth();
nameLeft = usePadding ? AndroidUtilities.dp(11) : 0; nameLeft = usePadding ? AndroidUtilities.dp(11) : 0;
} }
nameLockTop = AndroidUtilities.dp(15);
} else {
if (chat != null) {
nameLockTop = AndroidUtilities.dp(26);
if (chat.id < 0) {
drawNameBroadcast = true;
} else {
drawNameGroup = true;
}
if (!LocaleController.isRTL) {
nameLockLeft = AndroidUtilities.dp(61 + (usePadding ? 11 : 0));
nameLeft = AndroidUtilities.dp(65 + (usePadding ? 11 : 0)) + (drawNameGroup ? groupDrawable.getIntrinsicWidth() : broadcastDrawable.getIntrinsicWidth());
} else {
nameLockLeft = width - AndroidUtilities.dp(63 + (usePadding ? 11 : 0)) - (drawNameGroup ? groupDrawable.getIntrinsicWidth() : broadcastDrawable.getIntrinsicWidth());
nameLeft = usePadding ? AndroidUtilities.dp(11) : 0;
}
} else { } else {
drawNameLock = false;
if (!LocaleController.isRTL) { if (!LocaleController.isRTL) {
nameLeft = AndroidUtilities.dp(61 + (usePadding ? 11 : 0)); nameLeft = AndroidUtilities.dp(61 + (usePadding ? 11 : 0));
} else { } else {
nameLeft = usePadding ? AndroidUtilities.dp(11) : 0; nameLeft = usePadding ? AndroidUtilities.dp(11) : 0;
} }
} }
}
if (currentName != null) { if (currentName != null) {
nameString = currentName; nameString = currentName;
...@@ -326,6 +364,8 @@ public class ChatOrUserCell extends BaseCell { ...@@ -326,6 +364,8 @@ public class ChatOrUserCell extends BaseCell {
} }
if (drawNameLock) { if (drawNameLock) {
nameWidth -= AndroidUtilities.dp(6) + lockDrawable.getIntrinsicWidth(); nameWidth -= AndroidUtilities.dp(6) + lockDrawable.getIntrinsicWidth();
} else if (drawNameBroadcast) {
nameWidth -= AndroidUtilities.dp(6) + broadcastDrawable.getIntrinsicWidth();
} }
CharSequence nameStringFinal = TextUtils.ellipsize(nameString, currentNamePaint, nameWidth - AndroidUtilities.dp(12), TextUtils.TruncateAt.END); CharSequence nameStringFinal = TextUtils.ellipsize(nameString, currentNamePaint, nameWidth - AndroidUtilities.dp(12), TextUtils.TruncateAt.END);
......
...@@ -46,6 +46,7 @@ public class DialogCell extends BaseCell { ...@@ -46,6 +46,7 @@ public class DialogCell extends BaseCell {
private static Drawable lockDrawable; private static Drawable lockDrawable;
private static Drawable countDrawable; private static Drawable countDrawable;
private static Drawable groupDrawable; private static Drawable groupDrawable;
private static Drawable broadcastDrawable;
private TLRPC.TL_dialog currentDialog; private TLRPC.TL_dialog currentDialog;
private ImageReceiver avatarImage; private ImageReceiver avatarImage;
...@@ -130,6 +131,10 @@ public class DialogCell extends BaseCell { ...@@ -130,6 +131,10 @@ public class DialogCell extends BaseCell {
groupDrawable = getResources().getDrawable(R.drawable.grouplist); groupDrawable = getResources().getDrawable(R.drawable.grouplist);
} }
if (broadcastDrawable == null) {
broadcastDrawable = getResources().getDrawable(R.drawable.broadcast);
}
if (avatarImage == null) { if (avatarImage == null) {
avatarImage = new ImageReceiver(); avatarImage = new ImageReceiver();
avatarImage.parentView = this; avatarImage.parentView = this;
...@@ -220,14 +225,19 @@ public class DialogCell extends BaseCell { ...@@ -220,14 +225,19 @@ public class DialogCell extends BaseCell {
encryptedChat = null; encryptedChat = null;
int lower_id = (int)currentDialog.id; int lower_id = (int)currentDialog.id;
int high_id = (int)(currentDialog.id >> 32);
if (lower_id != 0) { if (lower_id != 0) {
if (high_id == 1) {
chat = MessagesController.getInstance().chats.get(lower_id);
} else {
if (lower_id < 0) { if (lower_id < 0) {
chat = MessagesController.getInstance().chats.get(-lower_id); chat = MessagesController.getInstance().chats.get(-lower_id);
} else { } else {
user = MessagesController.getInstance().users.get(lower_id); user = MessagesController.getInstance().users.get(lower_id);
} }
}
} else { } else {
encryptedChat = MessagesController.getInstance().encryptedChats.get((int)(currentDialog.id >> 32)); encryptedChat = MessagesController.getInstance().encryptedChats.get(high_id);
if (encryptedChat != null) { if (encryptedChat != null) {
user = MessagesController.getInstance().users.get(encryptedChat.user_id); user = MessagesController.getInstance().users.get(encryptedChat.user_id);
} }
...@@ -274,6 +284,9 @@ public class DialogCell extends BaseCell { ...@@ -274,6 +284,9 @@ public class DialogCell extends BaseCell {
} else if (cellLayout.drawNameGroup) { } else if (cellLayout.drawNameGroup) {
setDrawableBounds(groupDrawable, cellLayout.nameLockLeft, cellLayout.nameLockTop); setDrawableBounds(groupDrawable, cellLayout.nameLockLeft, cellLayout.nameLockTop);
groupDrawable.draw(canvas); groupDrawable.draw(canvas);
} else if (cellLayout.drawNameBroadcast) {
setDrawableBounds(broadcastDrawable, cellLayout.nameLockLeft, cellLayout.nameLockTop);
broadcastDrawable.draw(canvas);
} }
canvas.save(); canvas.save();
...@@ -328,6 +341,7 @@ public class DialogCell extends BaseCell { ...@@ -328,6 +341,7 @@ public class DialogCell extends BaseCell {
private StaticLayout nameLayout; private StaticLayout nameLayout;
private boolean drawNameLock; private boolean drawNameLock;
private boolean drawNameGroup; private boolean drawNameGroup;
private boolean drawNameBroadcast;
private int nameLockLeft; private int nameLockLeft;
private int nameLockTop; private int nameLockTop;
...@@ -372,9 +386,12 @@ public class DialogCell extends BaseCell { ...@@ -372,9 +386,12 @@ public class DialogCell extends BaseCell {
TextPaint currentMessagePaint = messagePaint; TextPaint currentMessagePaint = messagePaint;
boolean checkMessage = true; boolean checkMessage = true;
drawNameGroup = false;
drawNameBroadcast = false;
drawNameLock = false;
if (encryptedChat != null) { if (encryptedChat != null) {
drawNameLock = true; drawNameLock = true;
drawNameGroup = false;
nameLockTop = AndroidUtilities.dp(13); nameLockTop = AndroidUtilities.dp(13);
if (!LocaleController.isRTL) { if (!LocaleController.isRTL) {
nameLockLeft = AndroidUtilities.dp(77); nameLockLeft = AndroidUtilities.dp(77);
...@@ -384,19 +401,21 @@ public class DialogCell extends BaseCell { ...@@ -384,19 +401,21 @@ public class DialogCell extends BaseCell {
nameLeft = AndroidUtilities.dp(14); nameLeft = AndroidUtilities.dp(14);
} }
} else { } else {
drawNameLock = false;
if (chat != null) { if (chat != null) {
if (chat.id < 0) {
drawNameBroadcast = true;
} else {
drawNameGroup = true; drawNameGroup = true;
}
nameLockTop = AndroidUtilities.dp(14); nameLockTop = AndroidUtilities.dp(14);
if (!LocaleController.isRTL) { if (!LocaleController.isRTL) {
nameLockLeft = AndroidUtilities.dp(77); nameLockLeft = AndroidUtilities.dp(77);
nameLeft = AndroidUtilities.dp(81) + groupDrawable.getIntrinsicWidth(); nameLeft = AndroidUtilities.dp(81) + (drawNameGroup ? groupDrawable.getIntrinsicWidth() : broadcastDrawable.getIntrinsicWidth());
} else { } else {
nameLockLeft = width - AndroidUtilities.dp(77) - groupDrawable.getIntrinsicWidth(); nameLockLeft = width - AndroidUtilities.dp(77) - (drawNameGroup ? groupDrawable.getIntrinsicWidth() : broadcastDrawable.getIntrinsicWidth());
nameLeft = AndroidUtilities.dp(14); nameLeft = AndroidUtilities.dp(14);
} }
} else { } else {
drawNameGroup = false;
if (!LocaleController.isRTL) { if (!LocaleController.isRTL) {
nameLeft = AndroidUtilities.dp(77); nameLeft = AndroidUtilities.dp(77);
} else { } else {
...@@ -461,7 +480,7 @@ public class DialogCell extends BaseCell { ...@@ -461,7 +480,7 @@ public class DialogCell extends BaseCell {
messageString = message.messageText; messageString = message.messageText;
currentMessagePaint = messagePrintingPaint; currentMessagePaint = messagePrintingPaint;
} else { } else {
if (chat != null) { if (chat != null && chat.id > 0) {
String name = ""; String name = "";
if (message.isFromMe()) { if (message.isFromMe()) {
name = LocaleController.getString("FromYou", R.string.FromYou); name = LocaleController.getString("FromYou", R.string.FromYou);
...@@ -505,7 +524,7 @@ public class DialogCell extends BaseCell { ...@@ -505,7 +524,7 @@ public class DialogCell extends BaseCell {
} }
} }
if (message.isFromMe()) { if (message.isFromMe() && message.isOut()) {
if (message.messageOwner.send_state == MessagesController.MESSAGE_SEND_STATE_SENDING) { if (message.messageOwner.send_state == MessagesController.MESSAGE_SEND_STATE_SENDING) {
drawCheck1 = false; drawCheck1 = false;
drawCheck2 = false; drawCheck2 = false;
...@@ -579,6 +598,8 @@ public class DialogCell extends BaseCell { ...@@ -579,6 +598,8 @@ public class DialogCell extends BaseCell {
nameWidth -= AndroidUtilities.dp(4) + lockDrawable.getIntrinsicWidth(); nameWidth -= AndroidUtilities.dp(4) + lockDrawable.getIntrinsicWidth();
} else if (drawNameGroup) { } else if (drawNameGroup) {
nameWidth -= AndroidUtilities.dp(4) + groupDrawable.getIntrinsicWidth(); nameWidth -= AndroidUtilities.dp(4) + groupDrawable.getIntrinsicWidth();
} else if (drawNameBroadcast) {
nameWidth -= AndroidUtilities.dp(4) + broadcastDrawable.getIntrinsicWidth();
} }
if (drawClock) { if (drawClock) {
int w = clockDrawable.getIntrinsicWidth() + AndroidUtilities.dp(2); int w = clockDrawable.getIntrinsicWidth() + AndroidUtilities.dp(2);
......
...@@ -76,7 +76,11 @@ public class ChatProfileChangeNameActivity extends BaseFragment { ...@@ -76,7 +76,11 @@ public class ChatProfileChangeNameActivity extends BaseFragment {
TLRPC.Chat currentChat = MessagesController.getInstance().chats.get(chat_id); TLRPC.Chat currentChat = MessagesController.getInstance().chats.get(chat_id);
firstNameField = (EditText)fragmentView.findViewById(R.id.first_name_field); firstNameField = (EditText)fragmentView.findViewById(R.id.first_name_field);
if (chat_id > 0) {
firstNameField.setHint(LocaleController.getString("GroupName", R.string.GroupName)); firstNameField.setHint(LocaleController.getString("GroupName", R.string.GroupName));
} else {
firstNameField.setHint(LocaleController.getString("EnterListName", R.string.EnterListName));
}
firstNameField.setOnEditorActionListener(new TextView.OnEditorActionListener() { firstNameField.setOnEditorActionListener(new TextView.OnEditorActionListener() {
@Override @Override
public boolean onEditorAction(TextView textView, int i, KeyEvent keyEvent) { public boolean onEditorAction(TextView textView, int i, KeyEvent keyEvent) {
...@@ -91,7 +95,11 @@ public class ChatProfileChangeNameActivity extends BaseFragment { ...@@ -91,7 +95,11 @@ public class ChatProfileChangeNameActivity extends BaseFragment {
firstNameField.setSelection(firstNameField.length()); firstNameField.setSelection(firstNameField.length());
TextView headerLabel = (TextView)fragmentView.findViewById(R.id.settings_section_text); TextView headerLabel = (TextView)fragmentView.findViewById(R.id.settings_section_text);
if (chat_id > 0) {
headerLabel.setText(LocaleController.getString("EnterGroupNameTitle", R.string.EnterGroupNameTitle)); headerLabel.setText(LocaleController.getString("EnterGroupNameTitle", R.string.EnterGroupNameTitle));
} else {
headerLabel.setText(LocaleController.getString("EnterListName", R.string.EnterListName).toUpperCase());
}
} else { } else {
ViewGroup parent = (ViewGroup)fragmentView.getParent(); ViewGroup parent = (ViewGroup)fragmentView.getParent();
if (parent != null) { if (parent != null) {
......
...@@ -90,6 +90,8 @@ public class GroupCreateActivity extends BaseFragment implements NotificationCen ...@@ -90,6 +90,8 @@ public class GroupCreateActivity extends BaseFragment implements NotificationCen
private TextView emptyTextView; private TextView emptyTextView;
private EditText userSelectEditText; private EditText userSelectEditText;
private boolean ignoreChange = false; private boolean ignoreChange = false;
private boolean isBroadcast = false;
private int maxCount = 200;
private HashMap<Integer, XImageSpan> selectedContacts = new HashMap<Integer, XImageSpan>(); private HashMap<Integer, XImageSpan> selectedContacts = new HashMap<Integer, XImageSpan>();
private ArrayList<XImageSpan> allSpans = new ArrayList<XImageSpan>(); private ArrayList<XImageSpan> allSpans = new ArrayList<XImageSpan>();
...@@ -105,6 +107,16 @@ public class GroupCreateActivity extends BaseFragment implements NotificationCen ...@@ -105,6 +107,16 @@ public class GroupCreateActivity extends BaseFragment implements NotificationCen
private final static int done_button = 1; private final static int done_button = 1;
public GroupCreateActivity() {
super();
}
public GroupCreateActivity(Bundle args) {
super(args);
isBroadcast = args.getBoolean("broadcast", false);
maxCount = !isBroadcast ? MessagesController.getInstance().maxGroupCount : MessagesController.getInstance().maxBroadcastCount;
}
@Override @Override
public boolean onFragmentCreate() { public boolean onFragmentCreate() {
NotificationCenter.getInstance().addObserver(this, MessagesController.contactsDidLoaded); NotificationCenter.getInstance().addObserver(this, MessagesController.contactsDidLoaded);
...@@ -126,8 +138,12 @@ public class GroupCreateActivity extends BaseFragment implements NotificationCen ...@@ -126,8 +138,12 @@ public class GroupCreateActivity extends BaseFragment implements NotificationCen
if (fragmentView == null) { if (fragmentView == null) {
actionBarLayer.setDisplayHomeAsUpEnabled(true, R.drawable.ic_ab_back); actionBarLayer.setDisplayHomeAsUpEnabled(true, R.drawable.ic_ab_back);
actionBarLayer.setBackOverlay(R.layout.updating_state_layout); actionBarLayer.setBackOverlay(R.layout.updating_state_layout);
if (isBroadcast) {
actionBarLayer.setTitle(LocaleController.getString("NewBroadcastList", R.string.NewBroadcastList));
} else {
actionBarLayer.setTitle(LocaleController.getString("NewGroup", R.string.NewGroup)); actionBarLayer.setTitle(LocaleController.getString("NewGroup", R.string.NewGroup));
actionBarLayer.setSubtitle(LocaleController.formatString("MembersCount", R.string.MembersCount, selectedContacts.size(), 200)); }
actionBarLayer.setSubtitle(LocaleController.formatString("MembersCount", R.string.MembersCount, selectedContacts.size(), maxCount));
actionBarLayer.setActionBarMenuOnItemClick(new ActionBarLayer.ActionBarMenuOnItemClick() { actionBarLayer.setActionBarMenuOnItemClick(new ActionBarLayer.ActionBarMenuOnItemClick() {
@Override @Override
...@@ -140,6 +156,7 @@ public class GroupCreateActivity extends BaseFragment implements NotificationCen ...@@ -140,6 +156,7 @@ public class GroupCreateActivity extends BaseFragment implements NotificationCen
result.addAll(selectedContacts.keySet()); result.addAll(selectedContacts.keySet());
Bundle args = new Bundle(); Bundle args = new Bundle();
args.putIntegerArrayList("result", result); args.putIntegerArrayList("result", result);
args.putBoolean("broadcast", isBroadcast);
presentFragment(new GroupCreateFinalActivity(args)); presentFragment(new GroupCreateFinalActivity(args));
} }
} }
...@@ -201,7 +218,7 @@ public class GroupCreateActivity extends BaseFragment implements NotificationCen ...@@ -201,7 +218,7 @@ public class GroupCreateActivity extends BaseFragment implements NotificationCen
selectedContacts.remove(sp.uid); selectedContacts.remove(sp.uid);
} }
} }
actionBarLayer.setSubtitle(LocaleController.formatString("MembersCount", R.string.MembersCount, selectedContacts.size(), 200)); actionBarLayer.setSubtitle(LocaleController.formatString("MembersCount", R.string.MembersCount, selectedContacts.size(), maxCount));
listView.invalidateViews(); listView.invalidateViews();
} else { } else {
search = true; search = true;
...@@ -259,7 +276,7 @@ public class GroupCreateActivity extends BaseFragment implements NotificationCen ...@@ -259,7 +276,7 @@ public class GroupCreateActivity extends BaseFragment implements NotificationCen
userSelectEditText.setSelection(text.length()); userSelectEditText.setSelection(text.length());
ignoreChange = false; ignoreChange = false;
} else { } else {
if (selectedContacts.size() == 200) { if (selectedContacts.size() == maxCount) {
return; return;
} }
ignoreChange = true; ignoreChange = true;
...@@ -267,7 +284,7 @@ public class GroupCreateActivity extends BaseFragment implements NotificationCen ...@@ -267,7 +284,7 @@ public class GroupCreateActivity extends BaseFragment implements NotificationCen
span.uid = user.id; span.uid = user.id;
ignoreChange = false; ignoreChange = false;
} }
actionBarLayer.setSubtitle(LocaleController.formatString("MembersCount", R.string.MembersCount, selectedContacts.size(), 200)); actionBarLayer.setSubtitle(LocaleController.formatString("MembersCount", R.string.MembersCount, selectedContacts.size(), maxCount));
if (searching || searchWas) { if (searching || searchWas) {
searching = false; searching = false;
searchWas = false; searchWas = false;
......
...@@ -54,11 +54,13 @@ public class GroupCreateFinalActivity extends BaseFragment implements Notificati ...@@ -54,11 +54,13 @@ public class GroupCreateFinalActivity extends BaseFragment implements Notificati
private AvatarUpdater avatarUpdater = new AvatarUpdater(); private AvatarUpdater avatarUpdater = new AvatarUpdater();
private ProgressDialog progressDialog = null; private ProgressDialog progressDialog = null;
private String nameToSet = null; private String nameToSet = null;
private boolean isBroadcast = false;
private final static int done_button = 1; private final static int done_button = 1;
public GroupCreateFinalActivity(Bundle args) { public GroupCreateFinalActivity(Bundle args) {
super(args); super(args);
isBroadcast = args.getBoolean("broadcast", false);
} }
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
...@@ -120,7 +122,11 @@ public class GroupCreateFinalActivity extends BaseFragment implements Notificati ...@@ -120,7 +122,11 @@ public class GroupCreateFinalActivity extends BaseFragment implements Notificati
if (fragmentView == null) { if (fragmentView == null) {
actionBarLayer.setDisplayHomeAsUpEnabled(true, R.drawable.ic_ab_back); actionBarLayer.setDisplayHomeAsUpEnabled(true, R.drawable.ic_ab_back);
actionBarLayer.setBackOverlay(R.layout.updating_state_layout); actionBarLayer.setBackOverlay(R.layout.updating_state_layout);
if (isBroadcast) {
actionBarLayer.setTitle(LocaleController.getString("NewBroadcastList", R.string.NewBroadcastList));
} else {
actionBarLayer.setTitle(LocaleController.getString("NewGroup", R.string.NewGroup)); actionBarLayer.setTitle(LocaleController.getString("NewGroup", R.string.NewGroup));
}
actionBarLayer.setActionBarMenuOnItemClick(new ActionBarLayer.ActionBarMenuOnItemClick() { actionBarLayer.setActionBarMenuOnItemClick(new ActionBarLayer.ActionBarMenuOnItemClick() {
@Override @Override
...@@ -136,6 +142,9 @@ public class GroupCreateFinalActivity extends BaseFragment implements Notificati ...@@ -136,6 +142,9 @@ public class GroupCreateFinalActivity extends BaseFragment implements Notificati
} }
donePressed = true; donePressed = true;
if (isBroadcast) {
MessagesController.getInstance().createChat(nameTextView.getText().toString(), selectedContacts, uploadedAvatar, isBroadcast);
} else {
if (avatarUpdater.uploadingAvatar != null) { if (avatarUpdater.uploadingAvatar != null) {
createAfterUpload = true; createAfterUpload = true;
} else { } else {
...@@ -144,7 +153,7 @@ public class GroupCreateFinalActivity extends BaseFragment implements Notificati ...@@ -144,7 +153,7 @@ public class GroupCreateFinalActivity extends BaseFragment implements Notificati
progressDialog.setCanceledOnTouchOutside(false); progressDialog.setCanceledOnTouchOutside(false);
progressDialog.setCancelable(false); progressDialog.setCancelable(false);
final long reqId = MessagesController.getInstance().createChat(nameTextView.getText().toString(), selectedContacts, uploadedAvatar); final long reqId = MessagesController.getInstance().createChat(nameTextView.getText().toString(), selectedContacts, uploadedAvatar, isBroadcast);
progressDialog.setButton(DialogInterface.BUTTON_NEGATIVE, LocaleController.getString("Cancel", R.string.Cancel), new DialogInterface.OnClickListener() { progressDialog.setButton(DialogInterface.BUTTON_NEGATIVE, LocaleController.getString("Cancel", R.string.Cancel), new DialogInterface.OnClickListener() {
@Override @Override
...@@ -162,6 +171,7 @@ public class GroupCreateFinalActivity extends BaseFragment implements Notificati ...@@ -162,6 +171,7 @@ public class GroupCreateFinalActivity extends BaseFragment implements Notificati
} }
} }
} }
}
}); });
ActionBarMenu menu = actionBarLayer.createMenu(); ActionBarMenu menu = actionBarLayer.createMenu();
...@@ -173,6 +183,9 @@ public class GroupCreateFinalActivity extends BaseFragment implements Notificati ...@@ -173,6 +183,9 @@ public class GroupCreateFinalActivity extends BaseFragment implements Notificati
fragmentView = inflater.inflate(R.layout.group_create_final_layout, container, false); fragmentView = inflater.inflate(R.layout.group_create_final_layout, container, false);
final ImageButton button2 = (ImageButton)fragmentView.findViewById(R.id.settings_change_avatar_button); final ImageButton button2 = (ImageButton)fragmentView.findViewById(R.id.settings_change_avatar_button);
if (isBroadcast) {
button2.setVisibility(View.GONE);
} else {
button2.setOnClickListener(new View.OnClickListener() { button2.setOnClickListener(new View.OnClickListener() {
@Override @Override
public void onClick(View view) { public void onClick(View view) {
...@@ -184,9 +197,9 @@ public class GroupCreateFinalActivity extends BaseFragment implements Notificati ...@@ -184,9 +197,9 @@ public class GroupCreateFinalActivity extends BaseFragment implements Notificati
CharSequence[] items; CharSequence[] items;
if (avatar != null) { if (avatar != null) {
items = new CharSequence[] {LocaleController.getString("FromCamera", R.string.FromCamera), LocaleController.getString("FromGalley", R.string.FromGalley), LocaleController.getString("DeletePhoto", R.string.DeletePhoto)}; items = new CharSequence[]{LocaleController.getString("FromCamera", R.string.FromCamera), LocaleController.getString("FromGalley", R.string.FromGalley), LocaleController.getString("DeletePhoto", R.string.DeletePhoto)};
} else { } else {
items = new CharSequence[] {LocaleController.getString("FromCamera", R.string.FromCamera), LocaleController.getString("FromGalley", R.string.FromGalley)}; items = new CharSequence[]{LocaleController.getString("FromCamera", R.string.FromCamera), LocaleController.getString("FromGalley", R.string.FromGalley)};
} }
builder.setItems(items, new DialogInterface.OnClickListener() { builder.setItems(items, new DialogInterface.OnClickListener() {
...@@ -206,12 +219,17 @@ public class GroupCreateFinalActivity extends BaseFragment implements Notificati ...@@ -206,12 +219,17 @@ public class GroupCreateFinalActivity extends BaseFragment implements Notificati
showAlertDialog(builder); showAlertDialog(builder);
} }
}); });
}
avatarImage = (BackupImageView)fragmentView.findViewById(R.id.settings_avatar_image); avatarImage = (BackupImageView)fragmentView.findViewById(R.id.settings_avatar_image);
avatarImage.setImageResource(R.drawable.group_blue); avatarImage.setImageResource(R.drawable.group_blue);
nameTextView = (EditText)fragmentView.findViewById(R.id.bubble_input_text); nameTextView = (EditText)fragmentView.findViewById(R.id.bubble_input_text);
if (isBroadcast) {
nameTextView.setHint(LocaleController.getString("EnterListName", R.string.EnterListName));
} else {
nameTextView.setHint(LocaleController.getString("EnterGroupNamePlaceholder", R.string.EnterGroupNamePlaceholder)); nameTextView.setHint(LocaleController.getString("EnterGroupNamePlaceholder", R.string.EnterGroupNamePlaceholder));
}
if (nameToSet != null) { if (nameToSet != null) {
nameTextView.setText(nameToSet); nameTextView.setText(nameToSet);
nameToSet = null; nameToSet = null;
...@@ -237,7 +255,7 @@ public class GroupCreateFinalActivity extends BaseFragment implements Notificati ...@@ -237,7 +255,7 @@ public class GroupCreateFinalActivity extends BaseFragment implements Notificati
avatarImage.setImage(avatar, "50_50", R.drawable.group_blue); avatarImage.setImage(avatar, "50_50", R.drawable.group_blue);
if (createAfterUpload) { if (createAfterUpload) {
FileLog.e("tmessages", "avatar did uploaded"); FileLog.e("tmessages", "avatar did uploaded");
MessagesController.getInstance().createChat(nameTextView.getText().toString(), selectedContacts, uploadedAvatar); MessagesController.getInstance().createChat(nameTextView.getText().toString(), selectedContacts, uploadedAvatar, false);
} }
} }
}); });
......
...@@ -85,7 +85,6 @@ public class LaunchActivity extends ActionBarActivity implements NotificationCen ...@@ -85,7 +85,6 @@ public class LaunchActivity extends ActionBarActivity implements NotificationCen
currentConnectionState = ConnectionsManager.getInstance().getConnectionState(); currentConnectionState = ConnectionsManager.getInstance().getConnectionState();
NotificationCenter.getInstance().addObserver(this, 1234); NotificationCenter.getInstance().addObserver(this, 1234);
NotificationCenter.getInstance().addObserver(this, 658);
NotificationCenter.getInstance().addObserver(this, 701); NotificationCenter.getInstance().addObserver(this, 701);
NotificationCenter.getInstance().addObserver(this, 702); NotificationCenter.getInstance().addObserver(this, 702);
NotificationCenter.getInstance().addObserver(this, 703); NotificationCenter.getInstance().addObserver(this, 703);
...@@ -149,6 +148,7 @@ public class LaunchActivity extends ActionBarActivity implements NotificationCen ...@@ -149,6 +148,7 @@ public class LaunchActivity extends ActionBarActivity implements NotificationCen
Integer push_chat_id = 0; Integer push_chat_id = 0;
Integer push_enc_id = 0; Integer push_enc_id = 0;
Integer open_settings = 0; Integer open_settings = 0;
boolean showDialogsList = false;
photoPathsArray = null; photoPathsArray = null;
videoPath = null; videoPath = null;
...@@ -379,6 +379,8 @@ public class LaunchActivity extends ActionBarActivity implements NotificationCen ...@@ -379,6 +379,8 @@ public class LaunchActivity extends ActionBarActivity implements NotificationCen
NotificationCenter.getInstance().postNotificationName(MessagesController.closeChats); NotificationCenter.getInstance().postNotificationName(MessagesController.closeChats);
push_enc_id = encId; push_enc_id = encId;
} }
} else {
showDialogsList = true;
} }
} }
} }
...@@ -408,6 +410,11 @@ public class LaunchActivity extends ActionBarActivity implements NotificationCen ...@@ -408,6 +410,11 @@ public class LaunchActivity extends ActionBarActivity implements NotificationCen
if (presentFragment(fragment, false, true)) { if (presentFragment(fragment, false, true)) {
pushOpened = true; pushOpened = true;
} }
} else if (showDialogsList) {
for (int a = 1; a < fragmentsStack.size(); a++) {
removeFragmentFromStack(fragmentsStack.get(a));
a--;
}
} }
if (videoPath != null || photoPathsArray != null || sendingText != null || documentsPathsArray != null || contactsToSend != null) { if (videoPath != null || photoPathsArray != null || sendingText != null || documentsPathsArray != null || contactsToSend != null) {
NotificationCenter.getInstance().postNotificationName(MessagesController.closeChats); NotificationCenter.getInstance().postNotificationName(MessagesController.closeChats);
...@@ -440,18 +447,23 @@ public class LaunchActivity extends ActionBarActivity implements NotificationCen ...@@ -440,18 +447,23 @@ public class LaunchActivity extends ActionBarActivity implements NotificationCen
public void didSelectDialog(MessagesActivity messageFragment, long dialog_id, boolean param) { public void didSelectDialog(MessagesActivity messageFragment, long dialog_id, boolean param) {
if (dialog_id != 0) { if (dialog_id != 0) {
int lower_part = (int)dialog_id; int lower_part = (int)dialog_id;
int high_id = (int)(dialog_id >> 32);
Bundle args = new Bundle(); Bundle args = new Bundle();
args.putBoolean("scrollToTopOnResume", true); args.putBoolean("scrollToTopOnResume", true);
NotificationCenter.getInstance().postNotificationName(MessagesController.closeChats); NotificationCenter.getInstance().postNotificationName(MessagesController.closeChats);
if (lower_part != 0) { if (lower_part != 0) {
if (high_id == 1) {
args.putInt("chat_id", lower_part);
} else {
if (lower_part > 0) { if (lower_part > 0) {
args.putInt("user_id", lower_part); args.putInt("user_id", lower_part);
} else if (lower_part < 0) { } else if (lower_part < 0) {
args.putInt("chat_id", -lower_part); args.putInt("chat_id", -lower_part);
} }
}
} else { } else {
args.putInt("enc_id", (int)(dialog_id >> 32)); args.putInt("enc_id", high_id);
} }
ChatActivity fragment = new ChatActivity(args); ChatActivity fragment = new ChatActivity(args);
presentFragment(fragment, true); presentFragment(fragment, true);
...@@ -522,7 +534,6 @@ public class LaunchActivity extends ActionBarActivity implements NotificationCen ...@@ -522,7 +534,6 @@ public class LaunchActivity extends ActionBarActivity implements NotificationCen
} }
finished = true; finished = true;
NotificationCenter.getInstance().removeObserver(this, 1234); NotificationCenter.getInstance().removeObserver(this, 1234);
NotificationCenter.getInstance().removeObserver(this, 658);
NotificationCenter.getInstance().removeObserver(this, 701); NotificationCenter.getInstance().removeObserver(this, 701);
NotificationCenter.getInstance().removeObserver(this, 702); NotificationCenter.getInstance().removeObserver(this, 702);
NotificationCenter.getInstance().removeObserver(this, 703); NotificationCenter.getInstance().removeObserver(this, 703);
...@@ -546,30 +557,6 @@ public class LaunchActivity extends ActionBarActivity implements NotificationCen ...@@ -546,30 +557,6 @@ public class LaunchActivity extends ActionBarActivity implements NotificationCen
startActivity(intent2); startActivity(intent2);
onFinish(); onFinish();
finish(); finish();
} else if (id == 658) {
if (PhotoViewer.getInstance().isVisible()) {
PhotoViewer.getInstance().closePhoto(false);
}
Integer push_chat_id = (Integer)args[0];
Integer push_user_id = (Integer)args[1];
Integer push_enc_id = (Integer)args[2];
if (push_user_id != 0) {
NotificationCenter.getInstance().postNotificationName(MessagesController.closeChats);
Bundle args2 = new Bundle();
args2.putInt("user_id", push_user_id);
presentFragment(new ChatActivity(args2), false, true);
} else if (push_chat_id != 0) {
NotificationCenter.getInstance().postNotificationName(MessagesController.closeChats);
Bundle args2 = new Bundle();
args2.putInt("chat_id", push_chat_id);
presentFragment(new ChatActivity(args2), false, true);
} else if (push_enc_id != 0) {
NotificationCenter.getInstance().postNotificationName(MessagesController.closeChats);
Bundle args2 = new Bundle();
args2.putInt("enc_id", push_enc_id);
presentFragment(new ChatActivity(args2), false, true);
}
} else if (id == 702) { } else if (id == 702) {
if (args[0] != this) { if (args[0] != this) {
onFinish(); onFinish();
......
...@@ -8,7 +8,9 @@ ...@@ -8,7 +8,9 @@
package org.telegram.ui; package org.telegram.ui;
import android.content.Context;
import android.location.Location; import android.location.Location;
import android.location.LocationManager;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
...@@ -39,6 +41,8 @@ import org.telegram.ui.Views.ActionBar.ActionBarMenuItem; ...@@ -39,6 +41,8 @@ import org.telegram.ui.Views.ActionBar.ActionBarMenuItem;
import org.telegram.ui.Views.BackupImageView; import org.telegram.ui.Views.BackupImageView;
import org.telegram.ui.Views.ActionBar.BaseFragment; import org.telegram.ui.Views.ActionBar.BaseFragment;
import java.util.List;
public class LocationActivity extends BaseFragment implements NotificationCenter.NotificationCenterDelegate { public class LocationActivity extends BaseFragment implements NotificationCenter.NotificationCenterDelegate {
private GoogleMap googleMap; private GoogleMap googleMap;
private TextView distanceTextView; private TextView distanceTextView;
...@@ -164,8 +168,7 @@ public class LocationActivity extends BaseFragment implements NotificationCenter ...@@ -164,8 +168,7 @@ public class LocationActivity extends BaseFragment implements NotificationCenter
positionMarker(location); positionMarker(location);
} }
}); });
myLocation = googleMap.getMyLocation(); myLocation = getLastLocation();
if (sendButton != null) { if (sendButton != null) {
userLocation = new Location("network"); userLocation = new Location("network");
...@@ -249,6 +252,19 @@ public class LocationActivity extends BaseFragment implements NotificationCenter ...@@ -249,6 +252,19 @@ public class LocationActivity extends BaseFragment implements NotificationCenter
return fragmentView; return fragmentView;
} }
private Location getLastLocation() {
LocationManager lm = (LocationManager) ApplicationLoader.applicationContext.getSystemService(Context.LOCATION_SERVICE);
List<String> providers = lm.getProviders(true);
Location l = null;
for (int i = providers.size() - 1; i >= 0; i--) {
l = lm.getLastKnownLocation(providers.get(i));
if (l != null) {
break;
}
}
return l;
}
private void updateUserData() { private void updateUserData() {
if (messageObject != null && avatarImageView != null) { if (messageObject != null && avatarImageView != null) {
int fromId = messageObject.messageOwner.from_id; int fromId = messageObject.messageOwner.from_id;
......
...@@ -150,10 +150,10 @@ public class LoginActivityRegisterView extends SlideView { ...@@ -150,10 +150,10 @@ public class LoginActivityRegisterView extends SlideView {
final TLRPC.TL_auth_authorization res = (TLRPC.TL_auth_authorization)response; final TLRPC.TL_auth_authorization res = (TLRPC.TL_auth_authorization)response;
TLRPC.TL_userSelf user = (TLRPC.TL_userSelf)res.user; TLRPC.TL_userSelf user = (TLRPC.TL_userSelf)res.user;
UserConfig.clearConfig(); UserConfig.clearConfig();
MessagesStorage.getInstance().cleanUp();
MessagesController.getInstance().cleanUp(); MessagesController.getInstance().cleanUp();
UserConfig.setCurrentUser(user); UserConfig.setCurrentUser(user);
UserConfig.saveConfig(true); UserConfig.saveConfig(true);
MessagesStorage.getInstance().cleanUp(true);
ArrayList<TLRPC.User> users = new ArrayList<TLRPC.User>(); ArrayList<TLRPC.User> users = new ArrayList<TLRPC.User>();
users.add(user); users.add(user);
MessagesStorage.getInstance().putUsersAndChats(users, null, true, true); MessagesStorage.getInstance().putUsersAndChats(users, null, true, true);
......
...@@ -54,9 +54,12 @@ public class LoginActivitySmsView extends SlideView implements NotificationCente ...@@ -54,9 +54,12 @@ public class LoginActivitySmsView extends SlideView implements NotificationCente
private Bundle currentParams; private Bundle currentParams;
private Timer timeTimer; private Timer timeTimer;
private Timer codeTimer;
private static final Integer timerSync = 1; private static final Integer timerSync = 1;
private volatile int time = 60000; private volatile int time = 60000;
private volatile int codeTime = 15000;
private double lastCurrentTime; private double lastCurrentTime;
private double lastCodeTime;
private boolean waitingForSms = false; private boolean waitingForSms = false;
private boolean nextPressed = false; private boolean nextPressed = false;
private String lastError = ""; private String lastError = "";
...@@ -162,6 +165,7 @@ public class LoginActivitySmsView extends SlideView implements NotificationCente ...@@ -162,6 +165,7 @@ public class LoginActivitySmsView extends SlideView implements NotificationCente
codeField.requestFocus(); codeField.requestFocus();
destroyTimer(); destroyTimer();
destroyCodeTimer();
timeText.setText(String.format("%s 1:00", LocaleController.getString("CallText", R.string.CallText))); timeText.setText(String.format("%s 1:00", LocaleController.getString("CallText", R.string.CallText)));
lastCurrentTime = System.currentTimeMillis(); lastCurrentTime = System.currentTimeMillis();
problemText.setVisibility(time < 1000 ? VISIBLE : GONE); problemText.setVisibility(time < 1000 ? VISIBLE : GONE);
...@@ -169,6 +173,46 @@ public class LoginActivitySmsView extends SlideView implements NotificationCente ...@@ -169,6 +173,46 @@ public class LoginActivitySmsView extends SlideView implements NotificationCente
createTimer(); createTimer();
} }
private void createCodeTimer() {
if (codeTimer != null) {
return;
}
codeTime = 15000;
codeTimer = new Timer();
lastCodeTime = System.currentTimeMillis();
codeTimer.schedule(new TimerTask() {
@Override
public void run() {
double currentTime = System.currentTimeMillis();
double diff = currentTime - lastCodeTime;
codeTime -= diff;
lastCodeTime = currentTime;
Utilities.RunOnUIThread(new Runnable() {
@Override
public void run() {
if (codeTime <= 1000) {
problemText.setVisibility(VISIBLE);
destroyCodeTimer();
}
}
});
}
}, 0, 1000);
}
private void destroyCodeTimer() {
try {
synchronized(timerSync) {
if (codeTimer != null) {
codeTimer.cancel();
codeTimer = null;
}
}
} catch (Exception e) {
FileLog.e("tmessages", e);
}
}
private void createTimer() { private void createTimer() {
if (timeTimer != null) { if (timeTimer != null) {
return; return;
...@@ -189,9 +233,9 @@ public class LoginActivitySmsView extends SlideView implements NotificationCente ...@@ -189,9 +233,9 @@ public class LoginActivitySmsView extends SlideView implements NotificationCente
int seconds = time / 1000 - minutes * 60; int seconds = time / 1000 - minutes * 60;
timeText.setText(String.format("%s %d:%02d", LocaleController.getString("CallText", R.string.CallText), minutes, seconds)); timeText.setText(String.format("%s %d:%02d", LocaleController.getString("CallText", R.string.CallText), minutes, seconds));
} else { } else {
problemText.setVisibility(VISIBLE);
timeText.setText(LocaleController.getString("Calling", R.string.Calling)); timeText.setText(LocaleController.getString("Calling", R.string.Calling));
destroyTimer(); destroyTimer();
createCodeTimer();
TLRPC.TL_auth_sendCall req = new TLRPC.TL_auth_sendCall(); TLRPC.TL_auth_sendCall req = new TLRPC.TL_auth_sendCall();
req.phone_number = requestPhone; req.phone_number = requestPhone;
req.phone_code_hash = phoneHash; req.phone_code_hash = phoneHash;
...@@ -259,11 +303,12 @@ public class LoginActivitySmsView extends SlideView implements NotificationCente ...@@ -259,11 +303,12 @@ public class LoginActivitySmsView extends SlideView implements NotificationCente
if (error == null) { if (error == null) {
TLRPC.TL_auth_authorization res = (TLRPC.TL_auth_authorization)response; TLRPC.TL_auth_authorization res = (TLRPC.TL_auth_authorization)response;
destroyTimer(); destroyTimer();
destroyCodeTimer();
UserConfig.clearConfig(); UserConfig.clearConfig();
MessagesStorage.getInstance().cleanUp();
MessagesController.getInstance().cleanUp(); MessagesController.getInstance().cleanUp();
UserConfig.setCurrentUser(res.user); UserConfig.setCurrentUser(res.user);
UserConfig.saveConfig(true); UserConfig.saveConfig(true);
MessagesStorage.getInstance().cleanUp(true);
ArrayList<TLRPC.User> users = new ArrayList<TLRPC.User>(); ArrayList<TLRPC.User> users = new ArrayList<TLRPC.User>();
users.add(res.user); users.add(res.user);
MessagesStorage.getInstance().putUsersAndChats(users, null, true, true); MessagesStorage.getInstance().putUsersAndChats(users, null, true, true);
...@@ -280,6 +325,7 @@ public class LoginActivitySmsView extends SlideView implements NotificationCente ...@@ -280,6 +325,7 @@ public class LoginActivitySmsView extends SlideView implements NotificationCente
params.putString("code", req.phone_code); params.putString("code", req.phone_code);
delegate.setPage(2, true, params, false); delegate.setPage(2, true, params, false);
destroyTimer(); destroyTimer();
destroyCodeTimer();
} else { } else {
createTimer(); createTimer();
if (error.text.contains("PHONE_NUMBER_INVALID")) { if (error.text.contains("PHONE_NUMBER_INVALID")) {
...@@ -304,6 +350,7 @@ public class LoginActivitySmsView extends SlideView implements NotificationCente ...@@ -304,6 +350,7 @@ public class LoginActivitySmsView extends SlideView implements NotificationCente
@Override @Override
public void onBackPressed() { public void onBackPressed() {
destroyTimer(); destroyTimer();
destroyCodeTimer();
currentParams = null; currentParams = null;
AndroidUtilities.setWaitingForSms(false); AndroidUtilities.setWaitingForSms(false);
NotificationCenter.getInstance().removeObserver(this, 998); NotificationCenter.getInstance().removeObserver(this, 998);
...@@ -316,6 +363,7 @@ public class LoginActivitySmsView extends SlideView implements NotificationCente ...@@ -316,6 +363,7 @@ public class LoginActivitySmsView extends SlideView implements NotificationCente
AndroidUtilities.setWaitingForSms(false); AndroidUtilities.setWaitingForSms(false);
NotificationCenter.getInstance().removeObserver(this, 998); NotificationCenter.getInstance().removeObserver(this, 998);
destroyTimer(); destroyTimer();
destroyCodeTimer();
waitingForSms = false; waitingForSms = false;
} }
......
...@@ -74,6 +74,7 @@ public class MessagesActivity extends BaseFragment implements NotificationCenter ...@@ -74,6 +74,7 @@ public class MessagesActivity extends BaseFragment implements NotificationCenter
private final static int messages_list_menu_new_secret_chat = 3; private final static int messages_list_menu_new_secret_chat = 3;
private final static int messages_list_menu_contacts = 4; private final static int messages_list_menu_contacts = 4;
private final static int messages_list_menu_settings = 5; private final static int messages_list_menu_settings = 5;
private final static int messages_list_menu_new_broadcast = 6;
public static interface MessagesActivityDelegate { public static interface MessagesActivityDelegate {
public abstract void didSelectDialog(MessagesActivity fragment, long dialog_id, boolean param); public abstract void didSelectDialog(MessagesActivity fragment, long dialog_id, boolean param);
...@@ -175,6 +176,7 @@ public class MessagesActivity extends BaseFragment implements NotificationCenter ...@@ -175,6 +176,7 @@ public class MessagesActivity extends BaseFragment implements NotificationCenter
ActionBarMenuItem item = menu.addItem(0, R.drawable.ic_ab_other); ActionBarMenuItem item = menu.addItem(0, R.drawable.ic_ab_other);
item.addSubItem(messages_list_menu_new_chat, LocaleController.getString("NewGroup", R.string.NewGroup), 0); item.addSubItem(messages_list_menu_new_chat, LocaleController.getString("NewGroup", R.string.NewGroup), 0);
item.addSubItem(messages_list_menu_new_secret_chat, LocaleController.getString("NewSecretChat", R.string.NewSecretChat), 0); item.addSubItem(messages_list_menu_new_secret_chat, LocaleController.getString("NewSecretChat", R.string.NewSecretChat), 0);
item.addSubItem(messages_list_menu_new_broadcast, LocaleController.getString("NewBroadcastList", R.string.NewBroadcastList), 0);
item.addSubItem(messages_list_menu_contacts, LocaleController.getString("Contacts", R.string.Contacts), 0); item.addSubItem(messages_list_menu_contacts, LocaleController.getString("Contacts", R.string.Contacts), 0);
item.addSubItem(messages_list_menu_settings, LocaleController.getString("Settings", R.string.Settings), 0); item.addSubItem(messages_list_menu_settings, LocaleController.getString("Settings", R.string.Settings), 0);
} }
...@@ -206,6 +208,10 @@ public class MessagesActivity extends BaseFragment implements NotificationCenter ...@@ -206,6 +208,10 @@ public class MessagesActivity extends BaseFragment implements NotificationCenter
if (onlySelect) { if (onlySelect) {
finishFragment(); finishFragment();
} }
} else if (id == messages_list_menu_new_broadcast) {
Bundle args = new Bundle();
args.putBoolean("broadcast", true);
presentFragment(new GroupCreateActivity(args));
} }
} }
}); });
...@@ -258,7 +264,11 @@ public class MessagesActivity extends BaseFragment implements NotificationCenter ...@@ -258,7 +264,11 @@ public class MessagesActivity extends BaseFragment implements NotificationCenter
if (obj instanceof TLRPC.User) { if (obj instanceof TLRPC.User) {
dialog_id = ((TLRPC.User) obj).id; dialog_id = ((TLRPC.User) obj).id;
} else if (obj instanceof TLRPC.Chat) { } else if (obj instanceof TLRPC.Chat) {
if (((TLRPC.Chat) obj).id > 0) {
dialog_id = -((TLRPC.Chat) obj).id; dialog_id = -((TLRPC.Chat) obj).id;
} else {
dialog_id = AndroidUtilities.makeBroadcastId(((TLRPC.Chat) obj).id);
}
} else if (obj instanceof TLRPC.EncryptedChat) { } else if (obj instanceof TLRPC.EncryptedChat) {
dialog_id = ((long)((TLRPC.EncryptedChat) obj).id) << 32; dialog_id = ((long)((TLRPC.EncryptedChat) obj).id) << 32;
} }
...@@ -282,14 +292,19 @@ public class MessagesActivity extends BaseFragment implements NotificationCenter ...@@ -282,14 +292,19 @@ public class MessagesActivity extends BaseFragment implements NotificationCenter
} else { } else {
Bundle args = new Bundle(); Bundle args = new Bundle();
int lower_part = (int)dialog_id; int lower_part = (int)dialog_id;
int high_id = (int)(dialog_id >> 32);
if (lower_part != 0) { if (lower_part != 0) {
if (high_id == 1) {
args.putInt("chat_id", lower_part);
} else {
if (lower_part > 0) { if (lower_part > 0) {
args.putInt("user_id", lower_part); args.putInt("user_id", lower_part);
} else if (lower_part < 0) { } else if (lower_part < 0) {
args.putInt("chat_id", -lower_part); args.putInt("chat_id", -lower_part);
} }
}
} else { } else {
args.putInt("enc_id", (int)(dialog_id >> 32)); args.putInt("enc_id", high_id);
} }
presentFragment(new ChatActivity(args)); presentFragment(new ChatActivity(args));
} }
...@@ -319,7 +334,10 @@ public class MessagesActivity extends BaseFragment implements NotificationCenter ...@@ -319,7 +334,10 @@ public class MessagesActivity extends BaseFragment implements NotificationCenter
AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity()); AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity());
builder.setTitle(LocaleController.getString("AppName", R.string.AppName)); builder.setTitle(LocaleController.getString("AppName", R.string.AppName));
if ((int)selectedDialog < 0) { int lower_id = (int)selectedDialog;
int high_id = (int)(selectedDialog >> 32);
if (lower_id < 0 && high_id != 1) {
builder.setItems(new CharSequence[]{LocaleController.getString("ClearHistory", R.string.ClearHistory), LocaleController.getString("DeleteChat", R.string.DeleteChat)}, new DialogInterface.OnClickListener() { builder.setItems(new CharSequence[]{LocaleController.getString("ClearHistory", R.string.ClearHistory), LocaleController.getString("DeleteChat", R.string.DeleteChat)}, new DialogInterface.OnClickListener() {
@Override @Override
public void onClick(DialogInterface dialog, int which) { public void onClick(DialogInterface dialog, int which) {
...@@ -482,7 +500,15 @@ public class MessagesActivity extends BaseFragment implements NotificationCenter ...@@ -482,7 +500,15 @@ public class MessagesActivity extends BaseFragment implements NotificationCenter
AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity()); AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity());
builder.setTitle(LocaleController.getString("AppName", R.string.AppName)); builder.setTitle(LocaleController.getString("AppName", R.string.AppName));
int lower_part = (int)dialog_id; int lower_part = (int)dialog_id;
int high_id = (int)(dialog_id >> 32);
if (lower_part != 0) { if (lower_part != 0) {
if (high_id == 1) {
TLRPC.Chat chat = MessagesController.getInstance().chats.get(lower_part);
if (chat == null) {
return;
}
builder.setMessage(LocaleController.formatStringSimple(selectAlertString, chat.title));
} else {
if (lower_part > 0) { if (lower_part > 0) {
TLRPC.User user = MessagesController.getInstance().users.get(lower_part); TLRPC.User user = MessagesController.getInstance().users.get(lower_part);
if (user == null) { if (user == null) {
...@@ -496,9 +522,9 @@ public class MessagesActivity extends BaseFragment implements NotificationCenter ...@@ -496,9 +522,9 @@ public class MessagesActivity extends BaseFragment implements NotificationCenter
} }
builder.setMessage(LocaleController.formatStringSimple(selectAlertString, chat.title)); builder.setMessage(LocaleController.formatStringSimple(selectAlertString, chat.title));
} }
}
} else { } else {
int chat_id = (int)(dialog_id >> 32); TLRPC.EncryptedChat chat = MessagesController.getInstance().encryptedChats.get(high_id);
TLRPC.EncryptedChat chat = MessagesController.getInstance().encryptedChats.get(chat_id);
TLRPC.User user = MessagesController.getInstance().users.get(chat.user_id); TLRPC.User user = MessagesController.getInstance().users.get(chat.user_id);
if (user == null) { if (user == null) {
return; return;
......
...@@ -413,6 +413,9 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat ...@@ -413,6 +413,9 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat
imagesByIdsTemp.clear(); imagesByIdsTemp.clear();
needSearchImageInArr = false; needSearchImageInArr = false;
currentIndex = -1; currentIndex = -1;
if (foundIndex >= imagesArr.size()) {
foundIndex = imagesArr.size() - 1;
}
setImageIndex(foundIndex, true); setImageIndex(foundIndex, true);
} else { } else {
if (!cacheEndReached || !arr.isEmpty() && added != 0) { if (!cacheEndReached || !arr.isEmpty() && added != 0) {
...@@ -1384,6 +1387,15 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat ...@@ -1384,6 +1387,15 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat
NotificationCenter.getInstance().addObserver(this, MessagesController.mediaDidLoaded); NotificationCenter.getInstance().addObserver(this, MessagesController.mediaDidLoaded);
NotificationCenter.getInstance().addObserver(this, MessagesController.userPhotosLoaded); NotificationCenter.getInstance().addObserver(this, MessagesController.userPhotosLoaded);
try {
if (windowView.getParent() != null) {
WindowManager wm = (WindowManager) parentActivity.getSystemService(Context.WINDOW_SERVICE);
wm.removeView(windowView);
}
} catch (Exception e) {
FileLog.e("tmessages", e);
}
placeProvider = provider; placeProvider = provider;
WindowManager wm = (WindowManager) parentActivity.getSystemService(Context.WINDOW_SERVICE); WindowManager wm = (WindowManager) parentActivity.getSystemService(Context.WINDOW_SERVICE);
wm.addView(windowView, windowLayoutParams); wm.addView(windowView, windowLayoutParams);
...@@ -1702,8 +1714,8 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat ...@@ -1702,8 +1714,8 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat
return; return;
} }
try { try {
WindowManager wm = (WindowManager) parentActivity.getSystemService(Context.WINDOW_SERVICE);
if (windowView.getParent() != null) { if (windowView.getParent() != null) {
WindowManager wm = (WindowManager) parentActivity.getSystemService(Context.WINDOW_SERVICE);
wm.removeViewImmediate(windowView); wm.removeViewImmediate(windowView);
} }
windowView = null; windowView = null;
...@@ -1730,8 +1742,8 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat ...@@ -1730,8 +1742,8 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat
public void run() { public void run() {
animatingImageView.setImageBitmap(null); animatingImageView.setImageBitmap(null);
try { try {
WindowManager wm = (WindowManager) parentActivity.getSystemService(Context.WINDOW_SERVICE);
if (windowView.getParent() != null) { if (windowView.getParent() != null) {
WindowManager wm = (WindowManager) parentActivity.getSystemService(Context.WINDOW_SERVICE);
wm.removeView(windowView); wm.removeView(windowView);
} }
} catch (Exception e) { } catch (Exception e) {
......
...@@ -161,7 +161,7 @@ public class PopupNotificationActivity extends Activity implements NotificationC ...@@ -161,7 +161,7 @@ public class PopupNotificationActivity extends Activity implements NotificationC
return; return;
} }
NotificationsController.getInstance().popupMessages.remove(currentMessageNum); NotificationsController.getInstance().popupMessages.remove(currentMessageNum);
MessagesController.getInstance().markDialogAsRead(currentMessageObject.getDialogId(), currentMessageObject.messageOwner.id, Math.max(0, currentMessageObject.messageOwner.id), 0, currentMessageObject.messageOwner.date, true); MessagesController.getInstance().markDialogAsRead(currentMessageObject.getDialogId(), currentMessageObject.messageOwner.id, Math.max(0, currentMessageObject.messageOwner.id), 0, currentMessageObject.messageOwner.date, true, true);
currentMessageObject = null; currentMessageObject = null;
getNewMessage(); getNewMessage();
} }
...@@ -874,9 +874,6 @@ public class PopupNotificationActivity extends Activity implements NotificationC ...@@ -874,9 +874,6 @@ public class PopupNotificationActivity extends Activity implements NotificationC
chatActivityEnterView.setFieldFocused(false); chatActivityEnterView.setFieldFocused(false);
} }
ConnectionsManager.getInstance().setAppPaused(true, false); ConnectionsManager.getInstance().setAppPaused(true, false);
if (wakeLock.isHeld()) {
wakeLock.release();
}
} }
@Override @Override
......
...@@ -568,6 +568,9 @@ public class SettingsActivity extends BaseFragment implements NotificationCenter ...@@ -568,6 +568,9 @@ public class SettingsActivity extends BaseFragment implements NotificationCenter
} catch (Exception e) { } catch (Exception e) {
FileLog.e("tmessages", e); FileLog.e("tmessages", e);
} }
ArrayList<TLRPC.User> users = new ArrayList<TLRPC.User>();
users.add(res.user);
MessagesStorage.getInstance().putUsersAndChats(users, null, true, true);
MessagesController.getInstance().users.put(res.user.id, res.user); MessagesController.getInstance().users.put(res.user.id, res.user);
Bundle args = new Bundle(); Bundle args = new Bundle();
args.putInt("user_id", res.user.id); args.putInt("user_id", res.user.id);
...@@ -962,7 +965,7 @@ public class SettingsActivity extends BaseFragment implements NotificationCenter ...@@ -962,7 +965,7 @@ public class SettingsActivity extends BaseFragment implements NotificationCenter
MessagesController.getInstance().unregistedPush(); MessagesController.getInstance().unregistedPush();
MessagesController.getInstance().logOut(); MessagesController.getInstance().logOut();
UserConfig.clearConfig(); UserConfig.clearConfig();
MessagesStorage.getInstance().cleanUp(); MessagesStorage.getInstance().cleanUp(false);
MessagesController.getInstance().cleanUp(); MessagesController.getInstance().cleanUp();
ContactsController.getInstance().deleteAllAppAccounts(); ContactsController.getInstance().deleteAllAppAccounts();
} }
......
...@@ -406,7 +406,8 @@ public class SettingsNotificationsActivity extends BaseFragment implements Notif ...@@ -406,7 +406,8 @@ public class SettingsNotificationsActivity extends BaseFragment implements Notif
} }
public void updateServerNotificationsSettings(boolean group) { public void updateServerNotificationsSettings(boolean group) {
SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("Notifications", Activity.MODE_PRIVATE); //disable global settings sync
/*SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("Notifications", Activity.MODE_PRIVATE);
TLRPC.TL_account_updateNotifySettings req = new TLRPC.TL_account_updateNotifySettings(); TLRPC.TL_account_updateNotifySettings req = new TLRPC.TL_account_updateNotifySettings();
req.settings = new TLRPC.TL_inputPeerNotifySettings(); req.settings = new TLRPC.TL_inputPeerNotifySettings();
req.settings.sound = "default"; req.settings.sound = "default";
...@@ -425,7 +426,7 @@ public class SettingsNotificationsActivity extends BaseFragment implements Notif ...@@ -425,7 +426,7 @@ public class SettingsNotificationsActivity extends BaseFragment implements Notif
public void run(TLObject response, TLRPC.TL_error error) { public void run(TLObject response, TLRPC.TL_error error) {
} }
}); });*/
} }
@Override @Override
......
...@@ -467,18 +467,15 @@ public class VideoEditorActivity extends BaseFragment implements SurfaceHolder.C ...@@ -467,18 +467,15 @@ public class VideoEditorActivity extends BaseFragment implements SurfaceHolder.C
List<Track> tracks = movie.getTracks(); List<Track> tracks = movie.getTracks();
movie.setTracks(new LinkedList<Track>()); movie.setTracks(new LinkedList<Track>());
double startTime = videoTimelineView.getLeftProgress() * videoPlayer.getDuration() / 1000.0; double startTime = 0;
double endTime = videoTimelineView.getRightProgress() * videoPlayer.getDuration() / 1000.0; double endTime = 0;
boolean timeCorrected = false;
for (Track track : tracks) { for (Track track : tracks) {
if (track.getSyncSamples() != null && track.getSyncSamples().length > 0) { if (track.getSyncSamples() != null && track.getSyncSamples().length > 0) {
if (timeCorrected) { double duration = (double)track.getDuration() / (double)track.getTrackMetaData().getTimescale();
throw new RuntimeException("The startTime has already been corrected by another track with SyncSample. Not Supported."); startTime = correctTimeToSyncSample(track, videoTimelineView.getLeftProgress() * duration, false);
} endTime = videoTimelineView.getRightProgress() * duration;
startTime = correctTimeToSyncSample(track, startTime, false); break;
endTime = correctTimeToSyncSample(track, endTime, true);
timeCorrected = true;
} }
} }
...@@ -486,7 +483,7 @@ public class VideoEditorActivity extends BaseFragment implements SurfaceHolder.C ...@@ -486,7 +483,7 @@ public class VideoEditorActivity extends BaseFragment implements SurfaceHolder.C
long currentSample = 0; long currentSample = 0;
double currentTime = 0; double currentTime = 0;
double lastTime = 0; double lastTime = 0;
long startSample = -1; long startSample = 0;
long endSample = -1; long endSample = -1;
for (int i = 0; i < track.getSampleDurations().length; i++) { for (int i = 0; i < track.getSampleDurations().length; i++) {
...@@ -503,9 +500,7 @@ public class VideoEditorActivity extends BaseFragment implements SurfaceHolder.C ...@@ -503,9 +500,7 @@ public class VideoEditorActivity extends BaseFragment implements SurfaceHolder.C
} }
movie.addTrack(new CroppedTrack(track, startSample, endSample)); movie.addTrack(new CroppedTrack(track, startSample, endSample));
} }
long start1 = System.currentTimeMillis();
Container out = new DefaultMp4Builder().build(movie); Container out = new DefaultMp4Builder().build(movie);
long start2 = System.currentTimeMillis();
String fileName = Integer.MIN_VALUE + "_" + UserConfig.lastLocalId + ".mp4"; String fileName = Integer.MIN_VALUE + "_" + UserConfig.lastLocalId + ".mp4";
UserConfig.lastLocalId--; UserConfig.lastLocalId--;
...@@ -524,6 +519,11 @@ public class VideoEditorActivity extends BaseFragment implements SurfaceHolder.C ...@@ -524,6 +519,11 @@ public class VideoEditorActivity extends BaseFragment implements SurfaceHolder.C
} }
} }
// private void startEncodeVideo() {
// MediaExtractor mediaExtractor = new MediaExtractor();
// mediaExtractor.s
// }
private static double correctTimeToSyncSample(Track track, double cutHere, boolean next) { private static double correctTimeToSyncSample(Track track, double cutHere, boolean next) {
double[] timeOfSyncSamples = new double[track.getSyncSamples().length]; double[] timeOfSyncSamples = new double[track.getSyncSamples().length];
long currentSample = 0; long currentSample = 0;
......
...@@ -46,7 +46,7 @@ public class GifDrawable extends Drawable implements Animatable, MediaController ...@@ -46,7 +46,7 @@ public class GifDrawable extends Drawable implements Animatable, MediaController
private static native void renderFrame(int[] pixels, int gifFileInPtr, int[] metaData); private static native void renderFrame(int[] pixels, int gifFileInPtr, int[] metaData);
private static native int openFile(int[] metaData, String filePath); private static native int openFile(int[] metaData, String filePath);
private static native void free(int gifFileInPtr); private static native void free(int gifFileInPtr);
private static native boolean reset(int gifFileInPtr); private static native void reset(int gifFileInPtr);
private static native void setSpeedFactor(int gifFileInPtr, float factor); private static native void setSpeedFactor(int gifFileInPtr, float factor);
private static native String getComment(int gifFileInPtr); private static native String getComment(int gifFileInPtr);
private static native int getLoopCount(int gifFileInPtr); private static native int getLoopCount(int gifFileInPtr);
......
...@@ -75,17 +75,20 @@ public class ImageReceiver { ...@@ -75,17 +75,20 @@ public class ImageReceiver {
if (filter != null) { if (filter != null) {
key += "@" + filter; key += "@" + filter;
} }
Bitmap img; Bitmap img = null;
if (currentPath != null) { if (currentPath != null) {
if (currentPath.equals(key)) { if (currentPath.equals(key)) {
if (currentImage != null) {
return; return;
} else { } else {
img = FileLoader.getInstance().getImageFromMemory(path, httpUrl, this, filter, true); img = FileLoader.getInstance().getImageFromMemory(path, httpUrl, this, filter);
recycleBitmap(img);
} }
} else { } else {
img = FileLoader.getInstance().getImageFromMemory(path, httpUrl, this, filter, true); img = FileLoader.getInstance().getImageFromMemory(path, httpUrl, this, filter);
recycleBitmap(img);
}
} }
img = FileLoader.getInstance().getImageFromMemory(path, httpUrl, this, filter);
currentPath = key; currentPath = key;
last_path = path; last_path = path;
last_httpUrl = httpUrl; last_httpUrl = httpUrl;
...@@ -132,6 +135,9 @@ public class ImageReceiver { ...@@ -132,6 +135,9 @@ public class ImageReceiver {
last_filter = null; last_filter = null;
currentImage = null; currentImage = null;
last_size = 0; last_size = 0;
if (parentView != null) {
parentView.invalidate();
}
} }
public void setImageBitmap(Drawable bitmap) { public void setImageBitmap(Drawable bitmap) {
...@@ -145,6 +151,9 @@ public class ImageReceiver { ...@@ -145,6 +151,9 @@ public class ImageReceiver {
last_httpUrl = null; last_httpUrl = null;
last_filter = null; last_filter = null;
last_size = 0; last_size = 0;
if (parentView != null) {
parentView.invalidate();
}
} }
public void clearImage() { public void clearImage() {
......
TMessagesProj/src/main/res/drawable-hdpi/playvideo.png

2.59 KB | W: | H:

TMessagesProj/src/main/res/drawable-hdpi/playvideo.png

2.3 KB | W: | H:

TMessagesProj/src/main/res/drawable-hdpi/playvideo.png
TMessagesProj/src/main/res/drawable-hdpi/playvideo.png
TMessagesProj/src/main/res/drawable-hdpi/playvideo.png
TMessagesProj/src/main/res/drawable-hdpi/playvideo.png
  • 2-up
  • Swipe
  • Onion skin
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment