diff --git a/TMessagesProj/src/main/java/org/telegram/messenger/MediaDataController.java b/TMessagesProj/src/main/java/org/telegram/messenger/MediaDataController.java index cbb3be207..be7006c08 100644 --- a/TMessagesProj/src/main/java/org/telegram/messenger/MediaDataController.java +++ b/TMessagesProj/src/main/java/org/telegram/messenger/MediaDataController.java @@ -65,6 +65,8 @@ import java.util.Locale; import java.util.Map; import java.util.concurrent.CountDownLatch; +import tw.nekomimi.nekogram.NekoConfig; + @SuppressWarnings("unchecked") public class MediaDataController extends BaseController { @@ -289,7 +291,7 @@ public class MediaDataController extends BaseController { getFileRefController().requestReference(parentObject, req); } }); - maxCount = getMessagesController().maxFaveStickersCount; + maxCount = NekoConfig.unlimitedFavedStickers ? Integer.MAX_VALUE : getMessagesController().maxFaveStickersCount; } else { maxCount = getMessagesController().maxRecentStickersCount; } @@ -785,7 +787,7 @@ public class MediaDataController extends BaseController { maxCount = getMessagesController().maxRecentGifsCount; } else { if (type == TYPE_FAVE) { - maxCount = getMessagesController().maxFaveStickersCount; + maxCount = NekoConfig.unlimitedFavedStickers ? Integer.MAX_VALUE : getMessagesController().maxFaveStickersCount; } else { maxCount = getMessagesController().maxRecentStickersCount; } diff --git a/TMessagesProj/src/main/java/tw/nekomimi/nekogram/NekoConfig.java b/TMessagesProj/src/main/java/tw/nekomimi/nekogram/NekoConfig.java index b30b7165d..efd44111e 100644 --- a/TMessagesProj/src/main/java/tw/nekomimi/nekogram/NekoConfig.java +++ b/TMessagesProj/src/main/java/tw/nekomimi/nekogram/NekoConfig.java @@ -24,6 +24,7 @@ public class NekoConfig { public static boolean hideProxySponsorChannel = false; public static boolean saveCacheToPrivateDirectory = Build.VERSION.SDK_INT >= 24; public static float stickerSize = 14.0f; + public static boolean unlimitedFavedStickers = true; public static boolean showAddToSavedMessages = true; public static boolean showReport = false; @@ -73,6 +74,7 @@ public class NekoConfig { editor.putBoolean("newYearEve", newYearEve); editor.putBoolean("fireworks", fireworks); editor.putFloat("stickerSize", stickerSize); + editor.putBoolean("unlimitedFavedStickers", unlimitedFavedStickers); editor.commit(); } catch (Exception e) { @@ -111,6 +113,7 @@ public class NekoConfig { newYearEve = preferences.getBoolean("newYearEve", false); fireworks = preferences.getBoolean("fireworks", false); stickerSize = preferences.getFloat("stickerSize", 14.0f); + unlimitedFavedStickers = preferences.getBoolean("unlimitedFavedStickers", false); configLoaded = true; } } @@ -299,6 +302,14 @@ public class NekoConfig { editor.commit(); } + public static void toggleUnlimitedFavedStickers() { + unlimitedFavedStickers = !unlimitedFavedStickers; + SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("nekoconfig", Activity.MODE_PRIVATE); + SharedPreferences.Editor editor = preferences.edit(); + editor.putBoolean("unlimitedFavedStickers", unlimitedFavedStickers); + editor.commit(); + } + public static void setStickerSize(float size) { stickerSize = size; SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("nekoconfig", Activity.MODE_PRIVATE); diff --git a/TMessagesProj/src/main/java/tw/nekomimi/nekogram/NekoSettingsActivity.java b/TMessagesProj/src/main/java/tw/nekomimi/nekogram/NekoSettingsActivity.java index d40647da1..dd896e5ce 100644 --- a/TMessagesProj/src/main/java/tw/nekomimi/nekogram/NekoSettingsActivity.java +++ b/TMessagesProj/src/main/java/tw/nekomimi/nekogram/NekoSettingsActivity.java @@ -61,10 +61,6 @@ public class NekoSettingsActivity extends BaseFragment { private int rowCount; - private int sensitiveRow; - private int disableFilteringRow; - private int sensitive2Row; - private int connectionRow; private int ipv6Row; private int connection2Row; @@ -101,6 +97,11 @@ public class NekoSettingsActivity extends BaseFragment { private int fireworksRow; private int needRestartRow; + private int experimentRow; + private int disableFilteringRow; + private int unlimitedFavedStickersRow; + private int experiment2Row; + @Override public boolean onFragmentCreate() { super.onFragmentCreate(); @@ -347,6 +348,11 @@ public class NekoSettingsActivity extends BaseFragment { })); } else if (position == stickerSizeRow) { showStickerSizeAlert(); + } else if (position == unlimitedFavedStickersRow) { + NekoConfig.toggleUnlimitedFavedStickers(); + if (view instanceof TextCheckCell) { + ((TextCheckCell) view).setChecked(NekoConfig.unlimitedFavedStickers); + } } }); @@ -396,9 +402,10 @@ public class NekoSettingsActivity extends BaseFragment { newYearEveRow = rowCount++; fireworksRow = rowCount++; needRestartRow = rowCount++; - sensitiveRow = rowCount++; + experimentRow = rowCount++; disableFilteringRow = rowCount++; - sensitive2Row = rowCount++; + unlimitedFavedStickersRow = rowCount++; + experiment2Row = rowCount++; if (notify && listAdapter != null) { listAdapter.notifyDataSetChanged(); } @@ -671,8 +678,10 @@ public class NekoSettingsActivity extends BaseFragment { } else if (position == fireworksRow) { textCell.setTextAndCheck(LocaleController.getString("ShowFireworks", R.string.ShowFireworks), NekoConfig.fireworks, false); } else if (position == disableFilteringRow) { - textCell.setTextAndCheck(LocaleController.getString("SensitiveDisableFiltering", R.string.SensitiveDisableFiltering), sensitiveEnabled, false); + textCell.setTextAndValueAndCheck(LocaleController.getString("SensitiveDisableFiltering", R.string.SensitiveDisableFiltering), LocaleController.getString("SensitiveAbout", R.string.SensitiveAbout), sensitiveEnabled, true, true); textCell.setEnabled(sensitiveCanChange, null); + } else if (position == unlimitedFavedStickersRow) { + textCell.setTextAndValueAndCheck(LocaleController.getString("UnlimitedFavoredStickers", R.string.UnlimitedFavoredStickers), LocaleController.getString("UnlimitedFavoredStickersAbout", R.string.UnlimitedFavoredStickersAbout), NekoConfig.unlimitedFavedStickers, true, false); } break; } @@ -686,8 +695,8 @@ public class NekoSettingsActivity extends BaseFragment { headerCell.setText(LocaleController.getString("Connection", R.string.Connection)); } else if (position == chatRow) { headerCell.setText(LocaleController.getString("Chat", R.string.Chat)); - } else if (position == sensitiveRow) { - headerCell.setText(LocaleController.getString("SensitiveContent", R.string.SensitiveContent)); + } else if (position == experimentRow) { + headerCell.setText(LocaleController.getString("Experiment", R.string.Experiment)); } break; } @@ -695,8 +704,6 @@ public class NekoSettingsActivity extends BaseFragment { TextInfoPrivacyCell cell = (TextInfoPrivacyCell) holder.itemView; if (position == needRestartRow) { cell.setText(LocaleController.getString("SomeItemsNeedRestart", R.string.SomeItemsNeedRestart)); - } else if (position == sensitive2Row) { - cell.setText(LocaleController.getString("SensitiveAbout", R.string.SensitiveAbout)); } break; } @@ -714,7 +721,8 @@ public class NekoSettingsActivity extends BaseFragment { position == forceTabletRow || position == mapPreviewRow || position == xmasRow || position == newYearRow || position == newYearEveRow || position == fireworksRow || position == transparentStatusBarRow || position == hideProxySponsorChannelRow || position == saveCacheToPrivateDirectoryRow || - (position == disableFilteringRow && sensitiveCanChange) || position == stickerSizeRow; + (position == disableFilteringRow && sensitiveCanChange) || position == stickerSizeRow || + position == unlimitedFavedStickersRow; } @Override @@ -755,7 +763,7 @@ public class NekoSettingsActivity extends BaseFragment { @Override public int getItemViewType(int position) { - if (position == messageMenu2Row || position == connection2Row || position == chat2Row) { + if (position == messageMenu2Row || position == connection2Row || position == chat2Row || position == experiment2Row) { return 1; } else if (position == nameOrderRow || position == mapPreviewRow || position == stickerSizeRow) { return 2; @@ -765,12 +773,13 @@ public class NekoSettingsActivity extends BaseFragment { position == transparentStatusBarRow || position == hideProxySponsorChannelRow || position == showViewHistoryRow || position == ignoreBlockedRow || position == useSystemEmojiRow || position == typefaceRow || position == forceTabletRow || position == xmasRow || position == newYearRow || position == newYearEveRow || - position == fireworksRow || position == saveCacheToPrivateDirectoryRow || position == disableFilteringRow) { + position == fireworksRow || position == saveCacheToPrivateDirectoryRow || position == unlimitedFavedStickersRow || + position == disableFilteringRow) { return 3; - } else if (position == settingsRow || position == connectionRow || position == messageMenuRow || - position == chatRow || position == sensitiveRow) { + } else if (position == settingsRow || position == connectionRow || position == messageMenuRow || position == chatRow || + position == experimentRow) { return 4; - } else if (position == needRestartRow || position == sensitive2Row) { + } else if (position == needRestartRow) { return 7; } return 6; diff --git a/TMessagesProj/src/main/res/values/strings_neko.xml b/TMessagesProj/src/main/res/values/strings_neko.xml index 68046155c..3de84c2b1 100644 --- a/TMessagesProj/src/main/res/values/strings_neko.xml +++ b/TMessagesProj/src/main/res/values/strings_neko.xml @@ -50,12 +50,14 @@ View history Meow! Save cache to private directory* - Sensitive Content - Disable filtering - Display sensitive media in public channels on all your Telegram devices. + Disable sensitive content filtering + Display sensitive media in public channels on all your devices. Sticker size A big one A small one Meow Duang + Experimental + Unlimited favored stickers + Add unlimited stickers to favorites. Stickers may not be synchronized to other devices. \ No newline at end of file