update to 9.4.2

This commit is contained in:
xaxtix 2023-02-06 15:08:24 +04:00
parent fb2d9f90bc
commit c48aa4f3c9
51 changed files with 368 additions and 477 deletions

View file

@ -24,8 +24,8 @@ public class BuildVars {
public static boolean USE_CLOUD_STRINGS = true; public static boolean USE_CLOUD_STRINGS = true;
public static boolean CHECK_UPDATES = true; public static boolean CHECK_UPDATES = true;
public static boolean NO_SCOPED_STORAGE = Build.VERSION.SDK_INT <= 29; public static boolean NO_SCOPED_STORAGE = Build.VERSION.SDK_INT <= 29;
public static int BUILD_VERSION = 3102; public static int BUILD_VERSION = 3106;
public static String BUILD_VERSION_STRING = "9.4.1"; public static String BUILD_VERSION_STRING = "9.4.2";
public static int APP_ID = 4; public static int APP_ID = 4;
public static String APP_HASH = "014b35b6184100b085b0d0572f9b5103"; public static String APP_HASH = "014b35b6184100b085b0d0572f9b5103";

View file

@ -110,7 +110,7 @@ public class DispatchQueuePoolBackground {
@UiThread @UiThread
public static void execute(Runnable runnable, boolean now) { public static void execute(Runnable runnable, boolean now) {
if (Thread.currentThread() != ApplicationLoader.applicationHandler.getLooper().getThread()) { if (Thread.currentThread() != ApplicationLoader.applicationHandler.getLooper().getThread()) {
if (BuildVars.DEBUG_PRIVATE_VERSION) { if (BuildVars.DEBUG_VERSION) {
FileLog.e(new RuntimeException("wrong thread")); FileLog.e(new RuntimeException("wrong thread"));
} }
return; return;

View file

@ -71,7 +71,7 @@ public class FileLog {
private static HashSet<String> excludeRequests; private static HashSet<String> excludeRequests;
public static void dumpResponseAndRequest(TLObject request, TLObject response, TLRPC.TL_error error, long requestMsgId, long startRequestTimeInMillis, int requestToken) { public static void dumpResponseAndRequest(TLObject request, TLObject response, TLRPC.TL_error error, long requestMsgId, long startRequestTimeInMillis, int requestToken) {
if (!BuildVars.DEBUG_PRIVATE_VERSION || !BuildVars.LOGS_ENABLED || request == null || SharedConfig.getDevicePerformanceClass() == SharedConfig.PERFORMANCE_CLASS_LOW) { if (!BuildVars.DEBUG_VERSION || !BuildVars.LOGS_ENABLED || request == null || SharedConfig.getDevicePerformanceClass() == SharedConfig.PERFORMANCE_CLASS_LOW) {
return; return;
} }
String requestSimpleName = request.getClass().getSimpleName(); String requestSimpleName = request.getClass().getSimpleName();
@ -115,7 +115,7 @@ public class FileLog {
} }
public static void dumpUnparsedMessage(TLObject message, long messageId) { public static void dumpUnparsedMessage(TLObject message, long messageId) {
if (!BuildVars.DEBUG_PRIVATE_VERSION || !BuildVars.LOGS_ENABLED || message == null) { if (!BuildVars.DEBUG_VERSION || !BuildVars.LOGS_ENABLED || message == null) {
return; return;
} }
try { try {

View file

@ -1605,7 +1605,7 @@ public class ImageLoader {
bitmapDrawable = new BitmapDrawable(bitmap); bitmapDrawable = new BitmapDrawable(bitmap);
} }
lottieDrawable.recycle(); lottieDrawable.recycle(false);
currentBitmap.recycle(); currentBitmap.recycle();
onPostExecute(bitmapDrawable); onPostExecute(bitmapDrawable);
} }
@ -1621,7 +1621,7 @@ public class ImageLoader {
lottieMemCache.put(cacheImage.key, lottieDrawable); lottieMemCache.put(cacheImage.key, lottieDrawable);
toSet = lottieDrawable; toSet = lottieDrawable;
} else { } else {
lottieDrawable.recycle(); lottieDrawable.recycle(false);
} }
if (toSet != null) { if (toSet != null) {
incrementUseCount(cacheImage.key); incrementUseCount(cacheImage.key);
@ -2010,7 +2010,7 @@ public class ImageLoader {
((AnimatedFileDrawable) oldValue).recycle(); ((AnimatedFileDrawable) oldValue).recycle();
} }
if (oldValue instanceof RLottieDrawable) { if (oldValue instanceof RLottieDrawable) {
((RLottieDrawable) oldValue).recycle(); ((RLottieDrawable) oldValue).recycle(false);
} }
} }
} }

View file

@ -125,7 +125,7 @@ public class ImageReceiver implements NotificationCenter.NotificationCenterDeleg
} else if (drawable != null) { } else if (drawable != null) {
if (drawable instanceof RLottieDrawable) { if (drawable instanceof RLottieDrawable) {
RLottieDrawable fileDrawable = (RLottieDrawable) drawable; RLottieDrawable fileDrawable = (RLottieDrawable) drawable;
fileDrawable.recycle(); fileDrawable.recycle(false);
} else if (drawable instanceof AnimatedFileDrawable) { } else if (drawable instanceof AnimatedFileDrawable) {
AnimatedFileDrawable fileDrawable = (AnimatedFileDrawable) drawable; AnimatedFileDrawable fileDrawable = (AnimatedFileDrawable) drawable;
fileDrawable.recycle(); fileDrawable.recycle();
@ -2795,7 +2795,7 @@ public class ImageReceiver implements NotificationCenter.NotificationCenterDeleg
boolean canDelete = ImageLoader.getInstance().decrementUseCount(key); boolean canDelete = ImageLoader.getInstance().decrementUseCount(key);
if (!ImageLoader.getInstance().isInMemCache(key, true)) { if (!ImageLoader.getInstance().isInMemCache(key, true)) {
if (canDelete) { if (canDelete) {
fileDrawable.recycle(); fileDrawable.recycle(false);
} }
} }
} else if (image instanceof AnimatedFileDrawable) { } else if (image instanceof AnimatedFileDrawable) {

View file

@ -483,7 +483,7 @@ public class LocaleController {
langCode = langCode.replace("-", "_"); langCode = langCode.replace("-", "_");
} }
if (langCode == null || currentLocaleInfo != null && (langCode.equals(currentLocaleInfo.shortName) || langCode.equals(currentLocaleInfo.baseLangCode))) { if (langCode == null || currentLocaleInfo != null && (langCode.equals(currentLocaleInfo.shortName) || langCode.equals(currentLocaleInfo.baseLangCode))) {
applyRemoteLanguage(currentLocaleInfo, langCode, force, currentAccount, onDone); applyRemoteLanguage(currentLocaleInfo, langCode, force, force, currentAccount, onDone);
} }
} }
@ -493,11 +493,11 @@ public class LocaleController {
} }
if (currentLocaleInfo.hasBaseLang()) { if (currentLocaleInfo.hasBaseLang()) {
if (currentLocaleInfo.baseVersion < baseVersion) { if (currentLocaleInfo.baseVersion < baseVersion) {
applyRemoteLanguage(currentLocaleInfo, currentLocaleInfo.baseLangCode, false, currentAccount, null); applyRemoteLanguage(currentLocaleInfo, currentLocaleInfo.baseLangCode, false, false, currentAccount, null);
} }
} }
if (currentLocaleInfo.version < version) { if (currentLocaleInfo.version < version) {
applyRemoteLanguage(currentLocaleInfo, currentLocaleInfo.shortName, false, currentAccount, null); applyRemoteLanguage(currentLocaleInfo, currentLocaleInfo.shortName, false, false, currentAccount, null);
} }
} }
@ -654,7 +654,7 @@ public class LocaleController {
saveOtherLanguages(); saveOtherLanguages();
} }
localeValues = stringMap; localeValues = stringMap;
applyLanguage(localeInfo, true, false, true, false, currentAccount, null); applyLanguage(localeInfo, true, false, true, false, false, currentAccount, null);
return true; return true;
} }
} catch (Exception e) { } catch (Exception e) {
@ -849,10 +849,10 @@ public class LocaleController {
} }
public int applyLanguage(LocaleInfo localeInfo, boolean override, boolean init, final int currentAccount) { public int applyLanguage(LocaleInfo localeInfo, boolean override, boolean init, final int currentAccount) {
return applyLanguage(localeInfo, override, init, false, false, currentAccount, null); return applyLanguage(localeInfo, override, init, false, false, false, currentAccount, null);
} }
public int applyLanguage(final LocaleInfo localeInfo, boolean override, boolean init, boolean fromFile, boolean force, final int currentAccount, Runnable onDone) { public int applyLanguage(final LocaleInfo localeInfo, boolean override, boolean init, boolean fromFile, boolean force, boolean forceFullDifference, final int currentAccount, Runnable onDone) {
if (localeInfo == null) { if (localeInfo == null) {
return 0; return 0;
} }
@ -885,9 +885,9 @@ public class LocaleController {
} }
isLoadingRemote = true; isLoadingRemote = true;
if (init) { if (init) {
AndroidUtilities.runOnUIThread(() -> applyRemoteLanguage(localeInfo, null, true, currentAccount, onDone)); AndroidUtilities.runOnUIThread(() -> applyRemoteLanguage(localeInfo, null, true, forceFullDifference, currentAccount, onDone));
} else { } else {
requestId = applyRemoteLanguage(localeInfo, null, true, currentAccount, onDone); requestId = applyRemoteLanguage(localeInfo, null, true, forceFullDifference, currentAccount, onDone);
} }
} }
try { try {
@ -929,12 +929,12 @@ public class LocaleController {
} }
if (currentPluralRules == null) { if (currentPluralRules == null) {
currentPluralRules = allRules.get(args[0]); currentPluralRules = allRules.get(args[0]);
if (currentPluralRules == null) { }
currentPluralRules = allRules.get(currentLocale.getLanguage()); if (currentPluralRules == null) {
if (currentPluralRules == null) { currentPluralRules = allRules.get(currentLocale.getLanguage());
currentPluralRules = new PluralRules_None(); }
} if (currentPluralRules == null) {
} currentPluralRules = new PluralRules_None();
} }
changingConfiguration = true; changingConfiguration = true;
Locale.setDefault(currentLocale); Locale.setDefault(currentLocale);
@ -2063,6 +2063,9 @@ public class LocaleController {
public void saveRemoteLocaleStrings(LocaleInfo localeInfo, final TLRPC.TL_langPackDifference difference, int currentAccount, Runnable onDone) { public void saveRemoteLocaleStrings(LocaleInfo localeInfo, final TLRPC.TL_langPackDifference difference, int currentAccount, Runnable onDone) {
if (difference == null || difference.strings.isEmpty() || localeInfo == null || localeInfo.isLocal()) { if (difference == null || difference.strings.isEmpty() || localeInfo == null || localeInfo.isLocal()) {
if (onDone != null) {
onDone.run();
}
return; return;
} }
final String langCode = difference.lang_code.replace('-', '_').toLowerCase(); final String langCode = difference.lang_code.replace('-', '_').toLowerCase();
@ -2264,42 +2267,57 @@ public class LocaleController {
}, ConnectionsManager.RequestFlagWithoutLogin); }, ConnectionsManager.RequestFlagWithoutLogin);
} }
private int applyRemoteLanguage(LocaleInfo localeInfo, String langCode, boolean force, final int currentAccount, Runnable onDone) { private int applyRemoteLanguage(LocaleInfo localeInfo, String langCode, boolean force, boolean forceFullDifference, final int currentAccount, Runnable onDone) {
if (localeInfo == null || !localeInfo.isRemote() && !localeInfo.isUnofficial()) { if (localeInfo == null || !localeInfo.isRemote() && !localeInfo.isUnofficial()) {
return 0; return 0;
} }
int[] requested = new int[1], received = new int[1];
requested[0] = received[0] = 0;
Runnable onPartlyDone = () -> {
received[0]++;
if (received[0] >= requested[0] && onDone != null) {
onDone.run();
}
};
if (localeInfo.hasBaseLang() && (langCode == null || langCode.equals(localeInfo.baseLangCode))) { if (localeInfo.hasBaseLang() && (langCode == null || langCode.equals(localeInfo.baseLangCode))) {
if (localeInfo.baseVersion != 0 && !force) { if (localeInfo.baseVersion != 0 && !forceFullDifference) {
if (localeInfo.hasBaseLang()) { if (localeInfo.hasBaseLang()) {
TLRPC.TL_langpack_getDifference req = new TLRPC.TL_langpack_getDifference(); TLRPC.TL_langpack_getDifference req = new TLRPC.TL_langpack_getDifference();
req.from_version = localeInfo.baseVersion; req.from_version = localeInfo.baseVersion;
req.lang_code = localeInfo.getBaseLangCode(); req.lang_code = localeInfo.getBaseLangCode();
req.lang_pack = ""; req.lang_pack = "";
return ConnectionsManager.getInstance(currentAccount).sendRequest(req, (response, error) -> { requested[0]++;
ConnectionsManager.getInstance(currentAccount).sendRequest(req, (response, error) -> {
if (response != null) { if (response != null) {
AndroidUtilities.runOnUIThread(() -> saveRemoteLocaleStrings(localeInfo, (TLRPC.TL_langPackDifference) response, currentAccount, onDone)); AndroidUtilities.runOnUIThread(() -> saveRemoteLocaleStrings(localeInfo, (TLRPC.TL_langPackDifference) response, currentAccount, onPartlyDone));
} }
}, ConnectionsManager.RequestFlagWithoutLogin); }, ConnectionsManager.RequestFlagWithoutLogin);
} }
} else { } else {
TLRPC.TL_langpack_getLangPack req = new TLRPC.TL_langpack_getLangPack(); TLRPC.TL_langpack_getLangPack req = new TLRPC.TL_langpack_getLangPack();
req.lang_code = localeInfo.getBaseLangCode(); req.lang_code = localeInfo.getBaseLangCode();
return ConnectionsManager.getInstance(currentAccount).sendRequest(req, (TLObject response, TLRPC.TL_error error) -> { requested[0]++;
ConnectionsManager.getInstance(currentAccount).sendRequest(req, (TLObject response, TLRPC.TL_error error) -> {
if (response != null) { if (response != null) {
AndroidUtilities.runOnUIThread(() -> saveRemoteLocaleStrings(localeInfo, (TLRPC.TL_langPackDifference) response, currentAccount, onDone)); AndroidUtilities.runOnUIThread(() -> {
saveRemoteLocaleStrings(localeInfo, (TLRPC.TL_langPackDifference) response, currentAccount, onPartlyDone);
});
} }
}, ConnectionsManager.RequestFlagWithoutLogin); }, ConnectionsManager.RequestFlagWithoutLogin);
} }
} }
if (langCode == null || langCode.equals(localeInfo.shortName)) { if (langCode == null || langCode.equals(localeInfo.shortName)) {
if (localeInfo.version != 0 && !force) { if (localeInfo.version != 0 && !forceFullDifference) {
TLRPC.TL_langpack_getDifference req = new TLRPC.TL_langpack_getDifference(); TLRPC.TL_langpack_getDifference req = new TLRPC.TL_langpack_getDifference();
req.from_version = localeInfo.version; req.from_version = localeInfo.version;
req.lang_code = localeInfo.getLangCode(); req.lang_code = localeInfo.getLangCode();
req.lang_pack = ""; req.lang_pack = "";
requested[0]++;
return ConnectionsManager.getInstance(currentAccount).sendRequest(req, (response, error) -> { return ConnectionsManager.getInstance(currentAccount).sendRequest(req, (response, error) -> {
if (response != null) { if (response != null) {
AndroidUtilities.runOnUIThread(() -> saveRemoteLocaleStrings(localeInfo, (TLRPC.TL_langPackDifference) response, currentAccount, onDone)); AndroidUtilities.runOnUIThread(() -> {
saveRemoteLocaleStrings(localeInfo, (TLRPC.TL_langPackDifference) response, currentAccount, onPartlyDone);
});
} }
}, ConnectionsManager.RequestFlagWithoutLogin); }, ConnectionsManager.RequestFlagWithoutLogin);
} else { } else {
@ -2308,9 +2326,12 @@ public class LocaleController {
} }
TLRPC.TL_langpack_getLangPack req = new TLRPC.TL_langpack_getLangPack(); TLRPC.TL_langpack_getLangPack req = new TLRPC.TL_langpack_getLangPack();
req.lang_code = localeInfo.getLangCode(); req.lang_code = localeInfo.getLangCode();
requested[0]++;
return 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) { if (response != null) {
AndroidUtilities.runOnUIThread(() -> saveRemoteLocaleStrings(localeInfo, (TLRPC.TL_langPackDifference) response, currentAccount, onDone)); AndroidUtilities.runOnUIThread(() -> {
saveRemoteLocaleStrings(localeInfo, (TLRPC.TL_langPackDifference) response, currentAccount, onPartlyDone);
});
} }
}, ConnectionsManager.RequestFlagWithoutLogin); }, ConnectionsManager.RequestFlagWithoutLogin);
} }

View file

@ -4211,9 +4211,6 @@ public class NotificationsController extends BaseController {
photoPath = null; photoPath = null;
canReply = false; canReply = false;
} }
if (passcode) {
canReply = false;
}
if (photoPath != null) { if (photoPath != null) {
avatalFile = getFileLoader().getPathToAttach(photoPath, true); avatalFile = getFileLoader().getPathToAttach(photoPath, true);

View file

@ -5751,6 +5751,13 @@ public class SendMessagesHelper extends BaseController implements NotificationCe
} else { } else {
isSentError = true; isSentError = true;
existFlags = 0; existFlags = 0;
if (BuildVars.LOGS_ENABLED) {
StringBuilder builder = new StringBuilder();
for (int i = 0; i < updatesArr.size(); i++) {
builder.append(updatesArr.get(i).getClass().getSimpleName()).append(", ");
}
FileLog.d("can't find message int updates " + builder);
}
} }
Utilities.stageQueue.postRunnable(() -> getMessagesController().processUpdates(updates, false)); Utilities.stageQueue.postRunnable(() -> getMessagesController().processUpdates(updates, false));
} else { } else {

View file

@ -1869,8 +1869,8 @@ public class ActionBarLayout extends FrameLayout implements INavigationLayout, F
} }
@Override @Override
public void removeFragmentFromStack(BaseFragment fragment) { public void removeFragmentFromStack(BaseFragment fragment, boolean immediate) {
if ((fragmentsStack.size() > 0 && fragmentsStack.get(fragmentsStack.size() - 1) == fragment) || (fragmentsStack.size() > 1 && fragmentsStack.get(fragmentsStack.size() - 2) == fragment)) { if (((fragmentsStack.size() > 0 && fragmentsStack.get(fragmentsStack.size() - 1) == fragment) || (fragmentsStack.size() > 1 && fragmentsStack.get(fragmentsStack.size() - 2) == fragment))) {
onOpenAnimationEnd(); onOpenAnimationEnd();
onCloseAnimationEnd(); onCloseAnimationEnd();
} }
@ -1880,7 +1880,7 @@ public class ActionBarLayout extends FrameLayout implements INavigationLayout, F
if (delegate != null && fragmentsStack.size() == 1 && AndroidUtilities.isTablet()) { if (delegate != null && fragmentsStack.size() == 1 && AndroidUtilities.isTablet()) {
delegate.needCloseLastFragment(this); delegate.needCloseLastFragment(this);
} }
removeFragmentFromStackInternal(fragment, true); removeFragmentFromStackInternal(fragment, fragment.allowFinishFragmentInsteadOfRemoveFromStack() && !immediate);
} }
} }

View file

@ -311,6 +311,10 @@ public abstract class BaseFragment {
} }
public void removeSelfFromStack() { public void removeSelfFromStack() {
removeSelfFromStack(false);
}
public void removeSelfFromStack(boolean immediate) {
if (isFinished || parentLayout == null) { if (isFinished || parentLayout == null) {
return; return;
} }
@ -318,7 +322,11 @@ public abstract class BaseFragment {
parentDialog.dismiss(); parentDialog.dismiss();
return; return;
} }
parentLayout.removeFragmentFromStack(this); parentLayout.removeFragmentFromStack(this, immediate);
}
public boolean allowFinishFragmentInsteadOfRemoveFromStack() {
return true;
} }
protected boolean isFinishing() { protected boolean isFinishing() {

View file

@ -23,7 +23,7 @@ public interface INavigationLayout {
boolean presentFragment(NavigationParams params); boolean presentFragment(NavigationParams params);
boolean checkTransitionAnimation(); boolean checkTransitionAnimation();
boolean addFragmentToStack(BaseFragment fragment, int position); boolean addFragmentToStack(BaseFragment fragment, int position);
void removeFragmentFromStack(BaseFragment fragment); void removeFragmentFromStack(BaseFragment fragment, boolean immediate);
List<BaseFragment> getFragmentStack(); List<BaseFragment> getFragmentStack();
void setDelegate(INavigationLayoutDelegate INavigationLayoutDelegate); void setDelegate(INavigationLayoutDelegate INavigationLayoutDelegate);
void closeLastFragment(boolean animated, boolean forceNoAnimation); void closeLastFragment(boolean animated, boolean forceNoAnimation);
@ -78,6 +78,9 @@ public interface INavigationLayout {
return SharedConfig.useLNavigation ? new LNavigation(context) : new ActionBarLayout(context); return SharedConfig.useLNavigation ? new LNavigation(context) : new ActionBarLayout(context);
} }
default void removeFragmentFromStack(BaseFragment fragment) {
removeFragmentFromStack(fragment, false);
}
default boolean isActionBarInCrossfade() { default boolean isActionBarInCrossfade() {
return false; return false;
} }

View file

@ -8888,22 +8888,22 @@ public class Theme {
if (dialogs_archiveAvatarDrawable != null) { if (dialogs_archiveAvatarDrawable != null) {
dialogs_archiveAvatarDrawable.setCallback(null); dialogs_archiveAvatarDrawable.setCallback(null);
dialogs_archiveAvatarDrawable.recycle(); dialogs_archiveAvatarDrawable.recycle(false);
} }
if (dialogs_archiveDrawable != null) { if (dialogs_archiveDrawable != null) {
dialogs_archiveDrawable.recycle(); dialogs_archiveDrawable.recycle(false);
} }
if (dialogs_unarchiveDrawable != null) { if (dialogs_unarchiveDrawable != null) {
dialogs_unarchiveDrawable.recycle(); dialogs_unarchiveDrawable.recycle(false);
} }
if (dialogs_pinArchiveDrawable != null) { if (dialogs_pinArchiveDrawable != null) {
dialogs_pinArchiveDrawable.recycle(); dialogs_pinArchiveDrawable.recycle(false);
} }
if (dialogs_unpinArchiveDrawable != null) { if (dialogs_unpinArchiveDrawable != null) {
dialogs_unpinArchiveDrawable.recycle(); dialogs_unpinArchiveDrawable.recycle(false);
} }
if (dialogs_hidePsaDrawable != null) { if (dialogs_hidePsaDrawable != null) {
dialogs_hidePsaDrawable.recycle(); dialogs_hidePsaDrawable.recycle(false);
} }
dialogs_archiveAvatarDrawable = new RLottieDrawable(R.raw.chats_archiveavatar, "chats_archiveavatar", AndroidUtilities.dp(36), AndroidUtilities.dp(36), false, null); dialogs_archiveAvatarDrawable = new RLottieDrawable(R.raw.chats_archiveavatar, "chats_archiveavatar", AndroidUtilities.dp(36), AndroidUtilities.dp(36), false, null);
dialogs_archiveDrawable = new RLottieDrawable(R.raw.chats_archive, "chats_archive", AndroidUtilities.dp(36), AndroidUtilities.dp(36)); dialogs_archiveDrawable = new RLottieDrawable(R.raw.chats_archive, "chats_archive", AndroidUtilities.dp(36), AndroidUtilities.dp(36));

View file

@ -89,7 +89,7 @@ public class CacheChatsExceptionsFragment extends BaseFragment {
} }
args.putBoolean("allowGlobalSearch", false); args.putBoolean("allowGlobalSearch", false);
DialogsActivity activity = new DialogsActivity(args); DialogsActivity activity = new DialogsActivity(args);
activity.setDelegate((fragment, dids, message, param) -> { activity.setDelegate((fragment, dids, message, param, topicsFragment) -> {
activity.finishFragment(); activity.finishFragment();
CacheByChatsController.KeepMediaException newException = null; CacheByChatsController.KeepMediaException newException = null;
for (int i = 0; i < dids.size(); i++) { for (int i = 0; i < dids.size(); i++) {

View file

@ -40,6 +40,7 @@ import org.telegram.ui.Components.RLottieImageView;
import org.telegram.ui.Components.Switch; import org.telegram.ui.Components.Switch;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Locale;
public class TextCheckCell extends FrameLayout { public class TextCheckCell extends FrameLayout {
private boolean isAnimatingToThumbInsteadOfTouch; private boolean isAnimatingToThumbInsteadOfTouch;
@ -59,6 +60,7 @@ public class TextCheckCell extends FrameLayout {
private int padding; private int padding;
private Theme.ResourcesProvider resourcesProvider; private Theme.ResourcesProvider resourcesProvider;
ImageView imageView; ImageView imageView;
private boolean isRTL;
public static final Property<TextCheckCell, Float> ANIMATION_PROGRESS = new AnimationProperties.FloatProperty<TextCheckCell>("animationProgress") { public static final Property<TextCheckCell, Float> ANIMATION_PROGRESS = new AnimationProperties.FloatProperty<TextCheckCell>("animationProgress") {
@Override @Override
@ -121,6 +123,8 @@ public class TextCheckCell extends FrameLayout {
addView(checkBox, LayoutHelper.createFrame(37, 20, (LocaleController.isRTL ? Gravity.LEFT : Gravity.RIGHT) | Gravity.CENTER_VERTICAL, 22, 0, 22, 0)); addView(checkBox, LayoutHelper.createFrame(37, 20, (LocaleController.isRTL ? Gravity.LEFT : Gravity.RIGHT) | Gravity.CENTER_VERTICAL, 22, 0, 22, 0));
setClipChildren(false); setClipChildren(false);
isRTL = LocaleController.isRTL;
} }
@Override @Override
@ -167,6 +171,11 @@ public class TextCheckCell extends FrameLayout {
} }
public void updateRTL() { public void updateRTL() {
if (isRTL == LocaleController.isRTL) {
return;
}
isRTL = LocaleController.isRTL;
textView.setGravity((LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT) | Gravity.CENTER_VERTICAL); textView.setGravity((LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT) | Gravity.CENTER_VERTICAL);
removeView(textView); removeView(textView);
addView(textView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.MATCH_PARENT, (LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT) | Gravity.TOP, LocaleController.isRTL ? 70 : padding, 0, LocaleController.isRTL ? padding : 70, 0)); addView(textView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.MATCH_PARENT, (LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT) | Gravity.TOP, LocaleController.isRTL ? 70 : padding, 0, LocaleController.isRTL ? padding : 70, 0));

View file

@ -39,6 +39,7 @@ public class TextInfoPrivacyCell extends FrameLayout {
private int topPadding = 10; private int topPadding = 10;
private int bottomPadding = 17; private int bottomPadding = 17;
private int fixedSize; private int fixedSize;
private boolean isRTL;
private CharSequence text; private CharSequence text;
private final Theme.ResourcesProvider resourcesProvider; private final Theme.ResourcesProvider resourcesProvider;
@ -76,9 +77,23 @@ public class TextInfoPrivacyCell extends FrameLayout {
textView.setImportantForAccessibility(IMPORTANT_FOR_ACCESSIBILITY_NO); textView.setImportantForAccessibility(IMPORTANT_FOR_ACCESSIBILITY_NO);
addView(textView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT, (LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT) | Gravity.TOP, padding, 0, padding, 0)); addView(textView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT, (LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT) | Gravity.TOP, padding, 0, padding, 0));
isRTL = LocaleController.isRTL;
setWillNotDraw(false); setWillNotDraw(false);
} }
public void updateRTL() {
if (isRTL == LocaleController.isRTL) {
return;
}
isRTL = LocaleController.isRTL;
textView.setGravity(LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT);
FrameLayout.LayoutParams layoutParams = (FrameLayout.LayoutParams) textView.getLayoutParams();
layoutParams.gravity = (LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT) | Gravity.TOP;
textView.setLayoutParams(layoutParams);
}
@Override @Override
protected void onDraw(Canvas canvas) { protected void onDraw(Canvas canvas) {
if (links != null) { if (links != null) {

View file

@ -24,7 +24,6 @@ import org.telegram.ui.Components.AnimationProperties;
import org.telegram.ui.Components.CubicBezierInterpolator; import org.telegram.ui.Components.CubicBezierInterpolator;
import org.telegram.ui.Components.LayoutHelper; import org.telegram.ui.Components.LayoutHelper;
import org.telegram.ui.Components.RadioButton; import org.telegram.ui.Components.RadioButton;
import org.telegram.ui.Components.Switch;
import java.util.ArrayList; import java.util.ArrayList;
@ -42,6 +41,8 @@ public class TextRadioCell extends FrameLayout {
private float lastTouchX; private float lastTouchX;
private ObjectAnimator animator; private ObjectAnimator animator;
private boolean drawCheckRipple; private boolean drawCheckRipple;
private boolean isRTL;
private int padding;
public static final Property<TextRadioCell, Float> ANIMATION_PROGRESS = new AnimationProperties.FloatProperty<TextRadioCell>("animationProgress") { public static final Property<TextRadioCell, Float> ANIMATION_PROGRESS = new AnimationProperties.FloatProperty<TextRadioCell>("animationProgress") {
@Override @Override
@ -67,6 +68,8 @@ public class TextRadioCell extends FrameLayout {
public TextRadioCell(Context context, int padding, boolean dialog) { public TextRadioCell(Context context, int padding, boolean dialog) {
super(context); super(context);
this.padding = padding;
textView = new TextView(context); textView = new TextView(context);
textView.setTextColor(Theme.getColor(dialog ? Theme.key_dialogTextBlack : Theme.key_windowBackgroundWhiteBlackText)); textView.setTextColor(Theme.getColor(dialog ? Theme.key_dialogTextBlack : Theme.key_windowBackgroundWhiteBlackText));
textView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 16); textView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 16);
@ -94,9 +97,33 @@ public class TextRadioCell extends FrameLayout {
radioButton.setColor(Theme.getColor(Theme.key_radioBackground), Theme.getColor(Theme.key_radioBackgroundChecked)); radioButton.setColor(Theme.getColor(Theme.key_radioBackground), Theme.getColor(Theme.key_radioBackgroundChecked));
addView(radioButton, LayoutHelper.createFrame(20, 20, (LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT) | Gravity.CENTER_VERTICAL, 22, 0, 22, 0)); addView(radioButton, LayoutHelper.createFrame(20, 20, (LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT) | Gravity.CENTER_VERTICAL, 22, 0, 22, 0));
isRTL = LocaleController.isRTL;
setClipChildren(false); setClipChildren(false);
} }
public void updateRTL() {
if (isRTL == LocaleController.isRTL) {
return;
}
isRTL = LocaleController.isRTL;
textView.setGravity((LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT) | Gravity.CENTER_VERTICAL);
FrameLayout.LayoutParams textViewLayout = (FrameLayout.LayoutParams) textView.getLayoutParams();
textViewLayout.gravity = (LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT) | Gravity.TOP;
textViewLayout.leftMargin = AndroidUtilities.dp(LocaleController.isRTL ? padding : 64);
textViewLayout.rightMargin = AndroidUtilities.dp(LocaleController.isRTL ? 64 : padding);
textView.setLayoutParams(textViewLayout);
valueTextView.setGravity(LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT);
FrameLayout.LayoutParams valueTextViewLayout = (FrameLayout.LayoutParams) valueTextView.getLayoutParams();
valueTextViewLayout.gravity = (LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT) | Gravity.TOP;
valueTextViewLayout.leftMargin = AndroidUtilities.dp(LocaleController.isRTL ? padding : 64);
valueTextViewLayout.rightMargin = AndroidUtilities.dp(LocaleController.isRTL ? 64 : padding);
valueTextView.setLayoutParams(valueTextViewLayout);
FrameLayout.LayoutParams radioButtonLayout = (FrameLayout.LayoutParams) radioButton.getLayoutParams();
radioButtonLayout.gravity = (LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT) | Gravity.CENTER_VERTICAL;
radioButton.setLayoutParams(radioButtonLayout);
}
@Override @Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
if (isMultiline) { if (isMultiline) {

View file

@ -16420,7 +16420,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
if (AndroidUtilities.isTablet() && parentLayout != null && parentLayout.getFragmentStack().size() > 1) { if (AndroidUtilities.isTablet() && parentLayout != null && parentLayout.getFragmentStack().size() > 1) {
finishFragment(); finishFragment();
} else { } else {
removeSelfFromStack(); removeSelfFromStack(true);
} }
} }
} else if (id == NotificationCenter.commentsRead) { } else if (id == NotificationCenter.commentsRead) {
@ -24243,7 +24243,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
@Override @Override
public void onSwipeBackProgress(PopupSwipeBackLayout layout, float toProgress, float progress) { public void onSwipeBackProgress(PopupSwipeBackLayout layout, float toProgress, float progress) {
if (toProgress == 0 && !isEnter) { if (toProgress == 0 && !isEnter) {
finalReactionsLayout.startEnterAnimation(); finalReactionsLayout.startEnterAnimation(false);
isEnter = true; isEnter = true;
} else if (toProgress == 1 && isEnter) { } else if (toProgress == 1 && isEnter) {
finalReactionsLayout.setAlpha(1f - progress); finalReactionsLayout.setAlpha(1f - progress);
@ -24377,7 +24377,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
scrimPopupWindow.setDismissAnimationDuration(220); scrimPopupWindow.setDismissAnimationDuration(220);
scrimPopupWindow.setOutsideTouchable(true); scrimPopupWindow.setOutsideTouchable(true);
scrimPopupWindow.setClippingEnabled(true); scrimPopupWindow.setClippingEnabled(true);
if (reactionsLayout == null) { if (!isReactionsAvailable || reactionsLayout == null) {
scrimPopupWindow.setAnimationStyle(R.style.PopupContextAnimation); scrimPopupWindow.setAnimationStyle(R.style.PopupContextAnimation);
} else { } else {
scrimPopupWindow.setAnimationStyle(0); scrimPopupWindow.setAnimationStyle(0);
@ -24430,7 +24430,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
} }
scrimPopupWindow.showAtLocation(chatListView, Gravity.LEFT | Gravity.TOP, finalPopupX, finalPopupY); scrimPopupWindow.showAtLocation(chatListView, Gravity.LEFT | Gravity.TOP, finalPopupX, finalPopupY);
if (isReactionsAvailable && finalReactionsLayout != null) { if (isReactionsAvailable && finalReactionsLayout != null) {
finalReactionsLayout.startEnterAnimation(); finalReactionsLayout.startEnterAnimation(true);
} }
AndroidUtilities.runOnUIThread(() -> { AndroidUtilities.runOnUIThread(() -> {
if (scrimPopupWindowItems != null && scrimPopupWindowItems.length > 0 && scrimPopupWindowItems[0] != null) { if (scrimPopupWindowItems != null && scrimPopupWindowItems.length > 0 && scrimPopupWindowItems[0] != null) {
@ -25530,7 +25530,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
} }
@Override @Override
public boolean didSelectDialogs(DialogsActivity fragment, ArrayList<MessagesStorage.TopicKey> dids, CharSequence message, boolean param) { public boolean didSelectDialogs(DialogsActivity fragment, ArrayList<MessagesStorage.TopicKey> dids, CharSequence message, boolean param, TopicsFragment topicsFragment) {
if (forwardingMessage == null && selectedMessagesIds[0].size() == 0 && selectedMessagesIds[1].size() == 0) { if (forwardingMessage == null && selectedMessagesIds[0].size() == 0 && selectedMessagesIds[1].size() == 0) {
return false; return false;
} }

View file

@ -363,7 +363,7 @@ public class AlertsCreator {
} else if (request instanceof TLRPC.TL_messages_sendScheduledMessages) { } else if (request instanceof TLRPC.TL_messages_sendScheduledMessages) {
dialogId = DialogObject.getPeerDialogId(((TLRPC.TL_messages_sendScheduledMessages) request).peer); dialogId = DialogObject.getPeerDialogId(((TLRPC.TL_messages_sendScheduledMessages) request).peer);
} }
if (BuildVars.DEBUG_VERSION && error.text != null && error.text.startsWith("CHAT_SEND_") && error.text.endsWith("FORBIDDEN")) { if (error.text != null && error.text.startsWith("CHAT_SEND_") && error.text.endsWith("FORBIDDEN")) {
String errorText = error.text; String errorText = error.text;
TLRPC.Chat chat = dialogId < 0 ? MessagesController.getInstance(currentAccount).getChat(-dialogId) : null; TLRPC.Chat chat = dialogId < 0 ? MessagesController.getInstance(currentAccount).getChat(-dialogId) : null;
switch (error.text) { switch (error.text) {
@ -628,7 +628,7 @@ public class AlertsCreator {
localeInfo.pathToFile = "unofficial"; localeInfo.pathToFile = "unofficial";
} }
} }
LocaleController.getInstance().applyLanguage(localeInfo, true, false, false, true, UserConfig.selectedAccount, null); LocaleController.getInstance().applyLanguage(localeInfo, true, false, false, true, true, UserConfig.selectedAccount, null);
activity.rebuildAllFragments(true); activity.rebuildAllFragments(true);
}); });
builder.setNegativeButton(LocaleController.getString("Cancel", R.string.Cancel), null); builder.setNegativeButton(LocaleController.getString("Cancel", R.string.Cancel), null);

View file

@ -1395,7 +1395,7 @@ public class AudioPlayerAlert extends BottomSheet implements NotificationCenter.
DialogsActivity fragment = new DialogsActivity(args); DialogsActivity fragment = new DialogsActivity(args);
final ArrayList<MessageObject> fmessages = new ArrayList<>(); final ArrayList<MessageObject> fmessages = new ArrayList<>();
fmessages.add(messageObject); fmessages.add(messageObject);
fragment.setDelegate((fragment1, dids, message, param) -> { fragment.setDelegate((fragment1, dids, message, param, topicsFragment) -> {
if (dids.size() > 1 || dids.get(0) .dialogId== UserConfig.getInstance(currentAccount).getClientUserId() || message != null) { if (dids.size() > 1 || dids.get(0) .dialogId== UserConfig.getInstance(currentAccount).getClientUserId() || message != null) {
for (int a = 0; a < dids.size(); a++) { for (int a = 0; a < dids.size(); a++) {
long did = dids.get(a).dialogId; long did = dids.get(a).dialogId;

View file

@ -150,6 +150,7 @@ import org.telegram.ui.PhotoViewer;
import org.telegram.ui.PremiumPreviewFragment; import org.telegram.ui.PremiumPreviewFragment;
import org.telegram.ui.ProfileActivity; import org.telegram.ui.ProfileActivity;
import org.telegram.ui.StickersActivity; import org.telegram.ui.StickersActivity;
import org.telegram.ui.TopicsFragment;
import java.io.File; import java.io.File;
import java.io.FileOutputStream; import java.io.FileOutputStream;
@ -7415,7 +7416,7 @@ public class ChatActivityEnterView extends BlurredFrameLayout implements Notific
args.putBoolean("onlySelect", true); args.putBoolean("onlySelect", true);
args.putInt("dialogsType", DialogsActivity.DIALOGS_TYPE_BOT_SHARE); args.putInt("dialogsType", DialogsActivity.DIALOGS_TYPE_BOT_SHARE);
DialogsActivity fragment = new DialogsActivity(args); DialogsActivity fragment = new DialogsActivity(args);
fragment.setDelegate((fragment1, dids, message, param) -> { fragment.setDelegate((fragment1, dids, message, param, topicsFragment) -> {
long uid = messageObject.messageOwner.from_id.user_id; long uid = messageObject.messageOwner.from_id.user_id;
if (messageObject.messageOwner.via_bot_id != 0) { if (messageObject.messageOwner.via_bot_id != 0) {
uid = messageObject.messageOwner.via_bot_id; uid = messageObject.messageOwner.via_bot_id;
@ -7483,7 +7484,7 @@ public class ChatActivityEnterView extends BlurredFrameLayout implements Notific
DialogsActivity fragment = new DialogsActivity(args); DialogsActivity fragment = new DialogsActivity(args);
fragment.setDelegate(new DialogsActivity.DialogsActivityDelegate() { fragment.setDelegate(new DialogsActivity.DialogsActivityDelegate() {
@Override @Override
public boolean didSelectDialogs(DialogsActivity fragment, ArrayList<MessagesStorage.TopicKey> dids, CharSequence message, boolean param) { public boolean didSelectDialogs(DialogsActivity fragment, ArrayList<MessagesStorage.TopicKey> dids, CharSequence message, boolean param, TopicsFragment topicsFragment) {
if (dids != null && !dids.isEmpty()) { if (dids != null && !dids.isEmpty()) {
TLRPC.TL_messages_sendBotRequestedPeer req = new TLRPC.TL_messages_sendBotRequestedPeer(); TLRPC.TL_messages_sendBotRequestedPeer req = new TLRPC.TL_messages_sendBotRequestedPeer();
req.peer = MessagesController.getInstance(currentAccount).getInputPeer(messageObject.messageOwner.peer_id); req.peer = MessagesController.getInstance(currentAccount).getInputPeer(messageObject.messageOwner.peer_id);

View file

@ -994,13 +994,13 @@ public class EmojiPacksAlert extends BottomSheet implements NotificationCenter.N
} }
} }
boolean mePremium = UserConfig.getInstance(currentAccount).isPremium(); // boolean mePremium = UserConfig.getInstance(currentAccount).isPremium();
ArrayList<TLRPC.TL_messages_stickerSet> canInstallPacks = new ArrayList<>(notInstalledPacks); ArrayList<TLRPC.TL_messages_stickerSet> canInstallPacks = new ArrayList<>(notInstalledPacks);
for (int i = 0; i < canInstallPacks.size(); ++i) { // for (int i = 0; i < canInstallPacks.size(); ++i) {
if (MessageObject.isPremiumEmojiPack(canInstallPacks.get(i)) && !mePremium) { // if (MessageObject.isPremiumEmojiPack(canInstallPacks.get(i)) && !mePremium) {
canInstallPacks.remove(i--); // canInstallPacks.remove(i--);
} // }
} // }
boolean loadedNow = customEmojiPacks.inputStickerSets != null && allPacks.size() == customEmojiPacks.inputStickerSets.size(); boolean loadedNow = customEmojiPacks.inputStickerSets != null && allPacks.size() == customEmojiPacks.inputStickerSets.size();
if (!loaded && loadedNow) { if (!loaded && loadedNow) {
@ -1030,11 +1030,11 @@ public class EmojiPacksAlert extends BottomSheet implements NotificationCenter.N
addButtonView.setVisibility(View.GONE); addButtonView.setVisibility(View.GONE);
removeButtonView.setVisibility(View.GONE); removeButtonView.setVisibility(View.GONE);
updateShowButton(false); updateShowButton(false);
} else if (canInstallPacks.size() <= 0 && notInstalledPacks.size() >= 0 && !mePremium || !loaded) { // } else if (canInstallPacks.size() <= 0 && notInstalledPacks.size() >= 0 && !mePremium || !loaded) {
premiumButtonView.setVisibility(View.VISIBLE); // premiumButtonView.setVisibility(View.VISIBLE);
addButtonView.setVisibility(View.GONE); // addButtonView.setVisibility(View.GONE);
removeButtonView.setVisibility(View.GONE); // removeButtonView.setVisibility(View.GONE);
updateShowButton(true); // updateShowButton(true);
} else { } else {
premiumButtonView.setVisibility(View.INVISIBLE); premiumButtonView.setVisibility(View.INVISIBLE);
if (canInstallPacks.size() > 0) { if (canInstallPacks.size() > 0) {

View file

@ -23,7 +23,7 @@ public class HelloParticles {
"Sveiki", "Halo", "გამარჯობა", "Hallå", "Salam", "Tere", "Dia dhuit", "こんにちは", "Сайн уу", "Sveiki", "Halo", "გამარჯობა", "Hallå", "Salam", "Tere", "Dia dhuit", "こんにちは", "Сайн уу",
"Bongu", "Ahoj", "γεια", "Zdravo", "नमस्ते", "Habari", "Hallo", "ជំរាបសួរ", "مرحبًا", "ನಮಸ್ಕಾರ", "Bongu", "Ahoj", "γεια", "Zdravo", "नमस्ते", "Habari", "Hallo", "ជំរាបសួរ", "مرحبًا", "ನಮಸ್ಕಾರ",
"Салам", "Silav li wir", "سڵاو", "Kif inti", "Talofa", "Thobela", "हॅलो", "ሰላም", "Здраво", "Салам", "Silav li wir", "سڵاو", "Kif inti", "Talofa", "Thobela", "हॅलो", "ሰላም", "Здраво",
"ഹലോ", "ہیلو", "ꯍꯦꯜꯂꯣ", "Alô", "வணக்கம்", "Mhoro", "Moni", "Alo", "สวัสดี", "Salom", "" "ഹലോ", "ہیلو", "ꯍꯦꯜꯂꯣ", "Alô", "வணக்கம்", "Mhoro", "Moni", "Alo", "สวัสดี", "Salom", "Բարեւ"
}; };
public static class Drawable { public static class Drawable {

View file

@ -236,7 +236,7 @@ public class RLottieDrawable extends BitmapDrawable implements Animatable, Bitma
if (destroyWhenDone) { if (destroyWhenDone) {
checkRunningTasks(); checkRunningTasks();
if (loadFrameTask == null && cacheGenerateTask == null && nativePtr != 0) { if (loadFrameTask == null && cacheGenerateTask == null && nativePtr != 0) {
recycleNativePtr(); recycleNativePtr(true);
} }
} }
if ((nativePtr == 0 || fallbackCache) && secondNativePtr == 0 && bitmapsCache == null) { if ((nativePtr == 0 || fallbackCache) && secondNativePtr == 0 && bitmapsCache == null) {
@ -250,20 +250,33 @@ public class RLottieDrawable extends BitmapDrawable implements Animatable, Bitma
scheduleNextGetFrame(); scheduleNextGetFrame();
} }
private void recycleNativePtr() { private void recycleNativePtr(boolean uiThread) {
long nativePtrFinal = nativePtr; long nativePtrFinal = nativePtr;
long secondNativePtrFinal = secondNativePtr; long secondNativePtrFinal = secondNativePtr;
nativePtr = 0; nativePtr = 0;
secondNativePtr = 0; secondNativePtr = 0;
DispatchQueuePoolBackground.execute(() -> { if (nativePtrFinal != 0 || secondNativePtrFinal != 0) {
if (nativePtrFinal != 0) { if (uiThread) {
destroy(nativePtrFinal); DispatchQueuePoolBackground.execute(() -> {
if (nativePtrFinal != 0) {
destroy(nativePtrFinal);
}
if (secondNativePtrFinal != 0) {
destroy(secondNativePtrFinal);
}
});
} else {
Utilities.globalQueue.postRunnable(() ->{
if (nativePtrFinal != 0) {
destroy(nativePtrFinal);
}
if (secondNativePtrFinal != 0) {
destroy(secondNativePtrFinal);
}
});
} }
if (secondNativePtrFinal != 0) { }
destroy(secondNativePtrFinal);
}
});
} }
protected void recycleResources() { protected void recycleResources() {
@ -611,7 +624,7 @@ public class RLottieDrawable extends BitmapDrawable implements Animatable, Bitma
AndroidUtilities.runOnUIThread(() -> { AndroidUtilities.runOnUIThread(() -> {
loadingInBackground = false; loadingInBackground = false;
if (!secondLoadingInBackground && destroyAfterLoading) { if (!secondLoadingInBackground && destroyAfterLoading) {
recycle(); recycle(true);
return; return;
} }
timeBetweenFrames = Math.max(16, (int) (1000.0f / metaData[1])); timeBetweenFrames = Math.max(16, (int) (1000.0f / metaData[1]));
@ -645,7 +658,7 @@ public class RLottieDrawable extends BitmapDrawable implements Animatable, Bitma
AndroidUtilities.runOnUIThread(() -> { AndroidUtilities.runOnUIThread(() -> {
secondLoadingInBackground = false; secondLoadingInBackground = false;
if (!loadingInBackground && destroyAfterLoading) { if (!loadingInBackground && destroyAfterLoading) {
recycle(); recycle(true);
} }
}); });
return; return;
@ -655,7 +668,7 @@ public class RLottieDrawable extends BitmapDrawable implements Animatable, Bitma
AndroidUtilities.runOnUIThread(() -> { AndroidUtilities.runOnUIThread(() -> {
secondLoadingInBackground = false; secondLoadingInBackground = false;
if (!secondLoadingInBackground && destroyAfterLoading) { if (!secondLoadingInBackground && destroyAfterLoading) {
recycle(); recycle(true);
return; return;
} }
secondFramesCount = metaData2[0]; secondFramesCount = metaData2[0];
@ -817,14 +830,14 @@ public class RLottieDrawable extends BitmapDrawable implements Animatable, Bitma
} }
} }
public void recycle() { public void recycle(boolean uiThread) {
isRunning = false; isRunning = false;
isRecycled = true; isRecycled = true;
checkRunningTasks(); checkRunningTasks();
if (loadingInBackground || secondLoadingInBackground) { if (loadingInBackground || secondLoadingInBackground) {
destroyAfterLoading = true; destroyAfterLoading = true;
} else if (loadFrameTask == null && cacheGenerateTask == null && !generatingCache) { } else if (loadFrameTask == null && cacheGenerateTask == null && !generatingCache) {
recycleNativePtr(); recycleNativePtr(uiThread);
if (bitmapsCache != null) { if (bitmapsCache != null) {
bitmapsCache.recycle(); bitmapsCache.recycle();
bitmapsCache = null; bitmapsCache = null;
@ -853,7 +866,7 @@ public class RLottieDrawable extends BitmapDrawable implements Animatable, Bitma
@Override @Override
protected void finalize() throws Throwable { protected void finalize() throws Throwable {
try { try {
recycle(); recycle(false);
} finally { } finally {
super.finalize(); super.finalize();
} }

View file

@ -292,7 +292,7 @@ public class ChatSelectionReactionMenuOverlay extends FrameLayout {
} }
private boolean isMessageTypeAllowed(MessageObject obj) { private boolean isMessageTypeAllowed(MessageObject obj) {
return MessageObject.isPhoto(obj.messageOwner) || obj.getDocument() != null && MessageObject.isVideoDocument(obj.getDocument()); return MessageObject.isPhoto(obj.messageOwner) || obj.getDocument() != null && (MessageObject.isVideoDocument(obj.getDocument()) || MessageObject.isGifDocument(obj.getDocument()));
} }
public void setSelectedMessages(List<MessageObject> messages) { public void setSelectedMessages(List<MessageObject> messages) {
@ -341,7 +341,7 @@ public class ChatSelectionReactionMenuOverlay extends FrameLayout {
if (reactionsContainerLayout.isEnabled()) { if (reactionsContainerLayout.isEnabled()) {
messageSet = true; messageSet = true;
reactionsContainerLayout.setMessage(currentPrimaryObject, parentFragment.getCurrentChatInfo()); reactionsContainerLayout.setMessage(currentPrimaryObject, parentFragment.getCurrentChatInfo());
reactionsContainerLayout.startEnterAnimation(); reactionsContainerLayout.startEnterAnimation(false);
} else { } else {
messageSet = false; messageSet = false;
reactionsContainerLayout.setTransitionProgress(1f); reactionsContainerLayout.setTransitionProgress(1f);

View file

@ -162,6 +162,7 @@ public class ReactionsContainerLayout extends FrameLayout implements Notificatio
private boolean allReactionsIsDefault; private boolean allReactionsIsDefault;
private Paint selectedPaint; private Paint selectedPaint;
ChatScrimPopupContainerLayout parentLayout; ChatScrimPopupContainerLayout parentLayout;
private boolean animatePopup;
public ReactionsContainerLayout(BaseFragment fragment, @NonNull Context context, int currentAccount, Theme.ResourcesProvider resourcesProvider) { public ReactionsContainerLayout(BaseFragment fragment, @NonNull Context context, int currentAccount, Theme.ResourcesProvider resourcesProvider) {
super(context); super(context);
@ -925,7 +926,7 @@ public class ReactionsContainerLayout extends FrameLayout implements Notificatio
public void setTransitionProgress(float transitionProgress) { public void setTransitionProgress(float transitionProgress) {
this.transitionProgress = transitionProgress; this.transitionProgress = transitionProgress;
if (parentLayout != null && parentLayout.getPopupWindowLayout() != null) { if (parentLayout != null && parentLayout.getPopupWindowLayout() != null) {
parentLayout.getPopupWindowLayout().setReactionsTransitionProgress(transitionProgress); parentLayout.getPopupWindowLayout().setReactionsTransitionProgress(animatePopup ? transitionProgress : 1);
} }
invalidate(); invalidate();
} }
@ -1046,7 +1047,8 @@ public class ReactionsContainerLayout extends FrameLayout implements Notificatio
} }
} }
public void startEnterAnimation() { public void startEnterAnimation(boolean animatePopup) {
this.animatePopup = animatePopup;
setTransitionProgress(0); setTransitionProgress(0);
setAlpha(1f); setAlpha(1f);
ObjectAnimator animator = ObjectAnimator.ofFloat(this, ReactionsContainerLayout.TRANSITION_PROGRESS_VALUE, 0f, 1f).setDuration(350); ObjectAnimator animator = ObjectAnimator.ofFloat(this, ReactionsContainerLayout.TRANSITION_PROGRESS_VALUE, 0f, 1f).setDuration(350);
@ -1559,7 +1561,7 @@ public class ReactionsContainerLayout extends FrameLayout implements Notificatio
if (chatFull.id == waitingLoadingChatId && getVisibility() != View.VISIBLE && !(chatFull.available_reactions instanceof TLRPC.TL_chatReactionsNone)) { if (chatFull.id == waitingLoadingChatId && getVisibility() != View.VISIBLE && !(chatFull.available_reactions instanceof TLRPC.TL_chatReactionsNone)) {
setMessage(messageObject, null); setMessage(messageObject, null);
setVisibility(View.VISIBLE); setVisibility(View.VISIBLE);
startEnterAnimation(); startEnterAnimation(false);
} }
} }
} }

View file

@ -520,7 +520,7 @@ public class SearchViewPager extends ViewPagerFixed implements FilteredSearchVie
args.putBoolean("onlySelect", true); args.putBoolean("onlySelect", true);
args.putInt("dialogsType", DialogsActivity.DIALOGS_TYPE_FORWARD); args.putInt("dialogsType", DialogsActivity.DIALOGS_TYPE_FORWARD);
DialogsActivity fragment = new DialogsActivity(args); DialogsActivity fragment = new DialogsActivity(args);
fragment.setDelegate((fragment1, dids, message, param) -> { fragment.setDelegate((fragment1, dids, message, param, topicsFragment) -> {
ArrayList<MessageObject> fmessages = new ArrayList<>(); ArrayList<MessageObject> fmessages = new ArrayList<>();
Iterator<FilteredSearchView.MessageHashId> idIterator = selectedFiles.keySet().iterator(); Iterator<FilteredSearchView.MessageHashId> idIterator = selectedFiles.keySet().iterator();
while (idIterator.hasNext()) { while (idIterator.hasNext()) {

View file

@ -3256,7 +3256,7 @@ public class SharedMediaLayout extends FrameLayout implements NotificationCenter
args.putBoolean("canSelectTopics", true); args.putBoolean("canSelectTopics", true);
args.putInt("dialogsType", DialogsActivity.DIALOGS_TYPE_FORWARD); args.putInt("dialogsType", DialogsActivity.DIALOGS_TYPE_FORWARD);
DialogsActivity fragment = new DialogsActivity(args); DialogsActivity fragment = new DialogsActivity(args);
fragment.setDelegate((fragment1, dids, message, param) -> { fragment.setDelegate((fragment1, dids, message, param, topicsFragment) -> {
ArrayList<MessageObject> fmessages = new ArrayList<>(); ArrayList<MessageObject> fmessages = new ArrayList<>();
for (int a = 1; a >= 0; a--) { for (int a = 1; a >= 0; a--) {
ArrayList<Integer> ids = new ArrayList<>(); ArrayList<Integer> ids = new ArrayList<>();

View file

@ -196,7 +196,7 @@ public class SlotsDrawable extends RLottieDrawable {
AndroidUtilities.runOnUIThread(() -> { AndroidUtilities.runOnUIThread(() -> {
loadingInBackground = false; loadingInBackground = false;
if (!secondLoadingInBackground && destroyAfterLoading) { if (!secondLoadingInBackground && destroyAfterLoading) {
recycle(); recycle(true);
} }
}); });
return; return;
@ -240,7 +240,7 @@ public class SlotsDrawable extends RLottieDrawable {
AndroidUtilities.runOnUIThread(() -> { AndroidUtilities.runOnUIThread(() -> {
loadingInBackground = false; loadingInBackground = false;
if (!secondLoadingInBackground && destroyAfterLoading) { if (!secondLoadingInBackground && destroyAfterLoading) {
recycle(); recycle(true);
return; return;
} }
nativePtr = nativePtrs[0]; nativePtr = nativePtrs[0];
@ -268,7 +268,7 @@ public class SlotsDrawable extends RLottieDrawable {
AndroidUtilities.runOnUIThread(() -> { AndroidUtilities.runOnUIThread(() -> {
secondLoadingInBackground = false; secondLoadingInBackground = false;
if (!loadingInBackground && destroyAfterLoading) { if (!loadingInBackground && destroyAfterLoading) {
recycle(); recycle(true);
} }
}); });
return; return;
@ -359,7 +359,7 @@ public class SlotsDrawable extends RLottieDrawable {
} }
secondLoadingInBackground = false; secondLoadingInBackground = false;
if (!loadingInBackground && destroyAfterLoading) { if (!loadingInBackground && destroyAfterLoading) {
recycle(); recycle(true);
return; return;
} }
secondNativePtr = secondNativePtrs[0]; secondNativePtr = secondNativePtrs[0];
@ -373,7 +373,7 @@ public class SlotsDrawable extends RLottieDrawable {
} }
@Override @Override
public void recycle() { public void recycle(boolean uiThread) {
isRunning = false; isRunning = false;
isRecycled = true; isRecycled = true;
checkRunningTasks(); checkRunningTasks();

View file

@ -234,9 +234,18 @@ public class TranslateButton extends FrameLayout {
RestrictedLanguagesSelectActivity.toggleLanguage(detectedLanguage, true); RestrictedLanguagesSelectActivity.toggleLanguage(detectedLanguage, true);
translateController.checkRestrictedLanguagesUpdate(); translateController.checkRestrictedLanguagesUpdate();
translateController.setHideTranslateDialog(dialogId, true); translateController.setHideTranslateDialog(dialogId, true);
BulletinFactory.of(fragment).createSimpleBulletin(R.raw.msg_translate, AndroidUtilities.replaceTags(LocaleController.formatString("AddedToDoNotTranslate", R.string.AddedToDoNotTranslate, TranslateAlert2.capitalFirst(detectedLanguageName))), LocaleController.getString("Settings", R.string.Settings), () -> { String bulletinText;
fragment.presentFragment(new RestrictedLanguagesSelectActivity()); if (accusative[0]) {
}).show(); bulletinText = LocaleController.formatString("AddedToDoNotTranslate", R.string.AddedToDoNotTranslate, TranslateAlert2.capitalFirst(detectedLanguageNameAccusative));
} else {
bulletinText = LocaleController.formatString("AddedToDoNotTranslateOther", R.string.AddedToDoNotTranslateOther, TranslateAlert2.capitalFirst(detectedLanguageNameAccusative));
}
BulletinFactory.of(fragment).createSimpleBulletin(
R.raw.msg_translate,
bulletinText,
LocaleController.getString("Settings", R.string.Settings),
() -> fragment.presentFragment(new RestrictedLanguagesSelectActivity())
).show();
popupWindow.dismiss(); popupWindow.dismiss();
}); });
popupLayout.addView(dontTranslateButton); popupLayout.addView(dontTranslateButton);

View file

@ -938,7 +938,7 @@ public class ContactsActivity extends BaseFragment implements NotificationCenter
} }
} else if (id == NotificationCenter.closeChats) { } else if (id == NotificationCenter.closeChats) {
if (!creatingChat) { if (!creatingChat) {
removeSelfFromStack(); removeSelfFromStack(true);
} }
} }
} }

View file

@ -89,7 +89,7 @@ public class DialogOrContactPickerActivity extends BaseFragment {
args.putBoolean("resetDelegate", false); args.putBoolean("resetDelegate", false);
args.putInt("dialogsType", DialogsActivity.DIALOGS_TYPE_BLOCK); args.putInt("dialogsType", DialogsActivity.DIALOGS_TYPE_BLOCK);
dialogsActivity = new DialogsActivity(args); dialogsActivity = new DialogsActivity(args);
dialogsActivity.setDelegate((fragment, dids, message, param) -> { dialogsActivity.setDelegate((fragment, dids, message, param, topicsFragment) -> {
if (dids.isEmpty()) { if (dids.isEmpty()) {
return true; return true;
} }

View file

@ -2201,7 +2201,7 @@ public class DialogsActivity extends BaseFragment implements NotificationCenter.
} }
public interface DialogsActivityDelegate { public interface DialogsActivityDelegate {
boolean didSelectDialogs(DialogsActivity fragment, ArrayList<MessagesStorage.TopicKey> dids, CharSequence message, boolean param); boolean didSelectDialogs(DialogsActivity fragment, ArrayList<MessagesStorage.TopicKey> dids, CharSequence message, boolean param, TopicsFragment topicsFragment);
} }
public DialogsActivity(Bundle args) { public DialogsActivity(Bundle args) {
@ -3380,7 +3380,7 @@ public class DialogsActivity extends BaseFragment implements NotificationCenter.
if (closeFragment) { if (closeFragment) {
removeSelfFromStack(); removeSelfFromStack();
} }
dialogsActivityDelegate.didSelectDialogs(DialogsActivity.this, arrayList, null, true); dialogsActivityDelegate.didSelectDialogs(DialogsActivity.this, arrayList, null, true, null);
} }
@Override @Override
@ -3850,7 +3850,7 @@ public class DialogsActivity extends BaseFragment implements NotificationCenter.
for (int i = 0; i < selectedDialogs.size(); i++) { for (int i = 0; i < selectedDialogs.size(); i++) {
topicKeys.add(MessagesStorage.TopicKey.of(selectedDialogs.get(i), 0)); topicKeys.add(MessagesStorage.TopicKey.of(selectedDialogs.get(i), 0));
} }
delegate.didSelectDialogs(DialogsActivity.this, topicKeys, null, false); delegate.didSelectDialogs(DialogsActivity.this, topicKeys, null, false, null);
} else { } else {
if (floatingButton.getVisibility() != View.VISIBLE) { if (floatingButton.getVisibility() != View.VISIBLE) {
return; return;
@ -3989,7 +3989,7 @@ public class DialogsActivity extends BaseFragment implements NotificationCenter.
for (int i = 0; i < selectedDialogs.size(); i++) { for (int i = 0; i < selectedDialogs.size(); i++) {
topicKeys.add(MessagesStorage.TopicKey.of(selectedDialogs.get(i), 0)); topicKeys.add(MessagesStorage.TopicKey.of(selectedDialogs.get(i), 0));
} }
delegate.didSelectDialogs(DialogsActivity.this, topicKeys, message, false); delegate.didSelectDialogs(DialogsActivity.this, topicKeys, message, false, null);
} }
@Override @Override
@ -4182,7 +4182,7 @@ public class DialogsActivity extends BaseFragment implements NotificationCenter.
for (int i = 0; i < selectedDialogs.size(); i++) { for (int i = 0; i < selectedDialogs.size(); i++) {
topicKeys.add(MessagesStorage.TopicKey.of(selectedDialogs.get(i), 0)); topicKeys.add(MessagesStorage.TopicKey.of(selectedDialogs.get(i), 0));
} }
delegate.didSelectDialogs(DialogsActivity.this, topicKeys, commentView.getFieldText(), false); delegate.didSelectDialogs(DialogsActivity.this, topicKeys, commentView.getFieldText(), false, null);
}); });
writeButtonBackground.setOnLongClickListener(v -> { writeButtonBackground.setOnLongClickListener(v -> {
if (isNextButton) { if (isNextButton) {
@ -4834,7 +4834,7 @@ public class DialogsActivity extends BaseFragment implements NotificationCenter.
if (delegate != null) { if (delegate != null) {
ArrayList<MessagesStorage.TopicKey> keys = new ArrayList<>(); ArrayList<MessagesStorage.TopicKey> keys = new ArrayList<>();
keys.add(MessagesStorage.TopicKey.of(-chatId, 0)); keys.add(MessagesStorage.TopicKey.of(-chatId, 0));
delegate.didSelectDialogs(DialogsActivity.this, keys, null, false); delegate.didSelectDialogs(DialogsActivity.this, keys, null, false, null);
} }
} }
); );
@ -4935,7 +4935,7 @@ public class DialogsActivity extends BaseFragment implements NotificationCenter.
if (delegate != null) { if (delegate != null) {
ArrayList<MessagesStorage.TopicKey> keys = new ArrayList<>(); ArrayList<MessagesStorage.TopicKey> keys = new ArrayList<>();
keys.add(MessagesStorage.TopicKey.of(-chatId, 0)); keys.add(MessagesStorage.TopicKey.of(-chatId, 0));
delegate.didSelectDialogs(DialogsActivity.this, keys, null, false); delegate.didSelectDialogs(DialogsActivity.this, keys, null, false, null);
} }
} }
); );
@ -5262,6 +5262,7 @@ public class DialogsActivity extends BaseFragment implements NotificationCenter.
int[] position = new int[2]; int[] position = new int[2];
passcodeItem.getLocationInWindow(position); passcodeItem.getLocationInWindow(position);
((LaunchActivity) getParentActivity()).showPasscodeActivity(false, true, position[0] + passcodeItem.getMeasuredWidth() / 2, position[1] + passcodeItem.getMeasuredHeight() / 2, () -> passcodeItem.setAlpha(1.0f), () -> passcodeItem.setAlpha(0.0f)); ((LaunchActivity) getParentActivity()).showPasscodeActivity(false, true, position[0] + passcodeItem.getMeasuredWidth() / 2, position[1] + passcodeItem.getMeasuredHeight() / 2, () -> passcodeItem.setAlpha(1.0f), () -> passcodeItem.setAlpha(0.0f));
getNotificationsController().showNotifications();
updatePasscodeButton(); updatePasscodeButton();
} else if (id == 2) { } else if (id == 2) {
presentFragment(new ProxyListActivity()); presentFragment(new ProxyListActivity());
@ -9509,6 +9510,10 @@ public class DialogsActivity extends BaseFragment implements NotificationCenter.
} }
public void didSelectResult(final long dialogId, int topicId, boolean useAlert, final boolean param) { public void didSelectResult(final long dialogId, int topicId, boolean useAlert, final boolean param) {
didSelectResult(dialogId, topicId, useAlert, param, null);
}
public void didSelectResult(final long dialogId, int topicId, boolean useAlert, final boolean param, TopicsFragment topicsFragment) {
if (!checkCanWrite(dialogId)) { if (!checkCanWrite(dialogId)) {
return; return;
} }
@ -9549,7 +9554,7 @@ public class DialogsActivity extends BaseFragment implements NotificationCenter.
setDialogsListFrozen(true); setDialogsListFrozen(true);
ArrayList<MessagesStorage.TopicKey> dids = new ArrayList<>(); ArrayList<MessagesStorage.TopicKey> dids = new ArrayList<>();
dids.add(MessagesStorage.TopicKey.of(dialogId, 0)); dids.add(MessagesStorage.TopicKey.of(dialogId, 0));
delegate.didSelectDialogs(DialogsActivity.this, dids, null, param); delegate.didSelectDialogs(DialogsActivity.this, dids, null, param, null);
}); });
} else { } else {
AlertsCreator.processError(currentAccount, error, this, req); AlertsCreator.processError(currentAccount, error, this, req);
@ -9617,7 +9622,7 @@ public class DialogsActivity extends BaseFragment implements NotificationCenter.
} }
builder.setTitle(title); builder.setTitle(title);
builder.setMessage(AndroidUtilities.replaceTags(message)); builder.setMessage(AndroidUtilities.replaceTags(message));
builder.setPositiveButton(buttonText, (dialogInterface, i) -> didSelectResult(dialogId, topicId,false, false)); builder.setPositiveButton(buttonText, (dialogInterface, i) -> didSelectResult(dialogId, topicId,false, false, topicsFragment));
builder.setNegativeButton(LocaleController.getString("Cancel", R.string.Cancel), null); builder.setNegativeButton(LocaleController.getString("Cancel", R.string.Cancel), null);
showDialog(builder.create()); showDialog(builder.create());
} else if (initialDialogsType == DIALOGS_TYPE_BOT_REQUEST_PEER) { } else if (initialDialogsType == DIALOGS_TYPE_BOT_REQUEST_PEER) {
@ -9625,7 +9630,7 @@ public class DialogsActivity extends BaseFragment implements NotificationCenter.
if (delegate != null) { if (delegate != null) {
ArrayList<MessagesStorage.TopicKey> dids = new ArrayList<>(); ArrayList<MessagesStorage.TopicKey> dids = new ArrayList<>();
dids.add(MessagesStorage.TopicKey.of(dialogId, topicId)); dids.add(MessagesStorage.TopicKey.of(dialogId, topicId));
delegate.didSelectDialogs(DialogsActivity.this, dids, null, param); delegate.didSelectDialogs(DialogsActivity.this, dids, null, param, topicsFragment);
if (resetDelegate) { if (resetDelegate) {
delegate = null; delegate = null;
} }
@ -9653,7 +9658,7 @@ public class DialogsActivity extends BaseFragment implements NotificationCenter.
if (delegate != null) { if (delegate != null) {
ArrayList<MessagesStorage.TopicKey> dids = new ArrayList<>(); ArrayList<MessagesStorage.TopicKey> dids = new ArrayList<>();
dids.add(MessagesStorage.TopicKey.of(dialogId, topicId)); dids.add(MessagesStorage.TopicKey.of(dialogId, topicId));
boolean res = delegate.didSelectDialogs(DialogsActivity.this, dids, null, param); boolean res = delegate.didSelectDialogs(DialogsActivity.this, dids, null, param, topicsFragment);
if (res && resetDelegate) { if (res && resetDelegate) {
delegate = null; delegate = null;
} }
@ -9767,7 +9772,7 @@ public class DialogsActivity extends BaseFragment implements NotificationCenter.
for (int i = 0; i < selectedDialogs.size(); i++) { for (int i = 0; i < selectedDialogs.size(); i++) {
topicKeys.add(MessagesStorage.TopicKey.of(selectedDialogs.get(i), 0)); topicKeys.add(MessagesStorage.TopicKey.of(selectedDialogs.get(i), 0));
} }
delegate.didSelectDialogs(DialogsActivity.this, topicKeys, commentView.getFieldText(), false); delegate.didSelectDialogs(DialogsActivity.this, topicKeys, commentView.getFieldText(), false, null);
}); });
layout.addView(sendPopupLayout2, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT)); layout.addView(sendPopupLayout2, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT));

View file

@ -31,7 +31,7 @@ public class FeedWidgetConfigActivity extends ExternalActionActivity {
args.putBoolean("allowSwitchAccount", true); args.putBoolean("allowSwitchAccount", true);
args.putBoolean("checkCanWrite", false); args.putBoolean("checkCanWrite", false);
DialogsActivity fragment = new DialogsActivity(args); DialogsActivity fragment = new DialogsActivity(args);
fragment.setDelegate((fragment1, dids, message, param) -> { fragment.setDelegate((fragment1, dids, message, param, topicsFragment) -> {
AccountInstance.getInstance(fragment1.getCurrentAccount()).getMessagesStorage().putWidgetDialogs(creatingAppWidgetId, dids); AccountInstance.getInstance(fragment1.getCurrentAccount()).getMessagesStorage().putWidgetDialogs(creatingAppWidgetId, dids);
SharedPreferences preferences = FeedWidgetConfigActivity.this.getSharedPreferences("shortcut_widget", Activity.MODE_PRIVATE); SharedPreferences preferences = FeedWidgetConfigActivity.this.getSharedPreferences("shortcut_widget", Activity.MODE_PRIVATE);

View file

@ -98,7 +98,7 @@ public class KeepMediaPopupView extends ActionBarPopupWindow.ActionBarPopupWindo
} }
args.putBoolean("allowGlobalSearch", false); args.putBoolean("allowGlobalSearch", false);
DialogsActivity activity = new DialogsActivity(args); DialogsActivity activity = new DialogsActivity(args);
activity.setDelegate((fragment, dids, message, param) -> { activity.setDelegate((fragment, dids, message, param, topicsFragment) -> {
CacheByChatsController.KeepMediaException newException = null; CacheByChatsController.KeepMediaException newException = null;
for (int i = 0; i < dids.size(); i++) { for (int i = 0; i < dids.size(); i++) {
exceptions.add(newException = new CacheByChatsController.KeepMediaException(dids.get(i).dialogId, CacheByChatsController.KEEP_MEDIA_ONE_DAY)); exceptions.add(newException = new CacheByChatsController.KeepMediaException(dids.get(i).dialogId, CacheByChatsController.KEEP_MEDIA_ONE_DAY));

View file

@ -1078,7 +1078,7 @@ public class LNavigation extends FrameLayout implements INavigationLayout, Float
} }
@Override @Override
public void removeFragmentFromStack(BaseFragment fragment) { public void removeFragmentFromStack(BaseFragment fragment, boolean immediate) {
int i = fragmentStack.indexOf(fragment); int i = fragmentStack.indexOf(fragment);
if (i == -1) { if (i == -1) {
return; return;

View file

@ -8,30 +8,23 @@
package org.telegram.ui; package org.telegram.ui;
import android.animation.Animator;
import android.animation.AnimatorListenerAdapter;
import android.animation.ValueAnimator;
import android.content.Context; import android.content.Context;
import android.content.DialogInterface; import android.content.DialogInterface;
import android.content.SharedPreferences; import android.content.SharedPreferences;
import android.content.res.Configuration;
import android.graphics.Canvas; import android.graphics.Canvas;
import android.graphics.drawable.Drawable;
import android.view.Gravity;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.widget.EditText; import android.widget.EditText;
import android.widget.FrameLayout; import android.widget.FrameLayout;
import android.widget.LinearLayout;
import android.widget.TextView; import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.DefaultItemAnimator; import androidx.recyclerview.widget.DefaultItemAnimator;
import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView; import androidx.recyclerview.widget.RecyclerView;
import org.telegram.messenger.AndroidUtilities; import org.telegram.messenger.AndroidUtilities;
import org.telegram.messenger.FileLog; import org.telegram.messenger.FileLog;
import org.telegram.messenger.LanguageDetector;
import org.telegram.messenger.LocaleController; import org.telegram.messenger.LocaleController;
import org.telegram.messenger.MessagesController; import org.telegram.messenger.MessagesController;
import org.telegram.messenger.NotificationCenter; import org.telegram.messenger.NotificationCenter;
@ -220,7 +213,16 @@ public class LanguageSelectActivity extends BaseFragment implements Notification
final boolean currentFullValue = getContextValue() || getChatValue(); final boolean currentFullValue = getContextValue() || getChatValue();
if (currentFullValue != prevFullValue) { if (currentFullValue != prevFullValue) {
int start = 1 + (!getMessagesController().premiumLocked ? 1 : 0); int start = 1 + (!getMessagesController().premiumLocked ? 1 : 0);
listAdapter.notifyItemChanged(start); TextCheckCell last = null;
for (int i = 0; i < listView.getChildCount(); ++i) {
View child = listView.getChildAt(i);
if (listView.getChildAdapterPosition(child) == start && child instanceof TextCheckCell) {
last = (TextCheckCell) child;
}
}
if (last != null) {
last.setDivider(currentFullValue);
}
if (currentFullValue) { if (currentFullValue) {
listAdapter.notifyItemInserted(start + 1); listAdapter.notifyItemInserted(start + 1);
} else { } else {
@ -255,11 +257,16 @@ public class LanguageSelectActivity extends BaseFragment implements Notification
boolean sameLang = prevLocale == localeInfo; boolean sameLang = prevLocale == localeInfo;
final AlertDialog progressDialog = new AlertDialog(getContext(), AlertDialog.ALERT_TYPE_SPINNER); final AlertDialog progressDialog = new AlertDialog(getContext(), AlertDialog.ALERT_TYPE_SPINNER);
int reqId = LocaleController.getInstance().applyLanguage(localeInfo, true, false, false, true, currentAccount, () -> { if (!sameLang) {
progressDialog.showDelayed(500);
}
int reqId = LocaleController.getInstance().applyLanguage(localeInfo, true, false, false, true, false, currentAccount, () -> {
progressDialog.dismiss(); progressDialog.dismiss();
if (!sameLang) { if (!sameLang) {
actionBar.closeSearchField(); AndroidUtilities.runOnUIThread(() -> {
updateLanguage(); actionBar.closeSearchField();
updateLanguage();
}, 10);
} }
}); });
if (reqId != 0) { if (reqId != 0) {
@ -276,16 +283,14 @@ public class LanguageSelectActivity extends BaseFragment implements Notification
if (selectedLanguages.contains(prevLangCode) && !selectedLanguages.contains(langCode)) { if (selectedLanguages.contains(prevLangCode) && !selectedLanguages.contains(langCode)) {
newSelectedLanguages.removeIf(s -> s != null && s.equals(prevLangCode)); newSelectedLanguages.removeIf(s -> s != null && s.equals(prevLangCode));
newSelectedLanguages.add(langCode); if (langCode != null && !"null".equals(langCode)) {
newSelectedLanguages.add(langCode);
}
} }
preferences.edit().putStringSet("translate_button_restricted_languages", newSelectedLanguages).apply(); preferences.edit().putStringSet("translate_button_restricted_languages", newSelectedLanguages).apply();
MessagesController.getInstance(currentAccount).getTranslateController().checkRestrictedLanguagesUpdate(); MessagesController.getInstance(currentAccount).getTranslateController().checkRestrictedLanguagesUpdate();
MessagesController.getInstance(currentAccount).getTranslateController().cleanup(); MessagesController.getInstance(currentAccount).getTranslateController().cleanup();
if (!sameLang) {
progressDialog.showDelayed(500);
}
TranslateController.invalidateSuggestedLanguageCodes(); TranslateController.invalidateSuggestedLanguageCodes();
} }
} catch (Exception e) { } catch (Exception e) {
@ -420,26 +425,7 @@ public class LanguageSelectActivity extends BaseFragment implements Notification
listView.setAdapter(listAdapter); listView.setAdapter(listAdapter);
} }
} else { } else {
// try { processSearch(query);
// if (searchTimer != null) {
// searchTimer.cancel();
// }
// } catch (Exception e) {
// FileLog.e(e);
// }
// searchTimer = new Timer();
// searchTimer.schedule(new TimerTask() {
// @Override
// public void run() {
// try {
// searchTimer.cancel();
// searchTimer = null;
// } catch (Exception e) {
// FileLog.e(e);
// }
processSearch(query);
// }
// }, 100, 300);
} }
} }
@ -447,15 +433,17 @@ public class LanguageSelectActivity extends BaseFragment implements Notification
if (actionBar != null) { if (actionBar != null) {
actionBar.setTitleAnimated(LocaleController.getString("Language", R.string.Language), true, 350, CubicBezierInterpolator.EASE_OUT_QUINT); actionBar.setTitleAnimated(LocaleController.getString("Language", R.string.Language), true, 350, CubicBezierInterpolator.EASE_OUT_QUINT);
} }
if (listView != null) { if (listAdapter != null) {
for (int i = 0; i < listView.getChildCount(); ++i) { listAdapter.notifyItemRangeChanged(0, listAdapter.getItemCount());
View child = listView.getChildAt(i); // for (int i = 0; i < listView.getChildCount(); ++i) {
if (child instanceof TranslateSettings || child instanceof HeaderCell) { // View child = listView.getChildAt(i);
listAdapter.notifyItemChanged(listView.getChildAdapterPosition(child)); // listAdapter.onBindViewHolder(listView.getChildViewHolder(child), listView.getChildAdapterPosition(child));
} else { // if (child instanceof TextRadioCell) {
listAdapter.onBindViewHolder(listView.getChildViewHolder(child), listView.getChildAdapterPosition(child)); // ((TextRadioCell) child).updateRTL();
} // } else if (child instanceof TextInfoPrivacyCell) {
} // ((TextInfoPrivacyCell) child).updateRTL();
// }
// }
} }
} }
@ -495,278 +483,6 @@ public class LanguageSelectActivity extends BaseFragment implements Notification
}); });
} }
private class TranslateSettings extends LinearLayout {
private SharedPreferences preferences;
private HeaderCell header;
private TextCheckCell showButtonCheck;
private TextCheckCell showChatButtonCheck;
private TextSettingsCell doNotTranslateCell;
private TextInfoPrivacyCell info;
private TextInfoPrivacyCell info2;
private ValueAnimator doNotTranslateCellAnimation = null;
// private HeaderCell header2;
// private float HEIGHT_OPEN = 243;
// private float HEIGHT_CLOSED = HEIGHT_OPEN - 50;
private Drawable topShadow, bottomShadow;
public TranslateSettings(Context context) {
super(context);
setFocusable(false);
setOrientation(VERTICAL);
topShadow = Theme.getThemedDrawable(context, R.drawable.greydivider_bottom, Theme.key_windowBackgroundGrayShadow);
bottomShadow = Theme.getThemedDrawable(context, R.drawable.greydivider_top, Theme.key_windowBackgroundGrayShadow);
preferences = MessagesController.getMainSettings(currentAccount);
header = new HeaderCell(context);
header.setFocusable(true);
header.setBackgroundColor(Theme.getColor(Theme.key_windowBackgroundWhite));
header.setText(LocaleController.getString("TranslateMessages", R.string.TranslateMessages));
header.setContentDescription(LocaleController.getString("TranslateMessages", R.string.TranslateMessages));
addView(header, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT));
final boolean value = getValue();
showButtonCheck = new TextCheckCell(context);
showButtonCheck.setBackground(Theme.createSelectorWithBackgroundDrawable(Theme.getColor(Theme.key_windowBackgroundWhite), Theme.getColor(Theme.key_listSelector)));
showButtonCheck.setTextAndCheck(
LocaleController.getString("ShowTranslateButton", R.string.ShowTranslateButton),
getContextValue(),
true
);
showButtonCheck.setOnClickListener(e -> {
getMessagesController().getTranslateController().setContextTranslateEnabled(!getContextValue());
NotificationCenter.getInstance(currentAccount).postNotificationName(NotificationCenter.updateSearchSettings);
update();
});
addView(showButtonCheck, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT));
showChatButtonCheck = new TextCheckCell(context);
showChatButtonCheck.setBackground(Theme.createSelectorWithBackgroundDrawable(Theme.getColor(Theme.key_windowBackgroundWhite), Theme.getColor(Theme.key_listSelector)));
showChatButtonCheck.setTextAndCheck(
LocaleController.getString("ShowTranslateChatButton", R.string.ShowTranslateChatButton),
getChatValue(),
value
);
showChatButtonCheck.setOnClickListener(e -> {
if (!getUserConfig().isPremium()) {
showDialog(new PremiumFeatureBottomSheet(LanguageSelectActivity.this, PremiumPreviewFragment.PREMIUM_FEATURE_TRANSLATIONS, false));
return;
}
MessagesController.getMainSettings(currentAccount).edit().putBoolean("translate_chat_button", !getChatValue()).apply();
NotificationCenter.getInstance(currentAccount).postNotificationName(NotificationCenter.updateSearchSettings);
update();
});
showChatButtonCheck.setCheckBoxIcon(!getUserConfig().isPremium() ? R.drawable.permission_locked : 0);
addView(showChatButtonCheck, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT));
doNotTranslateCell = new TextSettingsCell(context);
doNotTranslateCell.setBackground(Theme.createSelectorWithBackgroundDrawable(Theme.getColor(Theme.key_windowBackgroundWhite), Theme.getColor(Theme.key_listSelector)));
doNotTranslateCell.setOnClickListener(e -> {
presentFragment(new RestrictedLanguagesSelectActivity());
update();
});
doNotTranslateCell.setClickable(value && LanguageDetector.hasSupport());
doNotTranslateCell.setAlpha(value && LanguageDetector.hasSupport() ? 1f : 0f);
addView(doNotTranslateCell, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT));
info = new TextInfoPrivacyCell(context);
info.setTopPadding(11);
info.setBottomPadding(16);
info.setFocusable(true);
info.setText(LocaleController.getString("TranslateMessagesInfo1", R.string.TranslateMessagesInfo1));
info.setContentDescription(LocaleController.getString("TranslateMessagesInfo1", R.string.TranslateMessagesInfo1));
addView(info, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT));
info2 = new TextInfoPrivacyCell(context);
info2.setTopPadding(0);
info2.setBottomPadding(16);
info2.setFocusable(true);
info2.setText(LocaleController.getString("TranslateMessagesInfo2", R.string.TranslateMessagesInfo2));
info2.setContentDescription(LocaleController.getString("TranslateMessagesInfo2", R.string.TranslateMessagesInfo2));
info2.setAlpha(value ? 0f : 1f);
addView(info2, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT));
// header2 = new HeaderCell(context);
// header2.setBackgroundColor(Theme.getColor(Theme.key_windowBackgroundWhite));
// header2.setText(LocaleController.getString("Language", R.string.Language));
// header2.setTranslationY(-Math.max(doNotTranslateCell.getHeight(), info2.getHeight()));
// addView(header2, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT, Gravity.BOTTOM));
// setLayoutParams(new RecyclerView.LayoutParams(LayoutHelper.MATCH_PARENT, height()));
updateHeight();
update();
}
@Override
protected void dispatchDraw(Canvas canvas) {
super.dispatchDraw(canvas);
float topShadowY = Math.max(showChatButtonCheck.getY() + showChatButtonCheck.getHeight(), doNotTranslateCell.getY() + doNotTranslateCell.getHeight() * doNotTranslateCell.getAlpha());
topShadow.setBounds(0, (int) topShadowY, getWidth(), (int) (topShadowY + AndroidUtilities.dp(12)));
topShadow.draw(canvas);
float bottomShadowY = getHeight();
bottomShadow.setBounds(0, (int) (bottomShadowY - AndroidUtilities.dp(12)), getWidth(), (int) bottomShadowY);
bottomShadow.draw(canvas);
}
public void updateTranslations() {
header.setText(LocaleController.getString("TranslateMessages", R.string.TranslateMessages));
showButtonCheck.setTextAndCheck(
LocaleController.getString("ShowTranslateButton", R.string.ShowTranslateButton), getContextValue(), true
);
showChatButtonCheck.setTextAndCheck(
LocaleController.getString("ShowTranslateChatButton", R.string.ShowTranslateChatButton), getChatValue(), getValue()
);
showChatButtonCheck.setCheckBoxIcon(!getUserConfig().isPremium() ? R.drawable.permission_locked : 0);
showButtonCheck.updateRTL();
doNotTranslateCell.updateRTL();
info.setText(LocaleController.getString("TranslateMessagesInfo1", R.string.TranslateMessagesInfo1));
info.getTextView().setGravity(LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT);
info2.setText(LocaleController.getString("TranslateMessagesInfo2", R.string.TranslateMessagesInfo2));
info2.getTextView().setGravity(LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT);
update();
updateHeight();
}
private boolean getValue() {
return getContextValue() || getChatValue();
}
public void update() {
boolean value = getValue() && LanguageDetector.hasSupport();
showButtonCheck.setChecked(getContextValue());
showChatButtonCheck.setChecked(getChatValue());
if (doNotTranslateCellAnimation != null) {
doNotTranslateCellAnimation.cancel();
}
showChatButtonCheck.setDivider(value);
HashSet<String> langCodes = RestrictedLanguagesSelectActivity.getRestrictedLanguages();
final String doNotTranslateCellName = LocaleController.getString("DoNotTranslate", R.string.DoNotTranslate);
String doNotTranslateCellValue = null;
try {
if (langCodes.size() == 1) {
doNotTranslateCellValue = TranslateAlert2.capitalFirst(TranslateAlert2.languageName(langCodes.iterator().next()));
} else {
Iterator<String> iterator = langCodes.iterator();
boolean first = true;
StringBuilder string = new StringBuilder();
while (iterator.hasNext()) {
String lang = iterator.next();
if (!first) {
string.append(", ");
}
string.append(TranslateAlert2.capitalFirst(TranslateAlert2.languageName(lang)));
first = false;
}
doNotTranslateCellValue = string.toString();
if (doNotTranslateCell.getValueTextView().getPaint().measureText(doNotTranslateCellValue) >
Math.min((AndroidUtilities.displaySize.x - AndroidUtilities.dp(34)) / 2f, AndroidUtilities.displaySize.x - AndroidUtilities.dp(21 * 4) - doNotTranslateCell.getTextView().getPaint().measureText(doNotTranslateCellName))) {
doNotTranslateCellValue = null;
}
}
} catch (Exception ignore) {}
if (doNotTranslateCellValue == null)
doNotTranslateCellValue = String.format(LocaleController.getPluralString("Languages", langCodes.size()), langCodes.size());
doNotTranslateCell.setTextAndValue(doNotTranslateCellName, doNotTranslateCellValue, false, false);
doNotTranslateCell.setClickable(value);
info2.setVisibility(View.VISIBLE);
doNotTranslateCellAnimation = ValueAnimator.ofFloat(doNotTranslateCell.getAlpha(), value ? 1f : 0f);
doNotTranslateCellAnimation.setInterpolator(CubicBezierInterpolator.DEFAULT);
doNotTranslateCellAnimation.addUpdateListener(a -> {
float t = (float) a.getAnimatedValue();
doNotTranslateCell.setAlpha(t);
doNotTranslateCell.setTranslationY(-AndroidUtilities.dp(8) * (1f - t));
info.setTranslationY(-doNotTranslateCell.getHeight() * (1f - t));
t = 1f;
info2.setAlpha(1f - t);
info2.setTranslationY(-doNotTranslateCell.getHeight() * (1f - t));
translateSettingsBackgroundHeight = header.getMeasuredHeight() + showButtonCheck.getMeasuredHeight() + (int) (doNotTranslateCell.getAlpha() * doNotTranslateCell.getMeasuredHeight());
invalidate();
});
doNotTranslateCellAnimation.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
super.onAnimationEnd(animation);
if (doNotTranslateCell.getAlpha() > .5) {
info2.setVisibility(View.GONE);
} else {
info2.setVisibility(View.VISIBLE);
}
translateSettingsBackgroundHeight = header.getMeasuredHeight() + showButtonCheck.getMeasuredHeight() + (int) (doNotTranslateCell.getAlpha() * doNotTranslateCell.getMeasuredHeight());
invalidate();
}
});
doNotTranslateCellAnimation.setDuration((long) (Math.abs(doNotTranslateCell.getAlpha() - (value ? 1f : 0f)) * 200));
doNotTranslateCellAnimation.start();
// updateHeight();
}
@Override
protected void onConfigurationChanged(Configuration newConfig) {
super.onConfigurationChanged(newConfig);
updateHeight();
}
@Override
protected void onLayout(boolean changed, int l, int t, int r, int b) {
updateHeight();
super.onLayout(changed, l, t, r, b);
}
void updateHeight() {
header.measure(MeasureSpec.makeMeasureSpec(AndroidUtilities.displaySize.x, MeasureSpec.EXACTLY), MeasureSpec.UNSPECIFIED);
showButtonCheck.measure(MeasureSpec.makeMeasureSpec(AndroidUtilities.displaySize.x, MeasureSpec.EXACTLY), MeasureSpec.UNSPECIFIED);
showChatButtonCheck.measure(MeasureSpec.makeMeasureSpec(AndroidUtilities.displaySize.x, MeasureSpec.EXACTLY), MeasureSpec.UNSPECIFIED);
doNotTranslateCell.measure(MeasureSpec.makeMeasureSpec(AndroidUtilities.displaySize.x, MeasureSpec.EXACTLY), MeasureSpec.UNSPECIFIED);
info.measure(MeasureSpec.makeMeasureSpec(AndroidUtilities.displaySize.x, MeasureSpec.EXACTLY), MeasureSpec.UNSPECIFIED);
info2.measure(MeasureSpec.makeMeasureSpec(AndroidUtilities.displaySize.x, MeasureSpec.EXACTLY), MeasureSpec.UNSPECIFIED);
int newHeight = searching ? 0 : height();
if (getLayoutParams() == null) {
setLayoutParams(new RecyclerView.LayoutParams(LayoutHelper.MATCH_PARENT, newHeight));
} else if (getLayoutParams().height != newHeight) {
RecyclerView.LayoutParams lp = (RecyclerView.LayoutParams) getLayoutParams();
lp.height = newHeight;
setLayoutParams(lp);
}
invalidate();
}
int height() {
return Math.max(AndroidUtilities.dp(40), header.getMeasuredHeight()) +
Math.max(AndroidUtilities.dp(50), showButtonCheck.getMeasuredHeight()) +
Math.max(AndroidUtilities.dp(50), showChatButtonCheck.getMeasuredHeight()) +
Math.max(Math.max(AndroidUtilities.dp(50), doNotTranslateCell.getMeasuredHeight()), (info2.getMeasuredHeight() <= 0 ? AndroidUtilities.dp(51) : info2.getMeasuredHeight())) +
(info.getMeasuredHeight() <= 0 ? AndroidUtilities.dp(62) : info.getMeasuredHeight());/* + header2.getHeight()*/
}
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
updateHeight();
}
@Override
protected void onAttachedToWindow() {
super.onAttachedToWindow();
update();
updateHeight();
}
}
private boolean getContextValue() { private boolean getContextValue() {
return getMessagesController().getTranslateController().isContextTranslateEnabled(); return getMessagesController().getTranslateController().isContextTranslateEnabled();
} }
@ -854,6 +570,13 @@ public class LanguageSelectActivity extends BaseFragment implements Notification
return new RecyclerListView.Holder(view); return new RecyclerListView.Holder(view);
} }
@Override
public void onViewAttachedToWindow(@NonNull RecyclerView.ViewHolder holder) {
if (holder.itemView instanceof TextRadioCell) {
((TextRadioCell) holder.itemView).updateRTL();
}
}
@Override @Override
public void onBindViewHolder(RecyclerView.ViewHolder holder, int position) { public void onBindViewHolder(RecyclerView.ViewHolder holder, int position) {
switch (holder.getItemViewType()) { switch (holder.getItemViewType()) {
@ -862,6 +585,7 @@ public class LanguageSelectActivity extends BaseFragment implements Notification
position -= (7 - (!(getChatValue() || getContextValue()) ? 1 : 0) - (getMessagesController().premiumLocked ? 1 : 0)); position -= (7 - (!(getChatValue() || getContextValue()) ? 1 : 0) - (getMessagesController().premiumLocked ? 1 : 0));
} }
TextRadioCell textSettingsCell = (TextRadioCell) holder.itemView; TextRadioCell textSettingsCell = (TextRadioCell) holder.itemView;
textSettingsCell.updateRTL();
LocaleController.LocaleInfo localeInfo = null; LocaleController.LocaleInfo localeInfo = null;
boolean last; boolean last;
if (search) { if (search) {
@ -904,6 +628,7 @@ public class LanguageSelectActivity extends BaseFragment implements Notification
} }
case VIEW_TYPE_SETTINGS: { case VIEW_TYPE_SETTINGS: {
TextSettingsCell settingsCell = (TextSettingsCell) holder.itemView; TextSettingsCell settingsCell = (TextSettingsCell) holder.itemView;
settingsCell.updateRTL();
HashSet<String> langCodes = RestrictedLanguagesSelectActivity.getRestrictedLanguages(); HashSet<String> langCodes = RestrictedLanguagesSelectActivity.getRestrictedLanguages();
final String doNotTranslateCellName = LocaleController.getString("DoNotTranslate", R.string.DoNotTranslate); final String doNotTranslateCellName = LocaleController.getString("DoNotTranslate", R.string.DoNotTranslate);
String doNotTranslateCellValue = null; String doNotTranslateCellValue = null;
@ -920,8 +645,11 @@ public class LanguageSelectActivity extends BaseFragment implements Notification
if (!first) { if (!first) {
string.append(", "); string.append(", ");
} }
string.append(TranslateAlert2.capitalFirst(TranslateAlert2.languageName(lang, accusative))); String langName = TranslateAlert2.capitalFirst(TranslateAlert2.languageName(lang, accusative));
first = false; if (langName != null) {
string.append(langName);
first = false;
}
} }
doNotTranslateCellValue = string.toString(); doNotTranslateCellValue = string.toString();
if (settingsCell.getValueTextView().getPaint().measureText(doNotTranslateCellValue) > Math.min((AndroidUtilities.displaySize.x - AndroidUtilities.dp(34)) / 2f, AndroidUtilities.displaySize.x - AndroidUtilities.dp(21 * 4) - settingsCell.getTextView().getPaint().measureText(doNotTranslateCellName))) { if (settingsCell.getValueTextView().getPaint().measureText(doNotTranslateCellValue) > Math.min((AndroidUtilities.displaySize.x - AndroidUtilities.dp(34)) / 2f, AndroidUtilities.displaySize.x - AndroidUtilities.dp(21 * 4) - settingsCell.getTextView().getPaint().measureText(doNotTranslateCellName))) {
@ -937,6 +665,7 @@ public class LanguageSelectActivity extends BaseFragment implements Notification
} }
case VIEW_TYPE_SWITCH: { case VIEW_TYPE_SWITCH: {
TextCheckCell cell = (TextCheckCell) holder.itemView; TextCheckCell cell = (TextCheckCell) holder.itemView;
cell.updateRTL();
if (position == 1) { if (position == 1) {
cell.setTextAndCheck(LocaleController.getString("ShowTranslateButton", R.string.ShowTranslateButton), getContextValue(), true); cell.setTextAndCheck(LocaleController.getString("ShowTranslateButton", R.string.ShowTranslateButton), getContextValue(), true);
} else if (position == 2) { } else if (position == 2) {
@ -947,6 +676,7 @@ public class LanguageSelectActivity extends BaseFragment implements Notification
} }
case VIEW_TYPE_INFO: { case VIEW_TYPE_INFO: {
TextInfoPrivacyCell infoCell = (TextInfoPrivacyCell) holder.itemView; TextInfoPrivacyCell infoCell = (TextInfoPrivacyCell) holder.itemView;
infoCell.updateRTL();
if (position == (getContextValue() || getChatValue() ? 4 : 3)) { if (position == (getContextValue() || getChatValue() ? 4 : 3)) {
infoCell.setText(LocaleController.getString("TranslateMessagesInfo1", R.string.TranslateMessagesInfo1)); infoCell.setText(LocaleController.getString("TranslateMessagesInfo1", R.string.TranslateMessagesInfo1));
infoCell.setBackground(Theme.getThemedDrawable(mContext, R.drawable.greydivider_bottom, Theme.key_windowBackgroundGrayShadow)); infoCell.setBackground(Theme.getThemedDrawable(mContext, R.drawable.greydivider_bottom, Theme.key_windowBackgroundGrayShadow));

View file

@ -50,7 +50,6 @@ import android.text.TextPaint;
import android.text.TextUtils; import android.text.TextUtils;
import android.text.style.ClickableSpan; import android.text.style.ClickableSpan;
import android.util.Base64; import android.util.Base64;
import android.util.Log;
import android.util.SparseArray; import android.util.SparseArray;
import android.util.SparseIntArray; import android.util.SparseIntArray;
import android.util.TypedValue; import android.util.TypedValue;
@ -88,11 +87,11 @@ import com.google.firebase.appindexing.Action;
import com.google.firebase.appindexing.FirebaseUserActions; import com.google.firebase.appindexing.FirebaseUserActions;
import com.google.firebase.appindexing.builders.AssistActionBuilder; import com.google.firebase.appindexing.builders.AssistActionBuilder;
import org.telegram.messenger.BackupAgent;
import org.telegram.PhoneFormat.PhoneFormat; import org.telegram.PhoneFormat.PhoneFormat;
import org.telegram.messenger.AccountInstance; import org.telegram.messenger.AccountInstance;
import org.telegram.messenger.AndroidUtilities; import org.telegram.messenger.AndroidUtilities;
import org.telegram.messenger.ApplicationLoader; import org.telegram.messenger.ApplicationLoader;
import org.telegram.messenger.BackupAgent;
import org.telegram.messenger.BotWebViewVibrationEffect; import org.telegram.messenger.BotWebViewVibrationEffect;
import org.telegram.messenger.BuildVars; import org.telegram.messenger.BuildVars;
import org.telegram.messenger.ChatObject; import org.telegram.messenger.ChatObject;
@ -112,6 +111,7 @@ import org.telegram.messenger.MessageObject;
import org.telegram.messenger.MessagesController; import org.telegram.messenger.MessagesController;
import org.telegram.messenger.MessagesStorage; import org.telegram.messenger.MessagesStorage;
import org.telegram.messenger.NotificationCenter; import org.telegram.messenger.NotificationCenter;
import org.telegram.messenger.NotificationsController;
import org.telegram.messenger.PushListenerController; import org.telegram.messenger.PushListenerController;
import org.telegram.messenger.R; import org.telegram.messenger.R;
import org.telegram.messenger.SendMessagesHelper; import org.telegram.messenger.SendMessagesHelper;
@ -1564,11 +1564,21 @@ public class LaunchActivity extends BasePermissionsActivity implements INavigati
rightActionBarLayout.getView().setVisibility(View.VISIBLE); rightActionBarLayout.getView().setVisibility(View.VISIBLE);
} }
NotificationCenter.getGlobalInstance().postNotificationName(NotificationCenter.passcodeDismissed, view); NotificationCenter.getGlobalInstance().postNotificationName(NotificationCenter.passcodeDismissed, view);
try {
NotificationsController.getInstance(UserConfig.selectedAccount).showNotifications();
} catch (Exception e) {
FileLog.e(e);
}
}; };
passcodeView.setDelegate(delegate); passcodeView.setDelegate(delegate);
for (PasscodeView overlay : overlayPasscodeViews) { for (PasscodeView overlay : overlayPasscodeViews) {
overlay.setDelegate(delegate); overlay.setDelegate(delegate);
} }
try {
NotificationsController.getInstance(UserConfig.selectedAccount).showNotifications();
} catch (Exception e) {
FileLog.e(e);
}
} }
public boolean allowShowFingerprintDialog(PasscodeView passcodeView) { public boolean allowShowFingerprintDialog(PasscodeView passcodeView) {
@ -2774,7 +2784,7 @@ public class LaunchActivity extends BasePermissionsActivity implements INavigati
} else { } else {
ArrayList<MessagesStorage.TopicKey> dids = new ArrayList<>(); ArrayList<MessagesStorage.TopicKey> dids = new ArrayList<>();
dids.add(MessagesStorage.TopicKey.of(dialogId, 0)); dids.add(MessagesStorage.TopicKey.of(dialogId, 0));
didSelectDialogs(null, dids, null, false); didSelectDialogs(null, dids, null, false, null);
} }
} else if (open_settings != 0) { } else if (open_settings != 0) {
BaseFragment fragment; BaseFragment fragment;
@ -3505,7 +3515,7 @@ public class LaunchActivity extends BasePermissionsActivity implements INavigati
args.putBoolean("allowBots", chooserTargets.contains("bots")); args.putBoolean("allowBots", chooserTargets.contains("bots"));
dialogsActivity = new DialogsActivity(args); dialogsActivity = new DialogsActivity(args);
dialogsActivity.setDelegate((fragment, dids, message1, param) -> { dialogsActivity.setDelegate((fragment, dids, message1, param, topicsFragment) -> {
long did = dids.get(0).dialogId; long did = dids.get(0).dialogId;
Bundle args1 = new Bundle(); Bundle args1 = new Bundle();
@ -3615,7 +3625,7 @@ public class LaunchActivity extends BasePermissionsActivity implements INavigati
args.putString("selectAlertString", LocaleController.getString("SendGameToText", R.string.SendGameToText)); args.putString("selectAlertString", LocaleController.getString("SendGameToText", R.string.SendGameToText));
args.putString("selectAlertStringGroup", LocaleController.getString("SendGameToGroupText", R.string.SendGameToGroupText)); args.putString("selectAlertStringGroup", LocaleController.getString("SendGameToGroupText", R.string.SendGameToGroupText));
DialogsActivity fragment = new DialogsActivity(args); DialogsActivity fragment = new DialogsActivity(args);
fragment.setDelegate((fragment1, dids, message1, param) -> { fragment.setDelegate((fragment1, dids, message1, param, topicsFragment) -> {
long did = dids.get(0).dialogId; long did = dids.get(0).dialogId;
TLRPC.TL_inputMediaGame inputMediaGame = new TLRPC.TL_inputMediaGame(); TLRPC.TL_inputMediaGame inputMediaGame = new TLRPC.TL_inputMediaGame();
inputMediaGame.id = new TLRPC.TL_inputGameShortName(); inputMediaGame.id = new TLRPC.TL_inputGameShortName();
@ -3684,7 +3694,7 @@ public class LaunchActivity extends BasePermissionsActivity implements INavigati
final String botHash = TextUtils.isEmpty(botChat) ? (TextUtils.isEmpty(botChannel) ? null : botChannel) : botChat; final String botHash = TextUtils.isEmpty(botChat) ? (TextUtils.isEmpty(botChannel) ? null : botChannel) : botChat;
// args.putString("addToGroupAlertString", LocaleController.formatString("AddToTheGroupAlertText", R.string.AddToTheGroupAlertText, UserObject.getUserName(user), "%1$s")); // args.putString("addToGroupAlertString", LocaleController.formatString("AddToTheGroupAlertText", R.string.AddToTheGroupAlertText, UserObject.getUserName(user), "%1$s"));
DialogsActivity fragment = new DialogsActivity(args); DialogsActivity fragment = new DialogsActivity(args);
fragment.setDelegate((fragment12, dids, message1, param) -> { fragment.setDelegate((fragment12, dids, message1, param, topicsFragment) -> {
long did = dids.get(0).dialogId; long did = dids.get(0).dialogId;
TLRPC.Chat chat = MessagesController.getInstance(currentAccount).getChat(-did); TLRPC.Chat chat = MessagesController.getInstance(currentAccount).getChat(-did);
@ -4163,7 +4173,7 @@ public class LaunchActivity extends BasePermissionsActivity implements INavigati
args.putBoolean("onlySelect", true); args.putBoolean("onlySelect", true);
args.putInt("dialogsType", DialogsActivity.DIALOGS_TYPE_FORWARD); args.putInt("dialogsType", DialogsActivity.DIALOGS_TYPE_FORWARD);
DialogsActivity fragment = new DialogsActivity(args); DialogsActivity fragment = new DialogsActivity(args);
fragment.setDelegate((fragment13, dids, m, param) -> { fragment.setDelegate((fragment13, dids, m, param, topicsFragment) -> {
long did = dids.get(0).dialogId; long did = dids.get(0).dialogId;
Bundle args13 = new Bundle(); Bundle args13 = new Bundle();
args13.putBoolean("scrollToTopOnResume", true); args13.putBoolean("scrollToTopOnResume", true);
@ -4921,7 +4931,7 @@ public class LaunchActivity extends BasePermissionsActivity implements INavigati
} }
@Override @Override
public boolean didSelectDialogs(DialogsActivity dialogsFragment, ArrayList<MessagesStorage.TopicKey> dids, CharSequence message, boolean param) { public boolean didSelectDialogs(DialogsActivity dialogsFragment, ArrayList<MessagesStorage.TopicKey> dids, CharSequence message, boolean param, TopicsFragment topicsFragment) {
final int account = dialogsFragment != null ? dialogsFragment.getCurrentAccount() : currentAccount; final int account = dialogsFragment != null ? dialogsFragment.getCurrentAccount() : currentAccount;
if (exportingChatUri != null) { if (exportingChatUri != null) {
@ -5016,7 +5026,12 @@ public class LaunchActivity extends BasePermissionsActivity implements INavigati
} }
} }
if (topicsFragment != null) {
topicsFragment.removeSelfFromStack();
}
boolean presentedFragmentWithRemoveLast = false;
if (contactsToSend != null && contactsToSend.size() == 1 && !mainFragmentsStack.isEmpty()) { if (contactsToSend != null && contactsToSend.size() == 1 && !mainFragmentsStack.isEmpty()) {
presentedFragmentWithRemoveLast = true;
PhonebookShareAlert alert = new PhonebookShareAlert(mainFragmentsStack.get(mainFragmentsStack.size() - 1), null, null, contactsToSendUri, null, null, null); PhonebookShareAlert alert = new PhonebookShareAlert(mainFragmentsStack.get(mainFragmentsStack.size() - 1), null, null, contactsToSendUri, null, null, null);
alert.setDelegate((user, notify2, scheduleDate) -> { alert.setDelegate((user, notify2, scheduleDate) -> {
if (fragment != null) { if (fragment != null) {
@ -5025,7 +5040,17 @@ public class LaunchActivity extends BasePermissionsActivity implements INavigati
AccountInstance accountInstance = AccountInstance.getInstance(UserConfig.selectedAccount); AccountInstance accountInstance = AccountInstance.getInstance(UserConfig.selectedAccount);
for (int i = 0; i < dids.size(); i++) { for (int i = 0; i < dids.size(); i++) {
long did = dids.get(i).dialogId; long did = dids.get(i).dialogId;
SendMessagesHelper.getInstance(account).sendMessage(user, did, null, null, null, null, notify2, scheduleDate); int topicId = dids.get(i).topicId;
MessageObject replyToMsg = null;
if (topicId != 0) {
TLRPC.TL_forumTopic topic = accountInstance.getMessagesController().getTopicsController().findTopic(-did, topicId);
if (topic != null && topic.topicStartMessage != null) {
replyToMsg = new MessageObject(accountInstance.getCurrentAccount(), topic.topicStartMessage, false, false);
replyToMsg.isTopicMainMessage = true;
}
}
SendMessagesHelper.getInstance(account).sendMessage(user, did, replyToMsg, replyToMsg, null, null, notify2, scheduleDate);
if (!TextUtils.isEmpty(message)) { if (!TextUtils.isEmpty(message)) {
SendMessagesHelper.prepareSendingText(accountInstance, message.toString(), did, notify, 0); SendMessagesHelper.prepareSendingText(accountInstance, message.toString(), did, notify, 0);
} }
@ -5044,12 +5069,14 @@ public class LaunchActivity extends BasePermissionsActivity implements INavigati
TLRPC.TL_forumTopic topic = accountInstance.getMessagesController().getTopicsController().findTopic(-did, topicId); TLRPC.TL_forumTopic topic = accountInstance.getMessagesController().getTopicsController().findTopic(-did, topicId);
if (topic != null && topic.topicStartMessage != null) { if (topic != null && topic.topicStartMessage != null) {
replyToMsg = new MessageObject(accountInstance.getCurrentAccount(), topic.topicStartMessage, false, false); replyToMsg = new MessageObject(accountInstance.getCurrentAccount(), topic.topicStartMessage, false, false);
replyToMsg.isTopicMainMessage = true;
} }
} }
boolean photosEditorOpened = false, videoEditorOpened = false; boolean photosEditorOpened = false, videoEditorOpened = false;
if (fragment != null) { if (fragment != null) {
boolean withoutAnimation = dialogsFragment == null || (videoPath != null || (photoPathsArray != null && photoPathsArray.size() > 0)); boolean withoutAnimation = dialogsFragment == null || (videoPath != null || (photoPathsArray != null && photoPathsArray.size() > 0));
actionBarLayout.presentFragment(fragment, dialogsFragment != null, withoutAnimation, true, false); actionBarLayout.presentFragment(fragment, dialogsFragment != null, withoutAnimation, true, false);
presentedFragmentWithRemoveLast = dialogsFragment != null;
if (videoPath != null) { if (videoPath != null) {
fragment.openVideoEditor(videoPath, sendingText); fragment.openVideoEditor(videoPath, sendingText);
videoEditorOpened = true; videoEditorOpened = true;
@ -5083,7 +5110,7 @@ public class LaunchActivity extends BasePermissionsActivity implements INavigati
captionToSend = sendingText; captionToSend = sendingText;
sendingText = null; sendingText = null;
} }
SendMessagesHelper.prepareSendingDocuments(accountInstance, documentsPathsArray, documentsOriginalPathsArray, documentsUrisArray, captionToSend, documentsMimeType, did, null, null, null, null, notify, 0); SendMessagesHelper.prepareSendingDocuments(accountInstance, documentsPathsArray, documentsOriginalPathsArray, documentsUrisArray, captionToSend, documentsMimeType, did, replyToMsg, replyToMsg, null, null, notify, 0);
} }
if (sendingText != null) { if (sendingText != null) {
SendMessagesHelper.prepareSendingText(accountInstance, sendingText, did, topicId, notify, 0); SendMessagesHelper.prepareSendingText(accountInstance, sendingText, did, topicId, notify, 0);
@ -5100,7 +5127,9 @@ public class LaunchActivity extends BasePermissionsActivity implements INavigati
} }
} }
if (dialogsFragment != null && fragment == null) { if (dialogsFragment != null && fragment == null) {
dialogsFragment.finishFragment(); if (!presentedFragmentWithRemoveLast) {
dialogsFragment.finishFragment();
}
} }
} }
@ -6497,6 +6526,11 @@ public class LaunchActivity extends BasePermissionsActivity implements INavigati
FileLog.d("lock app"); FileLog.d("lock app");
} }
showPasscodeActivity(true, false, -1, -1, null, null); showPasscodeActivity(true, false, -1, -1, null, null);
try {
NotificationsController.getInstance(UserConfig.selectedAccount).showNotifications();
} catch (Exception e) {
FileLog.e(e);
}
} else { } else {
if (BuildVars.LOGS_ENABLED) { if (BuildVars.LOGS_ENABLED) {
FileLog.d("didn't pass lock check"); FileLog.d("didn't pass lock check");

View file

@ -2435,7 +2435,7 @@ public class LocationActivity extends BaseFragment implements NotificationCenter
@Override @Override
public void didReceivedNotification(int id, int account, Object... args) { public void didReceivedNotification(int id, int account, Object... args) {
if (id == NotificationCenter.closeChats) { if (id == NotificationCenter.closeChats) {
removeSelfFromStack(); removeSelfFromStack(true);
} else if (id == NotificationCenter.locationPermissionGranted) { } else if (id == NotificationCenter.locationPermissionGranted) {
locationDenied = false; locationDenied = false;
if (adapter != null) { if (adapter != null) {

View file

@ -404,7 +404,7 @@ public class NotificationsCustomSettingsActivity extends BaseFragment implements
args.putInt("dialogsType", DialogsActivity.DIALOGS_TYPE_USERS_ONLY); args.putInt("dialogsType", DialogsActivity.DIALOGS_TYPE_USERS_ONLY);
} }
DialogsActivity activity = new DialogsActivity(args); DialogsActivity activity = new DialogsActivity(args);
activity.setDelegate((fragment, dids, message, param) -> { activity.setDelegate((fragment, dids, message, param, topicsFragment) -> {
Bundle args2 = new Bundle(); Bundle args2 = new Bundle();
args2.putLong("dialog_id", dids.get(0).dialogId); args2.putLong("dialog_id", dids.get(0).dialogId);
args2.putBoolean("exception", true); args2.putBoolean("exception", true);

View file

@ -612,7 +612,7 @@ public class PhotoAlbumPickerActivity extends BaseFragment implements Notificati
loading = false; loading = false;
} }
} else if (id == NotificationCenter.closeChats) { } else if (id == NotificationCenter.closeChats) {
removeSelfFromStack(); removeSelfFromStack(true);
} }
} }

View file

@ -1291,7 +1291,7 @@ public class PhotoPickerActivity extends BaseFragment implements NotificationCen
@Override @Override
public void didReceivedNotification(int id, int account, Object... args) { public void didReceivedNotification(int id, int account, Object... args) {
if (id == NotificationCenter.closeChats) { if (id == NotificationCenter.closeChats) {
removeSelfFromStack(); removeSelfFromStack(true);
} }
} }

View file

@ -67,7 +67,6 @@ import android.transition.TransitionManager;
import android.transition.TransitionSet; import android.transition.TransitionSet;
import android.transition.TransitionValues; import android.transition.TransitionValues;
import android.util.FloatProperty; import android.util.FloatProperty;
import android.util.Log;
import android.util.Property; import android.util.Property;
import android.util.Range; import android.util.Range;
import android.util.SparseArray; import android.util.SparseArray;
@ -198,7 +197,6 @@ import org.telegram.ui.Components.CombinedDrawable;
import org.telegram.ui.Components.Crop.CropTransform; import org.telegram.ui.Components.Crop.CropTransform;
import org.telegram.ui.Components.Crop.CropView; import org.telegram.ui.Components.Crop.CropView;
import org.telegram.ui.Components.CubicBezierInterpolator; import org.telegram.ui.Components.CubicBezierInterpolator;
import org.telegram.ui.Components.EmojiPacksAlert;
import org.telegram.ui.Components.FadingTextViewLayout; import org.telegram.ui.Components.FadingTextViewLayout;
import org.telegram.ui.Components.FilterShaders; import org.telegram.ui.Components.FilterShaders;
import org.telegram.ui.Components.FloatSeekBarAccessibilityDelegate; import org.telegram.ui.Components.FloatSeekBarAccessibilityDelegate;
@ -4369,7 +4367,7 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat
final ArrayList<MessageObject> fmessages = new ArrayList<>(); final ArrayList<MessageObject> fmessages = new ArrayList<>();
fmessages.add(currentMessageObject); fmessages.add(currentMessageObject);
final ChatActivity parentChatActivityFinal = parentChatActivity; final ChatActivity parentChatActivityFinal = parentChatActivity;
fragment.setDelegate((fragment1, dids, message, param) -> { fragment.setDelegate((fragment1, dids, message, param, topicsFragment) -> {
if (dids.size() > 1 || dids.get(0).dialogId == UserConfig.getInstance(currentAccount).getClientUserId() || message != null) { if (dids.size() > 1 || dids.get(0).dialogId == UserConfig.getInstance(currentAccount).getClientUserId() || message != null) {
for (int a = 0; a < dids.size(); a++) { for (int a = 0; a < dids.size(); a++) {
long did = dids.get(a).dialogId; long did = dids.get(a).dialogId;
@ -15431,20 +15429,27 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat
progress = progress + (1f - progress) * clippingImageProgress; progress = progress + (1f - progress) * clippingImageProgress;
} }
float scale = 1f + (1f - Utilities.clamp(progress, 1, 0)) * ZOOM_SCALE; float scale = 1f + (1f - Utilities.clamp(progress, 1, 0)) * ZOOM_SCALE;
if (SharedConfig.getDevicePerformanceClass() != SharedConfig.PERFORMANCE_CLASS_HIGH || SharedConfig.getLiteMode().enabled()) {
scale = 1f;
}
View view = parentFragment.getFragmentView(); View view = parentFragment.getFragmentView();
view.setPivotX(view.getWidth() / 2f); if (view.getScaleX() != scale || view.getScaleY() != scale) {
view.setPivotY(view.getHeight() / 2f);
view.setScaleX(scale);
view.setScaleY(scale);
if (parentAlert != null) {
view = parentAlert.getContainer();
view.setPivotX(view.getWidth() / 2f); view.setPivotX(view.getWidth() / 2f);
view.setPivotY(view.getHeight() / 2f); view.setPivotY(view.getHeight() / 2f);
view.setScaleX(scale); view.setScaleX(scale);
view.setScaleY(scale); view.setScaleY(scale);
} }
if (parentAlert != null) {
view = parentAlert.getContainer();
if (view.getScaleX() != scale || view.getScaleY() != scale) {
view.setPivotX(view.getWidth() / 2f);
view.setPivotY(view.getHeight() / 2f);
view.setScaleX(scale);
view.setScaleY(scale);
}
}
if (animationInProgress == 1 || animationInProgress == 2 || animationInProgress == 3 || pipAnimationInProgress) { if (animationInProgress == 1 || animationInProgress == 2 || animationInProgress == 3 || pipAnimationInProgress) {
containerView.invalidate(); containerView.invalidate();
} }

View file

@ -1905,7 +1905,7 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter.
args.putBoolean("closeFragment", false); args.putBoolean("closeFragment", false);
// args.putString("addToGroupAlertString", LocaleController.formatString("AddToTheGroupAlertText", R.string.AddToTheGroupAlertText, UserObject.getUserName(user), "%1$s")); // args.putString("addToGroupAlertString", LocaleController.formatString("AddToTheGroupAlertText", R.string.AddToTheGroupAlertText, UserObject.getUserName(user), "%1$s"));
DialogsActivity fragment = new DialogsActivity(args); DialogsActivity fragment = new DialogsActivity(args);
fragment.setDelegate((fragment1, dids, message, param) -> { fragment.setDelegate((fragment1, dids, message, param, topicsFragment) -> {
long did = dids.get(0).dialogId; long did = dids.get(0).dialogId;
TLRPC.Chat chat = MessagesController.getInstance(currentAccount).getChat(-did); TLRPC.Chat chat = MessagesController.getInstance(currentAccount).getChat(-did);
@ -6041,7 +6041,7 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter.
updateTtlIcon(); updateTtlIcon();
} }
} else if (id == NotificationCenter.closeChats) { } else if (id == NotificationCenter.closeChats) {
removeSelfFromStack(); removeSelfFromStack(true);
} else if (id == NotificationCenter.botInfoDidLoad) { } else if (id == NotificationCenter.botInfoDidLoad) {
TLRPC.BotInfo info = (TLRPC.BotInfo) args[0]; TLRPC.BotInfo info = (TLRPC.BotInfo) args[0];
if (info.user_id == userId) { if (info.user_id == userId) {
@ -8023,7 +8023,7 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter.
} }
@Override @Override
public boolean didSelectDialogs(DialogsActivity fragment, ArrayList<MessagesStorage.TopicKey> dids, CharSequence message, boolean param) { public boolean didSelectDialogs(DialogsActivity fragment, ArrayList<MessagesStorage.TopicKey> dids, CharSequence message, boolean param, TopicsFragment topicsFragment) {
long did = dids.get(0).dialogId; long did = dids.get(0).dialogId;
Bundle args = new Bundle(); Bundle args = new Bundle();
args.putBoolean("scrollToTopOnResume", true); args.putBoolean("scrollToTopOnResume", true);

View file

@ -1265,7 +1265,7 @@ public class QrActivity extends BaseFragment {
super.onDetachedFromWindow(); super.onDetachedFromWindow();
if (loadingMatrix != null) { if (loadingMatrix != null) {
loadingMatrix.stop(); loadingMatrix.stop();
loadingMatrix.recycle(); loadingMatrix.recycle(false);
loadingMatrix = null; loadingMatrix = null;
} }
} }

View file

@ -179,7 +179,7 @@ public class SaveToGallerySettingsActivity extends BaseFragment {
} }
args.putBoolean("allowGlobalSearch", false); args.putBoolean("allowGlobalSearch", false);
DialogsActivity activity = new DialogsActivity(args); DialogsActivity activity = new DialogsActivity(args);
activity.setDelegate((fragment, dids, message, param) -> { activity.setDelegate((fragment, dids, message, param, topicsFragment) -> {
Bundle args2 = new Bundle(); Bundle args2 = new Bundle();
args2.putLong("dialog_id", dids.get(0).dialogId); args2.putLong("dialog_id", dids.get(0).dialogId);
args2.putInt("type", type); args2.putInt("type", type);

View file

@ -1808,7 +1808,7 @@ public class SelectAnimatedEmojiDialog extends FrameLayout implements Notificati
} }
imageView.setDrawable(drawable); imageView.setDrawable(drawable);
if (!UserConfig.getInstance(currentAccount).isPremium()) { if (!UserConfig.getInstance(currentAccount).isPremium() && type != TYPE_AVATAR_CONSTRUCTOR && type != TYPE_TOPIC_ICON) {
if (imageView.premiumLockIconView == null) { if (imageView.premiumLockIconView == null) {
imageView.premiumLockIconView = new PremiumLockIconView(getContext(), PremiumLockIconView.TYPE_STICKERS_PREMIUM_LOCKED); imageView.premiumLockIconView = new PremiumLockIconView(getContext(), PremiumLockIconView.TYPE_STICKERS_PREMIUM_LOCKED);
imageView.addView(imageView.premiumLockIconView, LayoutHelper.createFrame(12, 12, Gravity.RIGHT | Gravity.BOTTOM)); imageView.addView(imageView.premiumLockIconView, LayoutHelper.createFrame(12, 12, Gravity.RIGHT | Gravity.BOTTOM));
@ -2122,7 +2122,7 @@ public class SelectAnimatedEmojiDialog extends FrameLayout implements Notificati
} }
imageView.setDrawable(drawable); imageView.setDrawable(drawable);
if (!UserConfig.getInstance(currentAccount).isPremium()) { if (!UserConfig.getInstance(currentAccount).isPremium() && type != TYPE_AVATAR_CONSTRUCTOR && type != TYPE_TOPIC_ICON) {
if (imageView.premiumLockIconView == null) { if (imageView.premiumLockIconView == null) {
imageView.premiumLockIconView = new PremiumLockIconView(getContext(), PremiumLockIconView.TYPE_STICKERS_PREMIUM_LOCKED); imageView.premiumLockIconView = new PremiumLockIconView(getContext(), PremiumLockIconView.TYPE_STICKERS_PREMIUM_LOCKED);
imageView.addView(imageView.premiumLockIconView, LayoutHelper.createFrame(12, 12, Gravity.RIGHT | Gravity.BOTTOM)); imageView.addView(imageView.premiumLockIconView, LayoutHelper.createFrame(12, 12, Gravity.RIGHT | Gravity.BOTTOM));

View file

@ -827,9 +827,8 @@ public class TopicsFragment extends BaseFragment implements NotificationCenter.N
onTopicSelectedListener.onTopicSelected(topic); onTopicSelectedListener.onTopicSelected(topic);
} }
if (dialogsActivity != null) { if (dialogsActivity != null) {
dialogsActivity.didSelectResult(-chatId, topic.id, true, false); dialogsActivity.didSelectResult(-chatId, topic.id, true, false, this);
} }
removeFragmentOnTransitionEnd = true;
return; return;
} }
if (selectedTopics.size() > 0) { if (selectedTopics.size() > 0) {
@ -1394,6 +1393,11 @@ public class TopicsFragment extends BaseFragment implements NotificationCenter.N
} }
} }
@Override
public boolean allowFinishFragmentInsteadOfRemoveFromStack() {
return false;
}
private void updateTopView() { private void updateTopView() {
float translation = 0; float translation = 0;
if (fragmentContextView != null) { if (fragmentContextView != null) {
@ -2634,7 +2638,7 @@ public class TopicsFragment extends BaseFragment implements NotificationCenter.N
} else if (id == NotificationCenter.chatSwithcedToForum) { } else if (id == NotificationCenter.chatSwithcedToForum) {
} else if (id == NotificationCenter.closeChats) { } else if (id == NotificationCenter.closeChats) {
removeSelfFromStack(); removeSelfFromStack(true);
} }
if (id == NotificationCenter.openedChatChanged) { if (id == NotificationCenter.openedChatChanged) {
if (getParentActivity() == null || !(inPreviewMode && AndroidUtilities.isTablet())) { if (getParentActivity() == null || !(inPreviewMode && AndroidUtilities.isTablet())) {

View file

@ -234,7 +234,7 @@ public class TwoStepVerificationSetupActivity extends BaseFragment {
} }
if (animationDrawables != null) { if (animationDrawables != null) {
for (int a = 0; a < animationDrawables.length; a++) { for (int a = 0; a < animationDrawables.length; a++) {
animationDrawables[a].recycle(); animationDrawables[a].recycle(false);
} }
animationDrawables = null; animationDrawables = null;
} }

View file

@ -566,7 +566,7 @@ public class WallpapersListActivity extends BaseFragment implements Notification
args.putBoolean("onlySelect", true); args.putBoolean("onlySelect", true);
args.putInt("dialogsType", DialogsActivity.DIALOGS_TYPE_FORWARD); args.putInt("dialogsType", DialogsActivity.DIALOGS_TYPE_FORWARD);
DialogsActivity fragment = new DialogsActivity(args); DialogsActivity fragment = new DialogsActivity(args);
fragment.setDelegate((fragment1, dids, message, param) -> { fragment.setDelegate((fragment1, dids, message, param, topicsFragment) -> {
StringBuilder fmessage = new StringBuilder(); StringBuilder fmessage = new StringBuilder();
for (int b = 0; b < selectedWallPapers.size(); b++) { for (int b = 0; b < selectedWallPapers.size(); b++) {
Object object = selectedWallPapers.valueAt(b); Object object = selectedWallPapers.valueAt(b);

View file

@ -6239,6 +6239,7 @@
<string name="TranslateToButtonOther">Translate to %s</string> <string name="TranslateToButtonOther">Translate to %s</string>
<string name="ShowOriginalButton">Show Original</string> <string name="ShowOriginalButton">Show Original</string>
<string name="AddedToDoNotTranslate">**%s** is added to the Do Not Translate list.</string> <string name="AddedToDoNotTranslate">**%s** is added to the Do Not Translate list.</string>
<string name="AddedToDoNotTranslateOther">**%s** is added to the Do Not Translate list.</string>
<string name="TranslationBarHiddenForChannel">Translation bar is now hidden for this channel.</string> <string name="TranslationBarHiddenForChannel">Translation bar is now hidden for this channel.</string>
<string name="TranslationBarHiddenForGroup">Translation bar is now hidden for this group.</string> <string name="TranslationBarHiddenForGroup">Translation bar is now hidden for this group.</string>
<string name="TranslationBarHiddenForChat">Translation bar is now hidden for this chat.</string> <string name="TranslationBarHiddenForChat">Translation bar is now hidden for this chat.</string>

View file

@ -13,8 +13,8 @@
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
# org.gradle.parallel=true # org.gradle.parallel=true
#Sat Mar 12 05:53:50 MSK 2016 #Sat Mar 12 05:53:50 MSK 2016
APP_VERSION_NAME=9.4.1 APP_VERSION_NAME=9.4.2
APP_VERSION_CODE=3102 APP_VERSION_CODE=3106
APP_PACKAGE=org.telegram.messenger APP_PACKAGE=org.telegram.messenger
RELEASE_KEY_PASSWORD=android RELEASE_KEY_PASSWORD=android
RELEASE_KEY_ALIAS=androidkey RELEASE_KEY_ALIAS=androidkey