Update to 7.9.1 (2387)

This commit is contained in:
DrKLO 2021-07-31 06:39:13 +07:00
parent 3e5d2ba92b
commit 24c6968b8a
23 changed files with 266 additions and 138 deletions

View file

@ -299,7 +299,7 @@ android {
}
}
defaultConfig.versionCode = 2384
defaultConfig.versionCode = 2387
applicationVariants.all { variant ->
variant.outputs.all { output ->
@ -318,7 +318,7 @@ android {
defaultConfig {
minSdkVersion 16
targetSdkVersion 29
versionName "7.9.0"
versionName "7.9.1"
vectorDrawables.generatedDensities = ['mdpi', 'hdpi', 'xhdpi', 'xxhdpi']

View file

@ -394,38 +394,40 @@ JNIEXPORT jlong JNICALL Java_org_telegram_messenger_voip_NativeInstance_makeGrou
});
},
.videoCapture = videoCapture,
.requestBroadcastPart = [](std::shared_ptr<PlatformContext> platformContext, int64_t timestamp, int64_t duration, std::function<void(BroadcastPart &&)> callback) -> std::shared_ptr<BroadcastPartTask> {
std::shared_ptr<BroadcastPartTask> task = std::make_shared<BroadcastPartTaskJava>(platformContext, callback, timestamp);
((AndroidContext *) platformContext.get())->streamTask = task;
tgvoip::jni::DoWithJNI([platformContext, timestamp, duration, task](JNIEnv *env) {
jobject globalRef = ((AndroidContext *) platformContext.get())->getJavaInstance();
env->CallVoidMethod(globalRef, env->GetMethodID(NativeInstanceClass, "onRequestBroadcastPart", "(JJ)V"), timestamp, duration);
});
return task;
},
.videoContentType = screencast ? VideoContentType::Screencast : VideoContentType::Generic,
.initialEnableNoiseSuppression = (bool) noiseSupression,
.requestMediaChannelDescriptions = [platformContext](std::vector<uint32_t> const &ssrcs, std::function<void(std::vector<MediaChannelDescription> &&)> callback) -> std::shared_ptr<RequestMediaChannelDescriptionTask> {
std::shared_ptr<RequestMediaChannelDescriptionTaskJava> task = std::make_shared<RequestMediaChannelDescriptionTaskJava>(platformContext, callback);
((AndroidContext *) platformContext.get())->descriptionTasks.push_back(task);
tgvoip::jni::DoWithJNI([platformContext, ssrcs, task](JNIEnv *env) {
unsigned int size = ssrcs.size();
jintArray intArray = env->NewIntArray(size);
jint intFill[size];
for (int a = 0; a < size; a++) {
intFill[a] = ssrcs[a];
}
env->SetIntArrayRegion(intArray, 0, size, intFill);
jobject globalRef = ((AndroidContext *) platformContext.get())->getJavaInstance();
env->CallVoidMethod(globalRef, env->GetMethodID(NativeInstanceClass, "onParticipantDescriptionsRequired", "(J[I)V"), (jlong) task.get(), intArray);
env->DeleteLocalRef(intArray);
});
return task;
},
.platformContext = platformContext
};
if (!screencast) {
descriptor.requestBroadcastPart = [](std::shared_ptr<PlatformContext> platformContext, int64_t timestamp, int64_t duration, std::function<void(BroadcastPart &&)> callback) -> std::shared_ptr<BroadcastPartTask> {
std::shared_ptr<BroadcastPartTask> task = std::make_shared<BroadcastPartTaskJava>(platformContext, callback, timestamp);
((AndroidContext *) platformContext.get())->streamTask = task;
tgvoip::jni::DoWithJNI([platformContext, timestamp, duration, task](JNIEnv *env) {
jobject globalRef = ((AndroidContext *) platformContext.get())->getJavaInstance();
env->CallVoidMethod(globalRef, env->GetMethodID(NativeInstanceClass, "onRequestBroadcastPart", "(JJ)V"), timestamp, duration);
});
return task;
};
descriptor.requestMediaChannelDescriptions = [platformContext](std::vector<uint32_t> const &ssrcs, std::function<void(std::vector<MediaChannelDescription> &&)> callback) -> std::shared_ptr<RequestMediaChannelDescriptionTask> {
std::shared_ptr<RequestMediaChannelDescriptionTaskJava> task = std::make_shared<RequestMediaChannelDescriptionTaskJava>(platformContext, callback);
((AndroidContext *) platformContext.get())->descriptionTasks.push_back(task);
tgvoip::jni::DoWithJNI([platformContext, ssrcs, task](JNIEnv *env) {
unsigned int size = ssrcs.size();
jintArray intArray = env->NewIntArray(size);
jint intFill[size];
for (int a = 0; a < size; a++) {
intFill[a] = ssrcs[a];
}
env->SetIntArrayRegion(intArray, 0, size, intFill);
jobject globalRef = ((AndroidContext *) platformContext.get())->getJavaInstance();
env->CallVoidMethod(globalRef, env->GetMethodID(NativeInstanceClass, "onParticipantDescriptionsRequired", "(J[I)V"), (jlong) task.get(), intArray);
env->DeleteLocalRef(intArray);
});
return task;
};
}
auto *holder = new InstanceHolder;
holder->groupNativeInstance = std::make_unique<GroupInstanceCustomImpl>(std::move(descriptor));

View file

@ -23,7 +23,6 @@ import android.content.Context;
import android.graphics.PointF;
import android.os.Parcel;
import android.os.Parcelable;
import android.util.AttributeSet;
import android.util.Log;
import android.view.View;
import android.view.ViewGroup;

View file

@ -59,7 +59,6 @@ import android.widget.LinearLayout;
import android.widget.OverScroller;
import org.telegram.messenger.AndroidUtilities;
import org.telegram.messenger.BuildConfig;
import org.telegram.messenger.BuildVars;
import org.telegram.messenger.FileLog;
@ -2776,7 +2775,7 @@ public class RecyclerView extends ViewGroup implements ScrollingView,
* same View may still get the focus as a result of that search.
*/
private boolean isPreferredNextFocus(View focused, View next, int direction) {
if (next == null || next == this) {
if (next == null || next == this || next == focused) {
return false;
}
// panic, result view is not a child anymore, maybe workaround b/37864393
@ -2826,9 +2825,9 @@ public class RecyclerView extends ViewGroup implements ScrollingView,
case View.FOCUS_DOWN:
return downness > 0;
case View.FOCUS_FORWARD:
return downness > 0 || (downness == 0 && rightness * rtl >= 0);
return downness > 0 || (downness == 0 && rightness * rtl > 0);
case View.FOCUS_BACKWARD:
return downness < 0 || (downness == 0 && rightness * rtl <= 0);
return downness < 0 || (downness == 0 && rightness * rtl < 0);
}
throw new IllegalArgumentException("Invalid direction: " + direction + exceptionLabel());
}
@ -5107,7 +5106,7 @@ public class RecyclerView extends ViewGroup implements ScrollingView,
// but some general-purpose code may choose to respond to changes this way.
final int scrollX = getScrollX();
final int scrollY = getScrollY();
onScrollChanged(scrollX, scrollY, scrollX, scrollY);
onScrollChanged(scrollX, scrollY, scrollX - hresult, scrollY - vresult);
// Pass the real deltas to onScrolled, the RecyclerView-specific method.
onScrolled(hresult, vresult);
@ -5327,7 +5326,7 @@ public class RecyclerView extends ViewGroup implements ScrollingView,
postOnAnimation();
if (mGapWorker != null) {
mGapWorker.postFromTraversal(RecyclerView.this, unconsumedX, unconsumedY);
mGapWorker.postFromTraversal(RecyclerView.this, consumedX, consumedY);
}
}
}

View file

@ -390,22 +390,6 @@ public class AndroidUtilities {
int end;
}
private static Boolean standaloneApp;
public static boolean isStandaloneApp() {
if (standaloneApp == null) {
standaloneApp = "org.telegram.messenger.web".equals(ApplicationLoader.applicationContext.getPackageName());
}
return standaloneApp;
}
private static Boolean betaApp;
public static boolean isBetaApp() {
if (betaApp == null) {
betaApp = "org.telegram.messenger.beta".equals(ApplicationLoader.applicationContext.getPackageName());
}
return betaApp;
}
private static String makeUrl(String url, String[] prefixes, Matcher matcher) {
boolean hasPrefix = false;
for (int i = 0; i < prefixes.length; i++) {
@ -1784,7 +1768,7 @@ public class AndroidUtilities {
public static boolean isTablet() {
if (isTablet == null) {
isTablet = ApplicationLoader.applicationContext.getResources().getBoolean(R.bool.isTablet);
isTablet = ApplicationLoader.applicationContext != null && ApplicationLoader.applicationContext.getResources().getBoolean(R.bool.isTablet);
}
return isTablet;
}

View file

@ -139,7 +139,7 @@ public class ApplicationLoader extends Application {
FileLog.d("screen state = " + isScreenOn);
}
} catch (Exception e) {
FileLog.e(e);
e.printStackTrace();
}
SharedConfig.loadConfig();

View file

@ -19,14 +19,14 @@ public class BuildVars {
public static boolean USE_CLOUD_STRINGS = true;
public static boolean CHECK_UPDATES = true;
public static boolean NO_SCOPED_STORAGE = true/* || Build.VERSION.SDK_INT <= 28*/;
public static int BUILD_VERSION = 2384;
public static String BUILD_VERSION_STRING = "7.9.0";
public static int BUILD_VERSION = 2387;
public static String BUILD_VERSION_STRING = "7.9.1";
public static int APP_ID = 4;
public static String APP_HASH = "014b35b6184100b085b0d0572f9b5103";
public static String APPCENTER_HASH = "a5b5c4f5-51da-dedc-9918-d9766a22ca7c";
public static String APPCENTER_HASH_DEBUG = "f9726602-67c9-48d2-b5d0-4761f1c1a8f3";
//
public static String SMS_HASH = AndroidUtilities.isStandaloneApp() ? "w0lkcmTZkKh" : (DEBUG_VERSION ? "O2P2z+/jBpJ" : "oLeq9AcOZkT");
public static String SMS_HASH = isStandaloneApp() ? "w0lkcmTZkKh" : (DEBUG_VERSION ? "O2P2z+/jBpJ" : "oLeq9AcOZkT");
public static String PLAYSTORE_APP_URL = "https://play.google.com/store/apps/details?id=org.telegram.messenger";
static {
@ -35,4 +35,20 @@ public class BuildVars {
LOGS_ENABLED = DEBUG_VERSION || sharedPreferences.getBoolean("logsEnabled", DEBUG_VERSION);
}
}
private static Boolean standaloneApp;
public static boolean isStandaloneApp() {
if (standaloneApp == null) {
standaloneApp = ApplicationLoader.applicationContext != null && "org.telegram.messenger.web".equals(ApplicationLoader.applicationContext.getPackageName());
}
return standaloneApp;
}
private static Boolean betaApp;
public static boolean isBetaApp() {
if (betaApp == null) {
betaApp = ApplicationLoader.applicationContext != null && "org.telegram.messenger.beta".equals(ApplicationLoader.applicationContext.getPackageName());
}
return betaApp;
}
}

View file

@ -288,7 +288,6 @@ public class Emoji {
@Override
public void setAlpha(int alpha) {
placeholderPaint.setAlpha(alpha);
paint.setAlpha(alpha);
}

View file

@ -14187,7 +14187,7 @@ public class MessagesController extends BaseController implements NotificationCe
}
for (int a = 0, N = reasons.size(); a < N; a++) {
TLRPC.TL_restrictionReason reason = reasons.get(a);
if ("all".equals(reason.platform) || !AndroidUtilities.isStandaloneApp() && !AndroidUtilities.isBetaApp() && "android".equals(reason.platform)) {
if ("all".equals(reason.platform) || !BuildVars.isStandaloneApp() && !BuildVars.isBetaApp() && "android".equals(reason.platform)) {
return reason.text;
}
}

View file

@ -421,7 +421,7 @@ public class SharedConfig {
}
public static boolean isAppUpdateAvailable() {
if (pendingAppUpdate == null || pendingAppUpdate.document == null || !AndroidUtilities.isStandaloneApp()) {
if (pendingAppUpdate == null || pendingAppUpdate.document == null || !BuildVars.isStandaloneApp()) {
return false;
}
int currentVersion;

View file

@ -2899,10 +2899,12 @@ public class VoIPService extends Service implements SensorEventListener, AudioMa
}
stopForeground(true);
stopRinging();
if (ApplicationLoader.mainInterfacePaused || !ApplicationLoader.isScreenOn) {
MessagesController.getInstance(currentAccount).ignoreSetOnline = false;
if (currentAccount >= 0) {
if (ApplicationLoader.mainInterfacePaused || !ApplicationLoader.isScreenOn) {
MessagesController.getInstance(currentAccount).ignoreSetOnline = false;
}
NotificationCenter.getInstance(currentAccount).removeObserver(this, NotificationCenter.appDidLogout);
}
NotificationCenter.getInstance(currentAccount).removeObserver(this, NotificationCenter.appDidLogout);
SensorManager sm = (SensorManager) getSystemService(SENSOR_SERVICE);
Sensor proximity = sm.getDefaultSensor(Sensor.TYPE_PROXIMITY);
if (proximity != null) {
@ -3006,15 +3008,17 @@ public class VoIPService extends Service implements SensorEventListener, AudioMa
}
}
ConnectionsManager.getInstance(currentAccount).setAppPaused(true, false);
VoIPHelper.lastCallTime = SystemClock.elapsedRealtime();
setSinks(null, null);
if (onDestroyRunnable != null) {
onDestroyRunnable.run();
}
if (ChatObject.isChannel(chat)) {
MessagesController.getInstance(currentAccount).startShortPoll(chat, classGuid, true);
if (currentAccount >= 0) {
ConnectionsManager.getInstance(currentAccount).setAppPaused(true, false);
if (ChatObject.isChannel(chat)) {
MessagesController.getInstance(currentAccount).startShortPoll(chat, classGuid, true);
}
}
}

View file

@ -1458,7 +1458,7 @@ public class ActionBar extends FrameLayout {
@Override
public Animator createAnimator(ViewGroup sceneRoot, TransitionValues startValues, TransitionValues endValues) {
if (startValues.view instanceof SimpleTextView) {
if (startValues != null && startValues.view instanceof SimpleTextView) {
AnimatorSet animatorSet = new AnimatorSet();
Animator animator = super.createAnimator(sceneRoot, startValues, endValues);
float s = (float) startValues.values.get("text_size") / (float) endValues.values.get("text_size");

View file

@ -229,7 +229,7 @@ public class ActionBarMenuItem extends FrameLayout {
toggleSubMenu();
return true;
}
} else if (popupWindow != null && popupWindow.isShowing()) {
} else if (showSubmenuByMove && popupWindow != null && popupWindow.isShowing()) {
getLocationOnScreen(location);
float x = event.getX() + location[0];
float y = event.getY() + location[1];
@ -245,14 +245,14 @@ public class ActionBarMenuItem extends FrameLayout {
if (!rect.contains((int) x, (int) y)) {
child.setPressed(false);
child.setSelected(false);
if (Build.VERSION.SDK_INT == 21) {
if (Build.VERSION.SDK_INT == 21 && child.getBackground() != null) {
child.getBackground().setVisible(false, false);
}
} else {
child.setPressed(true);
child.setSelected(true);
if (Build.VERSION.SDK_INT >= 21) {
if (Build.VERSION.SDK_INT == 21) {
if (Build.VERSION.SDK_INT == 21 && child.getBackground() != null) {
child.getBackground().setVisible(true, false);
}
child.drawableHotspotChanged(x, y - child.getTop());

View file

@ -7460,10 +7460,6 @@ public class Theme {
chat_statusRecordPaint.setStrokeCap(Paint.Cap.ROUND);
chat_actionTextPaint = new TextPaint(Paint.ANTI_ALIAS_FLAG);
chat_actionTextPaint.setTypeface(AndroidUtilities.getTypeface("fonts/rmedium.ttf"));
chat_actionBackgroundPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
chat_actionBackgroundSelectedPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
chat_actionBackgroundPaint2 = new Paint(Paint.ANTI_ALIAS_FLAG);
chat_actionBackgroundSelectedPaint2 = new Paint(Paint.ANTI_ALIAS_FLAG);
chat_actionBackgroundGradientDarkenPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
chat_actionBackgroundGradientDarkenPaint.setColor(0x2a000000);
chat_timeBackgroundPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
@ -7474,6 +7470,18 @@ public class Theme {
chat_radialProgressPausedPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
chat_radialProgressPausedSeekbarPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
}
if (chat_actionBackgroundPaint == null) {
chat_actionBackgroundPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
}
if (chat_actionBackgroundSelectedPaint == null) {
chat_actionBackgroundSelectedPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
}
if (chat_actionBackgroundPaint2 == null) {
chat_actionBackgroundPaint2 = new Paint(Paint.ANTI_ALIAS_FLAG);
}
if (chat_actionBackgroundSelectedPaint2 == null) {
chat_actionBackgroundSelectedPaint2 = new Paint(Paint.ANTI_ALIAS_FLAG);
}
}
public static void createChatResources(Context context, boolean fontsOnly) {
@ -8046,6 +8054,8 @@ public class Theme {
}
if (servicePressedColor == null) {
servicePressedColor = serviceSelectedMessageColor;
}
if (servicePressedColor2 == null) {
servicePressedColor2 = serviceSelectedMessage2Color;
}

View file

@ -29,16 +29,13 @@ import android.graphics.Path;
import android.graphics.PixelFormat;
import android.graphics.PorterDuff;
import android.graphics.PorterDuffColorFilter;
import android.graphics.RadialGradient;
import android.graphics.Rect;
import android.graphics.RectF;
import android.graphics.Shader;
import android.graphics.Typeface;
import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.Drawable;
import android.graphics.drawable.GradientDrawable;
import android.graphics.drawable.RippleDrawable;
import android.media.MediaPlayer;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
@ -71,8 +68,6 @@ import android.widget.Toast;
import androidx.core.graphics.ColorUtils;
import com.google.android.exoplayer2.util.Log;
import org.telegram.PhoneFormat.PhoneFormat;
import org.telegram.messenger.AndroidUtilities;
import org.telegram.messenger.ChatObject;
@ -119,7 +114,6 @@ import org.telegram.ui.Components.LinkPath;
import org.telegram.ui.Components.MediaActionDrawable;
import org.telegram.ui.Components.MessageBackgroundDrawable;
import org.telegram.ui.Components.MotionBackgroundDrawable;
import org.telegram.ui.Components.PlayPauseDrawable;
import org.telegram.ui.Components.Point;
import org.telegram.ui.Components.RLottieDrawable;
import org.telegram.ui.Components.RadialProgress2;
@ -139,7 +133,6 @@ import org.telegram.ui.Components.URLSpanNoUnderline;
import org.telegram.ui.Components.VideoForwardDrawable;
import org.telegram.ui.PhotoViewer;
import org.telegram.ui.PinchToZoomHelper;
import org.telegram.ui.RoundVideoProgressShadow;
import org.telegram.ui.SecretMediaViewer;
import java.io.File;
@ -8483,6 +8476,10 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
maxWidth = Math.min(AndroidUtilities.displaySize.x, AndroidUtilities.displaySize.y);
}
}
if (isPlayingRound) {
int backgroundWidthLocal = backgroundWidth - (AndroidUtilities.roundPlayingMessageSize - AndroidUtilities.roundMessageSize);
return maxWidth - backgroundWidthLocal - AndroidUtilities.dp(57);
}
return maxWidth - backgroundWidth - AndroidUtilities.dp(57);
}
if (currentMessagesGroup != null && !currentMessagesGroup.isDocuments) {
@ -10593,6 +10590,9 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
if (currentMessageObject.shouldDrawWithoutBackground()) {
if (currentMessageObject.isOutOwner()) {
replyStartX = AndroidUtilities.dp(23);
if (isPlayingRound) {
replyStartX -= (AndroidUtilities.roundPlayingMessageSize - AndroidUtilities.roundMessageSize);
}
} else if (currentMessageObject.type == MessageObject.TYPE_ROUND_VIDEO) {
replyStartX = backgroundDrawableLeft + backgroundDrawableRight + AndroidUtilities.dp(4);
} else {
@ -11076,7 +11076,11 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
replyStartX += currentMessagesGroup.transitionParams.offsetLeft;
}
if (transitionParams.animateBackgroundBoundsInner) {
replyStartX += transitionParams.deltaLeft;
if (isRoundVideo) {
replyStartX += transitionParams.deltaLeft + transitionParams.deltaRight;
} else {
replyStartX += transitionParams.deltaLeft;
}
}
if (currentMessageObject.shouldDrawWithoutBackground()) {
Theme.chat_replyLinePaint.setColor(Theme.getColor(Theme.key_chat_stickerReplyLine));
@ -13222,12 +13226,14 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
y1 = layoutHeight - AndroidUtilities.dp(6.3f - (drawPinnedBottom ? 2 : 0)) - timeLayout.getHeight();
}
Theme.chat_timePaint.setAlpha((int) (255 * timeAlpha));
canvas.save();
canvas.translate(x1, y1);
durationLayout.draw(canvas);
canvas.restore();
Theme.chat_timePaint.setAlpha(255);
if (durationLayout != null) {
Theme.chat_timePaint.setAlpha((int) (255 * timeAlpha));
canvas.save();
canvas.translate(x1, y1);
durationLayout.draw(canvas);
canvas.restore();
Theme.chat_timePaint.setAlpha(255);
}
}
}
@ -13570,6 +13576,7 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
private class MessageAccessibilityNodeProvider extends AccessibilityNodeProvider {
private final int LINK_IDS_START = 2000;
private final int LINK_CAPTION_IDS_START = 3000;
private final int BOT_BUTTONS_START = 1000;
private final int POLL_BUTTONS_START = 500;
private final int INSTANT_VIEW = 499;
@ -13583,17 +13590,24 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
@Override
public AccessibilityNodeInfo createAccessibilityNodeInfo(int virtualViewId) {
//FileLog.e("create node info "+virtualViewId);
int[] pos = {0, 0};
getLocationOnScreen(pos);
if (virtualViewId == HOST_VIEW_ID) {
AccessibilityNodeInfo info = AccessibilityNodeInfo.obtain(ChatMessageCell.this);
onInitializeAccessibilityNodeInfo(info);
StringBuilder sb = new StringBuilder();
if (isChat && currentUser!=null && !currentMessageObject.isOut()) {
if (isChat && currentUser != null && !currentMessageObject.isOut()) {
sb.append(UserObject.getUserName(currentUser));
sb.append('\n');
}
if (drawForwardedName) {
for (int a = 0; a < 2; a++) {
if (forwardedNameLayout[a] != null) {
sb.append(forwardedNameLayout[a].getText());
sb.append(a == 0 ? " " : "\n");
}
}
}
if (!TextUtils.isEmpty(currentMessageObject.messageText)) {
sb.append(currentMessageObject.messageText);
}
@ -13608,11 +13622,17 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
sb.append(", ");
sb.append(AndroidUtilities.formatFileSize(documentAttach.size));
}
if (documentAttachType == DOCUMENT_ATTACH_TYPE_VIDEO) {
sb.append(", ");
sb.append(LocaleController.formatDuration(currentMessageObject.getDuration()));
}
}
if (currentMessageObject.isMusic()) {
sb.append("\n");
sb.append(LocaleController.formatString("AccDescrMusicInfo", R.string.AccDescrMusicInfo, currentMessageObject.getMusicAuthor(), currentMessageObject.getMusicTitle()));
} else if (currentMessageObject.isVoice() || isRoundVideo){
sb.append(", ");
sb.append(LocaleController.formatDuration(currentMessageObject.getDuration()));
} else if (currentMessageObject.isVoice() || isRoundVideo) {
sb.append(", ");
sb.append(LocaleController.formatDuration(currentMessageObject.getDuration()));
if (currentMessageObject.isContentUnread()) {
@ -13720,7 +13740,7 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
info.addAction(AccessibilityNodeInfo.ACTION_LONG_CLICK);
}
if (currentMessageObject.isVoice() || currentMessageObject.isMusic() && MediaController.getInstance().isPlayingMessage(currentMessageObject)) {
if ((currentMessageObject.isVoice() || currentMessageObject.isMusic()) && MediaController.getInstance().isPlayingMessage(currentMessageObject)) {
seekBarAccessibilityDelegate.onInitializeAccessibilityNodeInfoInternal(info);
}
@ -13734,6 +13754,15 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
i++;
}
}
if (currentMessageObject.caption instanceof Spannable) {
Spannable buffer = (Spannable) currentMessageObject.caption;
CharacterStyle[] links = buffer.getSpans(0, buffer.length(), ClickableSpan.class);
i = 0;
for (CharacterStyle link : links) {
info.addChild(ChatMessageCell.this, LINK_CAPTION_IDS_START + i);
i++;
}
}
i = 0;
for (BotButton button : botButtons) {
info.addChild(ChatMessageCell.this, BOT_BUTTONS_START + i);
@ -13768,12 +13797,43 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
info.setSource(ChatMessageCell.this, virtualViewId);
info.setParent(ChatMessageCell.this);
info.setPackageName(getContext().getPackageName());
if (virtualViewId >= LINK_IDS_START) {
if (virtualViewId >= LINK_CAPTION_IDS_START) {
if (!(currentMessageObject.caption instanceof Spannable) || captionLayout == null) {
return null;
}
Spannable buffer = (Spannable) currentMessageObject.caption;
ClickableSpan link = getLinkById(virtualViewId, true);
if (link == null) {
return null;
}
int[] linkPos = getRealSpanStartAndEnd(buffer, link);
String content = buffer.subSequence(linkPos[0], linkPos[1]).toString();
info.setText(content);
int length = captionLayout.getText().length();
captionLayout.getSelectionPath(linkPos[0], linkPos[1], linkPath);
linkPath.computeBounds(rectF, true);
rect.set((int) rectF.left, (int) rectF.top, (int) rectF.right, (int) rectF.bottom);
rect.offset((int) captionX, (int) captionY);
info.setBoundsInParent(rect);
if (accessibilityVirtualViewBounds.get(virtualViewId) == null) {
accessibilityVirtualViewBounds.put(virtualViewId, new Rect(rect));
}
rect.offset(pos[0], pos[1]);
info.setBoundsInScreen(rect);
info.setClassName("android.widget.TextView");
info.setEnabled(true);
info.setClickable(true);
info.setLongClickable(true);
info.addAction(AccessibilityNodeInfo.ACTION_CLICK);
info.addAction(AccessibilityNodeInfo.ACTION_LONG_CLICK);
} else if (virtualViewId >= LINK_IDS_START) {
if (!(currentMessageObject.messageText instanceof Spannable)) {
return null;
}
Spannable buffer = (Spannable) currentMessageObject.messageText;
ClickableSpan link = getLinkById(virtualViewId);
ClickableSpan link = getLinkById(virtualViewId, false);
if (link == null) {
return null;
}
@ -13898,7 +13958,6 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
info.setContentDescription(LocaleController.getString("ShareFile", R.string.ShareFile));
}
info.addAction(AccessibilityNodeInfo.ACTION_CLICK);
// } else if (drawShareButton && x >= shareStartX && x <= shareStartX + AndroidUtilities.dp(40) && y >= shareStartY && y <= shareStartY + AndroidUtilities.dp(32)) {
rect.set((int) sideStartX, (int) sideStartY, (int) sideStartX + AndroidUtilities.dp(40), (int) sideStartY + AndroidUtilities.dp(32));
info.setBoundsInParent(rect);
if (accessibilityVirtualViewBounds.get(virtualViewId) == null || !accessibilityVirtualViewBounds.get(virtualViewId).equals(rect)) {
@ -13960,8 +14019,14 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
if (action == AccessibilityNodeInfo.ACTION_ACCESSIBILITY_FOCUS) {
sendAccessibilityEventForVirtualView(virtualViewId, AccessibilityEvent.TYPE_VIEW_ACCESSIBILITY_FOCUSED);
} else if (action == AccessibilityNodeInfo.ACTION_CLICK) {
if (virtualViewId >= LINK_IDS_START) {
ClickableSpan link = getLinkById(virtualViewId);
if (virtualViewId >= LINK_CAPTION_IDS_START) {
ClickableSpan link = getLinkById(virtualViewId, true);
if (link != null) {
delegate.didPressUrl(ChatMessageCell.this, link, false);
sendAccessibilityEventForVirtualView(virtualViewId, AccessibilityEvent.TYPE_VIEW_CLICKED);
}
} else if (virtualViewId >= LINK_IDS_START) {
ClickableSpan link = getLinkById(virtualViewId, false);
if (link != null) {
delegate.didPressUrl(ChatMessageCell.this, link, false);
sendAccessibilityEventForVirtualView(virtualViewId, AccessibilityEvent.TYPE_VIEW_CLICKED);
@ -14018,7 +14083,7 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
}
}
} else if (action == AccessibilityNodeInfo.ACTION_LONG_CLICK) {
ClickableSpan link = getLinkById(virtualViewId);
ClickableSpan link = getLinkById(virtualViewId, virtualViewId >= LINK_CAPTION_IDS_START);
if (link != null) {
delegate.didPressUrl(ChatMessageCell.this, link, true);
sendAccessibilityEventForVirtualView(virtualViewId, AccessibilityEvent.TYPE_VIEW_LONG_CLICKED);
@ -14028,17 +14093,30 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
return true;
}
private ClickableSpan getLinkById(int id) {
id -= LINK_IDS_START;
if (!(currentMessageObject.messageText instanceof Spannable)) {
return null;
private ClickableSpan getLinkById(int id, boolean caption) {
if (caption) {
id -= LINK_CAPTION_IDS_START;
if (!(currentMessageObject.caption instanceof Spannable)) {
return null;
}
Spannable buffer = (Spannable) currentMessageObject.caption;
ClickableSpan[] links = buffer.getSpans(0, buffer.length(), ClickableSpan.class);
if (links.length <= id) {
return null;
}
return links[id];
} else {
id -= LINK_IDS_START;
if (!(currentMessageObject.messageText instanceof Spannable)) {
return null;
}
Spannable buffer = (Spannable) currentMessageObject.messageText;
ClickableSpan[] links = buffer.getSpans(0, buffer.length(), ClickableSpan.class);
if (links.length <= id) {
return null;
}
return links[id];
}
Spannable buffer = (Spannable) currentMessageObject.messageText;
ClickableSpan[] links = buffer.getSpans(0, buffer.length(), ClickableSpan.class);
if (links.length <= id) {
return null;
}
return links[id];
}
}

View file

@ -2793,6 +2793,10 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
groupedBackgroundWasDraw = true;
}
if (cell != null && cell.getPhotoImage().isAnimationRunning()) {
invalidate();
}
float viewClipLeft = Math.max(chatListView.getLeft(), chatListView.getLeft() + child.getX());
float viewClipTop = Math.max(listTop, chatListView.getTop() + child.getY());
float viewClipRight = Math.min(chatListView.getRight(), chatListView.getLeft() + child.getX() + child.getMeasuredWidth());

View file

@ -1832,9 +1832,12 @@ public class ChatActivityEnterView extends FrameLayout implements NotificationCe
return false;
}
if (isPopupShowing() && event.getAction() == MotionEvent.ACTION_DOWN) {
boolean rez = false;
if (searchingType != 0) {
searchingType = 0;
emojiView.closeSearch(false);
requestFocus();
rez = true;
}
showPopup(AndroidUtilities.usingHardwareInput ? 0 : 2, 0);
if (stickersExpanded) {
@ -1847,7 +1850,7 @@ public class ChatActivityEnterView extends FrameLayout implements NotificationCe
} else {
openKeyboardInternal();
}
return false;
return rez;
}
try {
return super.onTouchEvent(event);
@ -4092,7 +4095,7 @@ public class ChatActivityEnterView extends FrameLayout implements NotificationCe
}
if (stickersExpanded) {
setStickersExpanded(false, true, false);
if (searchingType != 0) {
if (searchingType != 0 && emojiView != null) {
emojiView.closeSearch(false);
emojiView.hideSearchKeyboard();
}
@ -4165,6 +4168,20 @@ public class ChatActivityEnterView extends FrameLayout implements NotificationCe
}
return;
}
if (searchingType != 0) {
searchingType = 0;
emojiView.closeSearch(false);
if (stickersExpanded) {
setStickersExpanded(false, true, false);
waitingForKeyboardOpenAfterAnimation = true;
AndroidUtilities.runOnUIThread(() -> {
waitingForKeyboardOpenAfterAnimation = false;
openKeyboardInternal();
}, 200);
}
}
CharSequence[] message = new CharSequence[]{AndroidUtilities.getTrimmedString(messageEditText.getText())};
ArrayList<TLRPC.MessageEntity> entities = MediaDataController.getInstance(currentAccount).getEntities(message, supportsSendingNewEntities());
if (!TextUtils.equals(message[0], editingMessageObject.messageText) || entities != null && !entities.isEmpty() || entities == null && !editingMessageObject.messageOwner.entities.isEmpty() || editingMessageObject.messageOwner.media instanceof TLRPC.TL_messageMediaWebPage) {

View file

@ -220,6 +220,7 @@ public class InstantCameraView extends FrameLayout implements NotificationCenter
private int pointerId1, pointerId2;
private int textureViewSize;
private boolean isMessageTransition;
private boolean updateTextureViewSize;
@SuppressLint("ClickableViewAccessibility")
public InstantCameraView(Context context, ChatActivity parentFragment) {
@ -358,21 +359,24 @@ public class InstantCameraView extends FrameLayout implements NotificationCenter
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
int newSize;
if (MeasureSpec.getSize(heightMeasureSpec) > MeasureSpec.getSize(widthMeasureSpec)) {
newSize = AndroidUtilities.roundPlayingMessageSize;
} else {
newSize = AndroidUtilities.roundMessageSize;
}
if (newSize != textureViewSize) {
textureViewSize = newSize;
textureOverlayView.getLayoutParams().width = textureOverlayView.getLayoutParams().height = textureViewSize;
cameraContainer.getLayoutParams().width = cameraContainer.getLayoutParams().height = textureViewSize;
((LayoutParams) muteImageView.getLayoutParams()).topMargin = textureViewSize / 2 - AndroidUtilities.dp(24);
textureOverlayView.setRoundRadius(textureViewSize / 2);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
cameraContainer.invalidateOutline();
if (updateTextureViewSize) {
int newSize;
if (MeasureSpec.getSize(heightMeasureSpec) > MeasureSpec.getSize(widthMeasureSpec) * 1.3f) {
newSize = AndroidUtilities.roundPlayingMessageSize;
} else {
newSize = AndroidUtilities.roundMessageSize;
}
if (newSize != textureViewSize) {
textureViewSize = newSize;
textureOverlayView.getLayoutParams().width = textureOverlayView.getLayoutParams().height = textureViewSize;
cameraContainer.getLayoutParams().width = cameraContainer.getLayoutParams().height = textureViewSize;
((LayoutParams) muteImageView.getLayoutParams()).topMargin = textureViewSize / 2 - AndroidUtilities.dp(24);
textureOverlayView.setRoundRadius(textureViewSize / 2);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
cameraContainer.invalidateOutline();
}
}
updateTextureViewSize = false;
}
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
@ -597,6 +601,7 @@ public class InstantCameraView extends FrameLayout implements NotificationCenter
});
cameraContainer.addView(textureView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.MATCH_PARENT));
updateTextureViewSize = true;
setVisibility(VISIBLE);
startAnimation(true);

View file

@ -238,6 +238,7 @@ public class RecyclerAnimationScrollHelper {
}
}
recyclerView.setScrollEnabled(true);
recyclerView.setVerticalScrollBarEnabled(true);
if (BuildVars.DEBUG_VERSION) {

View file

@ -4138,7 +4138,9 @@ public class DialogsActivity extends BaseFragment implements NotificationCenter.
if (searchIsShowed) {
AndroidUtilities.requestAdjustResize(getParentActivity(), classGuid);
}
viewPages[0].dialogsAdapter.notifyDataSetChanged();
if (viewPages != null) {
viewPages[0].dialogsAdapter.notifyDataSetChanged();
}
}
@Override

View file

@ -1629,7 +1629,7 @@ public class LoginActivity extends BaseFragment {
return;
}
String phone = PhoneFormat.stripExceptNumbers("" + codeField.getText() + phoneField.getText());
boolean isTestBakcend = getConnectionsManager().isTestBackend();
boolean isTestBakcend = BuildVars.DEBUG_PRIVATE_VERSION && getConnectionsManager().isTestBackend();
if (isTestBakcend != testBackend) {
getConnectionsManager().switchBackend(false);
isTestBakcend = testBackend;

View file

@ -4763,7 +4763,7 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat
public void setVisibility(int visibility) {
super.setVisibility(visibility);
if (videoTimelineView != null && videoTimelineView.getVisibility() != GONE) {
showVideoTimeline(visibility == View.VISIBLE, false);
videoTimelineView.setVisibility(visibility == VISIBLE ? VISIBLE : INVISIBLE);
}
}
@ -4801,8 +4801,10 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat
videoTimelineView = new VideoTimelinePlayView(parentActivity) {
@Override
public void setTranslationY(float translationY) {
super.setTranslationY(translationY);
containerView.invalidate();
if (getTranslationY() != translationY) {
super.setTranslationY(translationY);
containerView.invalidate();
}
}
};
videoTimelineView.setDelegate(new VideoTimelinePlayView.VideoTimelineViewDelegate() {
@ -10485,6 +10487,8 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat
if (!animated) {
videoTimelineView.animate().setListener(null).cancel();
videoTimelineView.setVisibility(show ? View.VISIBLE : View.GONE);
videoTimelineView.setTranslationY(0);
videoTimelineView.setAlpha(pickerView.getAlpha());
} else {
if (show && videoTimelineView.getTag() == null) {
if (videoTimelineView.getVisibility() != View.VISIBLE) {

View file

@ -2676,7 +2676,7 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter.
LocaleController.getString("DebugMenuClearMediaCache", R.string.DebugMenuClearMediaCache),
LocaleController.getString("DebugMenuCallSettings", R.string.DebugMenuCallSettings),
null,
BuildVars.DEBUG_PRIVATE_VERSION || AndroidUtilities.isStandaloneApp() ? LocaleController.getString("DebugMenuCheckAppUpdate", R.string.DebugMenuCheckAppUpdate) : null,
BuildVars.DEBUG_PRIVATE_VERSION || BuildVars.isStandaloneApp() ? LocaleController.getString("DebugMenuCheckAppUpdate", R.string.DebugMenuCheckAppUpdate) : null,
LocaleController.getString("DebugMenuReadAllDialogs", R.string.DebugMenuReadAllDialogs),
SharedConfig.pauseMusicOnRecord ? LocaleController.getString("DebugMenuDisablePauseMusic", R.string.DebugMenuDisablePauseMusic) : LocaleController.getString("DebugMenuEnablePauseMusic", R.string.DebugMenuEnablePauseMusic),
BuildVars.DEBUG_VERSION && !AndroidUtilities.isTablet() && Build.VERSION.SDK_INT >= 23 ? (SharedConfig.smoothKeyboard ? LocaleController.getString("DebugMenuDisableSmoothKeyboard", R.string.DebugMenuDisableSmoothKeyboard) : LocaleController.getString("DebugMenuEnableSmoothKeyboard", R.string.DebugMenuEnableSmoothKeyboard)) : null,
@ -3012,6 +3012,7 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter.
timeItem = new ImageView(context);
timeItem.setPadding(AndroidUtilities.dp(10), AndroidUtilities.dp(10), AndroidUtilities.dp(5), AndroidUtilities.dp(5));
timeItem.setScaleType(ImageView.ScaleType.CENTER);
timeItem.setAlpha(0.0f);
timeItem.setImageDrawable(timerDrawable = new TimerDrawable(context));
frameLayout.addView(timeItem, LayoutHelper.createFrame(34, 34, Gravity.TOP | Gravity.LEFT));
updateTimeItem();
@ -5005,6 +5006,9 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter.
@Override
protected AnimatorSet onCustomTransitionAnimation(final boolean isOpen, final Runnable callback) {
if (playProfileAnimation != 0 && allowProfileAnimation && !isPulledDown) {
if (timeItem != null) {
timeItem.setAlpha(1.0f);
}
final AnimatorSet animatorSet = new AnimatorSet();
animatorSet.setDuration(playProfileAnimation == 2 ? 250 : 180);
listView.setLayerType(View.LAYER_TYPE_HARDWARE, null);
@ -5060,9 +5064,9 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter.
animators.add(ObjectAnimator.ofFloat(nameTextView[a], View.ALPHA, a == 0 ? 0.0f : 1.0f));
}
if (timeItem.getTag() != null) {
animators.add(ObjectAnimator.ofFloat(timeItem, View.ALPHA, 0.0f));
animators.add(ObjectAnimator.ofFloat(timeItem, View.SCALE_X, 0.0f));
animators.add(ObjectAnimator.ofFloat(timeItem, View.SCALE_Y, 0.0f));
animators.add(ObjectAnimator.ofFloat(timeItem, View.ALPHA, 1.0f, 0.0f));
animators.add(ObjectAnimator.ofFloat(timeItem, View.SCALE_X, 1.0f, 0.0f));
animators.add(ObjectAnimator.ofFloat(timeItem, View.SCALE_Y, 1.0f, 0.0f));
}
if (animatingItem != null) {
animatingItem.setAlpha(1.0f);
@ -5114,9 +5118,9 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter.
animators.add(ObjectAnimator.ofFloat(nameTextView[a], View.ALPHA, a == 0 ? 1.0f : 0.0f));
}
if (timeItem.getTag() != null) {
animators.add(ObjectAnimator.ofFloat(timeItem, View.ALPHA, 1.0f));
animators.add(ObjectAnimator.ofFloat(timeItem, View.SCALE_X, 1.0f));
animators.add(ObjectAnimator.ofFloat(timeItem, View.SCALE_Y, 1.0f));
animators.add(ObjectAnimator.ofFloat(timeItem, View.ALPHA, 0.0f, 1.0f));
animators.add(ObjectAnimator.ofFloat(timeItem, View.SCALE_X, 0.0f, 1.0f));
animators.add(ObjectAnimator.ofFloat(timeItem, View.SCALE_Y, 0.0f, 1.0f));
}
if (animatingItem != null) {
animatingItem.setAlpha(0.0f);
@ -6783,7 +6787,7 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter.
break;
case 0:
case 9:
if (AndroidUtilities.isStandaloneApp()) {
if (BuildVars.isStandaloneApp()) {
abi = "direct " + Build.CPU_ABI + " " + Build.CPU_ABI2;
} else {
abi = "universal " + Build.CPU_ABI + " " + Build.CPU_ABI2;