1.9 KiB
1.9 KiB
name, description, type
| name | description | type |
|---|---|---|
| Landscape Only Mode | Fixed landscape orientation for all activities - no rotation handling needed | project |
Landscape Only Mode
App configured to run exclusively in landscape orientation.
AndroidManifest.xml Configuration
<uses-feature android:name="android.hardware.screen.landscape" android:required="true" />
<activity
android:name=".MainActivity"
android:screenOrientation="landscape"
android:configChanges="orientation|screenSize">
</activity>
All activities (MainActivity, EstrategemasActivity, QRActivity) have:
android:screenOrientation="landscape"- Forces landscapeandroid:configChanges="orientation|screenSize"- Prevents activity recreation
Code Changes Required
Removed from all Activities:
onConfigurationChanged()method - no longer needed- Portrait-specific constants and logic
- Layout switching logic (portrait vs landscape)
QRActivity Specific:
// OLD: Size based on orientation
int qrSize = (orientation == LANDSCAPE) ? QR_SIZE_LANDSCAPE : QR_SIZE_PORTRAIT;
// NEW: Fixed landscape size
private static final int QR_SIZE = 360; // 180dp x 2 for xhdpi
Layout Structure
Only res/layout/ exists - no layout-land/ subdirectory needed.
All layouts are designed specifically for landscape (720x1280 on Galaxy S3).
Benefits for Galaxy S3:
- Memory savings - No duplicate layouts in memory
- Simpler code - No orientation change handling
- Consistent UI - Always optimized for 4.8" landscape display
- Better game experience - Estrategemas minigame designed for wide screen
Why: User requested fixed landscape for consistent Helldivers 2 theme experience. Removes complexity of handling rotation on low-memory devices.
How to apply: When creating new activities, always add android:screenOrientation="landscape". Never implement onConfigurationChanged(). Single layout folder only.