Update to 5.13.0 (1820)

Merged some parts of https://github.com/DrKLO/Telegram/pull/1541
This commit is contained in:
DrKLO 2020-01-01 21:32:12 +03:00
parent cc1dc35742
commit 1eea3ab6f7
25 changed files with 206 additions and 105 deletions

View file

@ -57,6 +57,9 @@ void reuse(JNIEnv *env, jclass c, jlong address) {
jobject getJavaByteBuffer(JNIEnv *env, jclass c, jlong address) {
NativeByteBuffer *buffer = (NativeByteBuffer *) (intptr_t) address;
if (buffer == nullptr) {
return nullptr;
}
return buffer->getJavaByteBuffer();
}

View file

@ -2018,9 +2018,8 @@ void ConnectionsManager::requestSaltsForDatacenter(Datacenter *datacenter, bool
if (iter != requestingSaltsForDc.end()) {
requestingSaltsForDc.erase(iter);
}
if (error == nullptr) {
TL_future_salts *res = (TL_future_salts *) response;
datacenter->mergeServerSalts(res->salts, media);
if (response != nullptr) {
datacenter->mergeServerSalts((TL_future_salts *) response, media);
saveConfig();
}
}, nullptr, RequestFlagWithoutLogin | RequestFlagEnableUnauthorized | RequestFlagUseUnboundKey, datacenter->getDatacenterId(), connectionType, true);

View file

@ -681,8 +681,8 @@ int64_t Datacenter::getServerSalt(bool media) {
return result;
}
void Datacenter::mergeServerSalts(std::vector<std::unique_ptr<TL_future_salt>> &newSalts, bool media) {
if (newSalts.empty()) {
void Datacenter::mergeServerSalts(TL_future_salts *futureSalts, bool media) {
if (futureSalts->salts.empty()) {
return;
}
std::vector<std::unique_ptr<TL_future_salt>> &salts = media ? mediaServerSalts : serverSalts;
@ -694,11 +694,11 @@ void Datacenter::mergeServerSalts(std::vector<std::unique_ptr<TL_future_salt>> &
existingSalts.push_back(salts[a]->salt);
}
bool added = false;
size = newSalts.size();
size = futureSalts->salts.size();
for (uint32_t a = 0; a < size; a++) {
int64_t value = newSalts[a]->salt;
if (std::find(existingSalts.begin(), existingSalts.end(), value) == existingSalts.end() && newSalts[a]->valid_until > date) {
salts.push_back(std::unique_ptr<TL_future_salt>(std::move(newSalts[a])));
int64_t value = futureSalts->salts[a]->salt;
if (std::find(existingSalts.begin(), existingSalts.end(), value) == existingSalts.end() && futureSalts->salts[a]->valid_until > date) {
salts.push_back(std::unique_ptr<TL_future_salt>(std::move(futureSalts->salts[a])));
added = true;
}
}

View file

@ -18,6 +18,7 @@ class TL_future_salt;
class Connection;
class NativeByteBuffer;
class TL_future_salt;
class TL_future_salts;
class TL_help_configSimple;
class ByteArray;
class TLObject;
@ -41,7 +42,7 @@ public:
void clearAuthKey(HandshakeType type);
void clearServerSalts(bool media);
int64_t getServerSalt(bool media);
void mergeServerSalts(std::vector<std::unique_ptr<TL_future_salt>> &newSalts, bool media);
void mergeServerSalts(TL_future_salts *newSalts, bool media);
void addServerSalt(std::unique_ptr<TL_future_salt> &serverSalt, bool media);
bool containsServerSalt(int64_t value, bool media);
void suspendConnections(bool suspendPush);

View file

@ -19,7 +19,7 @@ public class BuildVars {
public static boolean USE_CLOUD_STRINGS = true;
public static boolean CHECK_UPDATES = true;
public static boolean TON_WALLET_STANDALONE = false;
public static int BUILD_VERSION = 1819;
public static int BUILD_VERSION = 1820;
public static String BUILD_VERSION_STRING = "5.13.0";
public static int APP_ID = 4;
public static String APP_HASH = "014b35b6184100b085b0d0572f9b5103";

View file

@ -1601,7 +1601,7 @@ public class FileLoadOperation {
}
protected void startDownloadRequest() {
if (paused ||
if (paused || reuploadingCdn ||
state != stateDownloading ||
streamPriorityStartOffset == 0 && (
!nextPartWasPreloaded && (requestInfos.size() + delayedRequestInfos.size() >= currentMaxDownloadRequests) ||

View file

@ -300,6 +300,12 @@ public class MediaController implements AudioManager.OnAudioFocusChangeListener,
}
}
AudioManager.OnAudioFocusChangeListener audioRecordFocusChangedListener = focusChange -> {
if (focusChange != AudioManager.AUDIOFOCUS_GAIN) {
hasRecordAudioFocus = false;
}
};
public final static int VIDEO_BITRATE_1080 = 6800_000;
public final static int VIDEO_BITRATE_720 = 2621_440;
public final static int VIDEO_BITRATE_480 = 1000_000;
@ -340,6 +346,7 @@ public class MediaController implements AudioManager.OnAudioFocusChangeListener,
private float[] linearAcceleration = new float[3];
private int hasAudioFocus;
private boolean hasRecordAudioFocus;
private boolean callInProgress;
private int audioFocus = AUDIO_NO_FOCUS_NO_DUCK;
private boolean resumeAudioOnFocusGain;
@ -350,7 +357,19 @@ public class MediaController implements AudioManager.OnAudioFocusChangeListener,
private static final int AUDIO_NO_FOCUS_CAN_DUCK = 1;
private static final int AUDIO_FOCUSED = 2;
private ArrayList<MessageObject> videoConvertQueue = new ArrayList<>();
private class VideoConvertMessage {
public MessageObject messageObject;
public VideoEditedInfo videoEditedInfo;
public int currentAccount;
public VideoConvertMessage(MessageObject object, VideoEditedInfo info) {
messageObject = object;
currentAccount = messageObject.currentAccount;
videoEditedInfo = info;
}
}
private ArrayList<VideoConvertMessage> videoConvertQueue = new ArrayList<>();
private final Object videoQueueSync = new Object();
private HashMap<String, MessageObject> generatingWaveform = new HashMap<>();
@ -2821,7 +2840,13 @@ public class MediaController implements AudioManager.OnAudioFocusChangeListener,
boolean paused = false;
if (playingMessageObject != null && isPlayingMessage(playingMessageObject) && !isMessagePaused()) {
paused = true;
pauseMessage(playingMessageObject);
}
if (!hasRecordAudioFocus) {
int result = NotificationsController.audioManager.requestAudioFocus(audioRecordFocusChangedListener, AudioManager.STREAM_MUSIC, AudioManager.AUDIOFOCUS_GAIN_TRANSIENT);
if (result == AudioManager.AUDIOFOCUS_REQUEST_GRANTED) {
hasRecordAudioFocus = true;
}
}
try {
@ -2960,12 +2985,20 @@ public class MediaController implements AudioManager.OnAudioFocusChangeListener,
NotificationCenter.getInstance(recordingCurrentAccount).postNotificationName(NotificationCenter.audioRecordTooShort, recordingGuid, false);
recordingAudioFileToSend.delete();
}
if (hasRecordAudioFocus) {
NotificationsController.audioManager.abandonAudioFocus(audioRecordFocusChangedListener);
hasRecordAudioFocus = false;
}
});
});
} else {
if (recordingAudioFile != null) {
recordingAudioFile.delete();
}
if (hasRecordAudioFocus) {
NotificationsController.audioManager.abandonAudioFocus(audioRecordFocusChangedListener);
hasRecordAudioFocus = false;
}
}
try {
if (audioRecorder != null) {
@ -3490,7 +3523,7 @@ public class MediaController implements AudioManager.OnAudioFocusChangeListener,
} else if (isEmpty) {
new File(messageObject.messageOwner.attachPath).delete();
}
videoConvertQueue.add(messageObject);
videoConvertQueue.add(new VideoConvertMessage(messageObject, messageObject.videoEditedInfo));
if (videoConvertQueue.size() == 1) {
startVideoConvertFromQueue();
}
@ -3501,11 +3534,12 @@ public class MediaController implements AudioManager.OnAudioFocusChangeListener,
if (messageObject != null) {
if (!videoConvertQueue.isEmpty()) {
for (int a = 0; a < videoConvertQueue.size(); a++) {
MessageObject object = videoConvertQueue.get(a);
if (object.getId() == messageObject.getId() && object.currentAccount == messageObject.currentAccount) {
VideoConvertMessage videoConvertMessage = videoConvertQueue.get(a);
MessageObject object = videoConvertMessage.messageObject;
if (object.equals(messageObject) && object.currentAccount == messageObject.currentAccount) {
if (a == 0) {
synchronized (videoConvertSync) {
messageObject.videoEditedInfo.canceled = true;
videoConvertMessage.videoEditedInfo.canceled = true;
}
} else {
videoConvertQueue.remove(a);
@ -3519,10 +3553,12 @@ public class MediaController implements AudioManager.OnAudioFocusChangeListener,
private boolean startVideoConvertFromQueue() {
if (!videoConvertQueue.isEmpty()) {
MessageObject messageObject = videoConvertQueue.get(0);
VideoConvertMessage videoConvertMessage = videoConvertQueue.get(0);
MessageObject messageObject = videoConvertMessage.messageObject;
VideoEditedInfo videoEditedInfo = videoConvertMessage.videoEditedInfo;
synchronized (videoConvertSync) {
if (messageObject != null && messageObject.videoEditedInfo != null) {
messageObject.videoEditedInfo.canceled = false;
if (videoEditedInfo != null) {
videoEditedInfo.canceled = false;
}
}
Intent intent = new Intent(ApplicationLoader.applicationContext, VideoEncodingService.class);
@ -3544,7 +3580,7 @@ public class MediaController implements AudioManager.OnAudioFocusChangeListener,
FileLog.e(e);
}
}
VideoConvertRunnable.runConversion(messageObject);
VideoConvertRunnable.runConversion(videoConvertMessage);
return true;
}
return false;
@ -3624,44 +3660,44 @@ public class MediaController implements AudioManager.OnAudioFocusChangeListener,
return -5;
}
private void didWriteData(final MessageObject messageObject, final File file, final boolean last, long availableSize, final boolean error, final float progress) {
final boolean firstWrite = messageObject.videoEditedInfo.videoConvertFirstWrite;
private void didWriteData(final VideoConvertMessage message, final File file, final boolean last, long availableSize, final boolean error, final float progress) {
final boolean firstWrite = message.videoEditedInfo.videoConvertFirstWrite;
if (firstWrite) {
messageObject.videoEditedInfo.videoConvertFirstWrite = false;
message.videoEditedInfo.videoConvertFirstWrite = false;
}
AndroidUtilities.runOnUIThread(() -> {
if (error || last) {
synchronized (videoConvertSync) {
messageObject.videoEditedInfo.canceled = false;
message.videoEditedInfo.canceled = false;
}
videoConvertQueue.remove(messageObject);
videoConvertQueue.remove(message);
startVideoConvertFromQueue();
}
if (error) {
NotificationCenter.getInstance(messageObject.currentAccount).postNotificationName(NotificationCenter.filePreparingFailed, messageObject, file.toString(), progress);
NotificationCenter.getInstance(message.currentAccount).postNotificationName(NotificationCenter.filePreparingFailed, message.messageObject, file.toString(), progress);
} else {
if (firstWrite) {
NotificationCenter.getInstance(messageObject.currentAccount).postNotificationName(NotificationCenter.filePreparingStarted, messageObject, file.toString(), progress);
NotificationCenter.getInstance(message.currentAccount).postNotificationName(NotificationCenter.filePreparingStarted, message.messageObject, file.toString(), progress);
}
NotificationCenter.getInstance(messageObject.currentAccount).postNotificationName(NotificationCenter.fileNewChunkAvailable, messageObject, file.toString(), availableSize, last ? file.length() : 0, progress);
NotificationCenter.getInstance(message.currentAccount).postNotificationName(NotificationCenter.fileNewChunkAvailable, message.messageObject, file.toString(), availableSize, last ? file.length() : 0, progress);
}
});
}
private static class VideoConvertRunnable implements Runnable {
private MessageObject messageObject;
private VideoConvertMessage convertMessage;
private VideoConvertRunnable(MessageObject message) {
messageObject = message;
private VideoConvertRunnable(VideoConvertMessage message) {
convertMessage = message;
}
@Override
public void run() {
MediaController.getInstance().convertVideo(messageObject);
MediaController.getInstance().convertVideo(convertMessage);
}
public static void runConversion(final MessageObject obj) {
public static void runConversion(final VideoConvertMessage obj) {
new Thread(() -> {
try {
VideoConvertRunnable wrapper = new VideoConvertRunnable(obj);
@ -3676,8 +3712,9 @@ public class MediaController implements AudioManager.OnAudioFocusChangeListener,
}
private boolean convertVideo(final MessageObject messageObject) {
VideoEditedInfo info = messageObject.videoEditedInfo;
private boolean convertVideo(final VideoConvertMessage convertMessage) {
MessageObject messageObject = convertMessage.messageObject;
VideoEditedInfo info = convertMessage.videoEditedInfo;
if (messageObject == null || info == null) {
return false;
}
@ -3767,7 +3804,7 @@ public class MediaController implements AudioManager.OnAudioFocusChangeListener,
}
lastAvailableSize = availableSize;
MediaController.this.didWriteData(messageObject, cacheFile, false, availableSize, false, progress);
MediaController.this.didWriteData(convertMessage, cacheFile, false, availableSize, false, progress);
}
};
@ -3795,7 +3832,7 @@ public class MediaController implements AudioManager.OnAudioFocusChangeListener,
}
preferences.edit().putBoolean("isPreviousOk", true).apply();
didWriteData(messageObject, cacheFile, true, cacheFile.length(), error || canceled, 1f);
didWriteData(convertMessage, cacheFile, true, cacheFile.length(), error || canceled, 1f);
return true;
}

View file

@ -1781,9 +1781,11 @@ public class MediaDataController extends BaseController {
searchResultMessagesMap[0].clear();
searchResultMessagesMap[1].clear();
messagesSearchCount[0] = 0;
getNotificationCenter().postNotificationName(NotificationCenter.chatSearchResultsLoading, guid);
}
boolean added = false;
for (int a = 0; a < Math.min(res.messages.size(), 20); a++) {
int N = Math.min(res.messages.size(), 20);
for (int a = 0; a < N; a++) {
TLRPC.Message message = res.messages.get(a);
added = true;
MessageObject messageObject = new MessageObject(currentAccount, message, false);

View file

@ -5520,7 +5520,7 @@ public class SendMessagesHelper extends BaseController implements NotificationCe
}
public static String getKeyForPhotoSize(TLRPC.PhotoSize photoSize, Bitmap[] bitmap, boolean blur, boolean forceCache) {
if (photoSize == null) {
if (photoSize == null || photoSize.location == null) {
return null;
}
Point point = ChatMessageCell.getMessageSize(photoSize.w, photoSize.h);

View file

@ -818,7 +818,7 @@ public class SharedConfig {
int androidVersion = Build.VERSION.SDK_INT;
int cpuCount = ConnectionsManager.CPU_COUNT;
int memoryClass = ((ActivityManager) ApplicationLoader.applicationContext.getSystemService(Context.ACTIVITY_SERVICE)).getMemoryClass();
if (androidVersion < 21 || cpuCount <= 2 || memoryClass <= 100 || cpuCount <= 4 && maxCpuFreq != -1 && maxCpuFreq <= 1250 || cpuCount <= 4 && maxCpuFreq <= 1600 && memoryClass <= 128 && androidVersion <= 21) {
if (androidVersion < 21 || cpuCount <= 2 || memoryClass <= 100 || cpuCount <= 4 && maxCpuFreq != -1 && maxCpuFreq <= 1250 || cpuCount <= 4 && maxCpuFreq <= 1600 && memoryClass <= 128 && androidVersion <= 21 || cpuCount <= 4 && maxCpuFreq <= 1300 && memoryClass <= 128 && androidVersion <= 24) {
devicePerformanceClass = PERFORMANCE_CLASS_LOW;
} else if (cpuCount < 8 || memoryClass <= 160 || maxCpuFreq != -1 && maxCpuFreq <= 1650 || maxCpuFreq == -1 && cpuCount == 8 && androidVersion <= 23) {
devicePerformanceClass = PERFORMANCE_CLASS_AVERAGE;

View file

@ -171,7 +171,6 @@ public class Theme {
if (gradientColor != 0 && (gradientShader == null || backgroundHeight != currentBackgroundHeight || currentColor != color || currentGradientColor != gradientColor)) {
gradientShader = new LinearGradient(0, 0, 0, backgroundHeight, new int[]{gradientColor, color}, null, Shader.TileMode.CLAMP);
paint.setShader(gradientShader);
currentBackgroundHeight = backgroundHeight;
currentColor = color;
currentGradientColor = gradientColor;
paint.setColor(0xffffffff);
@ -182,6 +181,7 @@ public class Theme {
}
paint.setColor(color);
}
currentBackgroundHeight = backgroundHeight;
topY = top;
}
@ -215,19 +215,33 @@ public class Theme {
}
} else {
path.reset();
if (topY + bounds.bottom - rad < currentBackgroundHeight) {
path.moveTo(bounds.right - dp(2.6f), bounds.bottom - padding);
path.lineTo(bounds.left + padding + rad, bounds.bottom - padding);
rect.set(bounds.left + padding, bounds.bottom - padding - rad * 2, bounds.left + padding + rad * 2, bounds.bottom - padding);
path.arcTo(rect, 90, 90, false);
} else {
path.moveTo(bounds.right - dp(8), bounds.top - topY + currentBackgroundHeight);
path.lineTo(bounds.left + padding, bounds.top - topY + currentBackgroundHeight);
}
if (topY + rad * 2 >= 0) {
path.lineTo(bounds.left + padding, bounds.top + padding + rad);
rect.set(bounds.left + padding, bounds.top + padding, bounds.left + padding + rad * 2, bounds.top + padding + rad * 2);
path.arcTo(rect, 180, 90, false);
path.lineTo(bounds.right - dp(8) - rad, bounds.top + padding);
rect.set(bounds.right - dp(8) - rad * 2, bounds.top + padding, bounds.right - dp(8), bounds.top + padding + rad * 2);
path.arcTo(rect, 270, 90, false);
} else {
path.lineTo(bounds.left + padding, bounds.top - topY);
path.lineTo(bounds.right - dp(8), bounds.top - topY);
}
if (topY + bounds.bottom - rad * 2 < currentBackgroundHeight) {
path.lineTo(bounds.right - dp(8), bounds.bottom - padding - rad - dp(1));
rect.set(bounds.right - dp(8), bounds.bottom - padding - rad * 2 - dp(9), bounds.right - dp(7) + rad * 2, bounds.bottom - padding - dp(1));
path.arcTo(rect, 180, -83, false);
} else {
path.lineTo(bounds.right - dp(8), bounds.top - topY + currentBackgroundHeight);
}
path.close();
canvas.drawPath(path, paint);
@ -3756,11 +3770,11 @@ public class Theme {
if (preferences.contains("overrideThemeWallpaper") || preferences.contains("selectedBackground2")) {
boolean override = preferences.getBoolean("overrideThemeWallpaper", false);
long id = preferences.getLong("selectedBackground2", 1000001);
if (id != -2 && (override || id != 1000001)) {
if (id == -1 || override && id != -2 && id != 1000001) {
OverrideWallpaperInfo overrideWallpaper = new OverrideWallpaperInfo();
overrideWallpaper.color = preferences.getInt("selectedColor", 0);
overrideWallpaper.slug = preferences.getString("selectedBackgroundSlug", "");
if (id >= -100 && id <= -1 && TextUtils.isEmpty(overrideWallpaper.slug)) {
if (id >= -100 && id <= -1 && overrideWallpaper.color != 0) {
overrideWallpaper.slug = COLOR_BACKGROUND_SLUG;
overrideWallpaper.fileName = "";
overrideWallpaper.originalFileName = "";

View file

@ -849,8 +849,10 @@ public class ChannelCreateActivity extends BaseFragment implements NotificationC
@Override
public void onActivityResultFragment(int requestCode, int resultCode, Intent data) {
if (imageUpdater != null) {
imageUpdater.onActivityResult(requestCode, resultCode, data);
}
}
@Override
public void saveSelfArgs(Bundle args) {

View file

@ -1520,6 +1520,9 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
}
searchItem.setVisibility(View.GONE);
getMediaDataController().clearFoundMessageObjects();
if (messagesSearchAdapter != null) {
messagesSearchAdapter.notifyDataSetChanged();
}
removeSelectedMessageHighlight();
updateBottomOverlay();
updatePinnedMessageView(true);
@ -6010,6 +6013,9 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
}
private void showTextSelectionHint(MessageObject messageObject) {
if (getParentActivity() == null) {
return;
}
CharSequence text;
boolean canShowText = false;
if (messageObject.textLayoutBlocks != null && !messageObject.textLayoutBlocks.isEmpty()) {
@ -11308,8 +11314,10 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
}
}
} else if (id == NotificationCenter.chatSearchResultsLoading) {
if (classGuid == (Integer) args[0] && searchItem != null) {
if (classGuid == (Integer) args[0]) {
if (searchItem != null) {
searchItem.setShowSearchProgress(true);
}
if (messagesSearchAdapter != null) {
messagesSearchAdapter.notifyDataSetChanged();
}

View file

@ -1732,7 +1732,12 @@ public class ChatActivityEnterView extends FrameLayout implements NotificationCe
sendButton.setBackgroundDrawable(Theme.createSelectorDrawable(Color.argb(24, Color.red(color), Color.green(color), Color.blue(color)), 1));
}
sendButtonContainer.addView(sendButton, LayoutHelper.createFrame(48, 48));
sendButton.setOnClickListener(view -> sendMessage());
sendButton.setOnClickListener(view -> {
if (sendPopupWindow != null && sendPopupWindow.isShowing()) {
return;
}
sendMessage();
});
sendButton.setOnLongClickListener(this::onSendLongClick);
slowModeButton = new SimpleTextView(context);

View file

@ -2269,6 +2269,7 @@ public class ChatAttachAlert extends BottomSheet implements NotificationCenter.N
zoomWas = true;
}
} else {
if (cameraView != null) {
float diff = (newDistance - pinchStartDistance) / AndroidUtilities.dp(100);
pinchStartDistance = newDistance;
cameraZoom += diff;
@ -2282,6 +2283,7 @@ public class ChatAttachAlert extends BottomSheet implements NotificationCenter.N
cameraView.setZoom(cameraZoom);
showZoomControls(true, true);
}
}
} else {
float newY = event.getY();
float dy = (newY - lastY);

View file

@ -17,10 +17,10 @@ import android.graphics.Canvas;
import android.graphics.Paint;
import android.graphics.Path;
import android.graphics.RectF;
import android.os.Bundle;
import android.view.MotionEvent;
import android.view.View;
import android.view.accessibility.AccessibilityNodeInfo;
import android.view.accessibility.AccessibilityEvent;
import android.view.accessibility.AccessibilityManager;
import org.telegram.messenger.AndroidUtilities;
import org.telegram.messenger.BuildVars;
@ -28,6 +28,8 @@ import org.telegram.messenger.FileLog;
import java.util.ArrayList;
import androidx.annotation.Keep;
public class CallSwipeView extends View {
private Paint arrowsPaint, pullBgPaint;
@ -48,6 +50,7 @@ public class CallSwipeView extends View {
}
private void init() {
setClickable(true);
arrowsPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
arrowsPaint.setColor(0xFFFFFFFF);
arrowsPaint.setStyle(Paint.Style.STROKE);
@ -131,8 +134,10 @@ public class CallSwipeView extends View {
@Override
public boolean onTouchEvent(MotionEvent ev) {
if (!isEnabled())
return false;
AccessibilityManager am = (AccessibilityManager) getContext().getSystemService(Context.ACCESSIBILITY_SERVICE);
if (!isEnabled() || am.isTouchExplorationEnabled()) {
return super.onTouchEvent(ev);
}
if (ev.getAction() == MotionEvent.ACTION_DOWN) {
if ((!dragFromRight && ev.getX() < getDraggedViewWidth()) || (dragFromRight && ev.getX() > getWidth() - getDraggedViewWidth())) {
dragging = true;
@ -163,8 +168,9 @@ public class CallSwipeView extends View {
}
public void startAnimatingArrows() {
if (animatingArrows || arrowAnim == null)
if (animatingArrows || arrowAnim == null) {
return;
}
animatingArrows = true;
if (arrowAnim != null) {
arrowAnim.start();
@ -227,17 +233,11 @@ public class CallSwipeView extends View {
}
@Override
public void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo info){
super.onInitializeAccessibilityNodeInfo(info);
info.addAction(AccessibilityNodeInfo.ACTION_CLICK);
}
@Override
public boolean performAccessibilityAction(int action, Bundle arguments){
if(action==AccessibilityNodeInfo.ACTION_CLICK && isEnabled()){
public void onPopulateAccessibilityEvent(AccessibilityEvent ev) {
if (isEnabled() && ev.getEventType() == AccessibilityEvent.TYPE_VIEW_CLICKED) {
listener.onDragComplete();
}
return super.performAccessibilityAction(action, arguments);
super.onPopulateAccessibilityEvent(ev);
}
public interface Listener {
@ -254,10 +254,12 @@ public class CallSwipeView extends View {
index = value;
}
@Keep
public int getArrowAlpha() {
return arrowAlphas[index];
}
@Keep
public void setArrowAlpha(int value) {
arrowAlphas[index] = value;
}

View file

@ -772,7 +772,7 @@ public class DataUsageActivity extends BaseFragment {
} else if (position == messagesBytesSentRow || position == photosBytesSentRow || position == videosBytesSentRow || position == audiosBytesSentRow || position == filesBytesSentRow || position == callsBytesSentRow || position == totalBytesSentRow) {
textCell.setTextAndValue(LocaleController.getString("BytesSent", R.string.BytesSent), AndroidUtilities.formatFileSize(StatsController.getInstance(currentAccount).getSentBytesCount(currentType, type)), true);
} else if (position == messagesBytesReceivedRow || position == photosBytesReceivedRow || position == videosBytesReceivedRow || position == audiosBytesReceivedRow || position == filesBytesReceivedRow || position == callsBytesReceivedRow || position == totalBytesReceivedRow) {
textCell.setTextAndValue(LocaleController.getString("BytesReceived", R.string.BytesReceived), AndroidUtilities.formatFileSize(StatsController.getInstance(currentAccount).getReceivedBytesCount(currentType, type)), position != totalBytesReceivedRow);
textCell.setTextAndValue(LocaleController.getString("BytesReceived", R.string.BytesReceived), AndroidUtilities.formatFileSize(StatsController.getInstance(currentAccount).getReceivedBytesCount(currentType, type)), position == callsBytesReceivedRow);
}
}
break;

View file

@ -2567,7 +2567,7 @@ public class LaunchActivity extends Activity implements ActionBarLayout.ActionBa
fragment = null;
}
if (contactsToSend != null && contactsToSend.size() == 1) {
if (contactsToSend != null && contactsToSend.size() == 1 && !mainFragmentsStack.isEmpty()) {
PhonebookShareAlert alert = new PhonebookShareAlert(mainFragmentsStack.get(mainFragmentsStack.size() - 1), null, null, contactsToSendUri, null, null);
alert.setDelegate((user, notify, scheduleDate) -> {
if (fragment != null) {

View file

@ -1261,13 +1261,13 @@ public class NotificationsCustomSettingsActivity extends BaseFragment {
value = preferences.getInt("priority_channel", 1);
}
if (value == 0) {
textCell.setTextAndValue(LocaleController.getString("NotificationsImportance", R.string.NotificationsImportance), LocaleController.getString("NotificationsPriorityHigh", R.string.NotificationsPriorityHigh), true);
textCell.setTextAndValue(LocaleController.getString("NotificationsImportance", R.string.NotificationsImportance), LocaleController.getString("NotificationsPriorityHigh", R.string.NotificationsPriorityHigh), false);
} else if (value == 1 || value == 2) {
textCell.setTextAndValue(LocaleController.getString("NotificationsImportance", R.string.NotificationsImportance), LocaleController.getString("NotificationsPriorityUrgent", R.string.NotificationsPriorityUrgent), true);
textCell.setTextAndValue(LocaleController.getString("NotificationsImportance", R.string.NotificationsImportance), LocaleController.getString("NotificationsPriorityUrgent", R.string.NotificationsPriorityUrgent), false);
} else if (value == 4) {
textCell.setTextAndValue(LocaleController.getString("NotificationsImportance", R.string.NotificationsImportance), LocaleController.getString("NotificationsPriorityLow", R.string.NotificationsPriorityLow), true);
textCell.setTextAndValue(LocaleController.getString("NotificationsImportance", R.string.NotificationsImportance), LocaleController.getString("NotificationsPriorityLow", R.string.NotificationsPriorityLow), false);
} else if (value == 5) {
textCell.setTextAndValue(LocaleController.getString("NotificationsImportance", R.string.NotificationsImportance), LocaleController.getString("NotificationsPriorityMedium", R.string.NotificationsPriorityMedium), true);
textCell.setTextAndValue(LocaleController.getString("NotificationsImportance", R.string.NotificationsImportance), LocaleController.getString("NotificationsPriorityMedium", R.string.NotificationsPriorityMedium), false);
}
} else if (position == messagePopupNotificationRow) {
int option;

View file

@ -7198,11 +7198,11 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat
final ViewGroup.LayoutParams layoutParams = animatingImageView.getLayoutParams();
layoutParams.width = (int) drawRegion.width();
layoutParams.height = (int) drawRegion.height();
if (layoutParams.width == 0) {
layoutParams.width = 1;
if (layoutParams.width <= 0) {
layoutParams.width = 100;
}
if (layoutParams.height == 0) {
layoutParams.height = 1;
if (layoutParams.height <= 0) {
layoutParams.height = 100;
}
for (int i = 0; i < animatingImageViews.length; i++) {
@ -7570,11 +7570,11 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat
animatingImageViews[i].setImageBitmap(centerImage.getBitmapSafe());
}
}
if (layoutParams.width == 0) {
layoutParams.width = 1;
if (layoutParams.width <= 0) {
layoutParams.width = 100;
}
if (layoutParams.height == 0) {
layoutParams.height = 1;
if (layoutParams.height <= 0) {
layoutParams.height = 100;
}
float scaleX = (float) windowView.getMeasuredWidth() / layoutParams.width;

View file

@ -2771,6 +2771,7 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter.
int voiceRowPrev = voiceRow;
int groupsInCommonRowPrev = groupsInCommonRow;
int sharedSectionRowPrev = sharedSectionRow;
int itemsCount = rowCount;
updateRowsIds();
if (sharedHeaderRowPrev == -1 && sharedHeaderRow != -1) {
int newRowsCount = 2;
@ -2839,6 +2840,27 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter.
} else if (groupsInCommonRowPrev != -1 && groupsInCommonRow == -1) {
listAdapter.notifyItemRemoved(groupsInCommonRowPrev);
}
} else if (sharedHeaderRowPrev != -1 && sharedHeaderRow == -1) {
int newRowsCountPrev = 2;
if (photosRowPrev != -1) {
newRowsCountPrev++;
}
if (filesRowPrev != -1) {
newRowsCountPrev++;
}
if (linksRowPrev != -1) {
newRowsCountPrev++;
}
if (audioRowPrev != -1) {
newRowsCountPrev++;
}
if (voiceRowPrev != -1) {
newRowsCountPrev++;
}
if (groupsInCommonRowPrev != -1) {
newRowsCountPrev++;
}
listAdapter.notifyItemRangeChanged(sharedHeaderRowPrev, newRowsCountPrev);
}
}

View file

@ -165,7 +165,7 @@ public class QuickRepliesSettingsActivity extends BaseFragment {
settingsKey = "quick_reply_msg4";
defValue = LocaleController.getString("QuickReplyDefault4", R.string.QuickReplyDefault4);
}
textCell.setTextAndHint(getParentActivity().getSharedPreferences("mainconfig", Context.MODE_PRIVATE).getString(settingsKey, ""), defValue, true);
textCell.setTextAndHint(getParentActivity().getSharedPreferences("mainconfig", Context.MODE_PRIVATE).getString(settingsKey, ""), defValue, position != reply4Row);
break;
}

View file

@ -76,7 +76,7 @@ class TextSelectionHint extends View {
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
if (getMeasuredWidth() != lastW) {
if (getMeasuredWidth() != lastW || textLayout == null) {
if (a != null) {
a.removeAllListeners();
a.cancel();
@ -144,6 +144,9 @@ class TextSelectionHint extends View {
@Override
protected void onDraw(Canvas canvas) {
if (textLayout == null) {
return;
}
super.onDraw(canvas);
canvas.save();

View file

@ -1732,7 +1732,7 @@ public class ThemeActivity extends BaseFragment implements NotificationCenter.No
} else if (position == nightScheduledRow) {
typeCell.setValue(LocaleController.getString("AutoNightScheduled", R.string.AutoNightScheduled), Theme.selectedAutoNightType == Theme.AUTO_NIGHT_TYPE_SCHEDULED, true);
} else if (position == nightAutomaticRow) {
typeCell.setValue(LocaleController.getString("AutoNightAdaptive", R.string.AutoNightAdaptive), Theme.selectedAutoNightType == Theme.AUTO_NIGHT_TYPE_AUTOMATIC, true);
typeCell.setValue(LocaleController.getString("AutoNightAdaptive", R.string.AutoNightAdaptive), Theme.selectedAutoNightType == Theme.AUTO_NIGHT_TYPE_AUTOMATIC, nightSystemDefaultRow != -1);
} else if (position == nightSystemDefaultRow) {
typeCell.setValue(LocaleController.getString("AutoNightSystemDefault", R.string.AutoNightSystemDefault), Theme.selectedAutoNightType == Theme.AUTO_NIGHT_TYPE_SYSTEM, false);
}

View file

@ -1245,6 +1245,7 @@ public class VoIPActivity extends Activity implements VoIPService.StateListener,
}
}, 200);
} else if (state == VoIPService.STATE_BUSY) {
endBtn.setContentDescription(LocaleController.getString("CallAgain", R.string.CallAgain));
//endBtn.setEnabled(false);
setStateTextAnimated(LocaleController.getString("VoipBusy", R.string.VoipBusy), false);
/*stateText.postDelayed(new Runnable() {