Exteragram Customizations
Overview
This doc covers the Exteragram-owned Android customization layer:
TMessagesProj/src/main/java/com/exteragram/messenger/**- TMessagesProj/…/extera.xml
TMessagesProj/src/main/res/drawable*/extera*andTMessagesProj/src/main/res/mipmap*/extera*(no matching files at this snapshot)
The center of the module is TMessagesProj/…/ExteraConfig.java. It eagerly loads the exteraconfig SharedPreferences file into static fields and exposes helpers for values that Telegram UI code consumes at runtime: avatar rounding, drawer item visibility, icon pack selection, photo quality, double-tap seek duration, update settings, Google analytics/crashlytics opt-ins, translation target language, and official Exteragram/AyuGram channel or developer detection. Preference activities write through ExteraConfig.editor and update the corresponding static field immediately, so callers generally read ExteraConfig.* fields directly rather than re-reading preferences.
The Exteragram preferences UI is implemented under TMessagesProj/src/main/java/com/exteragram/messenger/preferences/**. BasePreferencesActivity.java provides the common Telegram BaseFragment/RecyclerListView shell and row type factory. MainPreferencesActivity.java is the entry screen; Telegram routes to it from TMessagesProj/…/ProfileActivity.java when the Exteragram settings row is tapped, while the adjacent AyuGram settings row opens AyuGram’s own AyuGramPreferencesActivity. The Exteragram screen links to update info, AyuGram GitHub/channel/chat/Crowdin URLs, and four subpages:
- GeneralPreferencesActivity.java controls CameraX selection/quality, number/time formatting, tablet mode, speed boost toggles, profile phone/ID display, and archive behavior.
- AppearancePreferencesActivity.java controls avatar corners, chat list title/status layout, folder tab title/style/counters, Solar icons, FAB shape, blur/snow/fonts/switch/divider/navigation styling, and drawer icon/event/visibility options. It posts Telegram
NotificationCenterevents and rebuilds fragments when values affect existing Telegram views. - ChatsPreferencesActivity.java controls sticker preview size/shape/time/category behavior, double-tap actions and reaction, chat/admin/message menu shortcuts, photo quality/counter/camera tile behavior, and video message playback/camera controls.
- OtherPreferencesActivity.java controls Google Crashlytics/Analytics collection, clears Exteragram preferences, reloads icons/resources, recreates locale formatters, and includes a delayed destructive delete-account flow.
Localized strings for these screens and their feature affordances live in TMessagesProj/…/extera.xml with overlays in locale-specific values-*/extera.xml files. The base file also defines exteraAppName as AyuGram, update strings, message-details labels, app-icon labels, boost/encryption labels, and utility strings such as RestartRequired and ResetSettingsBulletin; the localized overlay files mostly translate the same Exteragram preference labels.
Runtime integration with Telegram/AyuGram happens through small wrappers plus direct imports from Telegram code. TMessagesProj/…/LaunchActivity.java wraps Android resources with ExteraResources, whose getDrawableForDensity() remaps drawable IDs through ExteraConfig.getIconPack(). com/…/IconSetsController.java holds the Solar icon SparseIntArray, SolarIconSet.java installs it, and EmptyIconSet.java leaves Telegram’s original IDs unchanged. When the Solar preference changes, AppearancePreferencesActivity.java calls LaunchActivity.reloadIcons(), Theme.reloadAllResources(), and rebuilds fragments so existing Telegram views resolve the new drawables.
The CameraX path is owned by TMessagesProj/src/main/java/com/exteragram/messenger/camera/**. CameraXController.java binds CameraX preview, image capture, and video capture use cases, chooses front/back/wide/extension modes, maps Exteragram’s optimized-mode and resolution preferences into CameraX quality/capture settings, writes photos through JpegImageUtils, and emits video thumbnails for Telegram send flow. CameraXView.java adapts that controller to Telegram’s BaseCameraView API with preview fade/flip/effect animations, focus rings, flash, zoom, exposure, orientation tracking, haptics, and lifecycle cleanup. Telegram attachment and instant-camera code select this path when CameraX is supported and ExteraConfig.cameraType == 1; otherwise they stay on Telegram’s built-in camera or the system camera route.
The updater path is TMessagesProj/…/UpdaterUtils.java plus preferences/…/UpdaterBottomSheet.java and UpdaterBottomSheet2.java. LaunchActivity calls UpdaterUtils.checkUpdates() on startup when ExteraConfig.checkUpdatesOnLaunch is enabled, and the preferences screen can trigger manual checks. The updater queries GitHub releases under AyuConstants.APP_GITHUB, switches to the beta repo name for beta builds, selects an asset matching the installed APK ABI suffix, stores OTA files under the app external-files ota/<version>/update.apk directory, and installs via DownloadManager plus the app FileProvider.
Other feature packages are mostly adapters consumed from Telegram UI:
- components/TranslateBeforeSendWrapper.java renders a Telegram popup item for “translate before send”, stores the target language in
ExteraConfig.targetLanguage, and expects subclasses/callers to implement the click action. utils/TranslatorUtils.java performs Google Translate web requests on aDispatchQueue, optionally using Telegram’sLanguageDetector, and returns results on the UI thread. - components/MessageDetailsPopupWrapper.java builds a swipe-back popup of message metadata (IDs, dates, forwards/views, media file path/share, dimensions, bitrate, datacenter, sticker-set owner) and includes an AyuGram deleted-message hook through
AyuMessagesController. - boost/BoostController.java, boost/…/EncryptionHelper.java, boost/…/BaseEncryptor.java, and boost/…/ZalgoFilter.java are compatibility stubs: booster status is always false, encryption/decryption returns null/false/defaults, and Zalgo filtering currently returns the input unchanged.
- utils/AppUtils.java supplies notification colors, date/event-based drawer icon packs, winter detection, and an app signature/package-name modification check; utils/ChatUtils.java, LocaleUtils.java, PopupUtils.java, CanvasUtils.java, MonetUtils.java, FontUtils.java, FolderIcons.java, CrashlyticsUtils.java, and SystemUtils.java provide supporting UI, locale, drawing, system, and telemetry helpers used by the preference previews and Telegram integrations.
Path-routing notes: code under com/exteragram/messenger/preferences/** owns only the Exteragram settings pages, while AyuGram preferences live under com.radolyn.ayugram. Exteragram resources are not isolated by package at runtime: values*/extera.xml contributes normal R.string.* entries, and Solar icon remapping changes R.drawable.* lookups globally through LaunchActivity.getResources(). The covered drawable*/extera* and mipmap*/extera* globs are reserved for Exteragram-branded resource overlays but are empty in this revision.
Coupling
- If a new Exteragram preference is added in any preferences/*PreferencesActivity.java, also update ExteraConfig.java with a static field, load default, and write key; Telegram call sites read static fields directly and will not see a preference that only exists in UI code.
- If a preference affects already-mounted Telegram UI, mirror the existing notification/rebuild pattern in the owning preferences activity. For example, folder/tab changes in AppearancePreferencesActivity.java post
NotificationCenter.dialogFiltersUpdated, drawer visibility usesExteraConfig.toggleDrawerElements()andNotificationCenter.mainUserInfoChanged, and icon changes callLaunchActivity.reloadIcons()plusTheme.reloadAllResources(). - If adding or renaming strings referenced from
com/exteragram/messenger/**, update TMessagesProj/…/extera.xml first and then the values-*/extera.xml overlays. These strings compile into the shared TelegramRnamespace, so a missing base string breaks Java references regardless of locale coverage. - If adding Solar icon coverage in IconSetsController.java, verify the mapped
R.drawable.*_solarasset exists outside this doc’s covered paths and thatLaunchActivity.reloadIcons()is reachable after preference changes;ExteraResources.getDrawableForDensity()blindly redirects every drawable ID through the active map. - If changing CameraX controller semantics in camera/CameraXController.java or camera/CameraXView.java, verify the Telegram callers in org/…/ChatAttachAlertPhotoLayout.java and org/…/InstantCameraView.java; they branch on
CameraXUtils.isCameraXSupported()andExteraConfig.cameraType == 1and then cast toCameraXViewfor flash/effects/exposure/recording APIs. - If changing updater release selection in utils/UpdaterUtils.java, verify
com.radolyn.ayugram.AyuConstants.APP_GITHUB,BuildVars.isBetaApp(), and APKversionCode % 10packaging conventions together; the asset picker depends on all three to choose the correct GitHub release asset.
Risks
- TMessagesProj/…/ExteraConfig.java keeps process-wide mutable static preference fields. If code writes to
preferenceswithout also updating the matching static field, current UI/runtime behavior stays stale untilclearPreferences()or process restart. - TMessagesProj/…/ExteraResources.java overrides only
getDrawableForDensity(). If Telegram loads icons through anotherResourcesmethod or caches drawables beforeLaunchActivity.reloadIcons(), Solar icon changes may be partial untilTheme.reloadAllResources()and fragment rebuilds complete. - TMessagesProj/…/CameraXController.java catches unsupported CameraX surface combinations by rebinding without video capture or without image capture in selected paths. If caller assumptions change in ChatAttachAlertPhotoLayout.java or InstantCameraView.java, photo/video actions can fail on devices that enter the workaround path.
- TMessagesProj/…/UpdaterUtils.java downloads executable APKs from GitHub release metadata and installs via
DownloadManager/FileProvider. If the release asset naming or ABI suffix convention drifts, users may be offered the wrong APK or no update; there is no cryptographic verification in this module.