Refactor nekogram package structure

This commit is contained in:
luvletter2333 2022-01-17 15:45:37 +08:00
parent 2237ece95d
commit 2a6708a4cc
No known key found for this signature in database
GPG Key ID: A26A8880836E1978
143 changed files with 1625 additions and 2073 deletions

View File

@ -44,7 +44,7 @@ import androidx.recyclerview.widget.RecyclerView.ViewHolder;
import java.util.ArrayList;
import java.util.List;
import tw.nekomimi.nkmr.NekomuraConfig;
import tw.nekomimi.nekogram.NekoConfig;
/**
* This is a utility class to add swipe to dismiss and drag & drop support to RecyclerView.
@ -681,7 +681,7 @@ public class ItemTouchHelper extends RecyclerView.ItemDecoration
mSelected = selected;
if (actionState == ACTION_STATE_DRAG) {
if (!NekomuraConfig.disableVibration.Bool()) {
if (!NekoConfig.disableVibration.Bool()) {
mSelected.itemView.performHapticFeedback(HapticFeedbackConstants.LONG_PRESS);
}
}

View File

@ -95,7 +95,7 @@ import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import tw.nekomimi.nkmr.NekomuraConfig;
import tw.nekomimi.nekogram.NekoConfig;
import tw.nekomimi.nekogram.utils.VibrateUtil;
/**
@ -7002,7 +7002,7 @@ public class RecyclerView extends ViewGroup implements ScrollingView,
try {
TraceCompat.beginSection(TRACE_CREATE_VIEW_TAG);
final VH holder = onCreateViewHolder(parent, viewType);
if (NekomuraConfig.disableVibration.Bool()) {
if (NekoConfig.disableVibration.Bool()) {
VibrateUtil.disableHapticFeedback(holder.itemView);
}
if (holder.itemView.getParent() != null) {

View File

@ -39,7 +39,6 @@ import android.graphics.Typeface;
import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.ColorDrawable;
import android.graphics.drawable.Drawable;
import android.media.MediaScannerConnection;
import android.net.Uri;
import android.os.Build;
import android.os.Environment;
@ -154,8 +153,8 @@ import java.util.regex.Pattern;
import cn.hutool.core.util.StrUtil;
import kotlin.Unit;
import tw.nekomimi.nekogram.BottomBuilder;
import tw.nekomimi.nkmr.NekomuraConfig;
import tw.nekomimi.nekogram.ui.BottomBuilder;
import tw.nekomimi.nekogram.NekoConfig;
import tw.nekomimi.nekogram.NekoXConfig;
import tw.nekomimi.nekogram.utils.AlertUtil;
import tw.nekomimi.nekogram.utils.EnvUtil;
@ -1362,7 +1361,7 @@ public class AndroidUtilities {
public static Typeface getTypeface(String assetPath) {
synchronized (typefaceCache) {
if (NekomuraConfig.typeface.Bool() && Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
if (NekoConfig.typeface.Bool() && Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
if (assetPath.contains("medium") && assetPath.contains("italic")) {
return Typeface.create("sans-serif-medium", Typeface.ITALIC);
}
@ -1714,7 +1713,7 @@ public class AndroidUtilities {
provider = 1;
}
} else {
if (NekomuraConfig.mapPreviewProvider.Int() == 1) {
if (NekoConfig.mapPreviewProvider.Int() == 1) {
provider = 1;
}
}
@ -1800,7 +1799,7 @@ public class AndroidUtilities {
}
public static boolean isTablet() {
if (isTablet == null) switch (NekomuraConfig.tabletMode.Int()) {
if (isTablet == null) switch (NekoConfig.tabletMode.Int()) {
case 0:
isTablet = ApplicationLoader.applicationContext != null && ApplicationLoader.applicationContext.getResources().getBoolean(R.bool.isTablet);
break;
@ -4289,14 +4288,14 @@ public class AndroidUtilities {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
final View decorView = window.getDecorView();
int flags = decorView.getSystemUiVisibility();
if (!SharedConfig.noStatusBar && NekomuraConfig.transparentStatusBar.Bool()) {
if (!SharedConfig.noStatusBar && NekoConfig.transparentStatusBar.Bool()) {
window.setStatusBarColor(Color.TRANSPARENT);
}
if (enable) {
if ((flags & View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR) == 0) {
flags |= View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR;
decorView.setSystemUiVisibility(flags);
if (!SharedConfig.noStatusBar && !NekomuraConfig.transparentStatusBar.Bool()) {
if (!SharedConfig.noStatusBar && !NekoConfig.transparentStatusBar.Bool()) {
window.setStatusBarColor(0x0f000000);
}
}
@ -4304,7 +4303,7 @@ public class AndroidUtilities {
if ((flags & View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR) != 0) {
flags &= ~View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR;
decorView.setSystemUiVisibility(flags);
if (!SharedConfig.noStatusBar && !NekomuraConfig.transparentStatusBar.Bool()) {
if (!SharedConfig.noStatusBar && !NekoConfig.transparentStatusBar.Bool()) {
window.setStatusBarColor(0x33000000);
}
}

View File

@ -29,7 +29,6 @@ import android.os.SystemClock;
import android.telephony.TelephonyManager;
import android.util.Log;
import androidx.core.app.NotificationManagerCompat;
import androidx.multidex.MultiDex;
import org.telegram.messenger.voip.VideoCapturerDevice;
@ -42,14 +41,11 @@ import java.io.File;
import java.lang.reflect.Method;
import java.util.HashSet;
import java.util.LinkedList;
import java.util.Set;
import tw.nekomimi.nekogram.ExternalGcm;
import tw.nekomimi.nkmr.NekomuraConfig;
import tw.nekomimi.nekogram.NekoXConfig;
import tw.nekomimi.nekogram.parts.SignturesKt;
import tw.nekomimi.nekogram.utils.FileUtil;
import tw.nekomimi.nekogram.utils.UIUtil;
import static android.os.Build.VERSION.SDK_INT;

View File

@ -37,7 +37,7 @@ import java.util.Collections;
import java.util.HashMap;
import java.util.concurrent.ConcurrentHashMap;
import tw.nekomimi.nkmr.NekomuraConfig;
import tw.nekomimi.nekogram.NekoConfig;
import androidx.collection.LongSparseArray;
public class ContactsController extends BaseController {
@ -324,7 +324,7 @@ public class ContactsController extends BaseController {
AccountManager am = AccountManager.get(ApplicationLoader.applicationContext);
if (getUserConfig().isClientActivated()) {
readContacts();
if (systemAccount == null && !NekomuraConfig.disableSystemAccount.Bool()) {
if (systemAccount == null && !NekoConfig.disableSystemAccount.Bool()) {
try {
TLRPC.User user = getUserConfig().getCurrentUser();
systemAccount = new Account(formatName(user.first_name, user.last_name), BuildConfig.APPLICATION_ID);
@ -343,7 +343,7 @@ public class ContactsController extends BaseController {
Account[] accounts = am.getAccountsByType(BuildConfig.APPLICATION_ID);
for (int a = 0; a < accounts.length; a++) {
Account acc = accounts[a];
if (NekomuraConfig.disableSystemAccount.Bool()) {
if (NekoConfig.disableSystemAccount.Bool()) {
try {
am.removeAccount(accounts[a], null, null);
} catch (Exception ignore) {
@ -2641,7 +2641,7 @@ public class ContactsController extends BaseController {
lastName = lastName.trim();
}
StringBuilder result = new StringBuilder((firstName != null ? firstName.length() : 0) + (lastName != null ? lastName.length() : 0) + 1);
if (NekomuraConfig.nameOrder.Int() == 1) {
if (NekoConfig.nameOrder.Int() == 1) {
if (firstName != null && firstName.length() > 0) {
if (maxLength > 0 && firstName.length() > maxLength + 2) {
return firstName.substring(0, maxLength);

View File

@ -26,7 +26,7 @@ import java.util.HashMap;
import androidx.collection.LongSparseArray;
import cn.hutool.core.util.StrUtil;
import tw.nekomimi.nkmr.NekomuraConfig;
import tw.nekomimi.nekogram.NekoConfig;
public class DownloadController extends BaseController implements NotificationCenter.NotificationCenterDelegate {
@ -575,9 +575,9 @@ public class DownloadController extends BaseController implements NotificationCe
if (messageObject.getDocument() != null) {
String documentName = messageObject.getDocument().file_name;
if (StrUtil.isNotBlank(documentName)) {
if ((NekomuraConfig.disableAutoDownloadingWin32Executable.Bool() &&
if ((NekoConfig.disableAutoDownloadingWin32Executable.Bool() &&
documentName.toLowerCase().matches(".*\\.(cmd|bat|com|exe|lnk|msi|ps1|reg|vb|vbe|vbs|vbscript)")
) || (NekomuraConfig.disableAutoDownloadingArchive.Bool() &&
) || (NekoConfig.disableAutoDownloadingArchive.Bool() &&
documentName.toLowerCase().matches(".*\\.(apk|zip|7z|tar|gz|zst|iso|xz|lha|lzh)")
)
) return false;

View File

@ -24,7 +24,6 @@ import android.text.TextPaint;
import android.text.TextUtils;
import android.text.style.DynamicDrawableSpan;
import android.text.style.ImageSpan;
import android.util.Log;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
@ -36,12 +35,10 @@ import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.Locale;
import java.util.zip.ZipFile;
import java.util.zip.ZipInputStream;
import tw.nekomimi.nekogram.EmojiProvider;
import tw.nekomimi.nekogram.NekoXConfig;
import tw.nekomimi.nekogram.NekoConfig;
import tw.nekomimi.nkmr.NekomuraConfig;
public class Emoji {
@ -134,7 +131,7 @@ public class Emoji {
try {
InputStream is;
String entry = "emoji/" + String.format(Locale.US, "%d_%d.png", page, page2);
if (NekomuraConfig.useCustomEmoji.Bool()) {
if (NekoConfig.useCustomEmoji.Bool()) {
entry = "custom_emoji/" + entry;
is = new FileInputStream(new File(ApplicationLoader.applicationContext.getFilesDir(), entry));
} else {
@ -289,7 +286,7 @@ public class Emoji {
b = getBounds();
}
if (!NekomuraConfig.useSystemEmoji.Bool() && EmojiProvider.containsEmoji) {
if (!NekoConfig.useSystemEmoji.Bool() && EmojiProvider.containsEmoji) {
if (!isLoaded()) {
loadEmoji(info.page, info.page2);
canvas.drawRect(getBounds(), placeholderPaint);
@ -301,14 +298,14 @@ public class Emoji {
String emoji = fixEmoji(EmojiData.data[info.page][info.emojiIndex]);
if (!NekomuraConfig.useSystemEmoji.Bool() && EmojiProvider.isFont) {
if (!NekoConfig.useSystemEmoji.Bool() && EmojiProvider.isFont) {
try {
textPaint.setTypeface(EmojiProvider.getFont());
} catch (RuntimeException ignored) {
}
} else if (NekomuraConfig.useSystemEmoji.Bool()) {
} else if (NekoConfig.useSystemEmoji.Bool()) {
try {
textPaint.setTypeface(NekoConfig.getSystemEmojiTypeface());
textPaint.setTypeface(NekoXConfig.getSystemEmojiTypeface());
} catch (RuntimeException ignored) {
}
}
@ -333,7 +330,7 @@ public class Emoji {
}
public boolean isLoaded() {
if (!EmojiProvider.containsEmoji || NekomuraConfig.useSystemEmoji.Bool()) {
if (!EmojiProvider.containsEmoji || NekoConfig.useSystemEmoji.Bool()) {
return true;
}
return emojiBmp[info.page][info.page2] != null;

View File

@ -24,9 +24,6 @@ import android.text.format.DateFormat;
import android.util.Xml;
import android.view.Gravity;
import com.google.gson.Gson;
import com.google.gson.JsonObject;
import org.telegram.messenger.support.ArrayUtils;
import org.telegram.messenger.time.FastDateFormat;
import org.telegram.tgnet.ConnectionsManager;
@ -47,10 +44,9 @@ import java.util.Currency;
import java.util.Date;
import java.util.HashMap;
import java.util.Locale;
import java.util.Map;
import java.util.TimeZone;
import tw.nekomimi.nkmr.NekomuraConfig;
import tw.nekomimi.nekogram.NekoConfig;
import tw.nekomimi.nekogram.parts.LocFiltersKt;
import tw.nekomimi.nekogram.shamsicalendar.PersianCalendar;
import tw.nekomimi.nekogram.utils.FileUtil;
@ -107,7 +103,7 @@ public class LocaleController {
private HashMap<String, String> translitChars;
private HashMap<String, String> ruTranslitChars;
public static boolean usePersianCalendar = NekomuraConfig.usePersianCalendar.Bool(); // need restart
public static boolean usePersianCalendar = NekoConfig.usePersianCalendar.Bool(); // need restart
private class TimeZoneChangedReceiver extends BroadcastReceiver {
@Override
@ -1814,7 +1810,7 @@ public class LocaleController {
formatterWeekLong = createFormatter(locale, getStringInternal("formatterWeekLong", R.string.formatterWeekLong), "EEEE");
formatterScheduleDay = createFormatter(locale, getStringInternal("formatDateSchedule", R.string.formatDateSchedule), "MMM d");
formatterScheduleYear = createFormatter(locale, getStringInternal("formatDateScheduleYear", R.string.formatDateScheduleYear), "MMM d yyyy");
formatterDay = createFormatter(lang.toLowerCase().equals("ar") || lang.toLowerCase().equals("ko") ? locale : Locale.US, (is24HourFormat ? getStringInternal("formatterDay24H", R.string.formatterDay24H) : getStringInternal("formatterDay12H", R.string.formatterDay12H)).replace(":mm", NekomuraConfig.showSeconds.Bool() ? ":mm:ss" : ":mm"), (is24HourFormat ? "HH:mm" : "h:mm a").replace(":mm", NekomuraConfig.showSeconds.Bool() ? ":mm:ss" : ":mm"));
formatterDay = createFormatter(lang.toLowerCase().equals("ar") || lang.toLowerCase().equals("ko") ? locale : Locale.US, (is24HourFormat ? getStringInternal("formatterDay24H", R.string.formatterDay24H) : getStringInternal("formatterDay12H", R.string.formatterDay12H)).replace(":mm", NekoConfig.showSeconds.Bool() ? ":mm:ss" : ":mm"), (is24HourFormat ? "HH:mm" : "h:mm a").replace(":mm", NekoConfig.showSeconds.Bool() ? ":mm:ss" : ":mm"));
formatterStats = createFormatter(locale, is24HourFormat ? getStringInternal("formatterStats24H", R.string.formatterStats24H) : getStringInternal("formatterStats12H", R.string.formatterStats12H), is24HourFormat ? "MMM dd yyyy, HH:mm" : "MMM dd yyyy, h:mm a");
formatterBannedUntil = createFormatter(locale, is24HourFormat ? getStringInternal("formatterBannedUntil24H", R.string.formatterBannedUntil24H) : getStringInternal("formatterBannedUntil12H", R.string.formatterBannedUntil12H), is24HourFormat ? "MMM dd yyyy, HH:mm" : "MMM dd yyyy, h:mm a");
formatterBannedUntilThisYear = createFormatter(locale, is24HourFormat ? getStringInternal("formatterBannedUntilThisYear24H", R.string.formatterBannedUntilThisYear24H) : getStringInternal("formatterBannedUntilThisYear12H", R.string.formatterBannedUntilThisYear12H), is24HourFormat ? "MMM dd, HH:mm" : "MMM dd, h:mm a");
@ -1962,7 +1958,7 @@ public class LocaleController {
}
public static String formatShortNumber(int number, int[] rounded) {
if (NekomuraConfig.disableNumberRounding.Bool()) {
if (NekoConfig.disableNumberRounding.Bool()) {
if (rounded != null) {
rounded[0] = number;
}

View File

@ -61,7 +61,6 @@ import android.widget.FrameLayout;
import com.google.android.exoplayer2.C;
import com.google.android.exoplayer2.ExoPlayer;
import com.google.android.exoplayer2.ui.AspectRatioFrameLayout;
import com.google.android.exoplayer2.util.Log;
import org.telegram.messenger.audioinfo.AudioInfo;
import org.telegram.messenger.video.MediaCodecVideoConvertor;
@ -83,7 +82,6 @@ import org.telegram.ui.PhotoViewer;
import java.io.File;
import java.io.FileDescriptor;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.InputStream;
import java.io.OutputStream;
@ -102,7 +100,6 @@ import java.util.concurrent.CountDownLatch;
import tw.nekomimi.nekogram.SaveToDownloadReceiver;
import tw.nekomimi.nekogram.NekoConfig;
import tw.nekomimi.nkmr.NekomuraConfig;
import tw.nekomimi.nekogram.NekoXConfig;
public class MediaController implements AudioManager.OnAudioFocusChangeListener, NotificationCenter.NotificationCenterDelegate, SensorEventListener {
@ -574,7 +571,7 @@ public class MediaController implements AudioManager.OnAudioFocusChangeListener,
private ArrayList<ByteBuffer> recordBuffers = new ArrayList<>();
private ByteBuffer fileBuffer;
public int recordBufferSize = 1280;
public int sampleRate = NekomuraConfig.increaseVoiceMessageQuality.Bool() ? 48000 : 16000;
public int sampleRate = NekoConfig.increaseVoiceMessageQuality.Bool() ? 48000 : 16000;
private int sendAfterDone;
private boolean sendAfterDoneNotify;
private int sendAfterDoneScheduleDate;
@ -858,7 +855,7 @@ public class MediaController implements AudioManager.OnAudioFocusChangeListener,
public void recreateProximityWakeLock() {
if (NekomuraConfig.disableProximityEvents.Bool()) {
if (NekoConfig.disableProximityEvents.Bool()) {
proximityWakeLock = null;
return;
}
@ -879,7 +876,7 @@ public class MediaController implements AudioManager.OnAudioFocusChangeListener,
recordQueue.postRunnable(() -> {
try {
sampleRate = NekomuraConfig.increaseVoiceMessageQuality.Bool() ? 48000 : 16000;
sampleRate = NekoConfig.increaseVoiceMessageQuality.Bool() ? 48000 : 16000;
int minBuferSize = AudioRecord.getMinBufferSize(sampleRate, AudioFormat.CHANNEL_IN_MONO, AudioFormat.ENCODING_PCM_16BIT);
if (minBuferSize <= 0) {
minBuferSize = 1280;
@ -1434,7 +1431,7 @@ public class MediaController implements AudioManager.OnAudioFocusChangeListener,
}
private boolean isNearToSensor(float value) {
return !NekomuraConfig.disableProximityEvents.Bool() && value < 5.0f && value != proximitySensor.getMaximumRange();
return !NekoConfig.disableProximityEvents.Bool() && value < 5.0f && value != proximitySensor.getMaximumRange();
}
public boolean isRecordingOrListeningByProximity() {
@ -3459,7 +3456,7 @@ public class MediaController implements AudioManager.OnAudioFocusChangeListener,
requestAudioFocus(true);
if (!NekomuraConfig.disableVibration.Bool()) {
if (!NekoConfig.disableVibration.Bool()) {
try {
feedbackView.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING);
} catch (Exception ignore) {
@ -3489,7 +3486,7 @@ public class MediaController implements AudioManager.OnAudioFocusChangeListener,
recordingAudioFile = new File(FileLoader.getDirectory(FileLoader.MEDIA_DIR_CACHE), FileLoader.getAttachFileName(recordingAudio));
try {
if (startRecord(recordingAudioFile.getAbsolutePath(), NekomuraConfig.increaseVoiceMessageQuality.Bool() ? 48000 : 16000) == 0) {
if (startRecord(recordingAudioFile.getAbsolutePath(), NekoConfig.increaseVoiceMessageQuality.Bool() ? 48000 : 16000) == 0) {
AndroidUtilities.runOnUIThread(() -> {
recordStartRunnable = null;
NotificationCenter.getInstance(currentAccount).postNotificationName(NotificationCenter.recordStartError, guid);
@ -3647,7 +3644,7 @@ public class MediaController implements AudioManager.OnAudioFocusChangeListener,
if (send == 0) {
stopRecordingInternal(0, false, 0);
}
if (!NekomuraConfig.disableVibration.Bool()) {
if (!NekoConfig.disableVibration.Bool()) {
try {
feedbackView.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING);
} catch (Exception ignore) {

View File

@ -40,9 +40,6 @@ import androidx.core.content.pm.ShortcutManagerCompat;
import androidx.core.graphics.drawable.IconCompat;
import androidx.collection.LongSparseArray;
import androidx.core.content.pm.ShortcutInfoCompat;
import androidx.core.content.pm.ShortcutManagerCompat;
import androidx.core.graphics.drawable.IconCompat;
import org.telegram.SQLite.SQLiteCursor;
import org.telegram.SQLite.SQLiteDatabase;
@ -79,10 +76,8 @@ import java.util.concurrent.CountDownLatch;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import androidx.collection.LongSparseArray;
import tw.nekomimi.nkmr.NekomuraConfig;
import tw.nekomimi.nekogram.NekoXConfig;
import tw.nekomimi.nekogram.PinnedStickerHelper;
import tw.nekomimi.nekogram.NekoConfig;
import tw.nekomimi.nekogram.ui.PinnedStickerHelper;
@SuppressWarnings("unchecked")
public class MediaDataController extends BaseController {
@ -433,7 +428,7 @@ public class MediaDataController extends BaseController {
public ArrayList<TLRPC.Document> getRecentStickers(int type, int padding) {
ArrayList<TLRPC.Document> arrayList = recentStickers[type];
return new ArrayList<>(arrayList.subList(0, Math.min(arrayList.size(), NekomuraConfig.maxRecentStickerCount.Int() + padding)));
return new ArrayList<>(arrayList.subList(0, Math.min(arrayList.size(), NekoConfig.maxRecentStickerCount.Int() + padding)));
}
public ArrayList<TLRPC.Document> getRecentStickersNoCopy(int type) {
@ -495,7 +490,7 @@ public class MediaDataController extends BaseController {
AndroidUtilities.runOnUIThread(() -> getMediaDataController().loadRecents(MediaDataController.TYPE_FAVE, false, false, true));
}
});
maxCount = NekomuraConfig.unlimitedFavedStickers.Bool() ? Integer.MAX_VALUE : getMessagesController().maxFaveStickersCount;
maxCount = NekoConfig.unlimitedFavedStickers.Bool() ? Integer.MAX_VALUE : getMessagesController().maxFaveStickersCount;
} else {
if (type == TYPE_IMAGE && remove) {
NotificationCenter.getGlobalInstance().postNotificationName(NotificationCenter.showBulletin, Bulletin.TYPE_STICKER, document, StickerSetBulletinLayout.TYPE_REMOVED_FROM_RECENT);
@ -890,7 +885,7 @@ public class MediaDataController extends BaseController {
}
public void loadRecents(int type, boolean gif, boolean cache, boolean force) {
if (NekomuraConfig.unlimitedFavedStickers.Bool() && type == TYPE_FAVE && !cache) {
if (NekoConfig.unlimitedFavedStickers.Bool() && type == TYPE_FAVE && !cache) {
return;
}
if (gif) {
@ -1062,7 +1057,7 @@ public class MediaDataController extends BaseController {
if (type == TYPE_GREETINGS) {
maxCount = 200;
} else if (type == TYPE_FAVE) {
maxCount = NekomuraConfig.unlimitedFavedStickers.Bool() ? Integer.MAX_VALUE : getMessagesController().maxFaveStickersCount;
maxCount = NekoConfig.unlimitedFavedStickers.Bool() ? Integer.MAX_VALUE : getMessagesController().maxFaveStickersCount;
} else {
maxCount = getMessagesController().maxRecentStickersCount;
}
@ -1222,7 +1217,7 @@ public class MediaDataController extends BaseController {
}
public void loadFeaturedStickers(boolean cache, boolean force) {
if (loadingFeaturedStickers || NekomuraConfig.disableTrending.Bool()) {
if (loadingFeaturedStickers || NekoConfig.disableTrending.Bool()) {
return;
}
loadingFeaturedStickers = true;
@ -1552,7 +1547,7 @@ public class MediaDataController extends BaseController {
} else {
LongSparseArray<TLRPC.TL_messages_stickerSet> newStickerSets = new LongSparseArray<>();
// NekoX: Pin Sticker
if (NekomuraConfig.enableStickerPin.Bool() && type == MediaDataController.TYPE_IMAGE) {
if (NekoConfig.enableStickerPin.Bool() && type == MediaDataController.TYPE_IMAGE) {
PinnedStickerHelper ins = PinnedStickerHelper.getInstance(UserConfig.selectedAccount);
if (ins.reorderPinnedStickersForSS(res.sets, true))
AndroidUtilities.runOnUIThread(() -> {
@ -2071,7 +2066,7 @@ public class MediaDataController extends BaseController {
int type = stickerSet.masks ? TYPE_MASK : TYPE_IMAGE;
if (NekomuraConfig.enableStickerPin.Bool() && type == MediaDataController.TYPE_IMAGE && (toggle == 0 || toggle == 1)) {
if (NekoConfig.enableStickerPin.Bool() && type == MediaDataController.TYPE_IMAGE && (toggle == 0 || toggle == 1)) {
PinnedStickerHelper.getInstance(currentAccount).removePinnedStickerLocal(stickerSet.id);
}
@ -2108,7 +2103,7 @@ public class MediaDataController extends BaseController {
toggleStickerSetInternal(context, toggle, baseFragment, showSettings, stickerSetObject, stickerSet, type, false);
} else {
StickerSetBulletinLayout bulletinLayout = new StickerSetBulletinLayout(context, stickerSetObject, toggle);
int finalCurrentIndex = NekomuraConfig.enableStickerPin.Bool() && type == TYPE_IMAGE && PinnedStickerHelper.getInstance(UserConfig.selectedAccount).isPinned(stickerSet.id)
int finalCurrentIndex = NekoConfig.enableStickerPin.Bool() && type == TYPE_IMAGE && PinnedStickerHelper.getInstance(UserConfig.selectedAccount).isPinned(stickerSet.id)
? PinnedStickerHelper.getInstance(UserConfig.selectedAccount).pinnedList.size()
: currentIndex;
// NekoX: Pin Sticker, Fix undo for Archiving and Deleting

View File

@ -59,18 +59,14 @@ import java.util.Collections;
import java.util.GregorianCalendar;
import java.util.HashMap;
import java.util.List;
import java.util.Stack;
import java.util.concurrent.atomic.AtomicReference;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import cn.hutool.core.util.StrUtil;
import tw.nekomimi.nkmr.NekomuraConfig;
import tw.nekomimi.nekogram.NekoConfig;
import tw.nekomimi.nekogram.NekoXConfig;
import androidx.collection.LongSparseArray;
import androidx.core.math.MathUtils;
public class MessageObject {
public static final int MESSAGE_SEND_STATE_SENT = 0;
@ -3047,7 +3043,7 @@ public class MessageObject {
} else {
isRestrictedMessage = false;
String restrictionReason = MessagesController.getRestrictionReason(messageOwner.restriction_reason);
if (!TextUtils.isEmpty(restrictionReason) && !NekomuraConfig.ignoreContentRestrictions.Bool()) {
if (!TextUtils.isEmpty(restrictionReason) && !NekoConfig.ignoreContentRestrictions.Bool()) {
messageText = restrictionReason;
isRestrictedMessage = true;
} else if (!isMediaEmpty()) {

View File

@ -69,9 +69,8 @@ import java.util.stream.Collectors;
import cn.hutool.core.thread.ThreadUtil;
import tw.nekomimi.nekogram.ExternalGcm;
import tw.nekomimi.nekogram.InternalFilters;
import tw.nekomimi.nekogram.ui.InternalFilters;
import tw.nekomimi.nekogram.NekoConfig;
import tw.nekomimi.nkmr.NekomuraConfig;
import tw.nekomimi.nekogram.NekoXConfig;
import tw.nekomimi.nekogram.utils.AlertUtil;
import tw.nekomimi.nekogram.utils.UIUtil;
@ -659,25 +658,25 @@ public class MessagesController extends BaseController implements NotificationCe
boolean is1user = !DialogObject.isChannel(dialog1) && dialog1.id > 0;
boolean is2user = !DialogObject.isChannel(dialog2) && dialog2.id > 0;
if (NekomuraConfig.sortByUnread.Bool()) {
if (NekoConfig.sortByUnread.Bool()) {
if (dialog1.unread_count == 0 && dialog2.unread_count > 0) {
return 1;
} else if (dialog1.unread_count > 0 && dialog2.unread_count == 0) {
return -1;
} else if (dialog1.unread_count > 0 && dialog2.unread_count > 0) {
if (NekomuraConfig.sortByUnmuted.Bool()) {
if (NekoConfig.sortByUnmuted.Bool()) {
if (isDialogMuted(dialog1.id) && !isDialogMuted(dialog2.id)) {
return 1;
} else if (!isDialogMuted(dialog1.id) && isDialogMuted(dialog2.id)) {
return -1;
} else if (!isDialogMuted(dialog1.id) && !isDialogMuted(dialog2.id)) {
if (NekomuraConfig.sortByUser.Bool()) {
if (NekoConfig.sortByUser.Bool()) {
if (!is1user && is2user) {
return 1;
} else if (is1user && !is2user) {
return -1;
} else if (is1user && is2user) {
if (NekomuraConfig.sortByContacts.Bool()) {
if (NekoConfig.sortByContacts.Bool()) {
boolean is1contact = is1user && getContactsController().isContact((int) dialog1.id);
boolean is2contact = is2user && getContactsController().isContact((int) dialog2.id);
if (!is1contact && is2contact) {
@ -699,19 +698,19 @@ public class MessagesController extends BaseController implements NotificationCe
return 0;
}
}
} else if (NekomuraConfig.sortByUnmuted.Bool()) {
} else if (NekoConfig.sortByUnmuted.Bool()) {
if (dialog1.unread_count == 0 && dialog2.unread_count > 0 && isDialogMuted(dialog1.id) && !isDialogMuted(dialog2.id)) {
return 1;
} else if (dialog1.unread_count > 0 && dialog2.unread_count == 0 && !isDialogMuted(dialog1.id) && isDialogMuted(dialog2.id)) {
return -1;
} else if (dialog1.unread_count > 0 && dialog2.unread_count > 0 && !isDialogMuted(dialog1.id) && !isDialogMuted(dialog2.id)) {
if (NekomuraConfig.sortByUser.Bool()) {
if (NekoConfig.sortByUser.Bool()) {
if (!is1user && is2user) {
return 1;
} else if (is1user && !is2user) {
return -1;
} else if (is1user && is2user) {
if (NekomuraConfig.sortByContacts.Bool()) {
if (NekoConfig.sortByContacts.Bool()) {
boolean is1contact = is1user && getContactsController().isContact((int) dialog1.id);
boolean is2contact = is2user && getContactsController().isContact((int) dialog2.id);
if (!is1contact && is2contact) {
@ -4336,7 +4335,7 @@ public class MessagesController extends BaseController implements NotificationCe
}
loadingBlockedPeers = false;
getNotificationCenter().postNotificationName(NotificationCenter.blockedUsersDidLoad);
if (!reset && !blockedEndReached && NekomuraConfig.ignoreBlocked.Bool()) {
if (!reset && !blockedEndReached && NekoConfig.ignoreBlocked.Bool()) {
getBlockedPeers(false);
}
}
@ -5893,7 +5892,7 @@ public class MessagesController extends BaseController implements NotificationCe
TLRPC.TL_help_promoData res = (TLRPC.TL_help_promoData) response;
SharedConfig.ProxyInfo proxy = SharedConfig.currentProxy;
if (res.proxy && (NekomuraConfig.hideProxySponsorChannel.Bool() || (proxy != null && proxy.subId == 1L))) {
if (res.proxy && (NekoConfig.hideProxySponsorChannel.Bool() || (proxy != null && proxy.subId == 1L))) {
nextPromoInfoCheckTime = getConnectionsManager().getCurrentTime() + 60 * 60;
noDialog = true;
} else {
@ -6165,7 +6164,7 @@ public class MessagesController extends BaseController implements NotificationCe
newStrings.put(key, newPrintingStrings);
newTypes.put(key, newPrintingStringsTypes);
if (NekomuraConfig.ignoreBlocked.Bool()) {
if (NekoConfig.ignoreBlocked.Bool()) {
arr = arr.stream().filter(it -> getMessagesController().blockePeers.indexOfKey(it.userId) == -1).collect(Collectors.toCollection(ArrayList::new));
}
@ -6345,7 +6344,7 @@ public class MessagesController extends BaseController implements NotificationCe
}
public boolean sendTyping(long dialogId, int threadMsgId, int action, String emojicon, int classGuid) {
if (NekomuraConfig.disableChatAction.Bool()) return false;
if (NekoConfig.disableChatAction.Bool()) return false;
if (action < 0 || action >= sendingTypings.length || dialogId == 0) {
return false;
}
@ -6415,7 +6414,7 @@ public class MessagesController extends BaseController implements NotificationCe
} else if (action == 9) {
req.action = new TLRPC.TL_sendMessageUploadAudioAction();
} else if (action == 10) {
if (NekomuraConfig.disableChoosingSticker.Bool())
if (NekoConfig.disableChoosingSticker.Bool())
req.action = new TLRPC.TL_sendMessageTypingAction();
else
req.action = new TLRPC.TL_sendMessageChooseStickerAction();
@ -7897,7 +7896,7 @@ public class MessagesController extends BaseController implements NotificationCe
TLRPC.Message lastMessage = null;
for (int a = 0; a < dialogsRes.messages.size(); a++) {
TLRPC.Message message = dialogsRes.messages.get(a);
if (NekomuraConfig.ignoreBlocked.Bool() && getMessagesController().blockePeers.indexOfKey(message.peer_id.user_id) >= 0) {
if (NekoConfig.ignoreBlocked.Bool() && getMessagesController().blockePeers.indexOfKey(message.peer_id.user_id) >= 0) {
continue;
}
if (lastMessage == null || message.date < lastMessage.date) {
@ -11069,7 +11068,7 @@ public class MessagesController extends BaseController implements NotificationCe
newTaskId = taskId;
}
if (!NekomuraConfig.unlimitedPinnedDialogs.Bool()) getConnectionsManager().sendRequest(req, (response, error) -> {
if (!NekoConfig.unlimitedPinnedDialogs.Bool()) getConnectionsManager().sendRequest(req, (response, error) -> {
if (newTaskId != 0) {
getMessagesStorage().removePendingTask(newTaskId);
}
@ -11081,7 +11080,7 @@ public class MessagesController extends BaseController implements NotificationCe
}
public void loadPinnedDialogs(final int folderId, long newDialogId, ArrayList<Long> order) {
if (NekomuraConfig.unlimitedPinnedDialogs.Bool()) {
if (NekoConfig.unlimitedPinnedDialogs.Bool()) {
return;
}
if (loadingPinnedDialogs.indexOfKey(folderId) >= 0 || getUserConfig().isPinnedDialogsLoaded(folderId)) {
@ -14298,7 +14297,7 @@ public class MessagesController extends BaseController implements NotificationCe
message.entities = sponsoredMessage.entities;
message.flags |= 128;
}
if (NekomuraConfig.hideSponsoredMessage.Bool())
if (NekoConfig.hideSponsoredMessage.Bool())
message.hide = true;
message.peer_id = getPeer(dialogId);
message.from_id = sponsoredMessage.from_id;
@ -14619,7 +14618,7 @@ public class MessagesController extends BaseController implements NotificationCe
dialog.top_message = lastMessage.getId();
dialog.last_message_date = lastMessage.messageOwner.date;
changed = true;
if(NekomuraConfig.ignoreBlocked.Bool() && blockePeers.indexOfKey(lastMessage.getSenderId())>=0){
if(NekoConfig.ignoreBlocked.Bool() && blockePeers.indexOfKey(lastMessage.getSenderId())>=0){
MessageObject preMsg = dialogMessage.get(dialogId);
if(blockePeers.indexOfKey(preMsg.getSenderId())<0)
dialogMessageFromUnblocked.put(dialogId, preMsg);
@ -14760,10 +14759,10 @@ public class MessagesController extends BaseController implements NotificationCe
} catch (Exception e) {
NekomuraConfig.sortByUnread.setConfigBool(false);
NekomuraConfig.sortByUnmuted.setConfigBool(false);
NekomuraConfig.sortByUser.setConfigBool(false);
NekomuraConfig.sortByContacts.setConfigBool(false);
NekoConfig.sortByUnread.setConfigBool(false);
NekoConfig.sortByUnmuted.setConfigBool(false);
NekoConfig.sortByUser.setConfigBool(false);
NekoConfig.sortByContacts.setConfigBool(false);
try {
@ -14899,7 +14898,7 @@ public class MessagesController extends BaseController implements NotificationCe
}
for (int a = 0, N = reasons.size(); a < N; a++) {
TLRPC.TL_restrictionReason reason = reasons.get(a);
if ("all".equals(reason.platform) || !AndroidUtilities.isStandaloneApp() && !AndroidUtilities.isBetaApp() && "android".equals(reason.platform) && !NekomuraConfig.ignoreContentRestrictions.Bool()) {
if ("all".equals(reason.platform) || !AndroidUtilities.isStandaloneApp() && !AndroidUtilities.isBetaApp() && "android".equals(reason.platform) && !NekoConfig.ignoreContentRestrictions.Bool()) {
return reason.text;
}
}
@ -14939,7 +14938,7 @@ public class MessagesController extends BaseController implements NotificationCe
}
if (reason != null) {
showCantOpenAlert(fragment, reason);
if (!NekomuraConfig.ignoreContentRestrictions.Bool()) return false;
if (!NekoConfig.ignoreContentRestrictions.Bool()) return false;
}
if (messageId != 0 && originalMessage != null && chat != null && chat.access_hash == 0) {
long did = originalMessage.getDialogId();
@ -15004,7 +15003,7 @@ public class MessagesController extends BaseController implements NotificationCe
}
if (reason != null) {
showCantOpenAlert(fragment, reason);
if (!NekomuraConfig.ignoreContentRestrictions.Bool()) return;
if (!NekoConfig.ignoreContentRestrictions.Bool()) return;
}
Bundle args = new Bundle();

View File

@ -21,7 +21,6 @@ import android.util.SparseIntArray;
import androidx.annotation.UiThread;
import androidx.annotation.UiThread;
import androidx.collection.LongSparseArray;
import org.telegram.PhoneFormat.PhoneFormat;
@ -52,8 +51,7 @@ import java.util.concurrent.atomic.AtomicLong;
import cn.hutool.core.util.NumberUtil;
import cn.hutool.core.util.StrUtil;
import tw.nekomimi.nkmr.NekomuraConfig;
import androidx.collection.LongSparseArray;
import tw.nekomimi.nekogram.NekoConfig;
public class MessagesStorage extends BaseController {
@ -2565,7 +2563,7 @@ public class MessagesStorage extends BaseController {
continue;
}
flags = filter.flags;
if (NekomuraConfig.ignoreMutedCount.Bool() && (flags & MessagesController.DIALOG_FILTER_FLAG_EXCLUDE_MUTED) == 0) {
if (NekoConfig.ignoreMutedCount.Bool() && (flags & MessagesController.DIALOG_FILTER_FLAG_EXCLUDE_MUTED) == 0) {
flags |= MessagesController.DIALOG_FILTER_FLAG_EXCLUDE_MUTED;
}
} else {
@ -4735,7 +4733,7 @@ public class MessagesStorage extends BaseController {
}
unreadCount = filter.pendingUnreadCount;
flags = filter.flags;
if (NekomuraConfig.ignoreMutedCount.Bool() && (flags & MessagesController.DIALOG_FILTER_FLAG_EXCLUDE_MUTED) == 0) {
if (NekoConfig.ignoreMutedCount.Bool() && (flags & MessagesController.DIALOG_FILTER_FLAG_EXCLUDE_MUTED) == 0) {
flags |= MessagesController.DIALOG_FILTER_FLAG_EXCLUDE_MUTED;
}
} else {

View File

@ -21,7 +21,6 @@ import android.app.PendingIntent;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.content.res.Configuration;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Color;
@ -45,7 +44,6 @@ import android.os.SystemClock;
import android.provider.Settings;
import android.text.TextUtils;
import android.util.SparseArray;
import android.util.SparseIntArray;
import androidx.collection.LongSparseArray;
@ -58,14 +56,10 @@ import androidx.core.content.LocusIdCompat;
import androidx.core.content.pm.ShortcutInfoCompat;
import androidx.core.content.pm.ShortcutManagerCompat;
import androidx.core.graphics.drawable.IconCompat;
import android.text.TextUtils;
import android.util.SparseArray;
import org.json.JSONArray;
import org.telegram.messenger.support.LongSparseIntArray;
import org.telegram.tgnet.ConnectionsManager;
import org.telegram.tgnet.TLRPC;
import org.telegram.ui.ActionBar.Theme;
import org.telegram.ui.BubbleActivity;
import org.telegram.ui.LaunchActivity;
import org.telegram.ui.PopupNotificationActivity;
@ -78,8 +72,8 @@ import java.util.List;
import java.util.Map;
import java.util.concurrent.CountDownLatch;
import tw.nekomimi.nekogram.NekoXConfig;
import tw.nekomimi.nekogram.NekoConfig;
import tw.nekomimi.nkmr.NekomuraConfig;
public class NotificationsController extends BaseController {
@ -784,7 +778,7 @@ public class NotificationsController extends BaseController {
messageObject.messageOwner.silent && (messageObject.messageOwner.action instanceof TLRPC.TL_messageActionContactSignUp || messageObject.messageOwner.action instanceof TLRPC.TL_messageActionUserJoined))) {
continue;
}
if (NekomuraConfig.ignoreBlocked.Bool() && getMessagesController().blockePeers.indexOfKey(messageObject.getSenderId()) >= 0) {
if (NekoConfig.ignoreBlocked.Bool() && getMessagesController().blockePeers.indexOfKey(messageObject.getSenderId()) >= 0) {
continue;
}
@ -3746,7 +3740,7 @@ public class NotificationsController extends BaseController {
.setGroupSummary(true)
.setShowWhen(true)
.setWhen(((long) lastMessageObject.messageOwner.date) * 1000)
.setColor(NekoConfig.getNotificationColor());
.setColor(NekoXConfig.getNotificationColor());
long[] vibrationPattern = null;
Uri sound = null;
@ -4238,7 +4232,7 @@ public class NotificationsController extends BaseController {
int rowsMid = 0;
for (int a = messageObjects.size() - 1; a >= 0; a--) {
MessageObject messageObject = messageObjects.get(a);
if (NekomuraConfig.ignoreBlocked.Bool() && getMessagesController().blockePeers.indexOfKey(messageObject.getSenderId()) >= 0) {
if (NekoConfig.ignoreBlocked.Bool() && getMessagesController().blockePeers.indexOfKey(messageObject.getSenderId()) >= 0) {
continue;
}
String message = getShortStringForMessage(messageObject, senderName, preview);
@ -4454,7 +4448,7 @@ public class NotificationsController extends BaseController {
.setContentText(text.toString())
.setAutoCancel(true)
.setNumber(messageObjects.size())
.setColor(NekoConfig.getNotificationColor())
.setColor(NekoXConfig.getNotificationColor())
.setGroupSummary(false)
.setWhen(date)
.setShowWhen(true)

View File

@ -11,21 +11,15 @@ package org.telegram.messenger;
import android.app.Notification;
import android.app.NotificationChannel;
import android.app.NotificationManager;
import android.app.PendingIntent;
import android.app.Service;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.net.Uri;
import android.os.Build;
import android.os.IBinder;
import android.provider.Settings;
import androidx.core.app.NotificationCompat;
import tw.nekomimi.nekogram.NekoConfig;
import tw.nekomimi.nkmr.NekomuraConfig;
public class NotificationsService extends Service {
@Override

View File

@ -32,7 +32,6 @@ import java.util.Collections;
import java.util.Locale;
import java.util.concurrent.ConcurrentHashMap;
import tw.nekomimi.nkmr.NekomuraConfig;
import tw.nekomimi.nekogram.utils.AlertUtil;
public class SecretChatHelper extends BaseController {

View File

@ -54,7 +54,7 @@ import java.util.stream.Collectors;
import cn.hutool.core.util.StrUtil;
import okhttp3.HttpUrl;
import tw.nekomimi.nekogram.ProxyManager;
import tw.nekomimi.nekogram.proxy.ProxyManager;
import tw.nekomimi.nekogram.proxy.ShadowsocksLoader;
import tw.nekomimi.nekogram.proxy.ShadowsocksRLoader;
import tw.nekomimi.nekogram.proxy.VmessLoader;

View File

@ -11,7 +11,7 @@ import org.webrtc.VideoSink;
import java.nio.ByteBuffer;
import java.util.concurrent.CountDownLatch;
import tw.nekomimi.nkmr.NekomuraConfig;
import tw.nekomimi.nekogram.NekoConfig;
public class NativeInstance {
@ -74,7 +74,7 @@ public class NativeInstance {
instance.requestBroadcastPartCallback = requestBroadcastPartCallback;
instance.cancelRequestBroadcastPartCallback = cancelRequestBroadcastPartCallback;
instance.isGroup = true;
instance.nativePtr = makeGroupNativeInstance(instance, logPath, SharedConfig.disableVoiceAudioEffects, videoCapturer, screencast, noiseSupression, (short) NekomuraConfig.customAudioBitrate.Int());
instance.nativePtr = makeGroupNativeInstance(instance, logPath, SharedConfig.disableVoiceAudioEffects, videoCapturer, screencast, noiseSupression, (short) NekoConfig.customAudioBitrate.Int());
return instance;
}

View File

@ -37,7 +37,6 @@ import android.graphics.Path;
import android.graphics.PorterDuff;
import android.graphics.PorterDuffXfermode;
import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.Icon;
import android.hardware.Sensor;
import android.hardware.SensorEvent;
import android.hardware.SensorEventListener;
@ -133,7 +132,7 @@ import java.util.HashSet;
import java.util.Iterator;
import java.util.Set;
import tw.nekomimi.nkmr.NekomuraConfig;
import tw.nekomimi.nekogram.NekoConfig;
@SuppressLint("NewApi")
public class VoIPService extends Service implements SensorEventListener, AudioManager.OnAudioFocusChangeListener, VoIPController.ConnectionStateListener, NotificationCenter.NotificationCenterDelegate {
@ -3435,7 +3434,7 @@ public class VoIPService extends Service implements SensorEventListener, AudioMa
}
private void loadResources() {
if (NekomuraConfig.useMediaStreamInVoip.Bool()) {
if (NekoConfig.useMediaStreamInVoip.Bool()) {
currentStreamType = AudioManager.STREAM_MUSIC;
if (Build.VERSION.SDK_INT >= 21)
WebRtcAudioTrack.setAudioTrackUsageAttribute(AudioAttributes.USAGE_MEDIA);

View File

@ -9,7 +9,6 @@ import android.text.TextUtils;
import android.util.Base64;
import android.util.SparseArray;
import com.google.android.exoplayer2.util.Log;
import com.v2ray.ang.util.Utils;
import org.telegram.messenger.AccountInstance;
@ -50,7 +49,7 @@ import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicInteger;
import cn.hutool.core.util.StrUtil;
import tw.nekomimi.nkmr.NekomuraConfig;
import tw.nekomimi.nekogram.NekoConfig;
import tw.nekomimi.nekogram.parts.ProxySwitcher;
import tw.nekomimi.nekogram.utils.DnsFactory;
@ -881,7 +880,7 @@ public class ConnectionsManager extends BaseController {
if (!hasIpv4) {
ipStrategy = USE_IPV6_ONLY;
}
if (NekomuraConfig.useIPv6.Bool()) {
if (NekoConfig.useIPv6.Bool()) {
ipStrategy = USE_IPV4_IPV6_RANDOM;
}
return ipStrategy;

View File

@ -22,9 +22,7 @@ import java.util.ArrayList;
import java.util.HashMap;
import cn.hutool.core.util.ArrayUtil;
import tw.nekomimi.nekogram.NekoConfig;
import tw.nekomimi.nekogram.NekoXConfig;
import tw.nekomimi.nkmr.NekomuraConfig;
@SuppressWarnings("unchecked")
public class TLRPC {

View File

@ -41,7 +41,6 @@ import android.view.ViewPropertyAnimator;
import android.widget.FrameLayout;
import android.widget.ImageView;
import org.checkerframework.checker.units.qual.A;
import org.telegram.messenger.AndroidUtilities;
import org.telegram.messenger.LocaleController;
import org.telegram.messenger.R;
@ -55,8 +54,7 @@ import org.telegram.ui.Components.SnowflakesEffect;
import java.util.ArrayList;
import tw.nekomimi.nkmr.NekomuraConfig;
import tw.nekomimi.nkmr.NekomuraConfig;
import tw.nekomimi.nekogram.NekoConfig;
public class ActionBar extends FrameLayout {
@ -264,11 +262,11 @@ public class ActionBar extends FrameLayout {
}
}
}
if (NekomuraConfig.actionBarDecoration.Int() == 2) {
if (NekoConfig.actionBarDecoration.Int() == 2) {
if (fireworksEffect == null) {
fireworksEffect = new FireworksEffect();
}
} else if (NekomuraConfig.actionBarDecoration.Int() == 1 || Theme.canStartHolidayAnimation()) {
} else if (NekoConfig.actionBarDecoration.Int() == 1 || Theme.canStartHolidayAnimation()) {
if (snowflakesEffect == null) {
snowflakesEffect = new SnowflakesEffect(0);
}
@ -1580,7 +1578,7 @@ public class ActionBar extends FrameLayout {
}
public void unreadBadgeSetCount(int count) {
if (backButtonImageView != null && NekomuraConfig.unreadBadgeOnBackButton.Bool()) {
if (backButtonImageView != null && NekoConfig.unreadBadgeOnBackButton.Bool()) {
backButtonImageView.setUnread(count);
}
}

View File

@ -40,7 +40,6 @@ import android.widget.FrameLayout;
import androidx.annotation.Keep;
import androidx.annotation.Keep;
import androidx.core.graphics.ColorUtils;
import androidx.core.math.MathUtils;
@ -57,7 +56,7 @@ import org.telegram.ui.Components.LayoutHelper;
import java.util.ArrayList;
import java.util.HashMap;
import tw.nekomimi.nkmr.NekomuraConfig;
import tw.nekomimi.nekogram.NekoConfig;
import tw.nekomimi.nekogram.utils.VibrateUtil;
public class ActionBarLayout extends FrameLayout {
@ -338,7 +337,7 @@ public class ActionBarLayout extends FrameLayout {
if (layerShadowDrawable == null) {
layerShadowDrawable = getResources().getDrawable(R.drawable.layer_shadow);
headerShadowDrawable = NekomuraConfig.disableAppBarShadow.Bool() ? null : getResources().getDrawable(R.drawable.header_shadow).mutate();
headerShadowDrawable = NekoConfig.disableAppBarShadow.Bool() ? null : getResources().getDrawable(R.drawable.header_shadow).mutate();
scrimPaint = new Paint();
}
}
@ -665,7 +664,7 @@ public class ActionBarLayout extends FrameLayout {
View fragmentView = lastFragment.fragmentView;
if (fragmentView == null) {
fragmentView = lastFragment.createView(parentActivity);
if (NekomuraConfig.disableVibration.Bool()) {
if (NekoConfig.disableVibration.Bool()) {
VibrateUtil.disableHapticFeedback(fragmentView);
}
}
@ -1081,7 +1080,7 @@ public class ActionBarLayout extends FrameLayout {
View fragmentView = fragment.fragmentView;
if (fragmentView == null) {
fragmentView = fragment.createView(parentActivity);
if (NekomuraConfig.disableVibration.Bool()) {
if (NekoConfig.disableVibration.Bool()) {
VibrateUtil.disableHapticFeedback(fragmentView);
}
} else {
@ -1432,7 +1431,7 @@ public class ActionBarLayout extends FrameLayout {
}
});
animatorSet.start();
if (!NekomuraConfig.disableVibration.Bool()) {
if (!NekoConfig.disableVibration.Bool()) {
performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP);
}
@ -1479,7 +1478,7 @@ public class ActionBarLayout extends FrameLayout {
View fragmentView = previousFragment.fragmentView;
if (fragmentView == null) {
fragmentView = previousFragment.createView(parentActivity);
if (NekomuraConfig.disableVibration.Bool()) {
if (NekoConfig.disableVibration.Bool()) {
VibrateUtil.disableHapticFeedback(fragmentView);
}
}
@ -1667,7 +1666,7 @@ public class ActionBarLayout extends FrameLayout {
View fragmentView = previousFragment.fragmentView;
if (fragmentView == null) {
fragmentView = previousFragment.createView(parentActivity);
if (NekomuraConfig.disableVibration.Bool()) {
if (NekoConfig.disableVibration.Bool()) {
VibrateUtil.disableHapticFeedback(fragmentView);
}
} else {

View File

@ -50,9 +50,9 @@ import org.telegram.ui.Components.LayoutHelper;
import java.util.ArrayList;
import tw.nekomimi.nkmr.NekomuraConfig;
import tw.nekomimi.nekogram.NekoConfig;
import tw.nekomimi.nekogram.utils.VibrateUtil;
import tw.nekomimi.nekogram.MessageHelper;
import tw.nekomimi.nekogram.ui.MessageHelper;
public abstract class BaseFragment {
@ -191,7 +191,7 @@ public abstract class BaseFragment {
public void setParentFragment(BaseFragment fragment) {
setParentLayout(fragment.parentLayout);
fragmentView = createView(parentLayout.getContext());
if (NekomuraConfig.disableVibration.Bool()) {
if (NekoConfig.disableVibration.Bool()) {
VibrateUtil.disableHapticFeedback(fragmentView);
}
}

View File

@ -67,10 +67,6 @@ import androidx.core.graphics.ColorUtils;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.annotation.UiThread;
import androidx.core.graphics.ColorUtils;
import com.google.android.exoplayer2.util.Log;
import org.json.JSONArray;
import org.json.JSONObject;
@ -135,11 +131,7 @@ import java.util.Locale;
import java.util.Map;
import java.util.concurrent.CountDownLatch;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.annotation.UiThread;
import androidx.core.graphics.ColorUtils;
import tw.nekomimi.nkmr.NekomuraConfig;
import tw.nekomimi.nekogram.NekoConfig;
public class Theme {
@ -4877,7 +4869,7 @@ public class Theme {
themeInfo.previewOutColor = 0xffd0e6ff;
themeInfo.sortIndex = 1;
themeInfo.firstAccentIsDefault = true;
if (NekomuraConfig.useDefaultTheme.Bool())
if (NekoConfig.useDefaultTheme.Bool())
themeInfo.currentAccentId = DEFALT_THEME_ACCENT_ID;
themeInfo.setAccentColorOptions(
new int[] { 0xFF5890C5, 0xFF239853, 0xFFCE5E82, 0xFF7F63C3, 0xFF2491AD, 0xFF299C2F, 0xFF8854B4, 0xFF328ACF, 0xFF43ACC7, 0xFF52AC44, 0xFFCD5F93, 0xFFD28036, 0xFF8366CC, 0xFFCE4E57, 0xFFD3AE40, 0xFF7B88AB },
@ -4903,7 +4895,7 @@ public class Theme {
themeInfo.previewInColor = Color.parseColor("#c0ffffff");
themeInfo.previewOutColor = Color.parseColor("#3f51b5");
themeInfo.sortIndex = 0;
if (!NekomuraConfig.useDefaultTheme.Bool())
if (!NekoConfig.useDefaultTheme.Bool())
themeInfo.currentAccentId = DEFALT_THEME_ACCENT_ID;
themes.add(themeInfo);
themesDict.put("NekoX", themeInfo);
@ -5581,7 +5573,7 @@ public class Theme {
canStartHolidayAnimation = false;
}
if (dialogs_holidayDrawable == null) {
if (getEventType() == 0 || NekomuraConfig.newYear.Bool()) {
if (getEventType() == 0 || NekoConfig.newYear.Bool()) {
dialogs_holidayDrawable = ApplicationLoader.applicationContext.getResources().getDrawable(R.drawable.newyear);
dialogs_holidayDrawableOffsetX = -AndroidUtilities.dp(3);
dialogs_holidayDrawableOffsetY = -AndroidUtilities.dp(1);

View File

@ -59,7 +59,7 @@ import org.telegram.ui.Components.voip.CellFlickerDrawable;
import java.util.ArrayList;
import kotlin.Unit;
import tw.nekomimi.nekogram.BottomBuilder;
import tw.nekomimi.nekogram.ui.BottomBuilder;
@TargetApi(23)
public class ActionIntroActivity extends BaseFragment implements LocationController.LocationFetchCallback {

View File

@ -41,7 +41,7 @@ import java.util.Collections;
import cn.hutool.core.util.StrUtil;
import kotlin.jvm.functions.Function0;
import tw.nekomimi.nkmr.NekomuraConfig;
import tw.nekomimi.nekogram.NekoConfig;
import tw.nekomimi.nekogram.NekoXConfig;
public class DrawerLayoutAdapter extends RecyclerListView.SelectionAdapter implements NotificationCenter.NotificationCenterDelegate {
@ -273,7 +273,7 @@ public class DrawerLayoutAdapter extends RecyclerListView.SelectionAdapter imple
items.add(new Item(11, LocaleController.getString("SavedMessages", R.string.SavedMessages), savedIcon));
items.add(new Item(8, LocaleController.getString("Settings", R.string.Settings), settingsIcon));
items.add(new Item(10, LocaleController.getString("Calls", R.string.Calls), callsIcon));
if (NekomuraConfig.useProxyItem.Bool() && (!NekomuraConfig.hideProxyByDefault.Bool() || SharedConfig.proxyEnabled)) {
if (NekoConfig.useProxyItem.Bool() && (!NekoConfig.hideProxyByDefault.Bool() || SharedConfig.proxyEnabled)) {
items.add(new CheckItem(13, LocaleController.getString("Proxy", R.string.Proxy), R.drawable.baseline_security_24, () -> SharedConfig.proxyEnabled, () -> {
SharedConfig.setProxyEnable(!SharedConfig.proxyEnabled);
return true;

View File

@ -177,18 +177,13 @@ import java.util.Locale;
import cn.hutool.core.util.StrUtil;
import kotlin.Unit;
import tw.nekomimi.nekogram.BottomBuilder;
import tw.nekomimi.nkmr.NekomuraConfig;
import tw.nekomimi.nekogram.ui.BottomBuilder;
import tw.nekomimi.nekogram.NekoConfig;
import tw.nekomimi.nekogram.parts.ArticleTransKt;
import tw.nekomimi.nekogram.transtale.TranslateDb;
import tw.nekomimi.nekogram.utils.AlertUtil;
import tw.nekomimi.nekogram.utils.ProxyUtil;
import static org.telegram.messenger.MessageObject.POSITION_FLAG_BOTTOM;
import static org.telegram.messenger.MessageObject.POSITION_FLAG_LEFT;
import static org.telegram.messenger.MessageObject.POSITION_FLAG_RIGHT;
import static org.telegram.messenger.MessageObject.POSITION_FLAG_TOP;
public class ArticleViewer implements NotificationCenter.NotificationCenterDelegate {
public Activity parentActivity;
@ -1097,7 +1092,7 @@ public class ArticleViewer implements NotificationCenter.NotificationCenterDeleg
if (checkingForLongPress && windowView != null) {
checkingForLongPress = false;
if (pressedLink != null) {
if (!NekomuraConfig.disableVibration.Bool()) {
if (!NekoConfig.disableVibration.Bool()) {
windowView.performHapticFeedback(HapticFeedbackConstants.LONG_PRESS);
}
showCopyPopup(pressedLink.getUrl());
@ -1112,11 +1107,11 @@ public class ArticleViewer implements NotificationCenter.NotificationCenterDeleg
} else {
textSelectionHelper.trySelect(pressedLinkOwnerView);
}
if (textSelectionHelper.isSelectionMode() && !NekomuraConfig.disableVibration.Bool()) {
if (textSelectionHelper.isSelectionMode() && !NekoConfig.disableVibration.Bool()) {
windowView.performHapticFeedback(HapticFeedbackConstants.LONG_PRESS);
}
} else if (pressedLinkOwnerLayout != null && pressedLinkOwnerView != null) {
if (!NekomuraConfig.disableVibration.Bool()) {
if (!NekoConfig.disableVibration.Bool()) {
windowView.performHapticFeedback(HapticFeedbackConstants.LONG_PRESS);
}
int[] location = new int[2];
@ -10330,9 +10325,9 @@ public class ArticleViewer implements NotificationCenter.NotificationCenterDeleg
String currentUrl = AndroidUtilities.formapMapUrl(false, currentBlock.geo.lat, currentBlock.geo._long, (int) (photoWidth / AndroidUtilities.density), (int) (height / AndroidUtilities.density), true, 15);
WebFile currentWebFile = WebFile.createWithGeoPoint(currentBlock.geo, (int) (photoWidth / AndroidUtilities.density), (int) (height / AndroidUtilities.density), 15, Math.min(2, (int) Math.ceil(AndroidUtilities.density)));
if (NekomuraConfig.mapPreviewProvider.Int() == 0) {
if (NekoConfig.mapPreviewProvider.Int() == 0) {
currentMapProvider = 2;
} else if (NekomuraConfig.mapPreviewProvider.Int() == 1) {
} else if (NekoConfig.mapPreviewProvider.Int() == 1) {
currentMapProvider = 1;
} else {
currentMapProvider = -1;

View File

@ -44,8 +44,8 @@ import org.telegram.ui.Components.MediaActionDrawable;
import org.telegram.ui.Components.RadialProgress2;
import kotlin.Unit;
import tw.nekomimi.nekogram.BottomBuilder;
import tw.nekomimi.nkmr.NekomuraConfig;
import tw.nekomimi.nekogram.ui.BottomBuilder;
import tw.nekomimi.nekogram.NekoConfig;
public class AvatarPreviewer {
@ -436,7 +436,7 @@ public class AvatarPreviewer {
} else {
moveProgress = Math.max(-1, Math.min(0f, (event.getY() - downY) / AndroidUtilities.dp(56)));
if (moveProgress == -1) {
if (!NekomuraConfig.disableVibration.Bool()) {
if (!NekoConfig.disableVibration.Bool()) {
performHapticFeedback(HapticFeedbackConstants.LONG_PRESS);
}
moveAnimator = ValueAnimator.ofFloat(moveProgress, 0);

View File

@ -15,9 +15,7 @@ import android.content.pm.PackageManager;
import android.os.Build;
import android.os.Environment;
import android.os.StatFs;
import android.provider.Settings;
import android.os.SystemClock;
import android.text.TextUtils;
import android.transition.ChangeBounds;
import android.transition.Fade;
import android.transition.TransitionManager;
@ -28,7 +26,6 @@ import android.view.ViewGroup;
import android.widget.FrameLayout;
import android.widget.LinearLayout;
import androidx.annotation.RequiresApi;
import androidx.core.widget.NestedScrollView;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
@ -41,9 +38,6 @@ import org.telegram.SQLite.SQLitePreparedStatement;
import org.telegram.messenger.AccountInstance;
import org.telegram.messenger.AndroidUtilities;
import org.telegram.messenger.ApplicationLoader;
import org.telegram.messenger.ApplicationLoader;
import org.telegram.messenger.BuildConfig;
import org.telegram.messenger.BuildVars;
import org.telegram.messenger.DialogObject;
import org.telegram.messenger.FileLoader;
import org.telegram.messenger.FileLog;
@ -85,7 +79,7 @@ import java.util.ArrayList;
import cn.hutool.core.thread.ThreadUtil;
import kotlin.Unit;
import tw.nekomimi.nekogram.BottomBuilder;
import tw.nekomimi.nekogram.ui.BottomBuilder;
import tw.nekomimi.nekogram.transtale.TranslateDb;
import tw.nekomimi.nekogram.utils.EnvUtil;
import tw.nekomimi.nekogram.utils.FileUtil;

View File

@ -15,7 +15,7 @@ import android.view.MotionEvent;
import android.view.ViewConfiguration;
import android.view.ViewGroup;
import tw.nekomimi.nkmr.NekomuraConfig;
import tw.nekomimi.nekogram.NekoConfig;
public abstract class BaseCell extends ViewGroup {
@ -35,7 +35,7 @@ public abstract class BaseCell extends ViewGroup {
public void run() {
if (checkingForLongPress && getParent() != null && currentPressCount == pressCount) {
checkingForLongPress = false;
if (!NekomuraConfig.disableVibration.Bool()) {
if (!NekoConfig.disableVibration.Bool()) {
performHapticFeedback(HapticFeedbackConstants.LONG_PRESS);
}
if (onLongPress()) {

View File

@ -68,8 +68,6 @@ import android.widget.Toast;
import androidx.core.graphics.ColorUtils;
import com.google.android.exoplayer2.util.Log;
import org.telegram.PhoneFormat.PhoneFormat;
import org.telegram.messenger.AndroidUtilities;
import org.telegram.messenger.ChatObject;
@ -153,7 +151,7 @@ import java.util.Locale;
import java.util.Stack;
import java.util.concurrent.atomic.AtomicReference;
import tw.nekomimi.nkmr.NekomuraConfig;
import tw.nekomimi.nekogram.NekoConfig;
public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate, ImageReceiver.ImageReceiverDelegate, DownloadController.FileDownloadProgressListener, TextSelectionHelper.SelectableView, NotificationCenter.NotificationCenterDelegate {
@ -953,7 +951,7 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
private boolean needHideMessage() {
return currentMessageObject.messageOwner.hide ||
MessagesController.getInstance(currentAccount).blockePeers.indexOfKey(currentMessageObject.getFromChatId()) >= 0 &&
NekomuraConfig.ignoreBlocked.Bool() && !(getParent() != null && getParent().getClass().getName().contains("ChannelAdminLogActivity"));
NekoConfig.ignoreBlocked.Bool() && !(getParent() != null && getParent().getClass().getName().contains("ChannelAdminLogActivity"));
}
public ChatMessageCell(Context context) {
@ -5058,7 +5056,7 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
}
int maxVote = 0;
if (!animatePollAnswer && pollVoteInProgress && vibrateOnPollVote && !NekomuraConfig.disableVibration.Bool()) {
if (!animatePollAnswer && pollVoteInProgress && vibrateOnPollVote && !NekoConfig.disableVibration.Bool()) {
performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING);
}
animatePollAnswerAlpha = animatePollAnswer = attachedToWindow && (pollVoteInProgress || pollUnvoteInProgress);
@ -5489,9 +5487,9 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
currentMapProvider = -1;
}
} else {
if (NekomuraConfig.mapPreviewProvider.Int() == 0) {
if (NekoConfig.mapPreviewProvider.Int() == 0) {
currentMapProvider = 2;
} else if (NekomuraConfig.mapPreviewProvider.Int() == 1) {
} else if (NekoConfig.mapPreviewProvider.Int() == 1) {
currentMapProvider = 1;
} else {
currentMapProvider = -1;
@ -5540,10 +5538,10 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
float maxHeight;
int maxWidth;
if (AndroidUtilities.isTablet()) {
maxHeight = AndroidUtilities.getMinTabletSide() * (0.4f + (NekomuraConfig.stickerSize.Float() - 14.0f) / 40);
maxHeight = AndroidUtilities.getMinTabletSide() * (0.4f + (NekoConfig.stickerSize.Float() - 14.0f) / 40);
maxWidth = (int) maxHeight;
} else {
maxHeight = Math.min(getParentWidth(), AndroidUtilities.displaySize.y) * (0.5f + (NekomuraConfig.stickerSize.Float() - 14.0f) / 30);
maxHeight = Math.min(getParentWidth(), AndroidUtilities.displaySize.y) * (0.5f + (NekoConfig.stickerSize.Float() - 14.0f) / 30);
maxWidth = (int) maxHeight;
}
String filter;
@ -11012,7 +11010,7 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
if ((!autoPlayingMedia || !MediaController.getInstance().isPlayingMessageAndReadyToDraw(currentMessageObject) || isRoundVideo) && !transitionParams.animateBackgroundBoundsInner) {
drawOverlays(canvas);
}
if ((drawTime || !mediaBackground) && !forceNotDrawTime && !transitionParams.animateBackgroundBoundsInner && !(enterTransitionInPorgress && !currentMessageObject.isVoice()) && (!currentMessageObject.isAnyKindOfSticker() || !NekomuraConfig.hideTimeForSticker.Bool())) {
if ((drawTime || !mediaBackground) && !forceNotDrawTime && !transitionParams.animateBackgroundBoundsInner && !(enterTransitionInPorgress && !currentMessageObject.isVoice()) && (!currentMessageObject.isAnyKindOfSticker() || !NekoConfig.hideTimeForSticker.Bool())) {
drawTime(canvas, 1f, false);
}

View File

@ -39,7 +39,6 @@ import org.telegram.messenger.ImageReceiver;
import org.telegram.messenger.LocaleController;
import org.telegram.messenger.MediaController;
import org.telegram.messenger.MessageObject;
import org.telegram.messenger.MessagesController;
import org.telegram.messenger.R;
import org.telegram.messenger.SvgHelper;
import org.telegram.messenger.UserConfig;
@ -59,7 +58,7 @@ import java.io.File;
import java.util.ArrayList;
import java.util.Locale;
import tw.nekomimi.nkmr.NekomuraConfig;
import tw.nekomimi.nekogram.NekoConfig;
public class ContextLinkCell extends FrameLayout implements DownloadController.FileDownloadProgressListener {
@ -267,7 +266,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 (NekomuraConfig.mapPreviewProvider.Int() == 0) {
if (NekoConfig.mapPreviewProvider.Int() == 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

@ -39,8 +39,6 @@ import org.telegram.messenger.ChatObject;
import org.telegram.messenger.ContactsController;
import org.telegram.messenger.DialogObject;
import org.telegram.messenger.ChatThemeController;
import org.telegram.messenger.ContactsController;
import org.telegram.messenger.DialogObject;
import org.telegram.messenger.DownloadController;
import org.telegram.messenger.Emoji;
import org.telegram.messenger.FileLoader;
@ -81,8 +79,8 @@ import java.util.ArrayList;
import java.util.List;
import java.util.Stack;
import tw.nekomimi.nekogram.MessageHelper;
import tw.nekomimi.nkmr.NekomuraConfig;
import tw.nekomimi.nekogram.ui.MessageHelper;
import tw.nekomimi.nekogram.NekoConfig;
public class DialogCell extends BaseCell {
@ -1025,7 +1023,7 @@ public class DialogCell extends BaseCell {
currentMessagePaint = Theme.dialogs_messagePrintingPaint[paintIndex];
} else {
boolean needEmoji = true;
if (NekomuraConfig.mediaPreview.Bool() && TextUtils.isEmpty(restrictionReason) && currentDialogFolderId == 0 && encryptedChat == null && !message.needDrawBluredPreview() && (message.isPhoto() || message.isNewGif() || message.isVideo())) {
if (NekoConfig.mediaPreview.Bool() && TextUtils.isEmpty(restrictionReason) && currentDialogFolderId == 0 && encryptedChat == null && !message.needDrawBluredPreview() && (message.isPhoto() || message.isNewGif() || message.isVideo())) {
String type = message.isWebpage() ? message.messageOwner.media.webpage.type : null;
if (!("app".equals(type) || "profile".equals(type) || "article".equals(type) || type != null && type.startsWith("telegram_"))) {
TLRPC.PhotoSize smallThumb = FileLoader.getClosestPhotoSizeWithSize(message.photoThumbs, 40);
@ -2030,7 +2028,7 @@ public class DialogCell extends BaseCell {
if (mask == 0) {
clearingDialog = MessagesController.getInstance(currentAccount).isClearingDialog(dialog.id);
message = MessagesController.getInstance(currentAccount).dialogMessage.get(dialog.id);
if (message != null && NekomuraConfig.ignoreBlocked.Bool() && MessagesController.getInstance(currentAccount).blockePeers.indexOfKey(message.getSenderId()) >= 0) {
if (message != null && NekoConfig.ignoreBlocked.Bool() && MessagesController.getInstance(currentAccount).blockePeers.indexOfKey(message.getSenderId()) >= 0) {
if (MessagesController.getInstance(currentAccount).dialogMessageFromUnblocked.get(dialog.id) != null)
message = MessagesController.getInstance(currentAccount).dialogMessageFromUnblocked.get(dialog.id);
else {
@ -2316,7 +2314,7 @@ public class DialogCell extends BaseCell {
if (isSliding && !swipeCanceled) {
boolean prevValue = drawRevealBackground;
drawRevealBackground = Math.abs(translationX) >= getMeasuredWidth() * 0.45f;
if (prevValue != drawRevealBackground && archiveHidden == SharedConfig.archiveHidden && !NekomuraConfig.disableVibration.Bool()) {
if (prevValue != drawRevealBackground && archiveHidden == SharedConfig.archiveHidden && !NekoConfig.disableVibration.Bool()) {
try {
performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING);
} catch (Exception ignore) {

View File

@ -59,8 +59,7 @@ import org.telegram.ui.Components.RLottieDrawable;
import org.telegram.ui.Components.RLottieImageView;
import org.telegram.ui.Components.SnowflakesEffect;
import tw.nekomimi.nkmr.NekomuraConfig;
import tw.nekomimi.nkmr.NekomuraConfig;
import tw.nekomimi.nekogram.NekoConfig;
public class DrawerProfileCell extends FrameLayout {
@ -96,7 +95,7 @@ public class DrawerProfileCell extends FrameLayout {
imageReceiver.setCrossfadeWithOldImage(true);
imageReceiver.setForceCrossfade(true);
imageReceiver.setDelegate((imageReceiver, set, thumb, memCache) -> {
if (NekomuraConfig.avatarBackgroundDarken.Bool() || NekomuraConfig.avatarBackgroundBlur.Bool()) {
if (NekoConfig.avatarBackgroundDarken.Bool() || NekoConfig.avatarBackgroundBlur.Bool()) {
if (thumb || allowInvalidate) {
return;
}
@ -107,19 +106,19 @@ public class DrawerProfileCell extends FrameLayout {
imageReceiver.setCrossfadeWithOldImage(false);
imageReceiver.setImageBitmap(new BitmapDrawable(null, lastBitmap), false);
}
int width = NekomuraConfig.avatarBackgroundBlur.Bool() ? 150 : bmp.bitmap.getWidth();
int height = NekomuraConfig.avatarBackgroundBlur.Bool() ? 150 : bmp.bitmap.getHeight();
int width = NekoConfig.avatarBackgroundBlur.Bool() ? 150 : bmp.bitmap.getWidth();
int height = NekoConfig.avatarBackgroundBlur.Bool() ? 150 : bmp.bitmap.getHeight();
Bitmap bitmap = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888);
Canvas canvas = new Canvas(bitmap);
canvas.drawBitmap(bmp.bitmap, null, new Rect(0, 0, width, height), new Paint(Paint.FILTER_BITMAP_FLAG));
if (NekomuraConfig.avatarBackgroundBlur.Bool()) {
if (NekoConfig.avatarBackgroundBlur.Bool()) {
try {
Utilities.stackBlurBitmap(bitmap, 3);
} catch (Exception e) {
FileLog.e(e);
}
}
if (NekomuraConfig.avatarBackgroundDarken.Bool()) {
if (NekoConfig.avatarBackgroundDarken.Bool()) {
final Palette palette = Palette.from(bmp.bitmap).generate();
Paint paint = new Paint();
paint.setColor((palette.getDarkMutedColor(0xFF547499) & 0x00FFFFFF) | 0x44000000);
@ -252,10 +251,10 @@ public class DrawerProfileCell extends FrameLayout {
});
addView(darkThemeView, LayoutHelper.createFrame(48, 48, Gravity.RIGHT | Gravity.BOTTOM, 0, 10, 6, 90));
if (Theme.getEventType() == 0 || NekomuraConfig.actionBarDecoration.Int() == 1) {
if (Theme.getEventType() == 0 || NekoConfig.actionBarDecoration.Int() == 1) {
snowflakesEffect = new SnowflakesEffect(0);
snowflakesEffect.setColorKey(Theme.key_chats_menuName);
} else if (NekomuraConfig.actionBarDecoration.Int() == 2) {
} else if (NekoConfig.actionBarDecoration.Int() == 2) {
fireworksEffect = new FireworksEffect();
}
}
@ -276,9 +275,9 @@ public class DrawerProfileCell extends FrameLayout {
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
int heightBase = NekomuraConfig.largeAvatarInDrawer.Int() == 2 ? MeasureSpec.getSize(widthMeasureSpec) : AndroidUtilities.dp(148);
int heightBase = NekoConfig.largeAvatarInDrawer.Int() == 2 ? MeasureSpec.getSize(widthMeasureSpec) : AndroidUtilities.dp(148);
if (Build.VERSION.SDK_INT >= 21) {
heightBase -= NekomuraConfig.largeAvatarInDrawer.Int() == 2 ? AndroidUtilities.statusBarHeight : 0;
heightBase -= NekoConfig.largeAvatarInDrawer.Int() == 2 ? AndroidUtilities.statusBarHeight : 0;
super.onMeasure(MeasureSpec.makeMeasureSpec(MeasureSpec.getSize(widthMeasureSpec), MeasureSpec.EXACTLY), MeasureSpec.makeMeasureSpec(heightBase + AndroidUtilities.statusBarHeight, MeasureSpec.EXACTLY));
} else {
try {
@ -291,7 +290,7 @@ public class DrawerProfileCell extends FrameLayout {
}
private boolean useAdb() {
return NekomuraConfig.largeAvatarInDrawer.Int() > 0 && ImageLocation.isUserHasPhoto(user);
return NekoConfig.largeAvatarInDrawer.Int() > 0 && ImageLocation.isUserHasPhoto(user);
}
@Override
@ -398,7 +397,7 @@ public class DrawerProfileCell extends FrameLayout {
accountsShown = accounts;
setArrowState(false);
nameTextView.setText(UserObject.getUserName(user));
if (!NekomuraConfig.hidePhone.Bool()) {
if (!NekoConfig.hidePhone.Bool()) {
phoneTextView.setText(PhoneFormat.getInstance().format("+" + user.phone));
} else if (!TextUtils.isEmpty(user.username)) {
phoneTextView.setText("@" + user.username);
@ -408,21 +407,21 @@ public class DrawerProfileCell extends FrameLayout {
AvatarDrawable avatarDrawable = new AvatarDrawable(user);
avatarDrawable.setColor(Theme.getColor(Theme.key_avatar_backgroundInProfileBlue));
avatarImageView.setForUserOrChat(user, avatarDrawable);
if (NekomuraConfig.largeAvatarInDrawer.Int() > 0) {
if (NekoConfig.largeAvatarInDrawer.Int() > 0) {
ImageLocation imageLocation = ImageLocation.getForUser(user, ImageLocation.TYPE_BIG);
allowInvalidate = !useAdb() || !(NekomuraConfig.avatarBackgroundDarken.Bool() || NekomuraConfig.avatarBackgroundBlur.Bool());
allowInvalidate = !useAdb() || !(NekoConfig.avatarBackgroundDarken.Bool() || NekoConfig.avatarBackgroundBlur.Bool());
imageReceiver.setImage(imageLocation, "512_512", null, null, new ColorDrawable(0x00000000), 0, null, user, 1);
avatarImageView.setVisibility(INVISIBLE);
} else {
avatarImageView.setVisibility(VISIBLE);
}
if (NekomuraConfig.largeAvatarInDrawer.Int() == 2) {
if (NekoConfig.largeAvatarInDrawer.Int() == 2) {
// add shadow
nameTextView.setShadowLayer(6.0f, 2.0f, 2.0f, Color.BLACK);
phoneTextView.getTextView().setShadowLayer(6.0f, 2.0f, 2.0f, Color.BLACK);
// correct the position of night button
LayoutParams lp = NekomuraConfig.largeAvatarInDrawer.Int() == 2 ?
LayoutParams lp = NekoConfig.largeAvatarInDrawer.Int() == 2 ?
LayoutHelper.createFrame(48, 48, Gravity.RIGHT | Gravity.TOP, 0, AndroidUtilities.statusBarHeight / getResources().getDisplayMetrics().density, 6, 0) :
LayoutHelper.createFrame(48, 48, Gravity.RIGHT | Gravity.BOTTOM, 0, 10, 6, 90);
darkThemeView.setLayoutParams(lp);

View File

@ -23,7 +23,7 @@ import org.telegram.messenger.R;
import org.telegram.ui.ActionBar.Theme;
import org.telegram.ui.Components.LayoutHelper;
import tw.nekomimi.nekogram.NekoConfig;
import tw.nekomimi.nekogram.NekoXConfig;
public class PhotoAttachPermissionCell extends FrameLayout {
@ -72,7 +72,7 @@ public class PhotoAttachPermissionCell extends FrameLayout {
imageView.setImageResource(R.drawable.permissions_gallery1);
imageView2.setImageResource(R.drawable.permissions_gallery2);
textView.setText(LocaleController.getString("GalleryPermissionText", R.string.GalleryPermissionText));
if (NekoConfig.forceSystemPicker) {
if (NekoXConfig.forceSystemPicker) {
imageView.setImageResource(R.drawable.baseline_open_in_browser_24);
imageView2.setVisibility(GONE);
textView.setText(LocaleController.getString("OpenInExternalApp", R.string.OpenInExternalApp));

View File

@ -56,7 +56,7 @@ import java.util.Locale;
import java.util.Stack;
import java.util.concurrent.atomic.AtomicReference;
import tw.nekomimi.nkmr.NekomuraConfig;
import tw.nekomimi.nekogram.NekoConfig;
public class SharedLinkCell extends FrameLayout {
private final static int SPOILER_TYPE_LINK = 0,
@ -90,7 +90,7 @@ public class SharedLinkCell extends FrameLayout {
public void run() {
if (checkingForLongPress && getParent() != null && currentPressCount == pressCount) {
checkingForLongPress = false;
if (!NekomuraConfig.disableVibration.Bool()) {
if (!NekoConfig.disableVibration.Bool()) {
performHapticFeedback(HapticFeedbackConstants.LONG_PRESS);
}
if (pressedLink >= 0) {

View File

@ -43,9 +43,8 @@ import org.telegram.ui.Components.RadialProgressView;
import java.util.ArrayList;
import tw.nekomimi.nkmr.NekomuraConfig;
import tw.nekomimi.nekogram.NekoXConfig;
import tw.nekomimi.nekogram.PinnedStickerHelper;
import tw.nekomimi.nekogram.NekoConfig;
import tw.nekomimi.nekogram.ui.PinnedStickerHelper;
public class StickerSetCell extends FrameLayout {
@ -192,7 +191,7 @@ public class StickerSetCell extends FrameLayout {
}
// NekoX: Pinned Sticker Mark
if (NekomuraConfig.enableStickerPin.Bool() && PinnedStickerHelper.getInstance(UserConfig.selectedAccount).isPinned(set.set.id)) {
if (NekoConfig.enableStickerPin.Bool() && PinnedStickerHelper.getInstance(UserConfig.selectedAccount).isPinned(set.set.id)) {
pinnedImageView.setVisibility(VISIBLE);
} else {
pinnedImageView.setVisibility(INVISIBLE);
@ -237,7 +236,7 @@ public class StickerSetCell extends FrameLayout {
// NekoX: Pinned Sticker Mark -> Change Visibility
public void setPinnedMarkVisibility(boolean visible) {
if (!NekomuraConfig.enableStickerPin.Bool()) {
if (!NekoConfig.enableStickerPin.Bool()) {
pinnedImageView.setVisibility(INVISIBLE);
return;
}

View File

@ -53,7 +53,7 @@ import org.telegram.ui.Components.RecyclerListView;
import java.util.ArrayList;
import tw.nekomimi.nkmr.NekomuraConfig;
import tw.nekomimi.nekogram.NekoConfig;
import tw.nekomimi.nekogram.transtale.TranslateDb;
import tw.nekomimi.nekogram.transtale.Translator;
import tw.nekomimi.nekogram.utils.AlertUtil;
@ -236,7 +236,7 @@ public abstract class TextSelectionHelper<Cell extends TextSelectionHelper.Selec
textY = maybeTextY;
selectedView = newView;
if (!NekomuraConfig.disableVibration.Bool()) {
if (!NekoConfig.disableVibration.Bool()) {
textSelectionOverlay.performHapticFeedback(HapticFeedbackConstants.LONG_PRESS);
}
showActions();
@ -821,7 +821,7 @@ public abstract class TextSelectionHelper<Cell extends TextSelectionHelper.Selec
if (viewChanged || layoutOld != layoutNew || newSelectionLine != layoutNew.getLineForOffset(selectionStart) && newSelectionLine == nextWhitespaceLine) {
jumpToLine(newSelection, nextWhitespace, viewChanged, layoutBlock.yOffset, oldYoffset, oldSelectedView);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O_MR1 && !NekomuraConfig.disableVibration.Bool()) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O_MR1 && !NekoConfig.disableVibration.Bool()) {
textSelectionOverlay.performHapticFeedback(HapticFeedbackConstants.TEXT_HANDLE_MOVE);
}
TextSelectionHelper.this.invalidate();
@ -833,7 +833,7 @@ public abstract class TextSelectionHelper<Cell extends TextSelectionHelper.Selec
selectionStart = k;
movingHandleStart = false;
}
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O_MR1 && !NekomuraConfig.disableVibration.Bool()) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O_MR1 && !NekoConfig.disableVibration.Bool()) {
textSelectionOverlay.performHapticFeedback(HapticFeedbackConstants.TEXT_HANDLE_MOVE);
}
TextSelectionHelper.this.invalidate();
@ -884,7 +884,7 @@ public abstract class TextSelectionHelper<Cell extends TextSelectionHelper.Selec
selectionStart = k;
movingHandleStart = false;
}
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O_MR1 && !NekomuraConfig.disableVibration.Bool()) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O_MR1 && !NekoConfig.disableVibration.Bool()) {
textSelectionOverlay.performHapticFeedback(HapticFeedbackConstants.TEXT_HANDLE_MOVE);
}
TextSelectionHelper.this.invalidate();
@ -922,7 +922,7 @@ public abstract class TextSelectionHelper<Cell extends TextSelectionHelper.Selec
if (viewChanged || layoutOld != layoutNew || newSelectionLine != layoutNew.getLineForOffset(selectionEnd) && newSelectionLine == nextWhitespaceLine) {
jumpToLine(newSelection, nextWhitespace, viewChanged, layoutBlock.yOffset, oldYoffset, oldSelectedView);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O_MR1 && !NekomuraConfig.disableVibration.Bool()) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O_MR1 && !NekoConfig.disableVibration.Bool()) {
textSelectionOverlay.performHapticFeedback(HapticFeedbackConstants.TEXT_HANDLE_MOVE);
}
TextSelectionHelper.this.invalidate();
@ -934,7 +934,7 @@ public abstract class TextSelectionHelper<Cell extends TextSelectionHelper.Selec
selectionStart = k;
movingHandleStart = true;
}
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O_MR1 && !NekomuraConfig.disableVibration.Bool()) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O_MR1 && !NekoConfig.disableVibration.Bool()) {
textSelectionOverlay.performHapticFeedback(HapticFeedbackConstants.TEXT_HANDLE_MOVE);
}
TextSelectionHelper.this.invalidate();
@ -966,7 +966,7 @@ public abstract class TextSelectionHelper<Cell extends TextSelectionHelper.Selec
selectionStart = k;
movingHandleStart = true;
}
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O_MR1 && !NekomuraConfig.disableVibration.Bool()) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O_MR1 && !NekoConfig.disableVibration.Bool()) {
textSelectionOverlay.performHapticFeedback(HapticFeedbackConstants.TEXT_HANDLE_MOVE);
}
TextSelectionHelper.this.invalidate();

View File

@ -6,7 +6,6 @@ import android.app.Activity;
import android.content.Context;
import android.content.SharedPreferences;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.BitmapShader;
import android.graphics.Canvas;
import android.graphics.Color;
@ -41,7 +40,6 @@ import org.telegram.messenger.LocaleController;
import org.telegram.messenger.NotificationCenter;
import org.telegram.messenger.R;
import org.telegram.messenger.SharedConfig;
import org.telegram.messenger.UserConfig;
import org.telegram.messenger.Utilities;
import org.telegram.tgnet.ConnectionsManager;
import org.telegram.tgnet.TLRPC;
@ -64,7 +62,7 @@ import androidx.annotation.Keep;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import tw.nekomimi.nkmr.NekomuraConfig;
import tw.nekomimi.nekogram.NekoConfig;
public class ThemesHorizontalListCell extends RecyclerListView implements NotificationCenter.NotificationCenterDelegate {
@ -198,7 +196,7 @@ public class ThemesHorizontalListCell extends RecyclerListView implements Notifi
if (action == MotionEvent.ACTION_DOWN) {
pressed = true;
} else {
if (!NekomuraConfig.disableVibration.Bool()) {
if (!NekoConfig.disableVibration.Bool()) {
performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP);
}
showOptionsForTheme(themeInfo);

View File

@ -119,8 +119,8 @@ import java.util.ArrayList;
import java.util.HashMap;
import kotlin.Unit;
import tw.nekomimi.nekogram.BottomBuilder;
import tw.nekomimi.nkmr.NekomuraConfig;
import tw.nekomimi.nekogram.ui.BottomBuilder;
import tw.nekomimi.nekogram.NekoConfig;
import tw.nekomimi.nekogram.utils.AlertUtil;
import tw.nekomimi.nekogram.utils.ProxyUtil;
@ -1965,7 +1965,7 @@ public class ChannelAdminLogActivity extends BaseFragment implements Notificatio
}
public void showOpenUrlAlert(final String url, boolean ask) {
if (Browser.isInternalUrl(url, null) || !ask || NekomuraConfig.skipOpenLinkConfirm.Bool()) {
if (Browser.isInternalUrl(url, null) || !ask || NekoConfig.skipOpenLinkConfirm.Bool()) {
Browser.openUrl(getParentActivity(), url, true);
} else {
AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity());

View File

@ -72,7 +72,7 @@ import org.telegram.ui.Components.SizeNotifierFrameLayout;
import java.util.ArrayList;
import kotlin.Unit;
import tw.nekomimi.nekogram.BottomBuilder;
import tw.nekomimi.nekogram.ui.BottomBuilder;
import tw.nekomimi.nekogram.utils.VibrateUtil;
public class ChannelCreateActivity extends BaseFragment implements NotificationCenter.NotificationCenterDelegate, ImageUpdater.ImageUpdaterDelegate {

View File

@ -40,7 +40,7 @@ import org.telegram.ui.Components.CubicBezierInterpolator;
import java.util.ArrayList;
import java.util.Arrays;
import tw.nekomimi.nkmr.NekomuraConfig;
import tw.nekomimi.nekogram.NekoConfig;
public abstract class BaseChartView<T extends ChartData, L extends LineViewData> extends View implements ChartPickerDelegate.Listener {
@ -1488,7 +1488,7 @@ public abstract class BaseChartView<T extends ChartData, L extends LineViewData>
legendSignatureView.setVisibility(VISIBLE);
selectionA = 1f;
moveLegend(chartFullWidth * (pickerDelegate.pickerStart) - HORIZONTAL_PADDING);
if (!NekomuraConfig.disableVibration.Bool()) {
if (!NekoConfig.disableVibration.Bool()) {
performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING);
}
}

View File

@ -20,7 +20,7 @@ import org.telegram.ui.Charts.view_data.LineViewData;
import org.telegram.ui.Charts.view_data.PieLegendView;
import org.telegram.ui.Charts.view_data.TransitionParams;
import tw.nekomimi.nkmr.NekomuraConfig;
import tw.nekomimi.nekogram.NekoConfig;
public class PieChartView extends StackLinearChartView<PieChartViewData> {
@ -387,7 +387,7 @@ public class PieChartView extends StackLinearChartView<PieChartViewData> {
pieLegendView.setTranslationX(xl);
pieLegendView.setTranslationY(yl);
if (!NekomuraConfig.disableVibration.Bool()) {
if (!NekoConfig.disableVibration.Bool()) {
boolean v = false;
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O_MR1) {
v = performHapticFeedback(HapticFeedbackConstants.TEXT_HANDLE_MOVE, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING);

View File

@ -65,7 +65,6 @@ import android.text.TextUtils;
import android.text.style.CharacterStyle;
import android.text.style.ForegroundColorSpan;
import android.text.style.URLSpan;
import android.util.Log;
import android.util.Property;
import android.util.SparseArray;
import android.util.SparseIntArray;
@ -284,10 +283,10 @@ import java.util.regex.Pattern;
import cn.hutool.core.util.StrUtil;
import kotlin.Unit;
import tw.nekomimi.nekogram.BottomBuilder;
import tw.nekomimi.nekogram.MessageDetailsActivity;
import tw.nekomimi.nekogram.ui.BottomBuilder;
import tw.nekomimi.nekogram.ui.MessageDetailsActivity;
import tw.nekomimi.nekogram.utils.EnvUtil;
import tw.nekomimi.nkmr.NekomuraConfig;
import tw.nekomimi.nekogram.NekoConfig;
import tw.nekomimi.nekogram.NekoXConfig;
import tw.nekomimi.nekogram.parts.MessageTransKt;
import tw.nekomimi.nekogram.parts.PollTransUpdatesKt;
@ -296,7 +295,7 @@ import tw.nekomimi.nekogram.transtale.Translator;
import tw.nekomimi.nekogram.utils.AlertUtil;
import tw.nekomimi.nekogram.utils.PGPUtil;
import tw.nekomimi.nekogram.utils.ProxyUtil;
import tw.nekomimi.nkmr.NekomuraUtil;
import tw.nekomimi.nekogram.utils.TelegramUtil;
@SuppressWarnings("unchecked")
public class ChatActivity extends BaseFragment implements NotificationCenter.NotificationCenterDelegate, DialogsActivity.DialogsActivityDelegate, LocationActivity.LocationActivityDelegate, ChatAttachAlertDocumentLayout.DocumentSelectActivityDelegate {
@ -2957,15 +2956,15 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
}
actionModeOtherItem.addSubItem(nkbtn_translate, R.drawable.ic_translate, LocaleController.getString("Translate", R.string.Translate));
if (NekomuraConfig.showShareMessages.Bool())
if (NekoConfig.showShareMessages.Bool())
actionModeOtherItem.addSubItem(nkbtn_sharemessage, R.drawable.baseline_share_24, LocaleController.getString("ShareMessages", R.string.ShareMessages));
actionModeOtherItem.addSubItem(nkbtn_unpin, R.drawable.deproko_baseline_pin_undo_24, LocaleController.getString("UnpinMessage", R.string.UnpinMessage));
if (!noforward)
actionModeOtherItem.addSubItem(nkbtn_savemessage, R.drawable.baseline_bookmark_24, LocaleController.getString("AddToSavedMessages", R.string.AddToSavedMessages));
if (NekomuraConfig.showRepeat.Bool() && !noforward)
if (NekoConfig.showRepeat.Bool() && !noforward)
actionModeOtherItem.addSubItem(nkbtn_repeat, R.drawable.msg_repeat, LocaleController.getString("Repeat", R.string.Repeat));
if (NekomuraConfig.showMessageHide.Bool()) {
if (NekoConfig.showMessageHide.Bool()) {
actionModeOtherItem.addSubItem(nkbtn_hide, R.drawable.baseline_remove_circle_24, LocaleController.getString("Hide", R.string.Hide));
}
@ -4315,7 +4314,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
} else if (startedTrackingSlidingView) {
if (Math.abs(dx) >= AndroidUtilities.dp(50)) {
if (!wasTrackingVibrate) {
if (!NekomuraConfig.disableVibration.Bool()) {
if (!NekoConfig.disableVibration.Bool()) {
try {
performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING);
} catch (Exception ignore) {
@ -4357,7 +4356,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
if (e.getAction() == MotionEvent.ACTION_DOWN) {
scrollByTouch = true;
}
if (!NekomuraConfig.disableSwipeToNext.Bool() && pullingDownOffset != 0 && (e.getAction() == MotionEvent.ACTION_UP || e.getAction() == MotionEvent.ACTION_CANCEL)) {
if (!NekoConfig.disableSwipeToNext.Bool() && pullingDownOffset != 0 && (e.getAction() == MotionEvent.ACTION_UP || e.getAction() == MotionEvent.ACTION_CANCEL)) {
float progress = Math.min(1f, pullingDownOffset / AndroidUtilities.dp(110));
if (e.getAction() == MotionEvent.ACTION_UP && progress == 1 && pullingDownDrawable != null && !pullingDownDrawable.emptyStub) {
if (pullingDownDrawable.animationIsRunning()) {
@ -4496,7 +4495,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
drawReplyButton(c);
}
if (!NekomuraConfig.disableSwipeToNext.Bool() && pullingDownOffset != 0) {
if (!NekoConfig.disableSwipeToNext.Bool() && pullingDownOffset != 0) {
c.save();
float transitionOffset = 0;
if (pullingDownAnimateProgress != 0) {
@ -4529,7 +4528,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
drawLaterRoundProgressCell = null;
canvas.save();
if (!NekomuraConfig.disableSwipeToNext.Bool() && fromPullingDownTransition && !toPullingDownTransition) {
if (!NekoConfig.disableSwipeToNext.Bool() && fromPullingDownTransition && !toPullingDownTransition) {
canvas.clipRect(0, chatListViewPaddingTop - chatListViewPaddingVisibleOffset - AndroidUtilities.dp(4), getMeasuredWidth(), getMeasuredHeight());
}
@ -5495,7 +5494,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
@Override
public int scrollVerticallyBy(int dy, RecyclerView.Recycler recycler, RecyclerView.State state) {
if (!NekomuraConfig.disableSwipeToNext.Bool() && dy < 0 && pullingDownOffset != 0) {
if (!NekoConfig.disableSwipeToNext.Bool() && dy < 0 && pullingDownOffset != 0) {
pullingDownOffset += dy;
if (pullingDownOffset < 0) {
dy = (int) pullingDownOffset;
@ -5528,7 +5527,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
if (!foundTopView) {
scrolled = super.scrollVerticallyBy(dy, recycler, state);
}
if (!NekomuraConfig.disableSwipeToNext.Bool() && dy > 0 && scrolled == 0 && ChatObject.isChannel(currentChat) && !currentChat.megagroup && chatListView.getScrollState() == RecyclerView.SCROLL_STATE_DRAGGING && !chatListView.isFastScrollAnimationRunning() && !chatListView.isMultiselect()) {
if (!NekoConfig.disableSwipeToNext.Bool() && dy > 0 && scrolled == 0 && ChatObject.isChannel(currentChat) && !currentChat.megagroup && chatListView.getScrollState() == RecyclerView.SCROLL_STATE_DRAGGING && !chatListView.isFastScrollAnimationRunning() && !chatListView.isMultiselect()) {
if (pullingDownOffset == 0 && pullingDownDrawable != null) {
pullingDownDrawable.updateDialog();
}
@ -5647,7 +5646,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
wasManualScroll = true;
scrollingChatListView = true;
} else if (newState == RecyclerView.SCROLL_STATE_DRAGGING) {
if (NekomuraConfig.hideKeyboardOnChatScroll.Bool()) {
if (NekoConfig.hideKeyboardOnChatScroll.Bool()) {
AndroidUtilities.hideKeyboard(getParentActivity().getCurrentFocus());
}
pollHintCell = null;
@ -6333,8 +6332,8 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
textSelectionHelper.cancelTextSelectionRunnable();
if (createUnreadMessageAfterId != 0) {
scrollToMessageId(createUnreadMessageAfterId, 0, false, returnToLoadIndex, true, 0);
} else if (returnToMessageId > 0 || (NekomuraConfig.rememberAllBackMessages.Bool() && !returnToMessageIdsStack.empty())) {
if (NekomuraConfig.rememberAllBackMessages.Bool() && !returnToMessageIdsStack.empty())
} else if (returnToMessageId > 0 || (NekoConfig.rememberAllBackMessages.Bool() && !returnToMessageIdsStack.empty())) {
if (NekoConfig.rememberAllBackMessages.Bool() && !returnToMessageIdsStack.empty())
returnToMessageId = returnToMessageIdsStack.pop();
scrollToMessageId(returnToMessageId, 0, true, returnToLoadIndex, true, 0);
} else {
@ -6345,7 +6344,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
}
}
});
if (NekomuraConfig.rememberAllBackMessages.Bool()) {
if (NekoConfig.rememberAllBackMessages.Bool()) {
pagedownButton.setOnLongClickListener(view -> {
returnToMessageId = 0;
returnToMessageIdsStack.clear();
@ -10131,7 +10130,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
if (getParentActivity() == null || fragmentView == null || hide && voiceHintTextView == null || chatMode != 0 || chatActivityEnterView == null || chatActivityEnterView.getAudioVideoButtonContainer() == null || chatActivityEnterView.getAudioVideoButtonContainer().getVisibility() != View.VISIBLE) {
return;
}
if (NekomuraConfig.useChatAttachMediaMenu.Bool()) return;
if (NekoConfig.useChatAttachMediaMenu.Bool()) return;
if (voiceHintTextView == null) {
SizeNotifierFrameLayout frameLayout = (SizeNotifierFrameLayout) fragmentView;
int index = frameLayout.indexOfChild(chatActivityEnterView);
@ -11023,7 +11022,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
return dialog != chatAttachAlert && super.dismissDialogOnPause(dialog);
}
private boolean disableLinkPreview = NekomuraConfig.disableLinkPreviewByDefault.Bool();
private boolean disableLinkPreview = NekoConfig.disableLinkPreviewByDefault.Bool();
private void searchLinks(final CharSequence charSequence, final boolean force) {
if (currentEncryptedChat != null && getMessagesController().secretWebpagePreview == 0 || editingMessageObject != null && !editingMessageObject.isWebpage()) {
@ -11254,7 +11253,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
}
public void beforeMessageSend(boolean notify, int scheduleDate, boolean beforeSend) {
if (beforeSend != NekomuraConfig.sendCommentAfterForward.Bool()) return;
if (beforeSend != NekoConfig.sendCommentAfterForward.Bool()) return;
if (forwardingMessages != null) {
ArrayList<MessageObject> messagesToForward = new ArrayList<>();
forwardingMessages.getSelectedMessages(messagesToForward);
@ -12670,7 +12669,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
}
}
returnToMessageId = fromMessageId;
if (NekomuraConfig.rememberAllBackMessages.Bool() && fromMessageId > 0)
if (NekoConfig.rememberAllBackMessages.Bool() && fromMessageId > 0)
returnToMessageIdsStack.push(returnToMessageId);
returnToLoadIndex = loadIndex;
needSelectFromMessageId = select;
@ -16064,12 +16063,12 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
if (voters.chosen) {
if (voters.correct) {
fireworksOverlay.start();
if (!NekomuraConfig.disableVibration.Bool()) {
if (!NekoConfig.disableVibration.Bool()) {
pollView.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING);
}
} else {
((ChatMessageCell) pollView).shakeView();
if (!NekomuraConfig.disableVibration.Bool()) {
if (!NekoConfig.disableVibration.Bool()) {
pollView.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING);
}
showPollSolution(cell.getMessageObject(), results);
@ -19740,7 +19739,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
}
if (shareKeyItem != null) {
if ((currentChat != null && ChatObject.canSendMessages(currentChat) || user != null && !user.self) && StrUtil.isNotBlank(NekomuraConfig.openPGPApp.String())) {
if ((currentChat != null && ChatObject.canSendMessages(currentChat) || user != null && !user.self) && StrUtil.isNotBlank(NekoConfig.openPGPApp.String())) {
shareKeyItem.setVisibility(View.VISIBLE);
} else {
shareKeyItem.setVisibility(View.GONE);
@ -20820,7 +20819,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
// options.add(29);
// icons.add(R.drawable.msg_translate);
// }
if (NekomuraConfig.showReport.Bool() && selectedObject.contentType == 0 && !selectedObject.isMediaEmptyWebpage() && selectedObject.getId() > 0 && !selectedObject.isOut() && (currentChat != null || currentUser != null && currentUser.bot)) {
if (NekoConfig.showReport.Bool() && selectedObject.contentType == 0 && !selectedObject.isMediaEmptyWebpage() && selectedObject.getId() > 0 && !selectedObject.isOut() && (currentChat != null || currentUser != null && currentUser.bot)) {
items.add(LocaleController.getString("ReportChat", R.string.ReportChat));
options.add(OPTION_REPORT_CHAT);
icons.add(R.drawable.baseline_report_24);
@ -21101,7 +21100,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
}
}
if (chatMode != MODE_SCHEDULED) {
if (!UserObject.isUserSelf(currentUser) && NekomuraConfig.showAddToSavedMessages.Bool()) {
if (!UserObject.isUserSelf(currentUser) && NekoConfig.showAddToSavedMessages.Bool()) {
if (!noforward) {
items.add(LocaleController.getString("AddToSavedMessages", R.string.AddToSavedMessages));
options.add(nkbtn_savemessage);
@ -21110,7 +21109,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
}
boolean allowRepeat = currentUser != null
|| (currentChat != null && ChatObject.canSendMessages(currentChat));
if (allowRepeat && NekomuraConfig.showRepeat.Bool() && !noforward) {
if (allowRepeat && NekoConfig.showRepeat.Bool() && !noforward) {
items.add(LocaleController.getString("Repeat", R.string.Repeat));
options.add(nkbtn_repeat);
icons.add(R.drawable.msg_repeat);
@ -21120,13 +21119,13 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
boolean allowViewHistory = currentUser == null
&& (currentChat != null && !currentChat.broadcast && message.isFromUser());
if (NekomuraConfig.showDeleteDownloadedFile.Bool() && NekomuraUtil.messageObjectIsFile(type, selectedObject)) {
if (NekoConfig.showDeleteDownloadedFile.Bool() && TelegramUtil.messageObjectIsFile(type, selectedObject)) {
items.add(LocaleController.getString("DeleteDownloadedFile", R.string.DeleteDownloadedFile));
options.add(nkbtn_deldlcache);
icons.add(R.drawable.baseline_delete_sweep_24);
}
if (allowViewHistory && NekomuraConfig.showViewHistory.Bool()) {
if (allowViewHistory && NekoConfig.showViewHistory.Bool()) {
items.add(LocaleController.getString("ViewUserHistory", R.string.ViewHistory));
options.add(nkbtn_view_history);
icons.add(R.drawable.baseline_schedule_24);
@ -21140,7 +21139,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
}
}
}
if (NekomuraConfig.showTranslate.Bool()) {
if (NekoConfig.showTranslate.Bool()) {
if (messageObject != null || docsWithMessages) {
boolean td;
if (messageObject != null) {
@ -21153,14 +21152,14 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
icons.add(R.drawable.ic_translate);
}
}
if (NekomuraConfig.showShareMessages.Bool()) {
if (NekoConfig.showShareMessages.Bool()) {
if (messageObject != null || docsWithMessages) {
items.add(LocaleController.getString("ShareMessages", R.string.ShareMessages));
options.add(nkbtn_sharemessage);
icons.add(R.drawable.baseline_share_24);
}
}
if (messageObject != null && StrUtil.isNotBlank(messageObject.messageOwner.message) && StrUtil.isNotBlank(NekomuraConfig.openPGPApp.String())) {
if (messageObject != null && StrUtil.isNotBlank(messageObject.messageOwner.message) && StrUtil.isNotBlank(NekoConfig.openPGPApp.String())) {
if (PgpHelper.PGP_CLEARTEXT_SIGNATURE.matcher(selectedObject.messageOwner.message).matches()) {
items.add(LocaleController.getString("PGPVerify", R.string.PGPVerify));
options.add(nkbtn_PGPVerify);
@ -21180,12 +21179,12 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
}
}
}
if (NekomuraConfig.showMessageDetails.Bool()) {
if (NekoConfig.showMessageDetails.Bool()) {
items.add(LocaleController.getString("MessageDetails", R.string.MessageDetails));
options.add(nkbtn_detail);
icons.add(R.drawable.menu_info);
}
if (NekomuraConfig.showMessageHide.Bool()) {
if (NekoConfig.showMessageHide.Bool()) {
items.add(LocaleController.getString("Hide", R.string.Hide));
options.add(nkbtn_hide);
icons.add(R.drawable.baseline_remove_circle_24);
@ -21234,7 +21233,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
options.add(23);
icons.add(R.drawable.baseline_report_24);
} else if (NekomuraConfig.showReport.Bool()) {
} else if (NekoConfig.showReport.Bool()) {
items.add(LocaleController.getString("ReportChat", R.string.ReportChat));
options.add(23);
@ -21344,7 +21343,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
}
}
}
if (NekomuraConfig.showTranslate.Bool()) {
if (NekoConfig.showTranslate.Bool()) {
if (messageObject != null || docsWithMessages) {
boolean td;
if (messageObject != null) {
@ -21357,7 +21356,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
icons.add(R.drawable.ic_translate);
}
}
if (messageObject != null && StrUtil.isNotBlank(messageObject.messageOwner.message) && StrUtil.isNotBlank(NekomuraConfig.openPGPApp.String())) {
if (messageObject != null && StrUtil.isNotBlank(messageObject.messageOwner.message) && StrUtil.isNotBlank(NekoConfig.openPGPApp.String())) {
//TODO wtf
if (PgpHelper.PGP_CLEARTEXT_SIGNATURE.matcher(selectedObject.messageOwner.message).matches()) {
items.add(LocaleController.getString("PGPVerify", R.string.PGPVerify));
@ -21377,7 +21376,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
icons.add(R.drawable.baseline_vpn_key_24);
}
}
if (NekomuraConfig.showMessageHide.Bool()) {
if (NekoConfig.showMessageHide.Bool()) {
items.add(LocaleController.getString("Hide", R.string.Hide));
options.add(204);
icons.add(R.drawable.baseline_remove_circle_24);
@ -21414,13 +21413,13 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
editingAdmin = participant instanceof TLRPC.TL_chatParticipantAdmin;
}
if (canEditAdmin && NekomuraConfig.showAdminActions.Bool()) {
if (canEditAdmin && NekoConfig.showAdminActions.Bool()) {
items.add(editingAdmin ? LocaleController.getString("EditAdminRights", R.string.EditAdminRights) : LocaleController.getString("SetAsAdmin", R.string.SetAsAdmin));
icons.add(R.drawable.baseline_stars_24);
options.add(nkbtn_editAdmin);
selectedParticipant = participant;
}
if (canRestrict && NekomuraConfig.showChangePermissions.Bool()) {
if (canRestrict && NekoConfig.showChangePermissions.Bool()) {
items.add(LocaleController.getString("ChangePermissions", R.string.ChangePermissions));
icons.add(R.drawable.baseline_block_24);
options.add(nkbtn_editPermission);
@ -23200,11 +23199,11 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
hideFieldPanel(false);
for (int a = 0; a < dids.size(); a++) {
long did = dids.get(a);
if (message != null && !NekomuraConfig.sendCommentAfterForward.Bool()) {
if (message != null && !NekoConfig.sendCommentAfterForward.Bool()) {
getSendMessagesHelper().sendMessage(message.toString(), did, null, null, null, true, null, null, null, true, 0, null);
}
forwardMessages(fmessages, noForwardQuote, true, 0, did);
if (message != null && NekomuraConfig.sendCommentAfterForward.Bool()) {
if (message != null && NekoConfig.sendCommentAfterForward.Bool()) {
getSendMessagesHelper().sendMessage(message.toString(), did, null, null, null, true, null, null, null, true, 0, null);
}
}
@ -24122,7 +24121,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
Browser.openUrl(getParentActivity(), url, inlineReturn == 0, false);
} else if (type == 2) {
// NekoX: Fix skipOpenLinkConfirm broken in 7.6.0, since processExternalUrl is imported in 7.6.0
if (NekomuraConfig.skipOpenLinkConfirm.Bool())
if (NekoConfig.skipOpenLinkConfirm.Bool())
Browser.openUrl(getParentActivity(), url, inlineReturn == 0);
else
AlertsCreator.showOpenUrlAlert(ChatActivity.this, url, true, true, true);
@ -25483,7 +25482,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
return;
}
fireworksOverlay.start();
if (!NekomuraConfig.disableVibration.Bool()) {
if (!NekoConfig.disableVibration.Bool()) {
fireworksOverlay.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING);
}
}
@ -25617,7 +25616,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
MessageObject message = messages.get(position - messagesStartRow);
View view = holder.itemView;
boolean fromUserBlocked = getMessagesController().blockePeers.indexOfKey(message.getFromChatId()) >= 0 && NekomuraConfig.ignoreBlocked.Bool();
boolean fromUserBlocked = getMessagesController().blockePeers.indexOfKey(message.getFromChatId()) >= 0 && NekoConfig.ignoreBlocked.Bool();
if (view instanceof ChatMessageCell) {
final ChatMessageCell messageCell = (ChatMessageCell) view;
@ -28192,7 +28191,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
Integer end = ids.get(ids.size() - 1);
for (int i = 0; i < messages.size(); i++) {
int msgId = messages.get(i).getId();
if (NekomuraConfig.ignoreBlocked.Bool() && getMessagesController().blockePeers.indexOfKey(messages.get(i).getSenderId()) >= 0)
if (NekoConfig.ignoreBlocked.Bool() && getMessagesController().blockePeers.indexOfKey(messages.get(i).getSenderId()) >= 0)
continue;
if (msgId > begin && msgId < end && selectedMessagesIds[0].indexOfKey(msgId) < 0) {
MessageObject message = messages.get(i);
@ -28328,7 +28327,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
}
case nkbtn_deldlcache: {
final MessageObject so = selectedObject;
final boolean isDownloading = NekomuraUtil.messageObjectIsDownloading(getMessageType(so));
final boolean isDownloading = TelegramUtil.messageObjectIsDownloading(getMessageType(so));
AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity());
builder.setTitle(LocaleController.getString("DeleteDownloadedFile"));
@ -28368,7 +28367,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
if (isDownloading) {
// Download unfinished catalog is not the same
String cacheFilePath = AndroidUtilities.getCacheDir().getAbsolutePath();
cacheFilePath += "/" + NekomuraUtil.getFileNameNoEx(file.getName());
cacheFilePath += "/" + TelegramUtil.getFileNameWithoutEx(file.getName());
List<String> suffix = Arrays.asList(".pt", ".temp");
for (int ii = 0; ii < suffix.size(); ii++) {
file = new File(cacheFilePath + suffix.get(ii));
@ -28500,7 +28499,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
Intent open = new Intent(Intent.ACTION_SEND);
open.setType("application/pgp-message");
open.putExtra(Intent.EXTRA_TEXT, messageObject.messageOwner.message);
open.setClassName(NekomuraConfig.openPGPApp.String(), NekomuraConfig.openPGPApp.String() + ".ui.DecryptActivity");
open.setClassName(NekoConfig.openPGPApp.String(), NekoConfig.openPGPApp.String() + ".ui.DecryptActivity");
try {
@ -28530,8 +28529,8 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
case nkbtn_PGPImportPrivate:
case nkbtn_PGPImport: {
Intent open = new Intent(NekomuraConfig.openPGPApp.String() + ".action.IMPORT_KEY");
open.putExtra(NekomuraConfig.openPGPApp.String() + ".EXTRA_KEY_BYTES", StrUtil.utf8Bytes(selectedObject.messageOwner.message));
Intent open = new Intent(NekoConfig.openPGPApp.String() + ".action.IMPORT_KEY");
open.putExtra(NekoConfig.openPGPApp.String() + ".EXTRA_KEY_BYTES", StrUtil.utf8Bytes(selectedObject.messageOwner.message));
try {
@ -28586,7 +28585,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
if (selectedMessagesIds[0].get(selectedMessagesIds[0].keyAt(k)) != null)
messages.add(selectedMessagesIds[0].get(selectedMessagesIds[0].keyAt(k)));
}
if (!NekomuraConfig.repeatConfirm.Bool()) {
if (!NekoConfig.repeatConfirm.Bool()) {
doRepeatMessage(isLongClick, messages);
return;
}

View File

@ -118,8 +118,8 @@ import java.util.Locale;
import java.util.concurrent.CountDownLatch;
import kotlin.Unit;
import tw.nekomimi.nekogram.BottomBuilder;
import tw.nekomimi.nkmr.NekomuraConfig;
import tw.nekomimi.nekogram.ui.BottomBuilder;
import tw.nekomimi.nekogram.NekoConfig;
import tw.nekomimi.nekogram.utils.AlertUtil;
import tw.nekomimi.nekogram.utils.VibrateUtil;
@ -992,7 +992,7 @@ public class AlertsCreator {
return;
}
long inlineReturn = (fragment instanceof ChatActivity) ? ((ChatActivity) fragment).getInlineReturn() : 0;
if (Browser.isInternalUrl(url, null) || !ask || NekomuraConfig.skipOpenLinkConfirm.Bool()) {
if (Browser.isInternalUrl(url, null) || !ask || NekoConfig.skipOpenLinkConfirm.Bool()) {
Browser.openUrl(fragment.getParentActivity(), url, inlineReturn == 0, tryTelegraph);
} else {
String urlFinal;
@ -2418,7 +2418,7 @@ public class AlertsCreator {
});
final NumberPicker.OnValueChangeListener onValueChangeListener = (picker, oldVal, newVal) -> {
try {
if (!NekomuraConfig.disableVibration.Bool()) {
if (!NekoConfig.disableVibration.Bool()) {
container.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING);
}
} catch (Exception ignore) {
@ -2606,7 +2606,7 @@ public class AlertsCreator {
});
final NumberPicker.OnValueChangeListener onValueChangeListener = (picker, oldVal, newVal) -> {
try {
if (!NekomuraConfig.disableVibration.Bool()) {
if (!NekoConfig.disableVibration.Bool()) {
container.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING);
}
} catch (Exception ignore) {
@ -2810,7 +2810,7 @@ public class AlertsCreator {
dayPicker.setFormatter(value -> "" + value);
final NumberPicker.OnValueChangeListener onValueChangeListener = (picker, oldVal, newVal) -> {
try {
if (!NekomuraConfig.disableVibration.Bool()) {
if (!NekoConfig.disableVibration.Bool()) {
container.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING);
}
} catch (Exception ignore) {

View File

@ -162,8 +162,8 @@ import cn.hutool.core.util.ReUtil;
import cn.hutool.core.util.StrUtil;
import kotlin.Unit;
import kotlin.text.StringsKt;
import tw.nekomimi.nekogram.BottomBuilder;
import tw.nekomimi.nkmr.NekomuraConfig;
import tw.nekomimi.nekogram.ui.BottomBuilder;
import tw.nekomimi.nekogram.NekoConfig;
import tw.nekomimi.nekogram.cc.CCConverter;
import tw.nekomimi.nekogram.cc.CCTarget;
import tw.nekomimi.nekogram.transtale.TranslateDb;
@ -172,7 +172,7 @@ import tw.nekomimi.nekogram.transtale.TranslatorKt;
import tw.nekomimi.nekogram.utils.AlertUtil;
import tw.nekomimi.nekogram.utils.PGPUtil;
import tw.nekomimi.nekogram.utils.UIUtil;
import tw.nekomimi.nkmr.NekomuraConfig;
import java.util.concurrent.atomic.AtomicReference;
public class ChatActivityEnterView extends FrameLayout implements NotificationCenter.NotificationCenterDelegate, SizeNotifierFrameLayout.SizeNotifierFrameLayoutDelegate, StickersAlert.StickersAlertDelegate {
@ -517,7 +517,7 @@ public class ChatActivityEnterView extends FrameLayout implements NotificationCe
private MessageObject replyingMessageObject;
private MessageObject botMessageObject;
private TLRPC.WebPage messageWebPage;
private boolean messageWebPageSearch = !NekomuraConfig.disableLinkPreviewByDefault.Bool();
private boolean messageWebPageSearch = !NekoConfig.disableLinkPreviewByDefault.Bool();
private ChatActivityEnterViewDelegate delegate;
private TrendingStickersAlert trendingStickersAlert;
@ -3198,7 +3198,7 @@ public class ChatActivityEnterView extends FrameLayout implements NotificationCe
audioVideoButtonContainer = new FrameLayout(context);
audioVideoButtonContainer.setSoundEffectsEnabled(false);
sendButtonContainer.addView(audioVideoButtonContainer, LayoutHelper.createFrame(48, 48));
if (NekomuraConfig.useChatAttachMediaMenu.Bool()) {
if (NekoConfig.useChatAttachMediaMenu.Bool()) {
audioVideoButtonContainer.setOnClickListener(v -> {
if (recordCircle.isSendButtonVisible()) {
if (!hasRecordVideo || calledRecordRunnable) {
@ -3301,7 +3301,7 @@ public class ChatActivityEnterView extends FrameLayout implements NotificationCe
AndroidUtilities.cancelRunOnUIThread(recordAudioVideoRunnable);
delegate.onSwitchRecordMode(videoSendButton.getTag() == null);
setRecordVideoButtonVisible(videoSendButton.getTag() == null, true);
if (!NekomuraConfig.disableVibration.Bool()) {
if (!NekoConfig.disableVibration.Bool()) {
performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP);
}
sendAccessibilityEvent(AccessibilityEvent.TYPE_VIEW_CLICKED);
@ -3309,21 +3309,21 @@ public class ChatActivityEnterView extends FrameLayout implements NotificationCe
startedDraggingX = -1;
if (hasRecordVideo && videoSendButton.getTag() != null) {
CameraController.getInstance().cancelOnInitRunnable(onFinishInitCameraRunnable);
delegate.needStartRecordVideo(NekomuraConfig.confirmAVMessage.Bool() ? 3 : 1, true, 0);
delegate.needStartRecordVideo(NekoConfig.confirmAVMessage.Bool() ? 3 : 1, true, 0);
} else {
if (!NekomuraConfig.confirmAVMessage.Bool()) {
if (!NekoConfig.confirmAVMessage.Bool()) {
if (recordingAudioVideo && isInScheduleMode()) {
AlertsCreator.createScheduleDatePickerDialog(parentActivity, parentFragment.getDialogId(), (notify, scheduleDate) -> MediaController.getInstance().stopRecording(1, notify, scheduleDate), () -> MediaController.getInstance().stopRecording(0, false, 0), resourcesProvider);
}
}
delegate.needStartRecordAudio(0);
if (!NekomuraConfig.confirmAVMessage.Bool()) {
if (!NekoConfig.confirmAVMessage.Bool()) {
MediaController.getInstance().stopRecording(isInScheduleMode() ? 3 : 1, true, 0);
} else {
MediaController.getInstance().stopRecording(2, true, 0);
}
}
if (!NekomuraConfig.confirmAVMessage.Bool()) {
if (!NekoConfig.confirmAVMessage.Bool()) {
recordingAudioVideo = false;
messageTransitionIsRunning = false;
AndroidUtilities.runOnUIThread(moveToSendStateRunnable = () -> {
@ -3388,13 +3388,13 @@ public class ChatActivityEnterView extends FrameLayout implements NotificationCe
audioSendButton = new ImageView(context);
audioSendButton.setScaleType(ImageView.ScaleType.CENTER_INSIDE);
audioSendButton.setColorFilter(new PorterDuffColorFilter(getThemedColor(Theme.key_chat_messagePanelIcons), PorterDuff.Mode.SRC_IN));
audioSendButton.setImageResource(!NekomuraConfig.useChatAttachMediaMenu.Bool() ? R.drawable.baseline_mic_24 : R.drawable.ic_ab_other);
audioSendButton.setImageResource(!NekoConfig.useChatAttachMediaMenu.Bool() ? R.drawable.baseline_mic_24 : R.drawable.ic_ab_other);
audioSendButton.setPadding(0, 0, AndroidUtilities.dp(4), 0);
audioSendButton.setContentDescription(!NekomuraConfig.useChatAttachMediaMenu.Bool() ?
audioSendButton.setContentDescription(!NekoConfig.useChatAttachMediaMenu.Bool() ?
LocaleController.getString("AccDescrVoiceMessage", R.string.AccDescrVoiceMessage) :
LocaleController.getString("AccDescrChatAttachEnterMenu", R.string.AccDescrChatAttachEnterMenu));
if (Build.VERSION.SDK_INT >= 21 && NekomuraConfig.useChatAttachMediaMenu.Bool()) {
if (Build.VERSION.SDK_INT >= 21 && NekoConfig.useChatAttachMediaMenu.Bool()) {
audioSendButton.setBackgroundDrawable(Theme.createSelectorDrawable(Theme.getColor(Theme.key_listSelector)));
}
@ -3691,7 +3691,7 @@ public class ChatActivityEnterView extends FrameLayout implements NotificationCe
private void startLockTransition(boolean animate) {
AnimatorSet animatorSet = new AnimatorSet();
if (!NekomuraConfig.disableVibration.Bool() && animate) {
if (!NekoConfig.disableVibration.Bool() && animate) {
performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING);
}
@ -3820,7 +3820,7 @@ public class ChatActivityEnterView extends FrameLayout implements NotificationCe
recordAudioVideoRunnable.run();
delegate.onSwitchRecordMode(videoSendButton.getTag() == null);
setRecordVideoButtonVisible(videoSendButton.getTag() == null, true);
if (!NekomuraConfig.disableVibration.Bool()) {
if (!NekoConfig.disableVibration.Bool()) {
performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP);
}
recordCircle.sendButtonVisible = true;
@ -3852,7 +3852,7 @@ public class ChatActivityEnterView extends FrameLayout implements NotificationCe
recordAudioVideoRunnable.run();
delegate.onSwitchRecordMode(videoSendButton.getTag() == null);
setRecordVideoButtonVisible(videoSendButton.getTag() == null, true);
if (!NekomuraConfig.disableVibration.Bool()) {
if (!NekoConfig.disableVibration.Bool()) {
performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP);
}
recordCircle.sendButtonVisible = true;
@ -3867,7 +3867,7 @@ public class ChatActivityEnterView extends FrameLayout implements NotificationCe
} else {
if (StrUtil.isNotBlank(NekomuraConfig.openPGPApp.String())) {
if (StrUtil.isNotBlank(NekoConfig.openPGPApp.String())) {
cell.setTextAndIcon(LocaleController.getString("Sign", R.string.Sign), R.drawable.baseline_vpn_key_24);
cell.setOnClickListener(v -> {
@ -3907,7 +3907,7 @@ public class ChatActivityEnterView extends FrameLayout implements NotificationCe
if (menuPopupWindow != null && menuPopupWindow.isShowing()) {
menuPopupWindow.dismiss();
}
translateComment(TranslateDb.getChatLanguage(chatId, TranslatorKt.getCode2Locale(NekomuraConfig.translateInputLang.String())));
translateComment(TranslateDb.getChatLanguage(chatId, TranslatorKt.getCode2Locale(NekoConfig.translateInputLang.String())));
});
ActionBarMenuSubItem finalCell = cell;
cell.setOnLongClickListener(v -> {
@ -3928,7 +3928,7 @@ public class ChatActivityEnterView extends FrameLayout implements NotificationCe
cell.setTextAndIcon(LocaleController.getString("Translate", R.string.OpenCC), R.drawable.ic_translate);
ActionBarMenuSubItem finalCell1 = cell;
cell.setOnClickListener(v -> {
String ccTarget = TranslateDb.getChatCCTarget(chatId, NekomuraConfig.ccInputLang.String());
String ccTarget = TranslateDb.getChatCCTarget(chatId, NekoConfig.ccInputLang.String());
if (ccTarget == null || StringsKt.isBlank(ccTarget)) {
Translator.showCCTargetSelect(finalCell1, (target) -> {
if (menuPopupWindow != null && menuPopupWindow.isShowing()) {
@ -4153,7 +4153,7 @@ public class ChatActivityEnterView extends FrameLayout implements NotificationCe
sendPopupWindow.showAtLocation(view, Gravity.LEFT | Gravity.TOP, location[0] + view.getMeasuredWidth() - sendPopupLayout.getMeasuredWidth() + AndroidUtilities.dp(8), y);
sendPopupWindow.dimBehind();
sendButton.invalidate();
if (!NekomuraConfig.disableVibration.Bool()) {
if (!NekoConfig.disableVibration.Bool()) {
view.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING);
}
@ -4164,8 +4164,8 @@ public class ChatActivityEnterView extends FrameLayout implements NotificationCe
Intent intent = new Intent();
if (NekomuraConfig.openPGPKeyId.Long() != 0L && save)
intent.putExtra(OpenPgpApi.EXTRA_SIGN_KEY_ID, NekomuraConfig.openPGPKeyId.Long());
if (NekoConfig.openPGPKeyId.Long() != 0L && save)
intent.putExtra(OpenPgpApi.EXTRA_SIGN_KEY_ID, NekoConfig.openPGPKeyId.Long());
signComment(intent, save);
@ -4181,7 +4181,7 @@ public class ChatActivityEnterView extends FrameLayout implements NotificationCe
long keyId = result.getLongExtra(OpenPgpApi.EXTRA_SIGN_KEY_ID, 0L);
if (save) NekomuraConfig.openPGPKeyId.setConfigLong(keyId);
if (save) NekoConfig.openPGPKeyId.setConfigLong(keyId);
signComment(result, save);
@ -4223,7 +4223,7 @@ public class ChatActivityEnterView extends FrameLayout implements NotificationCe
OpenPgpError error = result.getParcelableExtra(OpenPgpApi.RESULT_ERROR);
if (error == null) return;
if (error.getMessage() != null && error.getMessage().contains("not found") && save) {
NekomuraConfig.openPGPKeyId.setConfigLong(0L);
NekoConfig.openPGPKeyId.setConfigLong(0L);
signComment(new Intent(), true);
} else {
AlertUtil.showToast(error.toString());
@ -4381,7 +4381,7 @@ public class ChatActivityEnterView extends FrameLayout implements NotificationCe
if (videoSendButton == null) {
return;
}
if (NekomuraConfig.useChatAttachMediaMenu.Bool()) visible = animated = false;
if (NekoConfig.useChatAttachMediaMenu.Bool()) visible = animated = false;
videoSendButton.setTag(visible ? 1 : null);
@ -5200,7 +5200,7 @@ public class ChatActivityEnterView extends FrameLayout implements NotificationCe
videoToSendMessageObject = null;
videoTimelineView.destroy();
if (videoSendButton != null && isInVideoMode() && !NekomuraConfig.useChatAttachMediaMenu.Bool()) {
if (videoSendButton != null && isInVideoMode() && !NekoConfig.useChatAttachMediaMenu.Bool()) {
videoSendButton.setVisibility(View.VISIBLE);
} else if (audioSendButton != null) {
audioSendButton.setVisibility(View.VISIBLE);
@ -5288,7 +5288,7 @@ public class ChatActivityEnterView extends FrameLayout implements NotificationCe
AnimatorSet attachIconAnimator = null;
AnimatorSet botIconAnimator = null;
if (attachButton != null && NekomuraConfig.useChatAttachMediaMenu.Bool()) {
if (attachButton != null && NekoConfig.useChatAttachMediaMenu.Bool()) {
checkAttachButton(false, 150);
if (!attachButton.isShown()) {
attachButton.setAlpha(0f);
@ -5631,7 +5631,7 @@ public class ChatActivityEnterView extends FrameLayout implements NotificationCe
}
if (attachLayout != null) {
if (!NekomuraConfig.useChatAttachMediaMenu.Bool()) {
if (!NekoConfig.useChatAttachMediaMenu.Bool()) {
runningAnimation2 = new AnimatorSet();
ArrayList<Animator> animators = new ArrayList<>();
animators.add(ObjectAnimator.ofFloat(attachLayout, View.ALPHA, 0.0f));
@ -5686,7 +5686,7 @@ public class ChatActivityEnterView extends FrameLayout implements NotificationCe
runningAnimation = new AnimatorSet();
ArrayList<Animator> animators = new ArrayList<>();
if (NekomuraConfig.useChatAttachMediaMenu.Bool() && botButton.getVisibility() == VISIBLE) {
if (NekoConfig.useChatAttachMediaMenu.Bool() && botButton.getVisibility() == VISIBLE) {
animators.add(ObjectAnimator.ofFloat(botButton, View.SCALE_X, 0.1f));
animators.add(ObjectAnimator.ofFloat(botButton, View.SCALE_Y, 0.1f));
animators.add(ObjectAnimator.ofFloat(botButton, View.ALPHA, 0.0f));
@ -5766,7 +5766,7 @@ public class ChatActivityEnterView extends FrameLayout implements NotificationCe
expandStickersButton.setVisibility(GONE);
}
if (attachLayout != null) {
if (!NekomuraConfig.useChatAttachMediaMenu.Bool()) {
if (!NekoConfig.useChatAttachMediaMenu.Bool()) {
attachLayout.setVisibility(GONE);
if (delegate != null && getVisibility() == VISIBLE) {
delegate.onAttachButtonHidden();
@ -5818,7 +5818,7 @@ public class ChatActivityEnterView extends FrameLayout implements NotificationCe
if (attachLayout != null) {
if (!NekomuraConfig.useChatAttachMediaMenu.Bool()) {
if (!NekoConfig.useChatAttachMediaMenu.Bool()) {
runningAnimation2 = new AnimatorSet();
ArrayList<Animator> animators = new ArrayList<>();
animators.add(ObjectAnimator.ofFloat(attachLayout, View.ALPHA, 0.0f));
@ -5872,7 +5872,7 @@ public class ChatActivityEnterView extends FrameLayout implements NotificationCe
runningAnimation = new AnimatorSet();
ArrayList<Animator> animators = new ArrayList<>();
if (NekomuraConfig.useChatAttachMediaMenu.Bool() && botButton.getVisibility() == VISIBLE) {
if (NekoConfig.useChatAttachMediaMenu.Bool() && botButton.getVisibility() == VISIBLE) {
animators.add(ObjectAnimator.ofFloat(botButton, View.SCALE_X, 0.1f));
animators.add(ObjectAnimator.ofFloat(botButton, View.SCALE_Y, 0.1f));
animators.add(ObjectAnimator.ofFloat(botButton, View.ALPHA, 0.0f));
@ -5921,7 +5921,7 @@ public class ChatActivityEnterView extends FrameLayout implements NotificationCe
@Override
public void onAnimationEnd(Animator animation) {
if (animation.equals(runningAnimation)) {
if (NekomuraConfig.useChatAttachMediaMenu.Bool() && botButton != null) {
if (NekoConfig.useChatAttachMediaMenu.Bool() && botButton != null) {
botButton.setVisibility(View.GONE);
updateFieldRight(1);
}
@ -5985,7 +5985,7 @@ public class ChatActivityEnterView extends FrameLayout implements NotificationCe
expandStickersButton.setVisibility(GONE);
}
if (attachLayout != null) {
if (!NekomuraConfig.useChatAttachMediaMenu.Bool()) {
if (!NekoConfig.useChatAttachMediaMenu.Bool()) {
attachLayout.setVisibility(GONE);
if (delegate != null && getVisibility() == VISIBLE) {
delegate.onAttachButtonHidden();
@ -6205,7 +6205,7 @@ public class ChatActivityEnterView extends FrameLayout implements NotificationCe
scheduledButton.setTranslationX(0);
}
}
if (NekomuraConfig.useChatAttachMediaMenu.Bool() && checkBotButton()) {
if (NekoConfig.useChatAttachMediaMenu.Bool() && checkBotButton()) {
animators.add(ObjectAnimator.ofFloat(botButton, View.SCALE_X, 1f));
animators.add(ObjectAnimator.ofFloat(botButton, View.SCALE_Y, 1f));
animators.add(ObjectAnimator.ofFloat(botButton, View.ALPHA, 1f));
@ -6218,7 +6218,7 @@ public class ChatActivityEnterView extends FrameLayout implements NotificationCe
if (animation.equals(runningAnimation2)) {
runningAnimation2 = null;
}
if (NekomuraConfig.useChatAttachMediaMenu.Bool() && checkBotButton()) {
if (NekoConfig.useChatAttachMediaMenu.Bool() && checkBotButton()) {
updateBotButton(true);
updateFieldRight(1);
}
@ -6399,7 +6399,7 @@ public class ChatActivityEnterView extends FrameLayout implements NotificationCe
}
recordCircle.voiceEnterTransitionInProgress = false;
boolean isVid = isInVideoMode() && !NekomuraConfig.useChatAttachMediaMenu.Bool();
boolean isVid = isInVideoMode() && !NekoConfig.useChatAttachMediaMenu.Bool();
if (recordingAudioVideo) {
if (recordInterfaceState == 1) {
@ -6844,7 +6844,7 @@ public class ChatActivityEnterView extends FrameLayout implements NotificationCe
audioVideoButtonContainer.setScaleY(0);
if (attachButton != null) {
if (NekomuraConfig.useChatAttachMediaMenu.Bool()) {
if (NekoConfig.useChatAttachMediaMenu.Bool()) {
checkAttachButton(false, 150);
} else if (attachButton.getVisibility() == View.VISIBLE) {
attachButton.setScaleX(0);
@ -7609,7 +7609,7 @@ public class ChatActivityEnterView extends FrameLayout implements NotificationCe
if (parentFragment == null) {
return;
}
if (NekomuraConfig.hideSendAsChannel.Bool())
if (NekoConfig.hideSendAsChannel.Bool())
return;
TLRPC.ChatFull full = parentFragment.getMessagesController().getChatFull(-dialog_id);
TLRPC.Peer defPeer = full != null ? full.default_send_as : null;

View File

@ -28,14 +28,12 @@ import android.graphics.Rect;
import android.graphics.RectF;
import android.graphics.drawable.Drawable;
import android.os.Build;
import android.os.Bundle;
import android.os.Vibrator;
import android.text.Editable;
import android.text.TextPaint;
import android.text.TextUtils;
import android.text.TextWatcher;
import android.text.style.ImageSpan;
import android.text.util.Linkify;
import android.util.Property;
import android.util.TypedValue;
import android.view.Gravity;
@ -46,7 +44,6 @@ import android.view.View;
import android.view.ViewGroup;
import android.view.ViewOutlineProvider;
import android.view.WindowManager;
import android.view.accessibility.AccessibilityEvent;
import android.view.accessibility.AccessibilityNodeInfo;
import android.view.animation.DecelerateInterpolator;
import android.view.animation.OvershootInterpolator;
@ -100,7 +97,7 @@ import java.util.Locale;
import java.util.concurrent.atomic.AtomicBoolean;
import kotlin.Unit;
import tw.nekomimi.nkmr.NekomuraConfig;
import tw.nekomimi.nekogram.NekoConfig;
import tw.nekomimi.nekogram.transtale.TranslateDb;
import tw.nekomimi.nekogram.transtale.Translator;
import tw.nekomimi.nekogram.transtale.TranslatorKt;
@ -1668,7 +1665,7 @@ public class ChatAttachAlert extends BottomSheet implements NotificationCenter.N
sendPopupWindow.dismiss();
}
if (num == 0) {
translateComment(parentFragment.getParentActivity(), TranslateDb.getChatLanguage(chatId, TranslatorKt.getCode2Locale(NekomuraConfig.translateInputLang.String())));
translateComment(parentFragment.getParentActivity(), TranslateDb.getChatLanguage(chatId, TranslatorKt.getCode2Locale(NekoConfig.translateInputLang.String())));
} else if (num == 1) {
AlertsCreator.createScheduleDatePickerDialog(getContext(), chatActivity.getDialogId(), (notify, scheduleDate) -> {
if (currentAttachLayout == photoLayout) {
@ -1721,7 +1718,7 @@ public class ChatAttachAlert extends BottomSheet implements NotificationCenter.N
view.getLocationInWindow(location);
sendPopupWindow.showAtLocation(view, Gravity.LEFT | Gravity.TOP, location[0] + view.getMeasuredWidth() - sendPopupLayout.getMeasuredWidth() + AndroidUtilities.dp(8), location[1] - sendPopupLayout.getMeasuredHeight() - AndroidUtilities.dp(2));
sendPopupWindow.dimBehind();
if (!NekomuraConfig.disableVibration.Bool()) {
if (!NekoConfig.disableVibration.Bool()) {
view.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING);
}

View File

@ -104,7 +104,7 @@ import java.util.HashMap;
import java.util.List;
import kotlin.Unit;
import tw.nekomimi.nekogram.BottomBuilder;
import tw.nekomimi.nekogram.ui.BottomBuilder;
public class ChatAttachAlertLocationLayout extends ChatAttachAlert.AttachAlertLayout implements NotificationCenter.NotificationCenterDelegate {

View File

@ -94,16 +94,10 @@ import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import androidx.annotation.Keep;
import androidx.core.graphics.ColorUtils;
import androidx.exifinterface.media.ExifInterface;
import androidx.recyclerview.widget.GridLayoutManager;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.LinearSmoothScroller;
import androidx.recyclerview.widget.RecyclerView;
import tw.nekomimi.nekogram.NekoXConfig;
import tw.nekomimi.nekogram.NekoConfig;
import tw.nekomimi.nkmr.NekomuraConfig;
public class ChatAttachAlertPhotoLayout extends ChatAttachAlert.AttachAlertLayout implements NotificationCenter.NotificationCenterDelegate {
@ -621,7 +615,7 @@ public class ChatAttachAlertPhotoLayout extends ChatAttachAlert.AttachAlertLayou
return;
} else if (noGalleryPermissions && position != 0) {
try {
if (NekoConfig.forceSystemPicker) {
if (NekoXConfig.forceSystemPicker) {
menu.onItemClick(open_in); // Use system photo picker
} else {
parentAlert.baseFragment.getParentActivity().requestPermissions(new String[]{Manifest.permission.READ_EXTERNAL_STORAGE}, 4);
@ -664,7 +658,7 @@ public class ChatAttachAlertPhotoLayout extends ChatAttachAlert.AttachAlertLayou
PhotoViewer.getInstance().setCaption(parentAlert.getCommentTextView().getText());
} else {
if (SharedConfig.inappCamera) {
if (NekomuraConfig.disableInstantCamera.Bool()) {
if (NekoConfig.disableInstantCamera.Bool()) {
showCamera();
}
openCamera(true);
@ -1625,7 +1619,7 @@ public class ChatAttachAlertPhotoLayout extends ChatAttachAlert.AttachAlertLayou
deviceHasGoodCamera = CameraController.getInstance().isCameraInitied();
}
}
if (deviceHasGoodCamera && NekomuraConfig.disableInstantCamera.Bool()) {
if (deviceHasGoodCamera && NekoConfig.disableInstantCamera.Bool()) {
// Clear cached bitmap
File file = new File(ApplicationLoader.getFilesDirFixed(), "cthumb.jpg");
if (file.exists()) file.delete();
@ -1633,7 +1627,7 @@ public class ChatAttachAlertPhotoLayout extends ChatAttachAlert.AttachAlertLayou
if ((old != deviceHasGoodCamera || old2 != noCameraPermissions) && adapter != null) {
adapter.notifyDataSetChanged();
}
if (parentAlert.isShowing() && deviceHasGoodCamera && parentAlert.baseFragment != null && parentAlert.getBackDrawable().getAlpha() != 0 && !cameraOpened && !NekomuraConfig.disableInstantCamera.Bool()) {
if (parentAlert.isShowing() && deviceHasGoodCamera && parentAlert.baseFragment != null && parentAlert.getBackDrawable().getAlpha() != 0 && !cameraOpened && !NekoConfig.disableInstantCamera.Bool()) {
showCamera();
}
}
@ -1922,7 +1916,7 @@ public class ChatAttachAlertPhotoLayout extends ChatAttachAlert.AttachAlertLayou
}
private void saveLastCameraBitmap() {
if (!canSaveCameraPreview || NekomuraConfig.disableInstantCamera.Bool()) {
if (!canSaveCameraPreview || NekoConfig.disableInstantCamera.Bool()) {
return;
}
try {

View File

@ -14,7 +14,6 @@ import org.telegram.messenger.ImageLocation;
import org.telegram.messenger.LocaleController;
import org.telegram.messenger.MediaDataController;
import org.telegram.messenger.MessageObject;
import org.telegram.messenger.NotificationCenter;
import org.telegram.messenger.R;
import org.telegram.messenger.SvgHelper;
import org.telegram.tgnet.TLRPC;
@ -22,7 +21,7 @@ import org.telegram.ui.ActionBar.Theme;
import java.util.Locale;
import tw.nekomimi.nkmr.NekomuraConfig;
import tw.nekomimi.nekogram.NekoConfig;
public class ChatGreetingsView extends LinearLayout {
@ -87,7 +86,7 @@ public class ChatGreetingsView extends LinearLayout {
stickerToSendView.setImage(ImageLocation.getForDocument(sticker), createFilter(sticker), ImageLocation.getForDocument(thumb, sticker), null, 0, sticker);
}
stickerToSendView.setOnClickListener(v -> {
if (NekomuraConfig.dontSendGreetingSticker.Bool())
if (NekoConfig.dontSendGreetingSticker.Bool())
return;
if (listener != null) {
listener.onGreetings(sticker);

View File

@ -48,7 +48,7 @@ import org.telegram.ui.ActionBar.Theme;
import java.util.List;
import cn.hutool.core.util.StrUtil;
import tw.nekomimi.nkmr.NekomuraConfig;
import tw.nekomimi.nekogram.NekoConfig;
import tw.nekomimi.nekogram.transtale.TranslateDb;
import tw.nekomimi.nekogram.transtale.Translator;
import tw.nekomimi.nekogram.transtale.TranslatorKt;
@ -196,7 +196,7 @@ public class EditTextCaption extends EditTextBoldCursor {
} else {
Translator.translate(TranslateDb.getChatLanguage(delegate.getCurrentChat(), TranslatorKt.getCode2Locale(NekomuraConfig.translateInputLang.String())), text, new Translator.Companion.TranslateCallBack() {
Translator.translate(TranslateDb.getChatLanguage(delegate.getCurrentChat(), TranslatorKt.getCode2Locale(NekoConfig.translateInputLang.String())), text, new Translator.Companion.TranslateCallBack() {
AlertDialog status = AlertUtil.showProgress(getContext());

View File

@ -15,10 +15,8 @@ import android.animation.ObjectAnimator;
import android.animation.StateListAnimator;
import android.annotation.SuppressLint;
import android.annotation.TargetApi;
import android.app.Activity;
import android.content.Context;
import android.content.SharedPreferences;
import android.database.DataSetObserver;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Outline;
@ -71,20 +69,6 @@ import android.widget.LinearLayout;
import android.widget.PopupWindow;
import android.widget.TextView;
import androidx.annotation.IntDef;
import androidx.annotation.MainThread;
import androidx.annotation.NonNull;
import androidx.core.view.ViewCompat;
import androidx.recyclerview.widget.GridLayoutManager;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.LinearSmoothScroller;
import androidx.recyclerview.widget.RecyclerView;
import androidx.recyclerview.widget.SimpleItemAnimator;
import androidx.viewpager.widget.PagerAdapter;
import androidx.viewpager.widget.ViewPager;
import com.google.android.exoplayer2.util.Log;
import org.telegram.messenger.AndroidUtilities;
import org.telegram.messenger.BuildVars;
import org.telegram.messenger.ChatObject;
@ -97,7 +81,6 @@ import org.telegram.messenger.FileLoader;
import org.telegram.messenger.FileLog;
import org.telegram.messenger.ImageReceiver;
import org.telegram.messenger.LocaleController;
import org.telegram.messenger.MediaDataController;
import org.telegram.messenger.MessageObject;
import org.telegram.messenger.MessagesController;
import org.telegram.messenger.MessagesStorage;
@ -113,7 +96,6 @@ import org.telegram.tgnet.TLRPC;
import org.telegram.ui.ActionBar.AlertDialog;
import org.telegram.ui.ActionBar.BottomSheet;
import org.telegram.ui.ActionBar.Theme;
import org.telegram.ui.Adapters.DialogsSearchAdapter;
import org.telegram.ui.Cells.ContextLinkCell;
import org.telegram.ui.Cells.EmptyCell;
import org.telegram.ui.Cells.FeaturedStickerSetInfoCell;
@ -131,8 +113,8 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
import tw.nekomimi.nkmr.NekomuraConfig;
import tw.nekomimi.nekogram.PinnedStickerHelper;
import tw.nekomimi.nekogram.NekoConfig;
import tw.nekomimi.nekogram.ui.PinnedStickerHelper;
public class EmojiView extends FrameLayout implements NotificationCenter.NotificationCenterDelegate {
@ -1996,7 +1978,7 @@ public class EmojiView extends FrameLayout implements NotificationCenter.Notific
} else if (event.getAction() == MotionEvent.ACTION_CANCEL || event.getAction() == MotionEvent.ACTION_UP) {
backspacePressed = false;
if (!backspaceOnce) {
if (delegate != null && delegate.onBackspace() && !NekomuraConfig.disableVibration.Bool()) {
if (delegate != null && delegate.onBackspace() && !NekoConfig.disableVibration.Bool()) {
backspaceButton.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP);
}
}
@ -3202,7 +3184,7 @@ public class EmojiView extends FrameLayout implements NotificationCenter.Notific
if (!backspacePressed) {
return;
}
if (delegate != null && delegate.onBackspace() && !NekomuraConfig.disableVibration.Bool()) {
if (delegate != null && delegate.onBackspace() && !NekoConfig.disableVibration.Bool()) {
backspaceButton.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP);
}
backspaceOnce = true;
@ -3271,7 +3253,7 @@ public class EmojiView extends FrameLayout implements NotificationCenter.Notific
if (trendingAdapter != null) {
trendingAdapter.notifyDataSetChanged();
}
if (!NekomuraConfig.disableTrending.Bool() && !featured.isEmpty() && (!BuildVars.DEBUG_PRIVATE_VERSION || featuredStickerSets.isEmpty() || preferences.getLong("featured_hidden", 0) == featured.get(0).set.id)) {
if (!NekoConfig.disableTrending.Bool() && !featured.isEmpty() && (!BuildVars.DEBUG_PRIVATE_VERSION || featuredStickerSets.isEmpty() || preferences.getLong("featured_hidden", 0) == featured.get(0).set.id)) {
final int id = mediaDataController.getUnreadStickerSets().isEmpty() ? 2 : 3;
final StickerTabView trendingStickersTabView = stickersTab.addStickerIconTab(id, stickerIcons[id]);
trendingStickersTabView.textView.setText(LocaleController.getString("FeaturedStickersShort", R.string.FeaturedStickersShort));
@ -3328,7 +3310,7 @@ public class EmojiView extends FrameLayout implements NotificationCenter.Notific
}
stickerSets.add(pack);
}
if (info != null && (!NekomuraConfig.hideGroupSticker.Bool())) {
if (info != null && (!NekoConfig.hideGroupSticker.Bool())) {
long hiddenStickerSetId = MessagesController.getEmojiSettings(currentAccount).getLong("group_hide_stickers_" + info.id, -1);
TLRPC.Chat chat = MessagesController.getInstance(currentAccount).getChat(info.id);
if (chat == null || info.stickerset == null || !ChatObject.hasAdminRights(chat)) {
@ -3428,7 +3410,7 @@ public class EmojiView extends FrameLayout implements NotificationCenter.Notific
gifTabs.addIconTab(0, gifIcons[0]).setContentDescription(LocaleController.getString("RecentStickers", R.string.RecentStickers));
}
if (!NekomuraConfig.disableTrending.Bool()) {
if (!NekoConfig.disableTrending.Bool()) {
gifTrendingTabNum = gifTabsCount++;
gifTabs.addIconTab(1, gifIcons[1]).setContentDescription(LocaleController.getString("FeaturedGifs", R.string.FeaturedGifs));
}
@ -3838,7 +3820,7 @@ public class EmojiView extends FrameLayout implements NotificationCenter.Notific
}
}
}
recentStickers = new ArrayList<>(recentStickers.subList(0, Math.min(recentStickers.size(), NekomuraConfig.maxRecentStickerCount.Int())));
recentStickers = new ArrayList<>(recentStickers.subList(0, Math.min(recentStickers.size(), NekoConfig.maxRecentStickerCount.Int())));
if (previousCount != recentStickers.size() || previousCount2 != favouriteStickers.size()) {
updateStickerTabs();
}

View File

@ -56,8 +56,8 @@ import org.telegram.ui.ActionBar.Theme;
import java.util.ArrayList;
import tw.nekomimi.nekogram.NekoXConfig;
import tw.nekomimi.nekogram.NekoConfig;
import tw.nekomimi.nkmr.NekomuraConfig;
public class FilterTabsView extends FrameLayout {
@ -984,7 +984,7 @@ public class FilterTabsView extends FrameLayout {
delegate.onPageSelected(id, scrollingForward);
}
scrollToChild(position);
if (NekomuraConfig.hideAllTab.Bool() && showAllChatsTab && id != Integer.MAX_VALUE)
if (NekoConfig.hideAllTab.Bool() && showAllChatsTab && id != Integer.MAX_VALUE)
toggleAllTabs(false);
}
@ -1295,7 +1295,7 @@ public class FilterTabsView extends FrameLayout {
manualScrollingToId = -1;
currentPosition = position;
selectedTabId = id;
if (NekomuraConfig.hideAllTab.Bool() && showAllChatsTab)
if (NekoConfig.hideAllTab.Bool() && showAllChatsTab)
toggleAllTabs(false);
}
}
@ -1517,7 +1517,7 @@ public class FilterTabsView extends FrameLayout {
@Override
public int getMovementFlags(RecyclerView recyclerView, RecyclerView.ViewHolder viewHolder) {
if (!isEditing || ((showAllChatsTab && viewHolder.getAdapterPosition() == 0) && !NekomuraConfig.pressTitleToOpenAllChats.Bool())) {
if (!isEditing || ((showAllChatsTab && viewHolder.getAdapterPosition() == 0) && !NekoConfig.pressTitleToOpenAllChats.Bool())) {
return makeMovementFlags(0, 0);
}
return makeMovementFlags(ItemTouchHelper.LEFT | ItemTouchHelper.RIGHT, 0);
@ -1559,7 +1559,7 @@ public class FilterTabsView extends FrameLayout {
return listView;
}
public boolean showAllChatsTab = !NekomuraConfig.hideAllTab.Bool();
public boolean showAllChatsTab = !NekoConfig.hideAllTab.Bool();
public void toggleAllTabs(boolean show) {
if (show == showAllChatsTab)
@ -1571,14 +1571,14 @@ public class FilterTabsView extends FrameLayout {
ArrayList<MessagesController.DialogFilter> filters = AccountInstance.getInstance(UserConfig.selectedAccount).getMessagesController().dialogFilters;
for (int a = 0, N = filters.size(); a < N; a++) {
MessagesController.DialogFilter dialogFilter = filters.get(a);
switch (NekomuraConfig.tabsTitleType.Int()) {
case NekoConfig.TITLE_TYPE_TEXT:
switch (NekoConfig.tabsTitleType.Int()) {
case NekoXConfig.TITLE_TYPE_TEXT:
addTab(a, filters.get(a).localId, dialogFilter.name);
break;
case NekoConfig.TITLE_TYPE_ICON:
case NekoXConfig.TITLE_TYPE_ICON:
addTab(a, filters.get(a).localId, dialogFilter.emoticon != null ? dialogFilter.emoticon : "📂");
break;
case NekoConfig.TITLE_TYPE_MIX:
case NekoXConfig.TITLE_TYPE_MIX:
addTab(a, filters.get(a).localId, dialogFilter.emoticon != null ? dialogFilter.emoticon + " " + dialogFilter.name : "📂 " + dialogFilter.name);
break;
}

View File

@ -81,7 +81,7 @@ import org.telegram.ui.LocationActivity;
import java.util.ArrayList;
import tw.nekomimi.nkmr.NekomuraConfig;
import tw.nekomimi.nekogram.NekoConfig;
public class FragmentContextView extends FrameLayout implements NotificationCenter.NotificationCenterDelegate, VoIPService.StateListener {
@ -449,7 +449,7 @@ public class FragmentContextView extends FrameLayout implements NotificationCent
isMuted = false;
AndroidUtilities.runOnUIThread(toggleMicRunnable, 90);
if (!NekomuraConfig.disableVibration.Bool()) {
if (!NekoConfig.disableVibration.Bool()) {
muteButton.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING);
}
};
@ -543,7 +543,7 @@ public class FragmentContextView extends FrameLayout implements NotificationCent
}
muteButton.playAnimation();
Theme.getFragmentContextViewWavesDrawable().updateState(true);
if (!NekomuraConfig.disableVibration.Bool()) {
if (!NekoConfig.disableVibration.Bool()) {
muteButton.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING);
}
});

View File

@ -37,7 +37,7 @@ import org.telegram.messenger.voip.VoIPService;
import org.telegram.tgnet.TLRPC;
import org.telegram.ui.GroupCallActivity;
import tw.nekomimi.nkmr.NekomuraConfig;
import tw.nekomimi.nekogram.NekoConfig;
import static android.view.WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE;
@ -131,7 +131,7 @@ public class GroupCallPip implements NotificationCenter.NotificationCenterDelega
return;
}
AndroidUtilities.runOnUIThread(micRunnable, 90);
if (!NekomuraConfig.disableVibration.Bool()) {
if (!NekoConfig.disableVibration.Bool()) {
performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING);
}
pressed = true;
@ -257,7 +257,7 @@ public class GroupCallPip implements NotificationCenter.NotificationCenterDelega
if (pressed) {
if (VoIPService.getSharedInstance() != null) {
VoIPService.getSharedInstance().setMicMute(true, false, false);
if (!NekomuraConfig.disableVibration.Bool()) {
if (!NekoConfig.disableVibration.Bool()) {
performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING);
}
}
@ -891,7 +891,7 @@ public class GroupCallPip implements NotificationCenter.NotificationCenterDelega
iconView.playAnimation();
}
if (prepare) {
if (!NekomuraConfig.disableVibration.Bool()) {
if (!NekoConfig.disableVibration.Bool()) {
button.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING);
}
}

View File

@ -61,7 +61,7 @@ import java.util.ArrayList;
import java.util.HashMap;
import kotlin.Unit;
import tw.nekomimi.nekogram.BottomBuilder;
import tw.nekomimi.nekogram.ui.BottomBuilder;
public class ImageUpdater implements NotificationCenter.NotificationCenterDelegate, PhotoCropActivity.PhotoEditActivityDelegate {

View File

@ -109,7 +109,7 @@ import javax.microedition.khronos.egl.EGLDisplay;
import javax.microedition.khronos.egl.EGLSurface;
import javax.microedition.khronos.opengles.GL;
import tw.nekomimi.nkmr.NekomuraConfig;
import tw.nekomimi.nekogram.NekoConfig;
@TargetApi(18)
public class InstantCameraView extends FrameLayout implements NotificationCenter.NotificationCenterDelegate {
@ -540,7 +540,7 @@ public class InstantCameraView extends FrameLayout implements NotificationCenter
textureOverlayView.setImageResource(R.drawable.icplaceholder);
}
cameraReady = false;
isFrontface = !NekomuraConfig.rearVideoMessages.Bool();
isFrontface = !NekoConfig.rearVideoMessages.Bool();
selectedCamera = null;
recordedTime = 0;
progress = 0;
@ -2196,7 +2196,7 @@ public class InstantCameraView extends FrameLayout implements NotificationCenter
if (cancelled) {
return;
}
if (!NekomuraConfig.disableVibration.Bool()) {
if (!NekoConfig.disableVibration.Bool()) {
try {
performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING);
} catch (Exception ignore) {

View File

@ -15,7 +15,7 @@ import org.telegram.ui.Components.Rect;
import java.util.UUID;
import tw.nekomimi.nkmr.NekomuraConfig;
import tw.nekomimi.nekogram.NekoConfig;
public class EntityView extends FrameLayout {
@ -59,7 +59,7 @@ public class EntityView extends FrameLayout {
recognizedLongPress = true;
if (delegate != null) {
if (!NekomuraConfig.disableVibration.Bool()) {
if (!NekoConfig.disableVibration.Bool()) {
performHapticFeedback(HapticFeedbackConstants.LONG_PRESS);
}
delegate.onEntityLongClicked(EntityView.this);

View File

@ -27,7 +27,6 @@ import android.hardware.biometrics.BiometricManager;
import android.hardware.biometrics.BiometricPrompt;
import android.os.Build;
import android.os.SystemClock;
import android.os.Vibrator;
import androidx.annotation.IdRes;
import androidx.core.content.ContextCompat;
@ -55,9 +54,6 @@ import android.widget.ImageView;
import android.widget.RelativeLayout;
import android.widget.TextView;
import androidx.annotation.IdRes;
import androidx.core.os.CancellationSignal;
import org.telegram.messenger.AndroidUtilities;
import org.telegram.messenger.ApplicationLoader;
import org.telegram.messenger.FileLog;
@ -73,7 +69,7 @@ import java.util.ArrayList;
import java.util.Locale;
import java.util.concurrent.Executor;
import tw.nekomimi.nkmr.NekomuraConfig;
import tw.nekomimi.nekogram.NekoConfig;
import tw.nekomimi.nekogram.utils.VibrateUtil;
public class PasscodeView extends FrameLayout {
@ -130,7 +126,7 @@ public class PasscodeView extends FrameLayout {
return;
}
try {
if (!NekomuraConfig.disableVibration.Bool()) {
if (!NekoConfig.disableVibration.Bool()) {
performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP);
}
} catch (Exception e) {
@ -253,7 +249,7 @@ public class PasscodeView extends FrameLayout {
return false;
}
try {
if (!NekomuraConfig.disableVibration.Bool()) {
if (!NekoConfig.disableVibration.Bool()) {
performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP);
}
} catch (Exception e) {

View File

@ -37,7 +37,7 @@ import org.telegram.ui.ActionBar.Theme;
import java.util.Locale;
import tw.nekomimi.nkmr.NekomuraConfig;
import tw.nekomimi.nekogram.NekoConfig;
public class ProximitySheet extends FrameLayout {
@ -202,7 +202,7 @@ public class ProximitySheet extends FrameLayout {
kmPicker.setTextOffset(AndroidUtilities.dp(20));
final NumberPicker.OnValueChangeListener onValueChangeListener = (picker, oldVal, newVal) -> {
try {
if (!NekomuraConfig.disableVibration.Bool()) {
if (!NekoConfig.disableVibration.Bool()) {
performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING);
}
} catch (Exception ignore) {

View File

@ -22,8 +22,6 @@ import android.text.TextUtils;
import android.view.HapticFeedbackConstants;
import android.view.View;
import com.google.android.exoplayer2.util.Log;
import org.telegram.messenger.AndroidUtilities;
import org.telegram.messenger.ApplicationLoader;
import org.telegram.messenger.DispatchQueuePool;
@ -42,7 +40,7 @@ import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;
import tw.nekomimi.nkmr.NekomuraConfig;
import tw.nekomimi.nekogram.NekoConfig;
public class RLottieDrawable extends BitmapDrawable implements Animatable {
@ -1010,7 +1008,7 @@ public class RLottieDrawable extends BitmapDrawable implements Animatable {
} else if (nextRenderingBitmap != null && (renderingBitmap == null || timeDiff >= timeCheck) && isCurrentParentViewMaster()) {
if (vibrationPattern != null && currentParentView != null) {
Integer force = vibrationPattern.get(currentFrame - 1);
if (force != null && !NekomuraConfig.disableVibration.Bool()) {
if (force != null && !NekoConfig.disableVibration.Bool()) {
currentParentView.performHapticFeedback(force == 1 ? HapticFeedbackConstants.LONG_PRESS : HapticFeedbackConstants.KEYBOARD_TAP, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING);
}
}

View File

@ -59,12 +59,7 @@ import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.HashSet;
import androidx.core.content.ContextCompat;
import androidx.core.graphics.ColorUtils;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import tw.nekomimi.nkmr.NekomuraConfig;
import tw.nekomimi.nekogram.NekoConfig;
public class RecyclerListView extends RecyclerView {
@ -1005,14 +1000,14 @@ public class RecyclerListView extends RecyclerView {
View child = currentChildView;
if (onItemLongClickListener != null) {
if (onItemLongClickListener.onItemClick(currentChildView, currentChildPosition)) {
if (!NekomuraConfig.disableVibration.Bool()) {
if (!NekoConfig.disableVibration.Bool()) {
child.performHapticFeedback(HapticFeedbackConstants.LONG_PRESS);
}
child.sendAccessibilityEvent(AccessibilityEvent.TYPE_VIEW_LONG_CLICKED);
}
} else {
if (onItemLongClickListenerExtended.onItemClick(currentChildView, currentChildPosition, event.getX() - currentChildView.getX(), event.getY() - currentChildView.getY())) {
if (!NekomuraConfig.disableVibration.Bool()) {
if (!NekoConfig.disableVibration.Bool()) {
child.performHapticFeedback(HapticFeedbackConstants.LONG_PRESS);
}
child.sendAccessibilityEvent(AccessibilityEvent.TYPE_VIEW_LONG_CLICKED);

View File

@ -100,7 +100,7 @@ import java.util.ArrayList;
import java.util.Collections;
import java.util.Locale;
import tw.nekomimi.nkmr.NekomuraConfig;
import tw.nekomimi.nekogram.NekoConfig;
public class ShareAlert extends BottomSheet implements NotificationCenter.NotificationCenterDelegate {
@ -1269,13 +1269,13 @@ public class ShareAlert extends BottomSheet implements NotificationCenter.Notifi
if (sendingMessageObjects != null) {
for (int a = 0; a < selectedDialogs.size(); a++) {
long key = selectedDialogs.keyAt(a);
if (NekomuraConfig.sendCommentAfterForward.Bool()) {
if (NekoConfig.sendCommentAfterForward.Bool()) {
SendMessagesHelper.getInstance(currentAccount).sendMessage(sendingMessageObjects, key, false, false, true, 0);
}
if (frameLayout2.getTag() != null && commentTextView.length() > 0) {
SendMessagesHelper.getInstance(currentAccount).sendMessage(commentTextView.getText().toString(), key, null, null, null, true, null, null, null, true, 0, null);
}
if (!NekomuraConfig.sendCommentAfterForward.Bool()) {
if (!NekoConfig.sendCommentAfterForward.Bool()) {
SendMessagesHelper.getInstance(currentAccount).sendMessage(sendingMessageObjects, key, false, false, true, 0);
}
}
@ -1290,13 +1290,13 @@ public class ShareAlert extends BottomSheet implements NotificationCenter.Notifi
if (sendingText[num] != null) {
for (int a = 0; a < selectedDialogs.size(); a++) {
long key = selectedDialogs.keyAt(a);
if (NekomuraConfig.sendCommentAfterForward.Bool()) {
if (NekoConfig.sendCommentAfterForward.Bool()) {
SendMessagesHelper.getInstance(currentAccount).sendMessage(sendingText[num], key, null, null, null, true, null, null, null, true, 0, null);
}
if (frameLayout2.getTag() != null && commentTextView.length() > 0) {
SendMessagesHelper.getInstance(currentAccount).sendMessage(commentTextView.getText().toString(), key, null, null, null, true, null, null, null, true, 0, null);
}
if (!NekomuraConfig.sendCommentAfterForward.Bool()) {
if (!NekoConfig.sendCommentAfterForward.Bool()) {
SendMessagesHelper.getInstance(currentAccount).sendMessage(sendingText[num], key, null, null, null, true, null, null, null, true, 0, null);
}
}

View File

@ -55,8 +55,6 @@ import androidx.recyclerview.widget.GridLayoutManager;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import com.google.android.exoplayer2.util.Log;
import org.telegram.messenger.AndroidUtilities;
import org.telegram.messenger.ApplicationLoader;
import org.telegram.messenger.ChatObject;
@ -72,7 +70,6 @@ import org.telegram.messenger.MessagesController;
import org.telegram.messenger.NotificationCenter;
import org.telegram.messenger.R;
import org.telegram.messenger.SharedConfig;
import org.telegram.messenger.UserConfig;
import org.telegram.messenger.UserObject;
import org.telegram.messenger.Utilities;
import org.telegram.messenger.browser.Browser;
@ -118,7 +115,7 @@ import java.util.HashMap;
import java.util.HashSet;
import kotlin.Unit;
import tw.nekomimi.nekogram.BottomBuilder;
import tw.nekomimi.nekogram.ui.BottomBuilder;
import tw.nekomimi.nekogram.utils.AlertUtil;
import tw.nekomimi.nekogram.utils.ProxyUtil;

View File

@ -51,13 +51,12 @@ import org.telegram.messenger.MessagesController;
import org.telegram.messenger.R;
import org.telegram.messenger.UserConfig;
import org.telegram.messenger.UserObject;
import org.telegram.tgnet.ConnectionsManager;
import org.telegram.tgnet.TLObject;
import org.telegram.tgnet.TLRPC;
import org.telegram.ui.ActionBar.BaseFragment;
import org.telegram.ui.ActionBar.Theme;
import org.telegram.ui.LaunchActivity;
import tw.nekomimi.nkmr.NekomuraConfig;
import tw.nekomimi.nekogram.NekoConfig;
import java.util.ArrayList;
@ -449,7 +448,7 @@ public class UndoView extends FrameLayout {
timeLeft = 5000;
currentInfoObject = infoObject;
if (NekomuraConfig.disableUndo.Bool() && !isTooltipAction()) {
if (NekoConfig.disableUndo.Bool() && !isTooltipAction()) {
if (actionRunnable != null) actionRunnable.run();
return;
}

View File

@ -37,7 +37,7 @@ import java.io.FileOutputStream;
import java.util.ArrayList;
import kotlin.Unit;
import tw.nekomimi.nekogram.BottomBuilder;
import tw.nekomimi.nekogram.ui.BottomBuilder;
public class WallpaperUpdater {

View File

@ -15,7 +15,7 @@ import android.view.View;
import org.telegram.messenger.AndroidUtilities;
import org.telegram.messenger.R;
import tw.nekomimi.nkmr.NekomuraConfig;
import tw.nekomimi.nekogram.NekoConfig;
public class ZoomControlView extends View {
@ -126,7 +126,7 @@ public class ZoomControlView extends View {
handled = true;
} else if (x >= minusCx - AndroidUtilities.dp(16) && x <= minusCx + AndroidUtilities.dp(16) && y >= minusCy - AndroidUtilities.dp(16) && y <= minusCy + AndroidUtilities.dp(16)) {
if (action == MotionEvent.ACTION_UP && animateToZoom((float) Math.floor(getZoom() / 0.25f) * 0.25f - 0.25f)) {
if (!NekomuraConfig.disableVibration.Bool()) {
if (!NekoConfig.disableVibration.Bool()) {
performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP);
}
} else {
@ -135,7 +135,7 @@ public class ZoomControlView extends View {
handled = true;
} else if (x >= plusCx - AndroidUtilities.dp(16) && x <= plusCx + AndroidUtilities.dp(16) && y >= plusCy - AndroidUtilities.dp(16) && y <= plusCy + AndroidUtilities.dp(16)) {
if (action == MotionEvent.ACTION_UP && animateToZoom((float) Math.floor(getZoom() / 0.25f) * 0.25f + 0.25f)) {
if (!NekomuraConfig.disableVibration.Bool()) {
if (!NekoConfig.disableVibration.Bool()) {
performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP);
}
} else {

View File

@ -61,7 +61,7 @@ import java.util.Collections;
import java.util.Locale;
import java.util.Set;
import tw.nekomimi.nkmr.NekomuraConfig;
import tw.nekomimi.nekogram.NekoConfig;
public class VoIPHelper {
@ -103,7 +103,7 @@ public class VoIPHelper {
return;
}
if (!confirmed && NekomuraConfig.askBeforeCall.Bool()) {
if (!confirmed && NekoConfig.askBeforeCall.Bool()) {
new AlertDialog.Builder(activity)
.setTitle(LocaleController.getString("ConfirmCall", R.string.ConfirmCall))
.setMessage(AndroidUtilities.replaceTags(LocaleController.formatString("CallTo", R.string.CallTo,

View File

@ -57,15 +57,13 @@ import org.telegram.ui.Cells.ContextLinkCell;
import org.telegram.ui.Cells.StickerCell;
import org.telegram.ui.Cells.StickerEmojiCell;
import org.telegram.ui.Components.AlertsCreator;
import org.telegram.ui.Components.ChatAvatarContainer;
import org.telegram.ui.Components.EmojiView;
import org.telegram.ui.Components.LayoutHelper;
import org.telegram.ui.Components.RecyclerListView;
import java.io.FileOutputStream;
import java.util.ArrayList;
import tw.nekomimi.nkmr.NekomuraConfig;
import tw.nekomimi.nekogram.NekoConfig;
public class ContentPreviewViewer {
@ -264,7 +262,7 @@ public class ContentPreviewViewer {
close();
});
visibleDialog.show();
if (!NekomuraConfig.disableVibration.Bool()) {
if (!NekoConfig.disableVibration.Bool()) {
containerView.performHapticFeedback(HapticFeedbackConstants.LONG_PRESS);
}
if (delegate != null && delegate.needRemove()) {
@ -358,7 +356,7 @@ public class ContentPreviewViewer {
close();
});
visibleDialog.show();
if (!NekomuraConfig.disableVibration.Bool()) {
if (!NekoConfig.disableVibration.Bool()) {
containerView.performHapticFeedback(HapticFeedbackConstants.LONG_PRESS);
}
if (canDelete) {

View File

@ -52,10 +52,9 @@ import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import kotlin.Unit;
import tw.nekomimi.nekogram.BottomBuilder;
import tw.nekomimi.nkmr.NekomuraConfig;
import tw.nekomimi.nekogram.ui.BottomBuilder;
import tw.nekomimi.nekogram.NekoConfig;
import tw.nekomimi.nekogram.utils.EnvUtil;
import tw.nekomimi.nkmr.NekomuraConfig;
public class DataSettingsActivity extends BaseFragment {
@ -342,7 +341,7 @@ public class DataSettingsActivity extends BaseFragment {
AtomicReference<String> target = new AtomicReference<>();
builder.addRadioItems(EnvUtil.getAvailableDirectories(),
(index, path) -> path.equals(NekomuraConfig.cachePath.String()), (__, path, cell) -> {
(index, path) -> path.equals(NekoConfig.cachePath.String()), (__, path, cell) -> {
target.set(path);
builder.doRadioCheck(cell);
@ -356,7 +355,7 @@ public class DataSettingsActivity extends BaseFragment {
if (target.get() != null) {
NekomuraConfig.cachePath.setConfigString(target.get());
NekoConfig.cachePath.setConfigString(target.get());
ImageLoader.getInstance().checkMediaPaths();
listAdapter.notifyItemChanged(position);
@ -482,7 +481,7 @@ public class DataSettingsActivity extends BaseFragment {
} else if (position == dataUsageRow) {
textCell.setText(LocaleController.getString("NetworkUsage", R.string.NetworkUsage), true);
} else if (position == storageNumRow) {
textCell.setTextAndValue(LocaleController.getString("StoragePath", R.string.StoragePath), NekomuraConfig.cachePath.String(), false);
textCell.setTextAndValue(LocaleController.getString("StoragePath", R.string.StoragePath), NekoConfig.cachePath.String(), false);
} else if (position == proxyRow) {
textCell.setText(LocaleController.getString("ProxySettings", R.string.ProxySettings), false);
} else if (position == resetDownloadRow) {

View File

@ -20,10 +20,8 @@ import org.telegram.ui.ActionBar.Theme;
import org.telegram.ui.Components.LayoutHelper;
import org.telegram.ui.Components.RLottieImageView;
import java.util.concurrent.Executor;
import tw.nekomimi.nekogram.utils.EnvUtil;
import tw.nekomimi.nkmr.NekomuraConfig;
import tw.nekomimi.nekogram.NekoConfig;
public class DatabaseMigrationHint extends FrameLayout {
@ -82,8 +80,8 @@ public class DatabaseMigrationHint extends FrameLayout {
// Move to /sdcard/Android/...... automatically
if (Build.VERSION.SDK_INT >= 30) {
ContextCompat.getMainExecutor(getContext()).execute(() -> {
if (!NekomuraConfig.cachePath.String().contains("/data/")) {
NekomuraConfig.cachePath.setConfigString(EnvUtil.getAvailableDirectories()[2]);
if (!NekoConfig.cachePath.String().contains("/data/")) {
NekoConfig.cachePath.setConfigString(EnvUtil.getAvailableDirectories()[2]);
ImageLoader.getInstance().checkMediaPaths();
}
});

View File

@ -176,10 +176,9 @@ import java.io.File;
import java.util.ArrayList;
import kotlin.Unit;
import tw.nekomimi.nekogram.BottomBuilder;
import tw.nekomimi.nekogram.ui.BottomBuilder;
import tw.nekomimi.nekogram.InternalUpdater;
import tw.nekomimi.nekogram.NekoConfig;
import tw.nekomimi.nkmr.NekomuraConfig;
import tw.nekomimi.nekogram.NekoXConfig;
import tw.nekomimi.nekogram.utils.PrivacyUtil;
import tw.nekomimi.nekogram.utils.ProxyUtil;
@ -736,7 +735,7 @@ public class DialogsActivity extends BaseFragment implements NotificationCenter.
viewPages[a].setTranslationY(0);
}
}
if ((initialDialogsType == 3 && NekomuraConfig.showTabsOnForward.Bool()) || !onlySelect) {
if ((initialDialogsType == 3 && NekoConfig.showTabsOnForward.Bool()) || !onlySelect) {
actionBar.setTranslationY(0);
}
searchViewPager.setTranslationY(0);
@ -759,7 +758,7 @@ public class DialogsActivity extends BaseFragment implements NotificationCenter.
if (filterTabsView != null && filterTabsView.getVisibility() == VISIBLE) {
h = heightSize - inputFieldHeight + AndroidUtilities.dp(2) - AndroidUtilities.dp(44) - topPadding;
} else {
h = heightSize - inputFieldHeight + AndroidUtilities.dp(2) - ((onlySelect && !(initialDialogsType == 3 && NekomuraConfig.showTabsOnForward.Bool())) ? 0 : actionBar.getMeasuredHeight()) - topPadding;
h = heightSize - inputFieldHeight + AndroidUtilities.dp(2) - ((onlySelect && !(initialDialogsType == 3 && NekoConfig.showTabsOnForward.Bool())) ? 0 : actionBar.getMeasuredHeight()) - topPadding;
}
if (filtersTabAnimator != null && filterTabsView != null && filterTabsView.getVisibility() == VISIBLE) {
@ -776,7 +775,7 @@ public class DialogsActivity extends BaseFragment implements NotificationCenter.
searchViewPager.setTranslationY(0);
int contentWidthSpec = View.MeasureSpec.makeMeasureSpec(widthSize, View.MeasureSpec.EXACTLY);
int h = View.MeasureSpec.getSize(heightMeasureSpec) + keyboardSize;
int contentHeightSpec = View.MeasureSpec.makeMeasureSpec(Math.max(AndroidUtilities.dp(10), h - inputFieldHeight + AndroidUtilities.dp(2) - (onlySelect && !(initialDialogsType == 3 && NekomuraConfig.showTabsOnForward.Bool()) ? 0 : actionBar.getMeasuredHeight()) - topPadding) - (searchTabsView == null ? 0 : AndroidUtilities.dp(44)), View.MeasureSpec.EXACTLY);
int contentHeightSpec = View.MeasureSpec.makeMeasureSpec(Math.max(AndroidUtilities.dp(10), h - inputFieldHeight + AndroidUtilities.dp(2) - (onlySelect && !(initialDialogsType == 3 && NekoConfig.showTabsOnForward.Bool()) ? 0 : actionBar.getMeasuredHeight()) - topPadding) - (searchTabsView == null ? 0 : AndroidUtilities.dp(44)), View.MeasureSpec.EXACTLY);
child.measure(contentWidthSpec, contentHeightSpec);
child.setPivotX(child.getMeasuredWidth() / 2);
} else if (commentView != null && commentView.isPopupView(child)) {
@ -866,11 +865,11 @@ public class DialogsActivity extends BaseFragment implements NotificationCenter.
} else if (child == filterTabsView || child == searchTabsView || child == filtersView) {
childTop = actionBar.getMeasuredHeight();
} else if (child == searchViewPager) {
childTop = (onlySelect && !(initialDialogsType == 3 && NekomuraConfig.showTabsOnForward.Bool()) ? 0 : actionBar.getMeasuredHeight()) + topPadding + (searchTabsView == null ? 0 : AndroidUtilities.dp(44));
childTop = (onlySelect && !(initialDialogsType == 3 && NekoConfig.showTabsOnForward.Bool()) ? 0 : actionBar.getMeasuredHeight()) + topPadding + (searchTabsView == null ? 0 : AndroidUtilities.dp(44));
} else if (child instanceof DatabaseMigrationHint) {
childTop = actionBar.getMeasuredHeight();
} else if (child instanceof ViewPage) {
if ((initialDialogsType == 3 && NekomuraConfig.showTabsOnForward.Bool()) || !onlySelect) {
if ((initialDialogsType == 3 && NekoConfig.showTabsOnForward.Bool()) || !onlySelect) {
if (filterTabsView != null && filterTabsView.getVisibility() == VISIBLE) {
childTop = AndroidUtilities.dp(44);
} else {
@ -1264,7 +1263,7 @@ public class DialogsActivity extends BaseFragment implements NotificationCenter.
@Override
protected void onMeasure(int widthSpec, int heightSpec) {
int t = 0;
if ((initialDialogsType == 3 && NekomuraConfig.showTabsOnForward.Bool()) || !onlySelect) {
if ((initialDialogsType == 3 && NekoConfig.showTabsOnForward.Bool()) || !onlySelect) {
if (filterTabsView != null && filterTabsView.getVisibility() == VISIBLE) {
t = AndroidUtilities.dp(44);
} else {
@ -1283,7 +1282,7 @@ public class DialogsActivity extends BaseFragment implements NotificationCenter.
ignoreLayout = false;
}
}
if ((initialDialogsType == 3 && NekomuraConfig.showTabsOnForward.Bool()) || !onlySelect) {
if ((initialDialogsType == 3 && NekoConfig.showTabsOnForward.Bool()) || !onlySelect) {
ignoreLayout = true;
if (filterTabsView != null && filterTabsView.getVisibility() == VISIBLE) {
t = ActionBar.getCurrentActionBarHeight() + (actionBar.getOccupyStatusBar() ? AndroidUtilities.statusBarHeight : 0);
@ -1307,7 +1306,7 @@ public class DialogsActivity extends BaseFragment implements NotificationCenter.
}
checkIfAdapterValid();
super.onMeasure(widthSpec, heightSpec);
if ((initialDialogsType == 3 && NekomuraConfig.showTabsOnForward.Bool()) || !onlySelect) {
if ((initialDialogsType == 3 && NekoConfig.showTabsOnForward.Bool()) || !onlySelect) {
if (appliedPaddingTop != t && viewPages != null && viewPages.length > 1) {
viewPages[1].setTranslationX(viewPages[0].getMeasuredWidth());
}
@ -1447,7 +1446,7 @@ public class DialogsActivity extends BaseFragment implements NotificationCenter.
}
if (!canShowHiddenArchive) {
canShowHiddenArchive = true;
if (!NekomuraConfig.disableVibration.Bool()) {
if (!NekoConfig.disableVibration.Bool()) {
performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING);
}
if (parentPage.pullForegroundDrawable != null) {
@ -1458,7 +1457,7 @@ public class DialogsActivity extends BaseFragment implements NotificationCenter.
parentPage.archivePullViewState = ARCHIVE_ITEM_STATE_SHOWED;
if (NekomuraConfig.openArchiveOnPull.Bool()) {
if (NekoConfig.openArchiveOnPull.Bool()) {
AndroidUtilities.runOnUIThread(() -> {
// Open the folder.
// Delay was taken from PullForegroundDrawable::startOutAnimation().
@ -1824,7 +1823,7 @@ public class DialogsActivity extends BaseFragment implements NotificationCenter.
getNotificationCenter().addObserver(this, NotificationCenter.dialogsNeedReload);
NotificationCenter.getGlobalInstance().addObserver(this, NotificationCenter.emojiLoaded);
if ((initialDialogsType == 3 && NekomuraConfig.showTabsOnForward.Bool()) || !onlySelect) {
if ((initialDialogsType == 3 && NekoConfig.showTabsOnForward.Bool()) || !onlySelect) {
NotificationCenter.getGlobalInstance().addObserver(this, NotificationCenter.closeSearchByActiveAction);
NotificationCenter.getGlobalInstance().addObserver(this, NotificationCenter.proxySettingsChanged);
getNotificationCenter().addObserver(this, NotificationCenter.filterSettingsUpdated);
@ -1898,7 +1897,7 @@ public class DialogsActivity extends BaseFragment implements NotificationCenter.
if (searchString == null) {
getNotificationCenter().removeObserver(this, NotificationCenter.dialogsNeedReload);
NotificationCenter.getGlobalInstance().removeObserver(this, NotificationCenter.emojiLoaded);
if ((initialDialogsType == 3 && NekomuraConfig.showTabsOnForward.Bool()) || !onlySelect) {
if ((initialDialogsType == 3 && NekoConfig.showTabsOnForward.Bool()) || !onlySelect) {
NotificationCenter.getGlobalInstance().removeObserver(this, NotificationCenter.closeSearchByActiveAction);
NotificationCenter.getGlobalInstance().removeObserver(this, NotificationCenter.proxySettingsChanged);
getNotificationCenter().removeObserver(this, NotificationCenter.filterSettingsUpdated);
@ -2129,7 +2128,7 @@ public class DialogsActivity extends BaseFragment implements NotificationCenter.
}
actionBar.setBackgroundColor(Theme.getColor(Theme.key_actionBarDefault));
actionBar.setOnLongClickListener(v -> {
if (NekomuraConfig.hideAllTab.Bool() && NekomuraConfig.pressTitleToOpenAllChats.Bool() && filterTabsView != null && filterTabsView.getCurrentTabId() != Integer.MAX_VALUE) {
if (NekoConfig.hideAllTab.Bool() && NekoConfig.pressTitleToOpenAllChats.Bool() && filterTabsView != null && filterTabsView.getCurrentTabId() != Integer.MAX_VALUE) {
filterTabsView.toggleAllTabs(true);
filterTabsView.selectFirstTab();
}
@ -2147,7 +2146,7 @@ public class DialogsActivity extends BaseFragment implements NotificationCenter.
} else {
actionBar.setTitle(LocaleController.getString("NekoX", R.string.NekoX));
actionBar.setOnLongClickListener(v -> {
if (NekomuraConfig.hideAllTab.Bool() && NekomuraConfig.pressTitleToOpenAllChats.Bool() && filterTabsView != null && filterTabsView.getCurrentTabId() != Integer.MAX_VALUE) {
if (NekoConfig.hideAllTab.Bool() && NekoConfig.pressTitleToOpenAllChats.Bool() && filterTabsView != null && filterTabsView.getCurrentTabId() != Integer.MAX_VALUE) {
filterTabsView.toggleAllTabs(true);
filterTabsView.selectFirstTab();
}
@ -2158,7 +2157,7 @@ public class DialogsActivity extends BaseFragment implements NotificationCenter.
actionBar.setSupportsHolidayImage(true);
}
}
if ((initialDialogsType == 3 && NekomuraConfig.showTabsOnForward.Bool()) || !onlySelect) {
if ((initialDialogsType == 3 && NekoConfig.showTabsOnForward.Bool()) || !onlySelect) {
actionBar.setAddToContainer(false);
actionBar.setCastShadows(false);
actionBar.setClipContent(true);
@ -2170,7 +2169,7 @@ public class DialogsActivity extends BaseFragment implements NotificationCenter.
scrollToTop();
});
if ((initialDialogsType == 3 && NekomuraConfig.showTabsOnForward.Bool()) || initialDialogsType == 0 && folderId == 0 && !onlySelect && TextUtils.isEmpty(searchString)) {
if ((initialDialogsType == 3 && NekoConfig.showTabsOnForward.Bool()) || initialDialogsType == 0 && folderId == 0 && !onlySelect && TextUtils.isEmpty(searchString)) {
scrimPaint = new Paint() {
@Override
public void setAlpha(int a) {
@ -2571,7 +2570,7 @@ public class DialogsActivity extends BaseFragment implements NotificationCenter.
ContentView contentView = new ContentView(context);
fragmentView = contentView;
int pagesCount = (initialDialogsType == 3 && NekomuraConfig.showTabsOnForward.Bool()) || (folderId == 0 && initialDialogsType == 0 && !onlySelect) ? 2 : 1;
int pagesCount = (initialDialogsType == 3 && NekoConfig.showTabsOnForward.Bool()) || (folderId == 0 && initialDialogsType == 0 && !onlySelect) ? 2 : 1;
viewPages = new ViewPage[pagesCount];
for (int a = 0; a < pagesCount; a++) {
final ViewPage viewPage = new ViewPage(context) {
@ -2764,7 +2763,7 @@ public class DialogsActivity extends BaseFragment implements NotificationCenter.
if (canShowHiddenArchive != canShowInternal) {
canShowHiddenArchive = canShowInternal;
if (viewPage.archivePullViewState == ARCHIVE_ITEM_STATE_HIDDEN) {
if (!NekomuraConfig.disableVibration.Bool()) {
if (!NekoConfig.disableVibration.Bool()) {
viewPage.listView.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING);
}
if (viewPage.pullForegroundDrawable != null) {
@ -3406,7 +3405,7 @@ public class DialogsActivity extends BaseFragment implements NotificationCenter.
if (filterTabsView != null) {
contentView.addView(filterTabsView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, 44));
}
if ((initialDialogsType == 3 && NekomuraConfig.showTabsOnForward.Bool()) || !onlySelect) {
if ((initialDialogsType == 3 && NekoConfig.showTabsOnForward.Bool()) || !onlySelect) {
final FrameLayout.LayoutParams layoutParams = LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT);
if (inPreviewMode && Build.VERSION.SDK_INT >= 21) {
layoutParams.topMargin = AndroidUtilities.statusBarHeight;
@ -3709,7 +3708,7 @@ public class DialogsActivity extends BaseFragment implements NotificationCenter.
}
private void updateFiltersView(boolean showMediaFilters, ArrayList<Object> users, ArrayList<FiltersView.DateData> dates, boolean archive, boolean animated) {
if (!searchIsShowed || onlySelect && !(initialDialogsType == 3 && NekomuraConfig.showTabsOnForward.Bool())) {
if (!searchIsShowed || onlySelect && !(initialDialogsType == 3 && NekoConfig.showTabsOnForward.Bool())) {
return;
}
boolean hasMediaFilter = false;
@ -4032,20 +4031,20 @@ public class DialogsActivity extends BaseFragment implements NotificationCenter.
filterTabsView.addTab(Integer.MAX_VALUE, 0, LocaleController.getString("FilterAllChats", R.string.FilterAllChats));
for (int a = 0, N = filters.size(); a < N; a++) {
MessagesController.DialogFilter dialogFilter = filters.get(a);
switch (NekomuraConfig.tabsTitleType.Int()) {
case NekoConfig.TITLE_TYPE_TEXT:
switch (NekoConfig.tabsTitleType.Int()) {
case NekoXConfig.TITLE_TYPE_TEXT:
filterTabsView.addTab(a, filters.get(a).localId, dialogFilter.name);
break;
case NekoConfig.TITLE_TYPE_ICON:
case NekoXConfig.TITLE_TYPE_ICON:
filterTabsView.addTab(a, filters.get(a).localId, dialogFilter.emoticon != null ? dialogFilter.emoticon : "📂");
break;
case NekoConfig.TITLE_TYPE_MIX:
case NekoXConfig.TITLE_TYPE_MIX:
filterTabsView.addTab(a, filters.get(a).localId, dialogFilter.emoticon != null ? dialogFilter.emoticon + " " + dialogFilter.name : "📂 " + dialogFilter.name);
break;
}
}
id = filterTabsView.getCurrentTabId();
boolean updateCurrentTab = NekomuraConfig.hideAllTab.Bool();
boolean updateCurrentTab = NekoConfig.hideAllTab.Bool();
if (id >= 0) {
if (viewPages[0].selectedType != id) {
updateCurrentTab = true;
@ -4324,11 +4323,11 @@ public class DialogsActivity extends BaseFragment implements NotificationCenter.
return false;
} else if (filterTabsView != null && filterTabsView.getVisibility() == View.VISIBLE && !tabsAnimationInProgress && !filterTabsView.isAnimatingIndicator()
&& filterTabsView.getCurrentTabId() != Integer.MAX_VALUE && !startedTracking) {
if(!NekomuraConfig.hideAllTab.Bool()){
if(!NekoConfig.hideAllTab.Bool()){
filterTabsView.selectFirstTab();
return false;
}
if (!NekomuraConfig.pressTitleToOpenAllChats.Bool() && filterTabsView != null) {
if (!NekoConfig.pressTitleToOpenAllChats.Bool() && filterTabsView != null) {
// not hideAllTab OR hideAllTab but not pressTitleToOpenAllChats
filterTabsView.toggleAllTabs(true);
filterTabsView.selectFirstTab();
@ -5111,7 +5110,7 @@ public class DialogsActivity extends BaseFragment implements NotificationCenter.
updateSelectedCount();
} else {
if (dialog instanceof TLRPC.TL_dialogFolder) {
if (!NekomuraConfig.disableVibration.Bool()) {
if (!NekoConfig.disableVibration.Bool()) {
view.performHapticFeedback(HapticFeedbackConstants.LONG_PRESS, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING);
}
BottomBuilder builder = new BottomBuilder(getParentActivity());
@ -5454,7 +5453,7 @@ public class DialogsActivity extends BaseFragment implements NotificationCenter.
int maxPinnedCount;
if (containsFilter) {
maxPinnedCount = 100 - filter.alwaysShow.size();
} else if (NekomuraConfig.unlimitedPinnedDialogs.Bool() || folderId != 0 || filter != null) {
} else if (NekoConfig.unlimitedPinnedDialogs.Bool() || folderId != 0 || filter != null) {
maxPinnedCount = getMessagesController().maxFolderPinnedDialogsCount;
} else {
maxPinnedCount = getMessagesController().maxPinnedDialogsCount;
@ -6253,7 +6252,7 @@ public class DialogsActivity extends BaseFragment implements NotificationCenter.
SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("mainconfig", Activity.MODE_PRIVATE);
String proxyAddress = preferences.getString("proxy_ip", "");
boolean proxyEnabled;
if (!NekomuraConfig.useProxyItem.Bool() && (!NekomuraConfig.hideProxyByDefault.Bool() || (proxyEnabled = preferences.getBoolean("proxy_enabled", false) && !TextUtils.isEmpty(proxyAddress)) || getMessagesController().blockedCountry && !SharedConfig.proxyList.isEmpty())) {
if (!NekoConfig.useProxyItem.Bool() && (!NekoConfig.hideProxyByDefault.Bool() || (proxyEnabled = preferences.getBoolean("proxy_enabled", false) && !TextUtils.isEmpty(proxyAddress)) || getMessagesController().blockedCountry && !SharedConfig.proxyList.isEmpty())) {
if (!actionBar.isSearchFieldVisible() && (doneItem == null || doneItem.getVisibility() != View.VISIBLE)) {
proxyItem.setVisibility(View.VISIBLE);
}
@ -7820,7 +7819,7 @@ public class DialogsActivity extends BaseFragment implements NotificationCenter.
@Override
public boolean isSwipeBackEnabled(MotionEvent event) {
return !((initialDialogsType == 3 && NekomuraConfig.showTabsOnForward.Bool()) && viewPages[0].selectedType != filterTabsView.getFirstTabId());
return !((initialDialogsType == 3 && NekoConfig.showTabsOnForward.Bool()) && viewPages[0].selectedType != filterTabsView.getFirstTabId());
}
public void setShowSearch(String query, int i) {

View File

@ -101,7 +101,7 @@ import java.util.concurrent.atomic.AtomicBoolean;
import cn.hutool.core.collection.CollectionUtil;
import kotlin.Unit;
import tw.nekomimi.nekogram.utils.EnvUtil;
import tw.nekomimi.nkmr.NekomuraConfig;
import tw.nekomimi.nekogram.NekoConfig;
import tw.nekomimi.nekogram.transtale.TranslateDb;
import tw.nekomimi.nekogram.transtale.Translator;
import tw.nekomimi.nekogram.transtale.TranslatorKt;
@ -748,7 +748,7 @@ public class DocumentSelectActivity extends BaseFragment {
sendPopupWindow.dismiss();
}
if (num == 0) {
translateComment(TranslateDb.getChatLanguage(chatId, TranslatorKt.getCode2Locale(NekomuraConfig.translateInputLang.String())));
translateComment(TranslateDb.getChatLanguage(chatId, TranslatorKt.getCode2Locale(NekoConfig.translateInputLang.String())));
} else if (num == 1) {
AlertsCreator.createScheduleDatePickerDialog(getParentActivity(), chatActivity.getDialogId(), this::sendSelectedFiles);
} else if (num == 2) {
@ -787,7 +787,7 @@ public class DocumentSelectActivity extends BaseFragment {
view.getLocationInWindow(location);
sendPopupWindow.showAtLocation(view, Gravity.LEFT | Gravity.TOP, location[0] + view.getMeasuredWidth() - sendPopupLayout.getMeasuredWidth() + AndroidUtilities.dp(8), location[1] - sendPopupLayout.getMeasuredHeight() - AndroidUtilities.dp(2));
sendPopupWindow.dimBehind();
if (!NekomuraConfig.disableVibration.Bool()) {
if (!NekoConfig.disableVibration.Bool()) {
view.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING);
}

View File

@ -33,7 +33,7 @@ import java.util.HashMap;
import java.util.HashSet;
import java.util.Random;
import tw.nekomimi.nkmr.NekomuraConfig;
import tw.nekomimi.nekogram.NekoConfig;
public class EmojiAnimationsOverlay implements NotificationCenter.NotificationCenterDelegate {
@ -154,7 +154,7 @@ public class EmojiAnimationsOverlay implements NotificationCenter.NotificationCe
checkStickerPack();
}
} else if (id == NotificationCenter.onEmojiInteractionsReceived) {
if (NekomuraConfig.disableRemoteEmojiInteractions.Bool())
if (NekoConfig.disableRemoteEmojiInteractions.Bool())
return;
long dialogId = (long) args[0];
TLRPC.TL_sendMessageEmojiInteraction action = (TLRPC.TL_sendMessageEmojiInteraction) args[1];

View File

@ -75,7 +75,7 @@ import java.util.HashMap;
import java.util.Locale;
import kotlin.Unit;
import tw.nekomimi.nekogram.BottomBuilder;
import tw.nekomimi.nekogram.ui.BottomBuilder;
import tw.nekomimi.nekogram.utils.AlertUtil;
import tw.nekomimi.nekogram.utils.ProxyUtil;

View File

@ -35,8 +35,6 @@ import android.media.projection.MediaProjectionManager;
import android.os.Build;
import android.os.Bundle;
import android.os.SystemClock;
import android.os.Vibrator;
import android.provider.Settings;
import android.provider.Settings;
import android.text.Editable;
import android.text.InputType;
@ -44,9 +42,6 @@ import android.text.SpannableStringBuilder;
import android.text.TextUtils;
import android.text.TextWatcher;
import android.util.Property;
import android.util.SparseArray;
import android.util.SparseBooleanArray;
import android.util.SparseIntArray;
import android.util.TypedValue;
import android.view.Gravity;
import android.view.HapticFeedbackConstants;
@ -133,7 +128,6 @@ import org.telegram.ui.Components.GroupVoipInviteAlert;
import org.telegram.ui.Components.HintView;
import org.telegram.ui.Components.ImageUpdater;
import org.telegram.ui.Components.JoinCallAlert;
import org.telegram.ui.Components.GroupVoipInviteAlert;
import org.telegram.ui.Components.LayoutHelper;
import org.telegram.ui.Components.NumberPicker;
import org.telegram.ui.Components.ProfileGalleryView;
@ -160,12 +154,10 @@ import java.util.Calendar;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Locale;
import tw.nekomimi.nkmr.NekomuraConfig;
import tw.nekomimi.nekogram.NekoConfig;
import static android.content.Context.AUDIO_SERVICE;
import com.google.android.exoplayer2.util.Log;
public class GroupCallActivity extends BottomSheet implements NotificationCenter.NotificationCenterDelegate, VoIPService.StateListener {
public final static int TABLET_LIST_SIZE = 320;
@ -421,7 +413,7 @@ public class GroupCallActivity extends BottomSheet implements NotificationCenter
if (call == null || !scheduled || VoIPService.getSharedInstance() == null) {
return;
}
if (!NekomuraConfig.disableVibration.Bool()) {
if (!NekoConfig.disableVibration.Bool()) {
muteButton.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING);
}
updateMuteButton(MUTE_BUTTON_STATE_MUTE, true);
@ -4074,7 +4066,7 @@ public class GroupCallActivity extends BottomSheet implements NotificationCenter
updateMuteButton(MUTE_BUTTON_STATE_UNMUTE, true);
if (VoIPService.getSharedInstance() != null) {
VoIPService.getSharedInstance().setMicMute(true, true, false);
if (!NekomuraConfig.disableVibration.Bool()) {
if (!NekoConfig.disableVibration.Bool()) {
muteButton.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING);
}
}
@ -4202,13 +4194,13 @@ public class GroupCallActivity extends BottomSheet implements NotificationCenter
} else if (muteButtonState == MUTE_BUTTON_STATE_UNMUTE) {
updateMuteButton(MUTE_BUTTON_STATE_MUTE, true);
VoIPService.getSharedInstance().setMicMute(false, false, true);
if (!NekomuraConfig.disableVibration.Bool()) {
if (!NekoConfig.disableVibration.Bool()) {
muteButton.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING);
}
} else {
updateMuteButton(MUTE_BUTTON_STATE_UNMUTE, true);
VoIPService.getSharedInstance().setMicMute(true, false, true);
if (!NekomuraConfig.disableVibration.Bool()) {
if (!NekoConfig.disableVibration.Bool()) {
muteButton.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING);
}
}

View File

@ -51,10 +51,6 @@ import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.ScrollView;
import androidx.annotation.Keep;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import org.telegram.messenger.AndroidUtilities;
import org.telegram.messenger.ChatObject;
import org.telegram.messenger.ContactsController;
@ -96,7 +92,7 @@ import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import tw.nekomimi.nkmr.NekomuraConfig;
import tw.nekomimi.nekogram.NekoConfig;
public class GroupCreateActivity extends BaseFragment implements NotificationCenter.NotificationCenterDelegate, View.OnClickListener {
@ -1194,7 +1190,7 @@ public class GroupCreateActivity extends BaseFragment implements NotificationCen
firstName = chat.title;
lastName = "";
}
if (NekomuraConfig.nameOrder.Int() == 1) {
if (NekoConfig.nameOrder.Int() == 1) {
if (!TextUtils.isEmpty(firstName)) {
return firstName.substring(0, 1).toUpperCase();
} else if (!TextUtils.isEmpty(lastName)) {

View File

@ -8,58 +8,31 @@
package org.telegram.ui;
import android.animation.ValueAnimator;
import android.content.Context;
import android.content.DialogInterface;
import android.content.SharedPreferences;
import android.content.res.Configuration;
import android.view.Gravity;
import android.view.View;
import android.view.ViewGroup;
import android.widget.EditText;
import android.widget.FrameLayout;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import android.widget.LinearLayout;
import android.widget.TextView;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import org.telegram.messenger.AndroidUtilities;
import org.telegram.messenger.FileLog;
import org.telegram.messenger.LocaleController;
import org.telegram.messenger.MessagesController;
import org.telegram.messenger.NotificationCenter;
import org.telegram.messenger.R;
import org.telegram.messenger.Utilities;
import org.telegram.ui.ActionBar.AlertDialog;
import org.telegram.ui.ActionBar.Theme;
import org.telegram.ui.ActionBar.ThemeDescription;
import org.telegram.ui.Cells.HeaderCell;
import org.telegram.ui.Cells.LanguageCell;
import org.telegram.tgnet.ConnectionsManager;
import org.telegram.tgnet.TLRPC;
import org.telegram.ui.ActionBar.ActionBar;
import org.telegram.ui.ActionBar.ActionBarMenu;
import org.telegram.ui.ActionBar.ActionBarMenuItem;
import org.telegram.ui.ActionBar.AlertDialog;
import org.telegram.ui.ActionBar.BaseFragment;
import org.telegram.ui.ActionBar.Theme;
import org.telegram.ui.ActionBar.ThemeDescription;
import org.telegram.ui.Cells.LanguageCell;
import org.telegram.ui.ActionBar.Theme;
import org.telegram.ui.ActionBar.ThemeDescription;
import org.telegram.ui.Cells.HeaderCell;
import org.telegram.ui.Cells.LanguageCell;
import org.telegram.ui.Cells.ShadowSectionCell;
import org.telegram.ui.Components.AlertsCreator;
import org.telegram.ui.Cells.TextCheckCell;
import org.telegram.ui.Cells.TextInfoPrivacyCell;
import org.telegram.ui.Cells.TextRadioCell;
import org.telegram.ui.Cells.TextSettingsCell;
import org.telegram.ui.Components.CubicBezierInterpolator;
import org.telegram.ui.Components.EmptyTextProgressView;
import org.telegram.ui.Components.LayoutHelper;
import org.telegram.ui.Components.RecyclerListView;
@ -67,13 +40,10 @@ import org.telegram.ui.Components.RecyclerListView;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashSet;
import java.util.Set;
import java.util.Timer;
import java.util.TimerTask;
import kotlin.Unit;
import tw.nekomimi.nekogram.BottomBuilder;
import tw.nekomimi.nekogram.ui.BottomBuilder;
import tw.nekomimi.nekogram.utils.AlertUtil;
import tw.nekomimi.nekogram.utils.ShareUtil;

View File

@ -155,10 +155,9 @@ import java.util.regex.Pattern;
import cn.hutool.core.util.StrUtil;
import kotlin.Unit;
import kotlin.text.StringsKt;
import tw.nekomimi.nekogram.BottomBuilder;
import tw.nekomimi.nekogram.ui.BottomBuilder;
import tw.nekomimi.nekogram.ExternalGcm;
import tw.nekomimi.nekogram.NekoConfig;
import tw.nekomimi.nkmr.NekomuraConfig;
import tw.nekomimi.nekogram.NekoXConfig;
import tw.nekomimi.nekogram.settings.NekoSettingsActivity;
import tw.nekomimi.nekogram.proxy.SubInfo;
@ -911,7 +910,7 @@ public class LaunchActivity extends Activity implements ActionBarLayout.ActionBa
ExternalGcm.checkUpdate(this);
if (NekomuraConfig.autoUpdateSubInfo.Bool()) for (SubInfo subInfo : SubManager.getSubList().find()) {
if (NekoConfig.autoUpdateSubInfo.Bool()) for (SubInfo subInfo : SubManager.getSubList().find()) {
if (subInfo == null || !subInfo.enable) continue;
@ -4040,7 +4039,7 @@ public class LaunchActivity extends Activity implements ActionBarLayout.ActionBa
showPermissionErrorAlert(LocaleController.getString("VoipNeedCameraPermission", R.string.VoipNeedCameraPermission));
}
} else if (requestCode == 4) {
NekoConfig.checkForceSystemPicker();
NekoXConfig.checkForceSystemPicker();
if (!granted) {
showPermissionErrorAlert(LocaleController.getString("PermissionStorage", R.string.PermissionStorage));
} else {

View File

@ -134,9 +134,9 @@ import cn.hutool.core.codec.Base64;
import cn.hutool.core.util.NumberUtil;
import cn.hutool.core.util.StrUtil;
import kotlin.Unit;
import tw.nekomimi.nekogram.BottomBuilder;
import tw.nekomimi.nekogram.ui.BottomBuilder;
import tw.nekomimi.nekogram.DataCenter;
import tw.nekomimi.nekogram.EditTextAutoFill;
import tw.nekomimi.nekogram.ui.EditTextAutoFill;
import tw.nekomimi.nekogram.NekoXConfig;
import tw.nekomimi.nekogram.utils.AlertUtil;
import tw.nekomimi.nekogram.utils.ProxyUtil;

View File

@ -76,7 +76,7 @@ import java.util.ArrayList;
import java.util.HashMap;
import java.util.Locale;
import tw.nekomimi.nkmr.NekomuraConfig;
import tw.nekomimi.nekogram.NekoConfig;
public class ManageLinksActivity extends BaseFragment {
@ -644,7 +644,7 @@ public class ManageLinksActivity extends BaseFragment {
if ((position >= linksStartRow && position < linksEndRow) || (position >= revokedLinksStartRow && position < revokedLinksEndRow)) {
LinkCell cell = (LinkCell) view;
cell.optionsView.callOnClick();
if (!NekomuraConfig.disableVibration.Bool()) {
if (!NekoConfig.disableVibration.Bool()) {
view.performHapticFeedback(HapticFeedbackConstants.LONG_PRESS, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING);
}
return true;

View File

@ -79,7 +79,7 @@ import java.util.Locale;
import java.util.concurrent.atomic.AtomicBoolean;
import kotlin.Unit;
import tw.nekomimi.nkmr.NekomuraConfig;
import tw.nekomimi.nekogram.NekoConfig;
import tw.nekomimi.nekogram.transtale.TranslateDb;
import tw.nekomimi.nekogram.transtale.Translator;
import tw.nekomimi.nekogram.transtale.TranslatorKt;
@ -513,7 +513,7 @@ public class PhotoAlbumPickerActivity extends BaseFragment implements Notificati
sendPopupWindow.dismiss();
}
if (num == 0) {
translateComment(TranslateDb.getChatLanguage(chatId, TranslatorKt.getCode2Locale(NekomuraConfig.translateInputLang.String())));
translateComment(TranslateDb.getChatLanguage(chatId, TranslatorKt.getCode2Locale(NekoConfig.translateInputLang.String())));
} else if (num == 1) {
AlertsCreator.createScheduleDatePickerDialog(getParentActivity(), chatActivity.getDialogId(), (notify, scheduleDate) -> {
sendSelectedPhotos(selectedPhotos, selectedPhotosOrder, notify, scheduleDate);
@ -557,7 +557,7 @@ public class PhotoAlbumPickerActivity extends BaseFragment implements Notificati
view.getLocationInWindow(location);
sendPopupWindow.showAtLocation(view, Gravity.LEFT | Gravity.TOP, location[0] + view.getMeasuredWidth() - sendPopupLayout.getMeasuredWidth() + AndroidUtilities.dp(8), location[1] - sendPopupLayout.getMeasuredHeight() - AndroidUtilities.dp(2));
sendPopupWindow.dimBehind();
if (!NekomuraConfig.disableVibration.Bool()) {
if (!NekoConfig.disableVibration.Bool()) {
view.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING);
}

View File

@ -78,7 +78,6 @@ import org.telegram.ui.ActionBar.ActionBarMenuSubItem;
import org.telegram.ui.ActionBar.ActionBarPopupWindow;
import org.telegram.ui.ActionBar.AlertDialog;
import org.telegram.ui.ActionBar.BaseFragment;
import org.telegram.ui.ActionBar.SimpleTextView;
import org.telegram.ui.ActionBar.Theme;
import org.telegram.ui.ActionBar.ThemeDescription;
import org.telegram.ui.Cells.DividerCell;
@ -103,7 +102,7 @@ import java.util.Locale;
import java.util.concurrent.atomic.AtomicBoolean;
import kotlin.Unit;
import tw.nekomimi.nkmr.NekomuraConfig;
import tw.nekomimi.nekogram.NekoConfig;
import tw.nekomimi.nekogram.transtale.TranslateDb;
import tw.nekomimi.nekogram.transtale.Translator;
import tw.nekomimi.nekogram.transtale.TranslatorKt;
@ -1121,7 +1120,7 @@ public class PhotoPickerActivity extends BaseFragment implements NotificationCen
sendPopupWindow.dismiss();
}
if (num == 0) {
translateComment(TranslateDb.getChatLanguage(chatId, TranslatorKt.getCode2Locale(NekomuraConfig.translateInputLang.String())));
translateComment(TranslateDb.getChatLanguage(chatId, TranslatorKt.getCode2Locale(NekoConfig.translateInputLang.String())));
} else if (num == 1) {
AlertsCreator.createScheduleDatePickerDialog(getParentActivity(), chatActivity.getDialogId(), this::sendSelectedPhotos);
} else if (num == 2) {
@ -1161,7 +1160,7 @@ public class PhotoPickerActivity extends BaseFragment implements NotificationCen
view.getLocationInWindow(location);
sendPopupWindow.showAtLocation(view, Gravity.LEFT | Gravity.TOP, location[0] + view.getMeasuredWidth() - sendPopupLayout.getMeasuredWidth() + AndroidUtilities.dp(8), location[1] - sendPopupLayout.getMeasuredHeight() - AndroidUtilities.dp(2));
sendPopupWindow.dimBehind();
if (!NekomuraConfig.disableVibration.Bool()) {
if (!NekoConfig.disableVibration.Bool()) {
view.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING);
}

View File

@ -66,7 +66,6 @@ import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.LinearSmoothScrollerEnd;
import androidx.recyclerview.widget.RecyclerView;
import android.text.Editable;
import android.text.Layout;
import android.text.Selection;
import android.text.Spannable;
@ -122,29 +121,10 @@ import android.widget.Scroller;
import android.widget.TextView;
import android.widget.Toast;
import androidx.annotation.Keep;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.collection.ArrayMap;
import androidx.core.content.ContextCompat;
import androidx.core.content.FileProvider;
import androidx.core.graphics.ColorUtils;
import androidx.core.view.ViewCompat;
import androidx.core.widget.NestedScrollView;
import androidx.dynamicanimation.animation.DynamicAnimation;
import androidx.dynamicanimation.animation.SpringAnimation;
import androidx.dynamicanimation.animation.SpringForce;
import androidx.exifinterface.media.ExifInterface;
import androidx.recyclerview.widget.DefaultItemAnimator;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.LinearSmoothScrollerEnd;
import androidx.recyclerview.widget.RecyclerView;
import com.google.android.exoplayer2.C;
import com.google.android.exoplayer2.ExoPlayer;
import com.google.android.exoplayer2.analytics.AnalyticsListener;
import com.google.android.exoplayer2.ui.AspectRatioFrameLayout;
import com.google.android.exoplayer2.util.Log;
import org.jetbrains.annotations.NotNull;
import org.telegram.messenger.AndroidUtilities;
@ -179,14 +159,6 @@ import org.telegram.messenger.UserObject;
import org.telegram.messenger.Utilities;
import org.telegram.messenger.VideoEditedInfo;
import org.telegram.messenger.WebFile;
import org.telegram.messenger.ApplicationLoader;
import org.telegram.messenger.FileLoader;
import org.telegram.messenger.FileLog;
import org.telegram.messenger.LocaleController;
import org.telegram.messenger.MediaController;
import org.telegram.messenger.MessagesController;
import org.telegram.messenger.NotificationCenter;
import org.telegram.messenger.R;
import org.telegram.messenger.browser.Browser;
import org.telegram.messenger.video.VideoPlayerRewinder;
import org.telegram.tgnet.ConnectionsManager;
@ -274,8 +246,7 @@ import java.util.Map;
import java.util.concurrent.atomic.AtomicBoolean;
import kotlin.Unit;
import tw.nekomimi.nekogram.MessageHelper;
import tw.nekomimi.nkmr.NekomuraConfig;
import tw.nekomimi.nekogram.NekoConfig;
import tw.nekomimi.nekogram.NekoXConfig;
import tw.nekomimi.nekogram.transtale.TranslateDb;
import tw.nekomimi.nekogram.transtale.Translator;
@ -5296,7 +5267,7 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat
} else if (a == 3) {
sendPressed(true, 0);
} else if (a == 4) {
translateComment(TranslateDb.getChatLanguage(chatId, TranslatorKt.getCode2Locale(NekomuraConfig.translateInputLang.String())));
translateComment(TranslateDb.getChatLanguage(chatId, TranslatorKt.getCode2Locale(NekoConfig.translateInputLang.String())));
} else if (a == 5) {
sendPressed(true, 0, false, true);
}
@ -5336,7 +5307,7 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat
int[] location = new int[2];
view.getLocationInWindow(location);
sendPopupWindow.showAtLocation(view, Gravity.LEFT | Gravity.TOP, location[0] + view.getMeasuredWidth() - sendPopupLayout.getMeasuredWidth() + AndroidUtilities.dp(14), location[1] - sendPopupLayout.getMeasuredHeight() - AndroidUtilities.dp(18));
if (!NekomuraConfig.disableVibration.Bool()) {
if (!NekoConfig.disableVibration.Bool()) {
view.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING);
}
@ -10150,7 +10121,7 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat
MessagesController.getInstance(currentAccount).loadDialogPhotos(avatarsDialogId, 80, 0, true, classGuid);
}
}
if (currentMessageObject != null && currentMessageObject.isVideo() || (NekomuraConfig.takeGIFasVideo.Bool() && currentMessageObject != null && currentMessageObject.isGif()) || currentBotInlineResult != null && (currentBotInlineResult.type.equals("video") || MessageObject.isVideoDocument(currentBotInlineResult.document)) || pageBlocksAdapter != null && pageBlocksAdapter.isVideo(index)) {
if (currentMessageObject != null && currentMessageObject.isVideo() || (NekoConfig.takeGIFasVideo.Bool() && currentMessageObject != null && currentMessageObject.isGif()) || currentBotInlineResult != null && (currentBotInlineResult.type.equals("video") || MessageObject.isVideoDocument(currentBotInlineResult.document)) || pageBlocksAdapter != null && pageBlocksAdapter.isVideo(index)) {
playerAutoStarted = true;
onActionClick(false);
} else if (!imagesArrLocals.isEmpty()) {
@ -13247,7 +13218,7 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat
if (photoPaintView != null) {
photoPaintView.onResume();
}
if (pausedOnPause && NekomuraConfig.autoPauseVideo.Bool() && videoPlayer != null && !videoPlayer.isPlaying()) {
if (pausedOnPause && NekoConfig.autoPauseVideo.Bool() && videoPlayer != null && !videoPlayer.isPlaying()) {
pausedOnPause = false;
videoPlayer.play();
}
@ -13270,7 +13241,7 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat
if (videoPlayer != null && playerLooping) {
videoPlayer.setLooping(false);
}
if (NekomuraConfig.autoPauseVideo.Bool() && videoPlayer != null && videoPlayer.isPlaying()) {
if (NekoConfig.autoPauseVideo.Bool() && videoPlayer != null && videoPlayer.isPlaying()) {
pausedOnPause = true;
videoPlayer.pause();
}
@ -14529,7 +14500,7 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat
public boolean onDown(MotionEvent e) {
if (!doubleTap && checkImageView.getVisibility() != View.VISIBLE && !drawPressedDrawable[0] && !drawPressedDrawable[1]) {
float x = e.getX();
int side = NekomuraConfig.disablePhotoSideAction.Bool() ? 0 : Math.min(135, containerView.getMeasuredWidth() / 8);
int side = NekoConfig.disablePhotoSideAction.Bool() ? 0 : Math.min(135, containerView.getMeasuredWidth() / 8);
if (x < side) {
if (leftImage.hasImageSet()) {
drawPressedDrawable[0] = true;
@ -14549,7 +14520,7 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat
public boolean canDoubleTap(MotionEvent e) {
if (checkImageView.getVisibility() != View.VISIBLE && !drawPressedDrawable[0] && !drawPressedDrawable[1]) {
float x = e.getX();
int side = NekomuraConfig.disablePhotoSideAction.Bool() ? 0 : Math.min(135, containerView.getMeasuredWidth() / 8);
int side = NekoConfig.disablePhotoSideAction.Bool() ? 0 : Math.min(135, containerView.getMeasuredWidth() / 8);
if (x < side || x > containerView.getMeasuredWidth() - side) {
return currentMessageObject == null || currentMessageObject.isVideo() && (SystemClock.elapsedRealtime() - lastPhotoSetTime) >= 500 && canDoubleTapSeekVideo(e);
}
@ -14643,7 +14614,7 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat
float y = e.getY();
if (checkImageView.getVisibility() != View.VISIBLE) {
if (y > ActionBar.getCurrentActionBarHeight() + AndroidUtilities.statusBarHeight + AndroidUtilities.dp(40)) {
int side = NekomuraConfig.disablePhotoSideAction.Bool() ? 0 : Math.min(135, containerView.getMeasuredWidth() / 8);
int side = NekoConfig.disablePhotoSideAction.Bool() ? 0 : Math.min(135, containerView.getMeasuredWidth() / 8);
if (x < side) {
if (leftImage.hasImageSet()) {
switchToNextIndex(-1, true);

View File

@ -81,7 +81,7 @@ import org.telegram.ui.Components.TypingDotsDrawable;
import java.io.File;
import java.util.ArrayList;
import tw.nekomimi.nkmr.NekomuraConfig;
import tw.nekomimi.nekogram.NekoConfig;
public class PopupNotificationActivity extends Activity implements NotificationCenter.NotificationCenterDelegate {
@ -932,7 +932,7 @@ public class PopupNotificationActivity extends Activity implements NotificationC
double lat = geoPoint.lat;
double lon = geoPoint._long;
if (NekomuraConfig.mapPreviewProvider.Int() == 0) {
if (NekoConfig.mapPreviewProvider.Int() == 0) {
imageView.setImage(ImageLocation.getForWebFile(WebFile.createWithGeoPoint(geoPoint, 100, 100, 15, Math.min(2, (int) Math.ceil(AndroidUtilities.density)))), null, null, null, messageObject);
} else {
String currentUrl = AndroidUtilities.formapMapUrl(false, lat, lon, 100, 100, true, 15);

View File

@ -179,9 +179,9 @@ import cn.hutool.core.util.RuntimeUtil;
import cn.hutool.core.util.StrUtil;
import kotlin.Unit;
import libv2ray.Libv2ray;
import tw.nekomimi.nekogram.BottomBuilder;
import tw.nekomimi.nekogram.ui.BottomBuilder;
import tw.nekomimi.nekogram.InternalUpdater;
import tw.nekomimi.nkmr.NekomuraConfig;
import tw.nekomimi.nekogram.NekoConfig;
import tw.nekomimi.nekogram.NekoXConfig;
import tw.nekomimi.nekogram.settings.NekoXSettingActivity;
import tw.nekomimi.nekogram.parts.DialogTransKt;
@ -1975,7 +1975,7 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter.
avatarContainer2.setPivotX(avatarContainer2.getMeasuredWidth() / 2f);
AndroidUtilities.updateViewVisibilityAnimated(avatarContainer2, !expanded, 0.95f, true);
if (Math.min(1f, extraHeight / AndroidUtilities.dp(88f)) > 0.85 && !searchMode && NekomuraConfig.showIdAndDc.Bool())
if (Math.min(1f, extraHeight / AndroidUtilities.dp(88f)) > 0.85 && !searchMode && NekoConfig.showIdAndDc.Bool())
idTextView.setVisibility(expanded ? INVISIBLE : VISIBLE);
callItem.setVisibility(expanded || !callItemVisible ? GONE : INVISIBLE);
@ -4849,7 +4849,7 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter.
nameTextView[a].setScaleY(nameScale);
}
if (diff > 0.85 && !searchMode && NekomuraConfig.showIdAndDc.Bool()) {
if (diff > 0.85 && !searchMode && NekoConfig.showIdAndDc.Bool()) {
idTextView.setVisibility(View.VISIBLE);
} else {
idTextView.setVisibility(View.GONE);
@ -6800,7 +6800,7 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter.
avatarContainer.setVisibility(View.VISIBLE);
nameTextView[1].setVisibility(View.VISIBLE);
onlineTextView[1].setVisibility(View.VISIBLE);
if (Math.min(1f, extraHeight / AndroidUtilities.dp(88f)) > 0.85 && !searchMode && NekomuraConfig.showIdAndDc.Bool())
if (Math.min(1f, extraHeight / AndroidUtilities.dp(88f)) > 0.85 && !searchMode && NekoConfig.showIdAndDc.Bool())
idTextView.setVisibility(View.VISIBLE);
actionBar.onSearchFieldVisibilityChanged(searchTransitionProgress > 0.5f);

View File

@ -91,7 +91,7 @@ import cn.hutool.core.thread.ThreadUtil;
import cn.hutool.core.util.StrUtil;
import kotlin.Unit;
import okhttp3.HttpUrl;
import tw.nekomimi.nekogram.BottomBuilder;
import tw.nekomimi.nekogram.ui.BottomBuilder;
import tw.nekomimi.nekogram.proxy.ShadowsocksRSettingsActivity;
import tw.nekomimi.nekogram.proxy.ShadowsocksSettingsActivity;
import tw.nekomimi.nekogram.proxy.SubSettingsActivity;
@ -105,7 +105,7 @@ import tw.nekomimi.nekogram.utils.AlertUtil;
import tw.nekomimi.nekogram.utils.FileUtil;
import tw.nekomimi.nekogram.utils.ProxyUtil;
import tw.nekomimi.nekogram.utils.UIUtil;
import tw.nekomimi.nkmr.NekomuraConfig;
import tw.nekomimi.nekogram.NekoConfig;
public class ProxyListActivity extends BaseFragment implements NotificationCenter.NotificationCenterDelegate {
@ -685,7 +685,7 @@ public class ProxyListActivity extends BaseFragment implements NotificationCente
updateRows(true);
} else if (position == enablePublicProxyRow) {
final boolean enabled = NekomuraConfig.enablePublicProxy.toggleConfigBool();
final boolean enabled = NekoConfig.enablePublicProxy.toggleConfigBool();
TextCheckCell cell = (TextCheckCell) view;
cell.setChecked(enabled);
UIUtil.runOnIoDispatcher(() -> {
@ -1178,7 +1178,7 @@ public class ProxyListActivity extends BaseFragment implements NotificationCente
} else if (position == callsRow) {
checkCell.setTextAndCheck(LocaleController.getString("UseProxyForCalls", R.string.UseProxyForCalls), useProxyForCalls, false);
} else if (position == enablePublicProxyRow) {
checkCell.setTextAndCheck(LocaleController.getString("enablePublicProxy", R.string.enablePublicProxy), NekomuraConfig.enablePublicProxy.Bool(), false);
checkCell.setTextAndCheck(LocaleController.getString("enablePublicProxy", R.string.enablePublicProxy), NekoConfig.enablePublicProxy.Bool(), false);
}
break;
}
@ -1213,7 +1213,7 @@ public class ProxyListActivity extends BaseFragment implements NotificationCente
} else if (position == callsRow) {
checkCell.setChecked(useProxyForCalls);
} else if (position == enablePublicProxyRow) {
checkCell.setChecked(NekomuraConfig.enablePublicProxy.Bool());
checkCell.setChecked(NekoConfig.enablePublicProxy.Bool());
}
} else {
super.onBindViewHolder(holder, position, payloads);
@ -1231,7 +1231,7 @@ public class ProxyListActivity extends BaseFragment implements NotificationCente
} else if (position == callsRow) {
checkCell.setChecked(useProxyForCalls);
} else if (position == enablePublicProxyRow) {
checkCell.setChecked(NekomuraConfig.enablePublicProxy.Bool());
checkCell.setChecked(NekoConfig.enablePublicProxy.Bool());
}
}
}

View File

@ -11,16 +11,12 @@ package org.telegram.ui;
import android.Manifest;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.SharedPreferences;
import android.content.pm.PackageManager;
import android.graphics.PorterDuff;
import android.graphics.PorterDuffColorFilter;
import android.net.Uri;
import android.os.Build;
import android.text.SpannableStringBuilder;
import android.text.Spanned;
import android.text.style.ImageSpan;
import android.util.Base64;
import android.util.TypedValue;
import android.view.Gravity;
@ -37,9 +33,7 @@ import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import org.telegram.messenger.AndroidUtilities;
import org.telegram.messenger.BuildConfig;
import org.telegram.messenger.FileLog;
import org.telegram.messenger.ApplicationLoader;
import org.telegram.messenger.DocumentObject;
import org.telegram.messenger.ImageLocation;
import org.telegram.messenger.LocaleController;
@ -72,11 +66,8 @@ import org.telegram.ui.Components.ColoredImageSpan;
import org.telegram.ui.Components.EmptyTextProgressView;
import org.telegram.ui.Components.FlickerLoadingView;
import org.telegram.ui.Components.LayoutHelper;
import org.telegram.ui.Components.RLottieImageView;
import org.telegram.ui.Components.RecyclerItemsEnterAnimator;
import org.telegram.ui.Components.RecyclerListView;
import org.telegram.ui.Components.ReplaceableIconDrawable;
import org.telegram.ui.Components.SlideChooseView;
import org.telegram.ui.Components.URLSpanNoUnderline;
import org.telegram.ui.Components.UndoView;
@ -84,9 +75,6 @@ import java.util.ArrayList;
import androidx.annotation.NonNull;
import androidx.core.content.ContextCompat;
import kotlin.Unit;
import tw.nekomimi.nekogram.BottomBuilder;
import tw.nekomimi.nekogram.utils.AlertUtil;
public class SessionsActivity extends BaseFragment implements NotificationCenter.NotificationCenterDelegate {

View File

@ -92,9 +92,9 @@ import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicReference;
import kotlin.Unit;
import tw.nekomimi.nekogram.BottomBuilder;
import tw.nekomimi.nkmr.NekomuraConfig;
import tw.nekomimi.nekogram.PinnedStickerHelper;
import tw.nekomimi.nekogram.ui.BottomBuilder;
import tw.nekomimi.nekogram.NekoConfig;
import tw.nekomimi.nekogram.ui.PinnedStickerHelper;
import tw.nekomimi.nekogram.utils.AlertUtil;
import tw.nekomimi.nekogram.utils.FileUtil;
import tw.nekomimi.nekogram.utils.ShareUtil;
@ -162,7 +162,7 @@ public class StickersActivity extends BaseFragment implements NotificationCenter
if (source.getItemViewType() != target.getItemViewType()) {
return false;
}
if (NekomuraConfig.enableStickerPin.Bool() && currentType == MediaDataController.TYPE_IMAGE) {
if (NekoConfig.enableStickerPin.Bool() && currentType == MediaDataController.TYPE_IMAGE) {
int from = source.getAdapterPosition();
int to = target.getAdapterPosition();
if (from < stickersStartRow + listAdapter.pinnedStickersCount) {
@ -633,7 +633,7 @@ public class StickersActivity extends BaseFragment implements NotificationCenter
final MediaDataController mediaDataController = MediaDataController.getInstance(currentAccount);
final List<TLRPC.TL_messages_stickerSet> newList = mediaDataController.getStickerSets(currentType);
if (MediaDataController.TYPE_IMAGE == currentType && NekomuraConfig.enableStickerPin.Bool()) {
if (MediaDataController.TYPE_IMAGE == currentType && NekoConfig.enableStickerPin.Bool()) {
PinnedStickerHelper.getInstance(currentAccount).reorderPinnedStickers(newList);
}
@ -787,7 +787,7 @@ public class StickersActivity extends BaseFragment implements NotificationCenter
public ListAdapter(Context context, List<TLRPC.TL_messages_stickerSet> stickerSets) {
mContext = context;
List<TLRPC.TL_messages_stickerSet> temp = new ArrayList<>(stickerSets);
if (MediaDataController.TYPE_IMAGE == currentType && NekomuraConfig.enableStickerPin.Bool()) {
if (MediaDataController.TYPE_IMAGE == currentType && NekoConfig.enableStickerPin.Bool()) {
if (PinnedStickerHelper.getInstance(currentAccount).reorderPinnedStickers(stickerSets)) {
// Sync is needed
// AndroidUtilities.runOnUIThread(() -> {
@ -803,7 +803,7 @@ public class StickersActivity extends BaseFragment implements NotificationCenter
public void setStickerSets(List<TLRPC.TL_messages_stickerSet> stickerSets) {
this.stickerSets.clear();
// if (MediaDataController.TYPE_IMAGE == currentType && NekomuraConfig.enableStickerPin.Bool()) {
// if (MediaDataController.TYPE_IMAGE == currentType && NekoConfig.enableStickerPin.Bool()) {
// pinnedStickersCount = PinnedStickerHelper.getInstance(currentAccount).reorderPinnedStickers(stickerSets);
// }
this.stickerSets.addAll(stickerSets);
@ -949,14 +949,14 @@ public class StickersActivity extends BaseFragment implements NotificationCenter
private void processSelectionOption(int which, TLRPC.TL_messages_stickerSet stickerSet) {
if (which == MENU_ARCHIVE) {
MediaDataController.getInstance(currentAccount).toggleStickerSet(getParentActivity(), stickerSet, !stickerSet.set.archived ? 1 : 2, StickersActivity.this, true, true);
if (NekomuraConfig.enableStickerPin.Bool() && currentType == MediaDataController.TYPE_IMAGE) {
if (NekoConfig.enableStickerPin.Bool() && currentType == MediaDataController.TYPE_IMAGE) {
// Sticker will be removed from local list in toggleStickerSet
pinnedStickersCount--;
setStickerSetCellPinnedMarkVisibility(stickerSet.set.id, false);
}
} else if (which == MENU_DELETE) {
MediaDataController.getInstance(currentAccount).toggleStickerSet(getParentActivity(), stickerSet, 0, StickersActivity.this, true, true);
if (NekomuraConfig.enableStickerPin.Bool() && currentType == MediaDataController.TYPE_IMAGE) {
if (NekoConfig.enableStickerPin.Bool() && currentType == MediaDataController.TYPE_IMAGE) {
pinnedStickersCount--;
setStickerSetCellPinnedMarkVisibility(stickerSet.set.id, false);
}
@ -983,7 +983,7 @@ public class StickersActivity extends BaseFragment implements NotificationCenter
if (index >= 0) {
listAdapter.toggleSelected(stickersStartRow + index);
}
} else if (which == MENU_TOGGLE_PIN && NekomuraConfig.enableStickerPin.Bool() && currentType == MediaDataController.TYPE_IMAGE) {
} else if (which == MENU_TOGGLE_PIN && NekoConfig.enableStickerPin.Bool() && currentType == MediaDataController.TYPE_IMAGE) {
final PinnedStickerHelper ins = PinnedStickerHelper.getInstance(currentAccount);
final MediaDataController mediaDataController = MediaDataController.getInstance(currentAccount);
if (ins.isPinned(stickerSet.set.id)) {
@ -1158,7 +1158,7 @@ public class StickersActivity extends BaseFragment implements NotificationCenter
};
icons = new int[]{R.drawable.baseline_archive_24, R.drawable.msg_reorder};
} else {
if (NekomuraConfig.enableStickerPin.Bool() && currentType == MediaDataController.TYPE_IMAGE) {
if (NekoConfig.enableStickerPin.Bool() && currentType == MediaDataController.TYPE_IMAGE) {
options = new int[]{MENU_ARCHIVE, 3, 4, 2, MENU_DELETE, MENU_TOGGLE_PIN};
items = new CharSequence[]{
LocaleController.getString("StickersHide", R.string.StickersHide),

View File

@ -12,7 +12,6 @@ import android.content.Context;
import android.content.DialogInterface;
import android.graphics.Typeface;
import android.os.Bundle;
import android.os.Vibrator;
import android.text.InputType;
import android.text.TextUtils;
import android.text.method.PasswordTransformationMethod;
@ -64,7 +63,7 @@ import org.telegram.ui.Components.RecyclerListView;
import java.util.ArrayList;
import java.util.Locale;
import tw.nekomimi.nekogram.EditTextAutoFill;
import tw.nekomimi.nekogram.ui.EditTextAutoFill;
import tw.nekomimi.nekogram.utils.VibrateUtil;
public class TwoStepVerificationActivity extends BaseFragment implements NotificationCenter.NotificationCenterDelegate {

View File

@ -23,7 +23,6 @@ import android.graphics.Rect;
import android.graphics.Typeface;
import android.os.Build;
import android.os.Bundle;
import android.os.Vibrator;
import android.text.Editable;
import android.text.InputType;
import android.text.TextUtils;
@ -46,8 +45,6 @@ import android.widget.ScrollView;
import android.widget.TextView;
import android.widget.Toast;
import com.google.android.exoplayer2.util.Log;
import org.telegram.messenger.AndroidUtilities;
import org.telegram.messenger.FileLog;
import org.telegram.messenger.LocaleController;
@ -75,7 +72,7 @@ import org.telegram.ui.Components.RLottieImageView;
import java.util.ArrayList;
import tw.nekomimi.nekogram.EditTextAutoFill;
import tw.nekomimi.nekogram.ui.EditTextAutoFill;
import tw.nekomimi.nekogram.utils.VibrateUtil;
public class TwoStepVerificationSetupActivity extends BaseFragment {

View File

@ -7,7 +7,6 @@ import android.content.Context;
import android.content.Intent;
import android.net.Uri;
import android.os.Build;
import android.util.Base64;
import android.widget.Toast;
import androidx.core.content.FileProvider;
@ -26,16 +25,10 @@ import org.telegram.ui.ActionBar.AlertDialog;
import java.io.File;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Locale;
import cn.hutool.http.HttpRequest;
import cn.hutool.http.HttpUtil;
import tw.nekomimi.nekogram.utils.FileUtil;
import tw.nekomimi.nkmr.CellGroup;
import tw.nekomimi.nkmr.NekomuraConfig;
import tw.nekomimi.nkmr.NekomuraUtil;
import tw.nekomimi.nkmr.cells.NekomuraTGSelectBox;
//TODO use UpdateAppAlertDialog / BlockingUpdateView?
@ -129,31 +122,7 @@ public class InternalUpdater {
final ApkMetadata apk = matchBuild(release.assets);
// match apk urls. these can be empty.
String urlChannel = "";
String sha1 = "";
try {
final String newBody = HttpUtil.get("https://api.github.com/repos/NekoX-Dev/updates/contents/" + release.name + ".txt?ref=main");
final GithubApiContents releaseNoteApi = new Gson().fromJson(newBody, GithubApiContents.class);
final String releaseNoteString = new String(Base64.decode(releaseNoteApi.content, Base64.DEFAULT));
final byte[] gzipped = Base64.decode(NekomuraUtil.getSubString(releaseNoteString, "#NekoXStart#", "#NekoXEnd#"), Base64.NO_PADDING);
final NekoXReleaseNote nekoXReleaseNote = new Gson().fromJson(new String(NekomuraUtil.uncompress(gzipped)), NekoXReleaseNote.class);
if (nekoXReleaseNote != null && nekoXReleaseNote.apks != null) {
for (NekoXAPK napk : nekoXReleaseNote.apks) {
if (napk.name.equals(apk.name)) {
sha1 = napk.sha1;
for (String url : napk.urls) {
if (url.startsWith("https://t.me/")) urlChannel = url;
}
break;
}
}
}
} catch (Exception ignored) {
}
String finalsha1 = sha1;
String finalUrlChannel = urlChannel;
ReleaseMetadata finalRelease = release;
AndroidUtilities.runOnUIThread(() -> {
@ -173,9 +142,7 @@ public class InternalUpdater {
builder.setMessage(message);
builder.setPositiveButton(LocaleController.getString("VersionUpdateConfirm", R.string.VersionUpdateConfirm), (dialog, which) -> {
showSelectDownloadSource(ctx, apk != null ? apk.name : finalRelease.name,
apk != null ? apk.browser_download_url : finalRelease.html_url,
finalUrlChannel, finalsha1);
Browser.openUrl(ctx, apk.browser_download_url);
});
builder.setNeutralButton(LocaleController.getString("VersionUpdateIgnore", R.string.VersionUpdateIgnore), (dialog, which) -> NekoXConfig.setIgnoredUpdateTag(finalRelease.name));
builder.setNegativeButton(LocaleController.getString("VersionUpdateNotNow", R.string.VersionUpdateNotNow), (dialog, which) -> NekoXConfig.setNextUpdateCheck(System.currentTimeMillis() / 1000 + 3 * 24 * 3600));
@ -188,33 +155,6 @@ public class InternalUpdater {
}
}
public static void showSelectDownloadSource(Context ctx, String title, String browser_download_url, String urlChannel, String sha1) {
CellGroup nkmrCells = new CellGroup(null);
nkmrCells.callBackSettingsChanged = ((k, v) -> {
int source = NekomuraConfig.update_download_soucre.Int();
switch (source) {
case 0:
Browser.openUrl(ctx, browser_download_url);
break;
case 1:
Browser.openUrl(ctx, urlChannel);
break;
}
});
ArrayList<String> sources = new ArrayList<>();
sources.add("Github Release"); // base of Current
if (!urlChannel.isEmpty()) sources.add("Telegram Channel");
String[] sources_ = new String[sources.size()];
sources.toArray(sources_);
NekomuraTGSelectBox sb = new NekomuraTGSelectBox(null, NekomuraConfig.update_download_soucre, sources_, null);
nkmrCells.appendCell(sb); // new
sb.onClickWithDialog(ctx);
}
public static boolean openApkInstall(Activity activity, File f) {
if (!checkApkInstallPermissions(activity)) {
return false;

View File

@ -1,151 +1,460 @@
package tw.nekomimi.nekogram;
import android.Manifest;
import android.annotation.SuppressLint;
import android.app.Activity;
import android.content.Intent;
import android.content.Context;
import android.content.SharedPreferences;
import android.content.pm.ApplicationInfo;
import android.content.pm.PackageManager;
import android.content.res.Configuration;
import android.graphics.Typeface;
import android.os.Build;
import org.telegram.messenger.AndroidUtilities;
import org.telegram.messenger.ApplicationLoader;
import org.telegram.messenger.BuildVars;
import org.telegram.messenger.FileLog;
import org.telegram.messenger.LocaleController;
import org.telegram.messenger.NotificationCenter;
import org.telegram.messenger.NotificationsService;
import org.telegram.messenger.R;
import org.telegram.ui.ActionBar.Theme;
import java.io.BufferedReader;
import java.io.FileReader;
import java.util.Locale;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import java.io.ByteArrayInputStream;
import java.io.ObjectInputStream;
import java.util.ArrayList;
import android.util.Base64;
import cn.hutool.core.util.StrUtil;
import tw.nekomimi.nkmr.NekomuraConfig;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Set;
import tw.nekomimi.nekogram.config.ConfigItem;
import static tw.nekomimi.nekogram.config.ConfigItem.*;
@SuppressLint("ApplySharedPref")
public class NekoConfig {
public static final int TITLE_TYPE_TEXT = 0;
public static final int TITLE_TYPE_ICON = 1;
public static final int TITLE_TYPE_MIX = 2;
public static final SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("nkmrcfg", Context.MODE_PRIVATE);
public static final Object sync = new Object();
public static boolean forceSystemPicker = false; // SDK23+ and no storage permission
private static boolean configLoaded = false;
private static final ArrayList<ConfigItem> configs = new ArrayList<>();
public static String getOpenPGPAppName() {
// Configs
public static ConfigItem migrate = addConfig("NekoConfigMigrate", configTypeBool, false);
public static ConfigItem largeAvatarInDrawer = addConfig("AvatarAsBackground", configTypeInt, 0); // 0:TG Default 1:NekoX Default 2:Large Avatar
public static ConfigItem unreadBadgeOnBackButton = addConfig("unreadBadgeOnBackButton", configTypeBool, false);
public static ConfigItem customPublicProxyIP = addConfig("customPublicProxyIP", configTypeString, "");
public static ConfigItem update_download_soucre = addConfig("update_download_soucre", configTypeInt, 0); // 0: Github 1: Channel 2:CDNDrive, removed
public static ConfigItem useCustomEmoji = addConfig("useCustomEmoji", configTypeBool, false);
public static ConfigItem repeatConfirm = addConfig("repeatConfirm", configTypeBool, false);
public static ConfigItem disableInstantCamera = addConfig("DisableInstantCamera", configTypeBool, false);
public static ConfigItem showSeconds = addConfig("showSeconds", configTypeBool, false);
if (StrUtil.isNotBlank(NekomuraConfig.openPGPApp.String())) {
public static ConfigItem enablePublicProxy = addConfig("enablePublicProxy", configTypeBool, true);
public static ConfigItem autoUpdateSubInfo = addConfig("autoUpdateSubInfo", configTypeBool, true);
try {
PackageManager manager = ApplicationLoader.applicationContext.getPackageManager();
ApplicationInfo info = manager.getApplicationInfo(NekomuraConfig.openPGPApp.String(), PackageManager.GET_META_DATA);
return (String) manager.getApplicationLabel(info);
} catch (PackageManager.NameNotFoundException e) {
NekomuraConfig.openPGPApp.setConfigString("");
}
// From NekoConfig
public static ConfigItem useIPv6 = addConfig("IPv6", configTypeBool, false);
public static ConfigItem hidePhone = addConfig("HidePhone", configTypeBool, true);
public static ConfigItem ignoreBlocked = addConfig("IgnoreBlocked", configTypeBool, false);
public static ConfigItem tabletMode = addConfig("TabletMode", configTypeInt, 0);
public static ConfigItem inappCamera = addConfig("DebugMenuEnableCamera", configTypeBool, true); // fake
public static ConfigItem smoothKeyboard = addConfig("DebugMenuEnableSmoothKeyboard", configTypeBool, false);// fake
}
public static ConfigItem typeface = addConfig("TypefaceUseDefault", configTypeBool, false);
public static ConfigItem nameOrder = addConfig("NameOrder", configTypeInt, 1);
public static ConfigItem mapPreviewProvider = addConfig("MapPreviewProvider", configTypeInt, 0);
public static ConfigItem transparentStatusBar = addConfig("TransparentStatusBar", configTypeBool, false);
public static ConfigItem hideProxySponsorChannel = addConfig("HideProxySponsorChannel", configTypeBool, false);
public static ConfigItem showAddToSavedMessages = addConfig("showAddToSavedMessages", configTypeBool, true);
public static ConfigItem showReport = addConfig("showReport", configTypeBool, true);
public static ConfigItem showViewHistory = addConfig("showViewHistory", configTypeBool, true);
public static ConfigItem showAdminActions = addConfig("showAdminActions", configTypeBool, true);
public static ConfigItem showChangePermissions = addConfig("showChangePermissions", configTypeBool, true);
public static ConfigItem showDeleteDownloadedFile = addConfig("showDeleteDownloadedFile", configTypeBool, true);
public static ConfigItem showMessageDetails = addConfig("showMessageDetails", configTypeBool, false);
public static ConfigItem showTranslate = addConfig("showTranslate", configTypeBool, true);
public static ConfigItem showRepeat = addConfig("showRepeat", configTypeBool, false);
public static ConfigItem showShareMessages = addConfig("showShareMessages", configTypeBool, false);
public static ConfigItem showMessageHide = addConfig("showMessageHide", configTypeBool, false);
return LocaleController.getString("None", R.string.None);
public static ConfigItem eventType = addConfig("eventType", configTypeInt, 0);
public static ConfigItem actionBarDecoration = addConfig("ActionBarDecoration", configTypeInt, 0);
public static ConfigItem newYear = addConfig("ChristmasHat", configTypeBool, false);
public static ConfigItem stickerSize = addConfig("stickerSize", configTypeFloat, 14.0f);
public static ConfigItem unlimitedFavedStickers = addConfig("UnlimitedFavoredStickers", configTypeBool, false);
public static ConfigItem unlimitedPinnedDialogs = addConfig("UnlimitedPinnedDialogs", configTypeBool, false);
public static ConfigItem translationProvider = addConfig("translationProvider", configTypeInt, 1);
public static ConfigItem disablePhotoSideAction = addConfig("DisablePhotoViewerSideAction", configTypeBool, true);
public static ConfigItem openArchiveOnPull = addConfig("OpenArchiveOnPull", configTypeBool, false);
public static ConfigItem hideKeyboardOnChatScroll = addConfig("HideKeyboardOnChatScroll", configTypeBool, false);
public static ConfigItem avatarBackgroundBlur = addConfig("BlurAvatarBackground", configTypeBool, false);
public static ConfigItem avatarBackgroundDarken = addConfig("DarkenAvatarBackground", configTypeBool, false);
public static ConfigItem useSystemEmoji = addConfig("EmojiUseDefault", configTypeBool, false);
public static ConfigItem showTabsOnForward = addConfig("ShowTabsOnForward", configTypeBool, false);
public static ConfigItem rearVideoMessages = addConfig("RearVideoMessages", configTypeBool, false);
public static ConfigItem hideAllTab = addConfig("HideAllTab", configTypeBool, false);
public static ConfigItem pressTitleToOpenAllChats = addConfig("pressTitleToOpenAllChats", configTypeBool, false);
}
public static ConfigItem disableChatAction = addConfig("DisableChatAction", configTypeBool, false);
public static ConfigItem sortByUnread = addConfig("sort_by_unread", configTypeBool, false);
public static ConfigItem sortByUnmuted = addConfig("sort_by_unmuted", configTypeBool, true);
public static ConfigItem sortByUser = addConfig("sort_by_user", configTypeBool, true);
public static ConfigItem sortByContacts = addConfig("sort_by_contacts", configTypeBool, true);
public static String formatLang(String name) {
public static ConfigItem disableUndo = addConfig("DisableUndo", configTypeBool, false);
if (name == null || name.isEmpty()) {
public static ConfigItem filterUsers = addConfig("filter_users", configTypeBool, true);
public static ConfigItem filterContacts = addConfig("filter_contacts", configTypeBool, true);
public static ConfigItem filterGroups = addConfig("filter_groups", configTypeBool, true);
public static ConfigItem filterChannels = addConfig("filter_channels", configTypeBool, true);
public static ConfigItem filterBots = addConfig("filter_bots", configTypeBool, true);
public static ConfigItem filterAdmins = addConfig("filter_admins", configTypeBool, true);
public static ConfigItem filterUnmuted = addConfig("filter_unmuted", configTypeBool, true);
public static ConfigItem filterUnread = addConfig("filter_unread", configTypeBool, true);
public static ConfigItem filterUnmutedAndUnread = addConfig("filter_unmuted_and_unread", configTypeBool, true);
return LocaleController.getString("Default", R.string.Default);
public static ConfigItem disableSystemAccount = addConfig("DisableSystemAccount", configTypeBool, false);
// public static ConfigItem disableProxyWhenVpnEnabled = addConfig("DisableProxyWhenVpnEnabled", configTypeBool, false);
public static ConfigItem skipOpenLinkConfirm = addConfig("SkipOpenLinkConfirm", configTypeBool, false);
} else {
public static ConfigItem ignoreMutedCount = addConfig("IgnoreMutedCount", configTypeBool, true);
public static ConfigItem useDefaultTheme = addConfig("UseDefaultTheme", configTypeBool, false);
public static ConfigItem showIdAndDc = addConfig("ShowIdAndDc", configTypeBool, false);
if (name.contains("-")) {
public static ConfigItem googleCloudTranslateKey = addConfig("GoogleCloudTransKey", configTypeString, "");
public static ConfigItem cachePath = addConfig("cache_path", configTypeString, "");
return new Locale(StrUtil.subBefore(name, "-", false), StrUtil.subAfter(name, "-", false)).getDisplayName(LocaleController.getInstance().currentLocale);
public static ConfigItem translateToLang = addConfig("TransToLang", configTypeString, ""); // "" -> translate to current language (MessageTrans.kt & Translator.kt)
public static ConfigItem translateInputLang = addConfig("TransInputToLang", configTypeString, "en");
} else {
public static ConfigItem ccToLang = addConfig("opencc_to_lang", configTypeString, "");
public static ConfigItem ccInputLang = addConfig("opencc_input_to_lang", configTypeString, "");
return new Locale(name).getDisplayName(LocaleController.getInstance().currentLocale);
public static ConfigItem tabsTitleType = addConfig("TabTitleType", configTypeInt, NekoXConfig.TITLE_TYPE_TEXT);
public static ConfigItem confirmAVMessage = addConfig("ConfirmAVMessage", configTypeBool, false);
public static ConfigItem askBeforeCall = addConfig("AskBeforeCalling", configTypeBool, false);
public static ConfigItem disableNumberRounding = addConfig("DisableNumberRounding", configTypeBool, false);
}
public static ConfigItem useSystemDNS = addConfig("useSystemDNS", configTypeBool, false);
public static ConfigItem customDoH = addConfig("customDoH", configTypeString, "");
public static ConfigItem hideProxyByDefault = addConfig("HideProxyByDefault", configTypeBool, false);
public static ConfigItem useProxyItem = addConfig("UseProxyItem", configTypeBool, true);
}
public static ConfigItem disableAppBarShadow = addConfig("DisableAppBarShadow", configTypeBool, false);
public static ConfigItem mediaPreview = addConfig("MediaPreview", configTypeBool, true);
}
public static ConfigItem proxyAutoSwitch = addConfig("ProxyAutoSwitch", configTypeBool, false);
public static ConfigItem usePersianCalendar = addConfig("UsePersiancalendar", configTypeBool, false);
public static ConfigItem displayPersianCalendarByLatin = addConfig("DisplayPersianCalendarByLatin", configTypeBool, false);
public static ConfigItem openPGPApp = addConfig("OpenPGPApp", configTypeString, "");
public static ConfigItem openPGPKeyId = addConfig("OpenPGPKey", configTypeLong, 0L);
public static ConfigItem disableVibration = addConfig("DisableVibration", configTypeBool, false);
public static ConfigItem autoPauseVideo = addConfig("AutoPauseVideo", configTypeBool, false);
public static ConfigItem disableProximityEvents = addConfig("DisableProximityEvents", configTypeBool, false);
public static ConfigItem ignoreContentRestrictions = addConfig("ignoreContentRestrictions", configTypeBool, !BuildVars.isPlay);
public static ConfigItem useChatAttachMediaMenu = addConfig("UseChatAttachEnterMenu", configTypeBool, true);
public static ConfigItem disableLinkPreviewByDefault = addConfig("DisableLinkPreviewByDefault", configTypeBool, false);
public static ConfigItem sendCommentAfterForward = addConfig("SendCommentAfterForward", configTypeBool, true);
public static ConfigItem increaseVoiceMessageQuality = addConfig("IncreaseVoiceMessageQuality", configTypeBool, true);
public static ConfigItem disableTrending = addConfig("DisableTrending", configTypeBool, true);
public static ConfigItem dontSendGreetingSticker = addConfig("DontSendGreetingSticker", configTypeBool, false);
public static ConfigItem hideTimeForSticker = addConfig("HideTimeForSticker", configTypeBool, false);
public static ConfigItem takeGIFasVideo = addConfig("TakeGIFasVideo", configTypeBool, false);
public static ConfigItem maxRecentStickerCount = addConfig("maxRecentStickerCount", configTypeInt, 20);
public static ConfigItem disableSwipeToNext = addConfig("disableSwipeToNextChannel", configTypeBool, true);
public static ConfigItem disableRemoteEmojiInteractions = addConfig("disableRemoteEmojiInteractions", configTypeBool, true);
public static ConfigItem disableChoosingSticker = addConfig("disableChoosingSticker", configTypeBool, false);
public static ConfigItem hideGroupSticker = addConfig("hideGroupSticker", configTypeBool, false);
public static ConfigItem hideSponsoredMessage = addConfig("hideSponsoredMessage", configTypeBool, false);
public static ConfigItem rememberAllBackMessages = addConfig("rememberAllBackMessages", configTypeBool, false);
public static ConfigItem hideSendAsChannel = addConfig("hideSendAsChannel", configTypeBool, false);
public static ConfigItem disableAutoDownloadingWin32Executable = addConfig("Win32ExecutableFiles", configTypeBool, true);
public static ConfigItem disableAutoDownloadingArchive = addConfig("ArchiveFiles", configTypeBool, true);
public static ConfigItem enableStickerPin = addConfig("EnableStickerPin", configTypeBool, false);
public static ConfigItem useMediaStreamInVoip = addConfig("UseMediaStreamInVoip", configTypeBool, false);
public static ConfigItem customAudioBitrate = addConfig("customAudioBitrate", configTypeInt, 32);
public static ConfigItem disableGroupVoipAudioProcessing = addConfig("disableGroupVoipAudioProcessing", configTypeBool, false);
static {
checkForceSystemPicker();
loadConfig(false);
checkMigrate(false);
}
public static void checkForceSystemPicker() {
// TODO show alert?
// TODO not working: send photo (upstream bug)
if (Build.VERSION.SDK_INT >= 23 && ApplicationLoader.applicationContext.checkSelfPermission(Manifest.permission.READ_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED) {
forceSystemPicker = true;
BuildVars.NO_SCOPED_STORAGE = false;
}
public static ConfigItem addConfig(String k, int t, Object d) {
ConfigItem a = new ConfigItem(k, t, d);
configs.add(a);
return a;
}
public static void loadConfig(boolean force) {
synchronized (sync) {
if (configLoaded && !force) {
return;
}
for (int i = 0; i < configs.size(); i++) {
ConfigItem o = configs.get(i);
private static final String EMOJI_FONT_AOSP = "NotoColorEmoji.ttf";
public static boolean loadSystemEmojiFailed = false;
private static Typeface systemEmojiTypeface;
public static Typeface getSystemEmojiTypeface() {
if (!loadSystemEmojiFailed && systemEmojiTypeface == null) {
try {
Pattern p = Pattern.compile(">(.*emoji.*)</font>", Pattern.CASE_INSENSITIVE);
BufferedReader br = new BufferedReader(new FileReader("/system/etc/fonts.xml"));
String line;
while ((line = br.readLine()) != null) {
Matcher m = p.matcher(line);
if (m.find()) {
systemEmojiTypeface = Typeface.createFromFile("/system/fonts/" + m.group(1));
FileLog.d("emoji font file fonts.xml = " + m.group(1));
break;
if (o.type == configTypeBool) {
o.value = preferences.getBoolean(o.key, (boolean) o.defaultValue);
}
if (o.type == configTypeInt) {
o.value = preferences.getInt(o.key, (int) o.defaultValue);
}
if (o.type == configTypeLong) {
o.value = preferences.getLong(o.key, (Long) o.defaultValue);
}
if (o.type == configTypeFloat) {
o.value = preferences.getFloat(o.key, (Float) o.defaultValue);
}
if (o.type == configTypeString) {
o.value = preferences.getString(o.key, (String) o.defaultValue);
}
if (o.type == configTypeSetInt) {
Set<String> ss = preferences.getStringSet(o.key, new HashSet<>());
HashSet<Integer> si = new HashSet<>();
for (String s : ss) {
si.add(Integer.parseInt(s));
}
o.value = si;
}
if (o.type == configTypeMapIntInt) {
String cv = preferences.getString(o.key, "");
// Log.e("NC", String.format("Getting pref %s val %s", o.key, cv));
if (cv.length() == 0) {
o.value = new HashMap<Integer, Integer>();
} else {
try {
byte[] data = Base64.decode(cv, Base64.DEFAULT);
ObjectInputStream ois = new ObjectInputStream(
new ByteArrayInputStream(data));
o.value = (HashMap<Integer, Integer>) ois.readObject();
if (o.value == null) {
o.value = new HashMap<Integer, Integer>();
}
ois.close();
} catch (Exception e) {
o.value = new HashMap<Integer, Integer>();
}
}
}
br.close();
} catch (Exception e) {
FileLog.e(e);
}
if (systemEmojiTypeface == null) {
try {
systemEmojiTypeface = Typeface.createFromFile("/system/fonts/" + EMOJI_FONT_AOSP);
FileLog.d("emoji font file = " + EMOJI_FONT_AOSP);
} catch (Exception e) {
FileLog.e(e);
loadSystemEmojiFailed = true;
}
}
configLoaded = true;
}
return systemEmojiTypeface;
}
public static int getNotificationColor() {
int color = 0;
Configuration configuration = ApplicationLoader.applicationContext.getResources().getConfiguration();
boolean isDark = (configuration.uiMode & Configuration.UI_MODE_NIGHT_MASK) == Configuration.UI_MODE_NIGHT_YES;
if (isDark) {
color = 0xffffffff;
} else {
if (Theme.getActiveTheme().hasAccentColors()) {
color = Theme.getActiveTheme().getAccentColor(Theme.getActiveTheme().currentAccentId);
}
if (Theme.getActiveTheme().isDark() || color == 0) {
color = Theme.getColor(Theme.key_actionBarDefault);
}
// too bright
if (AndroidUtilities.computePerceivedBrightness(color) >= 0.721f) {
color = Theme.getColor(Theme.key_windowBackgroundWhiteBlueHeader) | 0xff000000;
}
}
return color;
}
public static void checkMigrate(boolean force) {
// TODO remove this after some versions.
if (migrate.Bool() || force)
return;
migrate.setConfigBool(true);
// NekoConfig.java read & migrate
SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("nekoconfig", Activity.MODE_PRIVATE);
if (preferences.contains("typeface"))
typeface.setConfigBool(preferences.getInt("typeface", 0) != 0);
if (preferences.contains("nameOrder"))
nameOrder.setConfigInt(preferences.getInt("nameOrder", 1));
if (preferences.contains("mapPreviewProvider"))
mapPreviewProvider.setConfigInt(preferences.getInt("mapPreviewProvider", 0));
if (preferences.contains("transparentStatusBar"))
transparentStatusBar.setConfigBool(preferences.getBoolean("transparentStatusBar", false));
if (preferences.contains("hideProxySponsorChannel"))
hideProxySponsorChannel.setConfigBool(preferences.getBoolean("hideProxySponsorChannel", false));
if (preferences.contains("showAddToSavedMessages"))
showAddToSavedMessages.setConfigBool(preferences.getBoolean("showAddToSavedMessages", true));
if (preferences.contains("showReport"))
showReport.setConfigBool(preferences.getBoolean("showReport", true));
if (preferences.contains("showViewHistory"))
showViewHistory.setConfigBool(preferences.getBoolean("showViewHistory", true));
if (preferences.contains("showAdminActions"))
showAdminActions.setConfigBool(preferences.getBoolean("showAdminActions", true));
if (preferences.contains("showChangePermissions"))
showChangePermissions.setConfigBool(preferences.getBoolean("showChangePermissions", true));
if (preferences.contains("showDeleteDownloadedFile"))
showDeleteDownloadedFile.setConfigBool(preferences.getBoolean("showDeleteDownloadedFile", true));
if (preferences.contains("showMessageDetails"))
showMessageDetails.setConfigBool(preferences.getBoolean("showMessageDetails", false));
if (preferences.contains("showTranslate"))
showTranslate.setConfigBool(preferences.getBoolean("showTranslate", true));
if (preferences.contains("showRepeat"))
showRepeat.setConfigBool(preferences.getBoolean("showRepeat", false));
if (preferences.contains("showShareMessages"))
showShareMessages.setConfigBool(preferences.getBoolean("showShareMessages", false));
if (preferences.contains("showMessageHide"))
showMessageHide.setConfigBool(preferences.getBoolean("showMessageHide", false));
if (preferences.contains("eventType"))
eventType.setConfigInt(preferences.getInt("eventType", 0));
if (preferences.contains("actionBarDecoration"))
actionBarDecoration.setConfigInt(preferences.getInt("actionBarDecoration", 0));
if (preferences.contains("newYear"))
newYear.setConfigBool(preferences.getBoolean("newYear", false));
if (preferences.contains("stickerSize"))
stickerSize.setConfigFloat(preferences.getFloat("stickerSize", 14.0f));
if (preferences.contains("unlimitedFavedStickers"))
unlimitedFavedStickers.setConfigBool(preferences.getBoolean("unlimitedFavedStickers", false));
if (preferences.contains("unlimitedPinnedDialogs"))
unlimitedPinnedDialogs.setConfigBool(preferences.getBoolean("unlimitedPinnedDialogs", false));
if (preferences.contains("translationProvider"))
translationProvider.setConfigInt(preferences.getInt("translationProvider", 1));
if (preferences.contains("disablePhotoSideAction"))
disablePhotoSideAction.setConfigBool(preferences.getBoolean("disablePhotoSideAction", true));
if (preferences.contains("openArchiveOnPull"))
openArchiveOnPull.setConfigBool(preferences.getBoolean("openArchiveOnPull", false));
if (preferences.contains("showHiddenFeature")) //showHiddenFeature.setConfigBool(preferences.getBoolean("showHiddenFeature", false));
if (preferences.contains("hideKeyboardOnChatScroll"))
hideKeyboardOnChatScroll.setConfigBool(preferences.getBoolean("hideKeyboardOnChatScroll", false));
if (preferences.contains("avatarBackgroundBlur"))
avatarBackgroundBlur.setConfigBool(preferences.getBoolean("avatarBackgroundBlur", false));
if (preferences.contains("avatarBackgroundDarken"))
avatarBackgroundDarken.setConfigBool(preferences.getBoolean("avatarBackgroundDarken", false));
if (preferences.contains("useSystemEmoji"))
useSystemEmoji.setConfigBool(preferences.getBoolean("useSystemEmoji", false));
if (preferences.contains("showTabsOnForward"))
showTabsOnForward.setConfigBool(preferences.getBoolean("showTabsOnForward", false));
if (preferences.contains("rearVideoMessages"))
rearVideoMessages.setConfigBool(preferences.getBoolean("rearVideoMessages", false));
if (preferences.contains("hideAllTab"))
hideAllTab.setConfigBool(preferences.getBoolean("hideAllTab", false));
if (preferences.contains("pressTitleToOpenAllChats"))
pressTitleToOpenAllChats.setConfigBool(preferences.getBoolean("pressTitleToOpenAllChats", false));
if (preferences.contains("disable_chat_action"))
disableChatAction.setConfigBool(preferences.getBoolean("disable_chat_action", false));
if (preferences.contains("sort_by_unread"))
sortByUnread.setConfigBool(preferences.getBoolean("sort_by_unread", false));
if (preferences.contains("sort_by_unmuted"))
sortByUnmuted.setConfigBool(preferences.getBoolean("sort_by_unmuted", true));
if (preferences.contains("sort_by_user"))
sortByUser.setConfigBool(preferences.getBoolean("sort_by_user", true));
if (preferences.contains("sort_by_contacts"))
sortByContacts.setConfigBool(preferences.getBoolean("sort_by_contacts", true));
if (preferences.contains("disable_undo"))
disableUndo.setConfigBool(preferences.getBoolean("disable_undo", false));
if (preferences.contains("filter_users"))
filterUsers.setConfigBool(preferences.getBoolean("filter_users", true));
if (preferences.contains("filter_contacts"))
filterContacts.setConfigBool(preferences.getBoolean("filter_contacts", true));
if (preferences.contains("filter_groups"))
filterGroups.setConfigBool(preferences.getBoolean("filter_groups", true));
if (preferences.contains("filter_channels"))
filterChannels.setConfigBool(preferences.getBoolean("filter_channels", true));
if (preferences.contains("filter_bots"))
filterBots.setConfigBool(preferences.getBoolean("filter_bots", true));
if (preferences.contains("filter_admins"))
filterAdmins.setConfigBool(preferences.getBoolean("filter_admins", true));
if (preferences.contains("filter_unmuted"))
filterUnmuted.setConfigBool(preferences.getBoolean("filter_unmuted", true));
if (preferences.contains("filter_unread"))
filterUnread.setConfigBool(preferences.getBoolean("filter_unread", true));
if (preferences.contains("filter_unmuted_and_unread"))
filterUnmutedAndUnread.setConfigBool(preferences.getBoolean("filter_unmuted_and_unread", true));
if (preferences.contains("disable_system_account"))
disableSystemAccount.setConfigBool(preferences.getBoolean("disable_system_account", false));
if (preferences.contains("skip_open_link_confirm"))
skipOpenLinkConfirm.setConfigBool(preferences.getBoolean("skip_open_link_confirm", false));
if (preferences.contains("ignore_muted_count"))
ignoreMutedCount.setConfigBool(preferences.getBoolean("ignore_muted_count", true));
if (preferences.contains("use_default_theme"))
useDefaultTheme.setConfigBool(preferences.getBoolean("use_default_theme", false));
if (preferences.contains("show_id_and_dc"))
showIdAndDc.setConfigBool(preferences.getBoolean("show_id_and_dc", false));
if (preferences.contains("google_cloud_translate_key"))
googleCloudTranslateKey.setConfigString(preferences.getString("google_cloud_translate_key", null));
if (preferences.contains("cache_path"))
cachePath.setConfigString(preferences.getString("cache_path", null));
if (preferences.contains("trans_to_lang"))
translateToLang.setConfigString(preferences.getString("trans_to_lang", ""));
if (preferences.contains("trans_input_to_lang"))
translateInputLang.setConfigString(preferences.getString("trans_input_to_lang", "en"));
if (preferences.contains("opencc_to_lang"))
ccToLang.setConfigString(preferences.getString("opencc_to_lang", null));
if (preferences.contains("opencc_input_to_lang"))
ccInputLang.setConfigString(preferences.getString("opencc_input_to_lang", null));
if (preferences.contains("tabsTitleType"))
tabsTitleType.setConfigInt(preferences.getInt("tabsTitleType", NekoXConfig.TITLE_TYPE_TEXT));
if (preferences.contains("confirmAVMessage"))
confirmAVMessage.setConfigBool(preferences.getBoolean("confirmAVMessage", false));
if (preferences.contains("askBeforeCall"))
askBeforeCall.setConfigBool(preferences.getBoolean("askBeforeCall", false));
if (preferences.contains("disableNumberRounding"))
disableNumberRounding.setConfigBool(preferences.getBoolean("disableNumberRounding", false));
if (preferences.contains("useSystemDNS"))
useSystemDNS.setConfigBool(preferences.getBoolean("useSystemDNS", false));
if (preferences.contains("customDoH"))
customDoH.setConfigString(preferences.getString("customDoH", ""));
if (preferences.contains("hide_proxy_by_default"))
hideProxyByDefault.setConfigBool(preferences.getBoolean("hide_proxy_by_default", false));
if (preferences.contains("use_proxy_item"))
useProxyItem.setConfigBool(preferences.getBoolean("use_proxy_item", true));
if (preferences.contains("disableAppBarShadow"))
disableAppBarShadow.setConfigBool(preferences.getBoolean("disableAppBarShadow", false));
if (preferences.contains("mediaPreview"))
mediaPreview.setConfigBool(preferences.getBoolean("mediaPreview", true));
if (preferences.contains("proxy_auto_switch"))
proxyAutoSwitch.setConfigBool(preferences.getBoolean("proxy_auto_switch", false));
if (preferences.contains("openPGPApp"))
openPGPApp.setConfigString(preferences.getString("openPGPApp", ""));
if (preferences.contains("openPGPKeyId"))
openPGPKeyId.setConfigLong(preferences.getLong("openPGPKeyId", 0L));
if (preferences.contains("disableVibration"))
disableVibration.setConfigBool(preferences.getBoolean("disableVibration", false));
if (preferences.contains("autoPauseVideo"))
autoPauseVideo.setConfigBool(preferences.getBoolean("autoPauseVideo", false));
if (preferences.contains("disableProximityEvents"))
disableProximityEvents.setConfigBool(preferences.getBoolean("disableProximityEvents", false));
if (preferences.contains("ignoreContentRestrictions"))
ignoreContentRestrictions.setConfigBool(preferences.getBoolean("ignoreContentRestrictions", !BuildVars.isPlay));
if (preferences.contains("useChatAttachMediaMenu"))
useChatAttachMediaMenu.setConfigBool(preferences.getBoolean("useChatAttachMediaMenu", true));
if (preferences.contains("disableLinkPreviewByDefault"))
disableLinkPreviewByDefault.setConfigBool(preferences.getBoolean("disableLinkPreviewByDefault", false));
if (preferences.contains("sendCommentAfterForward"))
sendCommentAfterForward.setConfigBool(preferences.getBoolean("sendCommentAfterForward", true));
if (preferences.contains("increaseVoiceMessageQuality"))
increaseVoiceMessageQuality.setConfigBool(preferences.getBoolean("increaseVoiceMessageQuality", true));
if (preferences.contains("disableTrending"))
disableTrending.setConfigBool(preferences.getBoolean("disableTrending", true));
if (preferences.contains("dontSendGreetingSticker"))
dontSendGreetingSticker.setConfigBool(preferences.getBoolean("dontSendGreetingSticker", false));
if (preferences.contains("hideTimeForSticker"))
hideTimeForSticker.setConfigBool(preferences.getBoolean("hideTimeForSticker", false));
if (preferences.contains("takeGIFasVideo"))
takeGIFasVideo.setConfigBool(preferences.getBoolean("takeGIFasVideo", false));
if (preferences.contains("maxRecentStickerCount"))
maxRecentStickerCount.setConfigInt(preferences.getInt("maxRecentStickerCount", 20));
if (preferences.contains("disableSwipeToNext"))
disableSwipeToNext.setConfigBool(preferences.getBoolean("disableSwipeToNext", true));
if (preferences.contains("disableRemoteEmojiInteractions"))
disableRemoteEmojiInteractions.setConfigBool(preferences.getBoolean("disableRemoteEmojiInteractions", true));
if (preferences.contains("disableChoosingSticker"))
disableChoosingSticker.setConfigBool(preferences.getBoolean("disableChoosingSticker", false));
if (preferences.contains("disableAutoDownloadingWin32Executable"))
disableAutoDownloadingWin32Executable.setConfigBool(preferences.getBoolean("disableAutoDownloadingWin32Executable", true));
if (preferences.contains("disableAutoDownloadingArchive"))
disableAutoDownloadingArchive.setConfigBool(preferences.getBoolean("disableAutoDownloadingArchive", true));
if (preferences.contains("enableStickerPin"))
enableStickerPin.setConfigBool(preferences.getBoolean("enableStickerPin", false));
if (preferences.contains("useMediaStreamInVoip"))
useMediaStreamInVoip.setConfigBool(preferences.getBoolean("useMediaStreamInVoip", false));
if (preferences.contains("customAudioBitrate"))
customAudioBitrate.setConfigInt(preferences.getInt("customAudioBitrate", 32));
if (preferences.contains("disableGroupVoipAudioProcessing"))
disableGroupVoipAudioProcessing.setConfigBool(preferences.getBoolean("disableGroupVoipAudioProcessing", false));
}
}

View File

@ -1,12 +1,32 @@
package tw.nekomimi.nekogram;
import android.Manifest;
import android.content.SharedPreferences;
import android.content.pm.ApplicationInfo;
import android.content.pm.PackageManager;
import android.content.res.Configuration;
import android.graphics.Typeface;
import android.os.Build;
import org.telegram.messenger.AndroidUtilities;
import org.telegram.messenger.ApplicationLoader;
import org.telegram.messenger.BuildConfig;
import org.telegram.messenger.BuildVars;
import org.telegram.messenger.FileLog;
import org.telegram.messenger.LocaleController;
import org.telegram.messenger.NotificationCenter;
import org.telegram.messenger.R;
import org.telegram.messenger.UserConfig;
import org.telegram.ui.ActionBar.Theme;
import java.io.BufferedReader;
import java.io.FileReader;
import java.util.Locale;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import cn.hutool.core.util.ArrayUtil;
import cn.hutool.core.util.StrUtil;
import tw.nekomimi.nekogram.database.NitritesKt;
public class NekoXConfig {
@ -25,6 +45,30 @@ public class NekoXConfig {
380570774, // Haruhi
};
public static final int TITLE_TYPE_TEXT = 0;
public static final int TITLE_TYPE_ICON = 1;
public static final int TITLE_TYPE_MIX = 2;
public static boolean forceSystemPicker = false; // SDK23+ and no storage permission
private static final String EMOJI_FONT_AOSP = "NotoColorEmoji.ttf";
public static boolean loadSystemEmojiFailed = false;
private static Typeface systemEmojiTypeface;
static {
checkForceSystemPicker();
}
public static void checkForceSystemPicker() {
// TODO show alert?
// TODO not working: send photo (upstream bug)
if (Build.VERSION.SDK_INT >= 23 && ApplicationLoader.applicationContext.checkSelfPermission(Manifest.permission.READ_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED) {
forceSystemPicker = true;
BuildVars.NO_SCOPED_STORAGE = false;
}
}
public static SharedPreferences preferences = NitritesKt.openMainSharedPreference("nekox_config");
public static boolean developerMode = preferences.getBoolean("developer_mode", false);
@ -39,6 +83,9 @@ public class NekoXConfig {
public static String ignoredUpdateTag = preferences.getString("ignoredUpdateTag", "");
public static long nextUpdateCheck = preferences.getLong("nextUpdateCheckTimestamp", 0);
public static int customApi = preferences.getInt("custom_api", 0);
public static int customAppId = preferences.getInt("custom_app_id", 0);
public static String customAppHash = preferences.getString("custom_app_hash", "");
public static void toggleDeveloperMode() {
preferences.edit().putBoolean("developer_mode", developerMode = !developerMode).apply();
@ -59,10 +106,6 @@ public class NekoXConfig {
preferences.edit().putBoolean("disable_screenshot_detection", disableScreenshotDetection = !disableScreenshotDetection).apply();
}
public static int customApi = preferences.getInt("custom_api", 0);
public static int customAppId = preferences.getInt("custom_app_id", 0);
public static String customAppHash = preferences.getString("custom_app_hash", "");
public static int currentAppId() {
switch (customApi) {
case 0:
@ -123,4 +166,81 @@ public class NekoXConfig {
long myId = UserConfig.getInstance(UserConfig.selectedAccount).clientUserId;
return NekoXConfig.developerMode || NekoXConfig.customApi > 0 || ArrayUtil.contains(NekoXConfig.developers, myId);
}
public static String getOpenPGPAppName() {
if (StrUtil.isNotBlank(NekoConfig.openPGPApp.String())) {
try {
PackageManager manager = ApplicationLoader.applicationContext.getPackageManager();
ApplicationInfo info = manager.getApplicationInfo(NekoConfig.openPGPApp.String(), PackageManager.GET_META_DATA);
return (String) manager.getApplicationLabel(info);
} catch (PackageManager.NameNotFoundException e) {
NekoConfig.openPGPApp.setConfigString("");
}
}
return LocaleController.getString("None", R.string.None);
}
public static String formatLang(String name) {
if (name == null || name.isEmpty()) {
return LocaleController.getString("Default", R.string.Default);
} else {
if (name.contains("-")) {
return new Locale(StrUtil.subBefore(name, "-", false), StrUtil.subAfter(name, "-", false)).getDisplayName(LocaleController.getInstance().currentLocale);
} else {
return new Locale(name).getDisplayName(LocaleController.getInstance().currentLocale);
}
}
}
public static Typeface getSystemEmojiTypeface() {
if (!loadSystemEmojiFailed && systemEmojiTypeface == null) {
try {
Pattern p = Pattern.compile(">(.*emoji.*)</font>", Pattern.CASE_INSENSITIVE);
BufferedReader br = new BufferedReader(new FileReader("/system/etc/fonts.xml"));
String line;
while ((line = br.readLine()) != null) {
Matcher m = p.matcher(line);
if (m.find()) {
systemEmojiTypeface = Typeface.createFromFile("/system/fonts/" + m.group(1));
FileLog.d("emoji font file fonts.xml = " + m.group(1));
break;
}
}
br.close();
} catch (Exception e) {
FileLog.e(e);
}
if (systemEmojiTypeface == null) {
try {
systemEmojiTypeface = Typeface.createFromFile("/system/fonts/" + EMOJI_FONT_AOSP);
FileLog.d("emoji font file = " + EMOJI_FONT_AOSP);
} catch (Exception e) {
FileLog.e(e);
loadSystemEmojiFailed = true;
}
}
}
return systemEmojiTypeface;
}
public static int getNotificationColor() {
int color = 0;
Configuration configuration = ApplicationLoader.applicationContext.getResources().getConfiguration();
boolean isDark = (configuration.uiMode & Configuration.UI_MODE_NIGHT_MASK) == Configuration.UI_MODE_NIGHT_YES;
if (isDark) {
color = 0xffffffff;
} else {
if (Theme.getActiveTheme().hasAccentColors()) {
color = Theme.getActiveTheme().getAccentColor(Theme.getActiveTheme().currentAccentId);
}
if (Theme.getActiveTheme().isDark() || color == 0) {
color = Theme.getColor(Theme.key_actionBarDefault);
}
// too bright
if (AndroidUtilities.computePerceivedBrightness(color) >= 0.721f) {
color = Theme.getColor(Theme.key_windowBackgroundWhiteBlueHeader) | 0xff000000;
}
}
return color;
}
}

View File

@ -64,7 +64,7 @@ public class SaveToDownloadReceiver extends BroadcastReceiver {
.setCategory(NotificationCompat.CATEGORY_STATUS)
.setProgress(100, 0, true)
.setSmallIcon(android.R.drawable.stat_sys_download)
.setColor(NekoConfig.getNotificationColor())
.setColor(NekoXConfig.getNotificationColor())
.setOngoing(true)
.addAction(R.drawable.ic_close_white, LocaleController.getString("Cancel", R.string.Cancel), pendingIntent);
callbacks.put(notificationId, callback);

View File

@ -1,4 +1,4 @@
package tw.nekomimi.nkmr;
package tw.nekomimi.nekogram.config;
import android.view.View;
import android.view.ViewGroup;
@ -10,8 +10,8 @@ import org.telegram.ui.Components.RecyclerListView;
import java.util.ArrayList;
import tw.nekomimi.nkmr.cells.AbstractCell;
import tw.nekomimi.nkmr.cells.NekomuraTGDivider;
import tw.nekomimi.nekogram.config.cell.AbstractConfigCell;
import tw.nekomimi.nekogram.config.cell.ConfigCellDivider;
public class CellGroup {
public static final int ITEM_TYPE_DIVIDER = 1;
@ -24,7 +24,7 @@ public class CellGroup {
public BaseFragment thisFragment;
public RecyclerListView listView;
public RecyclerListView.SelectionAdapter listAdapter;
public ArrayList<AbstractCell> rows;
public ArrayList<AbstractConfigCell> rows;
public CallBackSettingsChanged callBackSettingsChanged;
@ -38,13 +38,13 @@ public class CellGroup {
this.listAdapter = la;
}
public AbstractCell appendCell(AbstractCell cell) {
public AbstractConfigCell appendCell(AbstractConfigCell cell) {
cell.bindCellGroup(this);
this.rows.add(cell);
return cell;
}
public AbstractCell appendCell(AbstractCell cell, boolean display) {
public AbstractConfigCell appendCell(AbstractConfigCell cell, boolean display) {
cell.bindCellGroup(this);
if (display) // For censored features, don't show it forever.
this.rows.add(cell);
@ -83,8 +83,8 @@ public class CellGroup {
cell.setLayoutParams(params);
}
public boolean needSetDivider(AbstractCell cell) {
return !(rows.get(rows.indexOf(cell) + 1) instanceof NekomuraTGDivider);
public boolean needSetDivider(AbstractConfigCell cell) {
return !(rows.get(rows.indexOf(cell) + 1) instanceof ConfigCellDivider);
}
}

View File

@ -0,0 +1,170 @@
package tw.nekomimi.nekogram.config;
import android.content.SharedPreferences;
import android.util.Base64;
import org.telegram.messenger.FileLog;
import java.io.ByteArrayOutputStream;
import java.io.ObjectOutputStream;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Set;
import tw.nekomimi.nekogram.NekoConfig;
public class ConfigItem {
public static final int configTypeBool = 0;
public static final int configTypeInt = 1;
public static final int configTypeString = 2;
public static final int configTypeSetInt = 3;
public static final int configTypeMapIntInt = 4;
public static final int configTypeLong = 5;
public static final int configTypeFloat = 6;
public final String key;
public final int type;
public final Object defaultValue;
public Object value;
public ConfigItem(String key, int type, Object defaultValue) {
this.key = key;
this.type = type;
this.defaultValue = defaultValue;
}
public String getKey() {
return key;
}
// 读配置
public boolean Bool() {
return (boolean) value;
}
public int Int() {
return (int) value;
}
public Long Long() {
return (Long) value;
}
public Float Float() {
return (Float) value;
}
public String String() {
return value.toString();
}
public HashSet<Integer> SetInt() {
return (HashSet<Integer>) value;
}
public HashMap<Integer, Integer> MapIntInt() {
return (HashMap<Integer, Integer>) value;
}
public boolean SetIntContains(Integer v) {
return ((HashSet<Integer>) value).contains(v);
}
public void changed(Object o) {
value = o;
}
//写配置
//这里没有检查类型哦
public boolean toggleConfigBool() {
value = !this.Bool();
saveConfig();
return this.Bool();//返回toggle之后的
}
public void setConfigBool(boolean v) {
value = v;
saveConfig();
}
public void setConfigInt(int v) {
value = v;
saveConfig();
}
public void setConfigLong(Long v) {
value = v;
saveConfig();
}
public void setConfigFloat(Float v) {
value = v;
saveConfig();
}
public void setConfigString(String v) {
if (v == null) {
value = "";
} else {
value = v;
}
saveConfig();
}
public void setConfigSetInt(HashSet<Integer> v) {
value = v;
saveConfig();
}
public void setConfigMapInt(HashMap<Integer, Integer> v) {
value = v;
saveConfig();
}
// save one item
public void saveConfig() {
synchronized (NekoConfig.sync) {
try {
SharedPreferences.Editor editor = NekoConfig.preferences.edit();
if (this.type == configTypeBool) {
editor.putBoolean(this.key, (boolean) this.value);
}
if (this.type == configTypeInt) {
editor.putInt(this.key, (int) this.value);
}
if (this.type == configTypeLong) {
editor.putLong(this.key, (Long) this.value);
}
if (this.type == configTypeFloat) {
editor.putFloat(this.key, (Float) this.value);
}
if (this.type == configTypeString) {
editor.putString(this.key, this.value.toString());
}
if (this.type == configTypeSetInt) {
HashSet<String> ss = new HashSet<>();
for (Integer n : (Set<Integer>) this.value) {
ss.add(Integer.toString(n));
}
editor.putStringSet(this.key, ss);
}
if (this.type == configTypeMapIntInt) {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
ObjectOutputStream oos = new ObjectOutputStream(baos);
oos.writeObject(this.value);
oos.close();
editor.putString(this.key, Base64.encodeToString(baos.toByteArray(), Base64.DEFAULT));
}
editor.apply();
} catch (Exception e) {
FileLog.e(e);
}
}
}
}

View File

@ -1,10 +1,10 @@
package tw.nekomimi.nkmr.cells;
package tw.nekomimi.nekogram.config.cell;
import androidx.recyclerview.widget.RecyclerView;
import tw.nekomimi.nkmr.CellGroup;
import tw.nekomimi.nekogram.config.CellGroup;
public abstract class AbstractCell {
public abstract class AbstractConfigCell {
// can not be null!
protected CellGroup cellGroup;

View File

@ -1,12 +1,12 @@
package tw.nekomimi.nkmr.cells;
package tw.nekomimi.nekogram.config.cell;
import androidx.recyclerview.widget.RecyclerView;
public class NekomuraTGCustom extends AbstractCell {
public class ConfigCellCustom extends AbstractConfigCell {
public final int type;
public final boolean enabled;
public NekomuraTGCustom(int type, boolean enabled) {
public ConfigCellCustom(int type, boolean enabled) {
this.type = type;
this.enabled = enabled;
}

Some files were not shown because too many files have changed in this diff Show More