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 b61aa5df0..083b2ec44 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/ActionBar/ActionBar.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/ActionBar/ActionBar.java @@ -196,7 +196,7 @@ public class ActionBar extends FrameLayout { if (drawable != null) { TextPaint textPaint = titleTextView.getTextPaint(); textPaint.getFontMetricsInt(fontMetricsInt); - textPaint.getTextBounds((String) titleTextView.getText(), 0, 1, rect); + textPaint.getTextBounds((String) titleTextView.getText(), 0, 2, rect); int x = titleTextView.getTextStartX() + Theme.getCurrentHolidayDrawableXOffset() + (rect.width() - (drawable.getIntrinsicWidth() + Theme.getCurrentHolidayDrawableXOffset())) / 2; int y = titleTextView.getTextStartY() + Theme.getCurrentHolidayDrawableYOffset() + (int) Math.ceil((titleTextView.getTextHeight() - rect.height()) / 2.0f); drawable.setBounds(x, y - drawable.getIntrinsicHeight(), x + drawable.getIntrinsicWidth(), y); 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 2399414f4..6d69be8c9 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/ActionBar/Theme.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/ActionBar/Theme.java @@ -88,6 +88,8 @@ import java.util.HashSet; import androidx.annotation.UiThread; +import tw.nekomimi.nekogram.NekoConfig; + public class Theme { public static class ThemeInfo implements NotificationCenter.NotificationCenterDelegate { @@ -2269,7 +2271,7 @@ public class Theme { int hour = calendar.get(Calendar.HOUR_OF_DAY); int eventType = -1; - if (monthOfYear == 11 && dayOfMonth >= 24 && dayOfMonth <= 31 || monthOfYear == 0 && dayOfMonth == 1) { + if (NekoConfig.xmas || (monthOfYear == 11 && dayOfMonth >= 24 && dayOfMonth <= 31 || monthOfYear == 0 && dayOfMonth == 1)) { eventType = 0; } return eventType; @@ -2284,16 +2286,16 @@ 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 (monthOfYear == 0 && dayOfMonth == 1 && minutes <= 10 && hour == 0) { + if (NekoConfig.newYearEve || (monthOfYear == 0 && dayOfMonth == 1 && minutes <= 10 && hour == 0)) { canStartHolidayAnimation = true; } else { canStartHolidayAnimation = false; } if (dialogs_holidayDrawable == null) { - if (monthOfYear == 11 && dayOfMonth >= (BuildVars.DEBUG_PRIVATE_VERSION ? 29 : 31) && dayOfMonth <= 31 || monthOfYear == 0 && dayOfMonth == 1) { + if (NekoConfig.newYear || (monthOfYear == 11 && dayOfMonth >= (BuildVars.DEBUG_PRIVATE_VERSION ? 29 : 31) && dayOfMonth <= 31 || monthOfYear == 0 && dayOfMonth == 1)) { dialogs_holidayDrawable = ApplicationLoader.applicationContext.getResources().getDrawable(R.drawable.newyear); dialogs_holidayDrawableOffsetX = -AndroidUtilities.dp(3); - dialogs_holidayDrawableOffsetY = -AndroidUtilities.dp(1); + dialogs_holidayDrawableOffsetY = +AndroidUtilities.dp(1); } } } diff --git a/TMessagesProj/src/main/java/tw/nekomimi/nekogram/NekoConfig.java b/TMessagesProj/src/main/java/tw/nekomimi/nekogram/NekoConfig.java index cfdd84685..f13cecdf9 100644 --- a/TMessagesProj/src/main/java/tw/nekomimi/nekogram/NekoConfig.java +++ b/TMessagesProj/src/main/java/tw/nekomimi/nekogram/NekoConfig.java @@ -29,6 +29,10 @@ public class NekoConfig { public static boolean showAdminActions = true; public static boolean showChangePermissions = true; + public static boolean xmas = false; + public static boolean newYear = false; + public static boolean newYearEve = false; + private static boolean configLoaded; static { @@ -57,6 +61,9 @@ public class NekoConfig { editor.putBoolean("showPrPr", showPrPr); editor.putBoolean("showAdminActions", showAdminActions); editor.putBoolean("showChangePermissions", showChangePermissions); + editor.putBoolean("xmas", xmas); + editor.putBoolean("newYear", newYear); + editor.putBoolean("newYearEve", newYearEve); editor.commit(); } catch (Exception e) { @@ -88,6 +95,9 @@ public class NekoConfig { showPrPr = preferences.getBoolean("showPrPr", true); showAdminActions = preferences.getBoolean("showAdminActions", true); showChangePermissions = preferences.getBoolean("showChangePermissions", true); + xmas = preferences.getBoolean("xmas", false); + newYear = preferences.getBoolean("newYear", false); + newYearEve = preferences.getBoolean("newYearEve", false); configLoaded = true; } } @@ -166,7 +176,7 @@ public class NekoConfig { editor.commit(); } - public static void toogleTypeface() { + public static void toggleTypeface() { typeface = typeface == 0 ? 1 : 0; SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("nekoconfig", Activity.MODE_PRIVATE); SharedPreferences.Editor editor = preferences.edit(); @@ -228,4 +238,28 @@ public class NekoConfig { } } + public static void toggleXmas() { + xmas = !xmas; + SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("nekoconfig", Activity.MODE_PRIVATE); + SharedPreferences.Editor editor = preferences.edit(); + editor.putBoolean("xmas", xmas); + editor.commit(); + } + + public static void toggleNewYear() { + newYear = !newYear; + SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("nekoconfig", Activity.MODE_PRIVATE); + SharedPreferences.Editor editor = preferences.edit(); + editor.putBoolean("newYear", newYear); + 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(); + } + } diff --git a/TMessagesProj/src/main/java/tw/nekomimi/nekogram/NekoSettingsActivity.java b/TMessagesProj/src/main/java/tw/nekomimi/nekogram/NekoSettingsActivity.java index 3e58ef6d9..cc1a31464 100644 --- a/TMessagesProj/src/main/java/tw/nekomimi/nekogram/NekoSettingsActivity.java +++ b/TMessagesProj/src/main/java/tw/nekomimi/nekogram/NekoSettingsActivity.java @@ -76,6 +76,9 @@ public class NekoSettingsActivity extends BaseFragment { private int navigationBarTintRow; private int navigationBarColorRow; private int forceTabletRow; + private int xmasRow; + private int newYearRow; + private int newYearEveRow; private int settings2Row; @Override @@ -221,7 +224,7 @@ public class NekoSettingsActivity extends BaseFragment { ((TextCheckCell) view).setChecked(SharedConfig.useSystemEmoji); } } else if (position == typefaceRow) { - NekoConfig.toogleTypeface(); + NekoConfig.toggleTypeface(); if (view instanceof TextCheckCell) { ((TextCheckCell) view).setChecked(NekoConfig.typeface == 1); } @@ -250,6 +253,21 @@ public class NekoSettingsActivity extends BaseFragment { listAdapter.notifyItemChanged(nameOrderRow); }); showDialog(builder.create()); + } else if (position == xmasRow) { + NekoConfig.toggleXmas(); + if (view instanceof TextCheckCell) { + ((TextCheckCell) view).setChecked(NekoConfig.xmas); + } + } 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); + } } }); @@ -290,6 +308,9 @@ public class NekoSettingsActivity extends BaseFragment { navigationBarColorRow = Build.VERSION.SDK_INT >= Build.VERSION_CODES.O ? rowCount++ : -1; forceTabletRow = rowCount++; nameOrderRow = rowCount++; + xmasRow = rowCount++; + newYearRow = rowCount++; + newYearEveRow = rowCount++; settings2Row = rowCount++; if (notify && listAdapter != null) { listAdapter.notifyDataSetChanged(); @@ -368,7 +389,7 @@ public class NekoSettingsActivity extends BaseFragment { value = LocaleController.getString("FirstLast", R.string.FirstLast); break; } - textCell.setTextAndValue(LocaleController.getString("NameOrder", R.string.NameOrder), value, false); + textCell.setTextAndValue(LocaleController.getString("NameOrder", R.string.NameOrder), value, true); } else if (position == navigationBarColorRow) { String value; switch (NekoConfig.navigationBarColor) { @@ -430,6 +451,12 @@ 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, false); } break; } @@ -457,6 +484,7 @@ public class NekoSettingsActivity extends BaseFragment { position == showChangePermissionsRow || position == showAdminActionsRow || position == showReportRow || position == showPrPrRow || position == showAddToSavedMessagesRow || position == nameOrderRow || position == forceTabletRow || position == mapPreviewRow || + position == xmasRow || position == newYearRow || position == newYearEveRow || (position == transparentStatusBarRow && (NekoConfig.navigationBarTint || Build.VERSION.SDK_INT < Build.VERSION_CODES.O)) || (position == navigationBarColorRow && NekoConfig.navigationBarTint); } @@ -504,7 +532,7 @@ public class NekoSettingsActivity extends BaseFragment { position == showAdminActionsRow || position == showChangePermissionsRow || position == transparentStatusBarRow || position == navigationBarTintRow || position == ignoreBlockedRow || position == useSystemEmojiRow || position == typefaceRow || - position == forceTabletRow) { + position == forceTabletRow || position == xmasRow || position == newYearRow || position == newYearEveRow) { return 3; } else if (position == settingsRow || position == connectionRow || position == messageMenuRow || position == chatRow) { return 4; diff --git a/TMessagesProj/src/main/res/drawable-hdpi/input_forward.png b/TMessagesProj/src/main/res/drawable-hdpi/input_forward.png index 75e547093..6606e1cab 100644 Binary files a/TMessagesProj/src/main/res/drawable-hdpi/input_forward.png and b/TMessagesProj/src/main/res/drawable-hdpi/input_forward.png differ diff --git a/TMessagesProj/src/main/res/drawable-mdpi/input_forward.png b/TMessagesProj/src/main/res/drawable-mdpi/input_forward.png index e5b7c44eb..1d2d109d8 100644 Binary files a/TMessagesProj/src/main/res/drawable-mdpi/input_forward.png and b/TMessagesProj/src/main/res/drawable-mdpi/input_forward.png differ diff --git a/TMessagesProj/src/main/res/drawable-xhdpi/input_forward.png b/TMessagesProj/src/main/res/drawable-xhdpi/input_forward.png index 7c5cfc610..1dc470517 100644 Binary files a/TMessagesProj/src/main/res/drawable-xhdpi/input_forward.png and b/TMessagesProj/src/main/res/drawable-xhdpi/input_forward.png differ diff --git a/TMessagesProj/src/main/res/drawable-xxhdpi/input_forward.png b/TMessagesProj/src/main/res/drawable-xxhdpi/input_forward.png index 34f1658e1..8a82b42b4 100644 Binary files a/TMessagesProj/src/main/res/drawable-xxhdpi/input_forward.png and b/TMessagesProj/src/main/res/drawable-xxhdpi/input_forward.png differ diff --git a/TMessagesProj/src/main/res/values-ja/strings_neko.xml b/TMessagesProj/src/main/res/values-ja/strings_neko.xml index c28f06c44..d3efccda5 100644 --- a/TMessagesProj/src/main/res/values-ja/strings_neko.xml +++ b/TMessagesProj/src/main/res/values-ja/strings_neko.xml @@ -40,4 +40,7 @@ 常駐通知を表示する 常駐通知を無効にする Nekogram ランニング + 毎日がXmas + 毎日が新年 + 毎日がHappy New Year \ No newline at end of file diff --git a/TMessagesProj/src/main/res/values-zh-rCN/strings_neko.xml b/TMessagesProj/src/main/res/values-zh-rCN/strings_neko.xml index 829df7dd4..3977f6c44 100644 --- a/TMessagesProj/src/main/res/values-zh-rCN/strings_neko.xml +++ b/TMessagesProj/src/main/res/values-zh-rCN/strings_neko.xml @@ -40,4 +40,7 @@ 请让猫咪住在通知栏里吧 果然通知栏还是太挤了 Nekogram 正在运行 + 天天是圣诞(需要重启) + 天天是新年(需要重启) + 天天跨年(需要重启) \ No newline at end of file diff --git a/TMessagesProj/src/main/res/values-zh-rTW/strings_neko.xml b/TMessagesProj/src/main/res/values-zh-rTW/strings_neko.xml index f9ac340ee..d3d4b8103 100644 --- a/TMessagesProj/src/main/res/values-zh-rTW/strings_neko.xml +++ b/TMessagesProj/src/main/res/values-zh-rTW/strings_neko.xml @@ -40,4 +40,7 @@ 請讓貓咪住在通知欄裡吧 果然通知欄還是太擠了 Nekogram 正在運行 + 天天是聖誕(需要重啟) + 天天是新年(需要重啟) + 天天跨年(需要重啟) \ No newline at end of file diff --git a/TMessagesProj/src/main/res/values/strings_neko.xml b/TMessagesProj/src/main/res/values/strings_neko.xml index 32ba80f79..c73cd88b1 100644 --- a/TMessagesProj/src/main/res/values/strings_neko.xml +++ b/TMessagesProj/src/main/res/values/strings_neko.xml @@ -18,7 +18,7 @@ Use system default font NoQuote forward Repeat - Add to Saved Messages + Save Message Create Mention Force tablet mode All @@ -30,7 +30,7 @@ Send message with suffix on long click Message suffix Suffix - prpr + Peropero Transparent status bar Set navigation bar and status bar color Navigation bar color @@ -40,4 +40,7 @@ Show a resident notification Disable resident notification Nekogram is running + Christmas holiday everyday + New year\'s day everyday + Happy new year everyday \ No newline at end of file