Introducing a new way to review your PRs.

Read the announcement

shmykelsa / aaad

The original application for downloading and installing apps made specifically for Android Auto outside of Google Play Store. Active since 2021.

View on GitHub

6 documents · Updated Nov 16, 2026

docs / dialogs-and-shared-ui-components

Dialogs and Shared UI Components

Overview

This area contains the reusable dialog wrappers, menu declarations, lightweight shared layouts, and animation resources available to the AAAD Android app. The only executable dialog code in this scope is app/…/AboutDialog.java and app/…/BottomDialog.java; the remaining covered files are Android resources that app flows can inflate or attach from activities/fragments.

app/…/AboutDialog.java is an androidx.fragment.app.DialogFragment that builds an AlertDialog for the app's About screen. It expects its arguments bundle to contain a string under key did, then concatenates R.string.about_part_one, R.string.about_part_three, R.string.about_part_two, and the device id into HTML text. The dialog is cancelable, has an OK positive button with no extra action, and a R.string.privacy negative button that replaces the builder message with R.string.privacy_policy and shows a second AlertDialog. The first dialog enables LinkMovementMethod on android.R.id.message, so links embedded in the About HTML can be tapped.

app/…/BottomDialog.java is a local builder-style facade over the third-party BottomDialogs dependency declared in app/build.gradle as com.github.iGio90:BottomDialogs:master-SNAPSHOT. BottomDialog.Builder accepts title/content strings or string resources, an icon drawable or drawable resource, background and shadow sizing, positive/negative button labels, optional ButtonCallbacks, cancelability, auto-dismiss behavior, and an optional custom view with dp-based padding. build() creates a BottomDialog; show() builds and immediately displays it. At creation time BottomDialog inflates com.github.javiersantos.bottomdialogs.R.layout.library_bottom_dialog, locates the library's container, shadow, icon, title, content, custom-view frame, cancel button, and OK button, then applies AAAD styling from R.color.dialog_text_color, R.style.TitleBarTextAppearance, and R.style.NormalTextAppeareance. Positive and negative callbacks receive the owning BottomDialog, and the underlying Dialog is dismissed after the callback unless autoDismiss(false) was set.

app/…/UtilsLibrary.java is the direct helper used by BottomDialog: it converts dp padding/shadow values to pixels and creates the rounded ripple drawable used as the positive button background. Its ripple color comes from the current theme's com.github.javiersantos.bottomdialogs.R.attr.colorControlHighlight, with a gray fallback.

The shared layout resources are simple building blocks rather than full screens. app/…/dialog_layout.xml and app/…/app_button.xml are currently identical scrollable containers with @drawable/dialog_background and a centered TextView at @id/dialog_content; both use @color/dialog_text_color and Material text appearance. app/…/header.xml provides a compact section/header row with @id/header_text, uppercase text, @font/raleway_light, and @color/dialog_text_color. app/…/dialog_background.xml supplies the rounded gradient used by dialog_layout.xml and app_button.xml.

app/…/menu.xml defines the app's overflow/menu contract: @id/infos for About, @id/help, @id/transfer_license, @id/show_intro, a checkable @id/debug_mode, and a disabled @id/version item whose title uses @string/version_format. app/…/shake.xml is a short horizontal translate animation, moving from -5% to 5% for 25 ms and repeating eight times in reverse, suitable for invalid-input feedback.

At this commit, the covered Java/Kotlin source under app/src/main/java/com/legs/appsforaa does not contain direct call sites for AboutDialog, BottomDialog, R.layout.dialog_layout, R.layout/header, R.layout.app_button, R.menu.menu, or R.anim.shake; these components are shared assets/APIs that other app flows can wire in without owning their definitions.

Coupling

  • If app/build.gradle changes the BottomDialogs dependency, also verify app/…/BottomDialog.java: it references the dependency's generated package, style, layout, ids, color, and attrs directly (com.github.javiersantos.bottomdialogs.R.*), so a library resource rename breaks dialog creation at compile time or view lookup at runtime.
  • If app/…/AboutDialog.java is shown from a new flow, pass a non-null arguments bundle with string key did; the dialog calls getArguments().getString("did") without a null guard before composing the About message.
  • If the About or privacy strings in app/…/strings.xml add links or HTML, verify app/…/AboutDialog.java: the initial About dialog enables LinkMovementMethod after show(), while the privacy dialog is created separately inside the negative-button callback and does not reapply link movement handling.
  • If app/…/menu.xml item ids or string keys change, update the activity or fragment that handles menu selection at the same time; callers will branch on ids such as @id/infos, @id/debug_mode, and @id/version, and @id/version is intentionally disabled in the resource.
  • If app/…/dialog_layout.xml or app/…/app_button.xml changes @id/dialog_content, update any inflater/binder that writes dialog text into that shared TextView; the two resources currently expose the same id and visual structure.
  • If app/…/header.xml changes @id/header_text, update any list adapter or section-header binder that inflates this layout; the text view is the only bindable child in the header resource.
  • If app/…/styles.xml changes TitleBarTextAppearance or NormalTextAppeareance, review app/…/BottomDialog.java because it applies those styles programmatically after setting title/content colors.

Risks

  • app/…/BottomDialog.java is tightly coupled to app/build.gradle's com.github.iGio90:BottomDialogs:master-SNAPSHOT dependency. Because it imports generated resources from the dependency's com.github.javiersantos.bottomdialogs.R namespace instead of an AAAD-owned layout, a dependency update can remove or rename library_bottom_dialog, bottomDialog_ok, bottomDialog_cancel, or the style/attrs and break dialog initialization.
  • app/…/AboutDialog.java assumes getContext(), getArguments(), and the did argument are available during onCreateDialog; if a caller constructs the fragment without arguments or shows it after the fragment is detached, dialog creation can crash before any UI is shown.
  • app/…/BottomDialog.java has a Builder.setBackgroundColor(int colorRes) method that calls context.getResources().getColor(colorRes). If a caller passes a raw color integer instead of a color resource id, the builder can resolve the wrong resource or throw a resource lookup exception before the dialog is displayed.