58 lines
1.9 KiB
Markdown
58 lines
1.9 KiB
Markdown
---
|
|
name: Landscape Only Mode
|
|
description: Fixed landscape orientation for all activities - no rotation handling needed
|
|
type: project
|
|
---
|
|
|
|
# Landscape Only Mode
|
|
|
|
App configured to run exclusively in landscape orientation.
|
|
|
|
## AndroidManifest.xml Configuration
|
|
|
|
```xml
|
|
<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 landscape
|
|
- `android: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:
|
|
```java
|
|
// 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:
|
|
|
|
1. **Memory savings** - No duplicate layouts in memory
|
|
2. **Simpler code** - No orientation change handling
|
|
3. **Consistent UI** - Always optimized for 4.8" landscape display
|
|
4. **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.
|