A vibe-coded pure native Android application for viewing and editing teletext pages in multiple historical formats.
- Package Name:
bg.alesla.teletexting - Minimum SDK: 23 (Android 6.0)
- Target SDK: 33 (Android 13)
- Language: Kotlin (100%)
- UI: XML layouts
The application supports 6 teletext formats and 1 image format:
- MRG Systems TTI (Teletext Interchange) -
.tti - 7-bit Escaped TTI (TTI eXtended) -
.ttix - Softel EP1 (Softel Page 1) -
.ep1 - Teletext Packets (T42) -
.t42 - Binary Dump (Raw page data) -
.bin - Cebra Teletext TTX -
.ttx(the app doesn't parse it properly, for future improvement) - Hi-Resolution PNG (Export only) -
.png
The custom TeletextView implements Level 1 teletext specifications:
- Grid System: 40 columns ร 25 rows
- Level 1 Control Codes:
- Text colors (Red, Green, Yellow, Blue, Magenta, Cyan, White, Black)
- Graphics colors, and mosaic characters
- Flash attribute (animated at 500ms intervals)
- Double height text
- Background colors (Black background, New background)
- Hold graphics
- Separated/Contiguous graphics
- Multilingual support: 13 different charsets
- File Operations: Open, Save, Save As using Android Storage Access Framework
- Page Navigation: Previous/Next page buttons, and specific magazine/page/subpage selection
- Cursor Control: Tap any cell to place the cursor
- Character Input: Tap cursor position to enter characters
- Attribute Toggling: Insert flash and other control codes
- Color Palette: Quick access to 8 teletext colors in 2 modes: alphanumeric and mosaic symbols
- Visual Toggles: Show/hide grid and control codes, black and white mode
- Page Editing Options: Select, copy, cut, and paste entire rows or regions of teletext pages
The status bar shows:
- Page Address: Current page/subpage number
- Character Position: Column and row coordinates
- Hex Value: Character code at cursor
- CRC Status: Data integrity indicator (Green = valid, Red = invalid)
bg.alesla.teletexting/
โโโ MainActivity.kt # Main application activity
โโโ view/
โ โโโ TeletextView.kt # Custom rendering view
โโโ parsers/
โ โโโ TTIParser.kt # MRG Systems TTI format
โ โโโ TTIxParser.kt # 7-bit Escaped TTIx format
โ โโโ EP1Parser.kt # Softel EP1 format
โ โโโ T42Parser.kt # Teletext Packets
โ โโโ BinaryParser.kt # Raw binary format
โ โโโ TTXParser.kt # Cebra TTX format
โโโ utils/
โ โโโ CRCCalculator.kt # Data integrity checking
โโโ res/
โโโ layout/
โ โโโ activity_main.xml # Main UI layout
โโโ menu/
โโโ main_menu.xml # Application menu
Custom View implementing teletext rendering:
- Attribute Processing: Scans each row left-to-right, tracking control code states
- Background Drawing: Respects double-height cells (spans 2 rows)
- Character Rendering: Uses custom pixelated fonts with proper baseline alignment
- Double Height: Single character drawn at 2ร size spanning two cells, with proper clipping
- Mosaic Graphics: Draws 6-sixel graphics based on bit patterns
- Flash Animation: Toggles visibility every 500ms via Handler
- Gesture Detection: Touch coordinates scaled for proper cursor positioning
- Custom Fonts: Supports external TTF fonts for authentic teletext appearance
Each parser implements:
parse(): Converts format-specific bytes/text to standardArray<IntArray>(25ร40)serialize(): Converts page data back to format-specific output
- Text-based with escape sequences
- Control codes escaped as
ESC + (code + 0x40) - Metadata: Page number, description, charset
- Almost the same as TTI - text-based with escape sequences
- Control codes converted/escaped to fit within 7-bit ASCII by using Prestel escape codes
- Binary with 6-byte header:
0xFE 0x01 [4 bytes] - 960 bytes of page data (25 rows ร 40 columns)
- 42-byte packets: 2 address bytes + 40 data bytes
- Hamming 8/4 encoding for addresses
- Row 0 contains the page number in the Hamming-encoded header
- Similar to T42 with 42-byte packets
- Hamming encoding for addresses and page numbers
- Data bytes have parity bit set (OR 0x80)
- Raw 1000 bytes (25 rows ร 40 columns)
- No header or metadata
- Auto-detects EP1 if signature present
CRC-16-CCITT algorithm:
- Polynomial: 0x1021
- Initial value: 0xFFFF
- Processes all 1000 bytes of page data
- Toolbar: App title and menu actions
- ScrollView: Allows panning for a large teletext display
- TeletextView: Centered rendering canvas
- Navigation: Page previous/next buttons and address bar with selections
- Color Palette: 16 color buttons for quick attribute insertion: 8 for alphanumeric, and 8 for mosaic symbols
- Undo / Redo
- Open file
- Save / Save As
- Export PNG
- Clear page
- Start / Extend / Clear selection of a teletext page
- Copy / Cut / Paste / Insert a single row, or a selection of a page
- Toggle grid overlay
- Show control codes
- Insert flash attribute
- Delete page
- Black and White mode
- Android Studio Electric Eel or newer
- Kotlin plugin 1.7+
- Gradle 7.4+
-
Clone/Create Project:
# Create a new Android project in Android Studio # Package: bg.alesla.teletexting # Minimum SDK: 23 # Target SDK: 33
-
Add Files:
- Copy all Kotlin files to the corresponding packages
- Copy XML files to
res/layout/andres/menu/ - Update
AndroidManifest.xml - Update
build.gradledependencies
-
Add Custom Fonts (Optional but Recommended):
- Create directory:
app/src/main/assets/fonts/ - Add
teletext.ttf(normal height font) - Add
teletext_double.ttf(double height font)
- Create directory:
-
Build:
./gradlew assembleDebug
-
Install:
./gradlew installDebug
- Tap Open in toolbar
- Select a teletext file (.tti, .ttix, .ep1, .t42, .ttx, .bin)
- File loads and displays in a grid
- Tap any cell to move cursor
- Tap cursor to enter character
- Use color palette to insert color control codes
- Menu โ Insert Flash to add flash attribute
- Save to overwrite current file
- Save As to create a new file with the selected format
- Export As to export the file in another format
- Export PNG to create high-resolution image
- Export HTML to export the teletext pages in HTML
- Prev/Next buttons for multi-page documents
- Scroll/zoom the canvas for better visibility
The app requests:
READ_EXTERNAL_STORAGE: To open teletext filesWRITE_EXTERNAL_STORAGE: To save files (Android 9 and below)
Android 10+ uses Scoped Storage (Storage Access Framework), which doesn't require permissions.
Based on ETSI EN 300 706 standard:
- 0x00-0x1F: Control codes
- 0x20-0x7F: Displayable characters and graphics
- 0x00-0x07: Text colors
- 0x08: Flash
- 0x09: Steady
- 0x0C: Normal height
- 0x0D: Double height
- 0x10-0x17: Graphics colors
- 0x19: Contiguous graphics
- 0x1A: Separated graphics
- 0x1C: Black background
- 0x1D: New background
- 0x1E: Hold graphics
- 0x1F: Release graphics
- 0x20-0x3F and 0x60-0x7F: Contiguous graphics by default, transformed into separated, using control code 0x1A before their beginning
- Each character represents 6 sixels (2ร3 grid)
- Bit pattern: 0x01=top-left, 0x02=top-right, 0x04=mid-left, 0x08=mid-right, 0x10=bottom-left, 0x40=bottom-right
Features for future implementation and improvement:
- Search and replace
- Repairing Cebra TTX Parser
- Level 1.5 features and others
No license specified.
- ETSI EN 300 706: Teletext specification
- @AndrewNile 's Teletext Meddler SE: Reference implementation
- Sample files provided for testing
For issues or questions about this MVP implementation, please refer to the teletext specifications at https://www.etsi.org/deliver/etsi_i_ets/300700_300799/300706/01_60/ets_300706e01p.pdf
