diff --git a/app/src/main/java/org/lsposed/manager/ui/activity/MainActivity.java b/app/src/main/java/org/lsposed/manager/ui/activity/MainActivity.java index f41fbb14..eaf9a859 100644 --- a/app/src/main/java/org/lsposed/manager/ui/activity/MainActivity.java +++ b/app/src/main/java/org/lsposed/manager/ui/activity/MainActivity.java @@ -45,7 +45,6 @@ import org.lsposed.manager.util.GlideHelper; import org.lsposed.manager.util.ModuleUtil; import org.lsposed.manager.util.NavUtil; import org.lsposed.manager.util.chrome.LinkTransformationMethod; -import org.lsposed.manager.util.holiday.HolidayHelper; import java.util.Locale; @@ -59,7 +58,6 @@ public class MainActivity extends BaseActivity { super.onCreate(savedInstanceState); binding = ActivityMainBinding.inflate(getLayoutInflater()); setContentView(binding.getRoot()); - HolidayHelper.setup(this); binding.status.setOnClickListener(v -> { if (ConfigManager.getXposedApiVersion() != -1) { new InfoDialogBuilder(this) @@ -102,17 +100,7 @@ public class MainActivity extends BaseActivity { binding.statusSummary.setText(R.string.selinux_policy_not_loaded_summary); } else { binding.statusTitle.setText(R.string.activated); - HolidayHelper.CardColors cardColors = HolidayHelper.getHolidayColors(); - if (cardColors.textColor != 0) { - binding.statusIcon.setImageTintList(ColorStateList.valueOf(cardColors.textColor)); - binding.statusTitle.setTextColor(ColorStateList.valueOf(cardColors.textColor)); - binding.statusSummary.setTextColor(ColorStateList.valueOf(cardColors.textColor)); - } - if (cardColors.backgroundColor != 0) { - cardBackgroundColor = cardColors.backgroundColor; - } else { - cardBackgroundColor = ResourcesKt.resolveColor(getTheme(), R.attr.colorNormal); - } + cardBackgroundColor = ResourcesKt.resolveColor(getTheme(), R.attr.colorNormal); binding.statusIcon.setImageResource(R.drawable.ic_check_circle); binding.statusSummary.setText(String.format(Locale.US, "%s (%d)", installXposedVersion, ConfigManager.getXposedVersionCode())); } diff --git a/app/src/main/java/org/lsposed/manager/util/holiday/Helpers.java b/app/src/main/java/org/lsposed/manager/util/holiday/Helpers.java deleted file mode 100644 index b11c4a56..00000000 --- a/app/src/main/java/org/lsposed/manager/util/holiday/Helpers.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - * This file is part of LSPosed. - * - * LSPosed is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * LSPosed is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with LSPosed. If not, see . - * - * Copyright (C) 2021 LSPosed Contributors - */ - -package org.lsposed.manager.util.holiday; - -import java.util.Calendar; - -public class Helpers { - - public static Holidays currentHoliday = Holidays.NONE; - - public enum Holidays { - NONE, NEWYEAR, LUNARNEWYEAR, PRIDE - } - - public static void detectHoliday() { - currentHoliday = Holidays.NONE; - Calendar cal = Calendar.getInstance(); - int month = cal.get(Calendar.MONTH); - int monthDay = cal.get(Calendar.DAY_OF_MONTH); - //int year = cal.get(Calendar.YEAR); - - // Lunar NY - if ((month == 0 && monthDay > 15) || month == 1) { - currentHoliday = Holidays.LUNARNEWYEAR; - } else if (month == 0 || month == 11) { // NY - currentHoliday = Holidays.NEWYEAR; - } else if (month == 5) { // Pride Month - currentHoliday = Holidays.PRIDE; - } - } -} diff --git a/app/src/main/java/org/lsposed/manager/util/holiday/HolidayHelper.java b/app/src/main/java/org/lsposed/manager/util/holiday/HolidayHelper.java deleted file mode 100644 index a24e370e..00000000 --- a/app/src/main/java/org/lsposed/manager/util/holiday/HolidayHelper.java +++ /dev/null @@ -1,85 +0,0 @@ -/* - * This file is part of LSPosed. - * - * LSPosed is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * LSPosed is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with LSPosed. If not, see . - * - * Copyright (C) 2021 LSPosed Contributors - */ - -package org.lsposed.manager.util.holiday; - -import android.app.Activity; -import android.graphics.drawable.ColorDrawable; -import android.view.View; -import android.view.ViewGroup; -import android.widget.FrameLayout; -import android.widget.ImageView; - -import org.lsposed.manager.R; - -public class HolidayHelper { - - public static void setup(Activity activity) { - Helpers.detectHoliday(); - - ImageView header = activity.findViewById(R.id.holiday_header); - - switch (Helpers.currentHoliday) { - case NEWYEAR: - header.setLayoutParams( - new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT)); - header.setImageResource(R.drawable.newyear_header); - header.setVisibility(View.VISIBLE); - break; - case LUNARNEWYEAR: - header.setLayoutParams(new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT)); - header.setImageResource(R.drawable.lunar_newyear_header); - header.setVisibility(View.VISIBLE); - ((FrameLayout) header.getParent()).requestLayout(); - break; - case PRIDE: - header.setForeground(new ColorDrawable(0x15000000)); - header.setImageResource(R.drawable.pride_flag); - header.setVisibility(View.VISIBLE); - break; - case NONE: - default: - ((ViewGroup) header.getParent()).removeView(header); - } - } - - public static CardColors getHolidayColors() { - switch (Helpers.currentHoliday) { - case LUNARNEWYEAR: - return new CardColors(0xfff05654, 0); - case NEWYEAR: - return new CardColors(0xff677a89, 0); - case PRIDE: - return new CardColors(0, 0xffffffff); - case NONE: - default: - return new CardColors(0, 0); - } - } - - public static class CardColors { - public int backgroundColor; - public int textColor; - - public CardColors(int background, int text) { - backgroundColor = background; - textColor = text; - } - } -} diff --git a/app/src/main/res/drawable-nodpi/lunar_newyear_header.webp b/app/src/main/res/drawable-nodpi/lunar_newyear_header.webp deleted file mode 100644 index 74a61214..00000000 Binary files a/app/src/main/res/drawable-nodpi/lunar_newyear_header.webp and /dev/null differ diff --git a/app/src/main/res/drawable-nodpi/newyear_header.webp b/app/src/main/res/drawable-nodpi/newyear_header.webp deleted file mode 100644 index acf47c4c..00000000 Binary files a/app/src/main/res/drawable-nodpi/newyear_header.webp and /dev/null differ diff --git a/app/src/main/res/drawable/pride_flag.xml b/app/src/main/res/drawable/pride_flag.xml deleted file mode 100644 index 085ec718..00000000 --- a/app/src/main/res/drawable/pride_flag.xml +++ /dev/null @@ -1,24 +0,0 @@ - - - - - - - - diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml index 82570909..79d98b02 100644 --- a/app/src/main/res/layout/activity_main.xml +++ b/app/src/main/res/layout/activity_main.xml @@ -82,7 +82,7 @@ - -