1
0
mirror of https://github.com/MGislv/NekoX.git synced 2024-06-30 10:14:04 +00:00

Removed jnigraphics use from native lib(not found on some devices), bug fixes

This commit is contained in:
DrKLO 2014-06-15 03:23:36 +04:00
parent 8c9616cb00
commit 68aeaeefc3
37 changed files with 221 additions and 252 deletions

View File

@ -81,7 +81,7 @@ android {
defaultConfig {
minSdkVersion 8
targetSdkVersion 19
versionCode 255
versionCode 256
versionName "1.5.3"
}
}

View File

@ -7,7 +7,7 @@ LOCAL_CFLAGS := -w -std=gnu99 -O3 -DNULL=0 -DSOCKLEN_T=socklen_t -DLOCALE_NOT_U
LOCAL_CFLAGS += -Drestrict='' -D__EMX__ -DOPUS_BUILD -DFIXED_POINT -DUSE_ALLOCA -DHAVE_LRINT -DHAVE_LRINTF -fno-math-errno
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 -O3 -funroll-loops
LOCAL_LDLIBS := -llog -lm -ljnigraphics
LOCAL_LDLIBS := -llog -lm
LOCAL_SRC_FILES := \
./opus/src/opus.c \

View File

@ -1,7 +1,6 @@
#include <jni.h>
#include <stdio.h>
#include <setjmp.h>
#include <android/bitmap.h>
#include <libjpeg/jpeglib.h>
#include "utils.h"
@ -17,23 +16,23 @@ METHODDEF(void) my_error_exit(j_common_ptr cinfo) {
longjmp(myerr->setjmp_buffer, 1);
}
JNIEXPORT void Java_org_telegram_messenger_Utilities_loadBitmap(JNIEnv *env, jclass class, jstring path, jobject bitmap, int scale) {
JNIEXPORT void Java_org_telegram_messenger_Utilities_loadBitmap(JNIEnv *env, jclass class, jstring path, jintArray bitmap, int scale, int format, int width, int height) {
AndroidBitmapInfo info;
int i;
if ((i = AndroidBitmap_getInfo(env, bitmap, &info)) >= 0) {
char *fileName = (*env)->GetStringUTFChars(env, path, NULL);
FILE *infile;
char *fileName = (*env)->GetStringUTFChars(env, path, NULL);
FILE *infile;
if ((infile = fopen(fileName, "rb"))) {
struct my_error_mgr jerr;
struct jpeg_decompress_struct cinfo;
if ((infile = fopen(fileName, "rb"))) {
struct my_error_mgr jerr;
struct jpeg_decompress_struct cinfo;
cinfo.err = jpeg_std_error(&jerr.pub);
jerr.pub.error_exit = my_error_exit;
if (!setjmp(jerr.setjmp_buffer)) {
cinfo.err = jpeg_std_error(&jerr.pub);
jerr.pub.error_exit = my_error_exit;
if (!setjmp(jerr.setjmp_buffer)) {
unsigned char *bitmapBuf = (*env)->GetPrimitiveArrayCritical(env, bitmap, 0);
if (bitmapBuf) {
jpeg_create_decompress(&cinfo);
jpeg_stdio_src(&cinfo, infile);
@ -45,60 +44,60 @@ JNIEXPORT void Java_org_telegram_messenger_Utilities_loadBitmap(JNIEnv *env, jcl
jpeg_start_decompress(&cinfo);
int row_stride = cinfo.output_width * cinfo.output_components;
JSAMPARRAY buffer = (*cinfo.mem->alloc_sarray) ((j_common_ptr) &cinfo, JPOOL_IMAGE, row_stride, 1);
int stride = width;
if (format == 0) {
stride *= 4;
} else if (format == 1) {
stride *= 2;
}
unsigned char *pixels = bitmapBuf;
int rowCount = min(cinfo.output_height, height);
int colCount = min(cinfo.output_width, width);
unsigned char *pixels;
if ((i = AndroidBitmap_lockPixels(env, bitmap, &pixels)) >= 0) {
while (cinfo.output_scanline < rowCount) {
jpeg_read_scanlines(&cinfo, buffer, 1);
int rowCount = min(cinfo.output_height, info.height);
int colCount = min(cinfo.output_width, info.width);
while (cinfo.output_scanline < rowCount) {
jpeg_read_scanlines(&cinfo, buffer, 1);
if (info.format == ANDROID_BITMAP_FORMAT_RGBA_8888) {
if (cinfo.out_color_space == JCS_GRAYSCALE) {
for (i = 0; i < colCount; i++) {
float alpha = buffer[0][i] / 255.0f;
pixels[i * 4] *= alpha;
pixels[i * 4 + 1] *= alpha;
pixels[i * 4 + 2] *= alpha;
pixels[i * 4 + 3] = buffer[0][i];
}
} else {
int c = 0;
for (i = 0; i < colCount; i++) {
pixels[i * 4] = buffer[0][i * 3];
pixels[i * 4 + 1] = buffer[0][i * 3 + 1];
pixels[i * 4 + 2] = buffer[0][i * 3 + 2];
pixels[i * 4 + 3] = 255;
c += 4;
}
if (format == 0) {
if (cinfo.out_color_space == JCS_GRAYSCALE) {
for (i = 0; i < colCount; i++) {
float alpha = buffer[0][i] / 255.0f;
pixels[i * 4] *= alpha;
pixels[i * 4 + 1] *= alpha;
pixels[i * 4 + 2] *= alpha;
pixels[i * 4 + 3] = buffer[0][i];
}
} else {
int c = 0;
for (i = 0; i < colCount; i++) {
pixels[i * 4] = buffer[0][i * 3 + 2];
pixels[i * 4 + 1] = buffer[0][i * 3 + 1];
pixels[i * 4 + 2] = buffer[0][i * 3];
pixels[i * 4 + 3] = 255;
c += 4;
}
} else if (info.format == ANDROID_BITMAP_FORMAT_RGB_565) {
}
} else if (format == 1) {
pixels += info.stride;
}
AndroidBitmap_unlockPixels(env, bitmap);
} else {
throwException(env, "AndroidBitmap_lockPixels() failed ! error=%d", i);
pixels += stride;
}
(*env)->ReleasePrimitiveArrayCritical(env, bitmap, bitmapBuf, 0);
jpeg_finish_decompress(&cinfo);
} else {
throwException(env, "the JPEG code has signaled an error");
throwException(env, "can't get bitmap buff");
}
jpeg_destroy_decompress(&cinfo);
fclose(infile);
} else {
throwException(env, "can't open %s\n", fileName);
throwException(env, "the JPEG code has signaled an error");
}
(*env)->ReleaseStringUTFChars(env, path, fileName);
jpeg_destroy_decompress(&cinfo);
fclose(infile);
} else {
throwException(env, "AndroidBitmap_getInfo() failed ! error=%d", i);
throwException(env, "can't open %s", fileName);
}
(*env)->ReleaseStringUTFChars(env, path, fileName);
}

View File

@ -65,6 +65,7 @@ public class ConnectionsManager implements Action.ActionDelegate, TcpConnection.
private long lastPingTime = System.currentTimeMillis();
private long lastPushPingTime = System.currentTimeMillis();
private int nextSleepTimeout = 30000;
private long nextPingId = 0;
private static volatile ConnectionsManager Instance = null;
public static ConnectionsManager getInstance() {
@ -2337,7 +2338,6 @@ public class ConnectionsManager implements Action.ActionDelegate, TcpConnection.
}
}
static long nextPingId = 0;
private ByteBufferDesc generatePingData(TcpConnection connection) {
if (connection == null) {
return null;
@ -2347,6 +2347,17 @@ public class ConnectionsManager implements Action.ActionDelegate, TcpConnection.
ping.ping_id = nextPingId++;
ping.disconnect_delay = 35;
pingIdToDate.put(ping.ping_id, (int)(System.currentTimeMillis() / 1000));
if (pingIdToDate.size() > 20) {
ArrayList<Long> itemsToDelete = new ArrayList<Long>();
for (Long pid : pingIdToDate.keySet()) {
if (pid < nextPingId - 10) {
itemsToDelete.add(pid);
}
}
for (Long pid : itemsToDelete) {
pingIdToDate.remove(pid);
}
}
NetworkMessage networkMessage = new NetworkMessage();
networkMessage.protoMessage = wrapMessage(ping, connection, false);

View File

@ -13,7 +13,6 @@ import java.io.InputStream;
import java.util.HashMap;
import java.util.Locale;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Canvas;
import android.graphics.ColorFilter;
@ -34,8 +33,21 @@ public class Emoji {
private static int drawImgSize, bigImgSize;
private static boolean inited = false;
private static Paint placeholderPaint;
private static Bitmap emojiBmp[] = new Bitmap[5];
private static EmojiBitmap emojiBmp[] = new EmojiBitmap[5];
private static boolean loadingEmoji[] = new boolean[5];
private static int emojiFullSize;
private static class EmojiBitmap {
public int[] colors;
public int width;
public int height;
public EmojiBitmap(int[] colors, int width, int height) {
this.colors = colors;
this.width = width;
this.height = height;
}
}
private static final int[] cols = {
13, 10, 15, 10, 14
@ -190,22 +202,21 @@ public class Emoji {
0x00000000D83DDD34L, 0x00000000D83DDD35L, 0x00000000D83DDD3BL, 0x00000000D83DDD36L, 0x00000000D83DDD37L, 0x00000000D83DDD38L, 0x00000000D83DDD39L}};
static {
int imgSize = 30;
if (Utilities.density <= 1.0f) {
imgSize = 30;
emojiFullSize = 30;
} else if (Utilities.density <= 1.5f) {
imgSize = 45;
emojiFullSize = 45;
} else if (Utilities.density <= 2.0f) {
imgSize = 60;
emojiFullSize = 60;
} else {
imgSize = 90;
emojiFullSize = 90;
}
drawImgSize = Utilities.dp(20);
bigImgSize = Utilities.dp(30);
for (int j = 1; j < data.length; j++) {
for (int i = 0; i < data[j].length; i++) {
Rect rect = new Rect((i % cols[j - 1]) * imgSize, (i / cols[j - 1]) * imgSize, (i % cols[j - 1] + 1) * imgSize, (i / cols[j - 1] + 1) * imgSize);
Rect rect = new Rect((i % cols[j - 1]) * emojiFullSize, (i / cols[j - 1]) * emojiFullSize, emojiFullSize, emojiFullSize);
rects.put(data[j][i], new DrawableInfo(rect, (byte)(j - 1)));
}
}
@ -213,7 +224,7 @@ public class Emoji {
placeholderPaint.setColor(0x00000000);
}
private static Bitmap loadEmoji(final int page) {
private static void loadEmoji(final int page) {
try {
float scale = 1.0f;
int imageResize = 1;
@ -241,8 +252,10 @@ public class Emoji {
opts.inJustDecodeBounds = true;
BitmapFactory.decodeFile(imageFile.getAbsolutePath(), opts);
final Bitmap colorsBitmap = Bitmap.createBitmap(opts.outWidth / imageResize, opts.outHeight / imageResize, Bitmap.Config.ARGB_8888);
Utilities.loadBitmap(imageFile.getAbsolutePath(), colorsBitmap, imageResize);
int width = opts.outWidth / imageResize;
int height = opts.outHeight / imageResize;
int[] bitmap = new int[width * height];
Utilities.loadBitmap(imageFile.getAbsolutePath(), bitmap, imageResize, 0, width, height);
imageName = String.format(Locale.US, "emoji%.01fx_a_%d.jpg", scale, page);
imageFile = ApplicationLoader.applicationContext.getFileStreamPath(imageName);
@ -252,21 +265,19 @@ public class Emoji {
is.close();
}
Utilities.loadBitmap(imageFile.getAbsolutePath(), colorsBitmap, imageResize);
Utilities.loadBitmap(imageFile.getAbsolutePath(), bitmap, imageResize, 0, width, height);
final EmojiBitmap emojiBitmap = new EmojiBitmap(bitmap, width, height);
Utilities.RunOnUIThread(new Runnable() {
@Override
public void run() {
emojiBmp[page] = colorsBitmap;
emojiBmp[page] = emojiBitmap;
NotificationCenter.getInstance().postNotificationName(999);
}
});
return colorsBitmap;
} catch(Throwable x) {
FileLog.e("tmessages", "Error loading emoji", x);
}
return null;
}
private static void loadEmojiAsync(final int page) {
@ -318,7 +329,7 @@ public class Emoji {
private DrawableInfo info;
boolean fullSize = false;
private static Paint paint;
static {
paint = new Paint();
paint.setFlags(Paint.FILTER_BITMAP_FLAG | Paint.ANTI_ALIAS_FLAG);
@ -330,20 +341,20 @@ public class Emoji {
@Override
public void draw(Canvas canvas) {
if (emojiBmp[info.page] == null) {
EmojiBitmap bitmap = emojiBmp[info.page];
if (bitmap == null) {
loadEmojiAsync(info.page);
canvas.drawRect(getBounds(), placeholderPaint);
return;
}
Rect b = copyBounds();
int cX = b.centerX(), cY = b.centerY();
b.left = cX - (fullSize ? bigImgSize : drawImgSize) / 2;
b.right = cX + (fullSize ? bigImgSize : drawImgSize) / 2;
b.top = cY - (fullSize ? bigImgSize : drawImgSize) / 2;
b.bottom = cY + (fullSize ? bigImgSize : drawImgSize) / 2;
if (!canvas.quickReject(b.left, b.top, b.right, b.bottom, Canvas.EdgeType.AA)) {
canvas.drawBitmap(emojiBmp[info.page], info.rect, b, paint);
}
int size = fullSize ? bigImgSize : drawImgSize;
float scale = (float)size / (float)emojiFullSize;
int offset = (getBounds().width() - size) / 2;
canvas.save();
canvas.scale(scale, scale);
canvas.drawBitmap(bitmap.colors, info.rect.top * bitmap.width + info.rect.left, bitmap.width, offset, offset, info.rect.right, info.rect.bottom, true, paint);
canvas.restore();
}
@Override

View File

@ -54,12 +54,6 @@ public class NativeLoader {
return;
}
try {
System.loadLibrary("jnigraphics");
} catch (Error e) {
FileLog.e("tmessages", e);
}
try {
String folder = null;
long libSize = 0;

View File

@ -17,7 +17,6 @@ import android.content.SharedPreferences;
import android.content.pm.ActivityInfo;
import android.content.res.Configuration;
import android.database.Cursor;
import android.graphics.Bitmap;
import android.graphics.Point;
import android.graphics.Typeface;
import android.net.Uri;
@ -156,7 +155,7 @@ public class Utilities {
public native static long doPQNative(long _what);
public native static byte[] aesIgeEncryption(byte[] _what, byte[] _key, byte[] _iv, boolean encrypt, boolean changeIv, int len);
public native static void aesIgeEncryption2(ByteBuffer _what, byte[] _key, byte[] _iv, boolean encrypt, boolean changeIv, int len);
public native static void loadBitmap(String path, Bitmap bitmap, int scale);
public native static void loadBitmap(String path, int[] bitmap, int scale, int format, int width, int height);
public static void lockOrientation(Activity activity) {
if (prevOrientation != -10) {

View File

@ -2335,9 +2335,7 @@ public class ChatActivity extends BaseFragment implements SizeNotifierRelativeLa
dayArr.remove(obj);
if (dayArr.isEmpty()) {
messagesByDays.remove(obj.dateKey);
if (index != -1) {
messages.remove(index);
}
messages.remove(index);
}
updated = true;
}

View File

@ -31,6 +31,7 @@ import android.widget.ListView;
import android.widget.TextView;
import org.telegram.messenger.LocaleController;
import org.telegram.messenger.MessagesStorage;
import org.telegram.messenger.TLRPC;
import org.telegram.messenger.ConnectionsManager;
import org.telegram.messenger.FileLog;
@ -51,6 +52,7 @@ import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.concurrent.Semaphore;
public class ChatProfileActivity extends BaseFragment implements NotificationCenter.NotificationCenterDelegate, ContactsActivity.ContactsActivityDelegate, PhotoViewer.PhotoViewerProvider {
private ListView listView;
@ -63,6 +65,7 @@ public class ChatProfileActivity extends BaseFragment implements NotificationCen
private int totalMediaCount = -1;
private int onlineCount = -1;
private ArrayList<Integer> sortedUsers = new ArrayList<Integer>();
private TLRPC.Chat currentChat;
private int avatarRow;
private int settingsSectionRow;
@ -85,12 +88,35 @@ public class ChatProfileActivity extends BaseFragment implements NotificationCen
@Override
public boolean onFragmentCreate() {
super.onFragmentCreate();
chat_id = getArguments().getInt("chat_id", 0);
currentChat = MessagesController.getInstance().chats.get(chat_id);
if (currentChat == null) {
final Semaphore semaphore = new Semaphore(0);
MessagesStorage.getInstance().storageQueue.postRunnable(new Runnable() {
@Override
public void run() {
currentChat = MessagesStorage.getInstance().getChat(chat_id);
semaphore.release();
}
});
try {
semaphore.acquire();
} catch (Exception e) {
FileLog.e("tmessages", e);
}
if (currentChat != null) {
MessagesController.getInstance().chats.put(currentChat.id, currentChat);
} else {
return false;
}
}
NotificationCenter.getInstance().addObserver(this, MessagesController.updateInterfaces);
NotificationCenter.getInstance().addObserver(this, MessagesController.chatInfoDidLoaded);
NotificationCenter.getInstance().addObserver(this, MessagesController.mediaCountDidLoaded);
NotificationCenter.getInstance().addObserver(this, MessagesController.closeChats);
chat_id = getArguments().getInt("chat_id", 0);
updateOnlineCount();
MessagesController.getInstance().getMediaCount(-chat_id, classGuid, true);
avatarUpdater.delegate = new AvatarUpdater.AvatarUpdaterDelegate() {

View File

@ -208,6 +208,7 @@ public class GroupCreateFinalActivity extends BaseFragment implements Notificati
});
avatarImage = (BackupImageView)fragmentView.findViewById(R.id.settings_avatar_image);
avatarImage.setImageResource(R.drawable.group_blue);
nameTextView = (EditText)fragmentView.findViewById(R.id.bubble_input_text);
nameTextView.setHint(LocaleController.getString("EnterGroupNamePlaceholder", R.string.EnterGroupNamePlaceholder));
@ -304,7 +305,7 @@ public class GroupCreateFinalActivity extends BaseFragment implements Notificati
}
Bundle args2 = new Bundle();
args2.putInt("chat_id", (Integer)args[0]);
presentFragment(new ChatActivity(args2));
presentFragment(new ChatActivity(args2), true);
}
});
}

View File

@ -48,7 +48,7 @@ public class LoginActivitySmsView extends SlideView implements NotificationCente
private Bundle currentParams;
private Timer timeTimer;
private final Integer timerSync = 1;
private static final Integer timerSync = 1;
private volatile int time = 60000;
private double lastCurrentTime;
private boolean waitingForSms = false;
@ -130,18 +130,17 @@ public class LoginActivitySmsView extends SlideView implements NotificationCente
Utilities.showKeyboard(codeField);
codeField.requestFocus();
try {
synchronized(timerSync) {
if (timeTimer != null) {
timeTimer.cancel();
timeTimer = null;
}
}
} catch (Exception e) {
FileLog.e("tmessages", e);
}
destroyTimer();
timeText.setText(String.format("%s 1:00", LocaleController.getString("CallText", R.string.CallText)));
lastCurrentTime = System.currentTimeMillis();
createTimer();
}
private void createTimer() {
if (timeTimer != null) {
return;
}
timeTimer = new Timer();
timeTimer.schedule(new TimerTask() {
@Override
@ -159,12 +158,7 @@ public class LoginActivitySmsView extends SlideView implements NotificationCente
timeText.setText(String.format("%s %d:%02d", LocaleController.getString("CallText", R.string.CallText), minutes, seconds));
} else {
timeText.setText(LocaleController.getString("Calling", R.string.Calling));
synchronized(timerSync) {
if (timeTimer != null) {
timeTimer.cancel();
timeTimer = null;
}
}
destroyTimer();
TLRPC.TL_auth_sendCall req = new TLRPC.TL_auth_sendCall();
req.phone_number = requestPhone;
req.phone_code_hash = phoneHash;
@ -180,6 +174,19 @@ public class LoginActivitySmsView extends SlideView implements NotificationCente
}, 0, 1000);
}
private void destroyTimer() {
try {
synchronized(timerSync) {
if (timeTimer != null) {
timeTimer.cancel();
timeTimer = null;
}
}
} catch (Exception e) {
FileLog.e("tmessages", e);
}
}
@Override
public void onNextPressed() {
if (nextPressed) {
@ -193,16 +200,7 @@ public class LoginActivitySmsView extends SlideView implements NotificationCente
req.phone_number = requestPhone;
req.phone_code = codeField.getText().toString();
req.phone_code_hash = phoneHash;
try {
synchronized(timerSync) {
if (timeTimer != null) {
timeTimer.cancel();
timeTimer = null;
}
}
} catch (Exception e) {
FileLog.e("tmessages", e);
}
destroyTimer();
if (delegate != null) {
delegate.needShowProgress();
}
@ -215,19 +213,11 @@ public class LoginActivitySmsView extends SlideView implements NotificationCente
if (delegate == null) {
return;
}
delegate.needHideProgress();
nextPressed = false;
if (error == null) {
TLRPC.TL_auth_authorization res = (TLRPC.TL_auth_authorization)response;
try {
synchronized(timerSync) {
if (timeTimer != null) {
timeTimer.cancel();
timeTimer = null;
}
}
} catch (Exception e) {
FileLog.e("tmessages", e);
}
destroyTimer();
UserConfig.clearConfig();
MessagesStorage.getInstance().cleanUp();
MessagesController.getInstance().cleanUp();
@ -248,55 +238,9 @@ public class LoginActivitySmsView extends SlideView implements NotificationCente
params.putString("phoneHash", phoneHash);
params.putString("code", req.phone_code);
delegate.setPage(2, true, params, false);
try {
synchronized(timerSync) {
if (timeTimer != null) {
timeTimer.cancel();
timeTimer = null;
}
}
} catch (Exception e) {
FileLog.e("tmessages", e);
}
destroyTimer();
} else {
if (timeTimer == null) {
timeTimer = new Timer();
timeTimer.schedule(new TimerTask() {
@Override
public void run() {
double currentTime = System.currentTimeMillis();
double diff = currentTime - lastCurrentTime;
time -= diff;
lastCurrentTime = currentTime;
Utilities.RunOnUIThread(new Runnable() {
@Override
public void run() {
if (time >= 1000) {
int minutes = time / 1000 / 60;
int seconds = time / 1000 - minutes * 60;
timeText.setText(String.format("%s %d:%02d", LocaleController.getString("CallText", R.string.CallText), minutes, seconds));
} else {
timeText.setText(LocaleController.getString("Calling", R.string.Calling));
synchronized(timerSync) {
if (timeTimer != null) {
timeTimer.cancel();
timeTimer = null;
}
}
TLRPC.TL_auth_sendCall req = new TLRPC.TL_auth_sendCall();
req.phone_number = requestPhone;
req.phone_code_hash = phoneHash;
ConnectionsManager.getInstance().performRpc(req, new RPCRequest.RPCRequestDelegate() {
@Override
public void run(TLObject response, TLRPC.TL_error error) {
}
}, null, true, RPCRequest.RPCRequestClassGeneric | RPCRequest.RPCRequestClassFailOnServerErrors | RPCRequest.RPCRequestClassWithoutLogin);
}
}
});
}
}, 0, 1000);
}
createTimer();
if (error.text.contains("PHONE_NUMBER_INVALID")) {
delegate.needShowAlert(LocaleController.getString("InvalidPhoneNumber", R.string.InvalidPhoneNumber));
} else if (error.text.contains("PHONE_CODE_EMPTY") || error.text.contains("PHONE_CODE_INVALID")) {
@ -318,16 +262,7 @@ public class LoginActivitySmsView extends SlideView implements NotificationCente
@Override
public void onBackPressed() {
try {
synchronized(timerSync) {
if (timeTimer != null) {
timeTimer.cancel();
timeTimer = null;
}
}
} catch (Exception e) {
FileLog.e("tmessages", e);
}
destroyTimer();
currentParams = null;
Utilities.setWaitingForSms(false);
NotificationCenter.getInstance().removeObserver(this, 998);
@ -339,16 +274,7 @@ public class LoginActivitySmsView extends SlideView implements NotificationCente
super.onDestroyActivity();
Utilities.setWaitingForSms(false);
NotificationCenter.getInstance().removeObserver(this, 998);
try {
synchronized(timerSync) {
if (timeTimer != null) {
timeTimer.cancel();
timeTimer = null;
}
}
} catch (Exception e) {
FileLog.e("tmessages", e);
}
destroyTimer();
waitingForSms = false;
}

View File

@ -455,6 +455,7 @@ public class ActionBarLayer extends FrameLayout {
LayoutInflater li = (LayoutInflater) getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
actionOverlay = li.inflate(resourceId, null);
addView(actionOverlay);
actionOverlay.setVisibility(GONE);
actionOverlay.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
@ -484,9 +485,12 @@ public class ActionBarLayer extends FrameLayout {
actionOverlay.setVisibility(!isSearchFieldVisible && isBackOverlayVisible ? VISIBLE : GONE);
if (actionOverlay.getVisibility() == VISIBLE) {
ViewGroup.LayoutParams layoutParams = actionOverlay.getLayoutParams();
layoutParams.width = widthMeasureSpec - (menu != null ? menu.getMeasuredWidth() : 0);
layoutParams.width = LayoutParams.WRAP_CONTENT;
layoutParams.height = LayoutParams.MATCH_PARENT;
actionOverlay.setLayoutParams(layoutParams);
actionOverlay.measure(widthMeasureSpec, heightMeasureSpec);
layoutParams.width = Math.min(actionOverlay.getMeasuredWidth() + Utilities.dp(4), widthMeasureSpec - (menu != null ? menu.getMeasuredWidth() : 0));
actionOverlay.setLayoutParams(layoutParams);
}
}

View File

@ -232,11 +232,11 @@ public class EmojiView extends LinearLayout {
}
};
localObject.setOnClickListener(new View.OnClickListener() {
public void onClick(View paramAnonymousView) {
public void onClick(View view) {
if (EmojiView.this.listener != null) {
EmojiView.this.listener.onEmojiSelected(EmojiView.this.convert((Long)paramAnonymousView.getTag()));
EmojiView.this.listener.onEmojiSelected(EmojiView.this.convert((Long)view.getTag()));
}
EmojiView.this.addToRecent((Long)paramAnonymousView.getTag());
EmojiView.this.addToRecent((Long)view.getTag());
}
});
localObject.setBackgroundResource(R.drawable.list_selector);

View File

@ -69,7 +69,6 @@
android:id="@+id/docs_item_thumb"
android:layout_width="55dp"
android:layout_height="42dp"
android:scaleType="centerCrop"
android:layout_marginTop="11dp"
android:layout_gravity="top|right"/>

View File

@ -21,8 +21,7 @@
<org.telegram.ui.Views.BackupImageView
android:id="@+id/settings_avatar_image"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:src="@drawable/group_blue"/>
android:layout_height="fill_parent"/>
<ImageButton
android:id="@+id/settings_change_avatar_button"

View File

@ -10,7 +10,6 @@
android:layout_width="50dp"
android:layout_height="50dp"
android:id="@+id/messages_list_row_avatar"
android:contentDescription=""
android:layout_marginTop="8dp"
android:layout_gravity="top|right"/>

View File

@ -22,7 +22,6 @@
<org.telegram.ui.Views.BackupImageView
android:layout_width="64dp"
android:layout_height="64dp"
android:contentDescription=""
android:id="@+id/location_avatar_view"
android:layout_marginRight="12dp"
android:layout_marginTop="16dp"

View File

@ -5,17 +5,20 @@
android:id="@+id/container_view"
android:orientation="vertical">
<FrameLayout android:layout_width="fill_parent"
<FrameLayout
android:layout_width="fill_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:background="#ffffff">
<org.telegram.ui.Views.BackupImageView android:layout_height="48dp"
<org.telegram.ui.Views.BackupImageView
android:layout_height="48dp"
android:layout_width="48dp"
android:id="@+id/avatar_image"
android:layout_gravity="right|top"/>
<FrameLayout android:layout_width="fill_parent"
<FrameLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_marginLeft="40dp"
android:orientation="vertical"
@ -23,7 +26,8 @@
android:layout_gravity="top|right"
android:id="@+id/text_layout">
<TextView android:layout_height="wrap_content"
<TextView
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:gravity="right|center"
android:textSize="15dp"
@ -34,7 +38,8 @@
android:layout_gravity="top|right"
android:singleLine="true"/>
<TextView android:layout_height="wrap_content"
<TextView
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:gravity="right|center"
android:textColor="#000000"
@ -47,7 +52,8 @@
</FrameLayout>
<ImageView android:layout_height="40dp"
<ImageView
android:layout_height="40dp"
android:layout_width="40dp"
android:layout_gravity="left|center"
android:src="@drawable/ic_profile_cross"

View File

@ -37,7 +37,6 @@
android:layout_width="64dp"
android:layout_height="64dp"
android:layout_marginTop="5dp"
android:scaleType="fitCenter"
android:id="@+id/chat_photo_image"/>
</LinearLayout>

View File

@ -14,7 +14,6 @@
android:layout_height="42dp"
android:layout_marginLeft="6dp"
android:id="@+id/chat_group_avatar_image"
android:scaleType="fitCenter"
android:layout_marginBottom="2dp"
android:layout_marginRight="4dp"
android:layout_gravity="bottom"/>
@ -34,7 +33,8 @@
android:id="@+id/shared_layout"
android:layout_weight="1">
<org.telegram.ui.Views.BackupImageView android:layout_height="42dp"
<org.telegram.ui.Views.BackupImageView
android:layout_height="42dp"
android:layout_width="42dp"
android:id="@+id/contact_avatar"/>

View File

@ -13,7 +13,6 @@
android:layout_height="42dp"
android:layout_marginLeft="6dp"
android:id="@+id/chat_group_avatar_image"
android:scaleType="fitCenter"
android:layout_marginBottom="2dp"
android:layout_marginRight="4dp"
android:layout_gravity="bottom"/>
@ -38,8 +37,6 @@
android:layout_width="42dp"
android:layout_height="42dp"
android:background="#40b7c9d7"
android:src="@drawable/doc_blue"
android:scaleType="center"
android:id="@+id/contact_avatar"/>
<org.telegram.ui.Views.TightTextView

View File

@ -14,7 +14,6 @@
android:layout_height="42dp"
android:layout_marginLeft="6dp"
android:id="@+id/chat_group_avatar_image"
android:scaleType="fitCenter"
android:layout_marginBottom="2dp"
android:layout_gravity="bottom"/>
@ -31,7 +30,6 @@
android:layout_width="100dp"
android:layout_margin="6dp"
android:layout_gravity="top"
android:scaleType="centerCrop"
android:id="@+id/chat_photo_image"/>
<LinearLayout

View File

@ -1,9 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true">
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true">
<org.telegram.ui.Views.BackupImageView
android:layout_height="48dp"

View File

@ -21,7 +21,8 @@
android:id="@+id/shared_layout"
android:layout_weight="1">
<org.telegram.ui.Views.BackupImageView android:layout_height="42dp"
<org.telegram.ui.Views.BackupImageView
android:layout_height="42dp"
android:layout_width="42dp"
android:id="@+id/contact_avatar"/>
@ -57,18 +58,21 @@
</FrameLayout>
<FrameLayout android:layout_width="wrap_content"
<FrameLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="8dp"
android:layout_gravity="top"
android:id="@+id/add_contact_view">
<FrameLayout android:layout_height="54dp"
<FrameLayout
android:layout_height="54dp"
android:layout_width="1dp"
android:background="#e8e8e8"
android:paddingRight="8dp"/>
<ImageView android:layout_width="38dp"
<ImageView
android:layout_width="38dp"
android:layout_height="54dp"
android:src="@drawable/ic_ab_add_member"
android:scaleType="center"
@ -79,4 +83,5 @@
</FrameLayout>
</LinearLayout>
</FrameLayout>

View File

@ -29,7 +29,6 @@
android:layout_height="42dp"
android:background="#40b7c9d7"
android:src="@drawable/doc_blue"
android:scaleType="center"
android:id="@+id/contact_avatar"/>
<TextView

View File

@ -22,7 +22,6 @@
android:layout_width="wrap_content"
android:layout_margin="6dp"
android:layout_gravity="top"
android:scaleType="centerCrop"
android:minHeight="100dp"
android:minWidth="100dp"
android:id="@+id/chat_photo_image"/>

View File

@ -16,19 +16,22 @@
android:layout_gravity="top|right"
android:id="@+id/chat_bubble_layout">
<FrameLayout android:layout_width="wrap_content"
<FrameLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="8dp"
android:layout_gravity="top"
android:id="@+id/add_contact_view">
<FrameLayout android:layout_height="54dp"
<FrameLayout
android:layout_height="54dp"
android:layout_width="1dp"
android:background="#aa70b15c"
android:paddingLeft="8dp"
android:layout_gravity="right"/>
<ImageView android:layout_width="40dp"
<ImageView
android:layout_width="40dp"
android:layout_height="54dp"
android:src="@drawable/ic_ab_add_member"
android:scaleType="center"
@ -38,16 +41,19 @@
</FrameLayout>
<FrameLayout android:layout_height="58dp"
<FrameLayout
android:layout_height="58dp"
android:layout_width="0dp"
android:id="@+id/shared_layout"
android:layout_weight="1">
<org.telegram.ui.Views.BackupImageView android:layout_height="42dp"
<org.telegram.ui.Views.BackupImageView
android:layout_height="42dp"
android:layout_width="42dp"
android:id="@+id/contact_avatar"/>
<TextView android:layout_height="wrap_content"
<TextView
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:scrollHorizontally="true"
android:paddingLeft="51dp"
@ -59,7 +65,8 @@
android:ellipsize="end"
android:id="@+id/chat_user_group_name"/>
<TextView android:layout_height="wrap_content"
<TextView
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:paddingLeft="51dp"
android:layout_marginTop="20dp"
@ -68,7 +75,8 @@
android:maxLines="1"
android:id="@+id/phone_text_view"/>
<LinearLayout android:layout_width="wrap_content"
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/chat_time_layout"
android:layout_gravity="bottom|right">

View File

@ -80,8 +80,6 @@
android:layout_width="42dp"
android:layout_height="42dp"
android:background="#408ed057"
android:src="@drawable/doc_green"
android:scaleType="center"
android:id="@+id/contact_avatar"/>
<org.telegram.ui.Views.TightTextView

View File

@ -39,7 +39,6 @@
android:layout_width="wrap_content"
android:layout_margin="6dp"
android:layout_gravity="top"
android:scaleType="centerCrop"
android:minHeight="100dp"
android:minWidth="100dp"
android:id="@+id/chat_photo_image"/>

View File

@ -59,7 +59,6 @@
android:id="@+id/docs_item_thumb"
android:layout_width="55dp"
android:layout_height="42dp"
android:scaleType="centerCrop"
android:layout_marginTop="11dp"
android:layout_gravity="top|left"/>

View File

@ -21,8 +21,7 @@
<org.telegram.ui.Views.BackupImageView
android:id="@+id/settings_avatar_image"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:src="@drawable/group_blue"/>
android:layout_height="fill_parent"/>
<ImageButton
android:id="@+id/settings_change_avatar_button"

View File

@ -10,7 +10,6 @@
android:layout_width="50dp"
android:layout_height="50dp"
android:id="@+id/messages_list_row_avatar"
android:contentDescription=""
android:layout_marginTop="8dp"
android:layout_gravity="top"/>

View File

@ -22,7 +22,6 @@
<org.telegram.ui.Views.BackupImageView
android:layout_width="64dp"
android:layout_height="64dp"
android:contentDescription=""
android:id="@+id/location_avatar_view"
android:layout_marginLeft="12dp"
android:layout_marginTop="16dp"

View File

@ -6,7 +6,6 @@
<org.telegram.ui.Views.BackupImageView
android:layout_height="100dp"
android:layout_width="100dp"
android:scaleType="centerCrop"
android:id="@+id/image"
android:layout_gravity="bottom"
android:background="#5A475866"/>