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 #38

Open
wants to merge 3 commits into
base: dev
Choose a base branch
from

Conversation

pr0t3us
Copy link
Contributor

@pr0t3us pr0t3us commented Mar 1, 2021

This PR fixes #23 and #35.
Increased AppCompat version to 1.2.0 and adjusted the context wrapping based on changes described in this answer.

Changes

Instead of the old approach with override attachBaseContext 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()) {
        ViewPumpContextWrapper.wrap(Philology.wrap(it))
    }

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

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.

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
1 participant