Fixed files uploading in secret chats, allow move application to sd card(not tested)

This commit is contained in:
DrKLO 2014-04-04 03:22:09 +04:00
parent 05471c4395
commit cea585cd39
5 changed files with 18 additions and 17 deletions

View File

@ -82,7 +82,7 @@ android {
defaultConfig { defaultConfig {
minSdkVersion 8 minSdkVersion 8
targetSdkVersion 19 targetSdkVersion 19
versionCode 221 versionCode 222
versionName "1.4.10" versionName "1.4.10"
} }
} }

View File

@ -45,7 +45,8 @@
android:theme="@style/Theme.TMessages.Start" android:theme="@style/Theme.TMessages.Start"
android:name="org.telegram.ui.ApplicationLoader" android:name="org.telegram.ui.ApplicationLoader"
android:hardwareAccelerated="true" android:hardwareAccelerated="true"
android:largeHeap="true"> android:largeHeap="true"
android:installLocation="auto">
<activity <activity
android:name="org.telegram.ui.LaunchActivity" android:name="org.telegram.ui.LaunchActivity"

View File

@ -130,13 +130,13 @@ public class FileUploadOperation {
isLastPart = true; isLastPart = true;
} }
sendBuffer.writeRaw(readBuffer, 0, readed); sendBuffer.writeRaw(readBuffer, 0, readed);
sendBuffer.rewind();
if (key != null) { if (key != null) {
for (int a = 0; a < toAdd; a++) { for (int a = 0; a < toAdd; a++) {
sendBuffer.writeByte(0); sendBuffer.writeByte(0);
} }
Utilities.aesIgeEncryption2(sendBuffer.buffer, key, iv, true, true, readed + toAdd); Utilities.aesIgeEncryption2(sendBuffer.buffer, key, iv, true, true, readed + toAdd);
} }
sendBuffer.rewind();
if (!isBigFile) { if (!isBigFile) {
mdEnc.update(sendBuffer.buffer); mdEnc.update(sendBuffer.buffer);
} }

View File

@ -1400,7 +1400,7 @@ public class MessagesStorage {
fromUser.add(message.fwd_from_id); fromUser.add(message.fwd_from_id);
} }
message.send_state = cursor.intValue(2); message.send_state = cursor.intValue(2);
if (!message.unread || message.id > 0) { if (!message.unread && lower_id != 0 || message.id > 0) {
message.send_state = 0; message.send_state = 0;
} }
if (lower_id == 0 && !cursor.isNull(5)) { if (lower_id == 0 && !cursor.isNull(5)) {

View File

@ -34,6 +34,7 @@ public class ImageReceiver {
public Integer TAG = null; public Integer TAG = null;
public WeakReference<View> parentView = null; public WeakReference<View> parentView = null;
public int imageX = 0, imageY = 0, imageW = 0, imageH = 0; public int imageX = 0, imageY = 0, imageW = 0, imageH = 0;
private boolean selfSetting = false;
public void setImage(TLRPC.FileLocation path, String filter, Drawable placeholder) { public void setImage(TLRPC.FileLocation path, String filter, Drawable placeholder) {
setImage(path, null, filter, placeholder, 0); setImage(path, null, filter, placeholder, 0);
@ -91,7 +92,9 @@ public class ImageReceiver {
isPlaceholder = true; isPlaceholder = true;
FileLoader.getInstance().loadImage(path, httpUrl, this, filter, true, size); FileLoader.getInstance().loadImage(path, httpUrl, this, filter, true, size);
} else { } else {
selfSetting = true;
setImageBitmap(img, currentPath); setImageBitmap(img, currentPath);
selfSetting = false;
} }
} }
@ -102,7 +105,7 @@ public class ImageReceiver {
isPlaceholder = false; isPlaceholder = false;
FileLoader.getInstance().incrementUseCount(currentPath); FileLoader.getInstance().incrementUseCount(currentPath);
currentImage = new BitmapDrawable(null, bitmap); currentImage = new BitmapDrawable(null, bitmap);
if (parentView.get() != null) { if (!selfSetting && parentView.get() != null) {
if (imageW != 0) { if (imageW != 0) {
parentView.get().invalidate(imageX, imageY, imageX + imageW, imageY + imageH); parentView.get().invalidate(imageX, imageY, imageX + imageW, imageY + imageH);
} else { } else {
@ -112,31 +115,28 @@ public class ImageReceiver {
} }
public void setImageBitmap(Bitmap bitmap) { public void setImageBitmap(Bitmap bitmap) {
FileLoader.getInstance().cancelLoadingForImageView(this);
recycleBitmap(null);
last_placeholder = new BitmapDrawable(null, bitmap);
currentPath = null; currentPath = null;
last_path = null; last_path = null;
last_httpUrl = null; last_httpUrl = null;
last_filter = null; last_filter = null;
last_placeholder = null; currentImage = null;
last_size = 0; last_size = 0;
FileLoader.getInstance().cancelLoadingForImageView(this);
if (bitmap != null) {
recycleBitmap(null);
currentImage = new BitmapDrawable(null, bitmap);
}
} }
public void setImageBitmap(Drawable bitmap) { public void setImageBitmap(Drawable bitmap) {
FileLoader.getInstance().cancelLoadingForImageView(this);
recycleBitmap(null);
last_placeholder = bitmap;
isPlaceholder = true;
currentPath = null; currentPath = null;
currentImage = null;
last_path = null; last_path = null;
last_httpUrl = null; last_httpUrl = null;
last_filter = null; last_filter = null;
last_placeholder = null;
last_size = 0; last_size = 0;
FileLoader.getInstance().cancelLoadingForImageView(this);
if (bitmap != null) {
recycleBitmap(null);
currentImage = bitmap;
}
} }
public void clearImage() { public void clearImage() {