feat: Implement Settings Screen, Dark Mode & Dynamic Auth Logic
Summary
This MR introduces a fully functional Settings Screen. It implements system-wide Light/Dark mode switching with persistent preferences and dynamic asset switching (logos). It also handles User Session logic, allowing guests to log in and users to log out, and fixes a layout truncation issue on the Quiz screen.
Key Changes
1. Theme System (Light/Dark Mode)
- Settings UI: Added a toggle switch to control the app theme.
- Dynamic Styling: Refactored all XML layouts to use Theme Attributes (?attr/colorBackground, ?attr/textColorPrimary) instead of hardcoded colors.
- Adaptive Assets: Implemented logo_dynamic.xml to automatically switch between the Black Logo (Light Mode) and White Logo (Dark Mode).
- Persistence: Theme preference is saved in SharedPreferences and applied immediately on app launch.
2. Authentication Flow
-
Dynamic Action: The Settings screen now detects if the current user is a "Guest" or a "Registered User".
- Guest: Shows "Log In / Sign Up" button.
- User: Shows "Log Out" button.
- Logout Logic: Clicking "Log Out" clears user session data and navigates back to the Login Screen, clearing the back stack.
3. UI/UX Fixes
- Quiz Screen: Wrapped the Quiz Game container in a NestedScrollView to prevent content (buttons/poster) from being cut off on smaller screens.
How to Test
- Theming: Go to Settings -> Toggle Dark Mode. Navigate to Home/Search/Profile to ensure colors adapt correctly (White background vs Black background).
- Logo: Verify the top logo in MainActivity changes color correctly when switching themes.
-
Auth:
- Log in as Guest -> Go to Settings -> Click "Log In" (Should go to Login screen).
- Log in as User -> Go to Settings -> Click "Log Out" (Should clear data and go to Login screen).
- Quiz: Start a quiz and ensure you can scroll down to see all answer options.