mirror of
https://github.com/NekoX-Dev/NekoX.git
synced 2024-11-30 05:11:22 +01:00
Bug fixes
This commit is contained in:
parent
ad0188baea
commit
fc14e8b4f7
@ -81,7 +81,7 @@ android {
|
||||
defaultConfig {
|
||||
minSdkVersion 8
|
||||
targetSdkVersion 19
|
||||
versionCode 251
|
||||
versionName "1.5.0"
|
||||
versionCode 252
|
||||
versionName "1.5.1"
|
||||
}
|
||||
}
|
||||
|
@ -126,23 +126,33 @@ public class BuffersStorage {
|
||||
}
|
||||
if (buffer.buffer.capacity() == 128) {
|
||||
synchronized (freeBuffers128) {
|
||||
freeBuffers128.add(buffer);
|
||||
if (freeBuffers128.size() < 10) {
|
||||
freeBuffers128.add(buffer);
|
||||
}
|
||||
}
|
||||
} else if (buffer.buffer.capacity() == 1024 + 200) {
|
||||
synchronized (freeBuffers1024) {
|
||||
freeBuffers1024.add(buffer);
|
||||
if (freeBuffers1024.size() < 10) {
|
||||
freeBuffers1024.add(buffer);
|
||||
}
|
||||
}
|
||||
} else if (buffer.buffer.capacity() == 4096 + 200) {
|
||||
synchronized (freeBuffers4096) {
|
||||
freeBuffers4096.add(buffer);
|
||||
if (freeBuffers4096.size() < 10) {
|
||||
freeBuffers4096.add(buffer);
|
||||
}
|
||||
}
|
||||
} else if (buffer.buffer.capacity() == 16384 + 200) {
|
||||
synchronized (freeBuffers16384) {
|
||||
freeBuffers16384.add(buffer);
|
||||
if (freeBuffers16384.size() < 10) {
|
||||
freeBuffers16384.add(buffer);
|
||||
}
|
||||
}
|
||||
} else if (buffer.buffer.capacity() == 40000) {
|
||||
synchronized (freeBuffers32768) {
|
||||
freeBuffers32768.add(buffer);
|
||||
if (freeBuffers32768.size() < 10) {
|
||||
freeBuffers32768.add(buffer);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -875,20 +875,17 @@ public class ConnectionsManager implements Action.ActionDelegate, TcpConnection.
|
||||
try {
|
||||
ConnectivityManager cm = (ConnectivityManager)ApplicationLoader.applicationContext.getSystemService(Context.CONNECTIVITY_SERVICE);
|
||||
NetworkInfo netInfo = cm.getActiveNetworkInfo();
|
||||
if (netInfo != null && netInfo.isConnected()) {
|
||||
if (netInfo != null && (netInfo.isConnectedOrConnecting() || netInfo.isRoaming() || netInfo.isAvailable())) {
|
||||
return true;
|
||||
}
|
||||
|
||||
netInfo = cm.getNetworkInfo(ConnectivityManager.TYPE_MOBILE);
|
||||
if (netInfo.isConnected()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (netInfo != null && netInfo.getState() == NetworkInfo.State.CONNECTED) {
|
||||
if (netInfo != null && (netInfo.isConnectedOrConnecting() || netInfo.isRoaming() || netInfo.isAvailable())) {
|
||||
return true;
|
||||
} else {
|
||||
netInfo = cm.getNetworkInfo(ConnectivityManager.TYPE_WIFI);
|
||||
if(netInfo != null && netInfo.getState() == NetworkInfo.State.CONNECTED) {
|
||||
if(netInfo != null && (netInfo.isConnectedOrConnecting() || netInfo.isRoaming() || netInfo.isAvailable())) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@ -2605,6 +2602,13 @@ public class ConnectionsManager implements Action.ActionDelegate, TcpConnection.
|
||||
});
|
||||
}
|
||||
}
|
||||
if (length == 4) {
|
||||
int error = data.readInt32();
|
||||
FileLog.e("tmessages", "mtproto error = " + error);
|
||||
connection.suspendConnection(true);
|
||||
connection.connect();
|
||||
return;
|
||||
}
|
||||
Datacenter datacenter = datacenterWithId(connection.getDatacenterId());
|
||||
|
||||
long keyId = data.readInt64();
|
||||
|
@ -11,7 +11,6 @@ package org.telegram.messenger;
|
||||
import android.os.Handler;
|
||||
import android.os.Looper;
|
||||
import android.os.Message;
|
||||
import android.util.Log;
|
||||
|
||||
public class DispatchQueue extends Thread {
|
||||
public volatile Handler handler = null;
|
||||
@ -68,6 +67,12 @@ public class DispatchQueue extends Thread {
|
||||
}
|
||||
}
|
||||
|
||||
public void cleanupQueue() {
|
||||
if (handler != null) {
|
||||
handler.removeCallbacksAndMessages(null);
|
||||
}
|
||||
}
|
||||
|
||||
public void run() {
|
||||
Looper.prepare();
|
||||
synchronized (handlerSyncObject) {
|
||||
|
@ -393,52 +393,57 @@ public class Emoji {
|
||||
}
|
||||
long buf = 0;
|
||||
int emojiCount = 0;
|
||||
for (int i = 0; i < cs.length(); i++) {
|
||||
char c = cs.charAt(i);
|
||||
if (c == 0xD83C || c == 0xD83D || (buf != 0 && (buf & 0xFFFFFFFF00000000L) == 0 && (c >= 0xDDE6 && c <= 0xDDFA))) {
|
||||
buf <<= 16;
|
||||
buf |= c;
|
||||
} else if (buf > 0 && (c & 0xF000) == 0xD000) {
|
||||
buf <<= 16;
|
||||
buf |= c;
|
||||
Drawable d = Emoji.getEmojiDrawable(buf);
|
||||
if (d != null) {
|
||||
EmojiSpan span = new EmojiSpan(d, DynamicDrawableSpan.ALIGN_BOTTOM, size, fontMetrics);
|
||||
emojiCount++;
|
||||
if (c>= 0xDDE6 && c <= 0xDDFA) {
|
||||
s.setSpan(span, i - 3, i + 1, 0);
|
||||
} else {
|
||||
s.setSpan(span, i - 1, i + 1, 0);
|
||||
}
|
||||
}
|
||||
buf = 0;
|
||||
} else if (c == 0x20E3) {
|
||||
if (i > 0) {
|
||||
char c2 = cs.charAt(i - 1);
|
||||
if ((c2 >= '0' && c2 <= '9') || c2 == '#') {
|
||||
buf = c2;
|
||||
buf <<= 16;
|
||||
buf |= c;
|
||||
Drawable d = Emoji.getEmojiDrawable(buf);
|
||||
if (d != null) {
|
||||
EmojiSpan span = new EmojiSpan(d, DynamicDrawableSpan.ALIGN_BOTTOM, size, fontMetrics);
|
||||
emojiCount++;
|
||||
try {
|
||||
for (int i = 0; i < cs.length(); i++) {
|
||||
char c = cs.charAt(i);
|
||||
if (c == 0xD83C || c == 0xD83D || (buf != 0 && (buf & 0xFFFFFFFF00000000L) == 0 && (c >= 0xDDE6 && c <= 0xDDFA))) {
|
||||
buf <<= 16;
|
||||
buf |= c;
|
||||
} else if (buf > 0 && (c & 0xF000) == 0xD000) {
|
||||
buf <<= 16;
|
||||
buf |= c;
|
||||
Drawable d = Emoji.getEmojiDrawable(buf);
|
||||
if (d != null) {
|
||||
EmojiSpan span = new EmojiSpan(d, DynamicDrawableSpan.ALIGN_BOTTOM, size, fontMetrics);
|
||||
emojiCount++;
|
||||
if (c>= 0xDDE6 && c <= 0xDDFA) {
|
||||
s.setSpan(span, i - 3, i + 1, 0);
|
||||
} else {
|
||||
s.setSpan(span, i - 1, i + 1, 0);
|
||||
}
|
||||
buf = 0;
|
||||
}
|
||||
buf = 0;
|
||||
} else if (c == 0x20E3) {
|
||||
if (i > 0) {
|
||||
char c2 = cs.charAt(i - 1);
|
||||
if ((c2 >= '0' && c2 <= '9') || c2 == '#') {
|
||||
buf = c2;
|
||||
buf <<= 16;
|
||||
buf |= c;
|
||||
Drawable d = Emoji.getEmojiDrawable(buf);
|
||||
if (d != null) {
|
||||
EmojiSpan span = new EmojiSpan(d, DynamicDrawableSpan.ALIGN_BOTTOM, size, fontMetrics);
|
||||
emojiCount++;
|
||||
s.setSpan(span, i - 1, i + 1, 0);
|
||||
}
|
||||
buf = 0;
|
||||
}
|
||||
}
|
||||
} else if (inArray(c, emojiChars)) {
|
||||
Drawable d = Emoji.getEmojiDrawable(c);
|
||||
if (d != null) {
|
||||
EmojiSpan span = new EmojiSpan(d, DynamicDrawableSpan.ALIGN_BOTTOM, size, fontMetrics);
|
||||
emojiCount++;
|
||||
s.setSpan(span, i, i + 1, 0);
|
||||
}
|
||||
}
|
||||
} else if (inArray(c, emojiChars)) {
|
||||
Drawable d = Emoji.getEmojiDrawable(c);
|
||||
if (d != null) {
|
||||
EmojiSpan span = new EmojiSpan(d, DynamicDrawableSpan.ALIGN_BOTTOM, size, fontMetrics);
|
||||
emojiCount++;
|
||||
s.setSpan(span, i, i + 1, 0);
|
||||
if (emojiCount >= 50) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (emojiCount >= 50) {
|
||||
break;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
FileLog.e("tmessages", e);
|
||||
return cs;
|
||||
}
|
||||
return s;
|
||||
}
|
||||
|
@ -36,6 +36,11 @@ public class MessagesStorage {
|
||||
public static byte[] secretPBytes = null;
|
||||
public static int secretG = 0;
|
||||
|
||||
private int lastSavedSeq = 0;
|
||||
private int lastSavedPts = 0;
|
||||
private int lastSavedDate = 0;
|
||||
private int lastSavedQts = 0;
|
||||
|
||||
public static final int wallpapersDidLoaded = 171;
|
||||
|
||||
private static volatile MessagesStorage Instance = null;
|
||||
@ -168,6 +173,7 @@ public class MessagesStorage {
|
||||
}
|
||||
|
||||
public void cleanUp() {
|
||||
storageQueue.cleanupQueue();
|
||||
storageQueue.postRunnable(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
@ -176,6 +182,12 @@ public class MessagesStorage {
|
||||
lastPtsValue = 0;
|
||||
lastQtsValue = 0;
|
||||
lastSecretVersion = 0;
|
||||
|
||||
lastSavedSeq = 0;
|
||||
lastSavedPts = 0;
|
||||
lastSavedDate = 0;
|
||||
lastSavedQts = 0;
|
||||
|
||||
secretPBytes = null;
|
||||
secretG = 0;
|
||||
if (database != null) {
|
||||
@ -186,6 +198,7 @@ public class MessagesStorage {
|
||||
cacheFile.delete();
|
||||
cacheFile = null;
|
||||
}
|
||||
storageQueue.cleanupQueue();
|
||||
openDatabase();
|
||||
}
|
||||
});
|
||||
@ -218,6 +231,9 @@ public class MessagesStorage {
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
if (lastSavedSeq == seq && lastSavedPts == pts && lastSavedDate == date && lastQtsValue == qts) {
|
||||
return;
|
||||
}
|
||||
SQLitePreparedStatement state = database.executeFast("UPDATE params SET seq = ?, pts = ?, date = ?, qts = ? WHERE id = 1");
|
||||
state.bindInteger(1, seq);
|
||||
state.bindInteger(2, pts);
|
||||
@ -225,6 +241,10 @@ public class MessagesStorage {
|
||||
state.bindInteger(4, qts);
|
||||
state.step();
|
||||
state.dispose();
|
||||
lastSavedSeq = seq;
|
||||
lastSavedPts = pts;
|
||||
lastSavedDate = date;
|
||||
lastSavedQts = qts;
|
||||
} catch (Exception e) {
|
||||
FileLog.e("tmessages", e);
|
||||
}
|
||||
@ -1838,6 +1858,7 @@ public class MessagesStorage {
|
||||
state.bindInteger(2, count);
|
||||
state.step();
|
||||
}
|
||||
cursor.dispose();
|
||||
}
|
||||
state.dispose();
|
||||
}
|
||||
|
@ -2682,9 +2682,6 @@ public class ChatActivity extends BaseFragment implements SizeNotifierRelativeLa
|
||||
scrollToTopUnReadOnResume = false;
|
||||
scrollToTopOnResume = false;
|
||||
}
|
||||
if (emojiView != null) {
|
||||
emojiView.loadRecents();
|
||||
}
|
||||
paused = false;
|
||||
if (readWhenResume && !messages.isEmpty()) {
|
||||
readWhenResume = false;
|
||||
@ -2866,10 +2863,6 @@ public class ChatActivity extends BaseFragment implements SizeNotifierRelativeLa
|
||||
return;
|
||||
}
|
||||
|
||||
selectedObject = null;
|
||||
forwaringMessage = null;
|
||||
selectedMessagesCanCopyIds.clear();
|
||||
selectedMessagesIds.clear();
|
||||
View parentView = getRowParentView(v);
|
||||
if (parentView == null) {
|
||||
return;
|
||||
@ -2882,6 +2875,12 @@ public class ChatActivity extends BaseFragment implements SizeNotifierRelativeLa
|
||||
message = holder.message;
|
||||
}
|
||||
final int type = getMessageType(message);
|
||||
|
||||
selectedObject = null;
|
||||
forwaringMessage = null;
|
||||
selectedMessagesCanCopyIds.clear();
|
||||
selectedMessagesIds.clear();
|
||||
|
||||
if (single || type < 2) {
|
||||
if (type >= 0) {
|
||||
selectedObject = message;
|
||||
@ -2924,6 +2923,9 @@ public class ChatActivity extends BaseFragment implements SizeNotifierRelativeLa
|
||||
builder.setItems(items, new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialogInterface, int i) {
|
||||
if (selectedObject == null) {
|
||||
return;
|
||||
}
|
||||
if (type == 0) {
|
||||
if (i == 0) {
|
||||
processSelectedOption(0);
|
||||
|
@ -107,7 +107,7 @@ public class PhotoPickerActivity extends BaseFragment implements NotificationCen
|
||||
}
|
||||
} else if (id == 1) {
|
||||
if (delegate != null) {
|
||||
finishFragment();
|
||||
finishFragment(false);
|
||||
delegate.startPhotoSelectActivity();
|
||||
}
|
||||
}
|
||||
|
@ -59,7 +59,8 @@ public class ActionBarActivity extends Activity {
|
||||
private long transitionAnimationStartTime;
|
||||
private boolean inActionMode = false;
|
||||
private int startedTrackingPointerId;
|
||||
private Animation.AnimationListener listener;
|
||||
private Runnable onCloseAnimationEndRunnable = null;
|
||||
private Runnable onOpenAnimationEndRunnable = null;
|
||||
|
||||
private class FrameLayoutTouch extends FrameLayout {
|
||||
public FrameLayoutTouch(Context context) {
|
||||
@ -157,10 +158,14 @@ public class ActionBarActivity extends Activity {
|
||||
protected void onResume() {
|
||||
super.onResume();
|
||||
fixLayout();
|
||||
if (transitionAnimationInProgress && listener != null) {
|
||||
openAnimation.cancel();
|
||||
closeAnimation.cancel();
|
||||
listener.onAnimationEnd(null);
|
||||
if (transitionAnimationInProgress) {
|
||||
if (onCloseAnimationEndRunnable != null) {
|
||||
closeAnimation.cancel();
|
||||
onCloseAnimationEnd(false);
|
||||
} else if (onOpenAnimationEndRunnable != null) {
|
||||
openAnimation.cancel();
|
||||
onOpenAnimationEnd(false);
|
||||
}
|
||||
}
|
||||
if (!fragmentsStack.isEmpty()) {
|
||||
BaseFragment lastFragment = fragmentsStack.get(fragmentsStack.size() - 1);
|
||||
@ -370,7 +375,7 @@ public class ActionBarActivity extends Activity {
|
||||
onFinish();
|
||||
finish();
|
||||
} else if (!fragmentsStack.isEmpty()) {
|
||||
closeLastFragment();
|
||||
closeLastFragment(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -501,8 +506,15 @@ public class ActionBarActivity extends Activity {
|
||||
if (needAnimation) {
|
||||
transitionAnimationStartTime = System.currentTimeMillis();
|
||||
transitionAnimationInProgress = true;
|
||||
onOpenAnimationEndRunnable = new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
presentFragmentInternalRemoveOld(removeLast, currentFragment);
|
||||
fragment.onOpenAnimationEnd();
|
||||
}
|
||||
};
|
||||
openAnimation.reset();
|
||||
openAnimation.setAnimationListener(listener = new Animation.AnimationListener() {
|
||||
openAnimation.setAnimationListener(new Animation.AnimationListener() {
|
||||
@Override
|
||||
public void onAnimationStart(Animation animation) {
|
||||
|
||||
@ -510,18 +522,7 @@ public class ActionBarActivity extends Activity {
|
||||
|
||||
@Override
|
||||
public void onAnimationEnd(Animation animation) {
|
||||
if (transitionAnimationInProgress) {
|
||||
transitionAnimationInProgress = false;
|
||||
transitionAnimationStartTime = 0;
|
||||
fragment.onOpenAnimationEnd();
|
||||
new Handler().post(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
presentFragmentInternalRemoveOld(removeLast, currentFragment);
|
||||
}
|
||||
});
|
||||
listener = null;
|
||||
}
|
||||
onOpenAnimationEnd(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -552,14 +553,14 @@ public class ActionBarActivity extends Activity {
|
||||
fragmentsStack.remove(fragment);
|
||||
}
|
||||
|
||||
public void closeLastFragment() {
|
||||
public void closeLastFragment(boolean animated) {
|
||||
if (fragmentsStack.size() <= 1 || checkTransitionAnimation()) {
|
||||
return;
|
||||
}
|
||||
if (getCurrentFocus() != null) {
|
||||
Utilities.hideKeyboard(getCurrentFocus());
|
||||
}
|
||||
boolean needAnimation = openAnimation != null && getSharedPreferences("mainconfig", Activity.MODE_PRIVATE).getBoolean("view_animations", true);
|
||||
boolean needAnimation = animated && closeAnimation != null && getSharedPreferences("mainconfig", Activity.MODE_PRIVATE).getBoolean("view_animations", true);
|
||||
final BaseFragment currentFragment = fragmentsStack.get(fragmentsStack.size() - 1);
|
||||
BaseFragment previousFragment = fragmentsStack.get(fragmentsStack.size() - 2);
|
||||
if (!needAnimation) {
|
||||
@ -584,7 +585,13 @@ public class ActionBarActivity extends Activity {
|
||||
transitionAnimationInProgress = true;
|
||||
closeAnimation.reset();
|
||||
closeAnimation.setFillAfter(true);
|
||||
closeAnimation.setAnimationListener(listener = new Animation.AnimationListener() {
|
||||
onCloseAnimationEndRunnable = new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
closeLastFragmentInternalRemoveOld(currentFragment);
|
||||
}
|
||||
};
|
||||
closeAnimation.setAnimationListener(new Animation.AnimationListener() {
|
||||
@Override
|
||||
public void onAnimationStart(Animation animation) {
|
||||
|
||||
@ -592,16 +599,7 @@ public class ActionBarActivity extends Activity {
|
||||
|
||||
@Override
|
||||
public void onAnimationEnd(Animation animation) {
|
||||
if (transitionAnimationInProgress) {
|
||||
transitionAnimationInProgress = false;
|
||||
transitionAnimationStartTime = 0;
|
||||
new Handler().post(new Runnable() {
|
||||
public void run() {
|
||||
closeLastFragmentInternalRemoveOld(currentFragment);
|
||||
}
|
||||
});
|
||||
listener = null;
|
||||
}
|
||||
onCloseAnimationEnd(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -691,13 +689,56 @@ public class ActionBarActivity extends Activity {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void startActivityForResult(Intent intent, int requestCode) {
|
||||
if (transitionAnimationInProgress && listener != null) {
|
||||
openAnimation.cancel();
|
||||
closeAnimation.cancel();
|
||||
listener.onAnimationEnd(null);
|
||||
private void onCloseAnimationEnd(boolean post) {
|
||||
if (transitionAnimationInProgress && onCloseAnimationEndRunnable != null) {
|
||||
transitionAnimationInProgress = false;
|
||||
transitionAnimationStartTime = 0;
|
||||
if (post) {
|
||||
new Handler().post(new Runnable() {
|
||||
public void run() {
|
||||
onCloseAnimationEndRunnable.run();
|
||||
onCloseAnimationEndRunnable = null;
|
||||
}
|
||||
});
|
||||
} else {
|
||||
onCloseAnimationEndRunnable.run();
|
||||
onCloseAnimationEndRunnable = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void onOpenAnimationEnd(boolean post) {
|
||||
if (transitionAnimationInProgress && onOpenAnimationEndRunnable != null) {
|
||||
transitionAnimationInProgress = false;
|
||||
transitionAnimationStartTime = 0;
|
||||
if (post) {
|
||||
new Handler().post(new Runnable() {
|
||||
public void run() {
|
||||
onOpenAnimationEndRunnable.run();
|
||||
onOpenAnimationEndRunnable = null;
|
||||
}
|
||||
});
|
||||
} else {
|
||||
onOpenAnimationEndRunnable.run();
|
||||
onOpenAnimationEndRunnable = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void startActivityForResult(final Intent intent, final int requestCode) {
|
||||
if (transitionAnimationInProgress) {
|
||||
if (onCloseAnimationEndRunnable != null) {
|
||||
closeAnimation.cancel();
|
||||
onCloseAnimationEnd(false);
|
||||
} else if (onOpenAnimationEndRunnable != null) {
|
||||
openAnimation.cancel();
|
||||
onOpenAnimationEnd(false);
|
||||
}
|
||||
containerView.invalidate();
|
||||
ActionBarActivity.super.startActivityForResult(intent, requestCode);
|
||||
} else {
|
||||
super.startActivityForResult(intent, requestCode);
|
||||
}
|
||||
super.startActivityForResult(intent, requestCode);
|
||||
}
|
||||
}
|
||||
|
@ -121,7 +121,6 @@ public class ActionBarMenuItem extends ImageView {
|
||||
}
|
||||
if (popupWindow == null) {
|
||||
popupWindow = new ActionBarPopupWindow(popupLayout, FrameLayout.LayoutParams.WRAP_CONTENT, FrameLayout.LayoutParams.WRAP_CONTENT);
|
||||
popupWindow.setFocusable(true);
|
||||
popupWindow.setBackgroundDrawable(new BitmapDrawable());
|
||||
popupWindow.setOutsideTouchable(true);
|
||||
popupWindow.setClippingEnabled(true);
|
||||
@ -132,8 +131,10 @@ public class ActionBarMenuItem extends ImageView {
|
||||
if (popupLayout.getMeasuredWidth() == 0) {
|
||||
popupWindow.showAsDropDown(this, parentActionBar.getMeasuredWidth() - popupLayout.getMeasuredWidth() - getLeft() - parentMenu.getLeft(), 0);
|
||||
popupWindow.update(this, parentActionBar.getMeasuredWidth() - popupLayout.getMeasuredWidth() - getLeft() - parentMenu.getLeft(), 0, -1, -1);
|
||||
popupWindow.setFocusable(true);
|
||||
} else {
|
||||
popupWindow.showAsDropDown(this, parentActionBar.getMeasuredWidth() - popupLayout.getMeasuredWidth() - getLeft() - parentMenu.getLeft(), 0);
|
||||
popupWindow.setFocusable(true);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -152,6 +152,7 @@ public class ActionBarPopupWindow extends PopupWindow {
|
||||
|
||||
@Override
|
||||
public void dismiss() {
|
||||
setFocusable(false);
|
||||
super.dismiss();
|
||||
unregisterListener();
|
||||
}
|
||||
|
@ -69,10 +69,14 @@ public class BaseFragment {
|
||||
}
|
||||
|
||||
public void finishFragment() {
|
||||
finishFragment(true);
|
||||
}
|
||||
|
||||
public void finishFragment(boolean animated) {
|
||||
if (isFinished || parentActivity == null) {
|
||||
return;
|
||||
}
|
||||
parentActivity.closeLastFragment();
|
||||
parentActivity.closeLastFragment(animated);
|
||||
}
|
||||
|
||||
public void removeSelfFromStack() {
|
||||
@ -192,13 +196,17 @@ public class BaseFragment {
|
||||
|
||||
}
|
||||
|
||||
protected void showAlertDialog(AlertDialog.Builder builder) {
|
||||
protected boolean showAlertDialog(AlertDialog.Builder builder) {
|
||||
if (parentActivity == null || parentActivity.checkTransitionAnimation() || parentActivity.animationInProgress || parentActivity.startedTracking) {
|
||||
return;
|
||||
return false;
|
||||
}
|
||||
if (visibleDialog != null && visibleDialog.isShowing()) {
|
||||
visibleDialog.dismiss();
|
||||
visibleDialog = null;
|
||||
try {
|
||||
if (visibleDialog != null) {
|
||||
visibleDialog.dismiss();
|
||||
visibleDialog = null;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
FileLog.e("tmessages", e);
|
||||
}
|
||||
visibleDialog = builder.show();
|
||||
visibleDialog.setCanceledOnTouchOutside(true);
|
||||
@ -208,5 +216,6 @@ public class BaseFragment {
|
||||
visibleDialog = null;
|
||||
}
|
||||
});
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -100,62 +100,58 @@ public class EmojiView extends LinearLayout {
|
||||
}
|
||||
|
||||
private void init() {
|
||||
setOrientation(1);
|
||||
for (int i = 0; ; i++) {
|
||||
if (i >= Emoji.data.length) {
|
||||
setBackgroundDrawable(new GradientDrawable(GradientDrawable.Orientation.TOP_BOTTOM, new int[] { -14145496, -16777216 }));
|
||||
pager = new ViewPager(getContext());
|
||||
pager.setAdapter(new EmojiPagesAdapter());
|
||||
PagerSlidingTabStrip tabs = new PagerSlidingTabStrip(getContext());
|
||||
tabs.setViewPager(this.pager);
|
||||
tabs.setShouldExpand(true);
|
||||
tabs.setIndicatorColor(0xff33b5e5);
|
||||
tabs.setIndicatorHeight(Utilities.dpf(2.0f));
|
||||
tabs.setUnderlineHeight(Utilities.dpf(2.0f));
|
||||
tabs.setUnderlineColor(1711276032);
|
||||
tabs.setTabBackground(0);
|
||||
LinearLayout localLinearLayout = new LinearLayout(getContext());
|
||||
localLinearLayout.setOrientation(0);
|
||||
localLinearLayout.addView(tabs, new LinearLayout.LayoutParams(-1, -1, 1.0F));
|
||||
ImageView localImageView = new ImageView(getContext());
|
||||
localImageView.setImageResource(R.drawable.ic_emoji_backspace);
|
||||
localImageView.setScaleType(ImageView.ScaleType.CENTER);
|
||||
localImageView.setBackgroundResource(R.drawable.bg_emoji_bs);
|
||||
localImageView.setOnClickListener(new View.OnClickListener() {
|
||||
public void onClick(View paramAnonymousView) {
|
||||
if (EmojiView.this.listener != null) {
|
||||
EmojiView.this.listener.onBackspace();
|
||||
}
|
||||
}
|
||||
});
|
||||
localImageView.setOnLongClickListener(new View.OnLongClickListener() {
|
||||
public boolean onLongClick(View paramAnonymousView) {
|
||||
EmojiView.this.getContext().getSharedPreferences("emoji", 0).edit().clear().commit();
|
||||
return true;
|
||||
}
|
||||
});
|
||||
localLinearLayout.addView(localImageView, new LinearLayout.LayoutParams(Utilities.dpf(61.0f), -1));
|
||||
this.recentsWrap = new FrameLayout(getContext());
|
||||
this.recentsWrap.addView(this.views.get(0));
|
||||
TextView localTextView = new TextView(getContext());
|
||||
localTextView.setText(LocaleController.getString("NoRecent", R.string.NoRecent));
|
||||
localTextView.setTextSize(18.0f);
|
||||
localTextView.setTextColor(-7829368);
|
||||
localTextView.setGravity(17);
|
||||
this.recentsWrap.addView(localTextView);
|
||||
this.views.get(0).setEmptyView(localTextView);
|
||||
addView(localLinearLayout, new LinearLayout.LayoutParams(-1, Utilities.dpf(48.0f)));
|
||||
addView(this.pager);
|
||||
loadRecents();
|
||||
return;
|
||||
}
|
||||
GridView localGridView = new GridView(getContext());
|
||||
localGridView.setColumnWidth(Utilities.dpf(45.0f));
|
||||
localGridView.setNumColumns(-1);
|
||||
setOrientation(LinearLayout.VERTICAL);
|
||||
for (int i = 0; i < Emoji.data.length; i++) {
|
||||
GridView gridView = new GridView(getContext());
|
||||
gridView.setColumnWidth(Utilities.dpf(45.0f));
|
||||
gridView.setNumColumns(-1);
|
||||
views.add(gridView);
|
||||
|
||||
EmojiGridAdapter localEmojiGridAdapter = new EmojiGridAdapter(Emoji.data[i]);
|
||||
localGridView.setAdapter(localEmojiGridAdapter);
|
||||
this.adapters.add(localEmojiGridAdapter);
|
||||
this.views.add(localGridView);
|
||||
gridView.setAdapter(localEmojiGridAdapter);
|
||||
adapters.add(localEmojiGridAdapter);
|
||||
}
|
||||
|
||||
setBackgroundDrawable(new GradientDrawable(GradientDrawable.Orientation.TOP_BOTTOM, new int[] { -14145496, -16777216 }));
|
||||
pager = new ViewPager(getContext());
|
||||
pager.setAdapter(new EmojiPagesAdapter());
|
||||
PagerSlidingTabStrip tabs = new PagerSlidingTabStrip(getContext());
|
||||
tabs.setViewPager(pager);
|
||||
tabs.setShouldExpand(true);
|
||||
tabs.setIndicatorColor(0xff33b5e5);
|
||||
tabs.setIndicatorHeight(Utilities.dpf(2.0f));
|
||||
tabs.setUnderlineHeight(Utilities.dpf(2.0f));
|
||||
tabs.setUnderlineColor(1711276032);
|
||||
tabs.setTabBackground(0);
|
||||
LinearLayout localLinearLayout = new LinearLayout(getContext());
|
||||
localLinearLayout.setOrientation(LinearLayout.HORIZONTAL);
|
||||
localLinearLayout.addView(tabs, new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT, 1.0f));
|
||||
ImageView localImageView = new ImageView(getContext());
|
||||
localImageView.setImageResource(R.drawable.ic_emoji_backspace);
|
||||
localImageView.setScaleType(ImageView.ScaleType.CENTER);
|
||||
localImageView.setBackgroundResource(R.drawable.bg_emoji_bs);
|
||||
localImageView.setOnClickListener(new View.OnClickListener() {
|
||||
public void onClick(View view) {
|
||||
if (EmojiView.this.listener != null) {
|
||||
EmojiView.this.listener.onBackspace();
|
||||
}
|
||||
}
|
||||
});
|
||||
localLinearLayout.addView(localImageView, new LinearLayout.LayoutParams(Utilities.dpf(61.0f), LayoutParams.MATCH_PARENT));
|
||||
recentsWrap = new FrameLayout(getContext());
|
||||
recentsWrap.addView(views.get(0));
|
||||
TextView localTextView = new TextView(getContext());
|
||||
localTextView.setText(LocaleController.getString("NoRecent", R.string.NoRecent));
|
||||
localTextView.setTextSize(18.0f);
|
||||
localTextView.setTextColor(-7829368);
|
||||
localTextView.setGravity(17);
|
||||
recentsWrap.addView(localTextView);
|
||||
views.get(0).setEmptyView(localTextView);
|
||||
addView(localLinearLayout, new LinearLayout.LayoutParams(-1, Utilities.dpf(48.0f)));
|
||||
addView(pager);
|
||||
loadRecents();
|
||||
if (Emoji.data[0] == null || Emoji.data[0].length == 0) {
|
||||
pager.setCurrentItem(1);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user