Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for AppCompat ver. 1.2.0 #4

Merged
merged 2 commits into from
Mar 25, 2021
Merged

Conversation

pr0t3us
Copy link

@pr0t3us pr0t3us commented Mar 25, 2021

This PR fixes JcMinarro#23 and JcMinarro#35.

Changes

  • Increased AppCompat version to 1.2.0 and adjusted the context wrapping based on changes described in this answer.

Instead of the old approach with attachBaseContext override from Activity - declare PhilologyAppCompatDelegateHolder in BaseActivity and supply the right delegate for androidx.appcompat.app.AppCompatActivity#getDelegate method:

    private val delegateHolder = PhilologyAppCompatDelegateHolder()
    override fun getDelegate() = delegateHolder.getDelegate(super.getDelegate())

The wrapped context will be reused inside activity on each getDelegate call.

Note:
⚠️ I've pinpointed CircleCi image to the latest successful docker image build before Update Java from v8 to v11. (#500) since it's incompatible with current Robolectric version

Screenshots

Before After

How to test

  1. Run the sample app (updated to AppCompat ver. 1.2.0)
  2. Philology should replace the text in the sample app based on the device locale.

@pr0t3us pr0t3us requested a review from a team March 25, 2021 08:12
Copy link

@ffelini ffelini left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍

@mbircu mbircu self-assigned this Mar 25, 2021
@mbircu mbircu merged commit b57b7cc into dev Mar 25, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Appcompat version 1.1.0 breaks resource interception
4 participants