mirror of
https://github.com/DrKLO/Telegram.git
synced 2024-12-22 14:35:03 +01:00
Bug fixes
This commit is contained in:
parent
5faa453835
commit
7fcd94d5c9
7 changed files with 59 additions and 69 deletions
|
@ -11,7 +11,7 @@ package org.telegram.messenger;
|
||||||
public class BuildVars {
|
public class BuildVars {
|
||||||
public static boolean DEBUG_VERSION = false;
|
public static boolean DEBUG_VERSION = false;
|
||||||
public static boolean DEBUG_PRIVATE_VERSION = false;
|
public static boolean DEBUG_PRIVATE_VERSION = false;
|
||||||
public static int BUILD_VERSION = 1041;
|
public static int BUILD_VERSION = 1042;
|
||||||
public static String BUILD_VERSION_STRING = "4.2";
|
public static String BUILD_VERSION_STRING = "4.2";
|
||||||
public static int APP_ID = 0; //obtain your own APP_ID at https://core.telegram.org/api/obtaining_api_id
|
public static int APP_ID = 0; //obtain your own APP_ID at https://core.telegram.org/api/obtaining_api_id
|
||||||
public static String APP_HASH = ""; //obtain your own APP_HASH at https://core.telegram.org/api/obtaining_api_id
|
public static String APP_HASH = ""; //obtain your own APP_HASH at https://core.telegram.org/api/obtaining_api_id
|
||||||
|
|
|
@ -174,7 +174,8 @@ public class NotificationCenter {
|
||||||
public void setAnimationInProgress(boolean value) {
|
public void setAnimationInProgress(boolean value) {
|
||||||
animationInProgress = value;
|
animationInProgress = value;
|
||||||
if (!animationInProgress && !delayedPosts.isEmpty()) {
|
if (!animationInProgress && !delayedPosts.isEmpty()) {
|
||||||
for (DelayedPost delayedPost : delayedPosts) {
|
for (int a = 0; a < delayedPosts.size(); a++) {
|
||||||
|
DelayedPost delayedPost = delayedPosts.get(a);
|
||||||
postNotificationNameInternal(delayedPost.id, true, delayedPost.args);
|
postNotificationNameInternal(delayedPost.id, true, delayedPost.args);
|
||||||
}
|
}
|
||||||
delayedPosts.clear();
|
delayedPosts.clear();
|
||||||
|
|
|
@ -39,6 +39,7 @@ import org.telegram.tgnet.TLRPC;
|
||||||
import org.telegram.ui.LaunchActivity;
|
import org.telegram.ui.LaunchActivity;
|
||||||
import org.telegram.ui.PopupNotificationActivity;
|
import org.telegram.ui.PopupNotificationActivity;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Calendar;
|
import java.util.Calendar;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
@ -1826,12 +1827,15 @@ public class NotificationsController {
|
||||||
mBuilder.setLargeIcon(img.getBitmap());
|
mBuilder.setLargeIcon(img.getBitmap());
|
||||||
} else {
|
} else {
|
||||||
try {
|
try {
|
||||||
float scaleFactor = 160.0f / AndroidUtilities.dp(50);
|
File file = FileLoader.getPathToAttach(photoPath, true);
|
||||||
BitmapFactory.Options options = new BitmapFactory.Options();
|
if (file.exists()) {
|
||||||
options.inSampleSize = scaleFactor < 1 ? 1 : (int) scaleFactor;
|
float scaleFactor = 160.0f / AndroidUtilities.dp(50);
|
||||||
Bitmap bitmap = BitmapFactory.decodeFile(FileLoader.getPathToAttach(photoPath, true).toString(), options);
|
BitmapFactory.Options options = new BitmapFactory.Options();
|
||||||
if (bitmap != null) {
|
options.inSampleSize = scaleFactor < 1 ? 1 : (int) scaleFactor;
|
||||||
mBuilder.setLargeIcon(bitmap);
|
Bitmap bitmap = BitmapFactory.decodeFile(file.getAbsolutePath(), options);
|
||||||
|
if (bitmap != null) {
|
||||||
|
mBuilder.setLargeIcon(bitmap);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} catch (Throwable e) {
|
} catch (Throwable e) {
|
||||||
//ignore
|
//ignore
|
||||||
|
@ -2085,12 +2089,15 @@ public class NotificationsController {
|
||||||
builder.setLargeIcon(img.getBitmap());
|
builder.setLargeIcon(img.getBitmap());
|
||||||
} else {
|
} else {
|
||||||
try {
|
try {
|
||||||
float scaleFactor = 160.0f / AndroidUtilities.dp(50);
|
File file = FileLoader.getPathToAttach(photoPath, true);
|
||||||
BitmapFactory.Options options = new BitmapFactory.Options();
|
if (file.exists()) {
|
||||||
options.inSampleSize = scaleFactor < 1 ? 1 : (int) scaleFactor;
|
float scaleFactor = 160.0f / AndroidUtilities.dp(50);
|
||||||
Bitmap bitmap = BitmapFactory.decodeFile(FileLoader.getPathToAttach(photoPath, true).toString(), options);
|
BitmapFactory.Options options = new BitmapFactory.Options();
|
||||||
if (bitmap != null) {
|
options.inSampleSize = scaleFactor < 1 ? 1 : (int) scaleFactor;
|
||||||
builder.setLargeIcon(bitmap);
|
Bitmap bitmap = BitmapFactory.decodeFile(file.getAbsolutePath(), options);
|
||||||
|
if (bitmap != null) {
|
||||||
|
builder.setLargeIcon(bitmap);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} catch (Throwable e) {
|
} catch (Throwable e) {
|
||||||
//ignore
|
//ignore
|
||||||
|
|
|
@ -19,7 +19,6 @@ import android.graphics.Canvas;
|
||||||
import android.graphics.Paint;
|
import android.graphics.Paint;
|
||||||
import android.graphics.Rect;
|
import android.graphics.Rect;
|
||||||
import android.graphics.drawable.Drawable;
|
import android.graphics.drawable.Drawable;
|
||||||
import android.os.Handler;
|
|
||||||
import android.view.Gravity;
|
import android.view.Gravity;
|
||||||
import android.view.KeyEvent;
|
import android.view.KeyEvent;
|
||||||
import android.view.Menu;
|
import android.view.Menu;
|
||||||
|
@ -234,9 +233,9 @@ public class ActionBarLayout extends FrameLayout {
|
||||||
currentAnimation = null;
|
currentAnimation = null;
|
||||||
}
|
}
|
||||||
if (onCloseAnimationEndRunnable != null) {
|
if (onCloseAnimationEndRunnable != null) {
|
||||||
onCloseAnimationEnd(false);
|
onCloseAnimationEnd();
|
||||||
} else if (onOpenAnimationEndRunnable != null) {
|
} else if (onOpenAnimationEndRunnable != null) {
|
||||||
onOpenAnimationEnd(false);
|
onOpenAnimationEnd();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!fragmentsStack.isEmpty()) {
|
if (!fragmentsStack.isEmpty()) {
|
||||||
|
@ -523,9 +522,9 @@ public class ActionBarLayout extends FrameLayout {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void onAnimationEndCheck(boolean byCheck, boolean customAnimation) {
|
private void onAnimationEndCheck(boolean byCheck) {
|
||||||
onCloseAnimationEnd(customAnimation);
|
onCloseAnimationEnd();
|
||||||
onOpenAnimationEnd(customAnimation);
|
onOpenAnimationEnd();
|
||||||
if (waitingForKeyboardCloseRunnable != null) {
|
if (waitingForKeyboardCloseRunnable != null) {
|
||||||
AndroidUtilities.cancelRunOnUIThread(waitingForKeyboardCloseRunnable);
|
AndroidUtilities.cancelRunOnUIThread(waitingForKeyboardCloseRunnable);
|
||||||
waitingForKeyboardCloseRunnable = null;
|
waitingForKeyboardCloseRunnable = null;
|
||||||
|
@ -551,7 +550,7 @@ public class ActionBarLayout extends FrameLayout {
|
||||||
|
|
||||||
public boolean checkTransitionAnimation() {
|
public boolean checkTransitionAnimation() {
|
||||||
if (transitionAnimationInProgress && transitionAnimationStartTime < System.currentTimeMillis() - 1500) {
|
if (transitionAnimationInProgress && transitionAnimationStartTime < System.currentTimeMillis() - 1500) {
|
||||||
onAnimationEndCheck(true, false);
|
onAnimationEndCheck(true);
|
||||||
}
|
}
|
||||||
return transitionAnimationInProgress;
|
return transitionAnimationInProgress;
|
||||||
}
|
}
|
||||||
|
@ -627,7 +626,7 @@ public class ActionBarLayout extends FrameLayout {
|
||||||
if (animationProgress < 1) {
|
if (animationProgress < 1) {
|
||||||
startLayoutAnimation(open, false);
|
startLayoutAnimation(open, false);
|
||||||
} else {
|
} else {
|
||||||
onAnimationEndCheck(false, false);
|
onAnimationEndCheck(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -730,7 +729,7 @@ public class ActionBarLayout extends FrameLayout {
|
||||||
currentAnimation.addListener(new AnimatorListenerAdapter() {
|
currentAnimation.addListener(new AnimatorListenerAdapter() {
|
||||||
@Override
|
@Override
|
||||||
public void onAnimationEnd(Animator animation) {
|
public void onAnimationEnd(Animator animation) {
|
||||||
onAnimationEndCheck(false, true);
|
onAnimationEndCheck(false);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
currentAnimation.start();
|
currentAnimation.start();
|
||||||
|
@ -750,7 +749,7 @@ public class ActionBarLayout extends FrameLayout {
|
||||||
AnimatorSet animation = fragment.onCustomTransitionAnimation(true, new Runnable() {
|
AnimatorSet animation = fragment.onCustomTransitionAnimation(true, new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
onAnimationEndCheck(false, true);
|
onAnimationEndCheck(false);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
if (animation == null) {
|
if (animation == null) {
|
||||||
|
@ -921,7 +920,7 @@ public class ActionBarLayout extends FrameLayout {
|
||||||
AnimatorSet animation = currentFragment.onCustomTransitionAnimation(false, new Runnable() {
|
AnimatorSet animation = currentFragment.onCustomTransitionAnimation(false, new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
onAnimationEndCheck(false, true);
|
onAnimationEndCheck(false);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
if (animation == null) {
|
if (animation == null) {
|
||||||
|
@ -985,7 +984,7 @@ public class ActionBarLayout extends FrameLayout {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onAnimationEnd(Animator animation) {
|
public void onAnimationEnd(Animator animation) {
|
||||||
onAnimationEndCheck(false, true);
|
onAnimationEndCheck(false);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
currentAnimation.start();
|
currentAnimation.start();
|
||||||
|
@ -1113,21 +1112,12 @@ public class ActionBarLayout extends FrameLayout {
|
||||||
inActionMode = false;
|
inActionMode = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void onCloseAnimationEnd(boolean post) {
|
private void onCloseAnimationEnd() {
|
||||||
if (transitionAnimationInProgress && onCloseAnimationEndRunnable != null) {
|
if (transitionAnimationInProgress && onCloseAnimationEndRunnable != null) {
|
||||||
transitionAnimationInProgress = false;
|
transitionAnimationInProgress = false;
|
||||||
transitionAnimationStartTime = 0;
|
transitionAnimationStartTime = 0;
|
||||||
if (post) {
|
onCloseAnimationEndRunnable.run();
|
||||||
new Handler().post(new Runnable() {
|
onCloseAnimationEndRunnable = null;
|
||||||
public void run() {
|
|
||||||
onCloseAnimationEndRunnable.run();
|
|
||||||
onCloseAnimationEndRunnable = null;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
onCloseAnimationEndRunnable.run();
|
|
||||||
onCloseAnimationEndRunnable = null;
|
|
||||||
}
|
|
||||||
checkNeedRebuild();
|
checkNeedRebuild();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1139,22 +1129,12 @@ public class ActionBarLayout extends FrameLayout {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void onOpenAnimationEnd(boolean post) {
|
private void onOpenAnimationEnd() {
|
||||||
if (transitionAnimationInProgress && onOpenAnimationEndRunnable != null) {
|
if (transitionAnimationInProgress && onOpenAnimationEndRunnable != null) {
|
||||||
transitionAnimationInProgress = false;
|
transitionAnimationInProgress = false;
|
||||||
transitionAnimationStartTime = 0;
|
transitionAnimationStartTime = 0;
|
||||||
if (post) {
|
onOpenAnimationEndRunnable.run();
|
||||||
AndroidUtilities.runOnUIThread(new Runnable() {
|
onOpenAnimationEndRunnable = null;
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
onOpenAnimationEndRunnable.run();
|
|
||||||
onOpenAnimationEndRunnable = null;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
onOpenAnimationEndRunnable.run();
|
|
||||||
onOpenAnimationEndRunnable = null;
|
|
||||||
}
|
|
||||||
checkNeedRebuild();
|
checkNeedRebuild();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1169,9 +1149,9 @@ public class ActionBarLayout extends FrameLayout {
|
||||||
currentAnimation = null;
|
currentAnimation = null;
|
||||||
}
|
}
|
||||||
if (onCloseAnimationEndRunnable != null) {
|
if (onCloseAnimationEndRunnable != null) {
|
||||||
onCloseAnimationEnd(false);
|
onCloseAnimationEnd();
|
||||||
} else if (onOpenAnimationEndRunnable != null) {
|
} else if (onOpenAnimationEndRunnable != null) {
|
||||||
onOpenAnimationEnd(false);
|
onOpenAnimationEnd();
|
||||||
}
|
}
|
||||||
containerView.invalidate();
|
containerView.invalidate();
|
||||||
if (intent != null) {
|
if (intent != null) {
|
||||||
|
|
|
@ -17,6 +17,7 @@ import android.text.Layout;
|
||||||
import android.text.Spannable;
|
import android.text.Spannable;
|
||||||
import android.text.SpannableStringBuilder;
|
import android.text.SpannableStringBuilder;
|
||||||
import android.text.StaticLayout;
|
import android.text.StaticLayout;
|
||||||
|
import android.text.TextUtils;
|
||||||
import android.text.style.ClickableSpan;
|
import android.text.style.ClickableSpan;
|
||||||
import android.text.style.URLSpan;
|
import android.text.style.URLSpan;
|
||||||
import android.view.Gravity;
|
import android.view.Gravity;
|
||||||
|
@ -80,11 +81,7 @@ public class AboutLinkCell extends FrameLayout {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setTextAndIcon(String text, int resId, boolean parseLinks) {
|
public void setTextAndIcon(String text, int resId, boolean parseLinks) {
|
||||||
if (text == null || text.length() == 0) {
|
if (TextUtils.isEmpty(text) || text != null && oldText != null && text.equals(oldText)) {
|
||||||
setVisibility(GONE);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (text != null && oldText != null && text.equals(oldText)) {
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
oldText = text;
|
oldText = text;
|
||||||
|
@ -174,8 +171,10 @@ public class AboutLinkCell extends FrameLayout {
|
||||||
@SuppressLint("DrawAllocation")
|
@SuppressLint("DrawAllocation")
|
||||||
@Override
|
@Override
|
||||||
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
|
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
|
||||||
textLayout = new StaticLayout(stringBuilder, Theme.profile_aboutTextPaint, MeasureSpec.getSize(widthMeasureSpec) - AndroidUtilities.dp(71 + 16), Layout.Alignment.ALIGN_NORMAL, 1.0f, 0.0f, false);
|
if (stringBuilder != null) {
|
||||||
super.onMeasure(MeasureSpec.makeMeasureSpec(MeasureSpec.getSize(widthMeasureSpec), MeasureSpec.EXACTLY), MeasureSpec.makeMeasureSpec(textLayout.getHeight() + AndroidUtilities.dp(16), MeasureSpec.EXACTLY));
|
textLayout = new StaticLayout(stringBuilder, Theme.profile_aboutTextPaint, MeasureSpec.getSize(widthMeasureSpec) - AndroidUtilities.dp(71 + 16), Layout.Alignment.ALIGN_NORMAL, 1.0f, 0.0f, false);
|
||||||
|
}
|
||||||
|
super.onMeasure(MeasureSpec.makeMeasureSpec(MeasureSpec.getSize(widthMeasureSpec), MeasureSpec.EXACTLY), MeasureSpec.makeMeasureSpec((textLayout != null ? textLayout.getHeight() : AndroidUtilities.dp(20)) + AndroidUtilities.dp(16), MeasureSpec.EXACTLY));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -947,7 +947,10 @@ public class DialogsActivity extends BaseFragment implements NotificationCenter.
|
||||||
permissons.add(Manifest.permission.WRITE_EXTERNAL_STORAGE);
|
permissons.add(Manifest.permission.WRITE_EXTERNAL_STORAGE);
|
||||||
}
|
}
|
||||||
String[] items = permissons.toArray(new String[permissons.size()]);
|
String[] items = permissons.toArray(new String[permissons.size()]);
|
||||||
activity.requestPermissions(items, 1);
|
try {
|
||||||
|
activity.requestPermissions(items, 1);
|
||||||
|
} catch (Exception ignore) {
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -2212,10 +2212,10 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter.
|
||||||
if ((user == null || !user.bot) && !TextUtils.isEmpty(user.phone)) {
|
if ((user == null || !user.bot) && !TextUtils.isEmpty(user.phone)) {
|
||||||
phoneRow = rowCount++;
|
phoneRow = rowCount++;
|
||||||
}
|
}
|
||||||
|
|
||||||
TLRPC.TL_userFull userFull = MessagesController.getInstance().getUserFull(user.id);
|
TLRPC.TL_userFull userFull = MessagesController.getInstance().getUserFull(user.id);
|
||||||
String about = userFull != null ? userFull.about : null;
|
|
||||||
boolean hasUsername = user != null && !TextUtils.isEmpty(user.username);
|
boolean hasUsername = user != null && !TextUtils.isEmpty(user.username);
|
||||||
if (about != null) {
|
if (userFull != null && !TextUtils.isEmpty(userFull.about)) {
|
||||||
if (phoneRow != -1) {
|
if (phoneRow != -1) {
|
||||||
userSectionRow = rowCount++;
|
userSectionRow = rowCount++;
|
||||||
}
|
}
|
||||||
|
@ -2228,7 +2228,9 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter.
|
||||||
if (hasUsername) {
|
if (hasUsername) {
|
||||||
usernameRow = rowCount++;
|
usernameRow = rowCount++;
|
||||||
}
|
}
|
||||||
sectionRow = rowCount++;
|
if (phoneRow != -1 || userInfoRow != -1 || userInfoDetailedRow != -1 || usernameRow != -1) {
|
||||||
|
sectionRow = rowCount++;
|
||||||
|
}
|
||||||
if (user_id != UserConfig.getClientUserId()) {
|
if (user_id != UserConfig.getClientUserId()) {
|
||||||
settingsNotificationsRow = rowCount++;
|
settingsNotificationsRow = rowCount++;
|
||||||
}
|
}
|
||||||
|
@ -2721,7 +2723,7 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter.
|
||||||
} else if (i == usernameRow) {
|
} else if (i == usernameRow) {
|
||||||
String text;
|
String text;
|
||||||
final TLRPC.User user = MessagesController.getInstance().getUser(user_id);
|
final TLRPC.User user = MessagesController.getInstance().getUser(user_id);
|
||||||
if (user != null && user.username != null && user.username.length() != 0) {
|
if (user != null && !TextUtils.isEmpty(user.username)) {
|
||||||
text = "@" + user.username;
|
text = "@" + user.username;
|
||||||
} else {
|
} else {
|
||||||
text = "-";
|
text = "-";
|
||||||
|
@ -2741,9 +2743,8 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter.
|
||||||
textDetailCell.setTextAndValue(text, MessagesController.getInstance().linkPrefix + "/" + currentChat.username);
|
textDetailCell.setTextAndValue(text, MessagesController.getInstance().linkPrefix + "/" + currentChat.username);
|
||||||
} else if (i == userInfoDetailedRow) {
|
} else if (i == userInfoDetailedRow) {
|
||||||
TLRPC.TL_userFull userFull = MessagesController.getInstance().getUserFull(user_id);
|
TLRPC.TL_userFull userFull = MessagesController.getInstance().getUserFull(user_id);
|
||||||
String about = userFull != null ? userFull.about : null;
|
|
||||||
textDetailCell.setMultiline(true);
|
textDetailCell.setMultiline(true);
|
||||||
textDetailCell.setTextAndValueAndIcon(about, LocaleController.getString("UserBio", R.string.UserBio), R.drawable.profile_info, 11);
|
textDetailCell.setTextAndValueAndIcon(userFull != null ? userFull.about : null, LocaleController.getString("UserBio", R.string.UserBio), R.drawable.profile_info, 11);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
|
@ -2903,8 +2904,7 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter.
|
||||||
AboutLinkCell aboutLinkCell = (AboutLinkCell) holder.itemView;
|
AboutLinkCell aboutLinkCell = (AboutLinkCell) holder.itemView;
|
||||||
if (i == userInfoRow) {
|
if (i == userInfoRow) {
|
||||||
TLRPC.TL_userFull userFull = MessagesController.getInstance().getUserFull(user_id);
|
TLRPC.TL_userFull userFull = MessagesController.getInstance().getUserFull(user_id);
|
||||||
String about = userFull != null ? userFull.about : null;
|
aboutLinkCell.setTextAndIcon(userFull != null ? userFull.about : null, R.drawable.profile_info, false);
|
||||||
aboutLinkCell.setTextAndIcon(about, R.drawable.profile_info, false);
|
|
||||||
} else if (i == channelInfoRow) {
|
} else if (i == channelInfoRow) {
|
||||||
String text = info.about;
|
String text = info.about;
|
||||||
while (text.contains("\n\n\n")) {
|
while (text.contains("\n\n\n")) {
|
||||||
|
|
Loading…
Reference in a new issue