diff --git a/README.md b/README.md index 5f4cfce33..8789cb1d0 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,7 @@ Nekogram is an UNOFFICIAL app that uses Telegram's API. - APKs: https://github.com/Nekogram/Nekogram/releases - Feedback: https://t.me/nekosupportbot - Feedback: https://github.com/Nekogram/Nekogram/issues -- Chat group (Chinese & English): Join our channel (https://t.me/Zuragram) and click "Chat" +- Chat group (Chinese): Join our channel (https://t.me/zuragram) and click "Chat" ## API, Protocol documentation @@ -20,10 +20,6 @@ MTproto protocol manuals: https://core.telegram.org/mtproto ## Compilation Guide -**Note**: In order to support [reproducible builds](https://core.telegram.org/reproducible-builds), this repo contains dummy release.keystore, google-services.json and filled variables inside BuildVars.java. Before publishing your own APKs please make sure to replace all these files with your own. - -You will require Android Studio 3.4, Android NDK rev. 20 and Android SDK 8.1 - 1. Download the Nekogram source code from https://github.com/Nekogram/Nekogram ( git clone https://github.com/Nekogram/Nekogram.git ) 2. Copy your release.keystore into TMessagesProj/config 3. Fill out RELEASE_KEY_PASSWORD, RELEASE_KEY_ALIAS, RELEASE_STORE_PASSWORD in local.properties to access your release.keystore @@ -42,7 +38,7 @@ As for the Nekogram specialized strings, we use Crowdin to translate Nekogram. J Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/docs/en/emoji-key)): -| [
猫耳逆变器](https://github.com/NekoInverter)
[💻](https://github.com/Nekogram/Nekogram/commits?author=NekoInverter "Code") | [
梨子](https://github.com/rikakomoe)
[💻](https://github.com/Nekogram/Nekogram/commits?author=rikakomoe "Code") [🚧](https://github.com/Nekogram/Nekogram/commits?author=rikakomoe "Maintenance") | [
呆瓜](https://t.me/Duang)
[🎨](#design-duang "Design") | +| [
猫耳逆变器](https://github.com/NekoInverter)
[💻](https://github.com/Nekogram/Nekogram/commits?author=NekoInverter "Code") | [
梨子](https://github.com/rikakomoe)
[💻](https://github.com/Nekogram/Nekogram/commits?author=rikakomoe "Code") | [
呆瓜](https://t.me/Duang)
[🎨](#design-duang "Design") | | :---: | :---: | :---: | diff --git a/TMessagesProj/src/main/java/org/telegram/ui/ActionBar/ActionBar.java b/TMessagesProj/src/main/java/org/telegram/ui/ActionBar/ActionBar.java index b1c90d506..c36c32690 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/ActionBar/ActionBar.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/ActionBar/ActionBar.java @@ -203,7 +203,7 @@ public class ActionBar extends FrameLayout { drawable.setBounds(x, y - drawable.getIntrinsicHeight(), x + drawable.getIntrinsicWidth(), y); drawable.draw(canvas); } - if (NekoConfig.fireworks) { + if (NekoConfig.actionBarDecoration == 2) { if (fireworksEffect == null) { fireworksEffect = new FireworksEffect(); } diff --git a/TMessagesProj/src/main/java/org/telegram/ui/ActionBar/Theme.java b/TMessagesProj/src/main/java/org/telegram/ui/ActionBar/Theme.java index 8642c4a64..4de39785a 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/ActionBar/Theme.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/ActionBar/Theme.java @@ -4215,9 +4215,9 @@ public class Theme { int hour = calendar.get(Calendar.HOUR_OF_DAY); int eventType = -1; - if (NekoConfig.xmas || (monthOfYear == 11 && dayOfMonth >= 24 && dayOfMonth <= 31 || monthOfYear == 0 && dayOfMonth == 1)) { + if (NekoConfig.eventType == 1 || (monthOfYear == 11 && dayOfMonth >= 24 && dayOfMonth <= 31 || monthOfYear == 0 && dayOfMonth == 1)) { eventType = 0; - } else if (monthOfYear == 1 && dayOfMonth == 14) { + } else if (NekoConfig.eventType == 2 || (monthOfYear == 1 && dayOfMonth == 14)) { eventType = 1; } return eventType; @@ -4232,7 +4232,7 @@ public class Theme { int dayOfMonth = calendar.get(Calendar.DAY_OF_MONTH); int minutes = calendar.get(Calendar.MINUTE); int hour = calendar.get(Calendar.HOUR_OF_DAY); - if (NekoConfig.newYearEve || (monthOfYear == 0 && dayOfMonth == 1 && minutes <= 10 && hour == 0)) { + if (NekoConfig.actionBarDecoration > 0 || (monthOfYear == 0 && dayOfMonth == 1 && minutes <= 10 && hour == 0)) { canStartHolidayAnimation = true; } else { canStartHolidayAnimation = false; diff --git a/TMessagesProj/src/main/java/tw/nekomimi/nekogram/NekoConfig.java b/TMessagesProj/src/main/java/tw/nekomimi/nekogram/NekoConfig.java index 05214acbc..1d7fbe5ae 100644 --- a/TMessagesProj/src/main/java/tw/nekomimi/nekogram/NekoConfig.java +++ b/TMessagesProj/src/main/java/tw/nekomimi/nekogram/NekoConfig.java @@ -37,10 +37,9 @@ public class NekoConfig { public static boolean showTranslate = true; public static boolean showRepeat = true; - public static boolean xmas = false; + public static int eventType = 0; + public static int actionBarDecoration = 0; public static boolean newYear = false; - public static boolean newYearEve = false; - public static boolean fireworks = false; public static int translationProvider = 1; @@ -77,13 +76,12 @@ public class NekoConfig { editor.putBoolean("showMessageDetails", showMessageDetails); editor.putBoolean("showTranslate", showTranslate); editor.putBoolean("showRepeat", showRepeat); - editor.putBoolean("xmas", xmas); editor.putBoolean("newYear", newYear); - editor.putBoolean("newYearEve", newYearEve); - editor.putBoolean("fireworks", fireworks); editor.putFloat("stickerSize", stickerSize); editor.putBoolean("unlimitedFavedStickers", unlimitedFavedStickers); editor.putInt("translationProvider", translationProvider); + editor.putInt("eventType", eventType); + editor.putInt("actionBarDecoration", actionBarDecoration); editor.commit(); } catch (Exception e) { @@ -120,10 +118,9 @@ public class NekoConfig { showMessageDetails = preferences.getBoolean("showMessageDetails", false); showTranslate = preferences.getBoolean("showTranslate", true); showRepeat = preferences.getBoolean("showRepeat", true); - xmas = preferences.getBoolean("xmas", false); + eventType = preferences.getInt("eventType", 0); + actionBarDecoration = preferences.getInt("actionBarDecoration", 0); newYear = preferences.getBoolean("newYear", false); - newYearEve = preferences.getBoolean("newYearEve", false); - fireworks = preferences.getBoolean("fireworks", false); stickerSize = preferences.getFloat("stickerSize", 14.0f); unlimitedFavedStickers = preferences.getBoolean("unlimitedFavedStickers", false); translationProvider = preferences.getInt("translationProvider", 1); @@ -298,11 +295,19 @@ public class NekoConfig { editor.commit(); } - public static void toggleXmas() { - xmas = !xmas; + public static void setEventType(int type) { + eventType = type; SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("nekoconfig", Activity.MODE_PRIVATE); SharedPreferences.Editor editor = preferences.edit(); - editor.putBoolean("xmas", xmas); + editor.putInt("eventType", eventType); + editor.commit(); + } + + public static void setActionBarDecoration(int decoration) { + actionBarDecoration = decoration; + SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("nekoconfig", Activity.MODE_PRIVATE); + SharedPreferences.Editor editor = preferences.edit(); + editor.putInt("actionBarDecoration", actionBarDecoration); editor.commit(); } @@ -314,22 +319,6 @@ public class NekoConfig { editor.commit(); } - public static void toggleNewYearEve() { - newYearEve = !newYearEve; - SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("nekoconfig", Activity.MODE_PRIVATE); - SharedPreferences.Editor editor = preferences.edit(); - editor.putBoolean("newYearEve", newYearEve); - editor.commit(); - } - - public static void toggleFireworks() { - fireworks = !fireworks; - SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("nekoconfig", Activity.MODE_PRIVATE); - SharedPreferences.Editor editor = preferences.edit(); - editor.putBoolean("fireworks", fireworks); - editor.commit(); - } - public static void toggleUnlimitedFavedStickers() { unlimitedFavedStickers = !unlimitedFavedStickers; 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 75a89d6b7..e010045b7 100644 --- a/TMessagesProj/src/main/java/tw/nekomimi/nekogram/NekoSettingsActivity.java +++ b/TMessagesProj/src/main/java/tw/nekomimi/nekogram/NekoSettingsActivity.java @@ -90,10 +90,9 @@ public class NekoSettingsActivity extends BaseFragment { private int nameOrderRow; private int transparentStatusBarRow; private int forceTabletRow; - private int xmasRow; + private int eventTypeRow; private int newYearRow; - private int newYearEveRow; - private int fireworksRow; + private int actionBarDecorationRow; private int needRestartRow; private int experimentRow; @@ -276,26 +275,75 @@ public class NekoSettingsActivity extends BaseFragment { } builder.setNegativeButton(LocaleController.getString("Cancel", R.string.Cancel), null); showDialog(builder.create()); - } else if (position == xmasRow) { - NekoConfig.toggleXmas(); - if (view instanceof TextCheckCell) { - ((TextCheckCell) view).setChecked(NekoConfig.xmas); + } else if (position == eventTypeRow) { + ArrayList arrayList = new ArrayList<>(); + ArrayList types = new ArrayList<>(); + arrayList.add(LocaleController.getString("DependsOnDate", R.string.DependsOnDate)); + types.add(0); + arrayList.add(LocaleController.getString("Christmas", R.string.Christmas)); + types.add(1); + arrayList.add(LocaleController.getString("Valentine", R.string.Valentine)); + types.add(2); + + AlertDialog.Builder builder = new AlertDialog.Builder(context); + builder.setTitle(LocaleController.getString("EventType", R.string.EventType)); + final LinearLayout linearLayout = new LinearLayout(context); + linearLayout.setOrientation(LinearLayout.VERTICAL); + builder.setView(linearLayout); + + for (int a = 0; a < arrayList.size(); a++) { + RadioColorCell cell = new RadioColorCell(context); + cell.setPadding(AndroidUtilities.dp(4), 0, AndroidUtilities.dp(4), 0); + cell.setTag(a); + cell.setCheckColor(Theme.getColor(Theme.key_radioBackground), Theme.getColor(Theme.key_dialogRadioBackgroundChecked)); + cell.setTextAndValue(arrayList.get(a), NekoConfig.eventType == types.get(a)); + linearLayout.addView(cell); + cell.setOnClickListener(v -> { + Integer which = (Integer) v.getTag(); + NekoConfig.setEventType(types.get(which)); + listAdapter.notifyItemChanged(eventTypeRow); + builder.getDismissRunnable().run(); + }); } + builder.setNegativeButton(LocaleController.getString("Cancel", R.string.Cancel), null); + showDialog(builder.create()); + } else if (position == actionBarDecorationRow) { + ArrayList arrayList = new ArrayList<>(); + ArrayList types = new ArrayList<>(); + arrayList.add(LocaleController.getString("DependsOnDate", R.string.DependsOnDate)); + types.add(0); + arrayList.add(LocaleController.getString("Snowflakes", R.string.Snowflakes)); + types.add(1); + arrayList.add(LocaleController.getString("Fireworks", R.string.Fireworks)); + types.add(2); + + AlertDialog.Builder builder = new AlertDialog.Builder(context); + builder.setTitle(LocaleController.getString("ActionBarDecoration", R.string.ActionBarDecoration)); + final LinearLayout linearLayout = new LinearLayout(context); + linearLayout.setOrientation(LinearLayout.VERTICAL); + builder.setView(linearLayout); + + for (int a = 0; a < arrayList.size(); a++) { + RadioColorCell cell = new RadioColorCell(context); + cell.setPadding(AndroidUtilities.dp(4), 0, AndroidUtilities.dp(4), 0); + cell.setTag(a); + cell.setCheckColor(Theme.getColor(Theme.key_radioBackground), Theme.getColor(Theme.key_dialogRadioBackgroundChecked)); + cell.setTextAndValue(arrayList.get(a), NekoConfig.actionBarDecoration == types.get(a)); + linearLayout.addView(cell); + cell.setOnClickListener(v -> { + Integer which = (Integer) v.getTag(); + NekoConfig.setActionBarDecoration(types.get(which)); + listAdapter.notifyItemChanged(actionBarDecorationRow); + builder.getDismissRunnable().run(); + }); + } + builder.setNegativeButton(LocaleController.getString("Cancel", R.string.Cancel), null); + showDialog(builder.create()); } else if (position == newYearRow) { NekoConfig.toggleNewYear(); if (view instanceof TextCheckCell) { ((TextCheckCell) view).setChecked(NekoConfig.newYear); } - } else if (position == newYearEveRow) { - NekoConfig.toggleNewYearEve(); - if (view instanceof TextCheckCell) { - ((TextCheckCell) view).setChecked(NekoConfig.newYearEve); - } - } else if (position == fireworksRow) { - NekoConfig.toggleFireworks(); - if (view instanceof TextCheckCell) { - ((TextCheckCell) view).setChecked(NekoConfig.fireworks); - } } else if (position == disableFilteringRow) { sensitiveEnabled = !sensitiveEnabled; TLRPC.TL_account_setContentSettings req = new TLRPC.TL_account_setContentSettings(); @@ -479,10 +527,9 @@ public class NekoSettingsActivity extends BaseFragment { transparentStatusBarRow = Build.VERSION.SDK_INT >= Build.VERSION_CODES.M ? rowCount++ : -1; forceTabletRow = rowCount++; nameOrderRow = rowCount++; - xmasRow = rowCount++; + eventTypeRow = rowCount++; newYearRow = rowCount++; - newYearEveRow = rowCount++; - fireworksRow = rowCount++; + actionBarDecorationRow = rowCount++; needRestartRow = rowCount++; experimentRow = rowCount++; smoothKeyboardRow = !AndroidUtilities.isTablet() ? rowCount++ : -1; @@ -860,6 +907,34 @@ public class NekoSettingsActivity extends BaseFragment { value = LocaleController.getString("MapPreviewProviderNobody", R.string.MapPreviewProviderNobody); } textCell.setTextAndValue(LocaleController.getString("MapPreviewProvider", R.string.MapPreviewProvider), value, true); + } else if (position == eventTypeRow) { + String value; + switch (NekoConfig.eventType) { + case 1: + value = LocaleController.getString("Christmas", R.string.Christmas); + break; + case 2: + value = LocaleController.getString("Valentine", R.string.Valentine); + break; + case 0: + default: + value = LocaleController.getString("DependsOnDate", R.string.DependsOnDate); + } + textCell.setTextAndValue(LocaleController.getString("EventType", R.string.EventType), value, true); + } else if (position == actionBarDecorationRow) { + String value; + switch (NekoConfig.actionBarDecoration) { + case 1: + value = LocaleController.getString("Snowflakes", R.string.Snowflakes); + break; + case 2: + value = LocaleController.getString("Fireworks", R.string.Fireworks); + break; + case 0: + default: + value = LocaleController.getString("DependsOnDate", R.string.DependsOnDate); + } + textCell.setTextAndValue(LocaleController.getString("ActionBarDecoration", R.string.ActionBarDecoration), value, false); } else if (position == stickerSizeRow) { textCell.setTextAndValue(LocaleController.getString("StickerSize", R.string.StickerSize), String.valueOf(Math.round(NekoConfig.stickerSize)), true); } else if (position == messageMenuRow) { @@ -917,14 +992,8 @@ public class NekoSettingsActivity extends BaseFragment { textCell.setTextAndCheck(LocaleController.getString("IgnoreBlocked", R.string.IgnoreBlocked), NekoConfig.ignoreBlocked, true); } else if (position == forceTabletRow) { textCell.setTextAndCheck(LocaleController.getString("ForceTabletMode", R.string.ForceTabletMode), NekoConfig.forceTablet, true); - } else if (position == xmasRow) { - textCell.setTextAndCheck(LocaleController.getString("ChristmasEveryday", R.string.ChristmasEveryday), NekoConfig.xmas, true); } else if (position == newYearRow) { - textCell.setTextAndCheck(LocaleController.getString("NewYearEveryday", R.string.NewYearEveryday), NekoConfig.newYear, true); - } else if (position == newYearEveRow) { - textCell.setTextAndCheck(LocaleController.getString("HappyNewYearEveryday", R.string.HappyNewYearEveryday), NekoConfig.newYearEve, true); - } else if (position == fireworksRow) { - textCell.setTextAndCheck(LocaleController.getString("ShowFireworks", R.string.ShowFireworks), NekoConfig.fireworks, false); + textCell.setTextAndCheck(LocaleController.getString("ChristmasHat", R.string.ChristmasHat), NekoConfig.newYear, true); } else if (position == disableFilteringRow) { textCell.setTextAndValueAndCheck(LocaleController.getString("SensitiveDisableFiltering", R.string.SensitiveDisableFiltering), LocaleController.getString("SensitiveAbout", R.string.SensitiveAbout), sensitiveEnabled, true, true); textCell.setEnabled(sensitiveCanChange, null); @@ -965,8 +1034,8 @@ public class NekoSettingsActivity extends BaseFragment { int position = holder.getAdapterPosition(); return position == hidePhoneRow || position == inappCameraRow || position == ignoreBlockedRow || position == useSystemEmojiRow || position == ipv6Row || position == typefaceRow || position == nameOrderRow || - position == forceTabletRow || position == mapPreviewRow || position == xmasRow || position == newYearRow || - position == newYearEveRow || position == fireworksRow || position == transparentStatusBarRow || + position == forceTabletRow || position == mapPreviewRow || position == newYearRow || + position == actionBarDecorationRow || position == eventTypeRow || position == transparentStatusBarRow || position == hideProxySponsorChannelRow || position == saveCacheToPrivateDirectoryRow || (position == disableFilteringRow && sensitiveCanChange) || position == stickerSizeRow || position == unlimitedFavedStickersRow || position == messageMenuRow || position == deleteAccountRow || @@ -1014,13 +1083,13 @@ public class NekoSettingsActivity extends BaseFragment { if (position == connection2Row || position == chat2Row || position == experiment2Row) { return 1; } else if (position == nameOrderRow || position == mapPreviewRow || position == stickerSizeRow || position == messageMenuRow || - position == deleteAccountRow || position == translationProviderRow) { + position == deleteAccountRow || position == translationProviderRow || position == eventTypeRow || position == actionBarDecorationRow) { return 2; } else if (position == ipv6Row || position == hidePhoneRow || position == inappCameraRow || position == transparentStatusBarRow || position == hideProxySponsorChannelRow || position == ignoreBlockedRow || position == useSystemEmojiRow || position == typefaceRow || - position == forceTabletRow || position == xmasRow || position == newYearRow || position == newYearEveRow || - position == fireworksRow || position == saveCacheToPrivateDirectoryRow || position == unlimitedFavedStickersRow || + position == forceTabletRow || position == newYearRow || + position == saveCacheToPrivateDirectoryRow || position == unlimitedFavedStickersRow || position == disableFilteringRow || position == smoothKeyboardRow || position == pauseMusicOnRecordRow) { return 3; } else if (position == settingsRow || position == connectionRow || position == chatRow || position == experimentRow) { diff --git a/TMessagesProj/src/main/res/values/strings_neko.xml b/TMessagesProj/src/main/res/values/strings_neko.xml index 0db4059c3..f658d6aa7 100644 --- a/TMessagesProj/src/main/res/values/strings_neko.xml +++ b/TMessagesProj/src/main/res/values/strings_neko.xml @@ -37,10 +37,14 @@ Show a resident notification Disable resident notification Nekogram is running - Christmas holiday everyday* - New year\'s day everyday* - Happy new year everyday* - Show fireworks* + Sidebar icon set* + Show christmas hat everyday* + Action bar decoration* + Depends on date + Christmas + Valentine\'s day + Snowflakes + Fireworks Options with * may need restart to take effect. Delete downloaded file Test Backend