Skip to content

fix: Fix crash on entering MainActivity on some tablets#25

Merged
nikclayton merged 1 commit intopachli:developfrom
nikclayton:18-pixel-c-crash
Sep 11, 2023
Merged

fix: Fix crash on entering MainActivity on some tablets#25
nikclayton merged 1 commit intopachli:developfrom
nikclayton:18-pixel-c-crash

Conversation

@nikclayton
Copy link
Copy Markdown
Contributor

First crash appeared to be caused by a failure to find the attr/colorBackgroundAccent colour from the theme.

It wasn't clear why the attribute could not be found, so to fix it was simpler to remove the color and attribute entirely, and replace it with something more appropriate from the Material 3 tokens.

  • Preview cards are stroked with colorOutline
  • Poll options use colorPrimary (user's vote) or colorSecondary (other choices) with appropriate text colours.
  • Links in link preview cards use android:attr/textColorLink
  • The placeholder icon in preview cards uses ?android/textColorLink
  • Remove it from help_message_background, and stroke with ?colorOutline

Doing this I discovered several places where a colour was being specified unnecessarily, those have been removed.

To make it easier to understand the theme hierarchy that has been collapsed and renamed to follow Android conventions.

  • AppTheme -> Base.Theme.Pachli
  • BaseTheme -> Theme.Pachli
  • DefaultTheme has been removed as unnecessary

This unearthed a second crash, where attr/actionBarSizeWithSubtitle was not found.

To fix that create an explicit style for toolbars that need it, and apply the style (Pachli.Widget.Toolbar).

This also surfaced a third problem, where the fragment_timeline* layouts had not been updated in layout-sw640dp, so those have been updated to reflect the same views/IDs as the default fragment_timeline layout.

These changes caused a small chain of "unused resource" lint errors, which have been fixed by removing the unused colours.

The Android Material libraries were also being implicitly depended on through other library imports instead of being explicit. So include them as an explicit dependency.

Fixes #18

First crash appeared to be caused by a failure to find the
`attr/colorBackgroundAccent` colour from the theme.

It wasn't clear why the attribute could not be found, so to fix it was
simpler to remove the color and attribute entirely, and replace it with
something more appropriate from the Material 3 tokens.

- Preview cards are stroked with `colorOutline`
- Poll options use `colorPrimary` (user's vote) or `colorSecondary`
  (other choices) with appropriate text colours.
- Links in link preview cards use `android:attr/textColorLink`
- The placeholder icon in preview cards uses `?android/textColorLink`
- Remove it from `help_message_background`, and stroke with
  `?colorOutline`

Doing this I discovered several places where a colour was being
specified unnecessarily, those have been removed.

To make it easier to understand the theme hierarchy that has been
collapsed and renamed to follow Android conventions.

- AppTheme -> Base.Theme.Pachli
- BaseTheme -> Theme.Pachli
- DefaultTheme has been removed as unnecessary

This unearthed a second crash, where `attr/actionBarSizeWithSubtitle`
was not found.

To fix that create an explicit style for toolbars that need it, and
apply the style (`Pachli.Widget.Toolbar`).

This also surfaced a third problem, where the `fragment_timeline*`
layouts had not been updated in `layout-sw640dp`, so those have been
updated to reflect the same views/IDs as the default `fragment_timeline`
layout.

These changes caused a small chain of "unused resource" lint errors,
which have been fixed by removing the unused colours.

The Android Material libraries were also being implicitly depended on
through other library imports instead of being explicit. So include
them as an explicit dependency.

Fixes pachli#18
@nikclayton nikclayton changed the title fix: Fix crash on entering MainActivity on Pixel C devices fix: Fix crash on entering MainActivity on some tablets Sep 11, 2023
@nikclayton nikclayton merged commit 811856a into pachli:develop Sep 11, 2023
@nikclayton nikclayton deleted the 18-pixel-c-crash branch September 11, 2023 11:54
@nikclayton nikclayton added this to the 1.1 milestone Sep 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

Crash on login on Pixel Tablet, triggered by android.view.InflateException

1 participant