Skip to content

Commit

Permalink
update to 9.2.1
Browse files Browse the repository at this point in the history
  • Loading branch information
xaxtix committed Dec 7, 2022
1 parent b73fc8d commit 03e899e
Show file tree
Hide file tree
Showing 63 changed files with 881 additions and 304 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,7 @@ protected void animateRemoveImpl(final RecyclerView.ViewHolder holder) {
animation
.setDuration(getRemoveDuration())
.setStartDelay(getRemoveDelay())
.setInterpolator(getRemoveInterpolator())
.alpha(0)
.scaleX(1f - animateByScale(view))
.scaleY(1f - animateByScale(view))
Expand Down Expand Up @@ -283,29 +284,30 @@ public void animateAddImpl(final RecyclerView.ViewHolder holder) {
.scaleY(1f)
.setDuration(getAddDuration())
.setStartDelay(getAddDelay())
.setListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationStart(Animator animator) {
dispatchAddStarting(holder);
}
.setInterpolator(getAddInterpolator())
.setListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationStart(Animator animator) {
dispatchAddStarting(holder);
}

@Override
public void onAnimationCancel(Animator animator) {
view.setAlpha(1);
if (animateByScale(view) > 0) {
view.setScaleX(1f);
view.setScaleY(1f);
}
@Override
public void onAnimationCancel(Animator animator) {
view.setAlpha(1);
if (animateByScale(view) > 0) {
view.setScaleX(1f);
view.setScaleY(1f);
}
}

@Override
public void onAnimationEnd(Animator animator) {
animation.setListener(null);
dispatchAddFinished(holder);
mAddAnimations.remove(holder);
dispatchFinishedWhenDone();
}
}).start();
@Override
public void onAnimationEnd(Animator animator) {
animation.setListener(null);
dispatchAddFinished(holder);
mAddAnimations.remove(holder);
dispatchFinishedWhenDone();
}
}).start();
}

@Override
Expand Down Expand Up @@ -368,12 +370,13 @@ protected void animateMoveImpl(final RecyclerView.ViewHolder holder, MoveInfo mo
}
if (translationInterpolator != null) {
animation.setInterpolator(translationInterpolator);
} else {
animation.setInterpolator(getMoveInterpolator());
}
beforeAnimateMoveImpl(holder);
animation
.setDuration(getMoveDuration())
.setStartDelay(getMoveDelay())
.setInterpolator(getMoveInterpolator())
.setListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationStart(Animator animator) {
Expand Down Expand Up @@ -455,6 +458,7 @@ void animateChangeImpl(final ChangeInfo changeInfo) {
.scaleY(1f - animateByScale(view));
}
oldViewAnim
.setInterpolator(getChangeInterpolator())
.setListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationStart(Animator animator) {
Expand Down Expand Up @@ -484,6 +488,7 @@ public void onAnimationEnd(Animator animator) {
.translationX(0).translationY(0)
.setDuration(getChangeAddDuration())
.setStartDelay(getChangeDelay() + (getChangeDuration() - getChangeAddDuration()))
.setInterpolator(getChangeInterpolator())
.alpha(1);
if (animateByScale(newView) > 0) {
newViewAnimation.scaleX(1f).scaleY(1f);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12747,7 +12747,10 @@ public abstract static class ItemAnimator {
private long mChangeAddDuration = 250;
private long mChangeRemoveDuration = 250;

private TimeInterpolator mMoveInterpolator = null;
private TimeInterpolator mAddInterpolator;
private TimeInterpolator mMoveInterpolator;
private TimeInterpolator mRemoveInterpolator;
private TimeInterpolator mChangeInterpolator;

private long mAddDelay = 0;
private long mRemoveDelay = 0;
Expand Down Expand Up @@ -12902,10 +12905,29 @@ public void setMoveInterpolator(TimeInterpolator interpolator) {
mMoveInterpolator = interpolator;
}

public void setInterpolator(TimeInterpolator interpolator) {
mAddInterpolator = interpolator;
mMoveInterpolator = interpolator;
mRemoveInterpolator = interpolator;
mChangeInterpolator = interpolator;
}

public TimeInterpolator getAddInterpolator() {
return mAddInterpolator;
}

public TimeInterpolator getMoveInterpolator() {
return mMoveInterpolator;
}

public TimeInterpolator getRemoveInterpolator() {
return mRemoveInterpolator;
}

public TimeInterpolator getChangeInterpolator() {
return mChangeInterpolator;
}

/**
* Internal only:
* Sets the listener that must be called when the animator is finished
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 = 2956;
public static String BUILD_VERSION_STRING = "9.2.0";
public static int BUILD_VERSION = 2962;
public static String BUILD_VERSION_STRING = "9.2.1";
public static int APP_ID = 4;
public static String APP_HASH = "014b35b6184100b085b0d0572f9b5103";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ public class FileLoadOperation {
long streamOffset;

public static volatile DispatchQueue filesQueue = new DispatchQueue("writeFileQueue");
private boolean forceSmallChunk;

public void setStream(FileLoadOperationStream stream, boolean streamPriority, long streamOffset) {
this.stream = stream;
Expand All @@ -48,6 +49,7 @@ protected static class RequestInfo {
private TLRPC.TL_upload_file response;
private TLRPC.TL_upload_webFile responseWeb;
private TLRPC.TL_upload_cdnFile responseCdn;
private boolean forceSmallChunk;
}

public static class Range {
Expand Down Expand Up @@ -205,7 +207,7 @@ public interface FileLoadOperationDelegate {
}

private void updateParams() {
if (MessagesController.getInstance(currentAccount).getfileExperimentalParams) {
if (MessagesController.getInstance(currentAccount).getfileExperimentalParams && !forceSmallChunk) {
downloadChunkSizeBig = 1024 * 512;
maxDownloadRequests = 8;
maxDownloadRequestsBig = 8;
Expand Down Expand Up @@ -1756,7 +1758,14 @@ protected boolean processRequestResult(RequestInfo requestInfo, TLRPC.TL_error e
}
}
} else {
if (error.text.contains("FILE_MIGRATE_")) {
if (error.text.contains("LIMIT_INVALID") && !requestInfo.forceSmallChunk) {
if (!forceSmallChunk) {
forceSmallChunk = true;
currentDownloadChunkSize = 0;
pause();
start();
}
} else if (error.text.contains("FILE_MIGRATE_")) {
String errorMsg = error.text.replace("FILE_MIGRATE_", "");
Scanner scanner = new Scanner(errorMsg);
scanner.useDelimiter("");
Expand Down Expand Up @@ -1993,6 +2002,7 @@ protected void startDownloadRequest() {
final RequestInfo requestInfo = new RequestInfo();
requestInfos.add(requestInfo);
requestInfo.offset = downloadOffset;
requestInfo.forceSmallChunk = forceSmallChunk;

if (!isPreloadVideoOperation && supportsPreloading && preloadStream != null && preloadedBytesRanges != null) {
PreloadRange range = preloadedBytesRanges.get(requestInfo.offset);
Expand Down Expand Up @@ -2032,7 +2042,7 @@ protected void startDownloadRequest() {
continue;
}
}

requestInfo.forceSmallChunk = forceSmallChunk;
requestInfo.requestToken = ConnectionsManager.getInstance(currentAccount).sendRequest(request, (response, error) -> {
if (!requestInfos.contains(requestInfo)) {
return;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ public static void dumpResponseAndRequest(TLObject request, TLObject response, T
String requestSimpleName = request.getClass().getSimpleName();
checkGson();

if (excludeRequests.contains(requestSimpleName)) {
if (excludeRequests.contains(requestSimpleName) && error == null) {
return;
}
try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -478,12 +478,12 @@ public boolean isCurrentLocalLocale() {
return currentLocaleInfo.isLocal();
}

public void reloadCurrentRemoteLocale(int currentAccount, String langCode, boolean force) {
public void reloadCurrentRemoteLocale(int currentAccount, String langCode, boolean force, Runnable onDone) {
if (langCode != null) {
langCode = langCode.replace("-", "_");
}
if (langCode == null || currentLocaleInfo != null && (langCode.equals(currentLocaleInfo.shortName) || langCode.equals(currentLocaleInfo.baseLangCode))) {
applyRemoteLanguage(currentLocaleInfo, langCode, force, currentAccount);
applyRemoteLanguage(currentLocaleInfo, langCode, force, currentAccount, onDone);
}
}

Expand All @@ -493,11 +493,11 @@ public void checkUpdateForCurrentRemoteLocale(int currentAccount, int version, i
}
if (currentLocaleInfo.hasBaseLang()) {
if (currentLocaleInfo.baseVersion < baseVersion) {
applyRemoteLanguage(currentLocaleInfo, currentLocaleInfo.baseLangCode, false, currentAccount);
applyRemoteLanguage(currentLocaleInfo, currentLocaleInfo.baseLangCode, false, currentAccount, null);
}
}
if (currentLocaleInfo.version < version) {
applyRemoteLanguage(currentLocaleInfo, currentLocaleInfo.shortName, false, currentAccount);
applyRemoteLanguage(currentLocaleInfo, currentLocaleInfo.shortName, false, currentAccount, null);
}
}

Expand Down Expand Up @@ -654,7 +654,7 @@ public boolean applyLanguageFile(File file, int currentAccount) {
saveOtherLanguages();
}
localeValues = stringMap;
applyLanguage(localeInfo, true, false, true, false, currentAccount);
applyLanguage(localeInfo, true, false, true, false, currentAccount, null);
return true;
}
} catch (Exception e) {
Expand Down Expand Up @@ -848,14 +848,15 @@ private HashMap<String, String> getLocaleFileStrings(File file, boolean preserve
return new HashMap<>();
}

public void applyLanguage(LocaleInfo localeInfo, boolean override, boolean init, final int currentAccount) {
applyLanguage(localeInfo, override, init, false, false, currentAccount);
public int applyLanguage(LocaleInfo localeInfo, boolean override, boolean init, final int currentAccount) {
return applyLanguage(localeInfo, override, init, false, false, currentAccount, null);
}

public void applyLanguage(final LocaleInfo localeInfo, boolean override, boolean init, boolean fromFile, boolean force, final int currentAccount) {
public int applyLanguage(final LocaleInfo localeInfo, boolean override, boolean init, boolean fromFile, boolean force, final int currentAccount, Runnable onDone) {
if (localeInfo == null) {
return;
return 0;
}
int requestId = 0;
boolean hasBase = localeInfo.hasBaseLang();
File pathToFile = localeInfo.getPathToFile();
File pathToBaseFile = localeInfo.getPathToBaseFile();
Expand Down Expand Up @@ -884,9 +885,9 @@ public void applyLanguage(final LocaleInfo localeInfo, boolean override, boolean
}
isLoadingRemote = true;
if (init) {
AndroidUtilities.runOnUIThread(() -> applyRemoteLanguage(localeInfo, null, true, currentAccount));
AndroidUtilities.runOnUIThread(() -> applyRemoteLanguage(localeInfo, null, true, currentAccount, onDone));
} else {
applyRemoteLanguage(localeInfo, null, true, currentAccount);
requestId = applyRemoteLanguage(localeInfo, null, true, currentAccount, onDone);
}
}
try {
Expand Down Expand Up @@ -943,9 +944,9 @@ public void applyLanguage(final LocaleInfo localeInfo, boolean override, boolean
changingConfiguration = false;
if (reloadLastFile) {
if (init) {
AndroidUtilities.runOnUIThread(() -> reloadCurrentRemoteLocale(currentAccount, null, force));
AndroidUtilities.runOnUIThread(() -> reloadCurrentRemoteLocale(currentAccount, null, force, null));
} else {
reloadCurrentRemoteLocale(currentAccount, null, force);
reloadCurrentRemoteLocale(currentAccount, null, force, null);
}
reloadLastFile = false;
}
Expand All @@ -955,6 +956,9 @@ public void applyLanguage(final LocaleInfo localeInfo, boolean override, boolean
} else {
NotificationCenter.getGlobalInstance().postNotificationName(NotificationCenter.reloadInterface);
}
if (onDone != null) {
onDone.run();
}
}
} catch (Exception e) {
FileLog.e(e);
Expand All @@ -964,6 +968,7 @@ public void applyLanguage(final LocaleInfo localeInfo, boolean override, boolean
if (force) {
MediaDataController.getInstance(currentAccount).loadAttachMenuBots(false, true);
}
return requestId;
}

public LocaleInfo getCurrentLocaleInfo() {
Expand Down Expand Up @@ -2053,10 +2058,10 @@ public void saveRemoteLocaleStringsForCurrentLocale(final TLRPC.TL_langPackDiffe
if (!langCode.equals(currentLocaleInfo.shortName) && !langCode.equals(currentLocaleInfo.baseLangCode)) {
return;
}
saveRemoteLocaleStrings(currentLocaleInfo, difference, currentAccount);
saveRemoteLocaleStrings(currentLocaleInfo, difference, currentAccount, null);
}

public void saveRemoteLocaleStrings(LocaleInfo localeInfo, final TLRPC.TL_langPackDifference difference, int currentAccount) {
public void saveRemoteLocaleStrings(LocaleInfo localeInfo, final TLRPC.TL_langPackDifference difference, int currentAccount, Runnable onDone) {
if (difference == null || difference.strings.isEmpty() || localeInfo == null || localeInfo.isLocal()) {
return;
}
Expand Down Expand Up @@ -2171,6 +2176,9 @@ public void saveRemoteLocaleStrings(LocaleInfo localeInfo, final TLRPC.TL_langPa
}
recreateFormatters();
NotificationCenter.getGlobalInstance().postNotificationName(NotificationCenter.reloadInterface);
if (onDone != null) {
onDone.run();
}
});
} catch (Exception ignore) {

Expand Down Expand Up @@ -2256,9 +2264,9 @@ public void loadRemoteLanguages(final int currentAccount, boolean applyCurrent)
}, ConnectionsManager.RequestFlagWithoutLogin);
}

private void applyRemoteLanguage(LocaleInfo localeInfo, String langCode, boolean force, final int currentAccount) {
private int applyRemoteLanguage(LocaleInfo localeInfo, String langCode, boolean force, final int currentAccount, Runnable onDone) {
if (localeInfo == null || !localeInfo.isRemote() && !localeInfo.isUnofficial()) {
return;
return 0;
}
if (localeInfo.hasBaseLang() && (langCode == null || langCode.equals(localeInfo.baseLangCode))) {
if (localeInfo.baseVersion != 0 && !force) {
Expand All @@ -2267,18 +2275,18 @@ private void applyRemoteLanguage(LocaleInfo localeInfo, String langCode, boolean
req.from_version = localeInfo.baseVersion;
req.lang_code = localeInfo.getBaseLangCode();
req.lang_pack = "";
ConnectionsManager.getInstance(currentAccount).sendRequest(req, (response, error) -> {
return ConnectionsManager.getInstance(currentAccount).sendRequest(req, (response, error) -> {
if (response != null) {
AndroidUtilities.runOnUIThread(() -> saveRemoteLocaleStrings(localeInfo, (TLRPC.TL_langPackDifference) response, currentAccount));
AndroidUtilities.runOnUIThread(() -> saveRemoteLocaleStrings(localeInfo, (TLRPC.TL_langPackDifference) response, currentAccount, onDone));
}
}, ConnectionsManager.RequestFlagWithoutLogin);
}
} else {
TLRPC.TL_langpack_getLangPack req = new TLRPC.TL_langpack_getLangPack();
req.lang_code = localeInfo.getBaseLangCode();
ConnectionsManager.getInstance(currentAccount).sendRequest(req, (TLObject response, TLRPC.TL_error error) -> {
return ConnectionsManager.getInstance(currentAccount).sendRequest(req, (TLObject response, TLRPC.TL_error error) -> {
if (response != null) {
AndroidUtilities.runOnUIThread(() -> saveRemoteLocaleStrings(localeInfo, (TLRPC.TL_langPackDifference) response, currentAccount));
AndroidUtilities.runOnUIThread(() -> saveRemoteLocaleStrings(localeInfo, (TLRPC.TL_langPackDifference) response, currentAccount, onDone));
}
}, ConnectionsManager.RequestFlagWithoutLogin);
}
Expand All @@ -2289,9 +2297,9 @@ private void applyRemoteLanguage(LocaleInfo localeInfo, String langCode, boolean
req.from_version = localeInfo.version;
req.lang_code = localeInfo.getLangCode();
req.lang_pack = "";
ConnectionsManager.getInstance(currentAccount).sendRequest(req, (response, error) -> {
return ConnectionsManager.getInstance(currentAccount).sendRequest(req, (response, error) -> {
if (response != null) {
AndroidUtilities.runOnUIThread(() -> saveRemoteLocaleStrings(localeInfo, (TLRPC.TL_langPackDifference) response, currentAccount));
AndroidUtilities.runOnUIThread(() -> saveRemoteLocaleStrings(localeInfo, (TLRPC.TL_langPackDifference) response, currentAccount, onDone));
}
}, ConnectionsManager.RequestFlagWithoutLogin);
} else {
Expand All @@ -2300,13 +2308,14 @@ private void applyRemoteLanguage(LocaleInfo localeInfo, String langCode, boolean
}
TLRPC.TL_langpack_getLangPack req = new TLRPC.TL_langpack_getLangPack();
req.lang_code = localeInfo.getLangCode();
ConnectionsManager.getInstance(currentAccount).sendRequest(req, (TLObject response, TLRPC.TL_error error) -> {
return ConnectionsManager.getInstance(currentAccount).sendRequest(req, (TLObject response, TLRPC.TL_error error) -> {
if (response != null) {
AndroidUtilities.runOnUIThread(() -> saveRemoteLocaleStrings(localeInfo, (TLRPC.TL_langPackDifference) response, currentAccount));
AndroidUtilities.runOnUIThread(() -> saveRemoteLocaleStrings(localeInfo, (TLRPC.TL_langPackDifference) response, currentAccount, onDone));
}
}, ConnectionsManager.RequestFlagWithoutLogin);
}
}
return 0;
}

public String getTranslitString(String src) {
Expand Down
Loading

1 comment on commit 03e899e

@AlexandrKozlovskiy
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@xaxtix Please not ignore pr #1713.

Please sign in to comment.