mirror of
https://github.com/DrKLO/Telegram.git
synced 2024-12-22 06:25:14 +01:00
update to 9.4.7
This commit is contained in:
parent
116092e32d
commit
7554c9b726
13 changed files with 91 additions and 38 deletions
|
@ -578,15 +578,23 @@ public class AndroidUtilities {
|
|||
return dir;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
ApplicationLoader.appCenterLog(e);
|
||||
|
||||
}
|
||||
try {
|
||||
File dir = new File(ApplicationLoader.applicationContext.getCacheDir() + "/logs");
|
||||
dir.mkdirs();
|
||||
return dir;
|
||||
} catch (Exception e) {
|
||||
ApplicationLoader.appCenterLog(e);
|
||||
|
||||
}
|
||||
try {
|
||||
File dir = new File(ApplicationLoader.applicationContext.getFilesDir() + "/logs");
|
||||
dir.mkdirs();
|
||||
return dir;
|
||||
} catch (Exception e) {
|
||||
|
||||
}
|
||||
ApplicationLoader.appCenterLog(new RuntimeException("can't create logs directory"));
|
||||
return null;
|
||||
}
|
||||
|
||||
|
@ -1949,7 +1957,11 @@ public class AndroidUtilities {
|
|||
try {
|
||||
File file = ApplicationLoader.applicationContext.getFilesDir();
|
||||
if (file != null) {
|
||||
return file;
|
||||
File cacheFile = new File(file, "cache/");
|
||||
cacheFile.mkdirs();
|
||||
if ((file.exists() || file.mkdirs()) && file.canWrite()) {
|
||||
return cacheFile;
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
|
||||
|
|
|
@ -24,8 +24,8 @@ public class BuildVars {
|
|||
public static boolean USE_CLOUD_STRINGS = true;
|
||||
public static boolean CHECK_UPDATES = true;
|
||||
public static boolean NO_SCOPED_STORAGE = Build.VERSION.SDK_INT <= 29;
|
||||
public static int BUILD_VERSION = 3155;
|
||||
public static String BUILD_VERSION_STRING = "9.4.6";
|
||||
public static int BUILD_VERSION = 3160;
|
||||
public static String BUILD_VERSION_STRING = "9.4.7";
|
||||
public static int APP_ID = 4;
|
||||
public static String APP_HASH = "014b35b6184100b085b0d0572f9b5103";
|
||||
|
||||
|
|
|
@ -33,6 +33,7 @@ import android.hardware.Sensor;
|
|||
import android.hardware.SensorEvent;
|
||||
import android.hardware.SensorEventListener;
|
||||
import android.hardware.SensorManager;
|
||||
import android.media.AudioDeviceInfo;
|
||||
import android.media.AudioFormat;
|
||||
import android.media.AudioManager;
|
||||
import android.media.AudioRecord;
|
||||
|
@ -52,6 +53,7 @@ import android.provider.OpenableColumns;
|
|||
import android.telephony.PhoneStateListener;
|
||||
import android.telephony.TelephonyManager;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
import android.util.SparseArray;
|
||||
import android.view.HapticFeedbackConstants;
|
||||
import android.view.TextureView;
|
||||
|
@ -60,6 +62,8 @@ import android.view.WindowManager;
|
|||
import android.webkit.MimeTypeMap;
|
||||
import android.widget.FrameLayout;
|
||||
|
||||
import androidx.annotation.RequiresApi;
|
||||
|
||||
import com.google.android.exoplayer2.C;
|
||||
import com.google.android.exoplayer2.ExoPlayer;
|
||||
import com.google.android.exoplayer2.ui.AspectRatioFrameLayout;
|
||||
|
@ -95,6 +99,7 @@ import java.nio.channels.FileChannel;
|
|||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Timer;
|
||||
import java.util.TimerTask;
|
||||
|
@ -1623,10 +1628,7 @@ public class MediaController implements AudioManager.OnAudioFocusChangeListener,
|
|||
if (raisedToBack == minCount || accelerometerVertical) {
|
||||
lastAccelerometerDetected = System.currentTimeMillis();
|
||||
}
|
||||
if (proximityTouched && (raisedToBack == minCount || accelerometerVertical || System.currentTimeMillis() - lastAccelerometerDetected < 60) && !NotificationsController.audioManager.isWiredHeadsetOn()) {
|
||||
if (BuildVars.LOGS_ENABLED) {
|
||||
FileLog.d("sensor values reached");
|
||||
}
|
||||
if (proximityTouched && (raisedToBack == minCount || accelerometerVertical || System.currentTimeMillis() - lastAccelerometerDetected < 60) && !NotificationsController.audioManager.isWiredHeadsetOn() && !VoIPService.isAnyKindOfCallActive()) {
|
||||
if (playingMessageObject == null && recordStartRunnable == null && recordingAudio == null && !PhotoViewer.getInstance().isVisible() && ApplicationLoader.isScreenOn && !inputFieldHasText && allowStartRecord && raiseChat != null && !callInProgress) {
|
||||
if (!raiseToEarRecord) {
|
||||
if (BuildVars.LOGS_ENABLED) {
|
||||
|
@ -1663,7 +1665,7 @@ public class MediaController implements AudioManager.OnAudioFocusChangeListener,
|
|||
raisedToTop = 0;
|
||||
raisedToTopSign = 0;
|
||||
countLess = 0;
|
||||
} else if (proximityTouched && ((accelerometerSensor == null || linearSensor == null) && gravitySensor == null)) {
|
||||
} else if (proximityTouched && ((accelerometerSensor == null || linearSensor == null) && gravitySensor == null) && !VoIPService.isAnyKindOfCallActive()) {
|
||||
if (playingMessageObject != null && !ApplicationLoader.mainInterfacePaused && (playingMessageObject.isVoice() || playingMessageObject.isRoundVideo())) {
|
||||
if (!useFrontSpeaker && !NotificationsController.audioManager.isWiredHeadsetOn()) {
|
||||
if (BuildVars.LOGS_ENABLED) {
|
||||
|
|
|
@ -1546,6 +1546,9 @@ public class ActionBarLayout extends FrameLayout implements INavigationLayout, F
|
|||
parent.removeView(fragmentView);
|
||||
}
|
||||
}
|
||||
if (!fragment.hasOwnBackground && fragmentView.getBackground() == null) {
|
||||
fragmentView.setBackgroundColor(Theme.getColor(Theme.key_windowBackgroundWhite));
|
||||
}
|
||||
containerView.addView(fragmentView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.MATCH_PARENT));
|
||||
if (fragment.actionBar != null && fragment.actionBar.shouldAddToContainer()) {
|
||||
if (removeActionBarExtraHeight) {
|
||||
|
|
|
@ -984,5 +984,10 @@ public class ReactionsLayoutInBubble {
|
|||
VisibleReaction that = (VisibleReaction) o;
|
||||
return documentId == that.documentId && Objects.equals(emojicon, that.emojicon);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(emojicon, documentId);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -977,7 +977,7 @@ public class ReactionsContainerLayout extends FrameLayout implements Notificatio
|
|||
allReactionsAvailable = true;
|
||||
fillRecentReactionsList(visibleReactions);
|
||||
}
|
||||
|
||||
filterReactions(visibleReactions);
|
||||
setVisibleReactionsList(visibleReactions);
|
||||
|
||||
if (message.messageOwner.reactions != null && message.messageOwner.reactions.results != null) {
|
||||
|
@ -989,6 +989,17 @@ public class ReactionsContainerLayout extends FrameLayout implements Notificatio
|
|||
}
|
||||
}
|
||||
|
||||
private void filterReactions(List<ReactionsLayoutInBubble.VisibleReaction> visibleReactions) {
|
||||
HashSet<ReactionsLayoutInBubble.VisibleReaction> set = new HashSet<>();
|
||||
for (int i = 0; i < visibleReactions.size(); i++) {
|
||||
if (set.contains(visibleReactions.get(i))) {
|
||||
i--;
|
||||
visibleReactions.remove(i);
|
||||
}
|
||||
set.add(visibleReactions.get(i));
|
||||
}
|
||||
}
|
||||
|
||||
private void fillRecentReactionsList(List<ReactionsLayoutInBubble.VisibleReaction> visibleReactions) {
|
||||
if (!allReactionsAvailable) {
|
||||
//fill default reactions
|
||||
|
|
|
@ -11,6 +11,7 @@ package org.telegram.ui.Components;
|
|||
import android.annotation.SuppressLint;
|
||||
import android.content.Context;
|
||||
import android.graphics.SurfaceTexture;
|
||||
import android.media.AudioManager;
|
||||
import android.net.Uri;
|
||||
import android.os.Handler;
|
||||
import android.os.Looper;
|
||||
|
@ -501,13 +502,13 @@ public class VideoPlayer implements Player.Listener, VideoListener, AnalyticsLis
|
|||
public void setStreamType(int type) {
|
||||
if (player != null) {
|
||||
player.setAudioAttributes(new AudioAttributes.Builder()
|
||||
.setContentType(type)
|
||||
.build(), false);
|
||||
.setUsage(type == AudioManager.STREAM_VOICE_CALL ? C.USAGE_VOICE_COMMUNICATION : C.USAGE_MEDIA)
|
||||
.build(), false);
|
||||
}
|
||||
if (audioPlayer != null) {
|
||||
audioPlayer.setAudioAttributes(new AudioAttributes.Builder()
|
||||
.setContentType(type)
|
||||
.build(), false);
|
||||
.setUsage(type == AudioManager.STREAM_VOICE_CALL ? C.USAGE_VOICE_COMMUNICATION : C.USAGE_MEDIA)
|
||||
.build(), true);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1077,7 +1077,7 @@ public class LaunchActivity extends BasePermissionsActivity implements INavigati
|
|||
}
|
||||
|
||||
private BaseFragment getClientNotActivatedFragment() {
|
||||
if (LoginActivity.loadCurrentState(false).getInt("currentViewNum", 0) != 0) {
|
||||
if (LoginActivity.loadCurrentState(false, currentAccount).getInt("currentViewNum", 0) != 0) {
|
||||
return new LoginActivity();
|
||||
}
|
||||
return new IntroActivity();
|
||||
|
@ -2977,7 +2977,9 @@ public class LaunchActivity extends BasePermissionsActivity implements INavigati
|
|||
}
|
||||
}
|
||||
}
|
||||
actionBarLayout.rebuildFragments(INavigationLayout.REBUILD_FLAG_REBUILD_LAST);
|
||||
if (SharedConfig.useLNavigation) {
|
||||
actionBarLayout.rebuildFragments(INavigationLayout.REBUILD_FLAG_REBUILD_LAST);
|
||||
}
|
||||
if (AndroidUtilities.isTablet()) {
|
||||
layersActionBarLayout.rebuildFragments(INavigationLayout.REBUILD_FLAG_REBUILD_LAST);
|
||||
rightActionBarLayout.rebuildFragments(INavigationLayout.REBUILD_FLAG_REBUILD_LAST);
|
||||
|
|
|
@ -589,7 +589,7 @@ public class LoginActivity extends BaseFragment {
|
|||
slideViewsContainer.addView(views[a], LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.MATCH_PARENT, Gravity.CENTER, AndroidUtilities.isTablet() ? 26 : 18, 30, AndroidUtilities.isTablet() ? 26 : 18, 0));
|
||||
}
|
||||
|
||||
Bundle savedInstanceState = activityMode == MODE_LOGIN ? loadCurrentState(newAccount) : null;
|
||||
Bundle savedInstanceState = activityMode == MODE_LOGIN ? loadCurrentState(newAccount, currentAccount) : null;
|
||||
if (savedInstanceState != null) {
|
||||
currentViewNum = savedInstanceState.getInt("currentViewNum", 0);
|
||||
syncContacts = savedInstanceState.getInt("syncContacts", 1) == 1;
|
||||
|
@ -873,13 +873,10 @@ public class LoginActivity extends BaseFragment {
|
|||
}
|
||||
}
|
||||
|
||||
public static Bundle loadCurrentState(boolean newAccount) {
|
||||
if (newAccount) {
|
||||
return null;
|
||||
}
|
||||
public static Bundle loadCurrentState(boolean newAccount, int currentAccount) {
|
||||
try {
|
||||
Bundle bundle = new Bundle();
|
||||
SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("logininfo2", Context.MODE_PRIVATE);
|
||||
SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("logininfo2" + (newAccount ? "_" + currentAccount : ""), Context.MODE_PRIVATE);
|
||||
Map<String, ?> params = preferences.getAll();
|
||||
for (Map.Entry<String, ?> entry : params.entrySet()) {
|
||||
String key = entry.getKey();
|
||||
|
@ -916,7 +913,7 @@ public class LoginActivity extends BaseFragment {
|
|||
}
|
||||
|
||||
private void clearCurrentState() {
|
||||
SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("logininfo2", Context.MODE_PRIVATE);
|
||||
SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("logininfo2" + (newAccount ? "_" + currentAccount : ""), Context.MODE_PRIVATE);
|
||||
SharedPreferences.Editor editor = preferences.edit();
|
||||
editor.clear();
|
||||
editor.commit();
|
||||
|
@ -1529,7 +1526,7 @@ public class LoginActivity extends BaseFragment {
|
|||
v.saveStateParams(bundle);
|
||||
}
|
||||
}
|
||||
SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("logininfo2", Context.MODE_PRIVATE);
|
||||
SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("logininfo2" + (newAccount ? "_" + currentAccount : ""), Context.MODE_PRIVATE);
|
||||
SharedPreferences.Editor editor = preferences.edit();
|
||||
editor.clear();
|
||||
putBundleToEditor(bundle, editor, null);
|
||||
|
@ -3475,7 +3472,10 @@ public class LoginActivity extends BaseFragment {
|
|||
timeText.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 15);
|
||||
timeText.setGravity(Gravity.TOP | Gravity.CENTER_HORIZONTAL);
|
||||
timeText.setOnClickListener(v-> {
|
||||
if (isRequestingFirebaseSms || isResendingCode) {
|
||||
// if (isRequestingFirebaseSms || isResendingCode) {
|
||||
// return;
|
||||
// }
|
||||
if (time > 0 && timeTimer != null) {
|
||||
return;
|
||||
}
|
||||
isResendingCode = true;
|
||||
|
@ -3994,9 +3994,11 @@ public class LoginActivity extends BaseFragment {
|
|||
if (currentType == AUTH_TYPE_MESSAGE) {
|
||||
setProblemTextVisible(true);
|
||||
timeText.setVisibility(GONE);
|
||||
problemText.setVisibility(VISIBLE);
|
||||
} else if (currentType == AUTH_TYPE_FLASH_CALL && (nextType == AUTH_TYPE_CALL || nextType == AUTH_TYPE_SMS)) {
|
||||
setProblemTextVisible(false);
|
||||
timeText.setVisibility(VISIBLE);
|
||||
problemText.setVisibility(GONE);
|
||||
if (nextType == AUTH_TYPE_CALL || nextType == AUTH_TYPE_MISSED_CALL) {
|
||||
timeText.setText(LocaleController.formatString("CallAvailableIn", R.string.CallAvailableIn, 1, 0));
|
||||
} else if (nextType == AUTH_TYPE_SMS) {
|
||||
|
@ -4014,6 +4016,7 @@ public class LoginActivity extends BaseFragment {
|
|||
timeText.setText(LocaleController.formatString("CallAvailableIn", R.string.CallAvailableIn, 2, 0));
|
||||
setProblemTextVisible(time < 1000);
|
||||
timeText.setVisibility(time < 1000 ? GONE : VISIBLE);
|
||||
problemText.setVisibility(time < 1000 ? VISIBLE : GONE);
|
||||
|
||||
SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("mainconfig", Activity.MODE_PRIVATE);
|
||||
String hash = preferences.getString("sms_hash", null);
|
||||
|
@ -4036,9 +4039,11 @@ public class LoginActivity extends BaseFragment {
|
|||
timeText.setText(LocaleController.formatString("SmsAvailableIn", R.string.SmsAvailableIn, 2, 0));
|
||||
setProblemTextVisible(time < 1000);
|
||||
timeText.setVisibility(time < 1000 ? GONE : VISIBLE);
|
||||
problemText.setVisibility(time < 1000 ? VISIBLE : GONE);
|
||||
createTimer();
|
||||
} else {
|
||||
timeText.setVisibility(GONE);
|
||||
problemText.setVisibility(VISIBLE);
|
||||
setProblemTextVisible(false);
|
||||
createCodeTimer();
|
||||
}
|
||||
|
@ -4090,6 +4095,7 @@ public class LoginActivity extends BaseFragment {
|
|||
if (codeTime <= 1000) {
|
||||
setProblemTextVisible(true);
|
||||
timeText.setVisibility(GONE);
|
||||
problemText.setVisibility(VISIBLE);
|
||||
destroyCodeTimer();
|
||||
}
|
||||
});
|
||||
|
@ -5889,6 +5895,10 @@ public class LoginActivity extends BaseFragment {
|
|||
|
||||
showKeyboard(codeFieldContainer.codeField[0]);
|
||||
codeFieldContainer.requestFocus();
|
||||
|
||||
if (!restore && params.containsKey("nextType")) {
|
||||
AndroidUtilities.runOnUIThread(resendCodeTimeout, params.getInt("timeout"));
|
||||
}
|
||||
}
|
||||
|
||||
private void onPasscodeError(boolean clear) {
|
||||
|
@ -6141,8 +6151,6 @@ public class LoginActivity extends BaseFragment {
|
|||
codeFieldContainer.setText("");
|
||||
codeFieldContainer.codeField[0].requestFocus();
|
||||
}
|
||||
|
||||
AndroidUtilities.runOnUIThread(resendCodeTimeout, 60000);
|
||||
}, SHOW_DELAY);
|
||||
}
|
||||
|
||||
|
|
|
@ -1142,9 +1142,13 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter.
|
|||
} catch (Throwable e) {
|
||||
FileLog.e(e);
|
||||
AndroidUtilities.runOnUIThread(() -> {
|
||||
RecyclerListView innerListView = sharedMediaLayout.getCurrentListView();
|
||||
if (innerListView != null && innerListView.getAdapter() != null) {
|
||||
innerListView.getAdapter().notifyDataSetChanged();
|
||||
try {
|
||||
RecyclerListView innerListView = sharedMediaLayout.getCurrentListView();
|
||||
if (innerListView != null && innerListView.getAdapter() != null) {
|
||||
innerListView.getAdapter().notifyDataSetChanged();
|
||||
}
|
||||
} catch (Throwable e2) {
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
@ -18,7 +18,6 @@ import static org.webrtc.MediaCodecUtils.QCOM_PREFIX;
|
|||
|
||||
import android.media.MediaCodecInfo;
|
||||
import android.os.Build;
|
||||
import android.util.Log;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
|
@ -162,20 +161,24 @@ public class HardwareVideoEncoderFactory implements VideoEncoderFactory {
|
|||
private @Nullable MediaCodecInfo findCodecForType(VideoCodecMimeType type) {
|
||||
ArrayList<MediaCodecInfo> infos = MediaCodecUtils.getSortedCodecsList();
|
||||
int count = infos.size();
|
||||
MediaCodecInfo info2 = null;
|
||||
for (int i = 0; i < count; ++i) {
|
||||
MediaCodecInfo info = infos.get(i);
|
||||
if (info == null || !info.isEncoder()) {
|
||||
continue;
|
||||
}
|
||||
if (isSupportedCodec(info, type)) {
|
||||
if (isSupportedCodec(info, type, true)) {
|
||||
return info;
|
||||
}
|
||||
if (isSupportedCodec(info, type, false)) {
|
||||
info2 = info;
|
||||
}
|
||||
}
|
||||
return null; // No support for this type.
|
||||
return info2; // No support for this type.
|
||||
}
|
||||
|
||||
// Returns true if the given MediaCodecInfo indicates a supported encoder for the given type.
|
||||
private boolean isSupportedCodec(MediaCodecInfo info, VideoCodecMimeType type) {
|
||||
private boolean isSupportedCodec(MediaCodecInfo info, VideoCodecMimeType type, boolean isHardwareSupportedInSdk) {
|
||||
if (!MediaCodecUtils.codecSupportsType(info, type)) {
|
||||
return false;
|
||||
}
|
||||
|
@ -185,7 +188,7 @@ public class HardwareVideoEncoderFactory implements VideoEncoderFactory {
|
|||
== null) {
|
||||
return false;
|
||||
}
|
||||
return isHardwareSupportedInCurrentSdk(info, type) && isMediaCodecAllowed(info);
|
||||
return (!isHardwareSupportedInSdk || isHardwareSupportedInCurrentSdk(info, type)) && isMediaCodecAllowed(info);
|
||||
}
|
||||
|
||||
// Returns true if the given MediaCodecInfo indicates a hardware module that is supported on the
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<paths>
|
||||
<external-path name="media" path="."/>
|
||||
<files-path name="logs" path="/logs/"/>
|
||||
<files-path name="cache" path="/cache/"/>
|
||||
<root-path name="external_files" path="/storage/" />
|
||||
</paths>
|
|
@ -13,8 +13,8 @@
|
|||
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
|
||||
# org.gradle.parallel=true
|
||||
#Sat Mar 12 05:53:50 MSK 2016
|
||||
APP_VERSION_NAME=9.4.6
|
||||
APP_VERSION_CODE=3155
|
||||
APP_VERSION_NAME=9.4.7
|
||||
APP_VERSION_CODE=3160
|
||||
APP_PACKAGE=org.telegram.messenger
|
||||
RELEASE_KEY_PASSWORD=android
|
||||
RELEASE_KEY_ALIAS=androidkey
|
||||
|
|
Loading…
Reference in a new issue