Update to 7.3.0 (2196)

This commit is contained in:
DrKLO 2020-12-24 09:36:01 +04:00
parent d52b2c921a
commit 4b588b90aa
69 changed files with 4280 additions and 1841 deletions

View file

@ -18,7 +18,7 @@ public class BuildVars {
public static boolean LOGS_ENABLED = false;
public static boolean USE_CLOUD_STRINGS = true;
public static boolean CHECK_UPDATES = true;
public static int BUILD_VERSION = 2195;
public static int BUILD_VERSION = 2196;
public static String BUILD_VERSION_STRING = "7.3.0";
public static int APP_ID = 4;
public static String APP_HASH = "014b35b6184100b085b0d0572f9b5103";

View file

@ -3233,7 +3233,7 @@ public class ImageLoader {
fileDir = location.volume_id != Integer.MIN_VALUE ? FileLoader.getDirectory(FileLoader.MEDIA_DIR_IMAGE) : FileLoader.getDirectory(FileLoader.MEDIA_DIR_CACHE);
}
final File cacheFile = new File(fileDir, fileName);
if (compressFormat == Bitmap.CompressFormat.JPEG && progressive) {
if (compressFormat == Bitmap.CompressFormat.JPEG && progressive && BuildVars.DEBUG_VERSION) {
photoSize.size = Utilities.saveProgressiveJpeg(scaledBitmap, scaledBitmap.getWidth(), scaledBitmap.getHeight(), scaledBitmap.getRowBytes(), quality, cacheFile.getAbsolutePath());
} else {
FileOutputStream stream = new FileOutputStream(cacheFile);

View file

@ -3948,6 +3948,7 @@ public class MediaDataController extends BaseController {
getMessagesStorage().getStorageQueue().postRunnable(() -> {
try {
ArrayList<MessageObject> loadedMessages = new ArrayList<>();
SQLiteCursor cursor = getMessagesStorage().getDatabase().queryFinalized(String.format(Locale.US, "SELECT m.data, m.mid, m.date, r.random_id FROM randoms as r INNER JOIN messages as m ON r.mid = m.mid WHERE r.random_id IN(%s)", TextUtils.join(",", replyMessages)));
while (cursor.next()) {
NativeByteBuffer data = cursor.byteBufferValue(0);
@ -3964,6 +3965,7 @@ public class MediaDataController extends BaseController {
replyMessageRandomOwners.remove(value);
if (arrayList != null) {
MessageObject messageObject = new MessageObject(currentAccount, message, false, false);
loadedMessages.add(messageObject);
for (int b = 0; b < arrayList.size(); b++) {
MessageObject object = arrayList.get(b);
object.replyMessageObject = messageObject;
@ -3985,7 +3987,7 @@ public class MediaDataController extends BaseController {
}
}
}
AndroidUtilities.runOnUIThread(() -> getNotificationCenter().postNotificationName(NotificationCenter.replyMessagesDidLoad, dialogId));
AndroidUtilities.runOnUIThread(() -> getNotificationCenter().postNotificationName(NotificationCenter.replyMessagesDidLoad, dialogId, loadedMessages));
if (callback != null) {
callback.run();
}
@ -4207,7 +4209,7 @@ public class MediaDataController extends BaseController {
}
}
if (changed) {
getNotificationCenter().postNotificationName(NotificationCenter.replyMessagesDidLoad, dialog_id);
getNotificationCenter().postNotificationName(NotificationCenter.replyMessagesDidLoad, dialog_id, messageObjects);
}
});
}

View file

@ -13,7 +13,6 @@ import android.text.SpannableStringBuilder;
import android.text.Spanned;
import android.text.TextUtils;
import android.text.style.ForegroundColorSpan;
import android.util.Log;
import android.util.LongSparseArray;
import android.util.Pair;
import android.util.SparseArray;
@ -270,7 +269,7 @@ public class MessagesStorage extends BaseController {
database.executeFast("PRAGMA secure_delete = ON").stepThis().dispose();
database.executeFast("PRAGMA temp_store = MEMORY").stepThis().dispose();
database.executeFast("PRAGMA journal_mode = WAL").stepThis().dispose();
database.executeFast("PRAGMA journal_size_limit = 52428800").stepThis().dispose();
database.executeFast("PRAGMA journal_size_limit = 10485760").stepThis().dispose();
if (createTable) {
if (BuildVars.LOGS_ENABLED) {

View file

@ -9,6 +9,8 @@
package org.telegram.messenger;
import androidx.annotation.UiThread;
import android.os.SystemClock;
import android.util.SparseArray;
import java.util.ArrayList;
@ -203,7 +205,7 @@ public class NotificationCenter {
public static final int closeSearchByActiveAction = totalEvents++;
public static final int messagePlayingSpeedChanged = totalEvents++;
public static final int screenStateChanged = totalEvents++;
public static final int didDatabaseCleared = totalEvents++;
public static final int didClearDatabase = totalEvents++;
public static final int voipServiceCreated = totalEvents++;
public static final int webRtcMicAmplitudeEvent = totalEvents++;
public static final int webRtcSpeakerAmplitudeEvent = totalEvents++;
@ -217,6 +219,8 @@ public class NotificationCenter {
private ArrayList<DelayedPost> delayedPostsTmp = new ArrayList<>(10);
private ArrayList<PostponeNotificationCallback> postponeCallbackList = new ArrayList<>(10);
private Runnable checkForExpiredNotifications;
private int broadcasting = 0;
private int animationInProgressCount;
@ -224,7 +228,7 @@ public class NotificationCenter {
HashSet<Integer> heavyOperationsCounter = new HashSet<>();
private final HashMap<Integer, int[]> allowedNotifications = new HashMap<>();
private final HashMap<Integer, AllowedNotifications> allowedNotifications = new HashMap<>();
public interface NotificationCenterDelegate {
void didReceivedNotification(int id, int account, Object... args);
@ -294,27 +298,56 @@ public class NotificationCenter {
if (stopHeavyOperations) {
heavyOperationsCounter.add(animationInProgressPointer);
}
if (allowedNotifications == null) {
allowedNotifications = new int[0];
AllowedNotifications notifications = new AllowedNotifications();
notifications.allowedIds = allowedNotifications;
this.allowedNotifications.put(animationInProgressPointer, notifications);
if (checkForExpiredNotifications == null) {
AndroidUtilities.runOnUIThread(checkForExpiredNotifications = this::checkForExpiredNotifications, 1017);
}
this.allowedNotifications.put(animationInProgressPointer, allowedNotifications);
return animationInProgressPointer;
}
public void updateAllowedNotifications(int transitionAnimationIndex, int[] allowedNotifications) {
if (this.allowedNotifications.containsKey(transitionAnimationIndex)) {
if (allowedNotifications == null) {
allowedNotifications = new int[0];
private void checkForExpiredNotifications() {
checkForExpiredNotifications = null;
if (this.allowedNotifications.isEmpty()) {
return;
}
long minTime = Long.MAX_VALUE;
long currentTime = SystemClock.elapsedRealtime();
ArrayList<Integer> expiredIndices = null;
for (HashMap.Entry<Integer, AllowedNotifications> entry : this.allowedNotifications.entrySet()) {
AllowedNotifications allowedNotification = entry.getValue();
if (currentTime - allowedNotification.time > 1000) {
if (expiredIndices == null) {
expiredIndices = new ArrayList<>();
}
expiredIndices.add(entry.getKey());
} else {
minTime = Math.min(allowedNotification.time, minTime);
}
this.allowedNotifications.put(transitionAnimationIndex, allowedNotifications);
}
if (expiredIndices != null) {
for (int i = 0; i < expiredIndices.size(); i++) {
onAnimationFinish(expiredIndices.get(i));
}
}
if (minTime != Long.MAX_VALUE) {
long time = 1017 - (currentTime - minTime);
AndroidUtilities.runOnUIThread(() -> checkForExpiredNotifications = this::checkForExpiredNotifications, Math.max(17, time));
}
}
public void updateAllowedNotifications(int transitionAnimationIndex, int[] allowedNotifications) {
AllowedNotifications notifications = this.allowedNotifications.get(transitionAnimationIndex);
if (notifications != null) {
notifications.allowedIds = allowedNotifications;
}
}
public void onAnimationFinish(int index) {
int[] notifications = allowedNotifications.remove(index);
if (notifications != null) {
AllowedNotifications allowed = allowedNotifications.remove(index);
if (allowed != null) {
animationInProgressCount--;
if (!heavyOperationsCounter.isEmpty()) {
heavyOperationsCounter.remove(index);
@ -326,6 +359,10 @@ public class NotificationCenter {
runDelayedNotifications();
}
}
if (checkForExpiredNotifications != null && allowedNotifications.isEmpty()) {
AndroidUtilities.cancelRunOnUIThread(checkForExpiredNotifications);
checkForExpiredNotifications = null;
}
}
public void runDelayedNotifications() {
@ -361,11 +398,20 @@ public class NotificationCenter {
public void postNotificationName(int id, Object... args) {
boolean allowDuringAnimation = id == startAllHeavyOperations || id == stopAllHeavyOperations || id == didReplacedPhotoInMemCache;
ArrayList<Integer> expiredIndices = null;
if (!allowDuringAnimation && !allowedNotifications.isEmpty()) {
int size = allowedNotifications.size();
int allowedCount = 0;
for (Integer key : allowedNotifications.keySet()) {
int[] allowed = allowedNotifications.get(key);
long currentTime = SystemClock.elapsedRealtime();
for (HashMap.Entry<Integer, AllowedNotifications> entry : allowedNotifications.entrySet()) {
AllowedNotifications allowedNotification = entry.getValue();
if (currentTime - allowedNotification.time > 1000) {
if (expiredIndices == null) {
expiredIndices = new ArrayList<>();
}
expiredIndices.add(entry.getKey());
}
int[] allowed = allowedNotification.allowedIds;
if (allowed != null) {
for (int a = 0; a < allowed.length; a++) {
if (allowed[a] == id) {
@ -387,6 +433,12 @@ public class NotificationCenter {
currentHeavyOperationFlags |= flags;
}
postNotificationNameInternal(id, allowDuringAnimation, args);
if (expiredIndices != null) {
for (int i = 0; i < expiredIndices.size(); i++) {
onAnimationFinish(expiredIndices.get(i));
}
}
}
@UiThread
@ -528,4 +580,14 @@ public class NotificationCenter {
runnable.run();
}
}
private static class AllowedNotifications {
int[] allowedIds;
final long time;
private AllowedNotifications() {
time = SystemClock.elapsedRealtime();
}
}
}

View file

@ -2913,13 +2913,15 @@ public class NotificationsController extends BaseController {
if (!settings.equals(newSettingsHash)) {
SharedPreferences.Editor editor = null;
if (channelImportance == NotificationManager.IMPORTANCE_NONE) {
if (isInApp) {
editor = preferences.edit();
if (isDefault) {
editor = preferences.edit();
if (isDefault) {
if (!isInApp) {
editor.putInt(getGlobalNotificationsKey(type), Integer.MAX_VALUE);
} else {
editor.putInt("notify2_" + dialogId, 2);
updateServerNotificationsSettings(type);
}
} else {
editor.putInt("notify2_" + dialogId, 2);
updateServerNotificationsSettings(dialogId, true);
}
edited = true;
} else if (channelImportance != importance) {
@ -3063,7 +3065,7 @@ public class NotificationsController extends BaseController {
if (edited && newSettingsHash != null) {
preferences.edit().putString(key, channelId).putString(key + "_s", newSettingsHash).commit();
} else {
} else if (!isInApp || !isDefault) {
for (int a = 0; a < vibrationPattern.length; a++) {
newSettings.append(vibrationPattern[a]);
}

View file

@ -23,7 +23,7 @@ public class NotificationsDisabledReceiver extends BroadcastReceiver {
public void onReceive(Context context, Intent intent) {
String channelId = intent.getStringExtra(EXTRA_NOTIFICATION_CHANNEL_ID);
boolean state = intent.getBooleanExtra(EXTRA_BLOCKED_STATE, false);
if (TextUtils.isEmpty(channelId)) {
if (TextUtils.isEmpty(channelId) || channelId.contains("_ia_")) {
return;
}
String[] args = channelId.split("_");
@ -38,11 +38,14 @@ public class NotificationsDisabledReceiver extends BroadcastReceiver {
SharedPreferences preferences = AccountInstance.getInstance(account).getNotificationsSettings();
SharedPreferences.Editor editor = preferences.edit();
if (args[1].startsWith("channel")) {
editor.putInt(NotificationsController.getGlobalNotificationsKey(NotificationsController.TYPE_CHANNEL), state ? Integer.MAX_VALUE : 0);
editor.putInt(NotificationsController.getGlobalNotificationsKey(NotificationsController.TYPE_CHANNEL), state ? Integer.MAX_VALUE : 0).commit();
AccountInstance.getInstance(account).getNotificationsController().updateServerNotificationsSettings(NotificationsController.TYPE_CHANNEL);
} else if (args[1].startsWith("groups")) {
editor.putInt(NotificationsController.getGlobalNotificationsKey(NotificationsController.TYPE_GROUP), state ? Integer.MAX_VALUE : 0);
editor.putInt(NotificationsController.getGlobalNotificationsKey(NotificationsController.TYPE_GROUP), state ? Integer.MAX_VALUE : 0).commit();
AccountInstance.getInstance(account).getNotificationsController().updateServerNotificationsSettings(NotificationsController.TYPE_GROUP);
} else if (args[1].startsWith("private")) {
editor.putInt(NotificationsController.getGlobalNotificationsKey(NotificationsController.TYPE_PRIVATE), state ? Integer.MAX_VALUE : 0);
editor.putInt(NotificationsController.getGlobalNotificationsKey(NotificationsController.TYPE_PRIVATE), state ? Integer.MAX_VALUE : 0).commit();
AccountInstance.getInstance(account).getNotificationsController().updateServerNotificationsSettings(NotificationsController.TYPE_PRIVATE);
} else {
long dialogId = Utilities.parseLong(args[1]);
if (dialogId == 0) {
@ -52,7 +55,9 @@ public class NotificationsDisabledReceiver extends BroadcastReceiver {
if (!state) {
editor.remove("notifyuntil_" + dialogId);
}
editor.commit();
AccountInstance.getInstance(account).getNotificationsController().updateServerNotificationsSettings(dialogId, true);
}
editor.commit();
AccountInstance.getInstance(account).getConnectionsManager().resumeNetworkMaybe();
}
}

View file

@ -23,6 +23,7 @@ limitations under the License.
package org.telegram.messenger;
import android.graphics.Bitmap;
import android.graphics.BitmapShader;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.ColorFilter;
@ -37,6 +38,7 @@ import android.graphics.Rect;
import android.graphics.RectF;
import android.graphics.Shader;
import android.graphics.drawable.Drawable;
import android.os.Build;
import android.os.SystemClock;
import org.telegram.ui.ActionBar.Theme;
@ -103,7 +105,9 @@ public class SvgHelper {
private int height;
private static int[] parentPosition = new int[2];
private LinearGradient backgroundGradient;
private Shader backgroundGradient;
private Bitmap backgroundBitmap;
private Canvas backgroundCanvas;
private LinearGradient placeholderGradient;
private Matrix placeholderMatrix;
private static float totalTranslation;
@ -233,7 +237,16 @@ public class SvgHelper {
color = Color.argb((int) (Color.alpha(color) / 2 * colorAlpha), Color.red(color), Color.green(color), Color.blue(color));
float centerX = (1.0f - w) / 2;
placeholderGradient = new LinearGradient(0, 0, gradientWidth, 0, new int[]{0x00000000, 0x00000000, color, 0x00000000, 0x00000000}, new float[]{0.0f, centerX - w / 2.0f, centerX, centerX + w / 2.0f, 1.0f}, Shader.TileMode.REPEAT);
backgroundGradient = new LinearGradient(0, 0, gradientWidth, 0, new int[]{color, color}, null, Shader.TileMode.REPEAT);
if (Build.VERSION.SDK_INT >= 28) {
backgroundGradient = new LinearGradient(0, 0, gradientWidth, 0, new int[]{color, color}, null, Shader.TileMode.REPEAT);
} else {
if (backgroundBitmap == null) {
backgroundBitmap = Bitmap.createBitmap(1, 1, Bitmap.Config.ARGB_8888);
backgroundCanvas = new Canvas(backgroundBitmap);
}
backgroundCanvas.drawColor(color);
backgroundGradient = new BitmapShader(backgroundBitmap, Shader.TileMode.REPEAT, Shader.TileMode.REPEAT);
}
placeholderMatrix = new Matrix();
placeholderGradient.setLocalMatrix(placeholderMatrix);
for (Paint paint : paints.values()) {

View file

@ -135,6 +135,7 @@ public abstract class VoIPBaseService extends Service implements SensorEventList
protected int currentState = 0;
protected Notification ongoingCallNotification;
protected NativeInstance tgVoip;
protected boolean wasConnected;
protected TLRPC.Chat chat;
@ -161,7 +162,7 @@ public abstract class VoIPBaseService extends Service implements SensorEventList
protected int spConnectingId;
protected int spPlayID;
protected boolean needPlayEndSound;
protected boolean haveAudioFocus;
protected boolean hasAudioFocus;
protected boolean micMute;
protected boolean unmutedByHold;
protected BluetoothAdapter btAdapter;
@ -819,7 +820,7 @@ public abstract class VoIPBaseService extends Service implements SensorEventList
am.abandonAudioFocus(this);
}
am.unregisterMediaButtonEventReceiver(new ComponentName(this, VoIPMediaButtonReceiver.class));
if (haveAudioFocus) {
if (hasAudioFocus) {
am.abandonAudioFocus(this);
}
Utilities.globalQueue.postRunnable(() -> soundPool.release());
@ -1111,9 +1112,9 @@ public abstract class VoIPBaseService extends Service implements SensorEventList
public void onAudioFocusChange(int focusChange) {
if (focusChange == AudioManager.AUDIOFOCUS_GAIN) {
haveAudioFocus = true;
hasAudioFocus = true;
} else {
haveAudioFocus = false;
hasAudioFocus = false;
}
}

View file

@ -1341,6 +1341,7 @@ public class VoIPService extends VoIPBaseService {
tgVoip.stopGroup();
}
cancelGroupCheckShortPoll();
wasConnected = false;
tgVoip = NativeInstance.makeGroup(this::startGroupCall, (uids, levels, voice) -> {
if (sharedInstance == null || groupCall == null) {
return;
@ -1377,10 +1378,12 @@ public class VoIPService extends VoIPBaseService {
if (state == 0) {
startGroupCheckShortpoll();
if (playedConnectedSound && spPlayID == 0) {
if (spPlayID != 0) {
soundPool.stop(spPlayID);
}
spPlayID = soundPool.play(spVoiceChatConnecting, 1.0f, 1.0f, 0, -1, 1);
Utilities.globalQueue.postRunnable(() -> {
if (spPlayID != 0) {
soundPool.stop(spPlayID);
}
spPlayID = soundPool.play(spVoiceChatConnecting, 1.0f, 1.0f, 0, -1, 1);
});
}
} else {
cancelGroupCheckShortPoll();
@ -1399,6 +1402,12 @@ public class VoIPService extends VoIPBaseService {
Utilities.globalQueue.postRunnable(() -> soundPool.play(spVoiceChatStartId, 1.0f, 1.0f, 0, 0, 1));
playedConnectedSound = true;
}
if (!wasConnected) {
if (!micMute) {
tgVoip.setMuteMicrophone(false);
}
wasConnected = true;
}
}
});
dispatchStateChanged(STATE_WAIT_INIT);

View file

@ -51,6 +51,7 @@ import android.widget.LinearLayout;
import android.widget.TextView;
import androidx.core.graphics.ColorUtils;
import androidx.core.view.ViewCompat;
import org.telegram.messenger.AndroidUtilities;
import org.telegram.messenger.ImageLocation;
@ -811,6 +812,14 @@ public class ActionBarMenuItem extends FrameLayout {
checkClearButton();
}
public static boolean checkRtl (String string) {
if (TextUtils.isEmpty(string)) {
return false;
}
char c = string.charAt(0);
return c >= 0x590 && c <= 0x6ff;
}
public void setClearsTextOnSearchCollapse(boolean value) {
clearsTextOnSearchCollapse = value;
@ -948,7 +957,7 @@ public class ActionBarMenuItem extends FrameLayout {
ignoreRequestLayout = true;
measureChildWithMargins(searchFilterLayout, widthMeasureSpec, width, heightMeasureSpec, 0);
int filterWidth = searchFilterLayout.getVisibility() == View.VISIBLE ? searchFilterLayout.getMeasuredWidth() : 0;
measureChildWithMargins(searchField, MeasureSpec.makeMeasureSpec(minWidth - AndroidUtilities.dp(6), MeasureSpec.UNSPECIFIED), width + filterWidth, heightMeasureSpec, 0);
measureChildWithMargins(searchField, MeasureSpec.makeMeasureSpec(minWidth - AndroidUtilities.dp(12), MeasureSpec.UNSPECIFIED), width + filterWidth, heightMeasureSpec, 0);
ignoreRequestLayout = false;
setMeasuredDimension(Math.max(filterWidth + searchField.getMeasuredWidth(), minWidth), MeasureSpec.getSize(heightMeasureSpec));
}

View file

@ -29,7 +29,6 @@ public class AdjustPanLayoutHelper {
private final View parent;
private View resizableViewToSet;
private ViewGroup decorView;
private ViewGroup contentView;
private View resizableView;
private boolean animationInProgress;
@ -119,7 +118,7 @@ public class AdjustPanLayoutHelper {
}
animator.addUpdateListener(animation -> {
float v = (float) animation.getAnimatedValue();
float y = from * v + to * (1f - v);
float y = (int) (from * v + to * (1f - v));
parent.setTranslationY(y);
onPanTranslationUpdate(-y, v, isKeyboardVisible);
});
@ -186,7 +185,7 @@ public class AdjustPanLayoutHelper {
Context context = parent.getContext();
Activity activity = getActivity(context);
if (activity != null) {
decorView = (android.view.ViewGroup) activity.getWindow().getDecorView();
ViewGroup decorView = (ViewGroup) activity.getWindow().getDecorView();
contentView = decorView.findViewById(Window.ID_ANDROID_CONTENT);
}
resizableView = findResizableView(parent);

View file

@ -289,7 +289,7 @@ public class ArticleViewer implements NotificationCenter.NotificationCenterDeleg
TextSelectionHelper.ArticleTextSelectionHelper textSelectionHelper;
TextSelectionHelper.ArticleTextSelectionHelper textSelectionHelperBottomSheet;
int allowAnimationIndex = -1;
private int allowAnimationIndex = -1;
private final String BOTTOM_SHEET_VIEW_TAG = "bottomSheet";

View file

@ -624,7 +624,7 @@ public class CacheControlActivity extends BaseFragment {
databaseSize = MessagesStorage.getInstance(currentAccount).getDatabaseSize();
listAdapter.notifyDataSetChanged();
}
NotificationCenter.getInstance(currentAccount).postNotificationName(NotificationCenter.didDatabaseCleared);
NotificationCenter.getInstance(currentAccount).postNotificationName(NotificationCenter.didClearDatabase);
});
}
});

View file

@ -155,7 +155,7 @@ public class CancelAccountDeletionActivity extends BaseFragment {
});
ActionBarMenu menu = actionBar.createMenu();
doneButton = menu.addItemWithWidth(done_button, R.drawable.ic_done, AndroidUtilities.dp(56));
doneButton = menu.addItemWithWidth(done_button, R.drawable.ic_done, AndroidUtilities.dp(56), LocaleController.getString("Done", R.string.Done));
doneButton.setVisibility(View.GONE);
ScrollView scrollView = new ScrollView(context) {

View file

@ -84,7 +84,7 @@ public class SharingLiveLocationCell extends FrameLayout {
distanceTextView = new SimpleTextView(context);
distanceTextView.setTextSize(14);
distanceTextView.setTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteGrayText2));
distanceTextView.setTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteGrayText3));
distanceTextView.setGravity(LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT);
addView(distanceTextView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, 20, Gravity.TOP | (LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT), LocaleController.isRTL ? padding : 73, 37, LocaleController.isRTL ? 73 : padding, 0));

View file

@ -65,7 +65,7 @@ public class ChangeNameActivity extends BaseFragment {
});
ActionBarMenu menu = actionBar.createMenu();
doneButton = menu.addItemWithWidth(done_button, R.drawable.ic_done, AndroidUtilities.dp(56));
doneButton = menu.addItemWithWidth(done_button, R.drawable.ic_done, AndroidUtilities.dp(56), LocaleController.getString("Done", R.string.Done));
TLRPC.User user = MessagesController.getInstance(currentAccount).getUser(UserConfig.getInstance(currentAccount).getClientUserId());
if (user == null) {

View file

@ -157,7 +157,7 @@ public class ChangePhoneActivity extends BaseFragment {
});
ActionBarMenu menu = actionBar.createMenu();
doneButton = menu.addItemWithWidth(done_button, R.drawable.ic_done, AndroidUtilities.dp(56));
doneButton = menu.addItemWithWidth(done_button, R.drawable.ic_done, AndroidUtilities.dp(56), LocaleController.getString("Done", R.string.Done));
ScrollView scrollView = new ScrollView(context) {
@Override

View file

@ -131,7 +131,7 @@ public class ChangeUsernameActivity extends BaseFragment {
});
ActionBarMenu menu = actionBar.createMenu();
doneButton = menu.addItemWithWidth(done_button, R.drawable.ic_done, AndroidUtilities.dp(56));
doneButton = menu.addItemWithWidth(done_button, R.drawable.ic_done, AndroidUtilities.dp(56), LocaleController.getString("Done", R.string.Done));
TLRPC.User user = MessagesController.getInstance(currentAccount).getUser(UserConfig.getInstance(currentAccount).getClientUserId());
if (user == null) {

View file

@ -267,6 +267,7 @@ public class ChannelAdminLogActivity extends BaseFragment implements Notificatio
NotificationCenter.getInstance(currentAccount).removeObserver(this, NotificationCenter.messagePlayingDidReset);
NotificationCenter.getInstance(currentAccount).removeObserver(this, NotificationCenter.messagePlayingProgressDidChanged);
NotificationCenter.getGlobalInstance().removeObserver(this, NotificationCenter.didSetNewWallpapper);
getNotificationCenter().onAnimationFinish(allowAnimationIndex);
}
private void updateEmptyPlaceholder() {

View file

@ -310,7 +310,7 @@ public class ChannelCreateActivity extends BaseFragment implements NotificationC
});
ActionBarMenu menu = actionBar.createMenu();
doneButton = menu.addItemWithWidth(done_button, R.drawable.ic_done, AndroidUtilities.dp(56));
doneButton = menu.addItemWithWidth(done_button, R.drawable.ic_done, AndroidUtilities.dp(56), LocaleController.getString("Done", R.string.Done));
if (currentStep == 0) {
actionBar.setTitle(LocaleController.getString("NewChannel", R.string.NewChannel));

View file

@ -404,6 +404,8 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
private int threadMaxOutboxReadId;
private int replyMaxReadId = 0;
private Runnable delayedReadRunnable;
private SparseArray<MessageObject> pendingSendMessagesDict = new SparseArray<>();
private ArrayList<MessageObject> pendingSendMessages = new ArrayList<>();
private ArrayList<MessageObject> animatingMessageObjects = new ArrayList<>();
private HashMap<TLRPC.Document, Integer> animatingDocuments = new HashMap<>();
@ -527,6 +529,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
private boolean hasAllMentionsLocal;
private SparseArray<MessageObject>[] messagesDict = new SparseArray[]{new SparseArray<>(), new SparseArray<>()};
private SparseArray<MessageObject> repliesMessagesDict = new SparseArray<>();
private HashMap<String, ArrayList<MessageObject>> messagesByDays = new HashMap<>();
protected ArrayList<MessageObject> messages = new ArrayList<>();
private SparseArray<MessageObject> waitingForReplies = new SparseArray<>();
@ -633,7 +636,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
private int distanceToPeer;
private int chatListViewPaddingTop;
private float chatListViewPaddingTop;
private int chatListViewPaddingVisibleOffset;
private int contentPaddingTop;
@ -649,6 +652,8 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
private int transitionAnimationIndex;
private int scrollAnimationIndex;
private int scrollCallbackAnimationIndex;
private final static int[] allowedNotificationsDuringChatListAnimations = new int[]{
NotificationCenter.messagesRead,
NotificationCenter.threadMessagesRead,
@ -697,7 +702,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
private boolean scrollByTouch;
private ChatActionCell infoTopView1;
public int getChatListViewPadding() {
public float getChatListViewPadding() {
return chatListViewPaddingTop;
}
@ -1114,7 +1119,6 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
int migrated_to = arguments.getInt("migrated_to", 0);
scrollToTopOnResume = arguments.getBoolean("scrollToTopOnResume", false);
needRemovePreviousSameChatActivity = arguments.getBoolean("need_remove_previous_same_chat_activity", true);
if (chatId != 0) {
currentChat = getMessagesController().getChat(chatId);
if (currentChat == null) {
@ -1496,6 +1500,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
}
getNotificationCenter().onAnimationFinish(transitionAnimationIndex);
getNotificationCenter().onAnimationFinish(scrollAnimationIndex);
getNotificationCenter().onAnimationFinish(scrollCallbackAnimationIndex);
hideUndoViews();
if (chatInviteRunnable != null) {
AndroidUtilities.cancelRunOnUIThread(chatInviteRunnable);
@ -3359,7 +3364,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
View child = getChildAt(a);
if (chatAdapter.isBot && child instanceof BotHelpCell) {
BotHelpCell botCell = (BotHelpCell) child;
int top = getMeasuredHeight() / 2 - child.getMeasuredHeight() / 2 + chatListViewPaddingTop;
float top = getMeasuredHeight() / 2 - child.getMeasuredHeight() / 2 + chatListViewPaddingTop;
if (!botCell.animating() && !chatListView.fastScrollAnimationRunning) {
if (child.getTop() > top) {
child.setTranslationY(top - child.getTop());
@ -4106,7 +4111,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
@Override
public int getStarForFixGap() {
int padding = chatListViewPaddingTop;
int padding = (int) chatListViewPaddingTop;
if (isThreadChat() && pinnedMessageView != null && pinnedMessageView.getVisibility() == View.VISIBLE) {
padding -= Math.max(0, AndroidUtilities.dp(48) + pinnedMessageEnterOffset);
}
@ -4116,7 +4121,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
@Override
protected int getParentStart() {
if (computingScroll) {
return chatListViewPaddingTop;
return (int) chatListViewPaddingTop;
}
return 0;
}
@ -4124,7 +4129,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
@Override
public int getStartAfterPadding() {
if (computingScroll) {
return chatListViewPaddingTop;
return (int) chatListViewPaddingTop;
}
return super.getStartAfterPadding();
}
@ -4132,7 +4137,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
@Override
public int getTotalSpace() {
if (computingScroll) {
return getHeight() - chatListViewPaddingTop - getPaddingBottom();
return (int) (getHeight() - chatListViewPaddingTop - getPaddingBottom());
}
return super.getTotalSpace();
}
@ -4164,7 +4169,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
@Override
public void scrollToPositionWithOffset(int position, int offset, boolean bottom) {
if (!bottom) {
offset = offset - getPaddingTop() + chatListViewPaddingTop;
offset = (int) (offset - getPaddingTop() + chatListViewPaddingTop);
}
super.scrollToPositionWithOffset(position, offset, bottom);
}
@ -4238,13 +4243,13 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
int n = chatListView.getChildCount();
for (int i = 0; i < n; i++) {
View child = chatListView.getChildAt(i);
int padding = chatListViewPaddingTop;
float padding = chatListViewPaddingTop;
if (isThreadChat() && pinnedMessageView != null && pinnedMessageView.getVisibility() == View.VISIBLE) {
padding -= Math.max(0, AndroidUtilities.dp(48) + pinnedMessageEnterOffset);
}
if (chatListView.getChildAdapterPosition(child) == chatAdapter.getItemCount() - 1) {
if (child.getTop() - dy > padding) {
dy = child.getTop() - padding;
dy = (int) (child.getTop() - padding);
}
return super.scrollVerticallyBy(dy, recycler, state);
}
@ -4848,6 +4853,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
closeReportSpam = new ImageView(context);
closeReportSpam.setImageResource(R.drawable.miniplayer_close);
closeReportSpam.setContentDescription(LocaleController.getString("Close", R.string.Close));
if (Build.VERSION.SDK_INT >= 21) {
closeReportSpam.setBackground(Theme.createSelectorDrawable(Theme.getColor(Theme.key_chat_topPanelClose) & 0x19ffffff));
}
@ -6838,6 +6844,9 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
private Animator infoTopViewAnimator;
private void updateInfoTopView(boolean animated) {
if (contentView == null) {
return;
}
SharedPreferences preferences = MessagesController.getNotificationsSettings(currentAccount);
distanceToPeer = preferences.getInt("dialog_bar_distance" + dialog_id, -1);
@ -7118,8 +7127,8 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
if (pinnedMessageView != null && pinnedMessageView.getVisibility() == View.VISIBLE) {
pinnedViewH = Math.max(0, AndroidUtilities.dp(48) + pinnedMessageEnterOffset);
}
int oldPadding = chatListViewPaddingTop;
chatListViewPaddingTop = (int) (AndroidUtilities.dp(4) + contentPaddingTop + topPanelViewH + pinnedViewH);
float oldPadding = chatListViewPaddingTop;
chatListViewPaddingTop = AndroidUtilities.dp(4) + contentPaddingTop + topPanelViewH + pinnedViewH;
chatListViewPaddingVisibleOffset = 0;
chatListViewPaddingTop += contentPanTranslation + bottomPanelTranslationY;
if (bottomPanelTranslationY == 0 && !chatActivityEnterView.pannelAniamationInProgress() && contentView.getLayoutParams().height < 0) {
@ -7182,7 +7191,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
invalidateMessagesVisiblePart();
}
chatListView.setTopGlowOffset(chatListViewPaddingTop - chatListViewPaddingVisibleOffset - AndroidUtilities.dp(4));
chatListView.setTopGlowOffset((int) (chatListViewPaddingTop - chatListViewPaddingVisibleOffset - AndroidUtilities.dp(4)));
if (oldPadding != chatListViewPaddingTop) {
int n = chatListView.getChildCount();
@ -7190,12 +7199,12 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
View child = chatListView.getChildAt(i);
int adapterPosition = chatListView.getChildAdapterPosition(child);
if (adapterPosition == chatAdapter.getItemCount() - 1) {
int padding = chatListViewPaddingTop;
float padding = chatListViewPaddingTop;
if (isThreadChat() && pinnedMessageView != null && pinnedMessageView.getVisibility() == View.VISIBLE) {
padding -= Math.max(0, AndroidUtilities.dp(48) + pinnedMessageEnterOffset);
}
if (child.getTop() > padding) {
chatListView.scrollBy(0, child.getTop() - padding);
chatListView.scrollBy(0, (int) (child.getTop() - padding));
}
break;
}
@ -7203,7 +7212,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
}
if (!isThreadChat() && !wasManualScroll && unreadMessageObject != null && chatListView != null) {
chatListView.scrollBy(0, oldPadding - chatListViewPaddingTop);
chatListView.scrollBy(0, (int) (oldPadding - chatListViewPaddingTop));
}
}
@ -9798,6 +9807,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
boolean previousThreadMessageVisible = threadMessageVisible;
int previousPinnedMessageId = currentPinnedMessageId;
int maxVisibleId = Integer.MIN_VALUE;
MessageObject maxVisibleMessageObject = null;
threadMessageVisible = firstLoading;
Integer currentReadMaxId;
@ -9832,14 +9842,17 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
if (view instanceof ChatMessageCell) {
ChatMessageCell messageCell = (ChatMessageCell) view;
messageObject = messageCell.getMessageObject();
maxVisibleId = Math.max(maxVisibleId, messageObject.getId());
if (messageObject.getId() > maxVisibleId) {
maxVisibleId = messageObject.getId();
maxVisibleMessageObject = messageObject;
}
int viewTop = top >= 0 ? 0 : -top;
int viewBottom = messageCell.getMeasuredHeight();
if (viewBottom > height) {
viewBottom = viewTop + height;
}
messageCell.setVisiblePart(viewTop, viewBottom - viewTop, recyclerChatViewHeight, contentView.getKeyboardHeight());
messageCell.setVisiblePart(viewTop, viewBottom - viewTop, recyclerChatViewHeight, contentView.getKeyboardHeight());
if (!threadMessageVisible && threadMessageObject != null && messageObject == threadMessageObject && messageCell.getBottom() > chatListViewPaddingTop) {
threadMessageVisible = true;
@ -9908,14 +9921,34 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
}
}
currentPinnedMessageId = 0;
if (maxVisibleId == Integer.MIN_VALUE) {
if (startLoadFromMessageId != 0) {
maxVisibleId = startLoadFromMessageId;
} else if (!pinnedMessageIds.isEmpty()) {
maxVisibleId = pinnedMessageIds.get(0) + 1;
}
}
if (!pinnedMessageIds.isEmpty()) {
if (maxVisibleId == Integer.MIN_VALUE) {
if (startLoadFromMessageId != 0) {
maxVisibleId = startLoadFromMessageId;
} else if (!pinnedMessageIds.isEmpty()) {
maxVisibleId = pinnedMessageIds.get(0) + 1;
}
} else if (maxVisibleId < 0) {
int idx = messages.indexOf(maxVisibleMessageObject);
if (idx >= 0) {
for (int a = idx - 1; a >= 0; a--) {
MessageObject object = messages.get(a);
if (object.getId() > 0) {
maxVisibleId = object.getId();
break;
}
}
if (maxVisibleId < 0) {
for (int a = idx + 1, N = messages.size(); a < N; a++) {
MessageObject object = messages.get(a);
if (object.getId() > 0) {
maxVisibleId = object.getId();
break;
}
}
}
}
}
currentPinnedMessageId = findClosest(pinnedMessageIds, forceNextPinnedMessageId != 0 ? forceNextPinnedMessageId : maxVisibleId, currentPinnedMessageIndex);
if (!loadingPinnedMessagesList && !pinnedEndReached && !pinnedMessageIds.isEmpty() && currentPinnedMessageIndex[0] > pinnedMessageIds.size() - 2) {
getMediaDataController().loadPinnedMessages(dialog_id, pinnedMessageIds.get(pinnedMessageIds.size() - 1), 0);
@ -10055,7 +10088,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
floatingDateView.setTranslationY(chatListView.getTranslationY() + chatListViewPaddingTop + floatingDateViewOffset - AndroidUtilities.dp(4));
}
invalidateChatListViewTopPadding();
if (!firstLoading && !paused && !inPreviewMode && fragmentOpened && chatMode == 0 && !getMessagesController().ignoreSetOnline) {
if (!firstLoading && !paused && !inPreviewMode && (fragmentOpened || inBubbleMode) && chatMode == 0 && !getMessagesController().ignoreSetOnline) {
int scheduledRead = 0;
if ((maxPositiveUnreadId != Integer.MIN_VALUE || maxNegativeUnreadId != Integer.MAX_VALUE)) {
int counterDecrement = 0;
@ -10184,7 +10217,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
private int getScrollOffsetForMessage(MessageObject object) {
int exactlyHeight = getHeightForMessage(object);
return Math.max(-AndroidUtilities.dp(2), (chatListView.getMeasuredHeight() - chatListViewPaddingTop - exactlyHeight) / 2);
return (int) Math.max(-AndroidUtilities.dp(2), (chatListView.getMeasuredHeight() - chatListViewPaddingTop - exactlyHeight) / 2);
}
private int getHeightForMessage(MessageObject object) {
@ -10330,7 +10363,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
if (found) {
int yOffset = getScrollOffsetForMessage(object);
int scrollY = view.getTop() - chatListViewPaddingTop - yOffset;
int scrollY = (int) (view.getTop() - chatListViewPaddingTop - yOffset);
int maxScrollOffset = chatListView.computeVerticalScrollRange() - chatListView.computeVerticalScrollOffset() - chatListView.computeVerticalScrollExtent();
if (maxScrollOffset < 0) maxScrollOffset = 0;
if (scrollY > maxScrollOffset) {
@ -10349,7 +10382,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
chatScrollHelperCallback.scrollTo = object;
chatScrollHelperCallback.lastBottom = false;
chatScrollHelperCallback.lastItemOffset = yOffset;
chatScrollHelperCallback.lastPadding = chatListViewPaddingTop;
chatScrollHelperCallback.lastPadding = (int) chatListViewPaddingTop;
chatScrollHelper.setScrollDirection(scrollDirection);
chatScrollHelper.scrollToPosition(position, yOffset, false, true);
canShowPagedownButton = true;
@ -11453,7 +11486,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
if (view instanceof ChatActionCell && currentChat != null) {
object.dialogId = -currentChat.id;
}
object.clipTopAddition = chatListViewPaddingTop - chatListViewPaddingVisibleOffset - AndroidUtilities.dp(4);
object.clipTopAddition = (int) (chatListViewPaddingTop - chatListViewPaddingVisibleOffset - AndroidUtilities.dp(4));
return object;
}
}
@ -11877,6 +11910,28 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
endReached[loadIndex] = true;
}
if (isThreadChat() && load_type == 0 && forwardEndReached[0] && !pendingSendMessages.isEmpty()) {
int pasteIndex = 0;
int date = pendingSendMessages.get(0).messageOwner.date;
if (!messArr.isEmpty()) {
if (date >= messArr.get(0).messageOwner.date) {
pasteIndex = 0;
} else if (date <= messArr.get(messArr.size() - 1).messageOwner.date) {
pasteIndex = messArr.size();
} else {
for (int a = 0, N = messArr.size(); a < N - 1; a++) {
if (messArr.get(a).messageOwner.date >= date && messArr.get(a + 1).messageOwner.date <= date) {
pasteIndex = a + 1;
}
}
}
}
messArr = new ArrayList<>(messArr);
messArr.addAll(pasteIndex, pendingSendMessages);
pendingSendMessages.clear();
pendingSendMessagesDict.clear();
}
if (!threadMessageAdded && isThreadChat() && (load_type == 0 && messArr.size() < count || (load_type == 2 || load_type == 3) && endReached[0])) {
TLRPC.Message msg = new TLRPC.TL_message();
if (threadMessageObject.getRepliesCount() == 0) {
@ -11933,6 +11988,9 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
}
for (int a = 0; a < messArr.size(); a++) {
MessageObject obj = messArr.get(a);
if (obj.replyMessageObject != null) {
repliesMessagesDict.put(obj.replyMessageObject.getId(), obj.replyMessageObject);
}
int messageId = obj.getId();
if (threadMessageId != 0) {
if (messageId <= (obj.isOut() ? threadMaxOutboxReadId : threadMaxInboxReadId)) {
@ -12437,7 +12495,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
chatScrollHelperCallback.scrollTo = null;
chatScrollHelperCallback.lastBottom = true;
chatScrollHelperCallback.lastItemOffset = 0;
chatScrollHelperCallback.lastPadding = chatListViewPaddingTop;
chatScrollHelperCallback.lastPadding = (int) chatListViewPaddingTop;
chatScrollHelper.scrollToPosition(0, 0, true, true);
} else {
MessageObject object = messagesDict[loadIndex].get(postponedScrollMessageId);
@ -12476,7 +12534,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
chatScrollHelperCallback.scrollTo = object;
chatScrollHelperCallback.lastBottom = false;
chatScrollHelperCallback.lastItemOffset = yOffset;
chatScrollHelperCallback.lastPadding = chatListViewPaddingTop;
chatScrollHelperCallback.lastPadding = (int) chatListViewPaddingTop;
chatScrollHelper.scrollToPosition(chatAdapter.messagesStartRow + k, yOffset, false, true);
}
}
@ -12872,6 +12930,13 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
}
Integer msgId = (Integer) args[0];
MessageObject obj = messagesDict[0].get(msgId);
if (isThreadChat() && pendingSendMessagesDict.size() > 0) {
MessageObject object = pendingSendMessagesDict.get(msgId);
if (object != null) {
Integer newMsgId = (Integer) args[1];
pendingSendMessagesDict.put(newMsgId, object);
}
}
if (obj != null) {
if (obj.shouldRemoveVideoEditedInfo) {
obj.videoEditedInfo = null;
@ -13540,6 +13605,11 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
} else if (id == NotificationCenter.replyMessagesDidLoad) {
long did = (Long) args[0];
if (did == dialog_id) {
ArrayList<MessageObject> loadedMessages = (ArrayList<MessageObject>) args[1];
for (int a = 0, N = loadedMessages.size(); a < N; a++) {
MessageObject obj = loadedMessages.get(a);
repliesMessagesDict.put(obj.getId(), obj);
}
updateVisibleRows();
} else if (waitingForReplies.size() != 0 && ChatObject.isChannel(currentChat) && !currentChat.megagroup && chatInfo != null && did == -chatInfo.linked_chat_id) {
checkWaitingForReplies();
@ -14349,13 +14419,17 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
boolean notifiedSearch = false;
LongSparseArray<Long> scheduledGroupReplacement = null;
for (int a = 0; a < arr.size(); a++) {
for (int a = 0, N = arr.size(); a < N; a++) {
MessageObject messageObject = arr.get(a);
int messageId = messageObject.getId();
if (threadMessageId != 0) {
if (messageId > 0 && messageId <= (messageObject.isOut() ? threadMaxOutboxReadId : threadMaxInboxReadId)) {
messageObject.setIsRead();
}
if (!forwardEndReached[0] && messageId < 0) {
pendingSendMessagesDict.put(messageId, messageObject);
pendingSendMessages.add(messageObject);
}
}
if (messageObject.isDice() && !messageObject.isForwarded()) {
messageObject.wasUnread = true;
@ -14420,6 +14494,9 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
}
if (messageObject.getReplyMsgId() != 0 && messageObject.replyMessageObject == null) {
messageObject.replyMessageObject = messagesDict[0].get(messageObject.getReplyMsgId());
if (messageObject.replyMessageObject == null && messageObject.getDialogId() != mergeDialogId) {
messageObject.replyMessageObject = repliesMessagesDict.get(messageObject.getReplyMsgId());
}
if (messageObject.messageOwner.action instanceof TLRPC.TL_messageActionPinMessage) {
messageObject.generatePinMessageText(null, null);
} else if (messageObject.messageOwner.action instanceof TLRPC.TL_messageActionGameScore) {
@ -14942,17 +15019,20 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
for (int a = 0; a < size; a++) {
Integer mid = markAsDeletedMessages.get(a);
MessageObject obj = messagesDict[loadIndex].get(mid);
if (loadIndex == 0 && pinnedMessageObjects.containsKey(mid)) {
pinnedMessageObjects.remove(mid);
pinnedMessageIds.remove(mid);
loadedPinnedMessagesCount = pinnedMessageIds.size();
totalPinnedMessagesCount--;
if (totalPinnedMessagesCount < 0) {
totalPinnedMessagesCount = 0;
}
if (currentPinnedMessageId == mid) {
currentPinnedMessageId = 0;
if (loadIndex == 0) {
if (pinnedMessageObjects.containsKey(mid)) {
pinnedMessageObjects.remove(mid);
pinnedMessageIds.remove(mid);
loadedPinnedMessagesCount = pinnedMessageIds.size();
totalPinnedMessagesCount--;
if (totalPinnedMessagesCount < 0) {
totalPinnedMessagesCount = 0;
}
if (currentPinnedMessageId == mid) {
currentPinnedMessageId = 0;
}
}
repliesMessagesDict.remove(mid);
}
if (obj != null) {
if (obj.messageOwner.reply_to != null && !(obj.messageOwner.action instanceof TLRPC.TL_messageActionPinMessage)) {
@ -15152,6 +15232,9 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
updatePinnedMessageView(true);
}
}
if (loadIndex == 0 && repliesMessagesDict.indexOfKey(messageObject.getId()) >= 0) {
repliesMessagesDict.put(messageObject.getId(), messageObject);
}
if (old == null || remove && old.messageOwner.date != messageObject.messageOwner.date) {
continue;
}
@ -21627,12 +21710,10 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
private boolean lastBottom;
private int lastPadding;
int animationIndex;
@Override
public void onStartAnimation() {
super.onStartAnimation();
animationIndex = getNotificationCenter().setAnimationInProgress(animationIndex, allowedNotificationsDuringChatListAnimations);
scrollCallbackAnimationIndex = getNotificationCenter().setAnimationInProgress(scrollCallbackAnimationIndex, allowedNotificationsDuringChatListAnimations);
}
@Override
@ -21641,7 +21722,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
chatAdapter.updateRowsSafe();
int lastItemPosition = chatAdapter.messagesStartRow + messages.indexOf(scrollTo);
if (lastItemPosition >= 0) {
chatLayoutManager.scrollToPositionWithOffset(lastItemPosition, lastItemOffset + lastPadding - chatListViewPaddingTop, lastBottom);
chatLayoutManager.scrollToPositionWithOffset(lastItemPosition, (int) (lastItemOffset + lastPadding - chatListViewPaddingTop), lastBottom);
}
} else {
chatAdapter.updateRowsSafe();
@ -21653,7 +21734,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
updateVisibleRows();
AndroidUtilities.runOnUIThread(() -> getNotificationCenter().onAnimationFinish(animationIndex));
AndroidUtilities.runOnUIThread(() -> getNotificationCenter().onAnimationFinish(scrollCallbackAnimationIndex));
}
@Override

View file

@ -192,7 +192,7 @@ public class ChatEditTypeActivity extends BaseFragment implements NotificationCe
});
ActionBarMenu menu = actionBar.createMenu();
menu.addItemWithWidth(done_button, R.drawable.ic_done, AndroidUtilities.dp(56));
menu.addItemWithWidth(done_button, R.drawable.ic_done, AndroidUtilities.dp(56), LocaleController.getString("Done", R.string.Done));
fragmentView = new ScrollView(context) {
@Override

View file

@ -545,7 +545,7 @@ public class ChatLinkActivity extends BaseFragment implements NotificationCenter
} else {
finishFragment();
}
}));
}), ConnectionsManager.RequestFlagInvokeAfter);
AndroidUtilities.runOnUIThread(() -> {
if (progressDialog[0] == null) {
return;

View file

@ -777,6 +777,18 @@ public class ChatUsersActivity extends BaseFragment implements NotificationCente
public void didChangeOwner(TLRPC.User user) {
onOwnerChaged(user);
}
@Override
public void didSelectUser(int uid) {
final TLRPC.User user = getMessagesController().getUser(uid);
if (user != null) {
AndroidUtilities.runOnUIThread(() -> {
if (BulletinFactory.canShowBulletin(ChatUsersActivity.this)) {
BulletinFactory.createPromoteToAdminBulletin(ChatUsersActivity.this, user.first_name).show();
}
}, 200);
}
}
});
fragment.setInfo(info);
presentFragment(fragment);
@ -1292,6 +1304,9 @@ public class ChatUsersActivity extends BaseFragment implements NotificationCente
channelParticipant.banned_rights = rightsBanned;
channelParticipant.rank = rank;
}
if (delegate != null && rights == 1) {
delegate.didSelectUser(user_id);
}
if (removeFragment) {
removeSelfFromStack();
}

View file

@ -1687,7 +1687,7 @@ public class ChatAttachAlertLocationLayout extends ChatAttachAlert.AttachAlertLa
themeDescriptions.add(new ThemeDescription(searchListView, 0, new Class[]{LocationCell.class}, new String[]{"addressTextView"}, null, null, null, Theme.key_windowBackgroundWhiteGrayText3));
themeDescriptions.add(new ThemeDescription(listView, 0, new Class[]{SharingLiveLocationCell.class}, new String[]{"nameTextView"}, null, null, null, Theme.key_windowBackgroundWhiteBlackText));
themeDescriptions.add(new ThemeDescription(listView, 0, new Class[]{SharingLiveLocationCell.class}, new String[]{"distanceTextView"}, null, null, null, Theme.key_windowBackgroundWhiteGrayText2));
themeDescriptions.add(new ThemeDescription(listView, 0, new Class[]{SharingLiveLocationCell.class}, new String[]{"distanceTextView"}, null, null, null, Theme.key_windowBackgroundWhiteGrayText3));
themeDescriptions.add(new ThemeDescription(listView, 0, new Class[]{LocationLoadingCell.class}, new String[]{"progressBar"}, null, null, null, Theme.key_progressCircle));
themeDescriptions.add(new ThemeDescription(listView, 0, new Class[]{LocationLoadingCell.class}, new String[]{"textView"}, null, null, null, Theme.key_windowBackgroundWhiteGrayText3));

View file

@ -20,6 +20,7 @@ import android.os.Bundle;
import android.text.TextUtils;
import android.view.Gravity;
import android.view.View;
import android.view.accessibility.AccessibilityNodeInfo;
import android.widget.FrameLayout;
import android.widget.ImageView;
@ -74,16 +75,31 @@ public class ChatAvatarContainer extends FrameLayout implements NotificationCent
super(context);
parentFragment = chatActivity;
avatarImageView = new BackupImageView(context);
final boolean avatarClickable = parentFragment != null && parentFragment.getChatMode() == 0 && !UserObject.isReplyUser(parentFragment.getCurrentUser());
avatarImageView = new BackupImageView(context) {
@Override
public void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo info) {
super.onInitializeAccessibilityNodeInfo(info);
if (avatarClickable && getImageReceiver().hasNotThumb()) {
info.setText(LocaleController.getString("AccDescrProfilePicture", R.string.AccDescrProfilePicture));
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
info.addAction(new AccessibilityNodeInfo.AccessibilityAction(AccessibilityNodeInfo.ACTION_CLICK, LocaleController.getString("Open", R.string.Open)));
}
} else {
info.setVisibleToUser(false);
}
}
};
if (parentFragment != null) {
sharedMediaPreloader = new SharedMediaLayout.SharedMediaPreloader(chatActivity);
if (parentFragment.isThreadChat() || parentFragment.getChatMode() == 2) {
avatarImageView.setVisibility(GONE);
}
}
avatarImageView.setContentDescription(LocaleController.getString("AccDescrProfilePicture", R.string.AccDescrProfilePicture));
avatarImageView.setRoundRadius(AndroidUtilities.dp(21));
addView(avatarImageView);
if (parentFragment != null && parentFragment.getChatMode() == 0 && !UserObject.isReplyUser(parentFragment.getCurrentUser())) {
if (avatarClickable) {
avatarImageView.setOnClickListener(v -> openProfile(true));
}
@ -647,4 +663,12 @@ public class ChatAvatarContainer extends FrameLayout implements NotificationCent
subtitleTextView.setTag(Theme.key_actionBarDefaultSubtitle);
}
}
@Override
public void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo info) {
super.onInitializeAccessibilityNodeInfo(info);
if (info.isClickable() && Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
info.addAction(new AccessibilityNodeInfo.AccessibilityAction(AccessibilityNodeInfo.ACTION_CLICK, LocaleController.getString("OpenProfile", R.string.OpenProfile)));
}
}
}

View file

@ -1316,10 +1316,6 @@ public class FragmentContextView extends FrameLayout implements NotificationCent
animatorSet = null;
}
final int currentAccount = account;
if (animatorSet != null) {
animatorSet.cancel();
animatorSet = null;
}
animationIndex = NotificationCenter.getInstance(currentAccount).setAnimationInProgress(animationIndex, null);
animatorSet = new AnimatorSet();
animatorSet.playTogether(ObjectAnimator.ofFloat(this, "topPadding", 0));

View file

@ -239,6 +239,11 @@ public class GroupCallPip implements NotificationCenter.NotificationCenterDelega
AndroidUtilities.cancelRunOnUIThread(micRunnable);
AndroidUtilities.cancelRunOnUIThread(pressedRunnable);
if (animateToPrepareRemove) {
if (pressed) {
if (VoIPService.getSharedInstance() != null) {
VoIPService.getSharedInstance().setMicMute(true, false, false);
}
}
pressed = false;
remove();
return false;

View file

@ -1044,6 +1044,10 @@ public class PhotoPaintView extends FrameLayout implements EntityView.EntityView
}
protected void onTextAdd() {
}
private Size baseStickerSize() {
float side = (float) Math.floor(getPaintingSize().width * 0.5);
return new Size(side, side);
@ -1081,6 +1085,7 @@ public class PhotoPaintView extends FrameLayout implements EntityView.EntityView
}
private TextPaintView createText(boolean select) {
onTextAdd();
Swatch currentSwatch = colorPicker.getSwatch();
Swatch swatch;
if (selectedTextType == 0) {

View file

@ -340,8 +340,8 @@ public class SearchViewPager extends ViewPagerFixed implements FilteredSearchVie
actionMode.addView(selectedMessagesCountTextView, LayoutHelper.createLinear(0, LayoutHelper.MATCH_PARENT, 1.0f, 72, 0, 0, 0));
selectedMessagesCountTextView.setOnTouchListener((v, event) -> true);
gotoItem = actionMode.addItemWithWidth(gotoItemId, R.drawable.msg_message, AndroidUtilities.dp(54));
forwardItem = actionMode.addItemWithWidth(forwardItemId, R.drawable.msg_forward, AndroidUtilities.dp(54));
gotoItem = actionMode.addItemWithWidth(gotoItemId, R.drawable.msg_message, AndroidUtilities.dp(54), LocaleController.getString("AccDescrGoToMessage", R.string.AccDescrGoToMessage));
forwardItem = actionMode.addItemWithWidth(forwardItemId, R.drawable.msg_forward, AndroidUtilities.dp(54), LocaleController.getString("Forward", R.string.Forward));
}
if (parent.getActionBar().getBackButton().getDrawable() instanceof MenuDrawable) {
parent.getActionBar().setBackButtonDrawable(new BackDrawable(false));

View file

@ -57,9 +57,6 @@ public class VoIPToggleButton extends FrameLayout {
private float crossProgress;
private boolean drawCross;
private Bitmap iconBitmap;
private Canvas iconCanvas;
private float crossOffset;
Drawable rippleDrawable;
@ -144,14 +141,6 @@ public class VoIPToggleButton extends FrameLayout {
}
icon[0].setAlpha(255);
if (iconBitmap == null) {
iconBitmap = Bitmap.createBitmap(AndroidUtilities.dp(32), AndroidUtilities.dp(32), Bitmap.Config.ARGB_8888);
iconCanvas = new Canvas(iconBitmap);
} else {
iconBitmap.eraseColor(Color.TRANSPARENT);
}
float x = iconBitmap.getWidth() >> 1;
float y = iconBitmap.getHeight() >> 1;
if (replaceProgress != 0 && iconChangeColor) {
int color = ColorUtils.blendARGB(replaceColorFrom, currentIconColor, replaceProgress);
icon[0].setColorFilter(new PorterDuffColorFilter(color, PorterDuff.Mode.MULTIPLY));
@ -175,8 +164,8 @@ public class VoIPToggleButton extends FrameLayout {
}
}
if (crossProgress > 0) {
int left = (int) (x - icon[0].getIntrinsicWidth() / 2f);
int top = (int) (x - icon[0].getIntrinsicHeight() / 2);
int left = (int) (cx - icon[0].getIntrinsicWidth() / 2f);
int top = (int) (cy - icon[0].getIntrinsicHeight() / 2);
float startX = left + AndroidUtilities.dpf2(8) + crossOffset;
float startY = top + AndroidUtilities.dpf2(8);
@ -184,15 +173,16 @@ public class VoIPToggleButton extends FrameLayout {
float endX = startX - AndroidUtilities.dp(1) + AndroidUtilities.dp(17) * CubicBezierInterpolator.DEFAULT.getInterpolation(crossProgress);
float endY = startY + AndroidUtilities.dp(17) * CubicBezierInterpolator.DEFAULT.getInterpolation(crossProgress);
canvas.saveLayerAlpha(0, 0, getMeasuredWidth(), getMeasuredHeight(), 255, Canvas.ALL_SAVE_FLAG);
icon[0].setBounds(
(int) (x - icon[0].getIntrinsicWidth() / 2f), (int) (y - icon[0].getIntrinsicHeight() / 2),
(int) (x + icon[0].getIntrinsicWidth() / 2), (int) (y + icon[0].getIntrinsicHeight() / 2)
(int) (cx - icon[0].getIntrinsicWidth() / 2f), (int) (cy - icon[0].getIntrinsicHeight() / 2),
(int) (cx + icon[0].getIntrinsicWidth() / 2), (int) (cy + icon[0].getIntrinsicHeight() / 2)
);
icon[0].draw(iconCanvas);
icon[0].draw(canvas);
iconCanvas.drawLine(startX, startY - AndroidUtilities.dp(2f), endX, endY - AndroidUtilities.dp(2f), xRefPaint);
iconCanvas.drawLine(startX, startY, endX, endY, crossPaint);
canvas.drawBitmap(iconBitmap, cx - x, cy - y, bitmapPaint);
canvas.drawLine(startX, startY - AndroidUtilities.dp(2f), endX, endY - AndroidUtilities.dp(2f), xRefPaint);
canvas.drawLine(startX, startY, endX, endY, crossPaint);
canvas.restore();
} else {
icon[0].setBounds(
(int) (cx - icon[0].getIntrinsicWidth() / 2f), (int) (cy - icon[0].getIntrinsicHeight() / 2),
@ -371,34 +361,37 @@ public class VoIPToggleButton extends FrameLayout {
}
}
//animate background if true
public void setCheckable(boolean checkable) {
this.checkable = checkable;
}
public void setChecked(boolean checked, boolean animated) {
this.checked = checked;
if (animated) {
if (checkAnimator != null) {
checkAnimator.removeAllListeners();
checkAnimator.cancel();
}
checkAnimator = ValueAnimator.ofFloat(checkedProgress, checked ? 1f : 0);
checkAnimator.addUpdateListener(valueAnimator -> {
checkedProgress = (float) valueAnimator.getAnimatedValue();
setBackgroundColor(backgroundCheck1, backgroundCheck2);
});
checkAnimator.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
checkedProgress = checked ? 1f : 0;
setBackgroundColor(backgroundCheck1, backgroundCheck2);
if (checkable) {
if (animated) {
if (checkAnimator != null) {
checkAnimator.removeAllListeners();
checkAnimator.cancel();
}
});
checkAnimator.setDuration(150);
checkAnimator.start();
} else {
checkedProgress = checked ? 1f : 0;
setBackgroundColor(backgroundCheck1, backgroundCheck2);
checkAnimator = ValueAnimator.ofFloat(checkedProgress, checked ? 1f : 0);
checkAnimator.addUpdateListener(valueAnimator -> {
checkedProgress = (float) valueAnimator.getAnimatedValue();
setBackgroundColor(backgroundCheck1, backgroundCheck2);
});
checkAnimator.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
checkedProgress = checked ? 1f : 0;
setBackgroundColor(backgroundCheck1, backgroundCheck2);
}
});
checkAnimator.setDuration(150);
checkAnimator.start();
} else {
checkedProgress = checked ? 1f : 0;
setBackgroundColor(backgroundCheck1, backgroundCheck2);
}
}
}

View file

@ -136,11 +136,12 @@ public class VoIPWindowView extends FrameLayout {
}
} else {
animationIndex = NotificationCenter.getInstance(UserConfig.selectedAccount).setAnimationInProgress(animationIndex, null);
int account = UserConfig.selectedAccount;
animationIndex = NotificationCenter.getInstance(account).setAnimationInProgress(animationIndex, null);
animate().translationX(getMeasuredWidth()).setListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
NotificationCenter.getInstance(UserConfig.selectedAccount).onAnimationFinish(animationIndex);
NotificationCenter.getInstance(account).onAnimationFinish(animationIndex);
if (getParent() != null) {
activity.setRequestedOrientation(orientationBefore);

View file

@ -147,11 +147,12 @@ public class ContactsActivity extends BaseFragment implements NotificationCenter
private boolean checkPermission = true;
private final static int search_button = 0;
private final static int sort_button = 1;
private AnimatorSet bounceIconAnimator;
private int animationIndex = -1;
private final static int search_button = 0;
private final static int sort_button = 1;
public interface ContactsActivityDelegate {
void didSelectContact(TLRPC.User user, String param, ContactsActivity activity);
}
@ -207,6 +208,7 @@ public class ContactsActivity extends BaseFragment implements NotificationCenter
NotificationCenter.getInstance(currentAccount).removeObserver(this, NotificationCenter.closeChats);
delegate = null;
AndroidUtilities.removeAdjustResize(getParentActivity(), classGuid);
getNotificationCenter().onAnimationFinish(animationIndex);
}
@Override
@ -1038,7 +1040,7 @@ public class ContactsActivity extends BaseFragment implements NotificationCenter
});
animatorSet.playTogether(valueAnimator);
AndroidUtilities.runOnUIThread(() -> {
animationIndex = NotificationCenter.getInstance(currentAccount).setAnimationInProgress(animationIndex, null);
animationIndex = getNotificationCenter().setAnimationInProgress(animationIndex, null);
animatorSet.start();
if (isOpen) {
floatingButton.setAnimation(R.raw.write_contacts_fab_icon, 52, 52);
@ -1178,7 +1180,7 @@ public class ContactsActivity extends BaseFragment implements NotificationCenter
previousFab.setScaleX(1f);
previousFab.setScaleY(1f);
bounceIconAnimator = null;
NotificationCenter.getInstance(currentAccount).onAnimationFinish(animationIndex);
getNotificationCenter().onAnimationFinish(animationIndex);
}
});
bounceIconAnimator.start();

View file

@ -74,8 +74,6 @@ import android.widget.TextView;
import androidx.core.graphics.ColorUtils;
import com.google.android.exoplayer2.util.Log;
import org.telegram.messenger.AccountInstance;
import org.telegram.messenger.AndroidUtilities;
import org.telegram.messenger.ApplicationLoader;
@ -493,6 +491,9 @@ public class DialogsActivity extends BaseFragment implements NotificationCenter.
if (child == fragmentContextView && fragmentContextView.getCurrentStyle() == 3) {
return true;
}
if (child == blurredView) {
return true;
}
boolean result;
if (child == viewPages[0] || (viewPages.length > 1 && child == viewPages[1]) || child == fragmentContextView || child == fragmentLocationContextView) {
canvas.save();
@ -605,6 +606,18 @@ public class DialogsActivity extends BaseFragment implements NotificationCenter.
fragmentContextView.setDrawOverlay(false);
canvas.restore();
}
if (blurredView != null && blurredView.getVisibility() == View.VISIBLE) {
if (blurredView.getAlpha() != 1f) {
if (blurredView.getAlpha() != 0) {
canvas.saveLayerAlpha(blurredView.getLeft(), blurredView.getTop(), blurredView.getRight(), blurredView.getBottom(), (int) (255 * blurredView.getAlpha()), Canvas.ALL_SAVE_FLAG);
canvas.translate(blurredView.getLeft(), blurredView.getTop());
blurredView.draw(canvas);
canvas.restore();
}
} else {
blurredView.draw(canvas);
}
}
if (scrimView != null) {
canvas.drawRect(0, 0, getMeasuredWidth(), getMeasuredHeight(), scrimPaint);
canvas.save();
@ -1622,14 +1635,14 @@ public class DialogsActivity extends BaseFragment implements NotificationCenter.
getNotificationCenter().addObserver(this, NotificationCenter.messagesDeleted);
getNotificationCenter().addObserver(this, NotificationCenter.didDatabaseCleared);
getNotificationCenter().addObserver(this, NotificationCenter.didClearDatabase);
if (!dialogsLoaded[currentAccount]) {
MessagesController messagesController = getMessagesController();
messagesController.loadGlobalNotificationsSettings();
messagesController.loadDialogs(folderId, 0, 100, true);
messagesController.loadHintDialogs();
messagesController.loadUserInfo(UserConfig.getInstance(currentAccount).getCurrentUser(), false, classGuid);
messagesController.loadUserInfo(getUserConfig().getCurrentUser(), false, classGuid);
getContactsController().checkInviteText();
getMediaDataController().loadRecents(MediaDataController.TYPE_FAVE, false, true, false);
getMediaDataController().checkFeaturedStickers();
@ -1676,13 +1689,14 @@ public class DialogsActivity extends BaseFragment implements NotificationCenter.
NotificationCenter.getGlobalInstance().removeObserver(this, NotificationCenter.didSetPasscode);
}
getNotificationCenter().removeObserver(this, NotificationCenter.didDatabaseCleared);
getNotificationCenter().removeObserver(this, NotificationCenter.didClearDatabase);
if (commentView != null) {
commentView.onDestroy();
}
if (undoView[0] != null) {
undoView[0].hide(true, 0);
}
getNotificationCenter().onAnimationFinish(animationIndex);
delegate = null;
}
@ -2878,7 +2892,15 @@ public class DialogsActivity extends BaseFragment implements NotificationCenter.
if (commentView != null) {
commentView.onDestroy();
}
commentView = new ChatActivityEnterView(getParentActivity(), contentView, null, false);
commentView = new ChatActivityEnterView(getParentActivity(), contentView, null, false) {
@Override
public boolean dispatchTouchEvent(MotionEvent ev) {
if (ev.getAction() == MotionEvent.ACTION_DOWN) {
AndroidUtilities.requestAdjustResize(getParentActivity(), classGuid);
}
return super.dispatchTouchEvent(ev);
}
};
commentView.setAllowStickersAndGifs(false, false);
commentView.setForceShowSendButton(true, false);
commentView.setVisibility(View.GONE);
@ -3054,7 +3076,7 @@ public class DialogsActivity extends BaseFragment implements NotificationCenter.
actionBarDefaultPaint.setColor(Theme.getColor(folderId == 0 ? Theme.key_actionBarDefault : Theme.key_actionBarDefaultArchived));
if (inPreviewMode) {
final TLRPC.User currentUser = UserConfig.getInstance(currentAccount).getCurrentUser();
final TLRPC.User currentUser = getUserConfig().getCurrentUser();
avatarContainer = new ChatAvatarContainer(actionBar.getContext(), null, false);
avatarContainer.setTitle(UserObject.getUserName(currentUser));
avatarContainer.setSubtitle(LocaleController.formatUserStatus(currentAccount, currentUser));
@ -3537,7 +3559,7 @@ public class DialogsActivity extends BaseFragment implements NotificationCenter.
}
final boolean tosAccepted;
if (!afterSignup) {
tosAccepted = UserConfig.getInstance(UserConfig.selectedAccount).unacceptedTermsOfService == null;
tosAccepted = getUserConfig().unacceptedTermsOfService == null;
} else {
tosAccepted = false;
afterSignup = false;
@ -3894,7 +3916,7 @@ public class DialogsActivity extends BaseFragment implements NotificationCenter.
searchAnimator.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
NotificationCenter.getInstance(currentAccount).onAnimationFinish(animationIndex);
getNotificationCenter().onAnimationFinish(animationIndex);
if (searchAnimator != animation) {
return;
}
@ -3936,7 +3958,7 @@ public class DialogsActivity extends BaseFragment implements NotificationCenter.
@Override
public void onAnimationCancel(Animator animation) {
NotificationCenter.getInstance(currentAccount).onAnimationFinish(animationIndex);
getNotificationCenter().onAnimationFinish(animationIndex);
if (searchAnimator == animation) {
if (show) {
viewPages[0].listView.hide();
@ -3947,7 +3969,7 @@ public class DialogsActivity extends BaseFragment implements NotificationCenter.
}
}
});
animationIndex = NotificationCenter.getInstance(currentAccount).setAnimationInProgress(animationIndex, null);
animationIndex = getNotificationCenter().setAnimationInProgress(animationIndex, null);
searchAnimator.start();
if (tabsAlphaAnimator != null) {
tabsAlphaAnimator.start();
@ -4014,7 +4036,6 @@ public class DialogsActivity extends BaseFragment implements NotificationCenter.
filterTabsMoveFrom = Math.max(0, AndroidUtilities.dp(44) + actionBar.getTranslationY());
}
float animateFromScrollY = actionBar.getTranslationY();
final int account = currentAccount;
filtersTabAnimator.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
@ -4026,7 +4047,7 @@ public class DialogsActivity extends BaseFragment implements NotificationCenter.
if (fragmentView != null) {
fragmentView.requestLayout();
}
NotificationCenter.getInstance(account).onAnimationFinish(animationIndex);
getNotificationCenter().onAnimationFinish(animationIndex);
}
});
filtersTabAnimator.addUpdateListener(valueAnimator -> {
@ -4040,7 +4061,7 @@ public class DialogsActivity extends BaseFragment implements NotificationCenter.
});
filtersTabAnimator.setDuration(220);
filtersTabAnimator.setInterpolator(CubicBezierInterpolator.DEFAULT);
animationIndex = NotificationCenter.getInstance(account).setAnimationInProgress(animationIndex, null);
animationIndex = getNotificationCenter().setAnimationInProgress(animationIndex, null);
filtersTabAnimator.start();
fragmentView.requestLayout();
} else {
@ -4105,7 +4126,7 @@ public class DialogsActivity extends BaseFragment implements NotificationCenter.
MessagesController.DialogFilter filter = getMessagesController().dialogFilters.get(viewPage.selectedType);
if ((filter.flags & MessagesController.DIALOG_FILTER_FLAG_EXCLUDE_ARCHIVED) == 0) {
if (visibleItemCount > 0 && viewPage.layoutManager.findLastVisibleItemPosition() >= getDialogsArray(currentAccount, viewPage.dialogsType, 1, dialogsListFrozen).size() - 10 ||
visibleItemCount == 0 && !MessagesController.getInstance(currentAccount).isDialogsEndReached(1)) {
visibleItemCount == 0 && !getMessagesController().isDialogsEndReached(1)) {
loadArchivedFromCache = !getMessagesController().isDialogsEndReached(1);
if (loadArchivedFromCache || !getMessagesController().isServerDialogsEndReached(1)) {
loadArchived = true;
@ -4115,7 +4136,7 @@ public class DialogsActivity extends BaseFragment implements NotificationCenter.
}
}
if (visibleItemCount > 0 && viewPage.layoutManager.findLastVisibleItemPosition() >= getDialogsArray(currentAccount, viewPage.dialogsType, folderId, dialogsListFrozen).size() - 10 ||
visibleItemCount == 0 && (viewPage.dialogsType == 7 || viewPage.dialogsType == 8) && !MessagesController.getInstance(currentAccount).isDialogsEndReached(folderId)) {
visibleItemCount == 0 && (viewPage.dialogsType == 7 || viewPage.dialogsType == 8) && !getMessagesController().isDialogsEndReached(folderId)) {
loadFromCache = !getMessagesController().isDialogsEndReached(folderId);
if (loadFromCache || !getMessagesController().isServerDialogsEndReached(folderId)) {
load = true;
@ -4752,7 +4773,7 @@ public class DialogsActivity extends BaseFragment implements NotificationCenter.
getMessagesController().setDialogsInTransaction(true);
perfromSelectedDialogsAction(action, false);
getMessagesController().setDialogsInTransaction(false);
MessagesController.getInstance(currentAccount).checkIfFolderEmpty(folderId);
getMessagesController().checkIfFolderEmpty(folderId);
if (folderId != 0 && getDialogsArray(currentAccount, viewPages[0].dialogsType, folderId, false).size() == 0) {
viewPages[0].listView.setEmptyView(null);
viewPages[0].progressView.setVisibility(View.INVISIBLE);
@ -4928,7 +4949,7 @@ public class DialogsActivity extends BaseFragment implements NotificationCenter.
if (AndroidUtilities.isTablet()) {
getNotificationCenter().postNotificationName(NotificationCenter.closeChats, selectedDialog);
}
MessagesController.getInstance(currentAccount).checkIfFolderEmpty(folderId);
getMessagesController().checkIfFolderEmpty(folderId);
}
});
}
@ -5701,7 +5722,7 @@ public class DialogsActivity extends BaseFragment implements NotificationCenter.
getMessagesController().blockPeer(user.id);
}
}
MessagesController.getInstance(currentAccount).checkIfFolderEmpty(folderId);
getMessagesController().checkIfFolderEmpty(folderId);
};
if (undoView[0] != null) {
getUndoView().showWithAction(dialogId, UndoView.ACTION_DELETE, deleteRunnable);
@ -5725,7 +5746,7 @@ public class DialogsActivity extends BaseFragment implements NotificationCenter.
int channelId = (int) args[1];
searchViewPager.messagesDeleted(channelId, markAsDeletedMessages);
}
} else if (id == NotificationCenter.didDatabaseCleared) {
} else if (id == NotificationCenter.didClearDatabase) {
for (int a = 0; a < viewPages.length; a++) {
viewPages[a].dialogsAdapter.didDatabaseCleared();
}

View file

@ -253,7 +253,7 @@ public class FilteredSearchView extends FrameLayout implements NotificationCente
public final LinearLayoutManager layoutManager;
private final FlickerLoadingView loadingView;
private boolean firstLoading = true;
int animationIndex = -1;
private int animationIndex = -1;
public int keyboardHeight;
private final ChatActionCell floatingDateView;
@ -768,7 +768,6 @@ public class FilteredSearchView extends FrameLayout implements NotificationCente
@Override
public void onAnimationEnd(Animator animation) {
NotificationCenter.getInstance(currentAccount).onAnimationFinish(animationIndex);
super.onAnimationEnd(animation);
}
});
animationIndex = NotificationCenter.getInstance(currentAccount).setAnimationInProgress(animationIndex, null);

View file

@ -115,7 +115,7 @@ public class GroupCreateActivity extends BaseFragment implements NotificationCen
private SparseArray<TLObject> ignoreUsers;
private int maxCount = MessagesController.getInstance(currentAccount).maxMegagroupCount;
private int maxCount = getMessagesController().maxMegagroupCount;
private int chatType = ChatObject.CHAT_TYPE_CHAT;
private boolean isAlwaysShare;
private boolean isNeverShare;
@ -239,11 +239,11 @@ public class GroupCreateActivity extends BaseFragment implements NotificationCen
currentAnimation.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
NotificationCenter.getInstance(currentAccount).onAnimationFinish(animationIndex);
getNotificationCenter().onAnimationFinish(animationIndex);
requestLayout();
}
});
animationIndex = NotificationCenter.getInstance(currentAccount).setAnimationInProgress(animationIndex, null);
animationIndex = getNotificationCenter().setAnimationInProgress(animationIndex, null);
currentAnimation.start();
animationStarted = true;
} else {
@ -349,24 +349,24 @@ public class GroupCreateActivity extends BaseFragment implements NotificationCen
if (isAlwaysShare || isNeverShare || addToGroup) {
maxCount = 0;
} else {
maxCount = chatType == ChatObject.CHAT_TYPE_CHAT ? MessagesController.getInstance(currentAccount).maxMegagroupCount : MessagesController.getInstance(currentAccount).maxBroadcastCount;
maxCount = chatType == ChatObject.CHAT_TYPE_CHAT ? getMessagesController().maxMegagroupCount : getMessagesController().maxBroadcastCount;
}
}
@Override
public boolean onFragmentCreate() {
NotificationCenter.getInstance(currentAccount).addObserver(this, NotificationCenter.contactsDidLoad);
NotificationCenter.getInstance(currentAccount).addObserver(this, NotificationCenter.updateInterfaces);
NotificationCenter.getInstance(currentAccount).addObserver(this, NotificationCenter.chatDidCreated);
getNotificationCenter().addObserver(this, NotificationCenter.contactsDidLoad);
getNotificationCenter().addObserver(this, NotificationCenter.updateInterfaces);
getNotificationCenter().addObserver(this, NotificationCenter.chatDidCreated);
return super.onFragmentCreate();
}
@Override
public void onFragmentDestroy() {
super.onFragmentDestroy();
NotificationCenter.getInstance(currentAccount).removeObserver(this, NotificationCenter.contactsDidLoad);
NotificationCenter.getInstance(currentAccount).removeObserver(this, NotificationCenter.updateInterfaces);
NotificationCenter.getInstance(currentAccount).removeObserver(this, NotificationCenter.chatDidCreated);
getNotificationCenter().removeObserver(this, NotificationCenter.contactsDidLoad);
getNotificationCenter().removeObserver(this, NotificationCenter.updateInterfaces);
getNotificationCenter().removeObserver(this, NotificationCenter.chatDidCreated);
}
@Override
@ -698,7 +698,7 @@ public class GroupCreateActivity extends BaseFragment implements NotificationCen
if (maxCount != 0 && selectedContacts.size() == maxCount) {
return;
}
if (chatType == ChatObject.CHAT_TYPE_CHAT && selectedContacts.size() == MessagesController.getInstance(currentAccount).maxGroupCount) {
if (chatType == ChatObject.CHAT_TYPE_CHAT && selectedContacts.size() == getMessagesController().maxGroupCount) {
AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity());
builder.setTitle(LocaleController.getString("AppName", R.string.AppName));
builder.setMessage(LocaleController.getString("SoftUserLimitAlert", R.string.SoftUserLimitAlert));
@ -718,7 +718,7 @@ public class GroupCreateActivity extends BaseFragment implements NotificationCen
return;
}
if (channelId != 0) {
TLRPC.Chat chat = MessagesController.getInstance(currentAccount).getChat(channelId);
TLRPC.Chat chat = getMessagesController().getChat(channelId);
AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity());
if (ChatObject.canAddAdmins(chat)) {
builder.setTitle(LocaleController.getString("AppName", R.string.AppName));
@ -738,10 +738,10 @@ public class GroupCreateActivity extends BaseFragment implements NotificationCen
return;
}
}
MessagesController.getInstance(currentAccount).putUser(user, !searching);
getMessagesController().putUser(user, !searching);
} else {
TLRPC.Chat chat = (TLRPC.Chat) object;
MessagesController.getInstance(currentAccount).putChat(chat, !searching);
getMessagesController().putChat(chat, !searching);
}
GroupCreateSpan span = new GroupCreateSpan(editText.getContext(), object);
spansContainer.addSpan(span);
@ -1024,13 +1024,13 @@ public class GroupCreateActivity extends BaseFragment implements NotificationCen
if (chatType == ChatObject.CHAT_TYPE_CHANNEL) {
ArrayList<TLRPC.InputUser> result = new ArrayList<>();
for (int a = 0; a < selectedContacts.size(); a++) {
TLRPC.InputUser user = MessagesController.getInstance(currentAccount).getInputUser(MessagesController.getInstance(currentAccount).getUser(selectedContacts.keyAt(a)));
TLRPC.InputUser user = getMessagesController().getInputUser(getMessagesController().getUser(selectedContacts.keyAt(a)));
if (user != null) {
result.add(user);
}
}
MessagesController.getInstance(currentAccount).addUsersToChannel(chatId, result, null);
NotificationCenter.getInstance(currentAccount).postNotificationName(NotificationCenter.closeChats);
getMessagesController().addUsersToChannel(chatId, result, null);
getNotificationCenter().postNotificationName(NotificationCenter.closeChats);
Bundle args2 = new Bundle();
args2.putInt("chat_id", chatId);
presentFragment(new ChatActivity(args2), true);
@ -1151,9 +1151,9 @@ public class GroupCreateActivity extends BaseFragment implements NotificationCen
public GroupCreateAdapter(Context ctx) {
context = ctx;
ArrayList<TLRPC.TL_contact> arrayList = ContactsController.getInstance(currentAccount).contacts;
ArrayList<TLRPC.TL_contact> arrayList = getContactsController().contacts;
for (int a = 0; a < arrayList.size(); a++) {
TLRPC.User user = MessagesController.getInstance(currentAccount).getUser(arrayList.get(a).user_id);
TLRPC.User user = getMessagesController().getUser(arrayList.get(a).user_id);
if (user == null || user.self || user.deleted) {
continue;
}
@ -1260,10 +1260,10 @@ public class GroupCreateActivity extends BaseFragment implements NotificationCen
count = contacts.size();
if (addToGroup) {
if (chatId != 0) {
TLRPC.Chat chat = MessagesController.getInstance(currentAccount).getChat(chatId);
TLRPC.Chat chat = getMessagesController().getChat(chatId);
inviteViaLink = ChatObject.canUserDoAdminAction(chat, ChatObject.ACTION_INVITE) ? 1 : 0;
} else if (channelId != 0) {
TLRPC.Chat chat = MessagesController.getInstance(currentAccount).getChat(channelId);
TLRPC.Chat chat = getMessagesController().getChat(channelId);
inviteViaLink = ChatObject.canUserDoAdminAction(chat, ChatObject.ACTION_INVITE) && TextUtils.isEmpty(chat.username) ? 2 : 0;
} else {
inviteViaLink = 0;

View file

@ -157,7 +157,7 @@ public class GroupStickersActivity extends BaseFragment implements NotificationC
});
ActionBarMenu menu = actionBar.createMenu();
doneItem = menu.addItemWithWidth(done_button, R.drawable.ic_done, AndroidUtilities.dp(56));
doneItem = menu.addItemWithWidth(done_button, R.drawable.ic_done, AndroidUtilities.dp(56), LocaleController.getString("Done", R.string.Done));
progressView = new ContextProgressView(context, 1);
progressView.setAlpha(0.0f);
progressView.setScaleX(0.1f);

View file

@ -3410,7 +3410,9 @@ public class LaunchActivity extends Activity implements ActionBarLayout.ActionBa
if (requestCode == 105) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
if (ApplicationLoader.canDrawOverlays = Settings.canDrawOverlays(this)) {
GroupCallActivity.groupCallInstance.dismissInternal();
if (GroupCallActivity.groupCallInstance != null) {
GroupCallActivity.groupCallInstance.dismissInternal();
}
AndroidUtilities.runOnUIThread(() -> {
GroupCallPip.clearForce();
GroupCallPip.updateVisibility(LaunchActivity.this);

View file

@ -1845,11 +1845,11 @@ public class LocationActivity extends BaseFragment implements NotificationCenter
circleOptions.center(new LatLng(myLocation.getLatitude(), myLocation.getLongitude()));
circleOptions.radius(meters);
if (isActiveThemeDark()) {
circleOptions.strokeColor(0xffffffff);
circleOptions.fillColor(0x20ffffff);
circleOptions.strokeColor(0x9666A3D7);
circleOptions.fillColor(0x1c66A3D7);
} else {
circleOptions.strokeColor(0xff000000);
circleOptions.fillColor(0x20000000);
circleOptions.strokeColor(0x964286F5);
circleOptions.fillColor(0x1c4286F5);
}
circleOptions.strokePattern(PATTERN_POLYGON_ALPHA);
circleOptions.strokeWidth(2);
@ -2704,7 +2704,7 @@ public class LocationActivity extends BaseFragment implements NotificationCenter
themeDescriptions.add(new ThemeDescription(searchListView, 0, new Class[]{LocationCell.class}, new String[]{"addressTextView"}, null, null, null, Theme.key_windowBackgroundWhiteGrayText3));
themeDescriptions.add(new ThemeDescription(listView, 0, new Class[]{SharingLiveLocationCell.class}, new String[]{"nameTextView"}, null, null, null, Theme.key_windowBackgroundWhiteBlackText));
themeDescriptions.add(new ThemeDescription(listView, 0, new Class[]{SharingLiveLocationCell.class}, new String[]{"distanceTextView"}, null, null, null, Theme.key_windowBackgroundWhiteGrayText2));
themeDescriptions.add(new ThemeDescription(listView, 0, new Class[]{SharingLiveLocationCell.class}, new String[]{"distanceTextView"}, null, null, null, Theme.key_windowBackgroundWhiteGrayText3));
themeDescriptions.add(new ThemeDescription(listView, 0, new Class[]{LocationLoadingCell.class}, new String[]{"progressBar"}, null, null, null, Theme.key_progressCircle));
themeDescriptions.add(new ThemeDescription(listView, 0, new Class[]{LocationLoadingCell.class}, new String[]{"textView"}, null, null, null, Theme.key_windowBackgroundWhiteGrayText3));

View file

@ -154,7 +154,7 @@ public class PasscodeActivity extends BaseFragment implements NotificationCenter
if (type != 0) {
ActionBarMenu menu = actionBar.createMenu();
menu.addItemWithWidth(done_button, R.drawable.ic_done, AndroidUtilities.dp(56));
menu.addItemWithWidth(done_button, R.drawable.ic_done, AndroidUtilities.dp(56), LocaleController.getString("Done", R.string.Done));
titleTextView = new TextView(context);
titleTextView.setTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteGrayText6));

View file

@ -1288,7 +1288,7 @@ public class PassportActivity extends BaseFragment implements NotificationCenter
if (currentActivityType != TYPE_REQUEST && currentActivityType != TYPE_MANAGE) {
ActionBarMenu menu = actionBar.createMenu();
doneItem = menu.addItemWithWidth(done_button, R.drawable.ic_done, AndroidUtilities.dp(56));
doneItem = menu.addItemWithWidth(done_button, R.drawable.ic_done, AndroidUtilities.dp(56), LocaleController.getString("Done", R.string.Done));
progressView = new ContextProgressView(context, 1);
progressView.setAlpha(0.0f);
progressView.setScaleX(0.1f);

View file

@ -483,7 +483,7 @@ public class PaymentFormActivity extends BaseFragment implements NotificationCen
ActionBarMenu menu = actionBar.createMenu();
if (currentStep == 0 || currentStep == 1 || currentStep == 2 || currentStep == 3 || currentStep == 4 || currentStep == 6) {
doneItem = menu.addItemWithWidth(done_button, R.drawable.ic_done, AndroidUtilities.dp(56));
doneItem = menu.addItemWithWidth(done_button, R.drawable.ic_done, AndroidUtilities.dp(56), LocaleController.getString("Done", R.string.Done));
progressView = new ContextProgressView(context, 1);
progressView.setAlpha(0.0f);
progressView.setScaleX(0.1f);

View file

@ -444,7 +444,7 @@ public class PhotoCropActivity extends BaseFragment {
});
ActionBarMenu menu = actionBar.createMenu();
menu.addItemWithWidth(done_button, R.drawable.ic_done, AndroidUtilities.dp(56));
menu.addItemWithWidth(done_button, R.drawable.ic_done, AndroidUtilities.dp(56), LocaleController.getString("Done", R.string.Done));
fragmentView = view = new PhotoCropView(context);
((PhotoCropView) fragmentView).freeform = getArguments().getBoolean("freeform", false);

View file

@ -1724,7 +1724,9 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat
@Override
protected void onPanTranslationUpdate(float y, float progress, boolean keyboardVisible) {
currentPanTranslationY = y;
actionBar.setTranslationY(y);
if (currentEditMode != 3) {
actionBar.setTranslationY(y);
}
if (miniProgressView != null) {
miniProgressView.setTranslationY(y);
}
@ -2916,7 +2918,6 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat
for (int a = 0; a < arr.size(); a++) {
MessageObject message = arr.get(a);
if (imagesByIdsTemp[loadIndex].indexOfKey(message.getId()) < 0) {
FileLog.d("add message " + message.getId() + " media = " + message.messageOwner.media);
imagesByIdsTemp[loadIndex].put(message.getId(), message);
if (opennedFromMedia) {
imagesArrTemp.add(message);
@ -8128,6 +8129,13 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat
}
drawable.setProgressMs(videoPlayer.getCurrentPosition() - (startTime > 0 ? startTime / 1000 : 0));
}
@Override
protected void onTextAdd() {
if (!windowView.isFocusable()) {
makeFocusable();
}
}
};
containerView.addView(photoPaintView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.MATCH_PARENT));
photoPaintView.getDoneTextView().setOnClickListener(v -> {
@ -11380,11 +11388,12 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat
}
animatorSet.playTogether(animators);
animatorSet.setDuration(200);
int account = currentAccount;
animatorSet.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
AndroidUtilities.runOnUIThread(() -> {
NotificationCenter.getInstance(currentAccount).onAnimationFinish(transitionIndex);
NotificationCenter.getInstance(account).onAnimationFinish(transitionIndex);
if (animationEndRunnable != null) {
animationEndRunnable.run();
animationEndRunnable = null;
@ -11399,7 +11408,7 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat
setCaptionHwLayerEnabled(false);
transitionAnimationStartTime = System.currentTimeMillis();
AndroidUtilities.runOnUIThread(() -> {
transitionIndex = NotificationCenter.getInstance(currentAccount).setAnimationInProgress(transitionIndex, new int[]{NotificationCenter.dialogsNeedReload, NotificationCenter.closeChats, NotificationCenter.mediaCountDidLoad, NotificationCenter.mediaDidLoad, NotificationCenter.dialogPhotosLoaded});
transitionIndex = NotificationCenter.getInstance(account).setAnimationInProgress(transitionIndex, new int[]{NotificationCenter.dialogsNeedReload, NotificationCenter.closeChats, NotificationCenter.mediaCountDidLoad, NotificationCenter.mediaDidLoad, NotificationCenter.dialogPhotosLoaded});
animatorSet.start();
});
} else {

View file

@ -326,7 +326,7 @@ public class PrivacyControlActivity extends BaseFragment implements Notification
});
ActionBarMenu menu = actionBar.createMenu();
doneButton = menu.addItemWithWidth(done_button, R.drawable.ic_done, AndroidUtilities.dp(56));
doneButton = menu.addItemWithWidth(done_button, R.drawable.ic_done, AndroidUtilities.dp(56), LocaleController.getString("Done", R.string.Done));
boolean hasChanges = hasChanges();
doneButton.setAlpha(hasChanges ? 1.0f : 0.0f);
doneButton.setScaleX(hasChanges ? 1.0f : 0.0f);

View file

@ -59,6 +59,7 @@ import android.view.ViewGroup;
import android.view.ViewOutlineProvider;
import android.view.ViewTreeObserver;
import android.view.WindowManager;
import android.view.accessibility.AccessibilityNodeInfo;
import android.view.animation.AccelerateInterpolator;
import android.view.animation.DecelerateInterpolator;
import android.widget.EditText;
@ -2045,27 +2046,25 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter.
}
int currentPaddingTop = listView.getPaddingTop();
View view = null;
int pos = RecyclerView.NO_POSITION;
for (int i = 0; i < listView.getChildCount(); i++) {
if (listView.getChildAdapterPosition(listView.getChildAt(i)) == 0) {
int p = listView.getChildAdapterPosition(listView.getChildAt(i));
if (p != RecyclerView.NO_POSITION) {
view = listView.getChildAt(i);
pos = p;
break;
}
}
int pos = RecyclerView.NO_POSITION;
int top = 0;
if (view != null) {
RecyclerView.ViewHolder holder = listView.findContainingViewHolder(view);
pos = holder.getAdapterPosition();
if (pos == RecyclerView.NO_POSITION) {
pos = holder.getPosition();
}
top = view.getTop();
}
boolean layout = false;
if (actionBar.isSearchFieldVisible()) {
layoutManager.scrollToPositionWithOffset(sharedMediaRow, -paddingTop);
layout = true;
} else if ((!changed || !allowPullingDown) && pos != RecyclerView.NO_POSITION) {
} else if ((!changed || !allowPullingDown) && view != null) {
layoutManager.scrollToPositionWithOffset(pos, top - paddingTop);
layout = true;
}
@ -2278,12 +2277,12 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter.
int animationIndex = -1;
int account;
@Override
protected void onAllAnimationsDone() {
super.onAllAnimationsDone();
NotificationCenter.getInstance(account = currentAccount).onAnimationFinish(animationIndex);
}
//
// @Override
// protected void onAllAnimationsDone() {
// super.onAllAnimationsDone();
// getNotificationCenter().onAnimationFinish(animationIndex);
// }
@Override
public void runPendingAnimations() {
@ -2296,7 +2295,7 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter.
valueAnimator.addUpdateListener(valueAnimator1 -> listView.invalidate());
valueAnimator.setDuration(getMoveDuration());
valueAnimator.start();
animationIndex = NotificationCenter.getInstance(account = currentAccount).setAnimationInProgress(animationIndex, null);
//animationIndex = getNotificationCenter().setAnimationInProgress(animationIndex, null);
}
super.runPendingAnimations();
}
@ -2794,7 +2793,21 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter.
avatarContainer.setPivotY(0);
frameLayout.addView(avatarContainer, LayoutHelper.createFrame(42, 42, Gravity.TOP | Gravity.LEFT, 64, 0, 0, 0));
avatarImage = new AvatarImageView(context);
avatarImage = new AvatarImageView(context) {
@Override
public void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo info) {
super.onInitializeAccessibilityNodeInfo(info);
if (getImageReceiver().hasNotThumb()) {
info.setText(LocaleController.getString("AccDescrProfilePicture", R.string.AccDescrProfilePicture));
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
info.addAction(new AccessibilityNodeInfo.AccessibilityAction(AccessibilityNodeInfo.ACTION_CLICK, LocaleController.getString("Open", R.string.Open)));
info.addAction(new AccessibilityNodeInfo.AccessibilityAction(AccessibilityNodeInfo.ACTION_LONG_CLICK, LocaleController.getString("AccDescrOpenInPhotoViewer", R.string.AccDescrOpenInPhotoViewer)));
}
} else {
info.setVisibleToUser(false);
}
}
};
avatarImage.setRoundRadius(AndroidUtilities.dp(21));
avatarImage.setPivotX(0);
avatarImage.setPivotY(0);
@ -2833,7 +2846,6 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter.
openAvatar();
return false;
});
avatarImage.setContentDescription(LocaleController.getString("AccDescrProfilePicture", R.string.AccDescrProfilePicture));
avatarProgressView = new RadialProgressView(context) {
private Paint paint = new Paint(Paint.ANTI_ALIAS_FLAG);
@ -4432,6 +4444,7 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter.
}
invalidateIsInLandscapeMode();
if (listAdapter != null) {
saveScrollPosition();
listAdapter.notifyDataSetChanged();
}
@ -6641,6 +6654,16 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter.
position == faqRow || position == policyRow || position == sendLogsRow ||
position == clearLogsRow || position == switchBackendRow || position == setAvatarRow;
}
if (holder.itemView instanceof UserCell) {
UserCell userCell = (UserCell) holder.itemView;
Object object = userCell.getCurrentObject();
if (object instanceof TLRPC.User) {
TLRPC.User user = (TLRPC.User) object;
if (UserObject.isUserSelf(user)) {
return false;
}
}
}
int type = holder.getItemViewType();
return type != 1 && type != 5 && type != 7 && type != 9 && type != 10 && type != 11 && type != 12 && type != 13;
}
@ -7412,6 +7435,10 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter.
updateRowsIds();
diffCallback.fillPositions(diffCallback.newPositionToItem);
DiffUtil.calculateDiff(diffCallback).dispatchUpdatesTo(listAdapter);
saveScrollPosition();
}
private void saveScrollPosition() {
if (listView != null && layoutManager != null && listView.getChildCount() > 0) {
View view = null;
int position = -1;

View file

@ -97,7 +97,7 @@ public class ReportOtherActivity extends BaseFragment {
});
ActionBarMenu menu = actionBar.createMenu();
doneButton = menu.addItemWithWidth(done_button, R.drawable.ic_done, AndroidUtilities.dp(56));
doneButton = menu.addItemWithWidth(done_button, R.drawable.ic_done, AndroidUtilities.dp(56), LocaleController.getString("Done", R.string.Done));
LinearLayout linearLayout = new LinearLayout(context);
fragmentView = linearLayout;

View file

@ -173,7 +173,7 @@ public class TwoStepVerificationActivity extends BaseFragment implements Notific
frameLayout.setBackgroundColor(Theme.getColor(Theme.key_windowBackgroundWhite));
ActionBarMenu menu = actionBar.createMenu();
doneItem = menu.addItemWithWidth(done_button, R.drawable.ic_done, AndroidUtilities.dp(56));
doneItem = menu.addItemWithWidth(done_button, R.drawable.ic_done, AndroidUtilities.dp(56), LocaleController.getString("Done", R.string.Done));
scrollView = new ScrollView(context);
scrollView.setFillViewport(true);

View file

@ -35,6 +35,7 @@ import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.view.accessibility.AccessibilityNodeInfo;
import android.view.inputmethod.EditorInfo;
import android.widget.FrameLayout;
import android.widget.ImageView;
@ -767,9 +768,17 @@ public class TwoStepVerificationSetupActivity extends BaseFragment {
}
});
showPasswordButton = new ImageView(context);
showPasswordButton = new ImageView(context) {
@Override
public void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo info) {
super.onInitializeAccessibilityNodeInfo(info);
info.setCheckable(true);
info.setChecked(passwordEditText.getTransformationMethod() == null);
}
};
showPasswordButton.setImageResource(R.drawable.msg_message);
showPasswordButton.setScaleType(ImageView.ScaleType.CENTER);
showPasswordButton.setContentDescription(LocaleController.getString("TwoStepVerificationShowPassword", R.string.TwoStepVerificationShowPassword));
if (Build.VERSION.SDK_INT >= 21) {
showPasswordButton.setBackgroundDrawable(Theme.createSelectorDrawable(Theme.getColor(Theme.key_listSelector)));
}

View file

@ -1814,7 +1814,6 @@ public class VoIPFragment implements VoIPBaseService.StateListener, Notification
}
private void setMicrohoneAction(VoIPToggleButton bottomButton, VoIPService service, boolean animated) {
bottomButton.setCheckable(false);
if (service.isMicMute()) {
bottomButton.setData(R.drawable.calls_unmute, Color.BLACK, Color.WHITE, LocaleController.getString("VoipUnmute", R.string.VoipUnmute), true, animated);
} else {
@ -1873,12 +1872,10 @@ public class VoIPFragment implements VoIPBaseService.StateListener, Notification
}
}
});
bottomButton.setCheckable(false);
bottomButton.setEnabled(true);
} else {
bottomButton.setData(R.drawable.calls_video, ColorUtils.setAlphaComponent(Color.WHITE, (int) (255 * 0.5f)), ColorUtils.setAlphaComponent(Color.WHITE, (int) (255 * 0.12f)), "Video", false, animated);
bottomButton.setOnClickListener(null);
bottomButton.setCheckable(false);
bottomButton.setEnabled(false);
}
}
@ -1920,7 +1917,6 @@ public class VoIPFragment implements VoIPBaseService.StateListener, Notification
}
private void setFrontalCameraAction(VoIPToggleButton bottomButton, VoIPService service, boolean animated) {
bottomButton.setCheckable(false);
if (!currentUserIsVideo) {
bottomButton.setData(R.drawable.calls_flip, ColorUtils.setAlphaComponent(Color.WHITE, (int) (255 * 0.5f)), ColorUtils.setAlphaComponent(Color.WHITE, (int) (255 * 0.12f)), LocaleController.getString("VoipFlip", R.string.VoipFlip), false, animated);
bottomButton.setOnClickListener(null);

View file

@ -532,8 +532,8 @@ public class WallpapersListActivity extends BaseFragment implements Notification
selectedMessagesCountTextView.setOnTouchListener((v, event) -> true);
actionMode.addView(selectedMessagesCountTextView, LayoutHelper.createLinear(0, LayoutHelper.MATCH_PARENT, 1.0f, 65, 0, 0, 0));
actionModeViews.add(actionMode.addItemWithWidth(forward, R.drawable.msg_forward, AndroidUtilities.dp(54)));
actionModeViews.add(actionMode.addItemWithWidth(delete, R.drawable.msg_delete, AndroidUtilities.dp(54)));
actionModeViews.add(actionMode.addItemWithWidth(forward, R.drawable.msg_forward, AndroidUtilities.dp(54), LocaleController.getString("Forward", R.string.Forward)));
actionModeViews.add(actionMode.addItemWithWidth(delete, R.drawable.msg_delete, AndroidUtilities.dp(54), LocaleController.getString("Delete", R.string.Delete)));
selectedWallPapers.clear();
}