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 {
minSdkVersion 8
targetSdkVersion 19
versionCode 221
versionCode 222
versionName "1.4.10"
}
}

View file

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

View file

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

View file

@ -1400,7 +1400,7 @@ public class MessagesStorage {
fromUser.add(message.fwd_from_id);
}
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;
}
if (lower_id == 0 && !cursor.isNull(5)) {

View file

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