♻️ refactor(onboarding): use static arrays for tutorial step data, update string resources to reduce memory footprint

This commit is contained in:
sankalp committed 2025-07-03 23:36:46 +05:45
1 parent 4b6035ee02
commit 9e40aab8f0
3 files changed
+23 -31

No files matched your search

@@ -39,24 +39,16 @@ public class OnboardingTutorialDialog extends Dialog implements View.OnClickList
private int currentStep = 1; private int currentStep = 1;
private static final int TOTAL_STEPS = 7; private static final int TOTAL_STEPS = 7;
// Tutorial step data // Tutorial step data - using static arrays to reduce memory footprint
private final int[] stepTitles = { private static final int[] STEP_TITLES = {
R.string.tutorial_step_1_title, R.string.tutorial_step_1_title, R.string.tutorial_step_2_title, R.string.tutorial_step_3_title,
R.string.tutorial_step_2_title, R.string.tutorial_step_4_title, R.string.tutorial_step_5_title, R.string.tutorial_step_6_title,
R.string.tutorial_step_3_title,
R.string.tutorial_step_4_title,
R.string.tutorial_step_5_title,
R.string.tutorial_step_6_title,
R.string.tutorial_step_7_title R.string.tutorial_step_7_title
}; };
private final int[] stepContents = { private static final int[] STEP_CONTENTS = {
R.string.tutorial_step_1_content, R.string.tutorial_step_1_content, R.string.tutorial_step_2_content, R.string.tutorial_step_3_content,
R.string.tutorial_step_2_content, R.string.tutorial_step_4_content, R.string.tutorial_step_5_content, R.string.tutorial_step_6_content,
R.string.tutorial_step_3_content,
R.string.tutorial_step_4_content,
R.string.tutorial_step_5_content,
R.string.tutorial_step_6_content,
R.string.tutorial_step_7_content R.string.tutorial_step_7_content
}; };
@@ -120,13 +112,13 @@ public class OnboardingTutorialDialog extends Dialog implements View.OnClickList
private void updateStepContent() { private void updateStepContent() {
// Update title // Update title
titleView.setText(stepTitles[currentStep - 1]); titleView.setText(STEP_TITLES[currentStep - 1]);
// Update step indicator // Update step indicator
stepIndicatorView.setText(currentStep + " / " + TOTAL_STEPS); stepIndicatorView.setText(currentStep + "/" + TOTAL_STEPS);
// Update content // Update content
contentView.setText(stepContents[currentStep - 1]); contentView.setText(STEP_CONTENTS[currentStep - 1]);
// Update button visibility and text // Update button visibility and text
if (currentStep == 1) { if (currentStep == 1) {
@@ -26,9 +26,9 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginBottom="16dp" android:layout_marginBottom="16dp"
android:gravity="center" android:gravity="center"
android:text="1 / 7" android:text="1/7"
android:textColor="@android:color/white" android:textColor="@android:color/white"
android:textSize="14sp" android:textSize="12sp"
android:alpha="0.7" /> android:alpha="0.7" />
<!-- Content --> <!-- Content -->
+11 -11
View File
@@ -116,26 +116,26 @@
<string name="onboarding_close">Close</string> <string name="onboarding_close">Close</string>
<!-- Tutorial Steps --> <!-- Tutorial Steps -->
<string name="tutorial_step_1_title">Welcome to Lunox Launcher</string> <string name="tutorial_step_1_title">Welcome to Lunox</string>
<string name="tutorial_step_1_content">Lunox is a minimalist text-based launcher that puts simplicity first. All your apps are displayed as text in a clean, distraction-free interface.</string> <string name="tutorial_step_1_content">A minimalist text-based launcher. Apps are displayed as text in a clean interface.</string>
<string name="tutorial_step_2_title">Opening Apps</string> <string name="tutorial_step_2_title">Opening Apps</string>
<string name="tutorial_step_2_content">Simply tap on any app name to open it. Apps are sorted alphabetically by default, but you can change the sorting in settings.</string> <string name="tutorial_step_2_content">Tap any app name to open it. Apps are sorted alphabetically by default.</string>
<string name="tutorial_step_3_title">Search Functionality</string> <string name="tutorial_step_3_title">Search</string>
<string name="tutorial_step_3_content">Swipe down to up anywhere on the screen to open the search bar. Start typing to quickly find and launch any app.</string> <string name="tutorial_step_3_content">Swipe down to up to open search. Start typing to find apps quickly.</string>
<string name="tutorial_step_4_title">App Options</string> <string name="tutorial_step_4_title">App Options</string>
<string name="tutorial_step_4_content">Long press on any app to access options like rename, hide, uninstall, change colors, and more customization features.</string> <string name="tutorial_step_4_content">Long press any app for options: rename, hide, colors, and more.</string>
<string name="tutorial_step_5_title">Launcher Settings</string> <string name="tutorial_step_5_title">Settings</string>
<string name="tutorial_step_5_content">Long press on empty space to access launcher settings. Here you can change themes, fonts, sorting options, and other preferences.</string> <string name="tutorial_step_5_content">Long press empty space for launcher settings: themes, fonts, sorting.</string>
<string name="tutorial_step_6_title">Customization</string> <string name="tutorial_step_6_title">Customization</string>
<string name="tutorial_step_6_content">Personalize your launcher with different themes, custom colors for apps, font options, and various sorting methods to make it truly yours.</string> <string name="tutorial_step_6_content">Personalize with themes, colors, fonts, and sorting methods.</string>
<string name="tutorial_step_7_title">You\'re All Set!</string> <string name="tutorial_step_7_title">Ready!</string>
<string name="tutorial_step_7_content">That\'s all you need to know to get started with Lunox. Enjoy your clean, minimalist launcher experience!</string> <string name="tutorial_step_7_content">You\'re all set. Enjoy your minimalist launcher!</string>
<string name="tutorial_replay">Show Tutorial</string> <string name="tutorial_replay">Show Tutorial</string>