1
0
mirror of https://github.com/MGislv/NekoX.git synced 2024-07-02 10:33:36 +00:00

Valentine's Day

This commit is contained in:
Riko Sakurauchi 2020-02-16 12:30:15 +08:00 committed by NekoInverter
parent ddedc4cd44
commit a8934169d2
No known key found for this signature in database
GPG Key ID: 280D6CCCF95715F9
6 changed files with 132 additions and 74 deletions

View File

@ -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)):
<!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section -->
| [<img src="https://avatars2.githubusercontent.com/u/42698724?s=460&v=4" width="80px;"/><br /><sub>猫耳逆变器</sub>](https://github.com/NekoInverter)<br />[💻](https://github.com/Nekogram/Nekogram/commits?author=NekoInverter "Code") | [<img src="https://avatars1.githubusercontent.com/u/18373361?s=460&v=4" width="80px;"/><br /><sub>梨子</sub>](https://github.com/rikakomoe)<br />[💻](https://github.com/Nekogram/Nekogram/commits?author=rikakomoe "Code") [🚧](https://github.com/Nekogram/Nekogram/commits?author=rikakomoe "Maintenance") | [<img src="https://i.loli.net/2020/01/17/e9Z5zkG7lNwUBPE.jpg" width="80px;"/><br /><sub>呆瓜</sub>](https://t.me/Duang)<br /> [🎨](#design-duang "Design") |
| [<img src="https://avatars2.githubusercontent.com/u/42698724?s=460&v=4" width="80px;"/><br /><sub>猫耳逆变器</sub>](https://github.com/NekoInverter)<br />[💻](https://github.com/Nekogram/Nekogram/commits?author=NekoInverter "Code") | [<img src="https://avatars1.githubusercontent.com/u/18373361?s=460&v=4" width="80px;"/><br /><sub>梨子</sub>](https://github.com/rikakomoe)<br />[💻](https://github.com/Nekogram/Nekogram/commits?author=rikakomoe "Code") | [<img src="https://i.loli.net/2020/01/17/e9Z5zkG7lNwUBPE.jpg" width="80px;"/><br /><sub>呆瓜</sub>](https://t.me/Duang)<br /> [🎨](#design-duang "Design") |
| :---: | :---: | :---: |
<!-- ALL-CONTRIBUTORS-LIST:END -->

View File

@ -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();
}

View File

@ -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;

View File

@ -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);

View File

@ -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<String> arrayList = new ArrayList<>();
ArrayList<Integer> 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<String> arrayList = new ArrayList<>();
ArrayList<Integer> 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) {

View File

@ -37,10 +37,14 @@
<string name="EnableResidentNotification">Show a resident notification</string>
<string name="DisableResidentNotification">Disable resident notification</string>
<string name="NekogramRunning">Nekogram is running</string>
<string name="ChristmasEveryday">Christmas holiday everyday*</string>
<string name="NewYearEveryday">New year\'s day everyday*</string>
<string name="HappyNewYearEveryday">Happy new year everyday*</string>
<string name="ShowFireworks">Show fireworks*</string>
<string name="EventType">Sidebar icon set*</string>
<string name="ChristmasHat">Show christmas hat everyday*</string>
<string name="ActionBarDecoration">Action bar decoration*</string>
<string name="DependsOnDate">Depends on date</string>
<string name="Christmas">Christmas</string>
<string name="Valentine">Valentine\'s day</string>
<string name="Snowflakes">Snowflakes</string>
<string name="Fireworks">Fireworks</string>
<string name="SomeItemsNeedRestart">Options with * may need restart to take effect.</string>
<string name="DeleteDownloadedFile">Delete downloaded file</string>
<string name="TestBackend">Test Backend</string>