Skip to content

Commit a484ab0

Browse files
author
DrKLO
committed
Bug fixes
1 parent 028f5d9 commit a484ab0

File tree

10 files changed

+47
-32
lines changed

10 files changed

+47
-32
lines changed

TMessagesProj/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ android {
8282
defaultConfig {
8383
minSdkVersion 8
8484
targetSdkVersion 22
85-
versionCode 467
85+
versionCode 468
8686
versionName "2.6.0"
8787
}
8888
}

TMessagesProj/src/main/java/org/telegram/android/MessageObject.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -504,7 +504,7 @@ private boolean containsUrls(CharSequence message) {
504504
} else if (!(c != ' ' && digitsInRow > 0)) {
505505
digitsInRow = 0;
506506
}
507-
if ((c == '@' || c == '#') && i == 0 || i != 0 && message.charAt(i - 1) == ' ') {
507+
if ((c == '@' || c == '#') && i == 0 || i != 0 && (message.charAt(i - 1) == ' ' || message.charAt(i - 1) == '\n')) {
508508
return true;
509509
}
510510
if (c == ':') {

TMessagesProj/src/main/java/org/telegram/android/SmsListener.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,11 +51,11 @@ public void onReceive(Context context, Intent intent) {
5151
NotificationCenter.getInstance().postNotificationName(NotificationCenter.didReceiveSmsCode, matcher.group(0));
5252
}
5353
}
54-
} catch (Exception e) {
54+
} catch (Throwable e) {
5555
FileLog.e("tmessages", e);
5656
}
5757

58-
} catch(Exception e) {
58+
} catch(Throwable e) {
5959
FileLog.e("tmessages", e);
6060
}
6161
}

TMessagesProj/src/main/java/org/telegram/messenger/ConnectionsManager.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2154,7 +2154,7 @@ void processMessage(TLObject message, long messageId, int messageSeqNo, long mes
21542154
implicitError.code = ((TLRPC.RpcError)resultContainer.result).error_code;
21552155
implicitError.text = ((TLRPC.RpcError)resultContainer.result).error_message;
21562156
} else if (!(resultContainer.result instanceof TLRPC.TL_error)) {
2157-
if (request.rawRequest == null || !request.rawRequest.responseClass().isAssignableFrom(resultContainer.result.getClass())) {
2157+
if (request.rawRequest == null || resultContainer.result == null || !request.rawRequest.responseClass().isAssignableFrom(resultContainer.result.getClass())) {
21582158
if (request.rawRequest == null) {
21592159
FileLog.e("tmessages", "rawRequest is null");
21602160
} else {

TMessagesProj/src/main/java/org/telegram/messenger/FileLoader.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,9 @@ public void uploadFile(final String location, final boolean encrypted, final boo
132132
}
133133

134134
public void uploadFile(final String location, final boolean encrypted, final boolean small, final int estimatedSize) {
135+
if (location == null) {
136+
return;
137+
}
135138
fileLoaderQueue.postRunnable(new Runnable() {
136139
@Override
137140
public void run() {

TMessagesProj/src/main/java/org/telegram/messenger/FileLog.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ public void run() {
181181
}
182182

183183
public static void cleanupLogs() {
184-
ArrayList<Uri> uris = new ArrayList<Uri>();
184+
ArrayList<Uri> uris = new ArrayList<>();
185185
File sdCard = ApplicationLoader.applicationContext.getExternalFilesDir(null);
186186
File dir = new File (sdCard.getAbsolutePath() + "/logs");
187187
File[] files = dir.listFiles();

TMessagesProj/src/main/java/org/telegram/ui/Adapters/MentionsAdapter.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ public void searchUsername(String text, int position, ArrayList<MessageObject> m
7070
continue;
7171
}
7272
char ch = text.charAt(a);
73-
if (ch == '@' && (a == 0 || text.charAt(a - 1) == ' ')) {
73+
if (ch == '@' && (a == 0 || text.charAt(a - 1) == ' ' || text.charAt(a - 1) == '\n')) {
7474
found = true;
7575
usernameStartPosition = a;
7676
usernameLength = username.length() + 1;

TMessagesProj/src/main/java/org/telegram/ui/Cells/ChatBaseCell.java

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
import org.telegram.android.LocaleController;
2828
import org.telegram.messenger.ApplicationLoader;
2929
import org.telegram.messenger.FileLoader;
30+
import org.telegram.messenger.FileLog;
3031
import org.telegram.messenger.TLRPC;
3132
import org.telegram.android.MessagesController;
3233
import org.telegram.messenger.R;
@@ -447,17 +448,25 @@ public void setMessageObject(MessageObject messageObject) {
447448
if (stringFinalName == null) {
448449
stringFinalName = LocaleController.getString("Loading", R.string.Loading);
449450
}
450-
replyNameLayout = new StaticLayout(stringFinalName, replyNamePaint, maxWidth, Layout.Alignment.ALIGN_NORMAL, 1.0f, 0.0f, false);
451-
if (replyNameLayout.getLineCount() > 0) {
452-
replyNameWidth = (int)Math.ceil(replyNameLayout.getLineWidth(0)) + AndroidUtilities.dp(12 + (needReplyImage ? 44 : 0));
453-
replyNameOffset = replyNameLayout.getLineLeft(0);
451+
try {
452+
replyNameLayout = new StaticLayout(stringFinalName, replyNamePaint, maxWidth, Layout.Alignment.ALIGN_NORMAL, 1.0f, 0.0f, false);
453+
if (replyNameLayout.getLineCount() > 0) {
454+
replyNameWidth = (int)Math.ceil(replyNameLayout.getLineWidth(0)) + AndroidUtilities.dp(12 + (needReplyImage ? 44 : 0));
455+
replyNameOffset = replyNameLayout.getLineLeft(0);
456+
}
457+
} catch (Exception e) {
458+
FileLog.e("tmessages", e);
454459
}
455-
if (stringFinalText != null) {
456-
replyTextLayout = new StaticLayout(stringFinalText, replyTextPaint, maxWidth, Layout.Alignment.ALIGN_NORMAL, 1.0f, 0.0f, false);
457-
if (replyTextLayout.getLineCount() > 0) {
458-
replyTextWidth = (int) Math.ceil(replyTextLayout.getLineWidth(0)) + AndroidUtilities.dp(12 + (needReplyImage ? 44 : 0));
459-
replyTextOffset = replyTextLayout.getLineLeft(0);
460+
try {
461+
if (stringFinalText != null) {
462+
replyTextLayout = new StaticLayout(stringFinalText, replyTextPaint, maxWidth, Layout.Alignment.ALIGN_NORMAL, 1.0f, 0.0f, false);
463+
if (replyTextLayout.getLineCount() > 0) {
464+
replyTextWidth = (int) Math.ceil(replyTextLayout.getLineWidth(0)) + AndroidUtilities.dp(12 + (needReplyImage ? 44 : 0));
465+
replyTextOffset = replyTextLayout.getLineLeft(0);
466+
}
460467
}
468+
} catch (Exception e) {
469+
FileLog.e("tmessages", e);
461470
}
462471
}
463472

TMessagesProj/src/main/java/org/telegram/ui/ChatActivity.java

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4120,17 +4120,20 @@ public void didSelectDialog(MessagesActivity activity, long did, boolean param)
41204120
args.putInt("chat_id", -lower_part);
41214121
}
41224122
ChatActivity chatActivity = new ChatActivity(args);
4123-
presentFragment(chatActivity, true);
4124-
chatActivity.showReplyForMessageObjectOrForward(true, null, fmessages, false);
4125-
if (!AndroidUtilities.isTablet()) {
4126-
removeSelfFromStack();
4127-
Activity parentActivity = getParentActivity();
4128-
if (parentActivity == null) {
4129-
parentActivity = chatActivity.getParentActivity();
4130-
}
4131-
if (parentActivity != null) {
4132-
parentActivity.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE);
4123+
if (presentFragment(chatActivity, true)) {
4124+
chatActivity.showReplyForMessageObjectOrForward(true, null, fmessages, false);
4125+
if (!AndroidUtilities.isTablet()) {
4126+
removeSelfFromStack();
4127+
Activity parentActivity = getParentActivity();
4128+
if (parentActivity == null) {
4129+
parentActivity = chatActivity.getParentActivity();
4130+
}
4131+
if (parentActivity != null) {
4132+
parentActivity.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE);
4133+
}
41334134
}
4135+
} else {
4136+
activity.finishFragment();
41344137
}
41354138
} else {
41364139
activity.finishFragment();

TMessagesProj/src/main/res/values-ar/strings.xml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -664,12 +664,12 @@
664664
<string name="ForwardedSticker_few">%1$d ملصق معاد توجيهه</string>
665665
<string name="ForwardedSticker_many">%1$d ملصق معاد توجيهه</string>
666666
<string name="ForwardedSticker_other">%1$d ملصق معاد توجيهه</string>
667-
<string name="AndOther_zero">and %1$d others</string>
668-
<string name="AndOther_one">and %1$d other</string>
669-
<string name="AndOther_two">and %1$d others</string>
670-
<string name="AndOther_few">and %1$d others</string>
671-
<string name="AndOther_many">and %1$d others</string>
672-
<string name="AndOther_other">and %1$d others</string>
667+
<string name="AndOther_zero">و %1$d غيرهم</string>
668+
<string name="AndOther_one">و %1$d غيره</string>
669+
<string name="AndOther_two">و %1$d غيرهم</string>
670+
<string name="AndOther_few">و %1$d غيرهم</string>
671+
<string name="AndOther_many">و %1$d غيرهم</string>
672+
<string name="AndOther_other">و %1$d غيرهم</string>
673673
<!--date formatters-->
674674
<string name="formatterMonthYear">MMMM yyyy</string>
675675
<string name="formatterMonth">MMM dd</string>

0 commit comments

Comments
 (0)