Broadcasts, updated gif lib, blur image\video preview
Note: untested, don’t upload to market
@ -83,7 +83,7 @@ android {
|
||||
defaultConfig {
|
||||
minSdkVersion 8
|
||||
targetSdkVersion 19
|
||||
versionCode 290
|
||||
versionName "1.6.2"
|
||||
versionCode 291
|
||||
versionName "1.7.0"
|
||||
}
|
||||
}
|
||||
|
@ -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_CPPFLAGS := -DBSD=1 -ffast-math -O2 -funroll-loops
|
||||
#LOCAL_LDLIBS := -llog
|
||||
LOCAL_LDLIBS := -ljnigraphics
|
||||
|
||||
LOCAL_SRC_FILES := \
|
||||
./opus/src/opus.c \
|
||||
|
@ -1,4 +1,4 @@
|
||||
//tanks to https://github.com/koral--/android-gif-drawable
|
||||
//thanks to https://github.com/koral--/android-gif-drawable
|
||||
/*
|
||||
MIT License
|
||||
Copyright (c)
|
||||
@ -73,7 +73,7 @@ typedef struct {
|
||||
|
||||
typedef struct {
|
||||
unsigned int duration;
|
||||
short transpIndex;
|
||||
int transpIndex;
|
||||
unsigned char disposalMethod;
|
||||
} FrameInfo;
|
||||
|
||||
@ -132,8 +132,9 @@ static int fileRewindFun(GifInfo *info) {
|
||||
static unsigned long getRealTime() {
|
||||
struct timespec ts;
|
||||
const clockid_t id = CLOCK_MONOTONIC;
|
||||
if (id != (clockid_t) - 1 && clock_gettime(id, &ts) != -1)
|
||||
if (id != (clockid_t) - 1 && clock_gettime(id, &ts) != -1) {
|
||||
return ts.tv_sec * 1000 + ts.tv_nsec / 1000000;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
@ -195,7 +196,7 @@ static void packARGB32(argb *pixel, GifByteType alpha, GifByteType red, GifByteT
|
||||
}
|
||||
|
||||
static void getColorFromTable(int idx, argb *dst, const ColorMapObject *cmap) {
|
||||
char colIdx = idx >= cmap->ColorCount ? 0 : idx;
|
||||
int colIdx = (idx >= cmap->ColorCount) ? 0 : idx;
|
||||
GifColorType *col = &cmap->Colors[colIdx];
|
||||
packARGB32(dst, 0xFF, col->Red, col->Green, col->Blue);
|
||||
}
|
||||
@ -218,7 +219,7 @@ static inline bool setupBackupBmp(GifInfo *info, short transpIndex) {
|
||||
if (transpIndex == -1) {
|
||||
getColorFromTable(fGIF->SBackGroundColor, &paintingColor, fGIF->SColorMap);
|
||||
} else {
|
||||
packARGB32(&paintingColor,0,0,0,0);
|
||||
packARGB32(&paintingColor, 0, 0, 0, 0);
|
||||
}
|
||||
eraseColor(info->backupPtr, fGIF->SWidth, fGIF->SHeight, paintingColor);
|
||||
return true;
|
||||
@ -231,14 +232,15 @@ static int readExtensions(int ExtFunction, GifByteType *ExtData, GifInfo *info)
|
||||
if (ExtFunction == GRAPHICS_EXT_FUNC_CODE && ExtData[0] == 4) {
|
||||
FrameInfo *fi = &info->infos[info->gifFilePtr->ImageCount];
|
||||
fi->transpIndex = -1;
|
||||
char *b = (char *)ExtData + 1;
|
||||
char *b = (char*) ExtData + 1;
|
||||
short delay = ((b[2] << 8) | b[1]);
|
||||
fi->duration = delay > 1 ? delay * 10 : 100;
|
||||
fi->disposalMethod = ((b[0] >> 2) & 7);
|
||||
if (ExtData[1] & 1)
|
||||
fi->transpIndex = (short) b[3];
|
||||
if (ExtData[1] & 1) {
|
||||
fi->transpIndex = 0xff & b[3];
|
||||
}
|
||||
if (fi->disposalMethod == 3 && info->backupPtr == NULL) {
|
||||
if (!setupBackupBmp(info,fi->transpIndex)) {
|
||||
if (!setupBackupBmp(info, fi->transpIndex)) {
|
||||
return GIF_ERROR;
|
||||
}
|
||||
}
|
||||
@ -260,7 +262,7 @@ static int readExtensions(int ExtFunction, GifByteType *ExtData, GifInfo *info)
|
||||
return GIF_OK;
|
||||
}
|
||||
|
||||
static int DDGifSlurp(GifFileType *GifFile, GifInfo *info, bool shouldDecode) {
|
||||
static int DDGifSlurp(GifFileType *GifFile, GifInfo* info, bool shouldDecode) {
|
||||
GifRecordType RecordType;
|
||||
GifByteType *ExtData;
|
||||
int codeSize;
|
||||
@ -268,12 +270,13 @@ static int DDGifSlurp(GifFileType *GifFile, GifInfo *info, bool shouldDecode) {
|
||||
size_t ImageSize;
|
||||
do {
|
||||
if (DGifGetRecordType(GifFile, &RecordType) == GIF_ERROR) {
|
||||
return GIF_ERROR;
|
||||
return (GIF_ERROR);
|
||||
}
|
||||
switch (RecordType) {
|
||||
case IMAGE_DESC_RECORD_TYPE: {
|
||||
case IMAGE_DESC_RECORD_TYPE:
|
||||
|
||||
if (DGifGetImageDesc(GifFile, !shouldDecode) == GIF_ERROR) {
|
||||
return GIF_ERROR;
|
||||
return (GIF_ERROR);
|
||||
}
|
||||
int i = shouldDecode ? info->currentIndex : GifFile->ImageCount - 1;
|
||||
SavedImage *sp = &GifFile->SavedImages[i];
|
||||
@ -302,12 +305,13 @@ static int DDGifSlurp(GifFileType *GifFile, GifInfo *info, bool shouldDecode) {
|
||||
}
|
||||
} else {
|
||||
if (DGifGetLine(GifFile, sp->RasterBits, ImageSize) == GIF_ERROR) {
|
||||
return GIF_ERROR;
|
||||
return (GIF_ERROR);
|
||||
}
|
||||
}
|
||||
if (info->currentIndex >= GifFile->ImageCount - 1) {
|
||||
if (info->loopCount > 0)
|
||||
if (info->loopCount > 0) {
|
||||
info->currentLoop++;
|
||||
}
|
||||
if (fileRewindFun(info) != 0) {
|
||||
info->gifFilePtr->Error = D_GIF_ERR_READ_FAILED;
|
||||
return GIF_ERROR;
|
||||
@ -316,31 +320,34 @@ static int DDGifSlurp(GifFileType *GifFile, GifInfo *info, bool shouldDecode) {
|
||||
return GIF_OK;
|
||||
} else {
|
||||
if (DGifGetCode(GifFile, &codeSize, &ExtData) == GIF_ERROR) {
|
||||
return GIF_ERROR;
|
||||
return (GIF_ERROR);
|
||||
}
|
||||
while (ExtData) {
|
||||
while (ExtData != NULL) {
|
||||
if (DGifGetCodeNext(GifFile, &ExtData) == GIF_ERROR) {
|
||||
return GIF_ERROR;
|
||||
return (GIF_ERROR);
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case EXTENSION_RECORD_TYPE: {
|
||||
case EXTENSION_RECORD_TYPE:
|
||||
if (DGifGetExtension(GifFile, &ExtFunction, &ExtData) == GIF_ERROR) {
|
||||
return GIF_ERROR;
|
||||
return (GIF_ERROR);
|
||||
}
|
||||
|
||||
if (!shouldDecode) {
|
||||
info->infos = realloc(info->infos, (GifFile->ImageCount + 1) * sizeof(FrameInfo));
|
||||
FrameInfo *tmpInfos = realloc(info->infos, (GifFile->ImageCount + 1) * sizeof(FrameInfo));
|
||||
if (tmpInfos == NULL) {
|
||||
return GIF_ERROR;
|
||||
}
|
||||
info->infos = tmpInfos;
|
||||
if (readExtensions(ExtFunction, ExtData, info) == GIF_ERROR) {
|
||||
return GIF_ERROR;
|
||||
}
|
||||
}
|
||||
while (ExtData) {
|
||||
while (ExtData != NULL) {
|
||||
if (DGifGetExtensionNext(GifFile, &ExtData, &ExtFunction) == GIF_ERROR) {
|
||||
return GIF_ERROR;
|
||||
return (GIF_ERROR);
|
||||
}
|
||||
if (!shouldDecode) {
|
||||
if (readExtensions(ExtFunction, ExtData, info) == GIF_ERROR) {
|
||||
@ -349,22 +356,23 @@ static int DDGifSlurp(GifFileType *GifFile, GifInfo *info, bool shouldDecode) {
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case TERMINATE_RECORD_TYPE:
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
} while (RecordType != TERMINATE_RECORD_TYPE);
|
||||
|
||||
bool ok = true;
|
||||
if (shouldDecode) {
|
||||
ok = (fileRewindFun(info) == 0);
|
||||
}
|
||||
if (ok) {
|
||||
return GIF_OK;
|
||||
return (GIF_OK);
|
||||
} else {
|
||||
info->gifFilePtr->Error = D_GIF_ERR_READ_FAILED;
|
||||
return GIF_ERROR;
|
||||
return (GIF_ERROR);
|
||||
}
|
||||
}
|
||||
|
||||
@ -381,7 +389,7 @@ static argb *getAddr(argb *bm, int width, int left, int top) {
|
||||
}
|
||||
|
||||
static void blitNormal(argb *bm, int width, int height, const SavedImage *frame, const ColorMapObject *cmap, int transparent) {
|
||||
const unsigned char *src = (unsigned char *)frame->RasterBits;
|
||||
const unsigned char* src = (unsigned char*) frame->RasterBits;
|
||||
argb *dst = getAddr(bm, width, frame->ImageDesc.Left, frame->ImageDesc.Top);
|
||||
GifWord copyWidth = frame->ImageDesc.Width;
|
||||
if (frame->ImageDesc.Left + copyWidth > width) {
|
||||
@ -393,9 +401,6 @@ static void blitNormal(argb *bm, int width, int height, const SavedImage *frame,
|
||||
copyHeight = height - frame->ImageDesc.Top;
|
||||
}
|
||||
|
||||
int srcPad, dstPad;
|
||||
dstPad = width - copyWidth;
|
||||
srcPad = frame->ImageDesc.Width - copyWidth;
|
||||
for (; copyHeight > 0; copyHeight--) {
|
||||
copyLine(dst, src, cmap, transparent, copyWidth);
|
||||
src += frame->ImageDesc.Width;
|
||||
@ -404,7 +409,7 @@ static void blitNormal(argb *bm, int width, int height, const SavedImage *frame,
|
||||
}
|
||||
|
||||
static void fillRect(argb *bm, int bmWidth, int bmHeight, GifWord left, GifWord top, GifWord width, GifWord height, argb col) {
|
||||
uint32_t *dst = (uint32_t *)getAddr(bm, bmWidth, left, top);
|
||||
uint32_t* dst = (uint32_t*) getAddr(bm, bmWidth, left, top);
|
||||
GifWord copyWidth = width;
|
||||
if (left + copyWidth > bmWidth) {
|
||||
copyWidth = bmWidth - left;
|
||||
@ -414,7 +419,7 @@ static void fillRect(argb *bm, int bmWidth, int bmHeight, GifWord left, GifWord
|
||||
if (top + copyHeight > bmHeight) {
|
||||
copyHeight = bmHeight - top;
|
||||
}
|
||||
uint32_t *pColor = (uint32_t *)(&col);
|
||||
uint32_t* pColor = (uint32_t *) (&col);
|
||||
for (; copyHeight > 0; copyHeight--) {
|
||||
memset(dst, *pColor, copyWidth * sizeof(argb));
|
||||
dst += bmWidth;
|
||||
@ -424,12 +429,11 @@ static void fillRect(argb *bm, int bmWidth, int bmHeight, GifWord left, GifWord
|
||||
static void drawFrame(argb *bm, int bmWidth, int bmHeight, const SavedImage *frame, const ColorMapObject *cmap, short transpIndex) {
|
||||
if (frame->ImageDesc.ColorMap != NULL) {
|
||||
cmap = frame->ImageDesc.ColorMap;
|
||||
if (cmap == NULL || cmap->ColorCount != (1 << cmap->BitsPerPixel)) {
|
||||
if (cmap->ColorCount != (1 << cmap->BitsPerPixel)) {
|
||||
cmap = defaultCmap;
|
||||
}
|
||||
}
|
||||
|
||||
blitNormal(bm, bmWidth, bmHeight, frame, cmap, (int) transpIndex);
|
||||
blitNormal(bm, bmWidth, bmHeight, frame, cmap, transpIndex);
|
||||
}
|
||||
|
||||
static bool checkIfCover(const SavedImage *target, const SavedImage *covered) {
|
||||
@ -445,30 +449,28 @@ static bool checkIfCover(const SavedImage *target, const SavedImage *covered) {
|
||||
}
|
||||
|
||||
static inline void disposeFrameIfNeeded(argb *bm, GifInfo *info, unsigned int idx) {
|
||||
argb *backup = info->backupPtr;
|
||||
argb* backup = info->backupPtr;
|
||||
argb color;
|
||||
packARGB32(&color, 0, 0, 0, 0);
|
||||
GifFileType *fGif = info->gifFilePtr;
|
||||
SavedImage *cur = &fGif->SavedImages[idx - 1];
|
||||
SavedImage *next = &fGif->SavedImages[idx];
|
||||
SavedImage* cur = &fGif->SavedImages[idx - 1];
|
||||
SavedImage* next = &fGif->SavedImages[idx];
|
||||
bool curTrans = info->infos[idx - 1].transpIndex != -1;
|
||||
int curDisposal = info->infos[idx - 1].disposalMethod;
|
||||
bool nextTrans = info->infos[idx].transpIndex != -1;
|
||||
int nextDisposal = info->infos[idx].disposalMethod;
|
||||
|
||||
argb *tmp;
|
||||
if ((curDisposal == 2 || curDisposal == 3) && (nextTrans || !checkIfCover(next, cur))) {
|
||||
switch (curDisposal) {
|
||||
case 2: {
|
||||
case 2:
|
||||
|
||||
fillRect(bm, fGif->SWidth, fGif->SHeight, cur->ImageDesc.Left, cur->ImageDesc.Top, cur->ImageDesc.Width, cur->ImageDesc.Height, color);
|
||||
}
|
||||
break;
|
||||
|
||||
case 3: {
|
||||
case 3:
|
||||
tmp = bm;
|
||||
bm = backup;
|
||||
backup = tmp;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -478,27 +480,25 @@ static inline void disposeFrameIfNeeded(argb *bm, GifInfo *info, unsigned int id
|
||||
}
|
||||
}
|
||||
|
||||
static jboolean reset(GifInfo *info) {
|
||||
static void reset(GifInfo *info) {
|
||||
if (fileRewindFun(info) != 0) {
|
||||
return JNI_FALSE;
|
||||
return;
|
||||
}
|
||||
info->nextStartTime = 0;
|
||||
info->currentLoop = -1;
|
||||
info->currentIndex = -1;
|
||||
return JNI_TRUE;
|
||||
}
|
||||
|
||||
static void getBitmap(argb *bm, GifInfo *info) {
|
||||
GifFileType *fGIF = info->gifFilePtr;
|
||||
GifFileType* fGIF = info->gifFilePtr;
|
||||
|
||||
argb paintingColor;
|
||||
int i = info->currentIndex;
|
||||
if (DDGifSlurp(fGIF, info, true) == GIF_ERROR) {
|
||||
return; //TODO add leniency support
|
||||
return;
|
||||
}
|
||||
SavedImage *cur = &fGIF->SavedImages[i];
|
||||
|
||||
short transpIndex = info->infos[i].transpIndex;
|
||||
SavedImage* cur = &fGIF->SavedImages[i];
|
||||
int transpIndex = info->infos[i].transpIndex;
|
||||
if (i == 0) {
|
||||
if (transpIndex == -1) {
|
||||
getColorFromTable(fGIF->SBackGroundColor, &paintingColor, fGIF->SColorMap);
|
||||
@ -513,11 +513,14 @@ static void getBitmap(argb *bm, GifInfo *info) {
|
||||
}
|
||||
|
||||
static void setMetaData(int width, int height, int ImageCount, int errorCode, JNIEnv *env, jintArray metaData) {
|
||||
jint *ints = (*env)->GetIntArrayElements(env, metaData, 0);
|
||||
*ints++ = width;
|
||||
*ints++ = height;
|
||||
*ints++ = ImageCount;
|
||||
*ints = errorCode;
|
||||
jint *const ints = (*env)->GetIntArrayElements(env, metaData, 0);
|
||||
if (ints == NULL) {
|
||||
return;
|
||||
}
|
||||
ints[0] = width;
|
||||
ints[1] = height;
|
||||
ints[2] = ImageCount;
|
||||
ints[3] = errorCode;
|
||||
(*env)->ReleaseIntArrayElements(env, metaData, ints, 0);
|
||||
}
|
||||
|
||||
@ -554,9 +557,6 @@ static jint open(GifFileType *GifFileIn, int Error, int startPos, JNIEnv *env, j
|
||||
info->speedFactor = 1.0;
|
||||
info->rasterBits = calloc(GifFileIn->SHeight * GifFileIn->SWidth, sizeof(GifPixelType));
|
||||
info->infos = malloc(sizeof(FrameInfo));
|
||||
info->infos->duration = 0;
|
||||
info->infos->disposalMethod = 0;
|
||||
info->infos->transpIndex = -1;
|
||||
info->backupPtr = NULL;
|
||||
|
||||
if (info->rasterBits == NULL || info->infos == NULL) {
|
||||
@ -564,15 +564,18 @@ static jint open(GifFileType *GifFileIn, int Error, int startPos, JNIEnv *env, j
|
||||
setMetaData(width, height, 0, D_GIF_ERR_NOT_ENOUGH_MEM, env, metaData);
|
||||
return (jint) NULL;
|
||||
}
|
||||
|
||||
if (DDGifSlurp(GifFileIn, info, false) == GIF_ERROR) {
|
||||
Error = GifFileIn->Error;
|
||||
}
|
||||
info->infos->duration = 0;
|
||||
info->infos->disposalMethod = 0;
|
||||
info->infos->transpIndex = -1;
|
||||
if (GifFileIn->SColorMap == NULL || GifFileIn->SColorMap->ColorCount != (1 << GifFileIn->SColorMap->BitsPerPixel)) {
|
||||
GifFreeMapObject(GifFileIn->SColorMap);
|
||||
GifFileIn->SColorMap = defaultCmap;
|
||||
}
|
||||
|
||||
DDGifSlurp(GifFileIn, info, false);
|
||||
|
||||
int imgCount = GifFileIn->ImageCount;
|
||||
|
||||
if (imgCount < 1) {
|
||||
Error = D_GIF_ERR_NO_FRAMES;
|
||||
}
|
||||
@ -583,7 +586,6 @@ static jint open(GifFileType *GifFileIn, int Error, int startPos, JNIEnv *env, j
|
||||
cleanUp(info);
|
||||
}
|
||||
setMetaData(width, height, imgCount, Error, env, metaData);
|
||||
|
||||
return (jint)(Error == 0 ? info : NULL);
|
||||
}
|
||||
|
||||
@ -600,12 +602,12 @@ JNIEXPORT jlong JNICALL Java_org_telegram_ui_Views_GifDrawable_getAllocationByte
|
||||
return sum;
|
||||
}
|
||||
|
||||
JNIEXPORT jboolean JNICALL Java_org_telegram_ui_Views_GifDrawable_reset(JNIEnv *env, jclass class, jobject gifInfo) {
|
||||
JNIEXPORT void JNICALL Java_org_telegram_ui_Views_GifDrawable_reset(JNIEnv *env, jclass class, jobject gifInfo) {
|
||||
GifInfo *info = (GifInfo *)gifInfo;
|
||||
if (info == NULL) {
|
||||
return JNI_FALSE;
|
||||
return;
|
||||
}
|
||||
return reset(info);
|
||||
reset(info);
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL Java_org_telegram_ui_Views_GifDrawable_setSpeedFactor(JNIEnv *env, jclass class, jobject gifInfo, jfloat factor) {
|
||||
@ -618,7 +620,7 @@ JNIEXPORT void JNICALL Java_org_telegram_ui_Views_GifDrawable_setSpeedFactor(JNI
|
||||
|
||||
JNIEXPORT void JNICALL Java_org_telegram_ui_Views_GifDrawable_seekToTime(JNIEnv *env, jclass class, jobject gifInfo, jint desiredPos, jintArray jPixels) {
|
||||
GifInfo *info = (GifInfo *)gifInfo;
|
||||
if (info == NULL) {
|
||||
if (info == NULL || jPixels == NULL) {
|
||||
return;
|
||||
}
|
||||
int imgCount = info->gifFilePtr->ImageCount;
|
||||
@ -643,15 +645,19 @@ JNIEXPORT void JNICALL Java_org_telegram_ui_Views_GifDrawable_seekToTime(JNIEnv
|
||||
if (i == imgCount - 1 && lastFrameRemainder > info->infos[i].duration) {
|
||||
lastFrameRemainder = info->infos[i].duration;
|
||||
}
|
||||
info->lastFrameReaminder = lastFrameRemainder;
|
||||
if (i > info->currentIndex) {
|
||||
jint *pixels = (*env)->GetIntArrayElements(env, jPixels, 0);
|
||||
jint *const pixels = (*env)->GetIntArrayElements(env, jPixels, 0);
|
||||
if (pixels == NULL) {
|
||||
return;
|
||||
}
|
||||
while (info->currentIndex <= i) {
|
||||
info->currentIndex++;
|
||||
getBitmap((argb *)pixels, info);
|
||||
getBitmap((argb*) pixels, info);
|
||||
}
|
||||
(*env)->ReleaseIntArrayElements(env, jPixels, pixels, 0);
|
||||
}
|
||||
info->lastFrameReaminder = lastFrameRemainder;
|
||||
|
||||
if (info->speedFactor == 1.0) {
|
||||
info->nextStartTime = getRealTime() + lastFrameRemainder;
|
||||
} else {
|
||||
@ -661,7 +667,7 @@ JNIEXPORT void JNICALL Java_org_telegram_ui_Views_GifDrawable_seekToTime(JNIEnv
|
||||
|
||||
JNIEXPORT void JNICALL Java_org_telegram_ui_Views_GifDrawable_seekToFrame(JNIEnv *env, jclass class, jobject gifInfo, jint desiredIdx, jintArray jPixels) {
|
||||
GifInfo *info = (GifInfo *)gifInfo;
|
||||
if (info == NULL) {
|
||||
if (info == NULL|| jPixels==NULL) {
|
||||
return;
|
||||
}
|
||||
if (desiredIdx <= info->currentIndex) {
|
||||
@ -673,15 +679,19 @@ JNIEXPORT void JNICALL Java_org_telegram_ui_Views_GifDrawable_seekToFrame(JNIEnv
|
||||
return;
|
||||
}
|
||||
|
||||
jint *const pixels = (*env)->GetIntArrayElements(env, jPixels, 0);
|
||||
if (pixels == NULL) {
|
||||
return;
|
||||
}
|
||||
|
||||
info->lastFrameReaminder = 0;
|
||||
if (desiredIdx >= imgCount) {
|
||||
desiredIdx = imgCount - 1;
|
||||
}
|
||||
|
||||
info->lastFrameReaminder = 0;
|
||||
jint *pixels = (*env)->GetIntArrayElements(env, jPixels, 0);
|
||||
while (info->currentIndex < desiredIdx) {
|
||||
info->currentIndex++;
|
||||
getBitmap((argb *)pixels, info);
|
||||
getBitmap((argb *) pixels, info);
|
||||
}
|
||||
(*env)->ReleaseIntArrayElements(env, jPixels, pixels, 0);
|
||||
if (info->speedFactor == 1.0) {
|
||||
@ -689,16 +699,13 @@ JNIEXPORT void JNICALL Java_org_telegram_ui_Views_GifDrawable_seekToFrame(JNIEnv
|
||||
} else {
|
||||
info->nextStartTime = getRealTime() + info->infos[info->currentIndex].duration * info->speedFactor;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL Java_org_telegram_ui_Views_GifDrawable_renderFrame(JNIEnv *env, jclass class, jintArray jPixels, jobject gifInfo, jintArray metaData) {
|
||||
|
||||
GifInfo *info = (GifInfo *)gifInfo;
|
||||
if (info == NULL) {
|
||||
if (info == NULL || jPixels == NULL) {
|
||||
return;
|
||||
}
|
||||
|
||||
bool needRedraw = false;
|
||||
unsigned long rt = getRealTime();
|
||||
|
||||
@ -708,23 +715,39 @@ JNIEXPORT void JNICALL Java_org_telegram_ui_Views_GifDrawable_renderFrame(JNIEnv
|
||||
}
|
||||
needRedraw = true;
|
||||
}
|
||||
jint *rawMetaData = (*env)->GetIntArrayElements(env, metaData, 0);
|
||||
jint *const rawMetaData = (*env)->GetIntArrayElements(env, metaData, 0);
|
||||
if (rawMetaData == NULL) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (needRedraw) {
|
||||
jint *pixels = (*env)->GetIntArrayElements(env, jPixels, 0);
|
||||
jint *const pixels = (*env)->GetIntArrayElements(env, jPixels, 0);
|
||||
if (pixels == NULL) {
|
||||
(*env)->ReleaseIntArrayElements(env, metaData, rawMetaData, 0);
|
||||
return;
|
||||
}
|
||||
getBitmap((argb *)pixels, info);
|
||||
rawMetaData[3] = info->gifFilePtr->Error;
|
||||
|
||||
(*env)->ReleaseIntArrayElements(env, jPixels, pixels, 0);
|
||||
|
||||
int scaledDuration = info->infos[info->currentIndex].duration;
|
||||
unsigned int scaledDuration = info->infos[info->currentIndex].duration;
|
||||
if (info->speedFactor != 1.0) {
|
||||
scaledDuration /= info->speedFactor;
|
||||
if (scaledDuration<=0) {
|
||||
scaledDuration=1;
|
||||
} else if (scaledDuration > INT_MAX) {
|
||||
scaledDuration = INT_MAX;
|
||||
}
|
||||
}
|
||||
info->nextStartTime = rt + scaledDuration;
|
||||
rawMetaData[4] = scaledDuration;
|
||||
} else {
|
||||
rawMetaData[4] = (int) (rt - info->nextStartTime);
|
||||
long delay = info->nextStartTime-rt;
|
||||
if (delay < 0) {
|
||||
rawMetaData[4] = -1;
|
||||
} else {
|
||||
rawMetaData[4] = (int) delay;
|
||||
}
|
||||
}
|
||||
(*env)->ReleaseIntArrayElements(env, metaData, rawMetaData, 0);
|
||||
}
|
||||
@ -794,9 +817,6 @@ JNIEXPORT void JNICALL Java_org_telegram_ui_Views_GifDrawable_saveRemainder(JNIE
|
||||
return;
|
||||
}
|
||||
info->lastFrameReaminder = getRealTime() - info->nextStartTime;
|
||||
if (info->lastFrameReaminder > 0) {
|
||||
info->lastFrameReaminder = 0;
|
||||
}
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL Java_org_telegram_ui_Views_GifDrawable_restoreRemainder(JNIEnv *env, jclass class, jobject gifInfo) {
|
||||
@ -814,7 +834,7 @@ JNIEXPORT jint JNICALL Java_org_telegram_ui_Views_GifDrawable_openFile(JNIEnv *e
|
||||
return (jint) NULL;
|
||||
}
|
||||
|
||||
const char *fname = (*env)->GetStringUTFChars(env, jfname, 0);
|
||||
const char *const fname = (*env)->GetStringUTFChars(env, jfname, 0);
|
||||
FILE *file = fopen(fname, "rb");
|
||||
(*env)->ReleaseStringUTFChars(env, jfname, fname);
|
||||
if (file == NULL) {
|
||||
|
@ -2,8 +2,101 @@
|
||||
#include <stdio.h>
|
||||
#include <setjmp.h>
|
||||
#include <libjpeg/jpeglib.h>
|
||||
#include <android/bitmap.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 {
|
||||
struct jpeg_error_mgr pub;
|
||||
jmp_buf setjmp_buffer;
|
||||
@ -16,6 +109,15 @@ METHODDEF(void) my_error_exit(j_common_ptr cinfo) {
|
||||
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) {
|
||||
|
||||
int i;
|
||||
|
@ -93,6 +93,9 @@ public class MessagesController implements NotificationCenter.NotificationCenter
|
||||
public boolean enableJoined = true;
|
||||
public int fontSize = AndroidUtilities.dp(16);
|
||||
|
||||
private TLRPC.ChatParticipants currentChatInfo = null;
|
||||
private int chatParticipantsId = 0;
|
||||
|
||||
private class UserActionUpdates extends TLRPC.Updates {
|
||||
|
||||
}
|
||||
@ -118,7 +121,7 @@ public class MessagesController implements NotificationCenter.NotificationCenter
|
||||
}
|
||||
|
||||
private class DelayedMessage {
|
||||
public TLRPC.TL_messages_sendMedia sendRequest;
|
||||
public TLObject sendRequest;
|
||||
public TLRPC.TL_decryptedMessage sendEncryptedRequest;
|
||||
public int type;
|
||||
public String originalPath;
|
||||
@ -182,7 +185,8 @@ public class MessagesController implements NotificationCenter.NotificationCenter
|
||||
MessagesStorage storage = MessagesStorage.getInstance();
|
||||
NotificationCenter.getInstance().addObserver(this, FileLoader.FileDidUpload);
|
||||
NotificationCenter.getInstance().addObserver(this, FileLoader.FileDidFailUpload);
|
||||
NotificationCenter.getInstance().addObserver(this, 10);
|
||||
NotificationCenter.getInstance().addObserver(this, chatInfoDidLoaded);
|
||||
NotificationCenter.getInstance().addObserver(this, messageReceivedByServer);
|
||||
addSupportUser();
|
||||
SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("Notifications", Activity.MODE_PRIVATE);
|
||||
enableJoined = preferences.getBoolean("EnableContactJoined", true);
|
||||
@ -282,28 +286,35 @@ public class MessagesController implements NotificationCenter.NotificationCenter
|
||||
if (arr != null) {
|
||||
for (int a = 0; a < arr.size(); a++) {
|
||||
DelayedMessage message = arr.get(a);
|
||||
if (file != null && message.sendRequest != null) {
|
||||
TLRPC.InputMedia media = null;
|
||||
if (message.sendRequest instanceof TLRPC.TL_messages_sendMedia) {
|
||||
media = ((TLRPC.TL_messages_sendMedia)message.sendRequest).media;
|
||||
} else if (message.sendRequest instanceof TLRPC.TL_messages_sendBroadcast) {
|
||||
media = ((TLRPC.TL_messages_sendBroadcast)message.sendRequest).media;
|
||||
}
|
||||
|
||||
if (file != null && media != null) {
|
||||
if (message.type == 0) {
|
||||
message.sendRequest.media.file = file;
|
||||
media.file = file;
|
||||
performSendMessageRequest(message.sendRequest, message.obj, message.originalPath);
|
||||
} else if (message.type == 1) {
|
||||
if (message.sendRequest.media.thumb == null) {
|
||||
message.sendRequest.media.thumb = file;
|
||||
if (media.thumb == null) {
|
||||
media.thumb = file;
|
||||
performSendDelayedMessage(message);
|
||||
} else {
|
||||
message.sendRequest.media.file = file;
|
||||
media.file = file;
|
||||
performSendMessageRequest(message.sendRequest, message.obj, message.originalPath);
|
||||
}
|
||||
} else if (message.type == 2) {
|
||||
if (message.sendRequest.media.thumb == null && message.location != null) {
|
||||
message.sendRequest.media.thumb = file;
|
||||
if (media.thumb == null && message.location != null) {
|
||||
media.thumb = file;
|
||||
performSendDelayedMessage(message);
|
||||
} else {
|
||||
message.sendRequest.media.file = file;
|
||||
media.file = file;
|
||||
performSendMessageRequest(message.sendRequest, message.obj, message.originalPath);
|
||||
}
|
||||
} else if (message.type == 3) {
|
||||
message.sendRequest.media.file = file;
|
||||
media.file = file;
|
||||
performSendMessageRequest(message.sendRequest, message.obj, message.originalPath);
|
||||
}
|
||||
arr.remove(a);
|
||||
@ -380,6 +391,11 @@ public class MessagesController implements NotificationCenter.NotificationCenter
|
||||
}
|
||||
NotificationCenter.getInstance().postNotificationName(dialogsNeedReload);
|
||||
}
|
||||
} else if (id == chatInfoDidLoaded) {
|
||||
int chatId = (Integer)args[0];
|
||||
if (chatParticipantsId == chatId) {
|
||||
currentChatInfo = (TLRPC.ChatParticipants)args[1];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -388,6 +404,7 @@ public class MessagesController implements NotificationCenter.NotificationCenter
|
||||
super.finalize();
|
||||
NotificationCenter.getInstance().removeObserver(this, FileLoader.FileDidUpload);
|
||||
NotificationCenter.getInstance().removeObserver(this, FileLoader.FileDidFailUpload);
|
||||
NotificationCenter.getInstance().removeObserver(this, chatInfoDidLoaded);
|
||||
NotificationCenter.getInstance().removeObserver(this, messageReceivedByServer);
|
||||
}
|
||||
|
||||
@ -432,6 +449,8 @@ public class MessagesController implements NotificationCenter.NotificationCenter
|
||||
startingSecretChat = false;
|
||||
statusRequest = 0;
|
||||
statusSettingState = 0;
|
||||
currentChatInfo = null;
|
||||
chatParticipantsId = 0;
|
||||
addSupportUser();
|
||||
}
|
||||
|
||||
@ -753,8 +772,14 @@ public class MessagesController implements NotificationCenter.NotificationCenter
|
||||
dialogsServerOnly.remove(dialog);
|
||||
dialogs_dict.remove(did);
|
||||
totalDialogsCount--;
|
||||
} else {
|
||||
dialog.unread_count = 0;
|
||||
}
|
||||
dialogMessage.remove(dialog.top_message);
|
||||
NotificationsController.getInstance().processReadMessages(null, did, 0, Integer.MAX_VALUE);
|
||||
HashMap<Long, Integer> dialogsToUpdate = new HashMap<Long, Integer>();
|
||||
dialogsToUpdate.put(did, 0);
|
||||
NotificationsController.getInstance().processDialogsUpdateRead(dialogsToUpdate, true);
|
||||
MessagesStorage.getInstance().deleteDialog(did, onlyHistory);
|
||||
NotificationCenter.getInstance().postNotificationName(removeAllMessagesFromDialog, did);
|
||||
NotificationCenter.getInstance().postNotificationName(dialogsNeedReload);
|
||||
@ -806,18 +831,22 @@ public class MessagesController implements NotificationCenter.NotificationCenter
|
||||
}
|
||||
});
|
||||
} else {
|
||||
int encId = (int)(did >> 32);
|
||||
int high_id = (int)(did >> 32);
|
||||
if (high_id > 0) {
|
||||
if (onlyHistory) {
|
||||
TLRPC.EncryptedChat encryptedChat = encryptedChats.get(encId);
|
||||
TLRPC.EncryptedChat encryptedChat = encryptedChats.get(high_id);
|
||||
sendClearHistoryMessage(encryptedChat);
|
||||
} else {
|
||||
declineSecretChat(encId);
|
||||
declineSecretChat(high_id);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void loadChatInfo(final int chat_id) {
|
||||
currentChatInfo = null;
|
||||
chatParticipantsId = chat_id;
|
||||
MessagesStorage.getInstance().loadChatInfo(chat_id);
|
||||
}
|
||||
|
||||
@ -877,7 +906,7 @@ public class MessagesController implements NotificationCenter.NotificationCenter
|
||||
checkDeletingTask();
|
||||
|
||||
if (UserConfig.isClientActivated()) {
|
||||
if (ConnectionsManager.getInstance().getPauseTime() == 0 && ApplicationLoader.isScreenOn) {
|
||||
if (ConnectionsManager.getInstance().getPauseTime() == 0 && ApplicationLoader.isScreenOn && !ApplicationLoader.mainInterfacePaused) {
|
||||
if (statusSettingState != 1 && (lastStatusUpdateTime == 0 || lastStatusUpdateTime <= System.currentTimeMillis() - 55000 || offlineSent)) {
|
||||
statusSettingState = 1;
|
||||
|
||||
@ -1046,8 +1075,9 @@ public class MessagesController implements NotificationCenter.NotificationCenter
|
||||
}, true, RPCRequest.RPCRequestClassGeneric | RPCRequest.RPCRequestClassFailOnServerErrors);
|
||||
ConnectionsManager.getInstance().bindRequestToGuid(reqId, classGuid);
|
||||
} else {
|
||||
int encId = (int)(dialog_id >> 32);
|
||||
TLRPC.EncryptedChat chat = encryptedChats.get(encId);
|
||||
int high_id = (int)(dialog_id >> 32);
|
||||
if (high_id > 0) {
|
||||
TLRPC.EncryptedChat chat = encryptedChats.get(high_id);
|
||||
if (chat.auth_key != null && chat.auth_key.length > 1 && chat instanceof TLRPC.TL_encryptedChat) {
|
||||
TLRPC.TL_messages_setEncryptedTyping req = new TLRPC.TL_messages_setEncryptedTyping();
|
||||
req.peer = new TLRPC.TL_inputEncryptedChat();
|
||||
@ -1064,6 +1094,7 @@ public class MessagesController implements NotificationCenter.NotificationCenter
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void loadMessages(final long dialog_id, final int offset, final int count, final int max_id, boolean fromCache, int midDate, final int classGuid, boolean from_unread, boolean forward) {
|
||||
int lower_part = (int)dialog_id;
|
||||
@ -1125,7 +1156,7 @@ public class MessagesController implements NotificationCenter.NotificationCenter
|
||||
final ArrayList<MessageObject> objects = new ArrayList<MessageObject>();
|
||||
for (TLRPC.Message message : messagesRes.messages) {
|
||||
message.dialog_id = dialog_id;
|
||||
objects.add(new MessageObject(message, usersLocal));
|
||||
objects.add(new MessageObject(message, usersLocal, 2));
|
||||
}
|
||||
Utilities.RunOnUIThread(new Runnable() {
|
||||
@Override
|
||||
@ -1234,7 +1265,7 @@ public class MessagesController implements NotificationCenter.NotificationCenter
|
||||
}
|
||||
|
||||
for (TLRPC.Message m : dialogsRes.messages) {
|
||||
new_dialogMessage.put(m.id, new MessageObject(m, usersLocal));
|
||||
new_dialogMessage.put(m.id, new MessageObject(m, usersLocal, 0));
|
||||
}
|
||||
for (TLRPC.TL_dialog d : dialogsRes.dialogs) {
|
||||
if (d.last_message_date == 0) {
|
||||
@ -1374,7 +1405,7 @@ public class MessagesController implements NotificationCenter.NotificationCenter
|
||||
}
|
||||
|
||||
for (TLRPC.Message m : dialogsRes.messages) {
|
||||
new_dialogMessage.put(m.id, new MessageObject(m, usersLocal));
|
||||
new_dialogMessage.put(m.id, new MessageObject(m, usersLocal, 0));
|
||||
}
|
||||
for (TLRPC.TL_dialog d : dialogsRes.dialogs) {
|
||||
if (d.last_message_date == 0) {
|
||||
@ -1615,9 +1646,10 @@ public class MessagesController implements NotificationCenter.NotificationCenter
|
||||
if (max_date == 0) {
|
||||
return;
|
||||
}
|
||||
int high_id = (int)(dialog_id >> 32);
|
||||
if (high_id > 0) {
|
||||
NotificationsController.getInstance().processReadMessages(null, dialog_id, max_date, 0);
|
||||
int encId = (int)(dialog_id >> 32);
|
||||
TLRPC.EncryptedChat chat = encryptedChats.get(encId);
|
||||
TLRPC.EncryptedChat chat = encryptedChats.get(high_id);
|
||||
if (chat.auth_key != null && chat.auth_key.length > 1 && chat instanceof TLRPC.TL_encryptedChat) {
|
||||
TLRPC.TL_messages_readEncryptedHistory req = new TLRPC.TL_messages_readEncryptedHistory();
|
||||
req.peer = new TLRPC.TL_inputEncryptedChat();
|
||||
@ -1659,6 +1691,7 @@ public class MessagesController implements NotificationCenter.NotificationCenter
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void cancelSendingMessage(MessageObject object) {
|
||||
String keyToRemvoe = null;
|
||||
@ -1795,7 +1828,7 @@ public class MessagesController implements NotificationCenter.NotificationCenter
|
||||
objArr.add(newMsgObj);
|
||||
ArrayList<TLRPC.Message> arr = new ArrayList<TLRPC.Message>();
|
||||
arr.add(newMsg);
|
||||
MessagesStorage.getInstance().putMessages(arr, false, true);
|
||||
MessagesStorage.getInstance().putMessages(arr, false, true, false);
|
||||
updateInterfaceWithMessages(newMsg.dialog_id, objArr);
|
||||
NotificationCenter.getInstance().postNotificationName(dialogsNeedReload);
|
||||
|
||||
@ -1844,7 +1877,7 @@ public class MessagesController implements NotificationCenter.NotificationCenter
|
||||
objArr.add(newMsgObj);
|
||||
ArrayList<TLRPC.Message> arr = new ArrayList<TLRPC.Message>();
|
||||
arr.add(newMsg);
|
||||
MessagesStorage.getInstance().putMessages(arr, false, true);
|
||||
MessagesStorage.getInstance().putMessages(arr, false, true, false);
|
||||
updateInterfaceWithMessages(newMsg.dialog_id, objArr);
|
||||
NotificationCenter.getInstance().postNotificationName(dialogsNeedReload);
|
||||
|
||||
@ -1944,6 +1977,7 @@ public class MessagesController implements NotificationCenter.NotificationCenter
|
||||
int lower_id = (int)peer;
|
||||
TLRPC.EncryptedChat encryptedChat = null;
|
||||
TLRPC.InputPeer sendToPeer = null;
|
||||
ArrayList<TLRPC.InputUser> sendToPeers = null;
|
||||
if (lower_id != 0) {
|
||||
if (lower_id < 0) {
|
||||
newMsg.to_id = new TLRPC.TL_peerChat();
|
||||
@ -1968,7 +2002,9 @@ public class MessagesController implements NotificationCenter.NotificationCenter
|
||||
}
|
||||
}
|
||||
} else {
|
||||
encryptedChat = encryptedChats.get((int)(peer >> 32));
|
||||
int high_id = (int)(peer >> 32);
|
||||
if (high_id > 0) {
|
||||
encryptedChat = encryptedChats.get(high_id);
|
||||
newMsg.to_id = new TLRPC.TL_peerUser();
|
||||
if (encryptedChat.participant_id == UserConfig.getClientUserId()) {
|
||||
newMsg.to_id.user_id = encryptedChat.admin_id;
|
||||
@ -1976,19 +2012,34 @@ public class MessagesController implements NotificationCenter.NotificationCenter
|
||||
newMsg.to_id.user_id = encryptedChat.participant_id;
|
||||
}
|
||||
newMsg.ttl = encryptedChat.ttl;
|
||||
} else {
|
||||
if (currentChatInfo == null) {
|
||||
return;
|
||||
}
|
||||
sendToPeers = new ArrayList<TLRPC.InputUser>();
|
||||
for (TLRPC.TL_chatParticipant participant : currentChatInfo.participants) {
|
||||
TLRPC.User sendToUser = users.get(participant.user_id);
|
||||
TLRPC.InputUser peerUser = getInputUser(sendToUser);
|
||||
if (peerUser != null) {
|
||||
sendToPeers.add(peerUser);
|
||||
}
|
||||
}
|
||||
newMsg.to_id = new TLRPC.TL_peerChat();
|
||||
newMsg.to_id.chat_id = high_id;
|
||||
}
|
||||
}
|
||||
newMsg.out = true;
|
||||
newMsg.date = ConnectionsManager.getInstance().getCurrentTime();
|
||||
newMsg.random_id = getNextRandomId();
|
||||
UserConfig.saveConfig(false);
|
||||
final MessageObject newMsgObj = new MessageObject(newMsg, null);
|
||||
final MessageObject newMsgObj = new MessageObject(newMsg, null, 2);
|
||||
newMsgObj.messageOwner.send_state = MESSAGE_SEND_STATE_SENDING;
|
||||
|
||||
final ArrayList<MessageObject> objArr = new ArrayList<MessageObject>();
|
||||
objArr.add(newMsgObj);
|
||||
ArrayList<TLRPC.Message> arr = new ArrayList<TLRPC.Message>();
|
||||
arr.add(newMsg);
|
||||
MessagesStorage.getInstance().putMessages(arr, false, true);
|
||||
MessagesStorage.getInstance().putMessages(arr, false, true, false);
|
||||
updateInterfaceWithMessages(peer, objArr);
|
||||
NotificationCenter.getInstance().postNotificationName(dialogsNeedReload);
|
||||
|
||||
@ -1996,11 +2047,19 @@ public class MessagesController implements NotificationCenter.NotificationCenter
|
||||
|
||||
if (type == 0) {
|
||||
if (encryptedChat == null) {
|
||||
if (sendToPeers != null) {
|
||||
TLRPC.TL_messages_sendBroadcast reqSend = new TLRPC.TL_messages_sendBroadcast();
|
||||
reqSend.message = message;
|
||||
reqSend.contacts = sendToPeers;
|
||||
reqSend.media = new TLRPC.TL_inputMediaEmpty();
|
||||
performSendMessageRequest(reqSend, newMsgObj, null);
|
||||
} else {
|
||||
TLRPC.TL_messages_sendMessage reqSend = new TLRPC.TL_messages_sendMessage();
|
||||
reqSend.message = message;
|
||||
reqSend.peer = sendToPeer;
|
||||
reqSend.random_id = newMsg.random_id;
|
||||
performSendMessageRequest(reqSend, newMsgObj, null);
|
||||
}
|
||||
} else {
|
||||
TLRPC.TL_decryptedMessage reqSend = new TLRPC.TL_decryptedMessage();
|
||||
reqSend.random_id = newMsg.random_id;
|
||||
@ -2012,74 +2071,64 @@ public class MessagesController implements NotificationCenter.NotificationCenter
|
||||
}
|
||||
} else if (type >= 1 && type <= 3 || type >= 5 && type <= 8) {
|
||||
if (encryptedChat == null) {
|
||||
TLRPC.TL_messages_sendMedia reqSend = new TLRPC.TL_messages_sendMedia();
|
||||
reqSend.peer = sendToPeer;
|
||||
reqSend.random_id = newMsg.random_id;
|
||||
TLRPC.InputMedia inputMedia = null;
|
||||
DelayedMessage delayedMessage = null;
|
||||
if (type == 1) {
|
||||
reqSend.media = new TLRPC.TL_inputMediaGeoPoint();
|
||||
reqSend.media.geo_point = new TLRPC.TL_inputGeoPoint();
|
||||
reqSend.media.geo_point.lat = lat;
|
||||
reqSend.media.geo_point._long = lon;
|
||||
performSendMessageRequest(reqSend, newMsgObj, null);
|
||||
inputMedia = new TLRPC.TL_inputMediaGeoPoint();
|
||||
inputMedia.geo_point = new TLRPC.TL_inputGeoPoint();
|
||||
inputMedia.geo_point.lat = lat;
|
||||
inputMedia.geo_point._long = lon;
|
||||
} else if (type == 2) {
|
||||
if (photo.access_hash == 0) {
|
||||
reqSend.media = new TLRPC.TL_inputMediaUploadedPhoto();
|
||||
DelayedMessage delayedMessage = new DelayedMessage();
|
||||
inputMedia = new TLRPC.TL_inputMediaUploadedPhoto();
|
||||
delayedMessage = new DelayedMessage();
|
||||
delayedMessage.originalPath = originalPath;
|
||||
delayedMessage.sendRequest = reqSend;
|
||||
delayedMessage.type = 0;
|
||||
delayedMessage.obj = newMsgObj;
|
||||
delayedMessage.location = photo.sizes.get(photo.sizes.size() - 1).location;
|
||||
performSendDelayedMessage(delayedMessage);
|
||||
} else {
|
||||
TLRPC.TL_inputMediaPhoto media = new TLRPC.TL_inputMediaPhoto();
|
||||
media.id = new TLRPC.TL_inputPhoto();
|
||||
media.id.id = photo.id;
|
||||
media.id.access_hash = photo.access_hash;
|
||||
reqSend.media = media;
|
||||
performSendMessageRequest(reqSend, newMsgObj, null);
|
||||
inputMedia = media;
|
||||
}
|
||||
} else if (type == 3) {
|
||||
if (video.access_hash == 0) {
|
||||
reqSend.media = new TLRPC.TL_inputMediaUploadedThumbVideo();
|
||||
reqSend.media.duration = video.duration;
|
||||
reqSend.media.w = video.w;
|
||||
reqSend.media.h = video.h;
|
||||
reqSend.media.mime_type = video.mime_type;
|
||||
DelayedMessage delayedMessage = new DelayedMessage();
|
||||
inputMedia = new TLRPC.TL_inputMediaUploadedThumbVideo();
|
||||
inputMedia.duration = video.duration;
|
||||
inputMedia.w = video.w;
|
||||
inputMedia.h = video.h;
|
||||
inputMedia.mime_type = video.mime_type;
|
||||
delayedMessage = new DelayedMessage();
|
||||
delayedMessage.originalPath = originalPath;
|
||||
delayedMessage.sendRequest = reqSend;
|
||||
delayedMessage.type = 1;
|
||||
delayedMessage.obj = newMsgObj;
|
||||
delayedMessage.location = video.thumb.location;
|
||||
delayedMessage.videoLocation = video;
|
||||
performSendDelayedMessage(delayedMessage);
|
||||
} else {
|
||||
TLRPC.TL_inputMediaVideo media = new TLRPC.TL_inputMediaVideo();
|
||||
media.id = new TLRPC.TL_inputVideo();
|
||||
media.id.id = video.id;
|
||||
media.id.access_hash = video.access_hash;
|
||||
reqSend.media = media;
|
||||
performSendMessageRequest(reqSend, newMsgObj, null);
|
||||
inputMedia = media;
|
||||
}
|
||||
} else if (type == 6) {
|
||||
reqSend.media = new TLRPC.TL_inputMediaContact();
|
||||
reqSend.media.phone_number = user.phone;
|
||||
reqSend.media.first_name = user.first_name;
|
||||
reqSend.media.last_name = user.last_name;
|
||||
performSendMessageRequest(reqSend, newMsgObj, null);
|
||||
inputMedia = new TLRPC.TL_inputMediaContact();
|
||||
inputMedia.phone_number = user.phone;
|
||||
inputMedia.first_name = user.first_name;
|
||||
inputMedia.last_name = user.last_name;
|
||||
} else if (type == 7) {
|
||||
if (document.access_hash == 0) {
|
||||
if (document.thumb.location != null && document.thumb.location instanceof TLRPC.TL_fileLocation) {
|
||||
reqSend.media = new TLRPC.TL_inputMediaUploadedThumbDocument();
|
||||
inputMedia = new TLRPC.TL_inputMediaUploadedThumbDocument();
|
||||
} else {
|
||||
reqSend.media = new TLRPC.TL_inputMediaUploadedDocument();
|
||||
inputMedia = new TLRPC.TL_inputMediaUploadedDocument();
|
||||
}
|
||||
reqSend.media.mime_type = document.mime_type;
|
||||
reqSend.media.file_name = document.file_name;
|
||||
DelayedMessage delayedMessage = new DelayedMessage();
|
||||
inputMedia.mime_type = document.mime_type;
|
||||
inputMedia.file_name = document.file_name;
|
||||
delayedMessage = new DelayedMessage();
|
||||
delayedMessage.originalPath = originalPath;
|
||||
delayedMessage.sendRequest = reqSend;
|
||||
delayedMessage.type = 2;
|
||||
delayedMessage.obj = newMsgObj;
|
||||
delayedMessage.documentLocation = document;
|
||||
@ -2090,26 +2139,73 @@ public class MessagesController implements NotificationCenter.NotificationCenter
|
||||
media.id = new TLRPC.TL_inputDocument();
|
||||
media.id.id = document.id;
|
||||
media.id.access_hash = document.access_hash;
|
||||
reqSend.media = media;
|
||||
performSendMessageRequest(reqSend, newMsgObj, null);
|
||||
inputMedia = media;
|
||||
}
|
||||
} else if (type == 8) {
|
||||
if (audio.access_hash == 0) {
|
||||
reqSend.media = new TLRPC.TL_inputMediaUploadedAudio();
|
||||
reqSend.media.duration = audio.duration;
|
||||
reqSend.media.mime_type = audio.mime_type;
|
||||
DelayedMessage delayedMessage = new DelayedMessage();
|
||||
delayedMessage.sendRequest = reqSend;
|
||||
inputMedia = new TLRPC.TL_inputMediaUploadedAudio();
|
||||
inputMedia.duration = audio.duration;
|
||||
inputMedia.mime_type = audio.mime_type;
|
||||
delayedMessage = new DelayedMessage();
|
||||
delayedMessage.type = 3;
|
||||
delayedMessage.obj = newMsgObj;
|
||||
delayedMessage.audioLocation = audio;
|
||||
performSendDelayedMessage(delayedMessage);
|
||||
} else {
|
||||
TLRPC.TL_inputMediaAudio media = new TLRPC.TL_inputMediaAudio();
|
||||
media.id = new TLRPC.TL_inputAudio();
|
||||
media.id.id = audio.id;
|
||||
media.id.access_hash = audio.access_hash;
|
||||
reqSend.media = media;
|
||||
inputMedia = media;
|
||||
}
|
||||
}
|
||||
|
||||
TLObject reqSend = null;
|
||||
|
||||
if (sendToPeers != null) {
|
||||
TLRPC.TL_messages_sendBroadcast request = new TLRPC.TL_messages_sendBroadcast();
|
||||
request.contacts = sendToPeers;
|
||||
request.media = inputMedia;
|
||||
request.message = "";
|
||||
if (delayedMessage != null) {
|
||||
delayedMessage.sendRequest = request;
|
||||
}
|
||||
reqSend = request;
|
||||
} else {
|
||||
TLRPC.TL_messages_sendMedia request = new TLRPC.TL_messages_sendMedia();
|
||||
request.peer = sendToPeer;
|
||||
request.random_id = newMsg.random_id;
|
||||
request.media = inputMedia;
|
||||
if (delayedMessage != null) {
|
||||
delayedMessage.sendRequest = request;
|
||||
}
|
||||
reqSend = request;
|
||||
}
|
||||
if (type == 1) {
|
||||
performSendMessageRequest(reqSend, newMsgObj, null);
|
||||
} else if (type == 2) {
|
||||
if (photo.access_hash == 0) {
|
||||
performSendDelayedMessage(delayedMessage);
|
||||
} else {
|
||||
performSendMessageRequest(reqSend, newMsgObj, null);
|
||||
}
|
||||
} else if (type == 3) {
|
||||
if (video.access_hash == 0) {
|
||||
performSendDelayedMessage(delayedMessage);
|
||||
} else {
|
||||
performSendMessageRequest(reqSend, newMsgObj, null);
|
||||
}
|
||||
} else if (type == 6) {
|
||||
performSendMessageRequest(reqSend, newMsgObj, null);
|
||||
} else if (type == 7) {
|
||||
if (document.access_hash == 0) {
|
||||
performSendDelayedMessage(delayedMessage);
|
||||
} else {
|
||||
performSendMessageRequest(reqSend, newMsgObj, null);
|
||||
}
|
||||
} else if (type == 8) {
|
||||
if (audio.access_hash == 0) {
|
||||
performSendDelayedMessage(delayedMessage);
|
||||
} else {
|
||||
performSendMessageRequest(reqSend, newMsgObj, null);
|
||||
}
|
||||
}
|
||||
@ -2360,7 +2456,7 @@ public class MessagesController implements NotificationCenter.NotificationCenter
|
||||
FileLoader.getInstance().replaceImageInCache(fileName, fileName2);
|
||||
ArrayList<TLRPC.Message> arr = new ArrayList<TLRPC.Message>();
|
||||
arr.add(newMsg);
|
||||
MessagesStorage.getInstance().putMessages(arr, false, true);
|
||||
MessagesStorage.getInstance().putMessages(arr, false, true, false);
|
||||
|
||||
MessagesStorage.getInstance().putSentFile(originalPath, newMsg.media.photo, 3);
|
||||
} else if (newMsg.media instanceof TLRPC.TL_messageMediaVideo && newMsg.media.video != null) {
|
||||
@ -2383,7 +2479,7 @@ public class MessagesController implements NotificationCenter.NotificationCenter
|
||||
newMsg.media.video.mime_type = video.mime_type;
|
||||
ArrayList<TLRPC.Message> arr = new ArrayList<TLRPC.Message>();
|
||||
arr.add(newMsg);
|
||||
MessagesStorage.getInstance().putMessages(arr, false, true);
|
||||
MessagesStorage.getInstance().putMessages(arr, false, true, false);
|
||||
|
||||
MessagesStorage.getInstance().putSentFile(originalPath, newMsg.media.video, 5);
|
||||
} else if (newMsg.media instanceof TLRPC.TL_messageMediaDocument && newMsg.media.document != null) {
|
||||
@ -2410,7 +2506,7 @@ public class MessagesController implements NotificationCenter.NotificationCenter
|
||||
|
||||
ArrayList<TLRPC.Message> arr = new ArrayList<TLRPC.Message>();
|
||||
arr.add(newMsg);
|
||||
MessagesStorage.getInstance().putMessages(arr, false, true);
|
||||
MessagesStorage.getInstance().putMessages(arr, false, true, false);
|
||||
|
||||
MessagesStorage.getInstance().putSentFile(originalPath, newMsg.media.document, 4);
|
||||
} else if (newMsg.media instanceof TLRPC.TL_messageMediaAudio && newMsg.media.audio != null) {
|
||||
@ -2438,7 +2534,7 @@ public class MessagesController implements NotificationCenter.NotificationCenter
|
||||
|
||||
ArrayList<TLRPC.Message> arr = new ArrayList<TLRPC.Message>();
|
||||
arr.add(newMsg);
|
||||
MessagesStorage.getInstance().putMessages(arr, false, true);
|
||||
MessagesStorage.getInstance().putMessages(arr, false, true, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -2539,12 +2635,13 @@ public class MessagesController implements NotificationCenter.NotificationCenter
|
||||
});
|
||||
}
|
||||
|
||||
private void performSendMessageRequest(TLObject req, final MessageObject newMsgObj, final String originalPath) {
|
||||
private void performSendMessageRequest(final TLObject req, final MessageObject newMsgObj, final String originalPath) {
|
||||
ConnectionsManager.getInstance().performRpc(req, new RPCRequest.RPCRequestDelegate() {
|
||||
@Override
|
||||
public void run(TLObject response, TLRPC.TL_error error) {
|
||||
if (error == null) {
|
||||
final int oldId = newMsgObj.messageOwner.id;
|
||||
final boolean isBroadcast = req instanceof TLRPC.TL_messages_sendBroadcast;
|
||||
final ArrayList<TLRPC.Message> sentMessages = new ArrayList<TLRPC.Message>();
|
||||
|
||||
if (response instanceof TLRPC.TL_messages_sentMessage) {
|
||||
@ -2596,9 +2693,11 @@ public class MessagesController implements NotificationCenter.NotificationCenter
|
||||
} else if (response instanceof TLRPC.messages_StatedMessages) {
|
||||
TLRPC.messages_StatedMessages res = (TLRPC.messages_StatedMessages) response;
|
||||
if (!res.messages.isEmpty()) {
|
||||
sentMessages.addAll(res.messages);
|
||||
TLRPC.Message message = res.messages.get(0);
|
||||
if (!isBroadcast) {
|
||||
newMsgObj.messageOwner.id = message.id;
|
||||
sentMessages.add(message);
|
||||
}
|
||||
processSentMessage(newMsgObj.messageOwner, message, null, null, originalPath);
|
||||
}
|
||||
if (MessagesStorage.lastSeqValue + 1 == res.seq) {
|
||||
@ -2623,13 +2722,28 @@ public class MessagesController implements NotificationCenter.NotificationCenter
|
||||
MessagesStorage.getInstance().storageQueue.postRunnable(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
MessagesStorage.getInstance().updateMessageStateAndId(newMsgObj.messageOwner.random_id, oldId, newMsgObj.messageOwner.id, 0, false);
|
||||
MessagesStorage.getInstance().putMessages(sentMessages, true, false);
|
||||
MessagesStorage.getInstance().updateMessageStateAndId(newMsgObj.messageOwner.random_id, oldId, (isBroadcast ? oldId : newMsgObj.messageOwner.id), 0, false);
|
||||
MessagesStorage.getInstance().putMessages(sentMessages, true, false, isBroadcast);
|
||||
if (isBroadcast) {
|
||||
ArrayList<TLRPC.Message> currentMessage = new ArrayList<TLRPC.Message>();
|
||||
currentMessage.add(newMsgObj.messageOwner);
|
||||
newMsgObj.messageOwner.send_state = MESSAGE_SEND_STATE_SENT;
|
||||
MessagesStorage.getInstance().putMessages(currentMessage, true, false, false);
|
||||
}
|
||||
Utilities.RunOnUIThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
newMsgObj.messageOwner.send_state = MESSAGE_SEND_STATE_SENT;
|
||||
NotificationCenter.getInstance().postNotificationName(messageReceivedByServer, oldId, newMsgObj.messageOwner.id, newMsgObj);
|
||||
if (isBroadcast) {
|
||||
for (TLRPC.Message message : sentMessages) {
|
||||
ArrayList<MessageObject> arr = new ArrayList<MessageObject>();
|
||||
MessageObject messageObject = new MessageObject(message, users, 0);
|
||||
arr.add(messageObject);
|
||||
updateInterfaceWithMessages(messageObject.getDialogId(), arr, isBroadcast);
|
||||
}
|
||||
NotificationCenter.getInstance().postNotificationName(dialogsNeedReload);
|
||||
}
|
||||
NotificationCenter.getInstance().postNotificationName(messageReceivedByServer, oldId, (isBroadcast ? oldId : newMsgObj.messageOwner.id), newMsgObj);
|
||||
sendingMessages.remove(oldId);
|
||||
}
|
||||
});
|
||||
@ -2681,7 +2795,13 @@ public class MessagesController implements NotificationCenter.NotificationCenter
|
||||
}
|
||||
} else if (message.type == 1) {
|
||||
if (message.sendRequest != null) {
|
||||
if (message.sendRequest.media.thumb == null) {
|
||||
TLRPC.InputMedia media = null;
|
||||
if (message.sendRequest instanceof TLRPC.TL_messages_sendMedia) {
|
||||
media = ((TLRPC.TL_messages_sendMedia)message.sendRequest).media;
|
||||
} else if (message.sendRequest instanceof TLRPC.TL_messages_sendBroadcast) {
|
||||
media = ((TLRPC.TL_messages_sendBroadcast)message.sendRequest).media;
|
||||
}
|
||||
if (media.thumb == null) {
|
||||
String location = AndroidUtilities.getCacheDir() + "/" + message.location.volume_id + "_" + message.location.local_id + ".jpg";
|
||||
putToDelayedMessages(location, message);
|
||||
FileLoader.getInstance().uploadFile(location, false);
|
||||
@ -2702,7 +2822,13 @@ public class MessagesController implements NotificationCenter.NotificationCenter
|
||||
FileLoader.getInstance().uploadFile(location, true);
|
||||
}
|
||||
} else if (message.type == 2) {
|
||||
if (message.sendRequest != null && message.sendRequest.media.thumb == null && message.location != null) {
|
||||
TLRPC.InputMedia media = null;
|
||||
if (message.sendRequest instanceof TLRPC.TL_messages_sendMedia) {
|
||||
media = ((TLRPC.TL_messages_sendMedia)message.sendRequest).media;
|
||||
} else if (message.sendRequest instanceof TLRPC.TL_messages_sendBroadcast) {
|
||||
media = ((TLRPC.TL_messages_sendBroadcast)message.sendRequest).media;
|
||||
}
|
||||
if (message.sendRequest != null && media.thumb == null && message.location != null) {
|
||||
String location = AndroidUtilities.getCacheDir() + "/" + message.location.volume_id + "_" + message.location.local_id + ".jpg";
|
||||
putToDelayedMessages(location, message);
|
||||
FileLoader.getInstance().uploadFile(location, false);
|
||||
@ -2726,7 +2852,61 @@ public class MessagesController implements NotificationCenter.NotificationCenter
|
||||
}
|
||||
}
|
||||
|
||||
public long createChat(String title, ArrayList<Integer> selectedContacts, final TLRPC.InputFile uploadedAvatar) {
|
||||
public long createChat(String title, ArrayList<Integer> selectedContacts, final TLRPC.InputFile uploadedAvatar, boolean isBroadcast) {
|
||||
if (isBroadcast) {
|
||||
TLRPC.TL_chat chat = new TLRPC.TL_chat();
|
||||
chat.id = UserConfig.lastBroadcastId;
|
||||
chat.title = title;
|
||||
chat.photo = new TLRPC.TL_chatPhotoEmpty();
|
||||
chat.participants_count = selectedContacts.size();
|
||||
chat.date = (int)(System.currentTimeMillis() / 1000);
|
||||
chat.left = false;
|
||||
chat.version = 1;
|
||||
UserConfig.lastBroadcastId--;
|
||||
chats.put(chat.id, chat);
|
||||
ArrayList<TLRPC.Chat> chatsArrays = new ArrayList<TLRPC.Chat>();
|
||||
chatsArrays.add(chat);
|
||||
MessagesStorage.getInstance().putUsersAndChats(null, chatsArrays, true, true);
|
||||
|
||||
TLRPC.TL_chatParticipants participants = new TLRPC.TL_chatParticipants();
|
||||
participants.chat_id = chat.id;
|
||||
participants.admin_id = UserConfig.getClientUserId();
|
||||
participants.version = 1;
|
||||
for (Integer id : selectedContacts) {
|
||||
TLRPC.TL_chatParticipant participant = new TLRPC.TL_chatParticipant();
|
||||
participant.user_id = id;
|
||||
participant.inviter_id = UserConfig.getClientUserId();
|
||||
participant.date = (int)(System.currentTimeMillis() / 1000);
|
||||
participants.participants.add(participant);
|
||||
}
|
||||
MessagesStorage.getInstance().updateChatInfo(chat.id, participants, false);
|
||||
|
||||
TLRPC.TL_messageService newMsg = new TLRPC.TL_messageService();
|
||||
newMsg.action = new TLRPC.TL_messageActionCreatedBroadcastList();
|
||||
newMsg.local_id = newMsg.id = UserConfig.getNewMessageId();
|
||||
newMsg.from_id = UserConfig.getClientUserId();
|
||||
newMsg.unread = false;
|
||||
newMsg.dialog_id = ((long)chat.id) << 32;
|
||||
newMsg.to_id = new TLRPC.TL_peerChat();
|
||||
newMsg.to_id.chat_id = chat.id;
|
||||
newMsg.out = false;
|
||||
newMsg.date = ConnectionsManager.getInstance().getCurrentTime();
|
||||
newMsg.random_id = 0;
|
||||
UserConfig.saveConfig(false);
|
||||
MessageObject newMsgObj = new MessageObject(newMsg, users);
|
||||
newMsgObj.messageOwner.send_state = MESSAGE_SEND_STATE_SENT;
|
||||
|
||||
ArrayList<MessageObject> objArr = new ArrayList<MessageObject>();
|
||||
objArr.add(newMsgObj);
|
||||
ArrayList<TLRPC.Message> arr = new ArrayList<TLRPC.Message>();
|
||||
arr.add(newMsg);
|
||||
MessagesStorage.getInstance().putMessages(arr, false, true, false);
|
||||
updateInterfaceWithMessages(newMsg.dialog_id, objArr);
|
||||
NotificationCenter.getInstance().postNotificationName(chatDidCreated, chat.id);
|
||||
NotificationCenter.getInstance().postNotificationName(dialogsNeedReload);
|
||||
|
||||
return 0;
|
||||
} else {
|
||||
TLRPC.TL_messages_createChat req = new TLRPC.TL_messages_createChat();
|
||||
req.title = title;
|
||||
for (Integer uid : selectedContacts) {
|
||||
@ -2777,7 +2957,7 @@ public class MessagesController implements NotificationCenter.NotificationCenter
|
||||
|
||||
final ArrayList<TLRPC.Message> messages = new ArrayList<TLRPC.Message>();
|
||||
messages.add(res.message);
|
||||
MessagesStorage.getInstance().putMessages(messages, true, true);
|
||||
MessagesStorage.getInstance().putMessages(messages, true, true, false);
|
||||
if (MessagesStorage.lastSeqValue + 1 == res.seq) {
|
||||
MessagesStorage.lastSeqValue = res.seq;
|
||||
MessagesStorage.lastPtsValue = res.pts;
|
||||
@ -2799,12 +2979,14 @@ public class MessagesController implements NotificationCenter.NotificationCenter
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
public void addUserToChat(int chat_id, final TLRPC.User user, final TLRPC.ChatParticipants info, int count_fwd) {
|
||||
if (user == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (chat_id > 0) {
|
||||
TLRPC.TL_messages_addChatUser req = new TLRPC.TL_messages_addChatUser();
|
||||
req.chat_id = chat_id;
|
||||
req.fwd_limit = count_fwd;
|
||||
@ -2859,7 +3041,7 @@ public class MessagesController implements NotificationCenter.NotificationCenter
|
||||
|
||||
final ArrayList<TLRPC.Message> messages = new ArrayList<TLRPC.Message>();
|
||||
messages.add(res.message);
|
||||
MessagesStorage.getInstance().putMessages(messages, true, true);
|
||||
MessagesStorage.getInstance().putMessages(messages, true, true, false);
|
||||
if (MessagesStorage.lastSeqValue + 1 == res.seq) {
|
||||
MessagesStorage.lastSeqValue = res.seq;
|
||||
MessagesStorage.lastPtsValue = res.pts;
|
||||
@ -2880,12 +3062,37 @@ public class MessagesController implements NotificationCenter.NotificationCenter
|
||||
}
|
||||
}
|
||||
});
|
||||
} else {
|
||||
if (info != null) {
|
||||
for (TLRPC.TL_chatParticipant p : info.participants) {
|
||||
if (p.user_id == user.id) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
TLRPC.Chat chat = chats.get(chat_id);
|
||||
chat.participants_count++;
|
||||
ArrayList<TLRPC.Chat> chatArrayList = new ArrayList<TLRPC.Chat>();
|
||||
chatArrayList.add(chat);
|
||||
MessagesStorage.getInstance().putUsersAndChats(null, chatArrayList, true, true);
|
||||
|
||||
TLRPC.TL_chatParticipant newPart = new TLRPC.TL_chatParticipant();
|
||||
newPart.user_id = user.id;
|
||||
newPart.inviter_id = UserConfig.getClientUserId();
|
||||
newPart.date = ConnectionsManager.getInstance().getCurrentTime();
|
||||
info.participants.add(0, newPart);
|
||||
MessagesStorage.getInstance().updateChatInfo(info.chat_id, info, true);
|
||||
NotificationCenter.getInstance().postNotificationName(chatInfoDidLoaded, info.chat_id, info);
|
||||
NotificationCenter.getInstance().postNotificationName(updateInterfaces, UPDATE_MASK_CHAT_MEMBERS);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void deleteUserFromChat(int chat_id, final TLRPC.User user, final TLRPC.ChatParticipants info) {
|
||||
if (user == null) {
|
||||
return;
|
||||
}
|
||||
if (chat_id > 0) {
|
||||
TLRPC.TL_messages_deleteChatUser req = new TLRPC.TL_messages_deleteChatUser();
|
||||
req.chat_id = chat_id;
|
||||
req.user_id = getInputUser(user);
|
||||
@ -2940,7 +3147,7 @@ public class MessagesController implements NotificationCenter.NotificationCenter
|
||||
if (user.id != UserConfig.getClientUserId()) {
|
||||
final ArrayList<TLRPC.Message> messages = new ArrayList<TLRPC.Message>();
|
||||
messages.add(res.message);
|
||||
MessagesStorage.getInstance().putMessages(messages, true, true);
|
||||
MessagesStorage.getInstance().putMessages(messages, true, true, false);
|
||||
}
|
||||
if (MessagesStorage.lastSeqValue + 1 == res.seq) {
|
||||
MessagesStorage.lastSeqValue = res.seq;
|
||||
@ -2962,9 +3169,36 @@ public class MessagesController implements NotificationCenter.NotificationCenter
|
||||
}
|
||||
}
|
||||
});
|
||||
} else {
|
||||
if (info != null) {
|
||||
TLRPC.Chat chat = chats.get(chat_id);
|
||||
chat.participants_count--;
|
||||
ArrayList<TLRPC.Chat> chatArrayList = new ArrayList<TLRPC.Chat>();
|
||||
chatArrayList.add(chat);
|
||||
MessagesStorage.getInstance().putUsersAndChats(null, chatArrayList, true, true);
|
||||
|
||||
boolean changed = false;
|
||||
if (info != null) {
|
||||
for (int a = 0; a < info.participants.size(); a++) {
|
||||
TLRPC.TL_chatParticipant p = info.participants.get(a);
|
||||
if (p.user_id == user.id) {
|
||||
info.participants.remove(a);
|
||||
changed = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (changed) {
|
||||
MessagesStorage.getInstance().updateChatInfo(info.chat_id, info, true);
|
||||
NotificationCenter.getInstance().postNotificationName(chatInfoDidLoaded, info.chat_id, info);
|
||||
}
|
||||
}
|
||||
NotificationCenter.getInstance().postNotificationName(updateInterfaces, UPDATE_MASK_CHAT_MEMBERS);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void changeChatTitle(int chat_id, String title) {
|
||||
if (chat_id > 0) {
|
||||
TLRPC.TL_messages_editChatTitle req = new TLRPC.TL_messages_editChatTitle();
|
||||
req.chat_id = chat_id;
|
||||
req.title = title;
|
||||
@ -3001,7 +3235,7 @@ public class MessagesController implements NotificationCenter.NotificationCenter
|
||||
|
||||
final ArrayList<TLRPC.Message> messages = new ArrayList<TLRPC.Message>();
|
||||
messages.add(res.message);
|
||||
MessagesStorage.getInstance().putMessages(messages, true, true);
|
||||
MessagesStorage.getInstance().putMessages(messages, true, true, false);
|
||||
if (MessagesStorage.lastSeqValue + 1 == res.seq) {
|
||||
MessagesStorage.lastSeqValue = res.seq;
|
||||
MessagesStorage.lastPtsValue = res.pts;
|
||||
@ -3022,6 +3256,15 @@ public class MessagesController implements NotificationCenter.NotificationCenter
|
||||
}
|
||||
}
|
||||
});
|
||||
} else {
|
||||
TLRPC.Chat chat = chats.get(chat_id);
|
||||
chat.title = title;
|
||||
ArrayList<TLRPC.Chat> chatArrayList = new ArrayList<TLRPC.Chat>();
|
||||
chatArrayList.add(chat);
|
||||
MessagesStorage.getInstance().putUsersAndChats(null, chatArrayList, true, true);
|
||||
NotificationCenter.getInstance().postNotificationName(dialogsNeedReload);
|
||||
NotificationCenter.getInstance().postNotificationName(updateInterfaces, UPDATE_MASK_CHAT_NAME);
|
||||
}
|
||||
}
|
||||
|
||||
public void changeChatAvatar(int chat_id, TLRPC.InputFile uploadedAvatar) {
|
||||
@ -3067,7 +3310,7 @@ public class MessagesController implements NotificationCenter.NotificationCenter
|
||||
|
||||
final ArrayList<TLRPC.Message> messages = new ArrayList<TLRPC.Message>();
|
||||
messages.add(res.message);
|
||||
MessagesStorage.getInstance().putMessages(messages, true, true);
|
||||
MessagesStorage.getInstance().putMessages(messages, true, true, false);
|
||||
if (MessagesStorage.lastSeqValue + 1 == res.seq) {
|
||||
MessagesStorage.lastSeqValue = res.seq;
|
||||
MessagesStorage.lastPtsValue = res.pts;
|
||||
@ -3400,7 +3643,7 @@ public class MessagesController implements NotificationCenter.NotificationCenter
|
||||
|
||||
final ArrayList<MessageObject> pushMessages = new ArrayList<MessageObject>();
|
||||
for (TLRPC.Message message : res.new_messages) {
|
||||
MessageObject obj = new MessageObject(message, usersDict);
|
||||
MessageObject obj = new MessageObject(message, usersDict, 2);
|
||||
|
||||
long dialog_id = obj.messageOwner.dialog_id;
|
||||
if (dialog_id == 0) {
|
||||
@ -3456,7 +3699,7 @@ public class MessagesController implements NotificationCenter.NotificationCenter
|
||||
@Override
|
||||
public void run() {
|
||||
MessagesStorage.getInstance().startTransaction(false);
|
||||
MessagesStorage.getInstance().putMessages(res.new_messages, false, false);
|
||||
MessagesStorage.getInstance().putMessages(res.new_messages, false, false, false);
|
||||
MessagesStorage.getInstance().putUsersAndChats(res.users, res.chats, false, false);
|
||||
MessagesStorage.getInstance().commitTransaction(false);
|
||||
}
|
||||
@ -3556,7 +3799,7 @@ public class MessagesController implements NotificationCenter.NotificationCenter
|
||||
NotificationCenter.getInstance().postNotificationName(dialogsNeedReload);
|
||||
}
|
||||
});
|
||||
MessagesStorage.getInstance().putMessages(arr, false, true);
|
||||
MessagesStorage.getInstance().putMessages(arr, false, true, false);
|
||||
} else if (MessagesStorage.lastSeqValue != updates.seq) {
|
||||
FileLog.e("tmessages", "need get diff TL_updateShortChatMessage, seq: " + MessagesStorage.lastSeqValue + " " + updates.seq);
|
||||
if (gettingDifference || updatesStartWaitTime == 0 || updatesStartWaitTime != 0 && updatesStartWaitTime + 1500 > System.currentTimeMillis()) {
|
||||
@ -3611,7 +3854,7 @@ public class MessagesController implements NotificationCenter.NotificationCenter
|
||||
NotificationCenter.getInstance().postNotificationName(dialogsNeedReload);
|
||||
}
|
||||
});
|
||||
MessagesStorage.getInstance().putMessages(arr, false, true);
|
||||
MessagesStorage.getInstance().putMessages(arr, false, true, false);
|
||||
} else if (MessagesStorage.lastSeqValue != updates.seq) {
|
||||
FileLog.e("tmessages", "need get diff TL_updateShortMessage, seq: " + MessagesStorage.lastSeqValue + " " + updates.seq);
|
||||
if (gettingDifference || updatesStartWaitTime == 0 || updatesStartWaitTime != 0 && updatesStartWaitTime + 1500 > System.currentTimeMillis()) {
|
||||
@ -3784,7 +4027,7 @@ public class MessagesController implements NotificationCenter.NotificationCenter
|
||||
}
|
||||
}
|
||||
messagesArr.add(upd.message);
|
||||
MessageObject obj = new MessageObject(upd.message, usersDict);
|
||||
MessageObject obj = new MessageObject(upd.message, usersDict, 2);
|
||||
if (obj.type == 11) {
|
||||
interfaceUpdateMask |= UPDATE_MASK_CHAT_AVATAR;
|
||||
} else if (obj.type == 10) {
|
||||
@ -3933,7 +4176,7 @@ public class MessagesController implements NotificationCenter.NotificationCenter
|
||||
if (message != null) {
|
||||
int cid = ((TLRPC.TL_updateNewEncryptedMessage)update).message.chat_id;
|
||||
messagesArr.add(message);
|
||||
MessageObject obj = new MessageObject(message, usersDict);
|
||||
MessageObject obj = new MessageObject(message, usersDict, 2);
|
||||
long uid = ((long)cid) << 32;
|
||||
ArrayList<MessageObject> arr = messages.get(uid);
|
||||
if (arr == null) {
|
||||
@ -4082,7 +4325,7 @@ public class MessagesController implements NotificationCenter.NotificationCenter
|
||||
}
|
||||
|
||||
if (!messagesArr.isEmpty()) {
|
||||
MessagesStorage.getInstance().putMessages(messagesArr, true, true);
|
||||
MessagesStorage.getInstance().putMessages(messagesArr, true, true, false);
|
||||
}
|
||||
|
||||
Utilities.RunOnUIThread(new Runnable() {
|
||||
@ -4136,7 +4379,7 @@ public class MessagesController implements NotificationCenter.NotificationCenter
|
||||
} else {
|
||||
editor.remove("notify2_" + dialog_id);
|
||||
}
|
||||
} else if (update.peer instanceof TLRPC.TL_notifyChats) {
|
||||
}/* else if (update.peer instanceof TLRPC.TL_notifyChats) { disable global settings sync
|
||||
if (editor == null) {
|
||||
SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("Notifications", Activity.MODE_PRIVATE);
|
||||
editor = preferences.edit();
|
||||
@ -4150,7 +4393,7 @@ public class MessagesController implements NotificationCenter.NotificationCenter
|
||||
}
|
||||
editor.putBoolean("EnableAll", update.notify_settings.mute_until == 0);
|
||||
editor.putBoolean("EnablePreviewAll", update.notify_settings.show_previews);
|
||||
}
|
||||
}*/
|
||||
}
|
||||
}
|
||||
if (editor != null) {
|
||||
@ -4317,6 +4560,10 @@ public class MessagesController implements NotificationCenter.NotificationCenter
|
||||
}
|
||||
|
||||
private void updateInterfaceWithMessages(long uid, ArrayList<MessageObject> messages) {
|
||||
updateInterfaceWithMessages(uid, messages, false);
|
||||
}
|
||||
|
||||
private void updateInterfaceWithMessages(long uid, ArrayList<MessageObject> messages, boolean isBroadcast) {
|
||||
MessageObject lastMessage = null;
|
||||
TLRPC.TL_dialog dialog = dialogs_dict.get(uid);
|
||||
|
||||
@ -4333,6 +4580,7 @@ public class MessagesController implements NotificationCenter.NotificationCenter
|
||||
boolean changed = false;
|
||||
|
||||
if (dialog == null) {
|
||||
if (!isBroadcast) {
|
||||
dialog = new TLRPC.TL_dialog();
|
||||
dialog.id = uid;
|
||||
dialog.unread_count = 0;
|
||||
@ -4342,16 +4590,19 @@ public class MessagesController implements NotificationCenter.NotificationCenter
|
||||
dialogs.add(dialog);
|
||||
dialogMessage.put(lastMessage.messageOwner.id, lastMessage);
|
||||
changed = true;
|
||||
}
|
||||
} else {
|
||||
if (dialog.top_message > 0 && lastMessage.messageOwner.id > 0 && lastMessage.messageOwner.id > dialog.top_message ||
|
||||
dialog.top_message < 0 && lastMessage.messageOwner.id < 0 && lastMessage.messageOwner.id < dialog.top_message ||
|
||||
dialog.last_message_date < lastMessage.messageOwner.date) {
|
||||
dialogMessage.remove(dialog.top_message);
|
||||
dialog.top_message = lastMessage.messageOwner.id;
|
||||
if (!isBroadcast) {
|
||||
dialog.last_message_date = lastMessage.messageOwner.date;
|
||||
dialogMessage.put(lastMessage.messageOwner.id, lastMessage);
|
||||
changed = true;
|
||||
}
|
||||
dialogMessage.put(lastMessage.messageOwner.id, lastMessage);
|
||||
}
|
||||
}
|
||||
|
||||
if (changed) {
|
||||
@ -4597,8 +4848,13 @@ public class MessagesController implements NotificationCenter.NotificationCenter
|
||||
public void run() {
|
||||
TLRPC.TL_dialog dialog = dialogs_dict.get(did);
|
||||
if (dialog != null) {
|
||||
dialog.unread_count = 0;
|
||||
dialogMessage.remove(dialog.top_message);
|
||||
}
|
||||
NotificationsController.getInstance().processReadMessages(null, did, 0, Integer.MAX_VALUE);
|
||||
HashMap<Long, Integer> dialogsToUpdate = new HashMap<Long, Integer>();
|
||||
dialogsToUpdate.put(did, 0);
|
||||
NotificationsController.getInstance().processDialogsUpdateRead(dialogsToUpdate, true);
|
||||
MessagesStorage.getInstance().deleteDialog(did, true);
|
||||
NotificationCenter.getInstance().postNotificationName(removeAllMessagesFromDialog, did);
|
||||
NotificationCenter.getInstance().postNotificationName(dialogsNeedReload);
|
||||
|
@ -367,6 +367,7 @@ public class MessagesStorage {
|
||||
database.executeFast("DELETE FROM dialogs WHERE did = " + did).stepThis().dispose();
|
||||
database.executeFast("DELETE FROM chat_settings WHERE uid = " + did).stepThis().dispose();
|
||||
}
|
||||
database.executeFast("UPDATE dialogs SET unread_count = 0 WHERE did = " + did).stepThis().dispose();
|
||||
database.executeFast("DELETE FROM media_counts WHERE uid = " + did).stepThis().dispose();
|
||||
database.executeFast("DELETE FROM messages WHERE uid = " + did).stepThis().dispose();
|
||||
database.executeFast("DELETE FROM media WHERE uid = " + did).stepThis().dispose();
|
||||
@ -1808,7 +1809,7 @@ public class MessagesStorage {
|
||||
}
|
||||
}
|
||||
|
||||
private void putMessagesInternal(final ArrayList<TLRPC.Message> messages, final boolean withTransaction) {
|
||||
private void putMessagesInternal(final ArrayList<TLRPC.Message> messages, final boolean withTransaction, final boolean isBroadcast) {
|
||||
try {
|
||||
if (withTransaction) {
|
||||
database.beginTransaction();
|
||||
@ -1949,10 +1950,21 @@ public class MessagesStorage {
|
||||
state.dispose();
|
||||
state2.dispose();
|
||||
state3.dispose();
|
||||
state = database.executeFast("REPLACE INTO dialogs VALUES(?, ?, ifnull((SELECT unread_count FROM dialogs WHERE did = ?), 0) + ?, ?)");
|
||||
|
||||
state = database.executeFast("REPLACE INTO dialogs VALUES(?, ?, ?, ?)");
|
||||
for (HashMap.Entry<Long, TLRPC.Message> pair : messagesMap.entrySet()) {
|
||||
state.requery();
|
||||
Long key = pair.getKey();
|
||||
|
||||
int dialog_date = 0;
|
||||
int old_unread_count = 0;
|
||||
SQLiteCursor cursor = database.queryFinalized("SELECT date, unread_count FROM dialogs WHERE did = " + key);
|
||||
if (cursor.next()) {
|
||||
dialog_date = cursor.intValue(0);
|
||||
old_unread_count = cursor.intValue(1);
|
||||
}
|
||||
cursor.dispose();
|
||||
|
||||
state.requery();
|
||||
TLRPC.Message value = pair.getValue();
|
||||
Integer unread_count = messagesCounts.get(key);
|
||||
if (unread_count == null) {
|
||||
@ -1963,10 +1975,13 @@ public class MessagesStorage {
|
||||
messageId = value.local_id;
|
||||
}
|
||||
state.bindLong(1, key);
|
||||
if (!isBroadcast) {
|
||||
state.bindInteger(2, value.date);
|
||||
state.bindLong(3, key);
|
||||
state.bindInteger(4, unread_count);
|
||||
state.bindInteger(5, messageId);
|
||||
} else {
|
||||
state.bindInteger(2, dialog_date != 0 ? dialog_date : value.date);
|
||||
}
|
||||
state.bindInteger(3, unread_count);
|
||||
state.bindInteger(4, messageId);
|
||||
state.step();
|
||||
}
|
||||
state.dispose();
|
||||
@ -2002,7 +2017,7 @@ public class MessagesStorage {
|
||||
}
|
||||
}
|
||||
|
||||
public void putMessages(final ArrayList<TLRPC.Message> messages, final boolean withTransaction, boolean useQueue) {
|
||||
public void putMessages(final ArrayList<TLRPC.Message> messages, final boolean withTransaction, boolean useQueue, final boolean isBroadcast) {
|
||||
if (messages.size() == 0) {
|
||||
return;
|
||||
}
|
||||
@ -2010,11 +2025,11 @@ public class MessagesStorage {
|
||||
storageQueue.postRunnable(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
putMessagesInternal(messages, withTransaction);
|
||||
putMessagesInternal(messages, withTransaction, isBroadcast);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
putMessagesInternal(messages, withTransaction);
|
||||
putMessagesInternal(messages, withTransaction, isBroadcast);
|
||||
}
|
||||
}
|
||||
|
||||
@ -2425,9 +2440,15 @@ public class MessagesStorage {
|
||||
}
|
||||
}
|
||||
} else {
|
||||
int encryptedId = (int)(dialog.id >> 32);
|
||||
if (!encryptedToLoad.contains(encryptedId)) {
|
||||
encryptedToLoad.add(encryptedId);
|
||||
int high_id = (int)(dialog.id >> 32);
|
||||
if (high_id > 0) {
|
||||
if (!encryptedToLoad.contains(high_id)) {
|
||||
encryptedToLoad.add(high_id);
|
||||
}
|
||||
} else {
|
||||
if (!chatsToLoad.contains(high_id)) {
|
||||
chatsToLoad.add(high_id);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -2692,9 +2713,15 @@ public class MessagesStorage {
|
||||
}
|
||||
}
|
||||
} else {
|
||||
int encryptedId = (int)(dialog.id >> 32);
|
||||
if (!encryptedToLoad.contains(encryptedId)) {
|
||||
encryptedToLoad.add(encryptedId);
|
||||
int high_id = (int)(dialog.id >> 32);
|
||||
if (high_id > 0) {
|
||||
if (!encryptedToLoad.contains(high_id)) {
|
||||
encryptedToLoad.add(high_id);
|
||||
}
|
||||
} else {
|
||||
if (!chatsToLoad.contains(high_id)) {
|
||||
chatsToLoad.add(high_id);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -25,8 +25,8 @@ public class NativeLoader {
|
||||
|
||||
private static final long sizes[] = new long[] {
|
||||
799376, //armeabi
|
||||
848548, //armeabi-v7a
|
||||
1246260, //x86
|
||||
852644, //armeabi-v7a
|
||||
1250356, //x86
|
||||
0, //mips
|
||||
};
|
||||
|
||||
|
@ -400,7 +400,7 @@ public class NotificationsController {
|
||||
}
|
||||
|
||||
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) {
|
||||
mBuilder.setLargeIcon(img);
|
||||
}
|
||||
@ -536,7 +536,7 @@ public class NotificationsController {
|
||||
|
||||
Boolean value = settingsCache.get(dialog_id);
|
||||
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) {
|
||||
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);
|
||||
|
@ -850,7 +850,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) {
|
||||
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);
|
||||
return 0;
|
||||
}
|
||||
|
@ -248,10 +248,14 @@ public class FileLoadOperation {
|
||||
|
||||
float w_filter = 0;
|
||||
float h_filter = 0;
|
||||
boolean blur = false;
|
||||
if (filter != null) {
|
||||
String args[] = filter.split("_");
|
||||
w_filter = Float.parseFloat(args[0]) * AndroidUtilities.density;
|
||||
h_filter = Float.parseFloat(args[1]) * AndroidUtilities.density;
|
||||
if (args.length > 2) {
|
||||
blur = true;
|
||||
}
|
||||
opts.inJustDecodeBounds = true;
|
||||
|
||||
if (mediaIdFinal != null) {
|
||||
@ -270,7 +274,7 @@ public class FileLoadOperation {
|
||||
opts.inSampleSize = (int)scaleFactor;
|
||||
}
|
||||
|
||||
if (filter == null) {
|
||||
if (filter == null || blur) {
|
||||
opts.inPreferredConfig = Bitmap.Config.ARGB_8888;
|
||||
} else {
|
||||
opts.inPreferredConfig = Bitmap.Config.RGB_565;
|
||||
@ -300,7 +304,9 @@ public class FileLoadOperation {
|
||||
image = scaledBitmap;
|
||||
}
|
||||
}
|
||||
|
||||
if (image != null && blur && bitmapH < 100 && bitmapW < 100) {
|
||||
Utilities.blurBitmap(image, (int)bitmapW, (int)bitmapH, image.getRowBytes());
|
||||
}
|
||||
}
|
||||
if (FileLoader.getInstance().runtimeHack != null) {
|
||||
FileLoader.getInstance().runtimeHack.trackFree(image.getRowBytes() * image.getHeight());
|
||||
@ -494,10 +500,14 @@ public class FileLoadOperation {
|
||||
|
||||
float w_filter = 0;
|
||||
float h_filter;
|
||||
boolean blur = false;
|
||||
if (filter != null) {
|
||||
String args[] = filter.split("_");
|
||||
w_filter = Float.parseFloat(args[0]) * AndroidUtilities.density;
|
||||
h_filter = Float.parseFloat(args[1]) * AndroidUtilities.density;
|
||||
if (args.length > 2) {
|
||||
blur = true;
|
||||
}
|
||||
|
||||
opts.inJustDecodeBounds = true;
|
||||
BitmapFactory.decodeFile(cacheFileFinal.getAbsolutePath(), opts);
|
||||
@ -511,7 +521,7 @@ public class FileLoadOperation {
|
||||
opts.inSampleSize = (int) scaleFactor;
|
||||
}
|
||||
|
||||
if (filter == null) {
|
||||
if (filter == null || blur) {
|
||||
opts.inPreferredConfig = Bitmap.Config.ARGB_8888;
|
||||
} else {
|
||||
opts.inPreferredConfig = Bitmap.Config.RGB_565;
|
||||
@ -540,7 +550,9 @@ public class FileLoadOperation {
|
||||
image = scaledBitmap;
|
||||
}
|
||||
}
|
||||
|
||||
if (image != null && blur && bitmapH < 100 && bitmapW < 100) {
|
||||
Utilities.blurBitmap(image, (int)bitmapW, (int)bitmapH, image.getRowBytes());
|
||||
}
|
||||
}
|
||||
if (image != null && FileLoader.getInstance().runtimeHack != null) {
|
||||
FileLoader.getInstance().runtimeHack.trackFree(image.getRowBytes() * image.getHeight());
|
||||
|
@ -64,7 +64,7 @@ public class FileLoader {
|
||||
private long lastProgressUpdateTime = 0;
|
||||
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 FileDidFailUpload = 10001;
|
||||
@ -717,15 +717,15 @@ public class FileLoader {
|
||||
});
|
||||
}
|
||||
|
||||
public Bitmap getImageFromMemory(TLRPC.FileLocation url, ImageReceiver imageView, String filter, boolean cancel) {
|
||||
return getImageFromMemory(url, null, imageView, filter, cancel);
|
||||
public Bitmap getImageFromMemory(TLRPC.FileLocation url, ImageReceiver imageView, String filter) {
|
||||
return getImageFromMemory(url, null, imageView, filter);
|
||||
}
|
||||
|
||||
public Bitmap getImageFromMemory(String url, ImageReceiver imageView, String filter, boolean cancel) {
|
||||
return getImageFromMemory(null, url, imageView, filter, cancel);
|
||||
public Bitmap getImageFromMemory(String url, ImageReceiver imageView, String filter) {
|
||||
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) {
|
||||
return null;
|
||||
}
|
||||
@ -739,11 +739,7 @@ public class FileLoader {
|
||||
key += "@" + filter;
|
||||
}
|
||||
|
||||
Bitmap img = imageFromKey(key);
|
||||
if (imageView != null && img != null && cancel) {
|
||||
cancelLoadingForImageView(imageView);
|
||||
}
|
||||
return img;
|
||||
return imageFromKey(key);
|
||||
}
|
||||
|
||||
private void performReplace(String oldKey, String newKey) {
|
||||
|
@ -439,6 +439,7 @@ public class TLClassStore {
|
||||
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_video_old.constructor, TLRPC.TL_video_old.class);
|
||||
classStore.put(TLRPC.TL_messageActionCreatedBroadcastList.constructor, TLRPC.TL_messageActionCreatedBroadcastList.class);
|
||||
}
|
||||
|
||||
static TLClassStore store = null;
|
||||
|
@ -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 int constructor = 0x55555556;
|
||||
|
||||
|
@ -24,6 +24,7 @@ public class UserConfig {
|
||||
public static String pushString = "";
|
||||
public static int lastSendMessageId = -210000;
|
||||
public static int lastLocalId = -210000;
|
||||
public static int lastBroadcastId = -1;
|
||||
public static String contactsHash = "";
|
||||
public static String importHash = "";
|
||||
private final static Integer sync = 1;
|
||||
@ -56,6 +57,7 @@ public class UserConfig {
|
||||
editor.putString("importHash", importHash);
|
||||
editor.putBoolean("saveIncomingPhotos", saveIncomingPhotos);
|
||||
editor.putInt("contactsVersion", contactsVersion);
|
||||
editor.putInt("lastBroadcastId", lastBroadcastId);
|
||||
editor.putBoolean("registeredForInternalPush", registeredForInternalPush);
|
||||
if (currentUser != null) {
|
||||
if (withFile) {
|
||||
@ -174,6 +176,7 @@ public class UserConfig {
|
||||
importHash = preferences.getString("importHash", "");
|
||||
saveIncomingPhotos = preferences.getBoolean("saveIncomingPhotos", false);
|
||||
contactsVersion = preferences.getInt("contactsVersion", 0);
|
||||
lastBroadcastId = preferences.getInt("lastBroadcastId", -1);
|
||||
registeredForInternalPush = preferences.getBoolean("registeredForInternalPush", false);
|
||||
String user = preferences.getString("user", null);
|
||||
if (user != null) {
|
||||
@ -196,6 +199,7 @@ public class UserConfig {
|
||||
lastLocalId = -210000;
|
||||
lastSendMessageId = -210000;
|
||||
contactsVersion = 1;
|
||||
lastBroadcastId = -1;
|
||||
saveIncomingPhotos = false;
|
||||
saveConfig(true);
|
||||
}
|
||||
|
@ -132,6 +132,7 @@ public class Utilities {
|
||||
|
||||
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 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);
|
||||
|
||||
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 {
|
||||
}
|
||||
|
||||
public static Integer parseInt(String value) {
|
||||
if (value == null) {
|
||||
return 0;
|
||||
}
|
||||
Integer val = 0;
|
||||
try {
|
||||
Matcher matcher = pattern.matcher(value);
|
||||
@ -548,7 +552,7 @@ public class Utilities {
|
||||
}
|
||||
|
||||
public static int getGroupAvatarForId(int id) {
|
||||
return arrGroupsAvatars[getColorIndex(-id)];
|
||||
return arrGroupsAvatars[getColorIndex(-Math.abs(id))];
|
||||
}
|
||||
|
||||
public static String MD5(String md5) {
|
||||
|
@ -63,6 +63,10 @@ public class MessageObject {
|
||||
public ArrayList<TextLayoutBlock> textLayoutBlocks;
|
||||
|
||||
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) {
|
||||
textPaint = new TextPaint(Paint.ANTI_ALIAS_FLAG);
|
||||
textPaint.setColor(0xff000000);
|
||||
@ -136,7 +140,7 @@ public class MessageObject {
|
||||
} 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));
|
||||
photoThumbs.add(new PhotoObject(size, preview));
|
||||
}
|
||||
if (isFromMe()) {
|
||||
messageText = LocaleController.getString("ActionYouChangedPhoto", R.string.ActionYouChangedPhoto);
|
||||
@ -232,13 +236,15 @@ 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)) {
|
||||
if (message.media instanceof TLRPC.TL_messageMediaPhoto) {
|
||||
photoThumbs = new ArrayList<PhotoObject>();
|
||||
for (TLRPC.PhotoSize size : message.media.photo.sizes) {
|
||||
PhotoObject obj = new PhotoObject(size);
|
||||
PhotoObject obj = new PhotoObject(size, preview);
|
||||
photoThumbs.add(obj);
|
||||
if (imagePreview == null && obj.image != null) {
|
||||
imagePreview = obj.image;
|
||||
@ -247,7 +253,7 @@ public class MessageObject {
|
||||
messageText = LocaleController.getString("AttachPhoto", R.string.AttachPhoto);
|
||||
} else if (message.media instanceof TLRPC.TL_messageMediaVideo) {
|
||||
photoThumbs = new ArrayList<PhotoObject>();
|
||||
PhotoObject obj = new PhotoObject(message.media.video.thumb);
|
||||
PhotoObject obj = new PhotoObject(message.media.video.thumb, preview);
|
||||
photoThumbs.add(obj);
|
||||
if (imagePreview == null && obj.image != null) {
|
||||
imagePreview = obj.image;
|
||||
@ -262,7 +268,7 @@ public class MessageObject {
|
||||
} 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);
|
||||
PhotoObject obj = new PhotoObject(message.media.document.thumb, preview);
|
||||
photoThumbs.add(obj);
|
||||
}
|
||||
messageText = LocaleController.getString("AttachDocument", R.string.AttachDocument);
|
||||
|
@ -13,6 +13,7 @@ import android.graphics.BitmapFactory;
|
||||
|
||||
import org.telegram.messenger.TLRPC;
|
||||
import org.telegram.messenger.FileLoader;
|
||||
import org.telegram.messenger.Utilities;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
@ -20,21 +21,26 @@ public class PhotoObject {
|
||||
public TLRPC.PhotoSize photoOwner;
|
||||
public Bitmap image;
|
||||
|
||||
public PhotoObject(TLRPC.PhotoSize photo) {
|
||||
public PhotoObject(TLRPC.PhotoSize photo, int preview) {
|
||||
photoOwner = photo;
|
||||
|
||||
if (photo instanceof TLRPC.TL_photoCachedSize) {
|
||||
if (preview != 0 && photo instanceof TLRPC.TL_photoCachedSize) {
|
||||
BitmapFactory.Options opts = new BitmapFactory.Options();
|
||||
opts.inPreferredConfig = Bitmap.Config.RGB_565;
|
||||
opts.inPreferredConfig = Bitmap.Config.ARGB_8888;
|
||||
opts.inDither = false;
|
||||
opts.outWidth = photo.w;
|
||||
opts.outHeight = photo.h;
|
||||
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());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static PhotoObject getClosestImageWithSize(ArrayList<PhotoObject> arr, int width, int height) {
|
||||
if (arr == null) {
|
||||
|
@ -31,7 +31,7 @@ import org.telegram.objects.PhotoObject;
|
||||
import org.telegram.ui.PhotoViewer;
|
||||
import org.telegram.ui.Views.GifDrawable;
|
||||
import org.telegram.ui.Views.ImageReceiver;
|
||||
import org.telegram.ui.Views.ProgressView;
|
||||
import org.telegram.ui.Views.RoundProgressView;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.Locale;
|
||||
@ -45,7 +45,7 @@ public class ChatMediaCell extends ChatBaseCell implements MediaController.FileD
|
||||
private static Drawable placeholderInDrawable;
|
||||
private static Drawable placeholderOutDrawable;
|
||||
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 MessageObject lastDownloadedGifMessage = null;
|
||||
|
||||
@ -57,10 +57,11 @@ public class ChatMediaCell extends ChatBaseCell implements MediaController.FileD
|
||||
private String currentUrl;
|
||||
private String currentPhotoFilter;
|
||||
private ImageReceiver photoImage;
|
||||
private ProgressView progressView;
|
||||
private RoundProgressView progressView;
|
||||
public int downloadPhotos = 0;
|
||||
private boolean progressVisible = false;
|
||||
private boolean photoNotSet = false;
|
||||
private boolean cancelLoading = false;
|
||||
|
||||
private int TAG;
|
||||
|
||||
@ -83,14 +84,10 @@ public class ChatMediaCell extends ChatBaseCell implements MediaController.FileD
|
||||
if (placeholderInDrawable == null) {
|
||||
placeholderInDrawable = getResources().getDrawable(R.drawable.photo_placeholder_in);
|
||||
placeholderOutDrawable = getResources().getDrawable(R.drawable.photo_placeholder_out);
|
||||
buttonStatesDrawables[0][0] = getResources().getDrawable(R.drawable.photoload);
|
||||
buttonStatesDrawables[0][1] = getResources().getDrawable(R.drawable.photoload_pressed);
|
||||
buttonStatesDrawables[1][0] = getResources().getDrawable(R.drawable.photocancel);
|
||||
buttonStatesDrawables[1][1] = getResources().getDrawable(R.drawable.photocancel_pressed);
|
||||
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);
|
||||
buttonStatesDrawables[0] = getResources().getDrawable(R.drawable.photoload);
|
||||
buttonStatesDrawables[1] = getResources().getDrawable(R.drawable.photocancel);
|
||||
buttonStatesDrawables[2] = getResources().getDrawable(R.drawable.photogif);
|
||||
buttonStatesDrawables[3] = getResources().getDrawable(R.drawable.playvideo);
|
||||
videoIconDrawable = getResources().getDrawable(R.drawable.ic_video);
|
||||
|
||||
infoPaint = new TextPaint(Paint.ANTI_ALIAS_FLAG);
|
||||
@ -102,8 +99,7 @@ public class ChatMediaCell extends ChatBaseCell implements MediaController.FileD
|
||||
|
||||
photoImage = new ImageReceiver();
|
||||
photoImage.parentView = this;
|
||||
progressView = new ProgressView();
|
||||
progressView.setProgressColors(0x802a2a2a, 0xffffffff);
|
||||
progressView = new RoundProgressView();
|
||||
}
|
||||
|
||||
public void clearGifImage() {
|
||||
@ -225,6 +221,7 @@ public class ChatMediaCell extends ChatBaseCell implements MediaController.FileD
|
||||
|
||||
private void didPressedButton() {
|
||||
if (buttonState == 0) {
|
||||
cancelLoading = false;
|
||||
if (currentMessageObject.type == 1) {
|
||||
if (currentMessageObject.imagePreview != null) {
|
||||
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
|
||||
delegate.didPressedCancelSendButton(this);
|
||||
}
|
||||
} else {
|
||||
cancelLoading = true;
|
||||
if (currentMessageObject.type == 1) {
|
||||
FileLoader.getInstance().cancelLoadingForImageView(photoImage);
|
||||
} else if (currentMessageObject.type == 8) {
|
||||
@ -304,6 +302,7 @@ public class ChatMediaCell extends ChatBaseCell implements MediaController.FileD
|
||||
public void setMessageObject(MessageObject messageObject) {
|
||||
if (currentMessageObject != messageObject || isPhotoDataChanged(messageObject) || isUserDataChanged()) {
|
||||
super.setMessageObject(messageObject);
|
||||
cancelLoading = false;
|
||||
|
||||
progressVisible = false;
|
||||
buttonState = -1;
|
||||
@ -395,6 +394,9 @@ public class ChatMediaCell extends ChatBaseCell implements MediaController.FileD
|
||||
photoHeight = h;
|
||||
backgroundWidth = w + AndroidUtilities.dp(12);
|
||||
currentPhotoFilter = String.format(Locale.US, "%d_%d", (int) (w / AndroidUtilities.density), (int) (h / AndroidUtilities.density));
|
||||
if (messageObject.photoThumbs.size() > 1) {
|
||||
currentPhotoFilter += "_b";
|
||||
}
|
||||
|
||||
if (currentPhotoObject.image != null) {
|
||||
photoImage.setImageBitmap(currentPhotoObject.image);
|
||||
@ -485,20 +487,16 @@ public class ChatMediaCell extends ChatBaseCell implements MediaController.FileD
|
||||
if (!cacheFile.exists()) {
|
||||
MediaController.getInstance().addLoadingFileObserver(fileName, this);
|
||||
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;
|
||||
progressVisible = false;
|
||||
} else {
|
||||
buttonState = -1;
|
||||
buttonState = 1;
|
||||
progressVisible = true;
|
||||
}
|
||||
progressView.setProgress(0);
|
||||
} else {
|
||||
if (currentMessageObject.type != 1 || downloadPhotos == 1 || downloadPhotos == 2 && !ConnectionsManager.isConnectedToWiFi()) {
|
||||
buttonState = 1;
|
||||
} else {
|
||||
buttonState = -1;
|
||||
}
|
||||
progressVisible = true;
|
||||
Float progress = FileLoader.getInstance().fileProgresses.get(fileName);
|
||||
if (progress != null) {
|
||||
@ -544,13 +542,10 @@ public class ChatMediaCell extends ChatBaseCell implements MediaController.FileD
|
||||
photoImage.imageW = photoWidth;
|
||||
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);
|
||||
buttonX = (int)(photoImage.imageX + (photoWidth - 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
|
||||
@ -566,22 +561,16 @@ public class ChatMediaCell extends ChatBaseCell implements MediaController.FileD
|
||||
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) {
|
||||
Drawable currentButtonDrawable = buttonStatesDrawables[buttonState][buttonPressed];
|
||||
Drawable currentButtonDrawable = buttonStatesDrawables[buttonState];
|
||||
setDrawableBounds(currentButtonDrawable, buttonX, buttonY);
|
||||
currentButtonDrawable.draw(canvas);
|
||||
}
|
||||
|
||||
if (progressVisible) {
|
||||
progressView.draw(canvas);
|
||||
}
|
||||
|
||||
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));
|
||||
mediaBackgroundDrawable.draw(canvas);
|
||||
|
@ -46,6 +46,7 @@ public class DialogCell extends BaseCell {
|
||||
private static Drawable lockDrawable;
|
||||
private static Drawable countDrawable;
|
||||
private static Drawable groupDrawable;
|
||||
private static Drawable broadcastDrawable;
|
||||
|
||||
private TLRPC.TL_dialog currentDialog;
|
||||
private ImageReceiver avatarImage;
|
||||
@ -130,6 +131,10 @@ public class DialogCell extends BaseCell {
|
||||
groupDrawable = getResources().getDrawable(R.drawable.grouplist);
|
||||
}
|
||||
|
||||
if (broadcastDrawable == null) {
|
||||
broadcastDrawable = getResources().getDrawable(R.drawable.broadcast);
|
||||
}
|
||||
|
||||
if (avatarImage == null) {
|
||||
avatarImage = new ImageReceiver();
|
||||
avatarImage.parentView = this;
|
||||
@ -227,10 +232,15 @@ public class DialogCell extends BaseCell {
|
||||
user = MessagesController.getInstance().users.get(lower_id);
|
||||
}
|
||||
} else {
|
||||
encryptedChat = MessagesController.getInstance().encryptedChats.get((int)(currentDialog.id >> 32));
|
||||
int high_id = (int)(currentDialog.id >> 32);
|
||||
if (high_id > 0) {
|
||||
encryptedChat = MessagesController.getInstance().encryptedChats.get(high_id);
|
||||
if (encryptedChat != null) {
|
||||
user = MessagesController.getInstance().users.get(encryptedChat.user_id);
|
||||
}
|
||||
} else {
|
||||
chat = MessagesController.getInstance().chats.get(high_id);
|
||||
}
|
||||
}
|
||||
|
||||
int placeHolderId = 0;
|
||||
@ -274,6 +284,9 @@ public class DialogCell extends BaseCell {
|
||||
} 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();
|
||||
@ -328,6 +341,7 @@ public class DialogCell extends BaseCell {
|
||||
private StaticLayout nameLayout;
|
||||
private boolean drawNameLock;
|
||||
private boolean drawNameGroup;
|
||||
private boolean drawNameBroadcast;
|
||||
private int nameLockLeft;
|
||||
private int nameLockTop;
|
||||
|
||||
@ -372,9 +386,12 @@ public class DialogCell extends BaseCell {
|
||||
TextPaint currentMessagePaint = messagePaint;
|
||||
boolean checkMessage = true;
|
||||
|
||||
drawNameGroup = false;
|
||||
drawNameBroadcast = false;
|
||||
drawNameLock = false;
|
||||
|
||||
if (encryptedChat != null) {
|
||||
drawNameLock = true;
|
||||
drawNameGroup = false;
|
||||
nameLockTop = AndroidUtilities.dp(13);
|
||||
if (!LocaleController.isRTL) {
|
||||
nameLockLeft = AndroidUtilities.dp(77);
|
||||
@ -384,19 +401,21 @@ public class DialogCell extends BaseCell {
|
||||
nameLeft = AndroidUtilities.dp(14);
|
||||
}
|
||||
} else {
|
||||
drawNameLock = false;
|
||||
if (chat != null) {
|
||||
if (chat.id < 0) {
|
||||
drawNameBroadcast = true;
|
||||
} else {
|
||||
drawNameGroup = true;
|
||||
}
|
||||
nameLockTop = AndroidUtilities.dp(14);
|
||||
if (!LocaleController.isRTL) {
|
||||
nameLockLeft = AndroidUtilities.dp(77);
|
||||
nameLeft = AndroidUtilities.dp(81) + groupDrawable.getIntrinsicWidth();
|
||||
nameLeft = AndroidUtilities.dp(81) + (drawNameGroup ? groupDrawable.getIntrinsicWidth() : broadcastDrawable.getIntrinsicWidth());
|
||||
} else {
|
||||
nameLockLeft = width - AndroidUtilities.dp(77) - groupDrawable.getIntrinsicWidth();
|
||||
nameLockLeft = width - AndroidUtilities.dp(77) - (drawNameGroup ? groupDrawable.getIntrinsicWidth() : broadcastDrawable.getIntrinsicWidth());
|
||||
nameLeft = AndroidUtilities.dp(14);
|
||||
}
|
||||
} else {
|
||||
drawNameGroup = false;
|
||||
if (!LocaleController.isRTL) {
|
||||
nameLeft = AndroidUtilities.dp(77);
|
||||
} else {
|
||||
@ -461,7 +480,7 @@ public class DialogCell extends BaseCell {
|
||||
messageString = message.messageText;
|
||||
currentMessagePaint = messagePrintingPaint;
|
||||
} else {
|
||||
if (chat != null) {
|
||||
if (chat != null && chat.id > 0) {
|
||||
String name = "";
|
||||
if (message.isFromMe()) {
|
||||
name = LocaleController.getString("FromYou", R.string.FromYou);
|
||||
@ -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) {
|
||||
drawCheck1 = false;
|
||||
drawCheck2 = false;
|
||||
@ -579,6 +598,8 @@ public class DialogCell extends BaseCell {
|
||||
nameWidth -= AndroidUtilities.dp(4) + lockDrawable.getIntrinsicWidth();
|
||||
} else if (drawNameGroup) {
|
||||
nameWidth -= AndroidUtilities.dp(4) + groupDrawable.getIntrinsicWidth();
|
||||
} else if (drawNameBroadcast) {
|
||||
nameWidth -= AndroidUtilities.dp(4) + broadcastDrawable.getIntrinsicWidth();
|
||||
}
|
||||
if (drawClock) {
|
||||
int w = clockDrawable.getIntrinsicWidth() + AndroidUtilities.dp(2);
|
||||
|
@ -212,7 +212,11 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
||||
}
|
||||
}
|
||||
MessagesController.getInstance().loadChatInfo(currentChat.id);
|
||||
if (chatId > 0) {
|
||||
dialog_id = -chatId;
|
||||
} else {
|
||||
dialog_id = ((long)chatId) << 32;
|
||||
}
|
||||
} else if (userId != 0) {
|
||||
currentUser = MessagesController.getInstance().users.get(userId);
|
||||
if (currentUser == null) {
|
||||
@ -528,6 +532,8 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
||||
|
||||
if (currentEncryptedChat != null) {
|
||||
actionBarLayer.setTitleIcon(R.drawable.ic_lock_white, AndroidUtilities.dp(4));
|
||||
} else if (currentChat != null && currentChat.id < 0) {
|
||||
actionBarLayer.setTitleIcon(R.drawable.broadcast2, AndroidUtilities.dp(4));
|
||||
}
|
||||
|
||||
ActionBarMenu menu = actionBarLayer.createMenu();
|
||||
@ -1045,7 +1051,8 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
||||
|
||||
private int getMessageType(MessageObject messageObject) {
|
||||
if (currentEncryptedChat == null) {
|
||||
if (messageObject.messageOwner.id <= 0 && messageObject.isOut()) {
|
||||
boolean isBroadcastError = (int)dialog_id == 0 && messageObject.messageOwner.id <= 0 && messageObject.messageOwner.send_state == MessagesController.MESSAGE_SEND_STATE_SEND_ERROR;
|
||||
if ((int)dialog_id != 0 && messageObject.messageOwner.id <= 0 && messageObject.isOut() || isBroadcastError) {
|
||||
if (messageObject.messageOwner.send_state == MessagesController.MESSAGE_SEND_STATE_SEND_ERROR) {
|
||||
if (!(messageObject.messageOwner.media instanceof TLRPC.TL_messageMediaEmpty)) {
|
||||
return 0;
|
||||
@ -1771,7 +1778,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
||||
if (messArr.size() != count) {
|
||||
if (isCache) {
|
||||
cacheEndReaced = true;
|
||||
if (currentEncryptedChat != null) {
|
||||
if ((int)dialog_id == 0) {
|
||||
endReached = true;
|
||||
}
|
||||
} else {
|
||||
@ -2897,26 +2904,26 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
||||
|
||||
private void forwardSelectedMessages(long did, boolean fromMyName) {
|
||||
if (forwaringMessage != null) {
|
||||
if (forwaringMessage.messageOwner.id > 0) {
|
||||
if (!fromMyName) {
|
||||
if (forwaringMessage.messageOwner.id > 0) {
|
||||
MessagesController.getInstance().sendMessage(forwaringMessage, did);
|
||||
}
|
||||
} else {
|
||||
processForwardFromMe(forwaringMessage, did);
|
||||
}
|
||||
}
|
||||
forwaringMessage = null;
|
||||
} else {
|
||||
ArrayList<Integer> ids = new ArrayList<Integer>(selectedMessagesIds.keySet());
|
||||
Collections.sort(ids);
|
||||
for (Integer id : ids) {
|
||||
if (id > 0) {
|
||||
if (!fromMyName) {
|
||||
if (id > 0) {
|
||||
MessagesController.getInstance().sendMessage(selectedMessagesIds.get(id), did);
|
||||
}
|
||||
} else {
|
||||
processForwardFromMe(selectedMessagesIds.get(id), did);
|
||||
}
|
||||
}
|
||||
}
|
||||
selectedMessagesCanCopyIds.clear();
|
||||
selectedMessagesIds.clear();
|
||||
}
|
||||
@ -2925,7 +2932,9 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
||||
@Override
|
||||
public void didSelectDialog(MessagesActivity activity, long did, boolean param) {
|
||||
if (dialog_id != 0 && (forwaringMessage != null || !selectedMessagesIds.isEmpty())) {
|
||||
|
||||
if ((int)dialog_id == 0 && currentEncryptedChat == null) {
|
||||
param = true;
|
||||
}
|
||||
if (did != dialog_id) {
|
||||
int lower_part = (int)did;
|
||||
if (lower_part != 0) {
|
||||
|
@ -112,7 +112,9 @@ public class ChatProfileActivity extends BaseFragment implements NotificationCen
|
||||
NotificationCenter.getInstance().addObserver(this, MessagesController.closeChats);
|
||||
|
||||
updateOnlineCount();
|
||||
if (chat_id > 0) {
|
||||
MessagesController.getInstance().getMediaCount(-chat_id, classGuid, true);
|
||||
}
|
||||
avatarUpdater.delegate = new AvatarUpdater.AvatarUpdaterDelegate() {
|
||||
@Override
|
||||
public void didUploadedPhoto(TLRPC.InputFile file, TLRPC.PhotoSize small, TLRPC.PhotoSize big) {
|
||||
@ -131,10 +133,12 @@ public class ChatProfileActivity extends BaseFragment implements NotificationCen
|
||||
private void updateRowsIds() {
|
||||
rowCount = 0;
|
||||
avatarRow = rowCount++;
|
||||
if (chat_id > 0) {
|
||||
settingsSectionRow = rowCount++;
|
||||
settingsNotificationsRow = rowCount++;
|
||||
sharedMediaSectionRow = rowCount++;
|
||||
sharedMediaRow = rowCount++;
|
||||
}
|
||||
if (info != null && !(info instanceof TLRPC.TL_chatParticipantsForbidden)) {
|
||||
membersSectionRow = rowCount++;
|
||||
rowCount += info.participants.size();
|
||||
@ -149,8 +153,10 @@ public class ChatProfileActivity extends BaseFragment implements NotificationCen
|
||||
addMemberRow = -1;
|
||||
membersSectionRow = -1;
|
||||
}
|
||||
if (chat_id > 0) {
|
||||
leaveGroupRow = rowCount++;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFragmentDestroy() {
|
||||
@ -166,7 +172,11 @@ public class ChatProfileActivity extends BaseFragment implements NotificationCen
|
||||
if (fragmentView == null) {
|
||||
actionBarLayer.setDisplayHomeAsUpEnabled(true, R.drawable.ic_ab_back);
|
||||
actionBarLayer.setBackOverlay(R.layout.updating_state_layout);
|
||||
if (chat_id > 0) {
|
||||
actionBarLayer.setTitle(LocaleController.getString("GroupInfo", R.string.GroupInfo));
|
||||
} else {
|
||||
actionBarLayer.setTitle(LocaleController.getString("BroadcastList", R.string.BroadcastList));
|
||||
}
|
||||
actionBarLayer.setActionBarMenuOnItemClick(new ActionBarLayer.ActionBarMenuOnItemClick() {
|
||||
@Override
|
||||
public void onItemClick(int id) {
|
||||
@ -181,7 +191,11 @@ public class ChatProfileActivity extends BaseFragment implements NotificationCen
|
||||
View item = menu.addItemResource(done_button, R.layout.group_profile_add_member_layout);
|
||||
TextView textView = (TextView)item.findViewById(R.id.done_button);
|
||||
if (textView != null) {
|
||||
if (chat_id > 0) {
|
||||
textView.setText(LocaleController.getString("AddMember", R.string.AddMember));
|
||||
} else {
|
||||
textView.setText(LocaleController.getString("AddRecipient", R.string.AddRecipient));
|
||||
}
|
||||
}
|
||||
|
||||
fragmentView = inflater.inflate(R.layout.chat_profile_layout, container, false);
|
||||
@ -206,7 +220,7 @@ public class ChatProfileActivity extends BaseFragment implements NotificationCen
|
||||
selectedUser = user;
|
||||
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity());
|
||||
CharSequence[] items = new CharSequence[] {LocaleController.getString("KickFromGroup", R.string.KickFromGroup)};
|
||||
CharSequence[] items = new CharSequence[] {chat_id > 0 ? LocaleController.getString("KickFromGroup", R.string.KickFromGroup) : LocaleController.getString("KickFromBroadcast", R.string.KickFromBroadcast)};
|
||||
|
||||
builder.setItems(items, new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
@ -259,7 +273,7 @@ public class ChatProfileActivity extends BaseFragment implements NotificationCen
|
||||
|
||||
@Override
|
||||
public void didSelectContact(TLRPC.User user, String param) {
|
||||
MessagesController.getInstance().addUserToChat(chat_id, user, info, Utilities.parseInt(param));
|
||||
MessagesController.getInstance().addUserToChat(chat_id, user, info, param != null ? Utilities.parseInt(param) : 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -461,7 +475,9 @@ public class ChatProfileActivity extends BaseFragment implements NotificationCen
|
||||
args.putBoolean("destroyAfterSelect", true);
|
||||
args.putBoolean("usersAsSections", true);
|
||||
args.putBoolean("returnAsResult", true);
|
||||
if (chat_id > 0) {
|
||||
args.putString("selectAlertString", LocaleController.getString("AddToTheGroup", R.string.AddToTheGroup));
|
||||
}
|
||||
ContactsActivity fragment = new ContactsActivity(args);
|
||||
fragment.setDelegate(this);
|
||||
if (info != null) {
|
||||
@ -546,6 +562,7 @@ public class ChatProfileActivity extends BaseFragment implements NotificationCen
|
||||
});
|
||||
|
||||
final ImageButton button2 = (ImageButton)view.findViewById(R.id.settings_change_avatar_button);
|
||||
if (chat_id > 0) {
|
||||
button2.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
@ -557,10 +574,10 @@ public class ChatProfileActivity extends BaseFragment implements NotificationCen
|
||||
int type;
|
||||
TLRPC.Chat chat = MessagesController.getInstance().chats.get(chat_id);
|
||||
if (chat.photo == null || chat.photo.photo_big == null || chat.photo instanceof TLRPC.TL_chatPhotoEmpty) {
|
||||
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)};
|
||||
type = 0;
|
||||
} else {
|
||||
items = new CharSequence[] {LocaleController.getString("OpenPhoto", R.string.OpenPhoto), LocaleController.getString("FromCamera", R.string.FromCamera), LocaleController.getString("FromGalley", R.string.FromGalley), LocaleController.getString("DeletePhoto", R.string.DeletePhoto)};
|
||||
items = new CharSequence[]{LocaleController.getString("OpenPhoto", R.string.OpenPhoto), LocaleController.getString("FromCamera", R.string.FromCamera), LocaleController.getString("FromGalley", R.string.FromGalley), LocaleController.getString("DeletePhoto", R.string.DeletePhoto)};
|
||||
type = 1;
|
||||
}
|
||||
|
||||
@ -592,6 +609,9 @@ public class ChatProfileActivity extends BaseFragment implements NotificationCen
|
||||
showAlertDialog(builder);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
button2.setVisibility(View.GONE);
|
||||
}
|
||||
} else {
|
||||
onlineText = (TextView)view.findViewById(R.id.settings_online);
|
||||
}
|
||||
@ -665,7 +685,13 @@ public class ChatProfileActivity extends BaseFragment implements NotificationCen
|
||||
LayoutInflater li = (LayoutInflater)mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
|
||||
view = li.inflate(R.layout.chat_profile_add_row, viewGroup, false);
|
||||
TextView textView = (TextView)view.findViewById(R.id.messages_list_row_name);
|
||||
if (chat_id > 0) {
|
||||
textView.setText(LocaleController.getString("AddMember", R.string.AddMember));
|
||||
} else {
|
||||
textView.setText(LocaleController.getString("AddRecipient", R.string.AddRecipient));
|
||||
View divider = view.findViewById(R.id.settings_row_divider);
|
||||
divider.setVisibility(View.INVISIBLE);
|
||||
}
|
||||
}
|
||||
} else if (type == 5) {
|
||||
if (view == null) {
|
||||
|
@ -90,6 +90,7 @@ public class GroupCreateActivity extends BaseFragment implements NotificationCen
|
||||
private TextView emptyTextView;
|
||||
private EditText userSelectEditText;
|
||||
private boolean ignoreChange = false;
|
||||
private boolean isBroadcast = false;
|
||||
|
||||
private HashMap<Integer, XImageSpan> selectedContacts = new HashMap<Integer, XImageSpan>();
|
||||
private ArrayList<XImageSpan> allSpans = new ArrayList<XImageSpan>();
|
||||
@ -105,6 +106,15 @@ public class GroupCreateActivity extends BaseFragment implements NotificationCen
|
||||
|
||||
private final static int done_button = 1;
|
||||
|
||||
public GroupCreateActivity() {
|
||||
super();
|
||||
}
|
||||
|
||||
public GroupCreateActivity(Bundle args) {
|
||||
super(args);
|
||||
isBroadcast = args.getBoolean("broadcast", false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onFragmentCreate() {
|
||||
NotificationCenter.getInstance().addObserver(this, MessagesController.contactsDidLoaded);
|
||||
@ -126,7 +136,11 @@ public class GroupCreateActivity extends BaseFragment implements NotificationCen
|
||||
if (fragmentView == null) {
|
||||
actionBarLayer.setDisplayHomeAsUpEnabled(true, R.drawable.ic_ab_back);
|
||||
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.setSubtitle(LocaleController.formatString("MembersCount", R.string.MembersCount, selectedContacts.size(), 200));
|
||||
|
||||
actionBarLayer.setActionBarMenuOnItemClick(new ActionBarLayer.ActionBarMenuOnItemClick() {
|
||||
@ -140,6 +154,7 @@ public class GroupCreateActivity extends BaseFragment implements NotificationCen
|
||||
result.addAll(selectedContacts.keySet());
|
||||
Bundle args = new Bundle();
|
||||
args.putIntegerArrayList("result", result);
|
||||
args.putBoolean("broadcast", isBroadcast);
|
||||
presentFragment(new GroupCreateFinalActivity(args));
|
||||
}
|
||||
}
|
||||
|
@ -54,11 +54,13 @@ public class GroupCreateFinalActivity extends BaseFragment implements Notificati
|
||||
private AvatarUpdater avatarUpdater = new AvatarUpdater();
|
||||
private ProgressDialog progressDialog = null;
|
||||
private String nameToSet = null;
|
||||
private boolean isBroadcast = false;
|
||||
|
||||
private final static int done_button = 1;
|
||||
|
||||
public GroupCreateFinalActivity(Bundle args) {
|
||||
super(args);
|
||||
isBroadcast = args.getBoolean("broadcast", false);
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@ -120,7 +122,11 @@ public class GroupCreateFinalActivity extends BaseFragment implements Notificati
|
||||
if (fragmentView == null) {
|
||||
actionBarLayer.setDisplayHomeAsUpEnabled(true, R.drawable.ic_ab_back);
|
||||
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.setActionBarMenuOnItemClick(new ActionBarLayer.ActionBarMenuOnItemClick() {
|
||||
@Override
|
||||
@ -136,6 +142,9 @@ public class GroupCreateFinalActivity extends BaseFragment implements Notificati
|
||||
}
|
||||
donePressed = true;
|
||||
|
||||
if (isBroadcast) {
|
||||
MessagesController.getInstance().createChat(nameTextView.getText().toString(), selectedContacts, uploadedAvatar, isBroadcast);
|
||||
} else {
|
||||
if (avatarUpdater.uploadingAvatar != null) {
|
||||
createAfterUpload = true;
|
||||
} else {
|
||||
@ -144,7 +153,7 @@ public class GroupCreateFinalActivity extends BaseFragment implements Notificati
|
||||
progressDialog.setCanceledOnTouchOutside(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() {
|
||||
@Override
|
||||
@ -162,6 +171,7 @@ public class GroupCreateFinalActivity extends BaseFragment implements Notificati
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
ActionBarMenu menu = actionBarLayer.createMenu();
|
||||
@ -173,6 +183,9 @@ public class GroupCreateFinalActivity extends BaseFragment implements Notificati
|
||||
fragmentView = inflater.inflate(R.layout.group_create_final_layout, container, false);
|
||||
|
||||
final ImageButton button2 = (ImageButton)fragmentView.findViewById(R.id.settings_change_avatar_button);
|
||||
if (isBroadcast) {
|
||||
button2.setVisibility(View.GONE);
|
||||
} else {
|
||||
button2.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
@ -184,9 +197,9 @@ public class GroupCreateFinalActivity extends BaseFragment implements Notificati
|
||||
CharSequence[] items;
|
||||
|
||||
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 {
|
||||
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() {
|
||||
@ -206,12 +219,17 @@ public class GroupCreateFinalActivity extends BaseFragment implements Notificati
|
||||
showAlertDialog(builder);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
avatarImage = (BackupImageView)fragmentView.findViewById(R.id.settings_avatar_image);
|
||||
avatarImage.setImageResource(R.drawable.group_blue);
|
||||
|
||||
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));
|
||||
}
|
||||
if (nameToSet != null) {
|
||||
nameTextView.setText(nameToSet);
|
||||
nameToSet = null;
|
||||
@ -237,7 +255,7 @@ public class GroupCreateFinalActivity extends BaseFragment implements Notificati
|
||||
avatarImage.setImage(avatar, "50_50", R.drawable.group_blue);
|
||||
if (createAfterUpload) {
|
||||
FileLog.e("tmessages", "avatar did uploaded");
|
||||
MessagesController.getInstance().createChat(nameTextView.getText().toString(), selectedContacts, uploadedAvatar);
|
||||
MessagesController.getInstance().createChat(nameTextView.getText().toString(), selectedContacts, uploadedAvatar, false);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
@ -458,7 +458,12 @@ public class LaunchActivity extends ActionBarActivity implements NotificationCen
|
||||
args.putInt("chat_id", -lower_part);
|
||||
}
|
||||
} else {
|
||||
args.putInt("enc_id", (int)(dialog_id >> 32));
|
||||
int high_id = (int)(dialog_id >> 32);
|
||||
if (high_id > 0) {
|
||||
args.putInt("enc_id", high_id);
|
||||
} else {
|
||||
args.putInt("chat_id", high_id);
|
||||
}
|
||||
}
|
||||
ChatActivity fragment = new ChatActivity(args);
|
||||
presentFragment(fragment, true);
|
||||
|
@ -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_contacts = 4;
|
||||
private final static int messages_list_menu_settings = 5;
|
||||
private final static int messages_list_menu_new_broadcast = 6;
|
||||
|
||||
public static interface MessagesActivityDelegate {
|
||||
public abstract void didSelectDialog(MessagesActivity fragment, long dialog_id, boolean param);
|
||||
@ -175,6 +176,7 @@ public class MessagesActivity extends BaseFragment implements NotificationCenter
|
||||
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_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_settings, LocaleController.getString("Settings", R.string.Settings), 0);
|
||||
}
|
||||
@ -206,6 +208,10 @@ public class MessagesActivity extends BaseFragment implements NotificationCenter
|
||||
if (onlySelect) {
|
||||
finishFragment();
|
||||
}
|
||||
} else if (id == messages_list_menu_new_broadcast) {
|
||||
Bundle args = new Bundle();
|
||||
args.putBoolean("broadcast", true);
|
||||
presentFragment(new GroupCreateActivity(args));
|
||||
}
|
||||
}
|
||||
});
|
||||
@ -289,7 +295,12 @@ public class MessagesActivity extends BaseFragment implements NotificationCenter
|
||||
args.putInt("chat_id", -lower_part);
|
||||
}
|
||||
} else {
|
||||
args.putInt("enc_id", (int)(dialog_id >> 32));
|
||||
int high_id = (int)(dialog_id >> 32);
|
||||
if (high_id > 0) {
|
||||
args.putInt("enc_id", high_id);
|
||||
} else {
|
||||
args.putInt("chat_id", high_id);
|
||||
}
|
||||
}
|
||||
presentFragment(new ChatActivity(args));
|
||||
}
|
||||
@ -497,13 +508,21 @@ public class MessagesActivity extends BaseFragment implements NotificationCenter
|
||||
builder.setMessage(LocaleController.formatStringSimple(selectAlertString, chat.title));
|
||||
}
|
||||
} else {
|
||||
int chat_id = (int)(dialog_id >> 32);
|
||||
TLRPC.EncryptedChat chat = MessagesController.getInstance().encryptedChats.get(chat_id);
|
||||
int high_id = (int)(dialog_id >> 32);
|
||||
if (high_id > 0) {
|
||||
TLRPC.EncryptedChat chat = MessagesController.getInstance().encryptedChats.get(high_id);
|
||||
TLRPC.User user = MessagesController.getInstance().users.get(chat.user_id);
|
||||
if (user == null) {
|
||||
return;
|
||||
}
|
||||
builder.setMessage(LocaleController.formatStringSimple(selectAlertString, Utilities.formatName(user.first_name, user.last_name)));
|
||||
} else {
|
||||
TLRPC.Chat chat = MessagesController.getInstance().chats.get(high_id);
|
||||
if (chat == null) {
|
||||
return;
|
||||
}
|
||||
builder.setMessage(LocaleController.formatStringSimple(selectAlertString, chat.title));
|
||||
}
|
||||
}
|
||||
CheckBox checkBox = null;
|
||||
/*if (delegate instanceof ChatActivity) {
|
||||
|
@ -874,9 +874,6 @@ public class PopupNotificationActivity extends Activity implements NotificationC
|
||||
chatActivityEnterView.setFieldFocused(false);
|
||||
}
|
||||
ConnectionsManager.getInstance().setAppPaused(true, false);
|
||||
if (wakeLock.isHeld()) {
|
||||
wakeLock.release();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -568,6 +568,9 @@ public class SettingsActivity extends BaseFragment implements NotificationCenter
|
||||
} catch (Exception 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);
|
||||
Bundle args = new Bundle();
|
||||
args.putInt("user_id", res.user.id);
|
||||
|
@ -406,7 +406,8 @@ public class SettingsNotificationsActivity extends BaseFragment implements Notif
|
||||
}
|
||||
|
||||
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();
|
||||
req.settings = new TLRPC.TL_inputPeerNotifySettings();
|
||||
req.settings.sound = "default";
|
||||
@ -425,7 +426,7 @@ public class SettingsNotificationsActivity extends BaseFragment implements Notif
|
||||
public void run(TLObject response, TLRPC.TL_error error) {
|
||||
|
||||
}
|
||||
});
|
||||
});*/
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -467,18 +467,15 @@ public class VideoEditorActivity extends BaseFragment implements SurfaceHolder.C
|
||||
List<Track> tracks = movie.getTracks();
|
||||
movie.setTracks(new LinkedList<Track>());
|
||||
|
||||
double startTime = videoTimelineView.getLeftProgress() * videoPlayer.getDuration() / 1000.0;
|
||||
double endTime = videoTimelineView.getRightProgress() * videoPlayer.getDuration() / 1000.0;
|
||||
double startTime = 0;
|
||||
double endTime = 0;
|
||||
|
||||
boolean timeCorrected = false;
|
||||
for (Track track : tracks) {
|
||||
if (track.getSyncSamples() != null && track.getSyncSamples().length > 0) {
|
||||
if (timeCorrected) {
|
||||
throw new RuntimeException("The startTime has already been corrected by another track with SyncSample. Not Supported.");
|
||||
}
|
||||
startTime = correctTimeToSyncSample(track, startTime, false);
|
||||
endTime = correctTimeToSyncSample(track, endTime, true);
|
||||
timeCorrected = true;
|
||||
double duration = (double)track.getDuration() / (double)track.getTrackMetaData().getTimescale();
|
||||
startTime = correctTimeToSyncSample(track, videoTimelineView.getLeftProgress() * duration, false);
|
||||
endTime = videoTimelineView.getRightProgress() * duration;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@ -486,7 +483,7 @@ public class VideoEditorActivity extends BaseFragment implements SurfaceHolder.C
|
||||
long currentSample = 0;
|
||||
double currentTime = 0;
|
||||
double lastTime = 0;
|
||||
long startSample = -1;
|
||||
long startSample = 0;
|
||||
long endSample = -1;
|
||||
|
||||
for (int i = 0; i < track.getSampleDurations().length; i++) {
|
||||
@ -503,9 +500,7 @@ public class VideoEditorActivity extends BaseFragment implements SurfaceHolder.C
|
||||
}
|
||||
movie.addTrack(new CroppedTrack(track, startSample, endSample));
|
||||
}
|
||||
long start1 = System.currentTimeMillis();
|
||||
Container out = new DefaultMp4Builder().build(movie);
|
||||
long start2 = System.currentTimeMillis();
|
||||
|
||||
String fileName = Integer.MIN_VALUE + "_" + UserConfig.lastLocalId + ".mp4";
|
||||
UserConfig.lastLocalId--;
|
||||
@ -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) {
|
||||
double[] timeOfSyncSamples = new double[track.getSyncSamples().length];
|
||||
long currentSample = 0;
|
||||
|
@ -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 int openFile(int[] metaData, String filePath);
|
||||
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 String getComment(int gifFileInPtr);
|
||||
private static native int getLoopCount(int gifFileInPtr);
|
||||
|
@ -75,17 +75,20 @@ public class ImageReceiver {
|
||||
if (filter != null) {
|
||||
key += "@" + filter;
|
||||
}
|
||||
Bitmap img;
|
||||
Bitmap img = null;
|
||||
if (currentPath != null) {
|
||||
if (currentPath.equals(key)) {
|
||||
if (currentImage != null) {
|
||||
return;
|
||||
} else {
|
||||
img = FileLoader.getInstance().getImageFromMemory(path, httpUrl, this, filter, true);
|
||||
recycleBitmap(img);
|
||||
img = FileLoader.getInstance().getImageFromMemory(path, httpUrl, this, filter);
|
||||
}
|
||||
} 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;
|
||||
last_path = path;
|
||||
last_httpUrl = httpUrl;
|
||||
|
@ -0,0 +1,43 @@
|
||||
/*
|
||||
* This is the source code of Telegram for Android v. 1.7.x.
|
||||
* It is licensed under GNU GPL v. 2 or later.
|
||||
* You should have received a copy of the license in this archive (see LICENSE).
|
||||
*
|
||||
* Copyright Nikolai Kudashov, 2013-2014.
|
||||
*/
|
||||
|
||||
package org.telegram.ui.Views;
|
||||
|
||||
import android.graphics.Canvas;
|
||||
import android.graphics.Paint;
|
||||
import android.graphics.RectF;
|
||||
|
||||
import org.telegram.android.AndroidUtilities;
|
||||
|
||||
public class RoundProgressView {
|
||||
private Paint paint;
|
||||
|
||||
public float currentProgress = 0;
|
||||
public RectF rect = new RectF();
|
||||
|
||||
public RoundProgressView() {
|
||||
paint = new Paint();
|
||||
paint.setColor(0xffffffff);
|
||||
paint.setStyle(Paint.Style.STROKE);
|
||||
paint.setStrokeWidth(AndroidUtilities.dp(1));
|
||||
paint.setAntiAlias(true);
|
||||
}
|
||||
|
||||
public void setProgress(float progress) {
|
||||
currentProgress = progress;
|
||||
if (currentProgress < 0) {
|
||||
currentProgress = 0;
|
||||
} else if (currentProgress > 1) {
|
||||
currentProgress = 1;
|
||||
}
|
||||
}
|
||||
|
||||
public void draw(Canvas canvas) {
|
||||
canvas.drawArc(rect, -90, 360 * currentProgress, false, paint);
|
||||
}
|
||||
}
|
BIN
TMessagesProj/src/main/res/drawable-hdpi/broadcast.png
Normal file
After Width: | Height: | Size: 1.1 KiB |
BIN
TMessagesProj/src/main/res/drawable-hdpi/broadcast2.png
Normal file
After Width: | Height: | Size: 1.1 KiB |
Before Width: | Height: | Size: 2.4 KiB After Width: | Height: | Size: 2.2 KiB |
Before Width: | Height: | Size: 2.6 KiB |
Before Width: | Height: | Size: 2.6 KiB After Width: | Height: | Size: 2.4 KiB |
Before Width: | Height: | Size: 2.8 KiB |
Before Width: | Height: | Size: 2.3 KiB After Width: | Height: | Size: 2.1 KiB |
Before Width: | Height: | Size: 2.5 KiB |
BIN
TMessagesProj/src/main/res/drawable-hdpi/playvideo.png
Executable file → Normal file
Before Width: | Height: | Size: 2.6 KiB After Width: | Height: | Size: 2.3 KiB |
Before Width: | Height: | Size: 2.7 KiB |
BIN
TMessagesProj/src/main/res/drawable-ldpi/broadcast.png
Normal file
After Width: | Height: | Size: 1.0 KiB |
BIN
TMessagesProj/src/main/res/drawable-ldpi/broadcast2.png
Normal file
After Width: | Height: | Size: 1018 B |
Before Width: | Height: | Size: 806 B After Width: | Height: | Size: 1.7 KiB |
Before Width: | Height: | Size: 805 B |
Before Width: | Height: | Size: 838 B After Width: | Height: | Size: 1.7 KiB |
Before Width: | Height: | Size: 857 B |
Before Width: | Height: | Size: 564 B After Width: | Height: | Size: 1.5 KiB |
Before Width: | Height: | Size: 591 B |
BIN
TMessagesProj/src/main/res/drawable-ldpi/playvideo.png
Executable file → Normal file
Before Width: | Height: | Size: 785 B After Width: | Height: | Size: 1.6 KiB |
Before Width: | Height: | Size: 793 B |
BIN
TMessagesProj/src/main/res/drawable-mdpi/broadcast.png
Normal file
After Width: | Height: | Size: 1.0 KiB |
BIN
TMessagesProj/src/main/res/drawable-mdpi/broadcast2.png
Normal file
After Width: | Height: | Size: 1.1 KiB |
Before Width: | Height: | Size: 1.7 KiB After Width: | Height: | Size: 1.9 KiB |
Before Width: | Height: | Size: 1.8 KiB |
Before Width: | Height: | Size: 1.8 KiB After Width: | Height: | Size: 1.9 KiB |
Before Width: | Height: | Size: 1.9 KiB |
Before Width: | Height: | Size: 1.6 KiB After Width: | Height: | Size: 1.8 KiB |
Before Width: | Height: | Size: 1.7 KiB |
BIN
TMessagesProj/src/main/res/drawable-mdpi/playvideo.png
Executable file → Normal file
Before Width: | Height: | Size: 1.8 KiB After Width: | Height: | Size: 1.8 KiB |
Before Width: | Height: | Size: 1.8 KiB |
BIN
TMessagesProj/src/main/res/drawable-xhdpi/broadcast.png
Normal file
After Width: | Height: | Size: 1.2 KiB |
BIN
TMessagesProj/src/main/res/drawable-xhdpi/broadcast2.png
Normal file
After Width: | Height: | Size: 1.2 KiB |
Before Width: | Height: | Size: 3.2 KiB After Width: | Height: | Size: 2.6 KiB |
Before Width: | Height: | Size: 3.4 KiB |
Before Width: | Height: | Size: 3.4 KiB After Width: | Height: | Size: 2.7 KiB |
Before Width: | Height: | Size: 3.6 KiB |
Before Width: | Height: | Size: 3.1 KiB After Width: | Height: | Size: 2.5 KiB |
Before Width: | Height: | Size: 3.3 KiB |
BIN
TMessagesProj/src/main/res/drawable-xhdpi/playvideo.png
Executable file → Normal file
Before Width: | Height: | Size: 3.5 KiB After Width: | Height: | Size: 2.7 KiB |
Before Width: | Height: | Size: 3.6 KiB |
BIN
TMessagesProj/src/main/res/drawable-xxhdpi/broadcast.png
Normal file
After Width: | Height: | Size: 1.4 KiB |
BIN
TMessagesProj/src/main/res/drawable-xxhdpi/broadcast2.png
Normal file
After Width: | Height: | Size: 1.4 KiB |
Before Width: | Height: | Size: 4.8 KiB After Width: | Height: | Size: 3.4 KiB |
Before Width: | Height: | Size: 5.1 KiB |
Before Width: | Height: | Size: 5.2 KiB After Width: | Height: | Size: 3.6 KiB |
Before Width: | Height: | Size: 5.5 KiB |
Before Width: | Height: | Size: 4.8 KiB After Width: | Height: | Size: 3.2 KiB |
Before Width: | Height: | Size: 5.1 KiB |
BIN
TMessagesProj/src/main/res/drawable-xxhdpi/playvideo.png
Executable file → Normal file
Before Width: | Height: | Size: 5.2 KiB After Width: | Height: | Size: 3.6 KiB |
Before Width: | Height: | Size: 5.5 KiB |
@ -57,6 +57,14 @@
|
||||
<string name="HiddenName">الاسم مخفي</string>
|
||||
<string name="SelectChat">اختر محادثة</string>
|
||||
|
||||
<!--broadcasts-->
|
||||
<string name="BroadcastList">Broadcast List</string>
|
||||
<string name="NewBroadcastList">New Broadcast List</string>
|
||||
<string name="EnterListName">Enter list name</string>
|
||||
<string name="YouCreatedBroadcastList">You created a broadcast list</string>
|
||||
<string name="AddRecipient">Add Recipient</string>
|
||||
<string name="KickFromBroadcast">Remove from broadcast list</string>
|
||||
|
||||
<!--documents view-->
|
||||
<string name="SelectFile">اختر ملف</string>
|
||||
<string name="FreeOfTotal">متاح %1$s من %2$s</string>
|
||||
|
@ -57,6 +57,14 @@
|
||||
<string name="HiddenName">Versteckter Name</string>
|
||||
<string name="SelectChat">Chat auswählen</string>
|
||||
|
||||
<!--broadcasts-->
|
||||
<string name="BroadcastList">Broadcast List</string>
|
||||
<string name="NewBroadcastList">New Broadcast List</string>
|
||||
<string name="EnterListName">Enter list name</string>
|
||||
<string name="YouCreatedBroadcastList">You created a broadcast list</string>
|
||||
<string name="AddRecipient">Add Recipient</string>
|
||||
<string name="KickFromBroadcast">Remove from broadcast list</string>
|
||||
|
||||
<!--documents view-->
|
||||
<string name="SelectFile">Datei auswählen</string>
|
||||
<string name="FreeOfTotal">Freier Speicher: %1$s von %2$s</string>
|
||||
|
@ -57,6 +57,14 @@
|
||||
<string name="HiddenName">Nombre oculto</string>
|
||||
<string name="SelectChat">Selecciona el chat</string>
|
||||
|
||||
<!--broadcasts-->
|
||||
<string name="BroadcastList">Broadcast List</string>
|
||||
<string name="NewBroadcastList">New Broadcast List</string>
|
||||
<string name="EnterListName">Enter list name</string>
|
||||
<string name="YouCreatedBroadcastList">You created a broadcast list</string>
|
||||
<string name="AddRecipient">Add Recipient</string>
|
||||
<string name="KickFromBroadcast">Remove from broadcast list</string>
|
||||
|
||||
<!--documents view-->
|
||||
<string name="SelectFile">Seleccionar archivo</string>
|
||||
<string name="FreeOfTotal">%1$s de %2$s libres</string>
|
||||
|
@ -57,6 +57,14 @@
|
||||
<string name="HiddenName">Nome nascosto</string>
|
||||
<string name="SelectChat">Seleziona chat</string>
|
||||
|
||||
<!--broadcasts-->
|
||||
<string name="BroadcastList">Broadcast List</string>
|
||||
<string name="NewBroadcastList">New Broadcast List</string>
|
||||
<string name="EnterListName">Enter list name</string>
|
||||
<string name="YouCreatedBroadcastList">You created a broadcast list</string>
|
||||
<string name="AddRecipient">Add Recipient</string>
|
||||
<string name="KickFromBroadcast">Remove from broadcast list</string>
|
||||
|
||||
<!--documents view-->
|
||||
<string name="SelectFile">Seleziona file</string>
|
||||
<string name="FreeOfTotal">Liberi %1$s di %2$s</string>
|
||||
|
@ -57,6 +57,14 @@
|
||||
<string name="HiddenName">Verborgen naam</string>
|
||||
<string name="SelectChat">Kies een gesprek</string>
|
||||
|
||||
<!--broadcasts-->
|
||||
<string name="BroadcastList">Broadcast List</string>
|
||||
<string name="NewBroadcastList">New Broadcast List</string>
|
||||
<string name="EnterListName">Enter list name</string>
|
||||
<string name="YouCreatedBroadcastList">You created a broadcast list</string>
|
||||
<string name="AddRecipient">Add Recipient</string>
|
||||
<string name="KickFromBroadcast">Remove from broadcast list</string>
|
||||
|
||||
<!--documents view-->
|
||||
<string name="SelectFile">Kies een bestand</string>
|
||||
<string name="FreeOfTotal">Vrij: %1$s van %2$s</string>
|
||||
|
@ -57,6 +57,14 @@
|
||||
<string name="HiddenName">Nome oculto</string>
|
||||
<string name="SelectChat">Selecione uma Conversa</string>
|
||||
|
||||
<!--broadcasts-->
|
||||
<string name="BroadcastList">Broadcast List</string>
|
||||
<string name="NewBroadcastList">New Broadcast List</string>
|
||||
<string name="EnterListName">Enter list name</string>
|
||||
<string name="YouCreatedBroadcastList">You created a broadcast list</string>
|
||||
<string name="AddRecipient">Add Recipient</string>
|
||||
<string name="KickFromBroadcast">Remove from broadcast list</string>
|
||||
|
||||
<!--documents view-->
|
||||
<string name="SelectFile">Selecione um Arquivo</string>
|
||||
<string name="FreeOfTotal">Disponível %1$s de %2$s</string>
|
||||
|
@ -57,6 +57,14 @@
|
||||
<string name="HiddenName">Nome oculto</string>
|
||||
<string name="SelectChat">Selecionar chat</string>
|
||||
|
||||
<!--broadcasts-->
|
||||
<string name="BroadcastList">Broadcast List</string>
|
||||
<string name="NewBroadcastList">New Broadcast List</string>
|
||||
<string name="EnterListName">Enter list name</string>
|
||||
<string name="YouCreatedBroadcastList">You created a broadcast list</string>
|
||||
<string name="AddRecipient">Add Recipient</string>
|
||||
<string name="KickFromBroadcast">Remove from broadcast list</string>
|
||||
|
||||
<!--documents view-->
|
||||
<string name="SelectFile">Selecionar ficheiro</string>
|
||||
<string name="FreeOfTotal">%1$s de %2$s livres</string>
|
||||
|
@ -57,6 +57,14 @@
|
||||
<string name="HiddenName">Hidden Name</string>
|
||||
<string name="SelectChat">Select Chat</string>
|
||||
|
||||
<!--broadcasts-->
|
||||
<string name="BroadcastList">Broadcast List</string>
|
||||
<string name="NewBroadcastList">New Broadcast List</string>
|
||||
<string name="EnterListName">Enter list name</string>
|
||||
<string name="YouCreatedBroadcastList">You created a broadcast list</string>
|
||||
<string name="AddRecipient">Add Recipient</string>
|
||||
<string name="KickFromBroadcast">Remove from broadcast list</string>
|
||||
|
||||
<!--documents view-->
|
||||
<string name="SelectFile">Select File</string>
|
||||
<string name="FreeOfTotal">Free %1$s of %2$s</string>
|
||||
@ -150,7 +158,7 @@
|
||||
<string name="NotificationGroupKickYou">%1$s removed you from the group %2$s</string>
|
||||
<string name="NotificationGroupLeftMember">%1$s has left the group %2$s</string>
|
||||
<string name="NotificationContactJoined">%1$s joined Telegram!</string>
|
||||
<string name="NotificationUnrecognizedDevice">%1$s,\nWe detected a login into your account from a new device on %2$s\n\nDevice: %3$s\nLocation: %4$s\n\nIf this wasn’t you, you can go to Settings – Terminate all sessions.\n\nThanks,\nThe Telegram Team</string>
|
||||
<string name="NotificationUnrecognizedDevice">%1$s,\nWe detected a login into your account from a new device on %2$s\n\nDevice: %3$s\nLocation: %4$s\n\nIf this wasn\'t you, you can go to Settings - Terminate all sessions.\n\nSincerely,\nThe Telegram Team</string>
|
||||
<string name="NotificationContactNewPhoto">%1$s updated profile photo</string>
|
||||
|
||||
<!--contacts view-->
|
||||
@ -263,19 +271,19 @@
|
||||
<string name="Enabled">Enabled</string>
|
||||
<string name="Disabled">Disabled</string>
|
||||
<string name="NotificationsService">Notifications Service</string>
|
||||
<string name="NotificationsServiceDisableInfo">If google play services are enough for you to receive notifications, you can disable Notifications Service. However we recommend you to leave it enabled to keep app running in background and receive instant notifications.</string>
|
||||
<string name="NotificationsServiceDisableInfo">If Google Play Services are enough for you to receive notifications, you can disable Notifications Service. However we recommend you to leave it enabled to keep app running in background and receive instant notifications.</string>
|
||||
<string name="SortBy">Sort By</string>
|
||||
<string name="ImportContacts">Import Contacts</string>
|
||||
<string name="WiFiOnly">Via WiFi only</string>
|
||||
<string name="SortFirstName">First name</string>
|
||||
<string name="SortLastName">Last name</string>
|
||||
<string name="LedColor">LED Color</string>
|
||||
<string name="PopupNotification">Popup Notification</string>
|
||||
<string name="PopupNotification">Popup Notifications</string>
|
||||
<string name="NoPopup">No popup</string>
|
||||
<string name="OnlyWhenScreenOn">Only when screen "on"</string>
|
||||
<string name="OnlyWhenScreenOff">Only when screen "off"</string>
|
||||
<string name="AlwaysShowPopup">Always show popup</string>
|
||||
<string name="BadgeNumber">Badge Number</string>
|
||||
<string name="BadgeNumber">Badge Counter</string>
|
||||
|
||||
<!--media view-->
|
||||
<string name="NoMedia">No shared media yet</string>
|
||||
@ -362,8 +370,8 @@
|
||||
<string name="InvalidLastName">Invalid last name</string>
|
||||
<string name="Loading">Loading...</string>
|
||||
<string name="NoPlayerInstalled">You don\'t have a video player, please install one to continue</string>
|
||||
<string name="NoMailInstalled">Please send an email to sms@telegram.org and explain your problem.</string>
|
||||
<string name="NoHandleAppInstalled">You don\'t have any application that can handle with mime type \'%1$s\', please install one to continue</string>
|
||||
<string name="NoMailInstalled">Please send an email to sms@telegram.org and tell us about your problem.</string>
|
||||
<string name="NoHandleAppInstalled">You don\'t have applications that can handle the file type \'%1$s\', please install one to continue</string>
|
||||
<string name="InviteUser">This user does not have Telegram yet, send an invitation?</string>
|
||||
<string name="AreYouSure">Are you sure?</string>
|
||||
<string name="AddContactQ">Add contact?</string>
|
||||
@ -371,15 +379,15 @@
|
||||
<string name="ForwardMessagesTo">Forward messages to %1$s?</string>
|
||||
<string name="DeleteChatQuestion">Delete this chat?</string>
|
||||
<string name="SendMessagesTo">Send messages to %1$s?</string>
|
||||
<string name="AreYouSureLogout">Are you sure you want to logout?</string>
|
||||
<string name="AreYouSureLogout">Are you sure you want to log out?</string>
|
||||
<string name="AreYouSureSessions">Are you sure you want to terminate all other sessions?</string>
|
||||
<string name="AreYouSureDeleteAndExit">Are you sure you want to delete and leave group?</string>
|
||||
<string name="AreYouSureDeleteAndExit">Are you sure you want to delete and leave the group?</string>
|
||||
<string name="AreYouSureDeleteThisChat">Are you sure you want to delete this chat?</string>
|
||||
<string name="AreYouSureShareMyContactInfo">Are you sure that you want to share your contact info?</string>
|
||||
<string name="AreYouSureShareMyContactInfo">Are you sure you want to share your contact info?</string>
|
||||
<string name="AreYouSureBlockContact">Are you sure you want to block this contact?</string>
|
||||
<string name="AreYouSureUnblockContact">Are you sure you want to unblock this contact?</string>
|
||||
<string name="AreYouSureDeleteContact">Are you sure you want to delete this contact?</string>
|
||||
<string name="AreYouSureSecretChat">Are you sure you want to start secret chat?</string>
|
||||
<string name="AreYouSureSecretChat">Are you sure you want to start a secret chat?</string>
|
||||
<string name="ForwardFromMyName">forward from my name</string>
|
||||
|
||||
<!--Intro view-->
|
||||
|