diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 313460d..e403abf 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -42,7 +42,8 @@ android:name=".SetupActivity" android:exported="false" android:label="@string/title_activity_setup" - android:theme="@style/Theme.MagiskModuleManager.NoActionBar" /> + android:parentActivityName=".MainActivity" + android:theme="@style/Theme.MagiskModuleManager.NoActionBar"/> Log.i("SetupWizard", "Background Update Check: " + isChecked)); + ((MaterialSwitch) Objects.requireNonNull(view.findViewById(R.id.setup_crash_reporting))).setOnCheckedChangeListener((buttonView, isChecked) -> Log.i("SetupWizard", "Crash Reporting: " + isChecked)); + ((MaterialSwitch) Objects.requireNonNull(view.findViewById(R.id.setup_androidacy_repo))).setOnCheckedChangeListener((buttonView, isChecked) -> Log.i("SetupWizard", "Androidacy Repo: " + isChecked)); + ((MaterialSwitch) Objects.requireNonNull(view.findViewById(R.id.setup_magisk_alt_repo))).setOnCheckedChangeListener((buttonView, isChecked) -> Log.i("SetupWizard", "Magisk Alt Repo: " + isChecked)); + } + // Setup popup dialogue for the setup_theme_button + MaterialButton themeButton = view.findViewById(R.id.setup_theme_button); + themeButton.setOnClickListener(v -> { + // Create a new dialog for the theme picker + MaterialAlertDialogBuilder builder = new MaterialAlertDialogBuilder(this); + builder.setTitle(R.string.setup_theme_title); + // Create a new array of theme names (system, light, dark, black, transparent light) + String[] themeNames = new String[]{getString(R.string.theme_system), getString(R.string.theme_light), getString(R.string.theme_dark), getString(R.string.theme_black), getString(R.string.theme_transparent_light)}; + // Create a new array of theme values (system, light, dark, black, transparent_light) + String[] themeValues = new String[]{"system", "light", "dark", "black", "transparent_light"}; + // if pref_theme is set, check the relevant theme_* menu item, otherwise check the default (theme_system) + String prefTheme = prefs.getString("pref_theme", "system"); + int checkedItem = 0; + switch (prefTheme) { + case "system": + break; + case "light": + checkedItem = 1; + break; + case "dark": + checkedItem = 2; + break; + case "black": + checkedItem = 3; + break; + case "transparent_light": + checkedItem = 4; + break; + } + builder.setCancelable(true); + // Create the dialog + builder.setSingleChoiceItems(themeNames, checkedItem, (dialog, which) -> { + // Set the theme + prefs.edit().putString("pref_theme", themeValues[which]).commit(); + // Restart the activity + UiThreadHandler.run(() -> { + Intent intent = getIntent(); + finish(); + startActivity(intent); + }); + // Set the theme button text to the selected theme + themeButton.setText(themeNames[which]); + // Dismiss the dialog + dialog.dismiss(); + // Set the theme + UiThreadHandler.handler.postDelayed(() -> { + switch (prefs.getString("pref_theme", "system")) { + case "light": + setTheme(R.style.Theme_MagiskModuleManager_Monet_Light); + break; + case "dark": + setTheme(R.style.Theme_MagiskModuleManager_Monet_Dark); + break; + case "system": + setTheme(R.style.Theme_MagiskModuleManager_Monet); + break; + case "black": + setTheme(R.style.Theme_MagiskModuleManager_Monet_Black); + break; + case "transparent_light": + setTheme(R.style.Theme_MagiskModuleManager_Transparent_Light); + break; + } + }, 100); + }); + builder.show(); + }); + // Setup language selector + MaterialButton languageSelector = view.findViewById(R.id.setup_language_button); + languageSelector.setOnClickListener(preference -> { + LanguageSwitcher ls = new LanguageSwitcher(Objects.requireNonNull(getActivity(this))); + ls.setSupportedStringLocales(MainApplication.supportedLocales); + ls.showChangeLanguageDialog((FragmentActivity) getActivity(this)); + }); + // Set up the buttons + // Setup button + MaterialButton setupButton = view.findViewById(R.id.setup_continue); + setupButton.setOnClickListener(v -> { + // Set first launch to false + // get instance of editor + SharedPreferences.Editor editor = prefs.edit(); + editor.putBoolean("first_time_user", false); + // Set the background update check pref + editor.putBoolean("pref_background_update_check", ((MaterialSwitch) Objects.requireNonNull(view.findViewById(R.id.setup_background_update_check))).isChecked()); + // Set the crash reporting pref + editor.putBoolean("pref_crash_reporting", ((MaterialSwitch) Objects.requireNonNull(view.findViewById(R.id.setup_crash_reporting))).isChecked()); + // Set the repos + // first pref_magisk_alt_repo_enabled then pref_androidacy_repo_enabled + editor.putBoolean("pref_magisk_alt_repo_enabled", ((MaterialSwitch) Objects.requireNonNull(view.findViewById(R.id.setup_magisk_alt_repo))).isChecked()); + editor.putBoolean("pref_androidacy_repo_enabled", ((MaterialSwitch) Objects.requireNonNull(view.findViewById(R.id.setup_androidacy_repo))).isChecked()); + // Commit the changes + editor.commit(); + // Sleep for 1 second to allow the user to see the changes + try { + Thread.sleep(500); + } catch ( + InterruptedException e) { + e.printStackTrace(); + } + // Log the changes if debug + if (BuildConfig.DEBUG) { + Log.d("SetupWizard", "Background update check: " + prefs.getBoolean("pref_background_update_check", false)); + Log.i("SetupWizard", "Crash reporting: " + prefs.getBoolean("pref_crash_reporting", false)); + Log.i("SetupWizard", "Magisk Alt Repo: " + prefs.getBoolean("pref_magisk_alt_repo_enabled", false)); + Log.i("SetupWizard", "Androidacy Repo: " + prefs.getBoolean("pref_androidacy_repo_enabled", false)); + } + // Restart the activity + MainActivity.doSetupRestarting = true; + Intent intent = new Intent(this, MainActivity.class); + startActivity(intent); + finish(); + }); + // Cancel button + MaterialButton cancelButton = view.findViewById(R.id.setup_cancel); + cancelButton.setText(R.string.cancel); + cancelButton.setOnClickListener(v -> { + // Set first launch to false and restart the activity + prefs.edit().putBoolean("first_time_user", false).commit(); + MainActivity.doSetupRestarting = true; + Intent intent = new Intent(this, MainActivity.class); + startActivity(intent); + finish(); + }); + } + + @Override + public Resources.Theme getTheme() { + Resources.Theme theme = super.getTheme(); + // Set the theme + SharedPreferences prefs = MainApplication.getSharedPreferences(); + switch (prefs.getString("pref_theme", "system")) { + case "light": + theme.applyStyle(R.style.Theme_MagiskModuleManager_Monet_Light, true); + break; + case "dark": + theme.applyStyle(R.style.Theme_MagiskModuleManager_Monet_Dark, true); + break; + case "system": + theme.applyStyle(R.style.Theme_MagiskModuleManager_Monet, true); + break; + case "black": + theme.applyStyle(R.style.Theme_MagiskModuleManager_Monet_Black, true); + break; + case "transparent_light": + theme.applyStyle(R.style.Theme_MagiskModuleManager_Transparent_Light, true); + break; + } + return theme; + } + + @Override + @SuppressLint({"InlinedApi", "RestrictedApi"}) + public void refreshRosettaX() { + // refresh app language + runOnUiThread(() -> { + // refresh activity + Intent intent = getIntent(); + finish(); + startActivity(intent); + }); + } +} \ No newline at end of file diff --git a/app/src/main/res/layout/activity_setup.xml b/app/src/main/res/layout/activity_setup.xml new file mode 100644 index 0000000..bacde20 --- /dev/null +++ b/app/src/main/res/layout/activity_setup.xml @@ -0,0 +1,14 @@ + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/content_scrolling.xml b/app/src/main/res/layout/content_scrolling.xml new file mode 100644 index 0000000..16fd7ce --- /dev/null +++ b/app/src/main/res/layout/content_scrolling.xml @@ -0,0 +1,215 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/menu/menu_setup.xml b/app/src/main/res/menu/menu_setup.xml new file mode 100644 index 0000000..9ef9a9d --- /dev/null +++ b/app/src/main/res/menu/menu_setup.xml @@ -0,0 +1,10 @@ + + + \ No newline at end of file diff --git a/app/src/main/res/values-cs/arrays.xml b/app/src/main/res/values-cs/arrays.xml index 8cff8f1..a011e39 100644 --- a/app/src/main/res/values-cs/arrays.xml +++ b/app/src/main/res/values-cs/arrays.xml @@ -3,7 +3,7 @@ Dle systému Tmavá AMOLED Black - Transparent (light) + Transparent Světlá diff --git a/app/src/main/res/values-de/arrays.xml b/app/src/main/res/values-de/arrays.xml index 54da743..f1dc336 100644 --- a/app/src/main/res/values-de/arrays.xml +++ b/app/src/main/res/values-de/arrays.xml @@ -4,7 +4,7 @@ Systemvorgabe Dunkel AMOLED Black - Transparent (light) + Transparent Hell diff --git a/app/src/main/res/values-el/arrays.xml b/app/src/main/res/values-el/arrays.xml index ac18184..96a4372 100644 --- a/app/src/main/res/values-el/arrays.xml +++ b/app/src/main/res/values-el/arrays.xml @@ -3,7 +3,7 @@ Προεπιλογή συστήματως Σκωτεινό AMOLED Black - Transparent (light) + Transparent Ανοιχτό \ No newline at end of file diff --git a/app/src/main/res/values-es-rMX/arrays.xml b/app/src/main/res/values-es-rMX/arrays.xml index 5248cbd..0309e88 100644 --- a/app/src/main/res/values-es-rMX/arrays.xml +++ b/app/src/main/res/values-es-rMX/arrays.xml @@ -3,7 +3,7 @@ Sistema Oscuro AMOLED Black - Transparent (light) + Transparent Claro \ No newline at end of file diff --git a/app/src/main/res/values-et/arrays.xml b/app/src/main/res/values-et/arrays.xml index a509f66..a16f802 100644 --- a/app/src/main/res/values-et/arrays.xml +++ b/app/src/main/res/values-et/arrays.xml @@ -3,7 +3,7 @@ Süsteem Tume AMOLED Black - Transparent (light) + Transparent Hele diff --git a/app/src/main/res/values-fr/arrays.xml b/app/src/main/res/values-fr/arrays.xml index b407b43..b78a1b4 100644 --- a/app/src/main/res/values-fr/arrays.xml +++ b/app/src/main/res/values-fr/arrays.xml @@ -3,7 +3,7 @@ Système Sombre AMOLED Black - Transparent (light) + Transparent Clair diff --git a/app/src/main/res/values-id/arrays.xml b/app/src/main/res/values-id/arrays.xml index 944a65e..277a9ea 100644 --- a/app/src/main/res/values-id/arrays.xml +++ b/app/src/main/res/values-id/arrays.xml @@ -3,7 +3,7 @@ Sistem Gelap AMOLED Black - Transparent (light) + Transparent Terang diff --git a/app/src/main/res/values-ja/arrays.xml b/app/src/main/res/values-ja/arrays.xml index 8229c0d..0528258 100644 --- a/app/src/main/res/values-ja/arrays.xml +++ b/app/src/main/res/values-ja/arrays.xml @@ -3,7 +3,7 @@ システムの設定を使用 ダーク AMOLED Black - Transparent (light) + Transparent ライト diff --git a/app/src/main/res/values-land/dimens.xml b/app/src/main/res/values-land/dimens.xml new file mode 100644 index 0000000..96d25a4 --- /dev/null +++ b/app/src/main/res/values-land/dimens.xml @@ -0,0 +1,4 @@ + + 48dp + 48dp + \ No newline at end of file diff --git a/app/src/main/res/values-pt-rBR/arrays.xml b/app/src/main/res/values-pt-rBR/arrays.xml index b52106b..72e9cf8 100644 --- a/app/src/main/res/values-pt-rBR/arrays.xml +++ b/app/src/main/res/values-pt-rBR/arrays.xml @@ -3,7 +3,7 @@ Sistema Escuro AMOLED Black - Transparent (light) + Transparent Claro \ No newline at end of file diff --git a/app/src/main/res/values-ro/arrays.xml b/app/src/main/res/values-ro/arrays.xml index a0a80e8..de0a9b6 100644 --- a/app/src/main/res/values-ro/arrays.xml +++ b/app/src/main/res/values-ro/arrays.xml @@ -5,7 +5,7 @@ Sistem Întunecată AMOLED Black - Transparent (light) + Transparent Luminoasă diff --git a/app/src/main/res/values-ru/arrays.xml b/app/src/main/res/values-ru/arrays.xml index 050de99..7b2632c 100644 --- a/app/src/main/res/values-ru/arrays.xml +++ b/app/src/main/res/values-ru/arrays.xml @@ -3,7 +3,7 @@ Как в системе Тёмная AMOLED Black - Transparent (light) + Transparent Светлая diff --git a/app/src/main/res/values-sk/arrays.xml b/app/src/main/res/values-sk/arrays.xml index c9dafec..65f1605 100644 --- a/app/src/main/res/values-sk/arrays.xml +++ b/app/src/main/res/values-sk/arrays.xml @@ -3,7 +3,7 @@ Podľa systému Tmavá AMOLED Black - Transparent (light) + Transparent Svetlá diff --git a/app/src/main/res/values-tr/arrays.xml b/app/src/main/res/values-tr/arrays.xml index cdfda29..232c2e1 100644 --- a/app/src/main/res/values-tr/arrays.xml +++ b/app/src/main/res/values-tr/arrays.xml @@ -3,7 +3,7 @@ Sistem Koyu AMOLED Black - Transparent (light) + Transparent Açık \ No newline at end of file diff --git a/app/src/main/res/values-vi/arrays.xml b/app/src/main/res/values-vi/arrays.xml index 96fa5c1..902dd7e 100644 --- a/app/src/main/res/values-vi/arrays.xml +++ b/app/src/main/res/values-vi/arrays.xml @@ -4,7 +4,7 @@ Hệ thống Tối AMOLED Black - Transparent (light) + Transparent Sáng \ No newline at end of file diff --git a/app/src/main/res/values-w1240dp/dimens.xml b/app/src/main/res/values-w1240dp/dimens.xml new file mode 100644 index 0000000..d73f4a3 --- /dev/null +++ b/app/src/main/res/values-w1240dp/dimens.xml @@ -0,0 +1,3 @@ + + 200dp + \ No newline at end of file diff --git a/app/src/main/res/values-w600dp/dimens.xml b/app/src/main/res/values-w600dp/dimens.xml new file mode 100644 index 0000000..96d25a4 --- /dev/null +++ b/app/src/main/res/values-w600dp/dimens.xml @@ -0,0 +1,4 @@ + + 48dp + 48dp + \ No newline at end of file diff --git a/app/src/main/res/values/arrays.xml b/app/src/main/res/values/arrays.xml index 90b1dfa..b50297b 100644 --- a/app/src/main/res/values/arrays.xml +++ b/app/src/main/res/values/arrays.xml @@ -14,7 +14,7 @@ System Dark AMOLED Black - Transparent (light) + Transparent Light Don't prompt again diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index aba6f1a..4eaf26b 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -272,102 +272,15 @@ Could not load the zip file Could not load the module properties Install %s? - Do you really want to install the module \"%s\" from the ZIP file \"%s\"? Installing untrusted modules can lead to security risks. + Do you really want to install the module \"%1$s\" from the ZIP file \"%2$s\"?\n\nMake sure you trust the source of this module, as modules are very powerful and can do almost anything. Developed in part by Androidacy Huge shoutout to Androidacy for their integration and contributions to the app. And of course, thanks to all of our contributors, whether it\'s translations, code, or just being fun to hang out with! We love you all. Inspecting module… - Warning! This module has indicators it may have been installed without your knowledge, or may be attempting to hide itself. Uninstall is strongly recommended. - I understandChoose themeChoose language - SetupActivity - -"Material is the metaphor.\n\n" - -"A material metaphor is the unifying theory of a rationalized space and a system of motion." -"The material is grounded in tactile reality, inspired by the study of paper and ink, yet " -"technologically advanced and open to imagination and magic.\n" -"Surfaces and edges of the material provide visual cues that are grounded in reality. The " -"use of familiar tactile attributes helps users quickly understand affordances. Yet the " -"flexibility of the material creates new affordances that supercede those in the physical " -"world, without breaking the rules of physics.\n" -"The fundamentals of light, surface, and movement are key to conveying how objects move, " -"interact, and exist in space and in relation to each other. Realistic lighting shows " -"seams, divides space, and indicates moving parts.\n\n" - -"Bold, graphic, intentional.\n\n" - -"The foundational elements of print based design typography, grids, space, scale, color, " -"and use of imagery guide visual treatments. These elements do far more than please the " -"eye. They create hierarchy, meaning, and focus. Deliberate color choices, edge to edge " -"imagery, large scale typography, and intentional white space create a bold and graphic " -"interface that immerse the user in the experience.\n" -"An emphasis on user actions makes core functionality immediately apparent and provides " -"waypoints for the user.\n\n" - -"Motion provides meaning.\n\n" - -"Motion respects and reinforces the user as the prime mover. Primary user actions are " -"inflection points that initiate motion, transforming the whole design.\n" -"All action takes place in a single environment. Objects are presented to the user without " -"breaking the continuity of experience even as they transform and reorganize.\n" -"Motion is meaningful and appropriate, serving to focus attention and maintain continuity. " -"Feedback is subtle yet clear. Transitions are efficient yet coherent.\n\n" - -"3D world.\n\n" - -"The material environment is a 3D space, which means all objects have x, y, and z " -"dimensions. The z-axis is perpendicularly aligned to the plane of the display, with the " -"positive z-axis extending towards the viewer. Every sheet of material occupies a single " -"position along the z-axis and has a standard 1dp thickness.\n" -"On the web, the z-axis is used for layering and not for perspective. The 3D world is " -"emulated by manipulating the y-axis.\n\n" - -"Light and shadow.\n\n" - -"Within the material environment, virtual lights illuminate the scene. Key lights create " -"directional shadows, while ambient light creates soft shadows from all angles.\n" -"Shadows in the material environment are cast by these two light sources. In Android " -"development, shadows occur when light sources are blocked by sheets of material at " -"various positions along the z-axis. On the web, shadows are depicted by manipulating the " -"y-axis only. The following example shows the card with a height of 6dp.\n\n" - -"Resting elevation.\n\n" - -"All material objects, regardless of size, have a resting elevation, or default elevation " -"that does not change. If an object changes elevation, it should return to its resting " -"elevation as soon as possible.\n\n" - -"Component elevations.\n\n" - -"The resting elevation for a component type is consistent across apps (e.g., FAB elevation " -"does not vary from 6dp in one app to 16dp in another app).\n" -"Components may have different resting elevations across platforms, depending on the depth " -"of the environment (e.g., TV has a greater depth than mobile or desktop).\n\n" - -"Responsive elevation and dynamic elevation offsets.\n\n" - -"Some component types have responsive elevation, meaning they change elevation in response " -"to user input (e.g., normal, focused, and pressed) or system events. These elevation " -"changes are consistently implemented using dynamic elevation offsets.\n" -"Dynamic elevation offsets are the goal elevation that a component moves towards, relative " -"to the component’s resting state. They ensure that elevation changes are consistent " -"across actions and component types. For example, all components that lift on press have " -"the same elevation change relative to their resting elevation.\n" -"Once the input event is completed or cancelled, the component will return to its resting " -"elevation.\n\n" - -"Avoiding elevation interference.\n\n" - -"Components with responsive elevations may encounter other components as they move between " -"their resting elevations and dynamic elevation offsets. Because material cannot pass " -"through other material, components avoid interfering with one another any number of ways, " -"whether on a per component basis or using the entire app layout.\n" -"On a component level, components can move or be removed before they cause interference. " -"For example, a floating action button (FAB) can disappear or move off screen before a " -"user picks up a card, or it can move if a snackbar appears.\n" -"On the layout level, design your app layout to minimize opportunities for interference. " -"For example, position the FAB to one side of stream of a cards so the FAB won’t interfere " -"when a user tries to pick up one of cards.\n\n" - + This module has indicators it may have been installed without your knowledge, or may be attempting to hide itself.\n\nUninstall is strongly recommended. + I understand + Choose theme + Choose language + Setup Wizard Settings diff --git a/app/src/main/res/values/themes.xml b/app/src/main/res/values/themes.xml index c6c3c8e..14aad4f 100644 --- a/app/src/main/res/values/themes.xml +++ b/app/src/main/res/values/themes.xml @@ -37,18 +37,23 @@ @color/black -