This commit is contained in:
世界 2020-04-01 00:19:06 +08:00
parent cbd9c6a5ef
commit f11c438491
No known key found for this signature in database
GPG Key ID: CD109927C34A63C4
36 changed files with 198 additions and 588 deletions

View File

@ -173,8 +173,8 @@ android {
sourceSets.release {
jniLibs.srcDir 'src/main/libs'
jni.srcDirs = []
java.srcDirs = ['/src/gservcies/java']
manifest.srcFile '/src/gservcies/AndroidManifest.xml'
java.srcDirs = ['src/gservcies/java']
manifest.srcFile 'src/gservcies/AndroidManifest.xml'
}
sourceSets.foss {

View File

@ -19,7 +19,6 @@ import android.content.ContentUris;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.content.SharedPreferences;
import android.content.pm.ActivityInfo;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;

View File

@ -289,7 +289,7 @@ public class ContactsController extends BaseController {
SharedPreferences.Editor editor = preferences1.edit();
editor.putString("invitelink", inviteLink = res.message);
editor.putInt("invitelinktime", (int) (System.currentTimeMillis() / 1000));
editor.apply();
editor.commit();
});
}
}

View File

@ -239,7 +239,7 @@ public class DownloadController extends BaseController implements NotificationCe
currentWifiPreset = preferences.getInt("currentWifiPreset", 3);
currentRoamingPreset = preferences.getInt("currentRoamingPreset", 3);
if (!newConfig) {
preferences.edit().putBoolean("newConfig", true).apply();
preferences.edit().putBoolean("newConfig", true).commit();
}
} else {
int[] mobileDataDownloadMask = new int[4];
@ -282,7 +282,7 @@ public class DownloadController extends BaseController implements NotificationCe
editor.putInt("currentMobilePreset", currentMobilePreset = 3);
editor.putInt("currentWifiPreset", currentWifiPreset = 3);
editor.putInt("currentRoamingPreset", currentRoamingPreset = 3);
editor.apply();
editor.commit();
}
AndroidUtilities.runOnUIThread(() -> {
@ -349,7 +349,7 @@ public class DownloadController extends BaseController implements NotificationCe
editor.putString("preset0", lowPreset.toString());
editor.putString("preset1", mediumPreset.toString());
editor.putString("preset2", highPreset.toString());
editor.apply();
editor.commit();
String str1 = lowPreset.toString();
String str2 = mediumPreset.toString();
String str3 = highPreset.toString();

View File

@ -178,7 +178,7 @@ public class FileUploadOperation {
remove(fileKey + "_id").
remove(fileKey + "_iv").
remove(fileKey + "_key").
remove(fileKey + "_ivc").apply();
remove(fileKey + "_ivc").commit();
try {
if (stream != null) {
stream.close();
@ -217,7 +217,7 @@ public class FileUploadOperation {
editor.putString(fileKey + "_ivc", Utilities.bytesToHex(ivChange));
editor.putString(fileKey + "_key", Utilities.bytesToHex(key));
}
editor.apply();
editor.commit();
}
private void calcTotalPartsCount() {
@ -587,7 +587,7 @@ public class FileUploadOperation {
if (isEncrypted) {
editor.putString(fileKey + "_ivc", Utilities.bytesToHex(ivToSave));
}
editor.apply();
editor.commit();
}
} else {
UploadCachedResult result = new UploadCachedResult();

View File

@ -9,7 +9,6 @@
package org.telegram.messenger;
import android.app.Activity;
import android.app.Application;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
@ -45,7 +44,6 @@ import java.util.TimeZone;
import tw.nekomimi.nekogram.NekoConfig;
import tw.nekomimi.nekogram.utils.FileUtil;
import tw.nekomimi.nekogram.utils.IoUtil;
public class LocaleController {
@ -158,7 +156,7 @@ public class LocaleController {
public File getPathToFile() {
File baseDir = new File(ApplicationLoader.applicationContext.getCacheDir().getParentFile(),"languages");
File baseDir = new File(ApplicationLoader.applicationContext.getCacheDir().getParentFile(), "languages");
FileUtil.initDir(baseDir);
@ -172,7 +170,7 @@ public class LocaleController {
public File getPathToBaseFile() {
if (isUnofficial()) {
File baseDir = new File(ApplicationLoader.applicationContext.getCacheDir().getParentFile(),"languages");
File baseDir = new File(ApplicationLoader.applicationContext.getCacheDir().getParentFile(), "languages");
FileUtil.initDir(baseDir);
return new File(baseDir, "unofficial_base_" + shortName + ".xml");
}
@ -228,6 +226,7 @@ public class LocaleController {
private ArrayList<LocaleInfo> otherLanguages = new ArrayList<>();
private static volatile LocaleController Instance = null;
public static LocaleController getInstance() {
LocaleController localInstance = Instance;
if (localInstance == null) {
@ -1764,7 +1763,7 @@ public class LocaleController {
return getString("WithinAWeek", R.string.WithinAWeek);
} else if (user.status.expires == -102) {
return getString("WithinAMonth", R.string.WithinAMonth);
} else {
} else {
return formatDateOnline(user.status.expires);
}
}

View File

@ -961,7 +961,7 @@ public class MediaController implements AudioManager.OnAudioFocusChangeListener,
lastSaveTime = SystemClock.elapsedRealtime();
Utilities.globalQueue.postRunnable(() -> {
SharedPreferences.Editor editor = ApplicationLoader.applicationContext.getSharedPreferences("media_saved_pos", Activity.MODE_PRIVATE).edit();
editor.putFloat(shouldSavePositionForCurrentAudio, value).apply();
editor.putFloat(shouldSavePositionForCurrentAudio, value).commit();
});
}
NotificationCenter.getInstance(currentPlayingMessageObject.currentAccount).postNotificationName(NotificationCenter.messagePlayingProgressDidChanged, currentPlayingMessageObject.getId(), value);
@ -2136,7 +2136,7 @@ public class MediaController implements AudioManager.OnAudioFocusChangeListener,
} else if (videoPlayer != null) {
videoPlayer.setPlaybackSpeed(speed);
}
MessagesController.getGlobalMainSettings().edit().putFloat(music ? "musicPlaybackSpeed" : "playbackSpeed", speed).apply();
MessagesController.getGlobalMainSettings().edit().putFloat(music ? "musicPlaybackSpeed" : "playbackSpeed", speed).commit();
NotificationCenter.getGlobalInstance().postNotificationName(NotificationCenter.messagePlayingSpeedChanged);
}

View File

@ -214,7 +214,7 @@ public class MediaDataController extends BaseController {
drafts.clear();
draftMessages.clear();
preferences.edit().clear().apply();
preferences.edit().clear().commit();
botInfos.clear();
botKeyboards.clear();
@ -878,16 +878,16 @@ public class MediaDataController extends BaseController {
if (gif) {
loadingRecentGifs = false;
recentGifsLoaded = true;
editor.putLong("lastGifLoadTime", System.currentTimeMillis()).apply();
editor.putLong("lastGifLoadTime", System.currentTimeMillis()).commit();
} else {
loadingRecentStickers[type] = false;
recentStickersLoaded[type] = true;
if (type == TYPE_IMAGE) {
editor.putLong("lastStickersLoadTime", System.currentTimeMillis()).apply();
editor.putLong("lastStickersLoadTime", System.currentTimeMillis()).commit();
} else if (type == TYPE_MASK) {
editor.putLong("lastStickersLoadTimeMask", System.currentTimeMillis()).apply();
editor.putLong("lastStickersLoadTimeMask", System.currentTimeMillis()).commit();
} else {
editor.putLong("lastStickersLoadTimeFavs", System.currentTimeMillis()).apply();
editor.putLong("lastStickersLoadTimeFavs", System.currentTimeMillis()).commit();
}
}
if (documents != null) {
@ -1205,7 +1205,7 @@ public class MediaDataController extends BaseController {
TLRPC.TL_messages_archivedStickers res = (TLRPC.TL_messages_archivedStickers) response;
archivedStickersCount[type] = res.count;
SharedPreferences preferences = MessagesController.getNotificationsSettings(currentAccount);
preferences.edit().putInt("archivedStickersCount" + type, res.count).apply();
preferences.edit().putInt("archivedStickersCount" + type, res.count).commit();
getNotificationCenter().postNotificationName(NotificationCenter.archivedStickersCountDidLoad, type);
}
}));
@ -4407,7 +4407,7 @@ public class MediaDataController extends BaseController {
if (draft == null || draft instanceof TLRPC.TL_draftMessageEmpty) {
drafts.remove(did);
draftMessages.remove(did);
preferences.edit().remove("" + did).remove("r_" + did).apply();
preferences.edit().remove("" + did).remove("r_" + did).commit();
messagesController.removeDraftDialogIfNeed(did);
} else {
drafts.put(did, draft);
@ -4431,7 +4431,7 @@ public class MediaDataController extends BaseController {
editor.putString("r_" + did, Utilities.bytesToHex(serializedData.toByteArray()));
serializedData.cleanup();
}
editor.apply();
editor.commit();
if (fromServer) {
if (draft.reply_to_msg_id != 0 && replyToMessage == null) {
int lower_id = (int) did;
@ -4514,7 +4514,7 @@ public class MediaDataController extends BaseController {
draftMessages.put(did, message);
SerializedData serializedData = new SerializedData(message.getObjectSize());
message.serializeToStream(serializedData);
preferences.edit().putString("r_" + did, Utilities.bytesToHex(serializedData.toByteArray())).apply();
preferences.edit().putString("r_" + did, Utilities.bytesToHex(serializedData.toByteArray())).commit();
getNotificationCenter().postNotificationName(NotificationCenter.newDraftReceived, did);
serializedData.cleanup();
}
@ -4525,7 +4525,7 @@ public class MediaDataController extends BaseController {
drafts.clear();
draftMessages.clear();
draftsFolderIds.clear();
preferences.edit().clear().apply();
preferences.edit().clear().commit();
if (notify) {
getMessagesController().sortDialogs(null);
getNotificationCenter().postNotificationName(NotificationCenter.dialogsNeedReload);
@ -4540,7 +4540,7 @@ public class MediaDataController extends BaseController {
if (!replyOnly) {
drafts.remove(did);
draftMessages.remove(did);
preferences.edit().remove("" + did).remove("r_" + did).apply();
preferences.edit().remove("" + did).remove("r_" + did).commit();
getMessagesController().sortDialogs(null);
getNotificationCenter().postNotificationName(NotificationCenter.dialogsNeedReload);
} else if (draftMessage.reply_to_msg_id != 0) {

View File

@ -159,7 +159,7 @@ public class MessageObject {
public CharSequence vCardData;
static final String[] excludeWords = new String[] {
static final String[] excludeWords = new String[]{
" vs. ",
" vs ",
" versus ",
@ -365,18 +365,18 @@ public class MessageObject {
public float[] heights;
public MessageGroupedLayoutAttempt(int i1, int i2, float f1, float f2) {
lineCounts = new int[] {i1, i2};
heights = new float[] {f1, f2};
lineCounts = new int[]{i1, i2};
heights = new float[]{f1, f2};
}
public MessageGroupedLayoutAttempt(int i1, int i2, int i3, float f1, float f2, float f3) {
lineCounts = new int[] {i1, i2, i3};
heights = new float[] {f1, f2, f3};
lineCounts = new int[]{i1, i2, i3};
heights = new float[]{f1, f2, f3};
}
public MessageGroupedLayoutAttempt(int i1, int i2, int i3, int i4, float f1, float f2, float f3, float f4) {
lineCounts = new int[] {i1, i2, i3, i4};
heights = new float[] {f1, f2, f3, f4};
lineCounts = new int[]{i1, i2, i3, i4};
heights = new float[]{f1, f2, f3, f4};
}
}
@ -411,8 +411,8 @@ public class MessageObject {
isOut = messageObject.isOutOwner();
needShare = !isOut && (
messageObject.messageOwner.fwd_from != null && messageObject.messageOwner.fwd_from.saved_from_peer != null ||
messageObject.messageOwner.from_id > 0 && (messageObject.messageOwner.to_id.channel_id != 0 || messageObject.messageOwner.to_id.chat_id != 0 ||
messageObject.messageOwner.media instanceof TLRPC.TL_messageMediaGame || messageObject.messageOwner.media instanceof TLRPC.TL_messageMediaInvoice)
messageObject.messageOwner.from_id > 0 && (messageObject.messageOwner.to_id.channel_id != 0 || messageObject.messageOwner.to_id.chat_id != 0 ||
messageObject.messageOwner.media instanceof TLRPC.TL_messageMediaGame || messageObject.messageOwner.media instanceof TLRPC.TL_messageMediaInvoice)
);
}
TLRPC.PhotoSize photoSize = FileLoader.getClosestPhotoSizeWithSize(messageObject.photoThumbs, AndroidUtilities.getPhotoSize());
@ -498,7 +498,7 @@ public class MessageObject {
position3.set(0, 1, 1, 1, rightWidth, thirdHeight / maxSizeHeight, POSITION_FLAG_RIGHT | POSITION_FLAG_BOTTOM);
position3.spanSize = maxSizeWidth;
position1.siblingHeights = new float[] {thirdHeight / maxSizeHeight, secondHeight / maxSizeHeight};
position1.siblingHeights = new float[]{thirdHeight / maxSizeHeight, secondHeight / maxSizeHeight};
if (isOut) {
position1.spanSize = maxSizeWidth - rightWidth;
@ -573,7 +573,7 @@ public class MessageObject {
position3.leftSpanOffset = w0;
position4.leftSpanOffset = w0;
}
position1.siblingHeights = new float[] {h0, h1, h2};
position1.siblingHeights = new float[]{h0, h1, h2};
hasSibling = true;
maxX = 1;
}
@ -631,7 +631,7 @@ public class MessageObject {
MessageGroupedLayoutAttempt attempt = attempts.get(a);
float height = 0;
float minLineHeight = Float.MAX_VALUE;
for (int b = 0; b < attempt.heights.length; b++){
for (int b = 0; b < attempt.heights.length; b++) {
height += attempt.heights[b];
if (attempt.heights[b] < minLineHeight) {
minLineHeight = attempt.heights[b];
@ -742,7 +742,7 @@ public class MessageObject {
for (int i = 0; i < messages.size(); i++) {
MessageObject object = messages.get(i);
MessageObject.GroupedMessagePosition position = positions.get(object);
if (position != null && (position.flags & (MessageObject.POSITION_FLAG_TOP | MessageObject.POSITION_FLAG_LEFT)) != 0) {
if (position != null && (position.flags & (MessageObject.POSITION_FLAG_TOP | MessageObject.POSITION_FLAG_LEFT)) != 0) {
return object;
}
}
@ -1546,7 +1546,7 @@ public class MessageObject {
message.out = false;
message.id = mid[0]++;
message.reply_to_msg_id = 0;
message.flags = message.flags &~ TLRPC.MESSAGE_FLAG_EDITED;
message.flags = message.flags & ~TLRPC.MESSAGE_FLAG_EDITED;
if (chat.megagroup) {
message.flags |= TLRPC.MESSAGE_FLAG_MEGAGROUP;
}
@ -2338,7 +2338,7 @@ public class MessageObject {
if (messageOwner.from_id == UserConfig.getInstance(currentAccount).getClientUserId()) {
if (isMissed) {
messageText = LocaleController.getString("CallMessageOutgoingMissed", R.string.CallMessageOutgoingMissed);
}else {
} else {
messageText = LocaleController.getString("CallMessageOutgoing", R.string.CallMessageOutgoing);
}
} else {
@ -3151,7 +3151,7 @@ public class MessageObject {
hasEntities = !messageOwner.entities.isEmpty();
}
boolean useManualParse = true;/*!hasEntities && (
boolean useManualParse = !hasEntities && (
eventId != 0 ||
messageOwner.media instanceof TLRPC.TL_messageMediaPhoto_old ||
messageOwner.media instanceof TLRPC.TL_messageMediaPhoto_layer68 ||
@ -3160,20 +3160,22 @@ public class MessageObject {
messageOwner.media instanceof TLRPC.TL_messageMediaDocument_layer68 ||
messageOwner.media instanceof TLRPC.TL_messageMediaDocument_layer74 ||
isOut() && messageOwner.send_state != MESSAGE_SEND_STATE_SENT ||
messageOwner.id < 0);*/
messageOwner.id < 0);
if (useManualParse) {
if (containsUrls(caption)) {
try {
if (containsUrls(caption)) {
try {
if (useManualParse) {
AndroidUtilities.addLinks((Spannable) caption, Linkify.WEB_URLS | Linkify.PHONE_NUMBERS);
} catch (Exception e) {
FileLog.e(e);
} else {
AndroidUtilities.addLinks((Spannable) caption, Linkify.WEB_URLS);
}
} catch (Exception e) {
FileLog.e(e);
}
addUrlsByPattern(isOutOwner(), caption, true, 0, 0, true);
}
addUrlsByPattern(isOutOwner(), caption, true, 0, 0, true);
addEntitiesToText(caption, useManualParse);
addEntitiesToText(caption, true);
if (isVideo()) {
addUrlsByPattern(isOutOwner(), caption, true, 3, getDuration(), false);
} else if (isMusic() || isVoice()) {
@ -3704,30 +3706,21 @@ public class MessageObject {
hasEntities = !messageOwner.entities.isEmpty();
}
boolean useManualParse = true;/*!hasEntities && (
boolean useManualParse = !hasEntities && (
eventId != 0 ||
messageOwner instanceof TLRPC.TL_message_old ||
messageOwner instanceof TLRPC.TL_message_old2 ||
messageOwner instanceof TLRPC.TL_message_old3 ||
messageOwner instanceof TLRPC.TL_message_old4 ||
messageOwner instanceof TLRPC.TL_messageForwarded_old ||
messageOwner instanceof TLRPC.TL_messageForwarded_old2 ||
messageOwner instanceof TLRPC.TL_message_secret ||
messageOwner.media instanceof TLRPC.TL_messageMediaInvoice ||
isOut() && messageOwner.send_state != MESSAGE_SEND_STATE_SENT ||
messageOwner.id < 0 || messageOwner.media instanceof TLRPC.TL_messageMediaUnsupported);*/
messageOwner instanceof TLRPC.TL_message_old ||
messageOwner instanceof TLRPC.TL_message_old2 ||
messageOwner instanceof TLRPC.TL_message_old3 ||
messageOwner instanceof TLRPC.TL_message_old4 ||
messageOwner instanceof TLRPC.TL_messageForwarded_old ||
messageOwner instanceof TLRPC.TL_messageForwarded_old2 ||
messageOwner instanceof TLRPC.TL_message_secret ||
messageOwner.media instanceof TLRPC.TL_messageMediaInvoice ||
isOut() && messageOwner.send_state != MESSAGE_SEND_STATE_SENT ||
messageOwner.id < 0 || messageOwner.media instanceof TLRPC.TL_messageMediaUnsupported);
addLinks(isOutOwner(), messageText, true, true);
if (useManualParse) {
addLinks(isOutOwner(), messageText, true, true);
} else {
if (messageText instanceof Spannable && messageText.length() < 1000) {
try {
AndroidUtilities.addLinks((Spannable) messageText, Linkify.PHONE_NUMBERS);
} catch (Throwable e) {
FileLog.e(e);
}
}
}
if (isYouTubeVideo() || replyMessageObject != null && replyMessageObject.isYouTubeVideo()) {
addUrlsByPattern(isOutOwner(), messageText, false, 3, Integer.MAX_VALUE, false);
} else if (replyMessageObject != null) {
@ -3738,7 +3731,7 @@ public class MessageObject {
}
}
boolean hasUrls = addEntitiesToText(messageText, useManualParse);
boolean hasUrls = addEntitiesToText(messageText, true);
int maxWidth = getMaxMessageTextWidth();
@ -4568,7 +4561,7 @@ public class MessageObject {
}
if (photoHeight > maxHeight) {
photoWidth *= maxHeight / photoHeight;
photoHeight = (int)maxHeight;
photoHeight = (int) maxHeight;
}
if (photoWidth > maxWidth) {
photoHeight *= maxWidth / photoWidth;

View File

@ -319,16 +319,16 @@ public class MessagesController extends BaseController implements NotificationCe
public TLRPC.SendMessageAction action;
}
public static int DIALOG_FILTER_FLAG_CONTACTS = 0x00000001;
public static int DIALOG_FILTER_FLAG_NON_CONTACTS = 0x00000002;
public static int DIALOG_FILTER_FLAG_GROUPS = 0x00000004;
public static int DIALOG_FILTER_FLAG_CHANNELS = 0x00000008;
public static int DIALOG_FILTER_FLAG_BOTS = 0x00000010;
public static int DIALOG_FILTER_FLAG_EXCLUDE_MUTED = 0x00000020;
public static int DIALOG_FILTER_FLAG_EXCLUDE_READ = 0x00000040;
public static int DIALOG_FILTER_FLAG_EXCLUDE_ARCHIVED = 0x00000080;
public static int DIALOG_FILTER_FLAG_ONLY_ARCHIVED = 0x00000100;
public static int DIALOG_FILTER_FLAG_ALL_CHATS = DIALOG_FILTER_FLAG_CONTACTS | DIALOG_FILTER_FLAG_NON_CONTACTS | DIALOG_FILTER_FLAG_GROUPS | DIALOG_FILTER_FLAG_CHANNELS | DIALOG_FILTER_FLAG_BOTS;
public static int DIALOG_FILTER_FLAG_CONTACTS = 0x00000001;
public static int DIALOG_FILTER_FLAG_NON_CONTACTS = 0x00000002;
public static int DIALOG_FILTER_FLAG_GROUPS = 0x00000004;
public static int DIALOG_FILTER_FLAG_CHANNELS = 0x00000008;
public static int DIALOG_FILTER_FLAG_BOTS = 0x00000010;
public static int DIALOG_FILTER_FLAG_EXCLUDE_MUTED = 0x00000020;
public static int DIALOG_FILTER_FLAG_EXCLUDE_READ = 0x00000040;
public static int DIALOG_FILTER_FLAG_EXCLUDE_ARCHIVED = 0x00000080;
public static int DIALOG_FILTER_FLAG_ONLY_ARCHIVED = 0x00000100;
public static int DIALOG_FILTER_FLAG_ALL_CHATS = DIALOG_FILTER_FLAG_CONTACTS | DIALOG_FILTER_FLAG_NON_CONTACTS | DIALOG_FILTER_FLAG_GROUPS | DIALOG_FILTER_FLAG_CHANNELS | DIALOG_FILTER_FLAG_BOTS;
public static class DialogFilter {
@ -1109,7 +1109,7 @@ public class MessagesController extends BaseController implements NotificationCe
}
}
if (changed) {
editor.apply();
editor.commit();
}
if (keelAliveChanged) {
ApplicationLoader.startPushService();
@ -1249,7 +1249,7 @@ public class MessagesController extends BaseController implements NotificationCe
editor.putString("dcDomainName2", dcDomainName);
editor.putInt("webFileDatacenterId", webFileDatacenterId);
editor.putString("suggestedLangCode", suggestedLangCode);
editor.apply();
editor.commit();
LocaleController.getInstance().checkUpdateForCurrentRemoteLocale(currentAccount, config.lang_pack_version, config.base_lang_pack_version);
getNotificationCenter().postNotificationName(NotificationCenter.configLoaded);
@ -1975,7 +1975,7 @@ public class MessagesController extends BaseController implements NotificationCe
oldUser.photo = user.photo;
oldUser.flags |= 32;
} else {
oldUser.flags = oldUser.flags & ~32;
oldUser.flags = oldUser.flags &~ 32;
oldUser.photo = null;
}
}
@ -2009,7 +2009,7 @@ public class MessagesController extends BaseController implements NotificationCe
user.photo = oldUser.photo;
user.flags |= 32;
} else {
user.flags = user.flags & ~32;
user.flags = user.flags &~ 32;
user.photo = null;
}
users.put(user.id, user);
@ -2073,7 +2073,7 @@ public class MessagesController extends BaseController implements NotificationCe
oldChat.username = chat.username;
oldChat.flags |= 64;
} else {
oldChat.flags = oldChat.flags & ~64;
oldChat.flags = oldChat.flags &~ 64;
oldChat.username = null;
}
if (chat.participants_count != 0) {

View File

@ -392,7 +392,7 @@ public class MusicBrowserService extends MediaBrowserService implements Notifica
return;
}
lastSelectedDialog = did;
MessagesController.getNotificationsSettings(currentAccount).edit().putInt("auto_lastSelectedDialog", did).apply();
MessagesController.getNotificationsSettings(currentAccount).edit().putInt("auto_lastSelectedDialog", did).commit();
MediaController.getInstance().setPlaylist(arrayList, arrayList.get(id), false);
mediaSession.setQueue(arrayList1);
if (did > 0) {

View File

@ -23,9 +23,9 @@ public class NotificationDismissReceiver extends BroadcastReceiver {
long dialogId = intent.getLongExtra("dialogId", 0);
int date = intent.getIntExtra("messageDate", 0);
if (dialogId == 0) {
MessagesController.getNotificationsSettings(currentAccount).edit().putInt("dismissDate", date).apply();
MessagesController.getNotificationsSettings(currentAccount).edit().putInt("dismissDate", date).commit();
} else {
MessagesController.getNotificationsSettings(currentAccount).edit().putInt("dismissDate" + dialogId, date).apply();
MessagesController.getNotificationsSettings(currentAccount).edit().putInt("dismissDate" + dialogId, date).commit();
}
}
}

View File

@ -214,7 +214,7 @@ public class NotificationsController extends BaseController {
preferences = ApplicationLoader.applicationContext.getSharedPreferences("Notifications", Activity.MODE_PRIVATE);
}
OTHER_NOTIFICATIONS_CHANNEL = "Other" + Utilities.random.nextLong();
preferences.edit().putString("OtherKey", OTHER_NOTIFICATIONS_CHANNEL).apply();
preferences.edit().putString("OtherKey", OTHER_NOTIFICATIONS_CHANNEL).commit();
}
if (notificationChannel == null) {
notificationChannel = new NotificationChannel(OTHER_NOTIFICATIONS_CHANNEL, "Other", NotificationManager.IMPORTANCE_DEFAULT);
@ -253,7 +253,7 @@ public class NotificationsController extends BaseController {
SharedPreferences preferences = getAccountInstance().getNotificationsSettings();
SharedPreferences.Editor editor = preferences.edit();
editor.clear();
editor.apply();
editor.commit();
if (Build.VERSION.SDK_INT >= 26) {
try {
@ -2266,7 +2266,7 @@ public class NotificationsController extends BaseController {
String key = "org.telegram.key" + dialogId;
String channelId = preferences.getString(key, null);
if (channelId != null) {
preferences.edit().remove(key).remove(key + "_s").apply();
preferences.edit().remove(key).remove(key + "_s").commit();
systemNotificationManager.deleteNotificationChannel(channelId);
}
} catch (Exception e) {
@ -2294,7 +2294,7 @@ public class NotificationsController extends BaseController {
editor.remove(key);
}
}
editor.apply();
editor.commit();
} catch (Exception e) {
FileLog.e(e);
}
@ -2411,7 +2411,7 @@ public class NotificationsController extends BaseController {
newSettingsHash = Utilities.MD5(newSettings.toString());
if (channelId != null && !settings.equals(newSettingsHash)) {
if (edited) {
preferences.edit().putString(key, channelId).putString(key + "_s", newSettingsHash).apply();
preferences.edit().putString(key, channelId).putString(key + "_s", newSettingsHash).commit();
} else {
systemNotificationManager.deleteNotificationChannel(channelId);
channelId = null;

View File

@ -1115,10 +1115,10 @@ public class SharedConfig {
currentProxy = info;
setProxyEnable(true);
saveProxyList();
setProxyEnable(true);
}
public static void loadProxyList() {

View File

@ -23,7 +23,7 @@ import java.util.Arrays;
public class UserConfig extends BaseController {
public static int selectedAccount;
public final static int MAX_ACCOUNT_COUNT = 3;
public final static int MAX_ACCOUNT_COUNT = 8;
private final Object sync = new Object();
private boolean configLoaded;
@ -65,6 +65,7 @@ public class UserConfig extends BaseController {
public long pendingAppUpdateInstallTime;
public long lastUpdateCheckTime;
public long autoDownloadConfigLoadTime;
public boolean isBot;
public volatile byte[] savedPasswordHash;
public volatile byte[] savedSaltedPassword;
@ -79,7 +80,6 @@ public class UserConfig extends BaseController {
public int tonBadPasscodeTries;
public String tonKeyName;
public boolean tonCreationFinished;
public boolean isBot;
private static volatile UserConfig[] Instance = new UserConfig[UserConfig.MAX_ACCOUNT_COUNT];
public static UserConfig getInstance(int num) {
@ -302,6 +302,7 @@ public class UserConfig extends BaseController {
notificationsSignUpSettingsLoaded = preferences.getBoolean("notificationsSignUpSettingsLoaded", false);
autoDownloadConfigLoadTime = preferences.getLong("autoDownloadConfigLoadTime", 0);
hasValidDialogLoadIds = preferences.contains("2dialogsLoadOffsetId") || preferences.getBoolean("hasValidDialogLoadIds", false);
isBot = preferences.getBoolean("isBot",false);
tonEncryptedData = preferences.getString("tonEncryptedData", null);
tonPublicKey = preferences.getString("tonPublicKey", null);
tonKeyName = preferences.getString("tonKeyName", "walletKey" + currentAccount);
@ -487,6 +488,7 @@ public class UserConfig extends BaseController {
loginTime = (int) (System.currentTimeMillis() / 1000);
lastContactsSyncTime = (int) (System.currentTimeMillis() / 1000) - 23 * 60 * 60;
lastHintsSyncTime = (int) (System.currentTimeMillis() / 1000) - 25 * 60 * 60;
isBot = false;
resetSavedPassword();
boolean hasActivated = false;
for (int a = 0; a < MAX_ACCOUNT_COUNT; a++) {

View File

@ -348,7 +348,7 @@ public class Browser {
}
return true;
} else if ("tg".equals(uri.getScheme()) || "vmess".equals(uri.getScheme()) || "ss".equals(uri.getScheme()) || "ssr".equals(uri.getScheme())) {
} else if ("tg".equals(uri.getScheme()) || "vmess".equals(uri.getScheme()) || "vmesss1".equals(uri.getScheme()) || "ss".equals(uri.getScheme()) || "ssr".equals(uri.getScheme())) {
return true;
} else if ("telegram.dog".equals(host)) {
String path = uri.getPath();

View File

@ -219,7 +219,7 @@ public class CameraController implements MediaRecorder.OnInfoListener {
serializedData.writeInt32(size.mHeight);
}
}
preferences.edit().putString("cameraCache", Base64.encodeToString(serializedData.toByteArray(), Base64.DEFAULT)).apply();
preferences.edit().putString("cameraCache", Base64.encodeToString(serializedData.toByteArray(), Base64.DEFAULT)).commit();
serializedData.cleanup();
}
cameraInfos = result;

View File

@ -123,14 +123,14 @@ public class CameraSession {
currentFlashMode = mode;
configurePhotoCamera();
SharedPreferences sharedPreferences = ApplicationLoader.applicationContext.getSharedPreferences("camera", Activity.MODE_PRIVATE);
sharedPreferences.edit().putString(cameraInfo.frontCamera != 0 ? "flashMode_front" : "flashMode", mode).apply();
sharedPreferences.edit().putString(cameraInfo.frontCamera != 0 ? "flashMode_front" : "flashMode", mode).commit();
}
public void setCurrentFlashMode(String mode) {
currentFlashMode = mode;
configurePhotoCamera();
SharedPreferences sharedPreferences = ApplicationLoader.applicationContext.getSharedPreferences("camera", Activity.MODE_PRIVATE);
sharedPreferences.edit().putString(cameraInfo.frontCamera != 0 ? "flashMode_front" : "flashMode", mode).apply();
sharedPreferences.edit().putString(cameraInfo.frontCamera != 0 ? "flashMode_front" : "flashMode", mode).commit();
}
public void setTorchEnabled(boolean enabled) {

View File

@ -62,8 +62,6 @@ import android.view.View;
import android.view.ViewGroup;
import android.widget.RemoteViews;
import androidx.annotation.RequiresApi;
import org.telegram.messenger.AndroidUtilities;
import org.telegram.messenger.ApplicationLoader;
import org.telegram.messenger.BuildConfig;

View File

@ -9,9 +9,7 @@
package org.telegram.ui.ActionBar;
import android.animation.Animator;
import android.app.Activity;
import android.content.Context;
import android.graphics.Point;
import android.graphics.PorterDuff;
import android.graphics.PorterDuffColorFilter;
import android.graphics.Rect;
@ -20,10 +18,8 @@ import android.os.Build;
import android.text.Editable;
import android.text.TextUtils;
import android.text.TextWatcher;
import android.util.DisplayMetrics;
import android.util.TypedValue;
import android.view.ActionMode;
import android.view.Display;
import android.view.Gravity;
import android.view.KeyEvent;
import android.view.Menu;
@ -41,7 +37,6 @@ import android.widget.LinearLayout;
import android.widget.TextView;
import org.telegram.messenger.AndroidUtilities;
import org.telegram.messenger.FileLog;
import org.telegram.messenger.LocaleController;
import org.telegram.messenger.R;
import org.telegram.messenger.SharedConfig;
@ -49,8 +44,6 @@ import org.telegram.ui.Components.CloseProgressDrawable2;
import org.telegram.ui.Components.EditTextBoldCursor;
import org.telegram.ui.Components.LayoutHelper;
import tw.nekomimi.nekogram.utils.AlertUtil;
public class ActionBarMenuItem extends FrameLayout {
public static class ActionBarMenuItemSearchListener {

View File

@ -85,7 +85,7 @@ public class DialogsAdapter extends RecyclerListView.SelectionAdapter {
if (folderId == 1) {
SharedPreferences preferences = MessagesController.getGlobalMainSettings();
showArchiveHint = preferences.getBoolean("archivehint", true);
preferences.edit().putBoolean("archivehint", false).apply();
preferences.edit().putBoolean("archivehint", false).commit();
if (showArchiveHint) {
archiveHintCell = new ArchiveHintCell(context);
}
@ -324,7 +324,7 @@ public class DialogsAdapter extends RecyclerListView.SelectionAdapter {
textView.setOnClickListener(view1 -> {
MessagesController.getInstance(currentAccount).hintDialogs.clear();
SharedPreferences preferences = MessagesController.getGlobalMainSettings();
preferences.edit().remove("installReferer").apply();
preferences.edit().remove("installReferer").commit();
notifyDataSetChanged();
});

View File

@ -8,11 +8,14 @@
package org.telegram.ui.Adapters;
import android.app.Activity;
import android.content.Context;
import android.content.SharedPreferences;
import android.view.View;
import android.view.ViewGroup;
import org.telegram.messenger.AndroidUtilities;
import org.telegram.messenger.ApplicationLoader;
import org.telegram.messenger.LocaleController;
import org.telegram.messenger.MessagesController;
import org.telegram.messenger.R;
@ -29,6 +32,7 @@ import org.telegram.ui.Components.SideMenultItemAnimator;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Locale;
import androidx.recyclerview.widget.RecyclerView;
@ -191,14 +195,19 @@ public class DrawerLayoutAdapter extends RecyclerListView.SelectionAdapter {
private void resetItems() {
accountNumbers.clear();
SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("nekoconfig", Activity.MODE_PRIVATE);
SharedPreferences.Editor editor = preferences.edit();
for (int a = 0; a < UserConfig.MAX_ACCOUNT_COUNT; a++) {
if (UserConfig.getInstance(a).isClientActivated()) {
accountNumbers.add(a);
} else {
editor.remove(String.format(Locale.US, "account_pos_%d", a));
}
}
editor.apply();
Collections.sort(accountNumbers, (o1, o2) -> {
long l1 = UserConfig.getInstance(o1).loginTime;
long l2 = UserConfig.getInstance(o2).loginTime;
long l1 = preferences.getLong(String.format(Locale.US, "account_pos_%d", o1), UserConfig.getInstance(o1).loginTime);
long l2 = preferences.getLong(String.format(Locale.US, "account_pos_%d", o2), UserConfig.getInstance(o2).loginTime);
if (l1 > l2) {
return 1;
} else if (l1 < l2) {
@ -291,4 +300,22 @@ public class DrawerLayoutAdapter extends RecyclerListView.SelectionAdapter {
actionCell.setTextAndIcon(text, icon);
}
}
public int getAccountsCount() {
return accountNumbers.size();
}
public void swapAccountPosition(int currentAdapterPosition, int targetAdapterPosition) {
int currentIndex = currentAdapterPosition - 2;
int targetIndex = targetAdapterPosition - 2;
int currentElement = accountNumbers.get(currentIndex);
int targetElement = accountNumbers.get(targetIndex);
accountNumbers.set(targetIndex, currentElement);
accountNumbers.set(currentIndex, targetElement);
ApplicationLoader.applicationContext.getSharedPreferences("nekoconfig", Activity.MODE_PRIVATE).edit().
putLong(String.format(Locale.US, "account_pos_%d", currentElement), targetIndex).
putLong(String.format(Locale.US, "account_pos_%d", targetElement), currentIndex)
.apply();
notifyItemMoved(currentAdapterPosition, targetAdapterPosition);
}
}

View File

@ -269,7 +269,7 @@ public class MentionsAdapter extends RecyclerListView.SelectionAdapter {
buttonClicked[0] = true;
if (foundContextBotFinal != null) {
SharedPreferences preferences1 = MessagesController.getNotificationsSettings(currentAccount);
preferences1.edit().putBoolean("inlinegeo_" + foundContextBotFinal.id, true).apply();
preferences1.edit().putBoolean("inlinegeo_" + foundContextBotFinal.id, true).commit();
checkLocationPermissionsOrStart();
}
});

View File

@ -7692,7 +7692,7 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
if (setCurrentDiceValue(!memCache && !currentMessageObject.wasUnread)) {
return;
}
if (!thumb && !currentMessageObject.mediaExists && !currentMessageObject.attachPathExists && (currentMessageObject.type == 0 && (documentAttachType == DOCUMENT_ATTACH_TYPE_WALLPAPER || documentAttachType == DOCUMENT_ATTACH_TYPE_NONE || documentAttachType == DOCUMENT_ATTACH_TYPE_STICKER) || currentMessageObject.type == MessageObject.TYPE_PHOTO)) {
if (!thumb && !currentMessageObject.mediaExists && !currentMessageObject.attachPathExists && (currentMessageObject.type == 0 && (documentAttachType == DOCUMENT_ATTACH_TYPE_WALLPAPER || documentAttachType == DOCUMENT_ATTACH_TYPE_NONE || documentAttachType == DOCUMENT_ATTACH_TYPE_STICKER) || currentMessageObject.type == MessageObject.TYPE_PHOTO)){
currentMessageObject.mediaExists = true;
updateButtonState(false, true, false);
}
@ -9442,7 +9442,7 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
} else {
imageW = 0;
}
if (drawLoadingProgress && loadingProgressLayout != null) {
if (drawLoadingProgress && loadingProgressLayout != null){
imageW = 0;
infoW = (int) loadingProgressLayout.getLineWidth(0);
} else {
@ -10229,7 +10229,7 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
AccessibilityNodeInfo info = AccessibilityNodeInfo.obtain(ChatMessageCell.this);
onInitializeAccessibilityNodeInfo(info);
StringBuilder sb = new StringBuilder();
if (isChat && currentUser != null && !currentMessageObject.isOut()) {
if (isChat && currentUser!=null && !currentMessageObject.isOut()) {
sb.append(UserObject.getUserName(currentUser));
sb.append('\n');
}
@ -10239,10 +10239,10 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
if (currentMessageObject.isMusic()) {
sb.append("\n");
sb.append(LocaleController.formatString("AccDescrMusicInfo", R.string.AccDescrMusicInfo, currentMessageObject.getMusicAuthor(), currentMessageObject.getMusicTitle()));
} else if (currentMessageObject.isVoice() || currentMessageObject.isRoundVideo()) {
} else if (currentMessageObject.isVoice() || currentMessageObject.isRoundVideo()){
sb.append(", ");
sb.append(LocaleController.formatCallDuration(currentMessageObject.getDuration()));
if (currentMessageObject.isContentUnread()) {
if (currentMessageObject.isContentUnread()){
sb.append(", ");
sb.append(LocaleController.getString("AccDescrMsgNotPlayed", R.string.AccDescrMsgNotPlayed));
}

View File

@ -256,7 +256,7 @@ public class ContextLinkCell extends FrameLayout implements DownloadController.F
if (inlineResult.send_message instanceof TLRPC.TL_botInlineMessageMediaVenue || inlineResult.send_message instanceof TLRPC.TL_botInlineMessageMediaGeo) {
double lat = inlineResult.send_message.geo.lat;
double lon = inlineResult.send_message.geo._long;
if (MessagesController.getInstance(currentAccount).mapProvider == 2) {
if (NekoConfig.mapPreviewProvider == 0) {
webFile = WebFile.createWithGeoPoint(inlineResult.send_message.geo, 72, 72, 15, Math.min(2, (int) Math.ceil(AndroidUtilities.density)));
} else {
urlLocation = AndroidUtilities.formapMapUrl(false, lat, lon, 72, 72, true, 15);

View File

@ -239,7 +239,7 @@ public class DrawerProfileCell extends FrameLayout {
darkBackColor = (Theme.getServiceMessageColor() & 0x00ffffff) | 0x50000000;
}
} else {
int visibility = drawCatsShadow ? VISIBLE : INVISIBLE;
int visibility = drawCatsShadow? VISIBLE : INVISIBLE;
if (shadowView.getVisibility() != visibility) {
shadowView.setVisibility(visibility);
}

View File

@ -3425,6 +3425,9 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
wasManualScroll = true;
scrollingChatListView = true;
} else if (newState == RecyclerView.SCROLL_STATE_DRAGGING) {
if (NekoConfig.hideKeyboardOnChatScroll) {
AndroidUtilities.hideKeyboard(getParentActivity().getCurrentFocus());
}
pollHintCell = null;
wasManualScroll = true;
scrollingFloatingDate = true;

View File

@ -2230,7 +2230,7 @@ public class AlertsCreator {
selected[0] = preferences.getInt("priority_channel", 1);
}
}
editor.apply();
editor.commit();
builder.getDismissRunnable().run();
if (onSelect != null) {
onSelect.run();
@ -2283,7 +2283,7 @@ public class AlertsCreator {
} else {
editor.putInt("popupChannel", selected[0]);
}
editor.apply();
editor.commit();
builder.getDismissRunnable().run();
if (onSelect != null) {
onSelect.run();
@ -2597,7 +2597,7 @@ public class AlertsCreator {
cell.setBackgroundDrawable(Theme.getSelectorDrawable(false));
cell.setTag(a);
if (a == 0) {
cell.setText(LocaleController.getString("ChangePermissions", R.string.ChangePermissions), "", false, false);
cell.setText(LocaleController.getString("DeleteBanUser", R.string.DeleteBanUser), "", false, false);
} else if (a == 1) {
cell.setText(LocaleController.getString("DeleteReportSpam", R.string.DeleteReportSpam), "", false, false);
} else if (a == 2) {
@ -2743,6 +2743,9 @@ public class AlertsCreator {
}
}
if (userFinal != null) {
if (checks[0]) {
MessagesController.getInstance(currentAccount).deleteUserFromChat(chat.id, userFinal, chatInfo);
}
if (checks[1]) {
TLRPC.TL_channels_reportSpam req = new TLRPC.TL_channels_reportSpam();
req.channel = MessagesController.getInputChannel(chat);
@ -2755,40 +2758,6 @@ public class AlertsCreator {
if (checks[2]) {
MessagesController.getInstance(currentAccount).deleteUserChannelHistory(chat, userFinal, 0);
}
if (checks[0]) {
for (int a = 0; a < chatInfo.participants.participants.size(); a++) {
TLRPC.ChatParticipant participant = chatInfo.participants.participants.get(a);
if (participant.user_id != userFinal.id || participant.user_id == UserConfig.getInstance(currentAccount).getCurrentUser().id) {
continue;
}
final TLRPC.ChannelParticipant channelParticipant;
if (ChatObject.isChannel(chat)) {
channelParticipant = ((TLRPC.TL_chatChannelParticipant) participant).channelParticipant;
} else {
channelParticipant = null;
}
TLRPC.User u = MessagesController.getInstance(currentAccount).getUser(participant.user_id);
if (channelParticipant != null) {
openRightsEdit(fragment,chatInfo,chat, u.id, participant, channelParticipant.admin_rights, channelParticipant.banned_rights, channelParticipant.rank);
} else {
openRightsEdit(fragment,chatInfo,chat, u.id, participant, null, null, "");
}
}
//MessagesController.getInstance(currentAccount).deleteUserFromChat(chat.id, userFinal, chatInfo);
}
}
if (onDelete != null) {
onDelete.run();
@ -2840,44 +2809,6 @@ public class AlertsCreator {
}
}
private static void openRightsEdit(BaseFragment f, TLRPC.ChatFull chatInfo, TLRPC.Chat currentChat, int user_id, TLRPC.ChatParticipant participant, TLRPC.TL_chatAdminRights adminRights, TLRPC.TL_chatBannedRights bannedRights, String rank) {
ChatRightsEditActivity fragment = new ChatRightsEditActivity(user_id, currentChat.id, adminRights, currentChat.default_banned_rights, bannedRights, rank, 1, true, false);
fragment.setDelegate(new ChatRightsEditActivity.ChatRightsEditActivityDelegate() {
@Override
public void didChangeOwner(TLRPC.User user) {
}
@Override
public void didSetRights(int rights, TLRPC.TL_chatAdminRights rightsAdmin, TLRPC.TL_chatBannedRights rightsBanned, String rank) {
if (rights == 0) {
if (currentChat.megagroup && chatInfo != null && chatInfo.participants != null) {
for (int a = 0; a < chatInfo.participants.participants.size(); a++) {
TLRPC.ChannelParticipant p = ((TLRPC.TL_chatChannelParticipant) chatInfo.participants.participants.get(a)).channelParticipant;
if (p.user_id == participant.user_id) {
if (chatInfo != null) {
chatInfo.participants_count--;
}
chatInfo.participants.participants.remove(a);
break;
}
}
if (chatInfo != null && chatInfo.participants != null) {
for (int a = 0; a < chatInfo.participants.participants.size(); a++) {
TLRPC.ChatParticipant p = chatInfo.participants.participants.get(a);
if (p.user_id == participant.user_id) {
chatInfo.participants.participants.remove(a);
break;
}
}
}
}
}
}
});
f.presentFragment(fragment);
}
public static void createThemeCreateDialog(BaseFragment fragment, int type, Theme.ThemeInfo switchToTheme, Theme.ThemeAccent switchToAccent) {
if (fragment == null || fragment.getParentActivity() == null) {
return;

View File

@ -190,7 +190,8 @@ public class EditTextBoldCursor extends EditText {
mShowCursorField = editorClass.getDeclaredField("mShowCursor");
mShowCursorField.setAccessible(true);
}
} catch (Throwable ignored) {
} catch (Throwable e) {
FileLog.e(e);
}
try {
gradientDrawable = new GradientDrawable(GradientDrawable.Orientation.TOP_BOTTOM, new int[] {0xff54a1db, 0xff54a1db});

View File

@ -1387,6 +1387,8 @@ public class DialogsActivity extends BaseFragment implements NotificationCenter.
public boolean onFragmentCreate() {
super.onFragmentCreate();
getMessagesController().getBlockedUsers(true);
if (getArguments() != null) {
onlySelect = arguments.getBoolean("onlySelect", false);
cantSendToChannels = arguments.getBoolean("cantSendToChannels", false);
@ -2003,351 +2005,6 @@ public class DialogsActivity extends BaseFragment implements NotificationCenter.
});
}
if (initialDialogsType == 0 && folderId == 0 && !onlySelect) {
scrimPaint = new Paint() {
@Override
public void setAlpha(int a) {
super.setAlpha(a);
if (fragmentView != null) {
fragmentView.invalidate();
}
}
};
filterTabsView = new FilterTabsView(context) {
@Override
public boolean onInterceptTouchEvent(MotionEvent ev) {
getParent().requestDisallowInterceptTouchEvent(true);
maybeStartTracking = false;
return super.onInterceptTouchEvent(ev);
}
@Override
public void setTranslationY(float translationY) {
super.setTranslationY(translationY);
if (fragmentContextView != null) {
fragmentContextView.setTranslationY(topPadding + translationY);
}
if (fragmentLocationContextView != null) {
fragmentLocationContextView.setTranslationY(topPadding + translationY);
}
if (fragmentView != null) {
fragmentView.invalidate();
}
}
@Override
protected void onLayout(boolean changed, int l, int t, int r, int b) {
super.onLayout(changed, l, t, r, b);
if (scrimView != null) {
scrimView.getLocationInWindow(scrimViewLocation);
fragmentView.invalidate();
}
}
};
filterTabsView.setBackgroundColor(Theme.getColor(Theme.key_actionBarDefault));
filterTabsView.setVisibility(View.GONE);
filterTabsView.setDelegate(new FilterTabsView.FilterTabsViewDelegate() {
private void showDeleteAlert(MessagesController.DialogFilter dialogFilter) {
AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity());
builder.setTitle(LocaleController.getString("FilterDelete", R.string.FilterDelete));
builder.setMessage(LocaleController.getString("FilterDeleteAlert", R.string.FilterDeleteAlert));
builder.setNegativeButton(LocaleController.getString("Cancel", R.string.Cancel), null);
builder.setPositiveButton(LocaleController.getString("Delete", R.string.Delete), (dialog2, which2) -> {
TLRPC.TL_messages_updateDialogFilter req = new TLRPC.TL_messages_updateDialogFilter();
req.id = dialogFilter.id;
getConnectionsManager().sendRequest(req, (response, error) -> AndroidUtilities.runOnUIThread(() -> {
}));
if (getMessagesController().dialogFilters.size() > 1) {
filterTabsView.beginCrossfade();
}
getMessagesController().removeFilter(dialogFilter);
getMessagesStorage().deleteDialogFilter(dialogFilter);
filterTabsView.commitCrossfade();
});
AlertDialog alertDialog = builder.create();
showDialog(alertDialog);
TextView button = (TextView) alertDialog.getButton(DialogInterface.BUTTON_POSITIVE);
if (button != null) {
button.setTextColor(Theme.getColor(Theme.key_dialogTextRed2));
}
}
@Override
public void onSamePageSelected() {
scrollToTop();
}
@Override
public void onPageReorder(int fromId, int toId) {
for (int a = 0; a < viewPages.length; a++) {
if (viewPages[a].selectedType == fromId) {
viewPages[a].selectedType = toId;
} else if (viewPages[a].selectedType == toId) {
viewPages[a].selectedType = fromId;
}
}
}
@Override
public void onPageSelected(int id, boolean forward) {
if (viewPages[0].selectedType == id) {
return;
}
ArrayList<MessagesController.DialogFilter> dialogFilters = getMessagesController().dialogFilters;
if (id != Integer.MAX_VALUE && (id < 0 || id >= dialogFilters.size())) {
return;
}
if (parentLayout != null) {
parentLayout.getDrawerLayoutContainer().setAllowOpenDrawerBySwipe(id == filterTabsView.getFirstTabId());
}
viewPages[1].selectedType = id;
viewPages[1].setVisibility(View.VISIBLE);
viewPages[1].setTranslationX(viewPages[0].getMeasuredWidth());
showScrollbars(false);
switchToCurrentSelectedMode(true);
animatingForward = forward;
}
@Override
public boolean canPerformActions() {
return !searching;
}
@Override
public void onPageScrolled(float progress) {
if (progress == 1 && viewPages[1].getVisibility() != View.VISIBLE && !searching) {
return;
}
if (animatingForward) {
viewPages[0].setTranslationX(-progress * viewPages[0].getMeasuredWidth());
viewPages[1].setTranslationX(viewPages[0].getMeasuredWidth() - progress * viewPages[0].getMeasuredWidth());
} else {
viewPages[0].setTranslationX(progress * viewPages[0].getMeasuredWidth());
viewPages[1].setTranslationX(progress * viewPages[0].getMeasuredWidth() - viewPages[0].getMeasuredWidth());
}
if (progress == 1) {
ViewPage tempPage = viewPages[0];
viewPages[0] = viewPages[1];
viewPages[1] = tempPage;
viewPages[1].setVisibility(View.GONE);
showScrollbars(true);
updateCounters(false);
checkListLoad(viewPages[0]);
}
}
@Override
public int getTabCounter(int tabId) {
if (tabId == Integer.MAX_VALUE) {
return getMessagesStorage().getMainUnreadCount();
}
ArrayList<MessagesController.DialogFilter> dialogFilters = getMessagesController().dialogFilters;
if (tabId < 0 || tabId >= dialogFilters.size()) {
return 0;
}
return getMessagesController().dialogFilters.get(tabId).unreadCount;
}
@Override
public boolean didSelectTab(FilterTabsView.TabView tabView, boolean selected) {
if (actionBar.isActionModeShowed()) {
return false;
}
if (scrimPopupWindow != null) {
scrimPopupWindow.dismiss();
scrimPopupWindow = null;
scrimPopupWindowItems = null;
return false;
}
Rect rect = new Rect();
MessagesController.DialogFilter dialogFilter;
if (tabView.getId() == Integer.MAX_VALUE) {
dialogFilter = null;
} else {
dialogFilter = getMessagesController().dialogFilters.get(tabView.getId());
}
ActionBarPopupWindow.ActionBarPopupWindowLayout popupLayout = new ActionBarPopupWindow.ActionBarPopupWindowLayout(getParentActivity());
popupLayout.setOnTouchListener(new View.OnTouchListener() {
private int[] pos = new int[2];
@Override
public boolean onTouch(View v, MotionEvent event) {
if (event.getActionMasked() == MotionEvent.ACTION_DOWN) {
if (scrimPopupWindow != null && scrimPopupWindow.isShowing()) {
View contentView = scrimPopupWindow.getContentView();
contentView.getLocationInWindow(pos);
rect.set(pos[0], pos[1], pos[0] + contentView.getMeasuredWidth(), pos[1] + contentView.getMeasuredHeight());
if (!rect.contains((int) event.getX(), (int) event.getY())) {
scrimPopupWindow.dismiss();
}
}
} else if (event.getActionMasked() == MotionEvent.ACTION_OUTSIDE) {
if (scrimPopupWindow != null && scrimPopupWindow.isShowing()) {
scrimPopupWindow.dismiss();
}
}
return false;
}
});
popupLayout.setDispatchKeyEventListener(keyEvent -> {
if (keyEvent.getKeyCode() == KeyEvent.KEYCODE_BACK && keyEvent.getRepeatCount() == 0 && scrimPopupWindow != null && scrimPopupWindow.isShowing()) {
scrimPopupWindow.dismiss();
}
});
Rect backgroundPaddings = new Rect();
Drawable shadowDrawable = getParentActivity().getResources().getDrawable(R.drawable.popup_fixed_alert).mutate();
shadowDrawable.getPadding(backgroundPaddings);
popupLayout.setBackgroundDrawable(shadowDrawable);
popupLayout.setBackgroundColor(Theme.getColor(Theme.key_actionBarDefaultSubmenuBackground));
LinearLayout linearLayout = new LinearLayout(getParentActivity());
ScrollView scrollView;
if (Build.VERSION.SDK_INT >= 21) {
scrollView = new ScrollView(getParentActivity(), null, 0, R.style.scrollbarShapeStyle) {
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
setMeasuredDimension(linearLayout.getMeasuredWidth(), getMeasuredHeight());
}
};
} else {
scrollView = new ScrollView(getParentActivity());
}
scrollView.setClipToPadding(false);
popupLayout.addView(scrollView, LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT));
linearLayout.setMinimumWidth(AndroidUtilities.dp(200));
linearLayout.setOrientation(LinearLayout.VERTICAL);
scrimPopupWindowItems = new ActionBarMenuSubItem[3];
for (int a = 0, N = (tabView.getId() == Integer.MAX_VALUE ? 2 : 3); a < N; a++) {
ActionBarMenuSubItem cell = new ActionBarMenuSubItem(getParentActivity());
if (a == 0) {
if (getMessagesController().dialogFilters.size() <= 1) {
continue;
}
cell.setTextAndIcon(LocaleController.getString("FilterReorder", R.string.FilterReorder), R.drawable.tabs_reorder);
} else if (a == 1) {
if (N == 2) {
cell.setTextAndIcon(LocaleController.getString("FilterEditAll", R.string.FilterEditAll), R.drawable.msg_edit);
} else {
cell.setTextAndIcon(LocaleController.getString("FilterEdit", R.string.FilterEdit), R.drawable.msg_edit);
}
} else {
cell.setTextAndIcon(LocaleController.getString("FilterDeleteItem", R.string.FilterDeleteItem), R.drawable.msg_delete);
}
scrimPopupWindowItems[a] = cell;
linearLayout.addView(cell);
final int i = a;
cell.setOnClickListener(v1 -> {
if (i == 0) {
resetScroll();
filterTabsView.setIsEditing(true);
showDoneItem(true);
} else if (i == 1) {
if (N == 2) {
presentFragment(new FiltersSetupActivity());
} else {
presentFragment(new FilterCreateActivity(dialogFilter));
}
} else if (i == 2) {
showDeleteAlert(dialogFilter);
}
if (scrimPopupWindow != null) {
scrimPopupWindow.dismiss();
}
});
}
scrollView.addView(linearLayout, LayoutHelper.createScroll(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, Gravity.LEFT | Gravity.TOP));
scrimPopupWindow = new ActionBarPopupWindow(popupLayout, LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT) {
@Override
public void dismiss() {
super.dismiss();
if (scrimPopupWindow != this) {
return;
}
scrimPopupWindow = null;
scrimPopupWindowItems = null;
if (scrimAnimatorSet != null) {
scrimAnimatorSet.cancel();
scrimAnimatorSet = null;
}
scrimAnimatorSet = new AnimatorSet();
ArrayList<Animator> animators = new ArrayList<>();
animators.add(ObjectAnimator.ofInt(scrimPaint, AnimationProperties.PAINT_ALPHA, 0));
scrimAnimatorSet.playTogether(animators);
scrimAnimatorSet.setDuration(220);
scrimAnimatorSet.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
if (scrimView != null) {
scrimView.setBackground(null);
scrimView = null;
}
if (fragmentView != null) {
fragmentView.invalidate();
}
}
});
scrimAnimatorSet.start();
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
getParentActivity().getWindow().getDecorView().setImportantForAccessibility(View.IMPORTANT_FOR_ACCESSIBILITY_AUTO);
}
}
};
tabView.setBackground(Theme.createRoundRectDrawable(AndroidUtilities.dp(6), Theme.getColor(Theme.key_actionBarDefault)));
scrimPopupWindow.setDismissAnimationDuration(220);
scrimPopupWindow.setOutsideTouchable(true);
scrimPopupWindow.setClippingEnabled(true);
scrimPopupWindow.setAnimationStyle(R.style.PopupContextAnimation);
scrimPopupWindow.setFocusable(true);
popupLayout.measure(View.MeasureSpec.makeMeasureSpec(AndroidUtilities.dp(1000), View.MeasureSpec.AT_MOST), View.MeasureSpec.makeMeasureSpec(AndroidUtilities.dp(1000), View.MeasureSpec.AT_MOST));
scrimPopupWindow.setInputMethodMode(ActionBarPopupWindow.INPUT_METHOD_NOT_NEEDED);
scrimPopupWindow.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_UNSPECIFIED);
scrimPopupWindow.getContentView().setFocusableInTouchMode(true);
tabView.getLocationInWindow(scrimViewLocation);
int popupX = scrimViewLocation[0] + backgroundPaddings.left - AndroidUtilities.dp(16);
if (popupX < AndroidUtilities.dp(6)) {
popupX = AndroidUtilities.dp(6);
} else if (popupX > fragmentView.getMeasuredWidth() - AndroidUtilities.dp(6) - popupLayout.getMeasuredWidth()) {
popupX = fragmentView.getMeasuredWidth() - AndroidUtilities.dp(6) - popupLayout.getMeasuredWidth();
}
int popupY = scrimViewLocation[1] + tabView.getMeasuredHeight() - AndroidUtilities.dp(12);
scrimPopupWindow.showAtLocation(fragmentView, Gravity.LEFT | Gravity.TOP, popupX, popupY - getCurrentPanTranslationY());
scrimView = tabView;
scrimViewSelected = selected;
fragmentView.invalidate();
if (scrimAnimatorSet != null) {
scrimAnimatorSet.cancel();
}
scrimAnimatorSet = new AnimatorSet();
ArrayList<Animator> animators = new ArrayList<>();
animators.add(ObjectAnimator.ofInt(scrimPaint, AnimationProperties.PAINT_ALPHA, 0, 50));
scrimAnimatorSet.playTogether(animators);
scrimAnimatorSet.setDuration(150);
scrimAnimatorSet.start();
return true;
}
@Override
public boolean isTabMenuVisible() {
return scrimPopupWindow != null && scrimPopupWindow.isShowing();
}
@Override
public void onDeletePressed(int id) {
showDeleteAlert(getMessagesController().dialogFilters.get(id));
}
});
}
if (allowSwitchAccount && UserConfig.getActivatedAccountsCount() > 1) {
switchItem = menu.addItemWithWidth(1, 0, AndroidUtilities.dp(56));
AvatarDrawable avatarDrawable = new AvatarDrawable();
@ -3534,9 +3191,6 @@ public class DialogsActivity extends BaseFragment implements NotificationCenter.
} else if (filterTabsView != null && filterTabsView.getVisibility() == View.VISIBLE && !tabsAnimationInProgress && !filterTabsView.isAnimatingIndicator() && filterTabsView.getCurrentTabId() != Integer.MAX_VALUE && !startedTracking) {
filterTabsView.selectFirstTab();
return false;
} else if (filterTabsView != null && filterTabsView.getVisibility() == View.VISIBLE && !tabsAnimationInProgress && !filterTabsView.isAnimatingIndicator() && filterTabsView.getCurrentTabId() != Integer.MAX_VALUE && !startedTracking) {
filterTabsView.selectFirstTab();
return false;
} else if (commentView != null && commentView.isPopupShowing()) {
commentView.hidePopup(true);
return false;

View File

@ -225,7 +225,7 @@ public class LaunchActivity extends Activity implements ActionBarLayout.ActionBa
public boolean onMove(RecyclerView recyclerView, RecyclerView.ViewHolder viewHolder, RecyclerView.ViewHolder target) {
if (viewHolder.getItemViewType() == 4 && target.getItemViewType() == 4 &&
viewHolder.getAdapterPosition() != target.getAdapterPosition()) {
// drawerLayoutAdapter.swapAccountPosition(viewHolder.getAdapterPosition(), target.getAdapterPosition());
drawerLayoutAdapter.swapAccountPosition(viewHolder.getAdapterPosition(), target.getAdapterPosition());
return true;
}
return false;

View File

@ -206,7 +206,7 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat
private Runnable miniProgressShowRunnable = () -> toggleMiniProgressInternal(true);
private Activity parentActivity;
private Context activityContext;
private Context actvityContext;
private ActionBar actionBar;
private boolean isActionBarVisible = true;
@ -469,7 +469,7 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat
lastSaveTime = SystemClock.elapsedRealtime();
Utilities.globalQueue.postRunnable(() -> {
SharedPreferences.Editor editor = ApplicationLoader.applicationContext.getSharedPreferences("media_saved_pos", Activity.MODE_PRIVATE).edit();
editor.putFloat(shouldSavePositionForCurrentVideo, value).apply();
editor.putFloat(shouldSavePositionForCurrentVideo, value).commit();
});
}
}
@ -683,9 +683,9 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat
private boolean bottomTouchEnabled = true;
private ArrayList<MessageObject> imagesArrTemp = new ArrayList<>();
private SparseArray<MessageObject>[] imagesByIdsTemp = new SparseArray[]{new SparseArray<>(), new SparseArray<>()};
private SparseArray<MessageObject>[] imagesByIdsTemp = new SparseArray[] {new SparseArray<>(), new SparseArray<>()};
private ArrayList<MessageObject> imagesArr = new ArrayList<>();
private SparseArray<MessageObject>[] imagesByIds = new SparseArray[]{new SparseArray<>(), new SparseArray<>()};
private SparseArray<MessageObject>[] imagesByIds = new SparseArray[] {new SparseArray<>(), new SparseArray<>()};
private ArrayList<ImageLocation> imagesArrLocations = new ArrayList<>();
private ArrayList<SecureDocument> secureDocuments = new ArrayList<>();
private ArrayList<TLRPC.Photo> avatarsArr = new ArrayList<>();
@ -1797,7 +1797,7 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat
String finalPath = (String) args[1];
long finalSize = (Long) args[3];
float progress = (float) args[4];
photoProgressViews[0].setProgress(progress, true);
photoProgressViews[0].setProgress(progress,true);
if (finalSize != 0) {
requestingPreview = false;
photoProgressViews[0].setProgress(1f, true);
@ -1958,7 +1958,7 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat
return;
}
parentActivity = activity;
activityContext = new ContextThemeWrapper(parentActivity, R.style.Theme_TMessages);
actvityContext = new ContextThemeWrapper(parentActivity, R.style.Theme_TMessages);
touchSlop = ViewConfiguration.get(parentActivity).getScaledTouchSlop();
if (progressDrawables == null) {
@ -2523,16 +2523,16 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat
menuItem.redrawPopup(0xf9222222);
sendItem.setContentDescription(LocaleController.getString("Forward", R.string.Forward));
bottomLayout = new FrameLayout(activityContext);
bottomLayout = new FrameLayout(actvityContext);
bottomLayout.setBackgroundColor(0x7f000000);
containerView.addView(bottomLayout, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, 48, Gravity.BOTTOM | Gravity.LEFT));
pressedDrawable[0] = new GradientDrawable(GradientDrawable.Orientation.LEFT_RIGHT, new int[]{0x32000000, 0});
pressedDrawable[0] = new GradientDrawable(GradientDrawable.Orientation.LEFT_RIGHT, new int[] {0x32000000, 0});
pressedDrawable[0].setShape(GradientDrawable.RECTANGLE);
pressedDrawable[1] = new GradientDrawable(GradientDrawable.Orientation.RIGHT_LEFT, new int[]{0x32000000, 0});
pressedDrawable[1] = new GradientDrawable(GradientDrawable.Orientation.RIGHT_LEFT, new int[] {0x32000000, 0});
pressedDrawable[1].setShape(GradientDrawable.RECTANGLE);
groupedPhotosListView = new GroupedPhotosListView(activityContext);
groupedPhotosListView = new GroupedPhotosListView(actvityContext);
containerView.addView(groupedPhotosListView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, 62, Gravity.BOTTOM | Gravity.LEFT, 0, 0, 0, 48));
groupedPhotosListView.setDelegate(new GroupedPhotosListView.GroupedPhotosListViewDelegate() {
@Override
@ -2594,7 +2594,7 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat
photoProgressViews[a].setBackgroundState(0, false);
}
miniProgressView = new RadialProgressView(activityContext) {
miniProgressView = new RadialProgressView(actvityContext) {
@Override
public void setAlpha(float alpha) {
super.setAlpha(alpha);
@ -2692,7 +2692,7 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat
qualityChooseView.setBackgroundColor(0x7f000000);
containerView.addView(qualityChooseView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, 70, Gravity.LEFT | Gravity.BOTTOM, 0, 0, 0, 48));
pickerView = new FrameLayout(activityContext) {
pickerView = new FrameLayout(actvityContext) {
@Override
public boolean dispatchTouchEvent(MotionEvent ev) {
return bottomTouchEnabled && super.dispatchTouchEvent(ev);
@ -3168,7 +3168,7 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat
SharedPreferences preferences1 = MessagesController.getGlobalMainSettings();
SharedPreferences.Editor editor = preferences1.edit();
editor.putInt("self_destruct", value);
editor.apply();
editor.commit();
bottomSheet.dismiss();
int seconds;
if (value >= 0 && value < 21) {
@ -3204,7 +3204,7 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat
bottomSheet.setBackgroundColor(0xff000000);
});
editorDoneLayout = new PickerBottomLayoutViewer(activityContext);
editorDoneLayout = new PickerBottomLayoutViewer(actvityContext);
editorDoneLayout.setBackgroundColor(0x7f000000);
editorDoneLayout.updateSelectedCount(0, false);
editorDoneLayout.setVisibility(View.GONE);
@ -3218,7 +3218,7 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat
switchToEditMode(0);
});
resetButton = new TextView(activityContext);
resetButton = new TextView(actvityContext);
resetButton.setVisibility(View.GONE);
resetButton.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 14);
resetButton.setTextColor(0xffffffff);
@ -3340,7 +3340,7 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat
ignoreDidSetImage = false;
});
captionEditText = new PhotoViewerCaptionEnterView(activityContext, containerView, windowView) {
captionEditText = new PhotoViewerCaptionEnterView(actvityContext, containerView, windowView) {
@Override
public boolean dispatchTouchEvent(MotionEvent ev) {
try {
@ -3407,7 +3407,7 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat
}
containerView.addView(captionEditText, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT, Gravity.BOTTOM | Gravity.LEFT));
mentionListView = new RecyclerListView(activityContext) {
mentionListView = new RecyclerListView(actvityContext) {
@Override
public boolean dispatchTouchEvent(MotionEvent ev) {
return !bottomTouchEnabled && super.dispatchTouchEvent(ev);
@ -3424,7 +3424,7 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat
}
};
mentionListView.setTag(5);
mentionLayoutManager = new LinearLayoutManager(activityContext) {
mentionLayoutManager = new LinearLayoutManager(actvityContext) {
@Override
public boolean supportsPredictiveItemAnimations() {
return false;
@ -3438,7 +3438,7 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat
mentionListView.setOverScrollMode(RecyclerListView.OVER_SCROLL_NEVER);
containerView.addView(mentionListView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, 110, Gravity.LEFT | Gravity.BOTTOM));
mentionListView.setAdapter(mentionsAdapter = new MentionsAdapter(activityContext, true, 0, new MentionsAdapter.MentionsAdapterDelegate() {
mentionListView.setAdapter(mentionsAdapter = new MentionsAdapter(actvityContext, true, 0, new MentionsAdapter.MentionsAdapterDelegate() {
@Override
public void needChangePanelVisibility(boolean show) {
if (show) {
@ -3558,9 +3558,9 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat
return false;
});
AccessibilityManager am = (AccessibilityManager) activityContext.getSystemService(Context.ACCESSIBILITY_SERVICE);
AccessibilityManager am = (AccessibilityManager) actvityContext.getSystemService(Context.ACCESSIBILITY_SERVICE);
if (am.isEnabled()) {
playButtonAccessibilityOverlay = new View(activityContext);
playButtonAccessibilityOverlay = new View(actvityContext);
playButtonAccessibilityOverlay.setContentDescription(LocaleController.getString("AccActionPlay", R.string.AccActionPlay));
playButtonAccessibilityOverlay.setFocusable(true);
containerView.addView(playButtonAccessibilityOverlay, LayoutHelper.createFrame(64, 64, Gravity.CENTER));
@ -3579,7 +3579,7 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat
TLRPC.Chat chat = parentChatActivity.getCurrentChat();
TLRPC.User user = parentChatActivity.getCurrentUser();
if (user != null || ChatObject.isChannel(chat) && chat.megagroup || !ChatObject.isChannel(chat)) {
MessagesController.getNotificationsSettings(currentAccount).edit().putBoolean("silent_" + parentChatActivity.getDialogId(), !notify).apply();
MessagesController.getNotificationsSettings(currentAccount).edit().putBoolean("silent_" + parentChatActivity.getDialogId(), !notify).commit();
}
}
VideoEditedInfo videoEditedInfo = getCurrentVideoEditedInfo();
@ -3596,7 +3596,7 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat
if (Build.VERSION.SDK_INT < 23 || Settings.canDrawOverlays(parentActivity)) {
return true;
} else {
new AlertDialog.Builder(parentActivity).setTitle(LocaleController.getString("NekoX", R.string.NekoX))
new AlertDialog.Builder(parentActivity).setTitle(LocaleController.getString("AppName", R.string.AppName))
.setMessage(LocaleController.getString("PermissionDrawAboveOtherApps", R.string.PermissionDrawAboveOtherApps))
.setPositiveButton(LocaleController.getString("PermissionOpenSettings", R.string.PermissionOpenSettings), (dialog, which) -> {
if (parentActivity != null) {
@ -3612,7 +3612,7 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat
}
private TextView createCaptionTextView() {
TextView textView = new TextView(activityContext) {
TextView textView = new TextView(actvityContext) {
@Override
public boolean onTouchEvent(MotionEvent event) {
return bottomTouchEnabled && super.onTouchEvent(event);
@ -4057,7 +4057,7 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat
Object object = imagesArrLocals.get(currentIndex);
if (apply) {
CharSequence caption = captionEditText.getFieldCharSequence();
CharSequence[] result = new CharSequence[]{caption};
CharSequence[] result = new CharSequence[] {caption};
ArrayList<TLRPC.MessageEntity> entities = MediaDataController.getInstance(currentAccount).getEntities(result, supportsSendingNewEntities());
if (object instanceof MediaController.PhotoEntry) {
@ -4403,7 +4403,7 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat
return;
}
AlertDialog.Builder builder = new AlertDialog.Builder(parentActivity);
builder.setTitle(LocaleController.getString("NekoX", R.string.NekoX));
builder.setTitle(LocaleController.getString("AppName", R.string.AppName));
builder.setMessage(LocaleController.getString("CantPlayVideo", R.string.CantPlayVideo));
builder.setPositiveButton(LocaleController.getString("Open", R.string.Open), (dialog, which) -> {
try {
@ -4471,8 +4471,8 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat
aspectRatioFrameLayout.getLocationInWindow(pipPosition);
//pipPosition[0] -= getLeftInset();
pipPosition[1] -= containerView.getTranslationY();
textureImageView.setTranslationX(textureImageView.getTranslationX() + getLeftInset());
videoTextureView.setTranslationX(videoTextureView.getTranslationX() + getLeftInset() - aspectRatioFrameLayout.getX());
textureImageView.setTranslationX(textureImageView.getTranslationX()+getLeftInset());
videoTextureView.setTranslationX(videoTextureView.getTranslationX()+getLeftInset()-aspectRatioFrameLayout.getX());
AnimatorSet animatorSet = new AnimatorSet();
animatorSet.playTogether(
@ -4779,7 +4779,7 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat
if (photoCropView != null) {
return;
}
photoCropView = new PhotoCropView(activityContext);
photoCropView = new PhotoCropView(actvityContext);
photoCropView.setVisibility(View.GONE);
int index = containerView.indexOfChild(pickerViewSendButton);
containerView.addView(photoCropView, index - 1, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.MATCH_PARENT, Gravity.TOP | Gravity.LEFT, 0, 0, 0, 48));
@ -5504,7 +5504,7 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat
TLRPC.BotInlineResult botInlineResult = (TLRPC.BotInlineResult) object;
if (botInlineResult.document != null) {
return FileLoader.getAttachFileName(botInlineResult.document);
} else if (botInlineResult.photo != null) {
} else if (botInlineResult.photo != null) {
TLRPC.PhotoSize sizeFull = FileLoader.getClosestPhotoSizeWithSize(botInlineResult.photo.sizes, AndroidUtilities.getPhotoSize());
return FileLoader.getAttachFileName(sizeFull);
} else if (botInlineResult.content instanceof TLRPC.TL_webDocument) {
@ -7309,7 +7309,7 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat
} else {
windowLayoutParams.flags = WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM;
}
if (chatActivity != null && chatActivity.getCurrentEncryptedChat() != null && !NekoXConfig.disableFlagSecure) {
if (chatActivity != null && chatActivity.getCurrentEncryptedChat() != null) {
windowLayoutParams.flags |= WindowManager.LayoutParams.FLAG_SECURE;
} else {
windowLayoutParams.flags &= ~WindowManager.LayoutParams.FLAG_SECURE;

View File

@ -187,6 +187,7 @@ public class SettingsActivity extends BaseFragment implements NotificationCenter
private int chatRow;
private int filtersRow;
private int devicesRow;
private int nekoRow;
private int devicesSectionRow;
private int helpHeaderRow;
private int questionRow;
@ -197,7 +198,6 @@ public class SettingsActivity extends BaseFragment implements NotificationCenter
private int sendLogsRow;
private int clearLogsRow;
private int switchBackendRow;
private int nekoRow;
private int versionRow;
private int rowCount;
@ -709,7 +709,7 @@ public class SettingsActivity extends BaseFragment implements NotificationCenter
titleTextView.setGravity(Gravity.LEFT);
titleTextView.setTextColor(Theme.getColor(Theme.key_actionBarDefaultTitle));
titleTextView.setTypeface(AndroidUtilities.getTypeface("fonts/rmedium.ttf"));
titleTextView.setText(BuildVars.DEBUG_VERSION ? "Telegram Beta" : LocaleController.getString("NekoX", R.string.NekoX));
titleTextView.setText(LocaleController.getString("NekoX", R.string.NekoX));
titleTextView.setAlpha(0.0f);
frameLayout.addView(titleTextView, LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, Gravity.LEFT | Gravity.TOP));

View File

@ -412,7 +412,7 @@ public class StickersActivity extends BaseFragment implements NotificationCenter
suggestRow = rowCount++;
loopRow = rowCount++;
loopInfoRow = rowCount++;
featuredRow = -1;
featuredRow = rowCount++;
} else {
suggestRow = -1;
loopRow = -1;

View File

@ -538,7 +538,11 @@ public class NekoSettingsActivity extends BaseFragment {
showSortMenuAlert();
} else if (position == disableSystemAccountRow) {
NekoXConfig.toggleDisableSystemAccount();
getContactsController().deleteUnknownAppAccounts();
if (NekoXConfig.disableSystemAccount) {
getContactsController().deleteUnknownAppAccounts();
} else {
getContactsController().checkAppAccount();
}
if (view instanceof TextCheckCell) {
((TextCheckCell) view).setChecked(NekoXConfig.disableSystemAccount);
}

View File

@ -320,6 +320,8 @@ public class NekoXConfig {
}
private static int currId = 10;
private static void mkFilter(String name, String description, int flag, FilterBuilder builder) {
TLRPC.TL_dialogFilterSuggested suggestedFilter = new TLRPC.TL_dialogFilterSuggested();
@ -328,6 +330,8 @@ public class NekoXConfig {
suggestedFilter.filter = new TLRPC.TL_dialogFilter();
suggestedFilter.filter.id = currId;
suggestedFilter.filter.title = name;
suggestedFilter.filter.flags = flag;
@ -335,6 +339,8 @@ public class NekoXConfig {
internalFilters.add(suggestedFilter);
currId ++;
}