Coder Social home page Coder Social logo

inflationx / viewpump Goto Github PK

View Code? Open in Web Editor NEW
894.0 894.0 61.0 592 KB

View Inflation you can intercept.

License: Apache License 2.0

Java 31.96% Kotlin 68.04%
android inflation interceptor java post-inflation-interceptors pre-inflation-interceptors

viewpump's People

Contributors

chrisjenx avatar jbarr21 avatar kibotu avatar zacsweers avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

viewpump's Issues

Inflation time interceptor

  • Log all views that are inflated and their inflation times
  • Potentially highlight views in the UI that take too long

Recipes page for potential use cases

Add a Wiki page with a list of use cases such as:

  • Changing text in a TextView
  • Hiding views with no content description
  • Returning a different subclass (similar to AppCompat)

Stateful pre-inflation interceptors run multiple times

Example:
Printing the name of the view to be inflated results in duplicate lines getting printed since multiple InflationRequests could be issued from successive attempts using different methods for inflating a view

Crash when targeting Q

Version:

'io.github.inflationx:calligraphy3:3.1.1'
'io.github.inflationx:viewpump:2.0.3'

Logs:

2021-06-05 11:46:43.110 1482-1634/? E/WifiVendorHal: getWifiLinkLayerStats_1_3_Internal(l.936) failed {.code = ERROR_NOT_SUPPORTED, .description = }
2021-06-05 11:46:43.415 21342-21342/? E/AndroidRuntime: FATAL EXCEPTION: main
    Process: com.mypackage.abcd, PID: 21342
    java.lang.RuntimeException: Unable to start activity ComponentInfo{com.mypackage.abcd/com.mypackage2.xyz.ui.activity.login.LoginActivity_}: android.view.InflateException: Binary XML file line #17 in com.mypackage.abcd:layout/abc_screen_simple: Binary XML file line #17 in com.mypackage.abcd:layout/abc_screen_simple: Error inflating class androidx.appcompat.widget.FitWindowsLinearLayout
        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3534)
        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3689)
        at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:83)
        at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:140)
        at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:100)
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2239)
        at android.os.Handler.dispatchMessage(Handler.java:107)
        at android.os.Looper.loop(Looper.java:237)
        at android.app.ActivityThread.main(ActivityThread.java:7830)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1040)
     Caused by: android.view.InflateException: Binary XML file line #17 in com.mypackage.abcd:layout/abc_screen_simple: Binary XML file line #17 in com.mypackage.abcd:layout/abc_screen_simple: Error inflating class androidx.appcompat.widget.FitWindowsLinearLayout
     Caused by: android.view.InflateException: Binary XML file line #17 in com.mypackage.abcd:layout/abc_screen_simple: Error inflating class androidx.appcompat.widget.FitWindowsLinearLayout
     Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.Object java.lang.reflect.Field.get(java.lang.Object)' on a null object reference
        at io.github.inflationx.viewpump.ReflectionUtils.getValue(SourceFile:1)
        at io.github.inflationx.viewpump.ViewPumpLayoutInflater.createCustomViewInternal(SourceFile:5)
        at io.github.inflationx.viewpump.ViewPumpLayoutInflater.access$000(SourceFile:1)
        at io.github.inflationx.viewpump.ViewPumpLayoutInflater$PrivateWrapperFactory2ViewCreator.onCreateView(SourceFile:3)
        at io.github.inflationx.viewpump.FallbackViewCreationInterceptor.intercept(SourceFile:3)
        at io.github.inflationx.viewpump.InterceptorChain.proceed(SourceFile:4)
        at io.github.inflationx.calligraphy3.CalligraphyInterceptor.intercept(SourceFile:1)
        at io.github.inflationx.viewpump.InterceptorChain.proceed(SourceFile:4)
        at io.github.inflationx.viewpump.ViewPump.inflate(SourceFile:2)
        at io.github.inflationx.viewpump.ViewPumpLayoutInflater$PrivateWrapperFactory2.onCreateView(SourceFile:8)
        at android.view.LayoutInflater$FactoryMerger.onCreateView(LayoutInflater.java:239)
        at android.view.LayoutInflater.tryCreateView(LayoutInflater.java:1086)
        at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:999)
        at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:963)
        at android.view.LayoutInflater.inflate(LayoutInflater.java:659)
        at io.github.inflationx.viewpump.ViewPumpLayoutInflater.inflate(SourceFile:2)
        at android.view.LayoutInflater.inflate(LayoutInflater.java:534)
        at android.view.LayoutInflater.inflate(LayoutInflater.java:481)
        at androidx.appcompat.app.AppCompatDelegateImpl.createSubDecor(SourceFile:39)
        at androidx.appcompat.app.AppCompatDelegateImpl.ensureSubDecor(SourceFile:2)
        at androidx.appcompat.app.AppCompatDelegateImpl.setContentView(SourceFile:6)
        at androidx.appcompat.app.AppCompatActivity.setContentView(SourceFile:1)
        at com.mypackage2.xyz.ui.base.BaseActivity.setContentView(SourceFile:1)
        at com.mypackage2.xyz.ui.activity.YBaseActivity.setContentView(SourceFile:1)
        at com.mypackage2.xyz.ui.activity.login.LoginActivity.setContentView(SourceFile:1)
2021-06-05 11:46:43.415 21342-21342/? E/AndroidRuntime:     at com.mypackage2.xyz.ui.activity.login.LoginActivity_.setContentView(SourceFile:1)
        at com.mypackage2.xyz.ui.activity.login.LoginActivity_.onCreate(SourceFile:7)
        at android.app.Activity.performCreate(Activity.java:7976)
        at android.app.Activity.performCreate(Activity.java:7965)
        at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1306)
        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3505)
        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3689)
        at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:83)
        at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:140)
        at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:100)
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2239)
        at android.os.Handler.dispatchMessage(Handler.java:107)
        at android.os.Looper.loop(Looper.java:237)
        at android.app.ActivityThread.main(ActivityThread.java:7830)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1040)
2021-06-05 11:46:43.436 1126-21675/? E/ResolverController: No valid NAT64 prefix (133, <unspecified>/0)
2021-06-05 11:46:43.475 1482-2780/? E/WindowManager: App trying to use insecure INPUT_FEATURE_NO_INPUT_CHANNEL flag. Ignoring
2021-06-05 11:46:43.619 1482-7053/? E/Process: get_ion_cache_memory: Unable to open /d/ion/system_stats
2021-06-05 11:46:43.625 1482-7053/? E/DatabaseUtils: Writing exception to parcel
    java.lang.IllegalArgumentException: Invalid column: title
        at com.android.providers.settings.SettingsProvider.normalizeProjection(SettingsProvider.java:2535)
        at com.android.providers.settings.SettingsProvider.query(SettingsProvider.java:657)
        at android.content.ContentProvider.query(ContentProvider.java:1224)
        at android.content.ContentProvider.query(ContentProvider.java:1317)
        at android.content.ContentProvider$Transport.query(ContentProvider.java:271)
        at android.content.ContentProviderNative.onTransact(ContentProviderNative.java:104)
        at android.os.Binder.execTransactInternal(Binder.java:1021)
        at android.os.Binder.execTransact(Binder.java:994)
2021-06-05 11:46:43.779 2872-2888/? E/hypnusd: submit dspfreq failed(Unknown error 524)

Fatal Exception: android.view.InflateException

io.github.inflationx.viewpump.internal.-ViewPumpLayoutInflater$NameAndAttrsViewCreator.onCreateView (-ViewPumpLayoutInflater.java:290)
io.github.inflationx.viewpump.internal.-FallbackViewCreationInterceptor.intercept (-FallbackViewCreationInterceptor.java:14)
io.github.inflationx.viewpump.internal.-InterceptorChain.proceed (-InterceptorChain.java:30)
io.github.inflationx.calligraphy3.CalligraphyInterceptor.intercept (CalligraphyInterceptor.java:18)
io.github.inflationx.viewpump.internal.-InterceptorChain.proceed (-InterceptorChain.java:30)
io.github.inflationx.viewpump.ViewPump.inflate (ViewPump.java:36)
io.github.inflationx.viewpump.internal.-ViewPumpLayoutInflater.onCreateView (-ViewPumpLayoutInflater.java:169)
android.view.LayoutInflater.onCreateView (LayoutInflater.java:682)
io.github.inflationx.viewpump.internal.-ViewPumpLayoutInflater.superOnCreateView (-ViewPumpLayoutInflater.java:233)
io.github.inflationx.viewpump.internal.-ViewPumpLayoutInflater.access$superOnCreateView (-ViewPumpLayoutInflater.java:19)
io.github.inflationx.viewpump.internal.-ViewPumpLayoutInflater$ParentAndNameAndAttrsViewCreator.onCreateView (-ViewPumpLayoutInflater.java:271)
io.github.inflationx.viewpump.internal.-FallbackViewCreationInterceptor.intercept (-FallbackViewCreationInterceptor.java:14)
io.github.inflationx.viewpump.internal.-InterceptorChain.proceed (-InterceptorChain.java:30)
io.github.inflationx.calligraphy3.CalligraphyInterceptor.intercept (CalligraphyInterceptor.java:18)
io.github.inflationx.viewpump.internal.-InterceptorChain.proceed (-InterceptorChain.java:30)
io.github.inflationx.viewpump.ViewPump.inflate (ViewPump.java:36)
io.github.inflationx.viewpump.internal.-ViewPumpLayoutInflater.onCreateView (-ViewPumpLayoutInflater.java:151)

Crash with Resources$NotFoundException

Fatal Exception: android.content.res.Resources$NotFoundException
Resource ID #0x0
android.content.res.ResourcesImpl.getValue (ResourcesImpl.java:237)
android.content.res.Resources.loadXmlResourceParser (Resources.java:2293)
android.content.res.Resources.getLayout (Resources.java:1187)
android.view.LayoutInflater.inflate (LayoutInflater.java:532)
io.github.inflationx.viewpump.internal.-ViewPumpLayoutInflater.inflate (-ViewPumpLayoutInflater.java:48)
android.widget.ArrayAdapter.createViewFromResource (ArrayAdapter.java:428)
android.widget.ArrayAdapter.getView (ArrayAdapter.java:419)
OT.getView (OT.java:2)
android.widget.AbsListView.obtainView (AbsListView.java:2472)
android.widget.ListView.measureHeightOfChildren (ListView.java:1421)
android.widget.ListView.onMeasure (ListView.java:1327)
android.view.View.measure (View.java:24777)
android.view.ViewGroup.measureChildWithMargins (ViewGroup.java:6858)
android.widget.FrameLayout.onMeasure (FrameLayout.java:194)
android.view.View.measure (View.java:24777)
android.view.ViewGroup.measureChildWithMargins (ViewGroup.java:6858)
android.widget.FrameLayout.onMeasure (FrameLayout.java:194)
android.view.View.measure (View.java:24777)
com.android.internal.widget.AlertDialogLayout.tryOnMeasure (AlertDialogLayout.java:146)
com.android.internal.widget.AlertDialogLayout.onMeasure (AlertDialogLayout.java:71)
android.view.View.measure (View.java:24777)
android.view.ViewGroup.measureChildWithMargins (ViewGroup.java:6858)
android.widget.FrameLayout.onMeasure (FrameLayout.java:194)
android.view.View.measure (View.java:24777)
android.view.ViewGroup.measureChildWithMargins (ViewGroup.java:6858)
android.widget.FrameLayout.onMeasure (FrameLayout.java:194)
android.view.View.measure (View.java:24777)
android.view.ViewGroup.measureChildWithMargins (ViewGroup.java:6858)
android.widget.FrameLayout.onMeasure (FrameLayout.java:194)
com.android.internal.policy.DecorView.onMeasure (DecorView.java:749)
android.view.View.measure (View.java:24777)
android.view.ViewRootImpl.performMeasure (ViewRootImpl.java:3282)
android.view.ViewRootImpl.measureHierarchy (ViewRootImpl.java:2025)
android.view.ViewRootImpl.performTraversals (ViewRootImpl.java:2354)
android.view.ViewRootImpl.doTraversal (ViewRootImpl.java:1940)
android.view.ViewRootImpl$TraversalRunnable.run (ViewRootImpl.java:8073)
android.view.Choreographer$CallbackRecord.run (Choreographer.java:1227)
android.view.Choreographer.doCallbacks (Choreographer.java:1029)
android.view.Choreographer.doFrame (Choreographer.java:942)
android.view.Choreographer$FrameHandler.handleMessage (Choreographer.java:1151)
android.os.Handler.dispatchMessage (Handler.java:107)
android.os.Looper.loop (Looper.java:214)
android.app.ActivityThread.main (ActivityThread.java:7707)
java.lang.reflect.Method.invoke (Method.java)
com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run (RuntimeInit.java:516)
com.android.internal.os.ZygoteInit.main (ZygoteInit.java:950)

The most crashes on Samsung, Huawei, Xiaomi, 100% crashes on Android 8 or higher

ViewPump doesn't support the `PreferenceInflater`

Description

When using androidx.preference.PreferenceFragmentCompat ViewPump doesn't intercept inflating underlying elements. Even PreferenceFragmentCompat uses a different inflation process than android.app.Fragment by loading the elements from the XML resource, it still uses regular widgets at the base.

How to reproduce

  • Add a preference activity with fragment to the sample app guided by this example
  • Don't forget to wrap the base context
  • Observe the interceptors are not called and the TextView is not replaced with CustomTextView

Consumer ProGuard rules are bad

As far as I can tell, this library does reflection but not on any of its own types. It's unclear why you are shipping ProGuard rules that retain the entire library, prevent it from being optimized, and prevent it from being obfuscated. Please remove the rules or make an effort to craft the narrowest rules that retain only what's needed.

Expose ViewPumpLayoutInflater

I want to be able inflate fragment's view with explicit argument driven theme.

Currently there seems to be no way to inflate something through ViewPump using ContextThemeWrapper.

IllegalArgumentException: Parameter specified as non-null is null: method kotlin.jvm.internal.Intrinsics.checkParameterIsNotNull

There are crash when ViewPupm try to inflate layout.

Device: Samsung Galaxy S7
OS: Android 7.0
Library version: 2.0.0
Main project language : Java

Caused by java.lang.IllegalArgumentException: Parameter specified as non-null is null: method kotlin.jvm.internal.Intrinsics.checkParameterIsNotNull, parameter parent at io.github.inflationx.viewpump.ViewPumpLayoutInflater.onCreateView(ViewPumpLayoutInflater.kt) at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:792) at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:734) at android.view.LayoutInflater.inflate(LayoutInflater.java:496) at io.github.inflationx.viewpump.ViewPumpLayoutInflater.inflate(ViewPumpLayoutInflater.kt:54) at android.view.LayoutInflater.inflate(LayoutInflater.java:427) at io.github.inflationx.viewpump.ViewPumpLayoutInflater.inflate(ViewPumpLayoutInflater.kt:45) at android.view.LayoutInflater.inflate(LayoutInflater.java:378) at com.android.internal.policy.DecorView.onResourcesLoaded(DecorView.java:2297) at com.android.internal.policy.PhoneWindow.generateLayout(PhoneWindow.java:2784) at com.android.internal.policy.PhoneWindow.installDecor(PhoneWindow.java:2857) at com.android.internal.policy.PhoneWindow.getDecorView(PhoneWindow.java:2167) at android.support.v7.app.AppCompatDelegateImpl.createSubDecor(AppCompatDelegateImpl.java:575) at android.support.v7.app.AppCompatDelegateImpl.ensureSubDecor(AppCompatDelegateImpl.java:518) at android.support.v7.app.AppCompatDelegateImpl.setContentView(AppCompatDelegateImpl.java:466) at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:140) at com.livescore.ui.activities.BaseActivity.onCreate(BaseActivity.java:188) at com.livescore.ui.activities.HomeActivity.onCreate(HomeActivity.java:31) at com.livescore.ui.activities.soccer.SoccerHomeActivity.onCreate(SoccerHomeActivity.java:17) at android.app.Activity.performCreate(Activity.java:6942) at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1126) at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2880) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2988) at android.app.ActivityThread.-wrap14(ActivityThread.java) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1631) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loop(Looper.java:154) at android.app.ActivityThread.main(ActivityThread.java:6682) at java.lang.reflect.Method.invoke(Method.java) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1520) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1410)

Also is seem that it cant inflate LinearLayout:

Caused by android.view.InflateException: Binary XML file line #24: Error inflating class LinearLayout

Code which I use:

    ViewPump.init(ViewPump.builder()
            .addInterceptor(chain -> {
                InflateResult result = chain.proceed(chain.request());
                if (result.view() instanceof TextView) {
                    TextView textView = (TextView) result.view();
                    textView.setTypeface(ResourcesCompat.getFont(LiveScoreApplication.this, R.font.roboto_black));
                }
                return result;
            }).build());

Out Of Memory Error

Fatal Exception: java.lang.OutOfMemoryError
Failed to allocate a 3096012 byte allocation with 1800472 free bytes and 1758KB until OOM
dalvik.system.VMRuntime.newNonMovableArray (VMRuntime.java)
androidx.appcompat.app.AppCompatDelegateImpl.onCreateView (AppCompatDelegateImpl.java:1457)
io.github.inflationx.viewpump.internal.-ViewPumpLayoutInflater$WrapperFactory2ViewCreator.onCreateView (-ViewPumpLayoutInflater.kt:378)
io.github.inflationx.viewpump.internal.-FallbackViewCreationInterceptor.intercept (-FallbackViewCreationInterceptor.kt:14)
io.github.inflationx.viewpump.internal.-InterceptorChain.proceed (-InterceptorChain.kt:30)
io.github.inflationx.calligraphy3.CalligraphyInterceptor.intercept (CalligraphyInterceptor.java:18)
io.github.inflationx.viewpump.internal.-InterceptorChain.proceed (-InterceptorChain.kt:30)
io.github.inflationx.viewpump.ViewPump.inflate (ViewPump.kt:36)
io.github.inflationx.viewpump.internal.-ViewPumpLayoutInflater$WrapperFactory2.onCreateView (-ViewPumpLayoutInflater.kt:358)
android.view.LayoutInflater.createViewFromTag (LayoutInflater.java:732)
android.view.LayoutInflater.inflate (LayoutInflater.java:511)
io.github.inflationx.viewpump.internal.-ViewPumpLayoutInflater.inflate (-ViewPumpLayoutInflater.kt:57)
android.view.LayoutInflater.inflate (LayoutInflater.java:415)
io.github.inflationx.viewpump.internal.-ViewPumpLayoutInflater.inflate (-ViewPumpLayoutInflater.kt:48)
androidx.databinding.DataBindingUtil.inflate (DataBindingUtil.java:126)
net.ibazzar.ibazzar.ui.main.poster.PostersPagingViewHolder$Companion.create (PostersPagingViewHolder.kt:194)
net.ibazzar.ibazzar.ui.main.poster.PostersPagingAdapter.onCreateViewHolder (PostersPagingAdapter.kt:56)
androidx.recyclerview.widget.RecyclerView$Adapter.createViewHolder (RecyclerView.java:7078)
com.android.internal.os.ZygoteInit.main (ZygoteInit.java:1194)

Crash app when I launch it

07-19 11:35:53.054 2610-2610/ connect.android.mobile E/dalvikvm: Could not find class 'io.github.inflationx.viewpump.FallbackViewCreationInterceptor', referenced from method io.github.inflationx.viewpump.ViewPump.
07-19 11:35:53.054 2610-2610/ connect.android.mobile E/dalvikvm: Could not find class 'io.github.inflationx.viewpump.InterceptorChain', referenced from method io.github.inflationx.viewpump.ViewPump.inflate
07-19 11:35:53.074 2610-2626/ connect.android.mobile E/dalvikvm: Could not find class 'android.app.job.JobScheduler', referenced from method com.google.android.gms.internal.iu.z
07-19 11:35:53.084 2610-2626/ connect.android.mobile E/dalvikvm: Could not find class 'android.app.job.JobScheduler', referenced from method com.google.android.gms.internal.iu.a
07-19 11:35:53.084 2610-2610/ connect.android.mobile E/AndroidRuntime: FATAL EXCEPTION: main
Process: connect.android.mobile, PID: 2610
java.lang.NoClassDefFoundError: io.github.inflationx.viewpump.FallbackViewCreationInterceptor
at io.github.inflationx.viewpump.ViewPump.(SourceFile:29)
at io.github.inflationx.viewpump.ViewPump.(SourceFile:10)
at io.github.inflationx.viewpump.ViewPump$Builder.build(SourceFile:143)
at connect.android.Application.onCreate(SourceFile:69)
at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1007)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4344)
at android.app.ActivityThread.access$1500(ActivityThread.java:135)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1256)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5017)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)
at dalvik.system.NativeStart.main(Native Method)

This crash was found out in android 4.4 emulator. But not for each device. What is the reason?

Fatal Exception: android.content.res.Resources$NotFoundException

We have this crash repeated hundreds of times each month. It is basically our major crash reason in the app. I have seen that the issue is coming during inflation, and seems related to view pump. Is it because of newer versions of appCompat? any planned fix for it?
According to my crash analytics data, it happens in all kind of devices and OS versions, I can not find a pattern there.

Using io.github.inflationx:viewpump:2.0.3

Fatal Exception: android.content.res.Resources$NotFoundException: Resource ID #0x0
       at android.content.res.ResourcesImpl.getValue(ResourcesImpl.java:237)
       at android.content.res.Resources.loadXmlResourceParser(Resources.java:2400)
       at android.content.res.Resources.getLayout(Resources.java:1252)
       at android.view.LayoutInflater.inflate(LayoutInflater.java:530)
       at io.github.inflationx.viewpump.internal.-ViewPumpLayoutInflater.inflate(-ViewPumpLayoutInflater.kt:48)
       at android.widget.ArrayAdapter.createViewFromResource(ArrayAdapter.java:425)
       at android.widget.ArrayAdapter.getView(ArrayAdapter.java:416)
       at x90.getView(chromium-TrichromeWebViewGoogle.aab-stable-443009133:2)
       at android.widget.AbsListView.obtainView(AbsListView.java:2412)
       at android.widget.ListView.measureHeightOfChildren(ListView.java:1417)
       at android.widget.ListView.onMeasure(ListView.java:1323)
       at android.view.View.measure(View.java:25470)
       at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6957)
       at android.widget.FrameLayout.onMeasure(FrameLayout.java:194)
       at android.view.View.measure(View.java:25470)
       at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6957)
       at android.widget.FrameLayout.onMeasure(FrameLayout.java:194)
       at android.view.View.measure(View.java:25470)
       at com.android.internal.widget.AlertDialogLayout.tryOnMeasure(AlertDialogLayout.java:146)
       at com.android.internal.widget.AlertDialogLayout.onMeasure(AlertDialogLayout.java:71)
       at android.view.View.measure(View.java:25470)
       at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6957)
       at android.widget.FrameLayout.onMeasure(FrameLayout.java:194)
       at android.view.View.measure(View.java:25470)
       at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6957)
       at android.widget.FrameLayout.onMeasure(FrameLayout.java:194)
       at android.view.View.measure(View.java:25470)
       at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6957)
       at android.widget.FrameLayout.onMeasure(FrameLayout.java:194)
       at com.android.internal.policy.DecorView.onMeasure(DecorView.java:747)
       at android.view.View.measure(View.java:25470)
       at android.view.ViewRootImpl.performMeasure(ViewRootImpl.java:3399)
       at android.view.ViewRootImpl.measureHierarchy(ViewRootImpl.java:2203)
       at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:2488)
       at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1954)
       at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:8180)
       at android.view.Choreographer$CallbackRecord.run(Choreographer.java:1056)
       at android.view.Choreographer.doCallbacks(Choreographer.java:878)
       at android.view.Choreographer.doFrame(Choreographer.java:811)
       at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:1041)
       at android.os.Handler.handleCallback(Handler.java:938)
       at android.os.Handler.dispatchMessage(Handler.java:99)
       at android.os.Looper.loop(Looper.java:223)
       at android.app.ActivityThread.main(ActivityThread.java:7698)
       at java.lang.reflect.Method.invoke(Method.java)
       at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:952)

Bug: can't import and build sample

First it showed a problem with "com.vanniktech:gradle-maven-publish-plugin" , so I've updated it to :

classpath 'com.vanniktech:gradle-maven-publish-plugin:0.18.0'

Then it showed a problem with:

apply plugin: 'com.vanniktech.maven.publish'

So I've commented it, and then it showed a different issue (of "project.groupid").
Then for some reason, after closing the project and re-opening it, it succeeded building.

Please make the sample be able to be built easily...
:(

Crash while inflating

Fatal Exception: android.view.InflateException: Binary XML file line #14: Error inflating class android.widget.TextView
at android.view.LayoutInflater.createView(LayoutInflater.java:633)
at io.github.inflationx.viewpump.internal.-ViewPumpLayoutInflater$NameAndAttrsViewCreator.onCreateView(-ViewPumpLayoutInflater.java:290)
at io.github.inflationx.viewpump.internal.-FallbackViewCreationInterceptor.intercept(-FallbackViewCreationInterceptor.java:14)
at io.github.inflationx.viewpump.internal.-InterceptorChain.proceed(-InterceptorChain.java:30)
at io.github.inflationx.calligraphy3.CalligraphyInterceptor.intercept(CalligraphyInterceptor.java:18)
at io.github.inflationx.viewpump.internal.-InterceptorChain.proceed(-InterceptorChain.java:30)
at io.github.inflationx.viewpump.ViewPump.inflate(ViewPump.java:36)
at io.github.inflationx.viewpump.internal.-ViewPumpLayoutInflater.onCreateView(-ViewPumpLayoutInflater.java:169)
at android.view.LayoutInflater.onCreateView(LayoutInflater.java:682)
at io.github.inflationx.viewpump.internal.-ViewPumpLayoutInflater.superOnCreateView(-ViewPumpLayoutInflater.java:233)
at io.github.inflationx.viewpump.internal.-ViewPumpLayoutInflater.access$superOnCreateView(-ViewPumpLayoutInflater.java:19)
at io.github.inflationx.viewpump.internal.-ViewPumpLayoutInflater$ParentAndNameAndAttrsViewCreator.onCreateView(-ViewPumpLayoutInflater.java:271)
at io.github.inflationx.viewpump.internal.-FallbackViewCreationInterceptor.intercept(-FallbackViewCreationInterceptor.java:14)
at io.github.inflationx.viewpump.internal.-InterceptorChain.proceed(-InterceptorChain.java:30)
at io.github.inflationx.calligraphy3.CalligraphyInterceptor.intercept(CalligraphyInterceptor.java:18)
at io.github.inflationx.viewpump.internal.-InterceptorChain.proceed(-InterceptorChain.java:30)
at io.github.inflationx.viewpump.ViewPump.inflate(ViewPump.java:36)
at io.github.inflationx.viewpump.internal.-ViewPumpLayoutInflater.onCreateView(-ViewPumpLayoutInflater.java:151)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:741)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:806)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:809)
at android.view.LayoutInflater.inflate(LayoutInflater.java:504)
at io.github.inflationx.viewpump.internal.-ViewPumpLayoutInflater.inflate(-ViewPumpLayoutInflater.java:57)
at android.view.LayoutInflater.inflate(LayoutInflater.java:414)
at io.github.inflationx.viewpump.internal.-ViewPumpLayoutInflater.inflate(-ViewPumpLayoutInflater.java:48)
at android.view.LayoutInflater.inflate(LayoutInflater.java:365)
at com.payu.payumoney.activities.CreateWebsiteActivity.showBackButtonDialogIfNecessary(CreateWebsiteActivity.java:111)
at com.payu.payumoney.activities.CreateWebsiteActivity.access$000(CreateWebsiteActivity.java:43)
at com.payu.payumoney.activities.CreateWebsiteActivity$1.onClick(CreateWebsiteActivity.java:80)
at android.view.View.performClick(View.java:4848)
at android.view.View$PerformClick.run(View.java:20300)
at android.os.Handler.handleCallback(Handler.java:815)
at android.os.Handler.dispatchMessage(Handler.java:104)
at android.os.Looper.loop(Looper.java:210)
at android.app.ActivityThread.main(ActivityThread.java:5839)
at java.lang.reflect.Method.invoke(Method.java)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1113)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:879)

Add extra debug info to Inflation exceptions

In order to make it easier to debug inflation exceptions in large apps, we should consider adding an API that provides the layout resource id that was trying to be inflated and possibly any other information that the app would like to tag the inflation request with.

Error Infalting views

HI I get this error when i try to run the sample in the README.md

2018-09-19 15:14:23.624 23399-23399/com.diamondacresoftware.astro W/System: ClassLoader referenced unknown path: /data/app/com.diamondacresoftware.astro-1/lib/arm
2018-09-19 15:14:23.765 23399-23399/com.diamondacresoftware.astro I/InstantRun: starting instant run server: is main process
2018-09-19 15:14:24.005 23399-23399/com.diamondacresoftware.astro W/art: Before Android 4.1, method android.graphics.PorterDuffColorFilter android.support.graphics.drawable.VectorDrawableCompat.updateTintFilter(android.graphics.PorterDuffColorFilter, android.content.res.ColorStateList, android.graphics.PorterDuff$Mode) would have incorrectly overridden the package-private method in android.graphics.drawable.Drawable
2018-09-19 15:14:24.261 23399-23399/com.diamondacresoftware.astro I/art: Rejecting re-init on previously-failed class java.lang.Class<android.support.v4.view.ViewCompat$OnUnhandledKeyEventListenerWrapper>: java.lang.NoClassDefFoundError: Failed resolution of: Landroid/view/View$OnUnhandledKeyEventListener;
2018-09-19 15:14:24.261 23399-23399/com.diamondacresoftware.astro I/art:     at void android.support.v4.view.ViewCompat.setOnApplyWindowInsetsListener(android.view.View, android.support.v4.view.OnApplyWindowInsetsListener) (ViewCompat.java:2203)
2018-09-19 15:14:24.261 23399-23399/com.diamondacresoftware.astro I/art:     at android.view.ViewGroup android.support.v7.app.AppCompatDelegateImpl.createSubDecor() (AppCompatDelegateImpl.java:637)
2018-09-19 15:14:24.261 23399-23399/com.diamondacresoftware.astro I/art:     at void android.support.v7.app.AppCompatDelegateImpl.ensureSubDecor() (AppCompatDelegateImpl.java:518)
2018-09-19 15:14:24.261 23399-23399/com.diamondacresoftware.astro I/art:     at void android.support.v7.app.AppCompatDelegateImpl.setContentView(int) (AppCompatDelegateImpl.java:466)
2018-09-19 15:14:24.261 23399-23399/com.diamondacresoftware.astro I/art:     at void android.support.v7.app.AppCompatActivity.setContentView(int) (AppCompatActivity.java:140)
2018-09-19 15:14:24.261 23399-23399/com.diamondacresoftware.astro I/art:     at void com.diamondacresoftware.astro.ui.home.HomeActivity.onCreate(android.os.Bundle) (HomeActivity.kt:105)
2018-09-19 15:14:24.261 23399-23399/com.diamondacresoftware.astro I/art:     at void android.app.Activity.performCreate(android.os.Bundle) (Activity.java:6955)
2018-09-19 15:14:24.261 23399-23399/com.diamondacresoftware.astro I/art:     at void android.app.Instrumentation.callActivityOnCreate(android.app.Activity, android.os.Bundle) (Instrumentation.java:1126)
2018-09-19 15:14:24.261 23399-23399/com.diamondacresoftware.astro I/art:     at android.app.Activity android.app.ActivityThread.performLaunchActivity(android.app.ActivityThread$ActivityClientRecord, android.content.Intent) (ActivityThread.java:2927)
2018-09-19 15:14:24.261 23399-23399/com.diamondacresoftware.astro I/art:     at void android.app.ActivityThread.handleLaunchActivity(android.app.ActivityThread$ActivityClientRecord, android.content.Intent, java.lang.String) (ActivityThread.java:3045)
2018-09-19 15:14:24.261 23399-23399/com.diamondacresoftware.astro I/art:     at void android.app.ActivityThread.-wrap14(android.app.ActivityThread, android.app.ActivityThread$ActivityClientRecord, android.content.Intent, java.lang.String) (ActivityThread.java:-1)
2018-09-19 15:14:24.261 23399-23399/com.diamondacresoftware.astro I/art:     at void android.app.ActivityThread$H.handleMessage(android.os.Message) (ActivityThread.java:1642)
2018-09-19 15:14:24.261 23399-23399/com.diamondacresoftware.astro I/art:     at void android.os.Handler.dispatchMessage(android.os.Message) (Handler.java:102)
2018-09-19 15:14:24.261 23399-23399/com.diamondacresoftware.astro I/art:     at void android.os.Looper.loop() (Looper.java:154)
2018-09-19 15:14:24.261 23399-23399/com.diamondacresoftware.astro I/art:     at void android.app.ActivityThread.main(java.lang.String[]) (ActivityThread.java:6776)
2018-09-19 15:14:24.261 23399-23399/com.diamondacresoftware.astro I/art:     at java.lang.Object java.lang.reflect.Method.invoke!(java.lang.Object, java.lang.Object[]) (Method.java:-2)
2018-09-19 15:14:24.262 23399-23399/com.diamondacresoftware.astro I/art:     at void com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run() (ZygoteInit.java:1496)
2018-09-19 15:14:24.262 23399-23399/com.diamondacresoftware.astro I/art:     at void com.android.internal.os.ZygoteInit.main(java.lang.String[]) (ZygoteInit.java:1386)
2018-09-19 15:14:24.262 23399-23399/com.diamondacresoftware.astro I/art: Caused by: java.lang.ClassNotFoundException: Didn't find class "android.view.View$OnUnhandledKeyEventListener" on path: DexPathList[[zip file "/data/app/com.diamondacresoftware.astro-1/base.apk", zip file "/data/app/com.diamondacresoftware.astro-1/split_lib_dependencies_apk.apk", zip file "/data/app/com.diamondacresoftware.astro-1/split_lib_slice_0_apk.apk", zip file "/data/app/com.diamondacresoftware.astro-1/split_lib_slice_1_apk.apk", zip file "/data/app/com.diamondacresoftware.astro-1/split_lib_slice_2_apk.apk", zip file "/data/app/com.diamondacresoftware.astro-1/split_lib_slice_3_apk.apk", zip file "/data/app/com.diamondacresoftware.astro-1/split_lib_slice_4_apk.apk", zip file "/data/app/com.diamondacresoftware.astro-1/split_lib_slice_5_apk.apk", zip file "/data/app/com.diamondacresoftware.astro-1/split_lib_slice_6_apk.apk", zip file "/data/app/com.diamondacresoftware.astro-1/split_lib_slice_7_apk.apk", zip file "/data/app/com.diamondacresoftware.astro-1/split_lib_slice_8_apk.apk", zip file "/data/app/co
2018-09-19 15:14:24.262 23399-23399/com.diamondacresoftware.astro I/art:     at java.lang.Class dalvik.system.BaseDexClassLoader.findClass(java.lang.String) (BaseDexClassLoader.java:56)
2018-09-19 15:14:24.262 23399-23399/com.diamondacresoftware.astro I/art:     at java.lang.Class java.lang.ClassLoader.loadClass(java.lang.String, boolean) (ClassLoader.java:380)
2018-09-19 15:14:24.262 23399-23399/com.diamondacresoftware.astro I/art:     at java.lang.Class java.lang.ClassLoader.loadClass(java.lang.String) (ClassLoader.java:312)
2018-09-19 15:14:24.262 23399-23399/com.diamondacresoftware.astro I/art:     at void android.support.v4.view.ViewCompat.setOnApplyWindowInsetsListener(android.view.View, android.support.v4.view.OnApplyWindowInsetsListener) (ViewCompat.java:2203)
2018-09-19 15:14:24.262 23399-23399/com.diamondacresoftware.astro I/art:     at android.view.ViewGroup android.support.v7.app.AppCompatDelegateImpl.createSubDecor() (AppCompatDelegateImpl.java:637)
2018-09-19 15:14:24.262 23399-23399/com.diamondacresoftware.astro I/art:     at void android.support.v7.app.AppCompatDelegateImpl.ensureSubDecor() (AppCompatDelegateImpl.java:518)
2018-09-19 15:14:24.262 23399-23399/com.diamondacresoftware.astro I/art:     at void android.support.v7.app.AppCompatDelegateImpl.setContentView(int) (AppCompatDelegateImpl.java:466)
2018-09-19 15:14:24.262 23399-23399/com.diamondacresoftware.astro I/art:     at void android.support.v7.app.AppCompatActivity.setContentView(int) (AppCompatActivity.java:140)
2018-09-19 15:14:24.262 23399-23399/com.diamondacresoftware.astro I/art:     at void com.diamondacresoftware.astro.ui.home.HomeActivity.onCreate(android.os.Bundle) (HomeActivity.kt:105)
2018-09-19 15:14:24.262 23399-23399/com.diamondacresoftware.astro I/art:     at void android.app.Activity.performCreate(android.os.Bundle) (Activity.java:6955)
2018-09-19 15:14:24.262 23399-23399/com.diamondacresoftware.astro I/art:     at void android.app.Instrumentation.callActivityOnCreate(android.app.Activity, android.os.Bundle) (Instrumentation.java:1126)
2018-09-19 15:14:24.262 23399-23399/com.diamondacresoftware.astro I/art:     at android.app.Activity android.app.ActivityThread.performLaunchActivity(android.app.ActivityThread$ActivityClientRecord, android.content.Intent) (ActivityThread.java:2927)
2018-09-19 15:14:24.262 23399-23399/com.diamondacresoftware.astro I/art:     at void android.app.ActivityThread.handleLaunchActivity(android.app.ActivityThread$ActivityClientRecord, android.content.Intent, java.lang.String) (ActivityThread.java:3045)
2018-09-19 15:14:24.262 23399-23399/com.diamondacresoftware.astro I/art:     at void android.app.ActivityThread.-wrap14(android.app.ActivityThread, android.app.ActivityThread$ActivityClientRecord, android.content.Intent, java.lang.String) (ActivityThread.java:-1)
2018-09-19 15:14:24.262 23399-23399/com.diamondacresoftware.astro I/art:     at void android.app.ActivityThread$H.handleMessage(android.os.Message) (ActivityThread.java:1642)
2018-09-19 15:14:24.262 23399-23399/com.diamondacresoftware.astro I/art:     at void android.os.Handler.dispatchMessage(android.os.Message) (Handler.java:102)
2018-09-19 15:14:24.262 23399-23399/com.diamondacresoftware.astro I/art:     at void android.os.Looper.loop() (Looper.java:154)
2018-09-19 15:14:24.262 23399-23399/com.diamondacresoftware.astro I/art:     at void android.app.ActivityThread.main(java.lang.String[]) (ActivityThread.java:6776)
2018-09-19 15:14:24.262 23399-23399/com.diamondacresoftware.astro I/art:     at java.lang.Object java.lang.reflect.Method.invoke!(java.lang.Object, java.lang.Object[]) (Method.java:-2)
2018-09-19 15:14:24.262 23399-23399/com.diamondacresoftware.astro I/art:     at void com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run() (ZygoteInit.java:1496)
2018-09-19 15:14:24.262 23399-23399/com.diamondacresoftware.astro I/art:     at void com.android.internal.os.ZygoteInit.main(java.lang.String[]) (ZygoteInit.java:1386)

CompileSdk = 28

Changing Artefacts

It seems like you have published 2 versions of ViewPump with the same version number. This caused a few issues with our team. It seems the most recent version of 2.0.0 has some issues #28 . It potentially has breaking API changes (we are still trying to diagnose this). But the original 2.0.0 did not have these issues.

This caused issues with different team members being unable to build and random CI machines failing. This is because some machines still have the old artefact cached and others pulled the new one.

How come you uploaded different artefacts with the same version?

Will you be following semantic versioning in the future?

NonSdkApiUsedViolation for LayoutInflater.mConstructorArgs

StrictMode    Used a non-SDK API
  android.os.strictmode.NonSdkApiUsedViolation: Landroid/view/LayoutInflater;->mConstructorArgs:[Ljava/lang/Object;
    at android.os.StrictMode.lambda$static$1(StrictMode.java:428)
    at android.os.-$$Lambda$StrictMode$lu9ekkHJ2HMz0jd3F8K8MnhenxQ.accept(Unknown Source:2)
    at java.lang.Class.getDeclaredField(Native Method)
    at io.github.inflationx.viewpump.ReflectionUtils.getField(ReflectionUtils.java:15)
    at io.github.inflationx.viewpump.ViewPumpLayoutInflater.createCustomViewInternal(ViewPumpLayoutInflater.java:194)
    at io.github.inflationx.viewpump.ViewPumpLayoutInflater.access$000(ViewPumpLayoutInflater.java:14)
    at io.github.inflationx.viewpump.ViewPumpLayoutInflater$PrivateWrapperFactory2ViewCreator.onCreateView(ViewPumpLayoutInflater.java:405)
    at io.github.inflationx.viewpump.FallbackViewCreationInterceptor.intercept(FallbackViewCreationInterceptor.java:11)
    at io.github.inflationx.viewpump.InterceptorChain.proceed(InterceptorChain.java:37)
    at com.ubercab.presidio.font.core.FontOverrideViewpumpInterceptor.intercept(FontOverrideViewpumpInterceptor.java:31)
    at io.github.inflationx.viewpump.InterceptorChain.proceed(InterceptorChain.java:37)
    at io.github.inflationx.calligraphy3.CalligraphyInterceptor.intercept(CalligraphyInterceptor.java:18)
    at io.github.inflationx.viewpump.InterceptorChain.proceed(InterceptorChain.java:37)
    at io.github.inflationx.viewpump.ViewPump.inflate(ViewPump.java:49)
    at io.github.inflationx.viewpump.ViewPumpLayoutInflater$PrivateWrapperFactory2.onCreateView(ViewPumpLayoutInflater.java:385)
    at android.view.LayoutInflater$FactoryMerger.onCreateView(LayoutInflater.java:186)
    at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:780)
    at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:730)
    at android.view.LayoutInflater.inflate(LayoutInflater.java:492)
    at io.github.inflationx.viewpump.ViewPumpLayoutInflater.inflate(ViewPumpLayoutInflater.java:55)
    at android.view.LayoutInflater.inflate(LayoutInflater.java:423)
    at android.view.LayoutInflater.inflate(LayoutInflater.java:374)

intercepting bug, or better understanding ?

Hi folks,

I have couple questions related to the intercepting pipeline.
I built the sample app (latest master)
and used single own built interceptor which looks this way

public class CustomTextViewInterceptor implements Interceptor {

    @Override
    public InflateResult intercept(Chain chain) {
        InflateResult result = chain.proceed(chain.request());
        Log.d("Inflater", String.format("name:%s view:%s", result.name(), result.view()));
        return result;
    }
}

the result is quite unexpected though

2020-06-25 21:35:32.674 7533-7533/io.github.inflationx.viewpump.sample D/Inflater: name:LinearLayout view:null
2020-06-25 21:35:32.677 7533-7533/io.github.inflationx.viewpump.sample D/Inflater: name:LinearLayout view:null
2020-06-25 21:35:32.686 7533-7533/io.github.inflationx.viewpump.sample D/Inflater: name:android.widget.LinearLayout view:android.widget.LinearLayout{56487e8 V.E...... ......I. 0,0-0,0}
2020-06-25 21:35:32.689 7533-7533/io.github.inflationx.viewpump.sample D/Inflater: name:android.widget.LinearLayout view:android.widget.LinearLayout{56487e8 V.E...... ......I. 0,0-0,0}
2020-06-25 21:35:32.692 7533-7533/io.github.inflationx.viewpump.sample D/Inflater: name:ViewStub view:null
2020-06-25 21:35:32.694 7533-7533/io.github.inflationx.viewpump.sample D/Inflater: name:ViewStub view:null
2020-06-25 21:35:32.697 7533-7533/io.github.inflationx.viewpump.sample D/Inflater: name:android.view.ViewStub view:android.view.ViewStub{2a6be01 G.E...... ......I. 0,0-0,0 #1020194 android:id/action_mode_bar_stub}
2020-06-25 21:35:32.700 7533-7533/io.github.inflationx.viewpump.sample D/Inflater: name:android.view.ViewStub view:android.view.ViewStub{2a6be01 G.E...... ......I. 0,0-0,0 #1020194 android:id/action_mode_bar_stub}
2020-06-25 21:35:32.702 7533-7533/io.github.inflationx.viewpump.sample D/Inflater: name:FrameLayout view:null
2020-06-25 21:35:32.704 7533-7533/io.github.inflationx.viewpump.sample D/Inflater: name:FrameLayout view:null
2020-06-25 21:35:32.708 7533-7533/io.github.inflationx.viewpump.sample D/Inflater: name:android.widget.FrameLayout view:android.widget.FrameLayout{4a964a6 V.E...... ......I. 0,0-0,0 #1020002 android:id/content}
2020-06-25 21:35:32.710 7533-7533/io.github.inflationx.viewpump.sample D/Inflater: name:android.widget.FrameLayout view:android.widget.FrameLayout{4a964a6 V.E...... ......I. 0,0-0,0 #1020002 android:id/content}
2020-06-25 21:35:32.726 7533-7533/io.github.inflationx.viewpump.sample D/Inflater: name:androidx.appcompat.widget.FitWindowsLinearLayout view:null
2020-06-25 21:35:32.731 7533-7533/io.github.inflationx.viewpump.sample D/Inflater: name:androidx.appcompat.widget.FitWindowsLinearLayout view:androidx.appcompat.widget.FitWindowsLinearLayout{e772532 V.E...... ......I. 0,0-0,0 #7f070009 app:id/action_bar_root}
2020-06-25 21:35:32.734 7533-7533/io.github.inflationx.viewpump.sample D/Inflater: name:androidx.appcompat.widget.ViewStubCompat view:null
2020-06-25 21:35:32.740 7533-7533/io.github.inflationx.viewpump.sample D/Inflater: name:androidx.appcompat.widget.ViewStubCompat view:androidx.appcompat.widget.ViewStubCompat{cbc4283 G.E...... ......I. 0,0-0,0 #7f070014 app:id/action_mode_bar_stub}
2020-06-25 21:35:32.743 7533-7533/io.github.inflationx.viewpump.sample D/Inflater: name:androidx.appcompat.widget.ContentFrameLayout view:null
2020-06-25 21:35:32.747 7533-7533/io.github.inflationx.viewpump.sample D/Inflater: name:androidx.appcompat.widget.ContentFrameLayout view:androidx.appcompat.widget.ContentFrameLayout{9fc2c39 V.E...... ......I. 0,0-0,0 #7f070007 app:id/action_bar_activity_content}
2020-06-25 21:35:32.755 7533-7533/io.github.inflationx.viewpump.sample D/Inflater: name:androidx.appcompat.widget.Toolbar view:null
2020-06-25 21:35:32.761 7533-7533/io.github.inflationx.viewpump.sample D/Inflater: name:androidx.appcompat.widget.Toolbar view:androidx.appcompat.widget.Toolbar{e9e482c V.E...... ......ID 0,0-0,0 #7f070089 app:id/toolbar}
2020-06-25 21:35:32.763 7533-7533/io.github.inflationx.viewpump.sample D/Inflater: name:LinearLayout view:null
2020-06-25 21:35:32.768 7533-7533/io.github.inflationx.viewpump.sample D/Inflater: name:LinearLayout view:null
2020-06-25 21:35:32.772 7533-7533/io.github.inflationx.viewpump.sample D/Inflater: name:android.widget.LinearLayout view:android.widget.LinearLayout{16a52f5 V.E...... ......I. 0,0-0,0 #7f07002a app:id/container}
2020-06-25 21:35:32.775 7533-7533/io.github.inflationx.viewpump.sample D/Inflater: name:android.widget.LinearLayout view:android.widget.LinearLayout{16a52f5 V.E...... ......I. 0,0-0,0 #7f07002a app:id/container}
2020-06-25 21:35:32.798 7533-7533/io.github.inflationx.viewpump.sample D/Inflater: name:androidx.appcompat.widget.z view:androidx.appcompat.widget.z{7697efb V.ED..... ......ID 0,0-0,0}
2020-06-25 21:35:32.838 7533-7533/io.github.inflationx.viewpump.sample D/Inflater: name:androidx.appcompat.widget.g view:androidx.appcompat.widget.g{d6395a9 VFED..C.. ......I. 0,0-0,0}

and my questions now

  1. how so that calling chain.proceed(chain.request()) might end up with null view ?
  2. why is the interceptor called twice for same view sometime or everytime ? for example android:id/content ?
    Or the very first 4 lines, twice null for LinearLayout and twice for its intstance ?

Is there logic behind what would give me more clarity why is it not called 1 time per each view (not having null) ?
Or is it just a bug ?

Discussion: JetPack Compose support?

Hi! Thanks for the great libraries. I was wondering if something like this is possible with Jetpack Compose. I know it's mostly different in how it's laid out. But I believe it's the same canvas API underneath/?

Thanks!

Multiple `ViewPump` instances

From what I gathered from the doc and source code, currently we call only call ViewPump.init once, and have only one configuration

If we want to add some new interceptors later, we have to call init again after getting currently installed interceptors, and add them in the new config

It also means that having an activity specific configuration while maintaining an app wide configuration is possible but complicated

In my case, I have an app-wide configuration, and for one activity, I have to override a specific widget with my own version

  • One solution could be to add a ViewPump parameter to the ViewPumpContextWrapper#wrap method, and then inject the ViewPump instance into ViewPumpLayoutInflater, and by default make it use ViewPump.get()
  • This change would also mean that the resolution would be eager, and thus after creating the wrapped context, changes to ViewPump wouldn't affect it anymore. An easy solution would be to inject null in the ViewPumpLayoutInflater, and when creating a view, if the instance is null, fallback to ViewPump.get() as before. This would prevent any behavior changes

Race-Condition: kotlin.KotlinNullPointerException when calling getLayoutInflator from two threads

When calling getLayoutInflater from two threads early in the application lifecycle, it's possible to hit a KotlinNullPointerException when evaluating this lazy(NONE): https://github.com/InflationX/ViewPump/blob/master/viewpump/src/main/java/io/github/inflationx/viewpump/ViewPumpContextWrapper.kt#L24

While it is probably not advisable to get a LayoutInflater off of the main thread (and we've already fixed our callsite that was triggering this), it does appear to be a regression. We should be able to replace lazy(NONE) with lazy(PUBLICATION) to correct this crash and avoid any impact to runtime performance.

Crash due to mConstructorArgs not found when targeting Q

I've noticed a crash on Android Q Beta 2 using ViewPump 2.0.2 with Calligraphy 3.1.1. Seems to happen on ViewPumpContextWrapper.wrap() :

compileSdkVersion = android-Q
targetSdkVersion = Q

Offending code:

    override fun attachBaseContext(newBase: Context?) {
        newBase?.let {
            super.attachBaseContext(ViewPumpContextWrapper.wrap(it))
        }
    }

Crash log details:

Caused by: java.lang.NoSuchFieldException: No field mConstructorArgs in class Landroid/view/LayoutInflater; (declaration of 'android.view.LayoutInflater' appears in /system/framework/framework.jar!classes3.dex)
        at java.lang.Class.getDeclaredField(Native Method)
        at io.github.inflationx.viewpump.internal.-ViewPumpLayoutInflater$Companion$CONSTRUCTOR_ARGS_FIELD$2.invoke(-ViewPumpLayoutInflater.kt:421)
        at io.github.inflationx.viewpump.internal.-ViewPumpLayoutInflater$Companion$CONSTRUCTOR_ARGS_FIELD$2.invoke(-ViewPumpLayoutInflater.kt:418)
        at kotlin.SynchronizedLazyImpl.getValue(LazyJVM.kt:74)
        at io.github.inflationx.viewpump.internal.-ViewPumpLayoutInflater$Companion.getCONSTRUCTOR_ARGS_FIELD(Unknown Source:11)
        at io.github.inflationx.viewpump.internal.-ViewPumpLayoutInflater$Companion.access$getCONSTRUCTOR_ARGS_FIELD$p(-ViewPumpLayoutInflater.kt:418)
        at io.github.inflationx.viewpump.internal.-ViewPumpLayoutInflater.createCustomViewInternal(-ViewPumpLayoutInflater.kt:205)
        at io.github.inflationx.viewpump.internal.-ViewPumpLayoutInflater.access$createCustomViewInternal(-ViewPumpLayoutInflater.kt:17)
        at io.github.inflationx.viewpump.internal.-ViewPumpLayoutInflater$PrivateWrapperFactory2ViewCreator.onCreateView(-ViewPumpLayoutInflater.kt:413)
        at io.github.inflationx.viewpump.internal.-FallbackViewCreationInterceptor.intercept(-FallbackViewCreationInterceptor.kt:14)
        at io.github.inflationx.viewpump.internal.-InterceptorChain.proceed(-InterceptorChain.kt:30)
        at io.github.inflationx.calligraphy3.CalligraphyInterceptor.intercept(CalligraphyInterceptor.java:18)
        at io.github.inflationx.viewpump.internal.-InterceptorChain.proceed(-InterceptorChain.kt:30)
        at io.github.inflationx.viewpump.ViewPump.inflate(ViewPump.kt:36)
        at io.github.inflationx.viewpump.internal.-ViewPumpLayoutInflater$PrivateWrapperFactory2.onCreateView(-ViewPumpLayoutInflater.kt:391)
        at android.view.LayoutInflater$FactoryMerger.onCreateView(LayoutInflater.java:235)
        at android.view.LayoutInflater.tryCreateView(LayoutInflater.java:1065)
        at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:995)
        at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:959)
        at android.view.LayoutInflater.inflate(LayoutInflater.java:670)
        at io.github.inflationx.viewpump.internal.-ViewPumpLayoutInflater.inflate(-ViewPumpLayoutInflater.kt:53)
        at android.view.LayoutInflater.inflate(LayoutInflater.java:545)

Given Android Q is only in Beta 2 this is more a heads up than a request for a fix right now ๐Ÿ˜„.

Using 'init(ViewPump): Unit' is an error.

Global singletons are bad for testing, scoping, and composition. Use local ViewPump instances instead.

private fun initCustomFont() { val calligraphyBuilder = CalligraphyConfig.Builder().setDefaultFontPath("fonts/ft_regular.ttf") .setFontAttrId(R.attr.fontPath).build() val viewPumpInterceptor = CalligraphyInterceptor(calligraphyBuilder) val viewPumpBuilder = ViewPump.builder().addInterceptor(viewPumpInterceptor).build() ViewPump.init(viewPumpBuilder) }

After upgrading to AGP 8.0.1. I am getting this exception. 
Attached screenshot for reference. 
image

ANR from ViewPump.init(ViewPump.builder()

My app gets sometimes an ANR from that line
ViewPump.init(ViewPump.builder()

looking like this:

"main" prio=5 tid=1 Runnable
| group="main" sCount=0 dsCount=0 flags=0 obj=0x72b266f0 self=0x7c85cc3a00
| sysTid=25641 nice=0 cgrp=default sched=0/0 handle=0x7c8a49c9b0
| state=R schedstat=( 1753354711 262386751 2208 ) utm=30 stm=145 core=0 HZ=100
| stack=0x7ff109e000-0x7ff10a0000 stackSize=8MB
| held mutexes= "mutator lock"(shared held)

Not sure it's actually the framworks fault but maybe anyone knows what this means

Remove the `-` prefix for internal files because they don't work?

Hi, I saw #24 mentioned:

The - prefixes on internal classes are to hide them from java, as they're otherwise visible as public classes

But in fact, this did not really achieve the effect we expected:

image

And we have moved them to an internal package, so are we going to remove these prefixes?

Crash: android.content.res.Resources$NotFoundException: Resource ID #0x0

Crashes are observed while using Viewpump SDKs. Please find the SDK details below. Its mostly happening on Android 11 and lower versions.

implementation "io.github.inflationx:viewpump:2.1.1"
implementation "dev.b3nedikt.restring:restring:5.2.2"
implementation "dev.b3nedikt.reword:reword:1.1.0"

dev.b3nedikt.restring.internal.RestringResources.getLayout
RestringResources.java, line 168

**android.content.res.Resources$NotFoundException: Resource ID #0x0**
 
android.content.res.ResourcesImpl.getValue ResourcesImpl.java:239
android.content.res.MiuiResourcesImpl.getValue MiuiResourcesImpl.java:96
android.content.res.Resources.loadXmlResourceParser Resources.java:2437
android.content.res.Resources.getLayout Resources.java:1269
dev.b3nedikt.restring.internal.RestringResources.getLayout RestringResources.java:168
android.view.LayoutInflater.inflate LayoutInflater.java:534
io.github.inflationx.viewpump.internal.-ViewPumpLayoutInflater.inflate -ViewPumpLayoutInflater.java:61
android.widget.ArrayAdapter.createViewFromResource ArrayAdapter.java:425
android.widget.ArrayAdapter.getView ArrayAdapter.java:416
WV.VM.getView VM.java:11
android.widget.AbsListView.obtainView AbsListView.java:2424
android.widget.ListView.measureHeightOfChildren ListView.java:1437
android.widget.ListView.onMeasure ListView.java:1343
android.view.View.measure View.java:25902
android.view.ViewGroup.measureChildWithMargins ViewGroup.java:7047
android.widget.FrameLayout.onMeasure FrameLayout.java:194
android.view.View.measure View.java:25902
android.view.ViewGroup.measureChildWithMargins ViewGroup.java:7047
android.widget.FrameLayout.onMeasure FrameLayout.java:194
android.view.View.measure View.java:25902
com.android.internal.widget.AlertDialogLayout.tryOnMeasure AlertDialogLayout.java:146
com.android.internal.widget.AlertDialogLayout.onMeasure AlertDialogLayout.java:71
android.view.View.measure View.java:25902
android.view.ViewGroup.measureChildWithMargins ViewGroup.java:7047
android.widget.FrameLayout.onMeasure FrameLayout.java:194
android.view.View.measure View.java:25902
android.view.ViewGroup.measureChildWithMargins ViewGroup.java:7047
android.widget.FrameLayout.onMeasure FrameLayout.java:194
android.view.View.measure View.java:25902
android.view.ViewGroup.measureChildWithMargins ViewGroup.java:7047
android.widget.FrameLayout.onMeasure FrameLayout.java:194
com.android.internal.policy.DecorView.onMeasure DecorView.java:767
android.view.View.measure View.java:25902
android.view.ViewRootImpl.performMeasure ViewRootImpl.java:3572
android.view.ViewRootImpl.measureHierarchy ViewRootImpl.java:2347
android.view.ViewRootImpl.performTraversals ViewRootImpl.java:2651
android.view.ViewRootImpl.doTraversal ViewRootImpl.java:2074
android.view.ViewRootImpl$TraversalRunnable.run ViewRootImpl.java:8547
android.view.Choreographer$CallbackRecord.run Choreographer.java:1077
android.view.Choreographer.doCallbacks Choreographer.java:897
android.view.Choreographer.doFrame Choreographer.java:826
android.view.Choreographer$FrameDisplayEventReceiver.run Choreographer.java:1062
android.os.Handler.handleCallback Handler.java:938
android.os.Handler.dispatchMessage Handler.java:99
android.os.Looper.loop Looper.java:237
android.app.ActivityThread.main ActivityThread.java:8126
java.lang.reflect.Method.invoke Method.java
com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run RuntimeInit.java:656
com.android.internal.os.ZygoteInit.main ZygoteInit.java:967

AppCompat 1.2.0 breaks ViewPump

It seems like the interception breaks with the newest libs. Here are my libraries versions:

    implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
    implementation 'androidx.core:core-ktx:1.3.1'
    implementation 'androidx.appcompat:appcompat:1.2.0'
    implementation 'com.google.android.material:material:1.3.0-alpha02'
    implementation 'androidx.constraintlayout:constraintlayout:2.0.1'
    implementation 'androidx.navigation:navigation-fragment:2.3.0'
    implementation 'androidx.navigation:navigation-ui:2.3.0'
    implementation 'androidx.lifecycle:lifecycle-livedata-ktx:2.2.0'
    implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.2.0'
    implementation 'androidx.navigation:navigation-fragment-ktx:2.3.0'
    implementation 'androidx.navigation:navigation-ui-ktx:2.3.0'
    implementation 'androidx.preference:preference-ktx:1.1.1'
    implementation 'androidx.legacy:legacy-support-v4:1.0.0'
    implementation 'androidx.browser:browser:1.2.0'
    implementation 'androidx.webkit:webkit:1.3.0'
    implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.3.8'

Change font fot EditText and TabLaout

I try this
`public InflateResult intercept(@NotNull Chain chain) {
InflateRequest request = chain.request();
InflateResult result = chain.proceed(request);
if (applicationTheme != null) {
View view = result.view();
if (view != null) {
AttributeSet attrs = request.attrs();
if (view instanceof TextView || view instanceof Toolbar && !(view instanceof BottomAppBar))
setFont(view, applicationTheme.getFontName());
}
return result;
}

private void setFont(View view, String fontName) {

    if (fontName != null) {
        String formattedName = fontName.replaceAll("^\"|\"$", "").trim();
        typeface = getTypeface(formattedName, context);
    }
    if (typeface == null)
        typeface = ResourcesCompat.getFont(context, R.font.montserrat_medium);


    if (view instanceof TextView) {
        view.setTypeface(typeface);
    }
}`

This code don't change font for EditText (if inputtype="password") and for TabLayout. How i can intercept it?

[Proposal] Support intercepting views created at runtime

When a view is created at runtime, ViewPump should be able to:

  • Instantiate the view (using reflection as a fallback)
  • Run all interceptors against it
  • Return the View

API could look like:

ViewPump.from(context).create(TextView.class)

Crash when launching app with latest update

Hi!

With the latest update, the app crashes as soon as it starts. If I switch back to the old library, it works as it should. I've tried to rebuild all, but still same problem.

My project was migrated to AndroidX some months ago, so that should not be any issue. Running on Android 7 on an emulator. (My project doesn't use any kotlin code, if that matters.) I'm using this library together with Calligraphy3.

Here is the stack trace:

java.lang.RuntimeException: Unable to start activity ComponentInfo{com.the.app/com.the.app.activities.MainActivity}: android.view.InflateException: Binary XML file line #24: Binary XML file line #24: Error inflating class LinearLayout
        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2646)
        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2707)
        at android.app.ActivityThread.-wrap12(ActivityThread.java)
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1460)
        at android.os.Handler.dispatchMessage(Handler.java:102)
        at android.os.Looper.loop(Looper.java:154)
        at android.app.ActivityThread.main(ActivityThread.java:6077)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:866)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:756)
     Caused by: android.view.InflateException: Binary XML file line #24: Binary XML file line #24: Error inflating class LinearLayout
     Caused by: android.view.InflateException: Binary XML file line #24: Error inflating class LinearLayout
     Caused by: java.lang.IllegalArgumentException: Parameter specified as non-null is null: method kotlin.jvm.internal.Intrinsics.checkParameterIsNotNull, parameter parent
        at io.github.inflationx.viewpump.ViewPumpLayoutInflater.onCreateView(ViewPumpLayoutInflater.kt)
        at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:785)
        at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:727)
        at android.view.LayoutInflater.inflate(LayoutInflater.java:495)
        at io.github.inflationx.viewpump.ViewPumpLayoutInflater.inflate(ViewPumpLayoutInflater.kt:54)
        at android.view.LayoutInflater.inflate(LayoutInflater.java:426)
        at io.github.inflationx.viewpump.ViewPumpLayoutInflater.inflate(ViewPumpLayoutInflater.kt:45)
        at android.view.LayoutInflater.inflate(LayoutInflater.java:377)
        at com.android.internal.policy.DecorView.onResourcesLoaded(DecorView.java:1776)
        at com.android.internal.policy.PhoneWindow.generateLayout(PhoneWindow.java:2613)
        at com.android.internal.policy.PhoneWindow.installDecor(PhoneWindow.java:2686)
        at com.android.internal.policy.PhoneWindow.getDecorView(PhoneWindow.java:2049)
        at androidx.appcompat.app.AppCompatDelegateImpl.createSubDecor(AppCompatDelegateImpl.java:575)
        at androidx.appcompat.app.AppCompatDelegateImpl.ensureSubDecor(AppCompatDelegateImpl.java:518)
        at androidx.appcompat.app.AppCompatDelegateImpl.setContentView(AppCompatDelegateImpl.java:466)
        at androidx.appcompat.app.AppCompatActivity.setContentView(AppCompatActivity.java:140)
        at com.the.app.activities.MainActivity.onCreate(MainActivity.java:270)
        at android.app.Activity.performCreate(Activity.java:6662)
        at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1118)
        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2599)
        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2707)
        at android.app.ActivityThread.-wrap12(ActivityThread.java)
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1460)
        at android.os.Handler.dispatchMessage(Handler.java:102)
        at android.os.Looper.loop(Looper.java:154)
        at android.app.ActivityThread.main(ActivityThread.java:6077)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:866)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:756)

crash

Fatal Exception: java.lang.RuntimeException: Unable to start activity ComponentInfo{com.schwab.mobile.ssm/com.schwab.mobile.ssm.lms3.LMSLogin}: android.view.InflateException: Binary XML file line #60: Binary XML file line #60: Error inflating class android.webkit.WebView
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2434)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2494)
at android.app.ActivityThread.access$900(ActivityThread.java:157)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1356)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:5551)
at java.lang.reflect.Method.invoke(Method.java)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:730)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:620)

Caused by android.view.InflateException: Binary XML file line #60: Binary XML file line #60: Error inflating class android.webkit.WebView
at android.view.LayoutInflater.inflate(LayoutInflater.java:539)
at io.github.inflationx.viewpump.internal.-ViewPumpLayoutInflater.inflate(-ViewPumpLayoutInflater.kt:57)
at android.view.LayoutInflater.inflate(LayoutInflater.java:423)
at io.github.inflationx.viewpump.internal.-ViewPumpLayoutInflater.inflate(-ViewPumpLayoutInflater.kt:48)
at android.view.LayoutInflater.inflate(LayoutInflater.java:374)
at com.android.internal.policy.PhoneWindow.setContentView(PhoneWindow.java:401)
at android.app.Activity.setContentView(Activity.java:2171)
at com.schwab.mobile.ssm.lms3.LMSLogin.onCreate(LMSLogin.java:121)
at android.app.Activity.performCreate(Activity.java:6272)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1108)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2387)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2494)
at android.app.ActivityThread.access$900(ActivityThread.java:157)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1356)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:5551)
at java.lang.reflect.Method.invoke(Method.java)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:730)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:620)

Caused by android.view.InflateException: Binary XML file line #60: Error inflating class android.webkit.WebView
at android.view.LayoutInflater.createView(LayoutInflater.java:645)
at io.github.inflationx.viewpump.internal.-ViewPumpLayoutInflater$NameAndAttrsViewCreator.onCreateView(-ViewPumpLayoutInflater.kt:290)
at io.github.inflationx.viewpump.internal.-FallbackViewCreationInterceptor.intercept(-FallbackViewCreationInterceptor.kt:14)
at io.github.inflationx.viewpump.internal.-InterceptorChain.proceed(-InterceptorChain.kt:30)
at io.github.inflationx.calligraphy3.CalligraphyInterceptor.intercept(CalligraphyInterceptor.java:18)
at io.github.inflationx.viewpump.internal.-InterceptorChain.proceed(-InterceptorChain.kt:30)
at io.github.inflationx.viewpump.ViewPump.inflate(ViewPump.kt:36)
at io.github.inflationx.viewpump.internal.-ViewPumpLayoutInflater.onCreateView(-ViewPumpLayoutInflater.kt:169)
at android.view.LayoutInflater.onCreateView(LayoutInflater.java:694)
at io.github.inflationx.viewpump.internal.-ViewPumpLayoutInflater.superOnCreateView(-ViewPumpLayoutInflater.kt:233)
at io.github.inflationx.viewpump.internal.-ViewPumpLayoutInflater.access$superOnCreateView(-ViewPumpLayoutInflater.kt:19)
at io.github.inflationx.viewpump.internal.-ViewPumpLayoutInflater$ParentAndNameAndAttrsViewCreator.onCreateView(-ViewPumpLayoutInflater.kt:271)
at io.github.inflationx.viewpump.internal.-FallbackViewCreationInterceptor.intercept(-FallbackViewCreationInterceptor.kt:14)
at io.github.inflationx.viewpump.internal.-InterceptorChain.proceed(-InterceptorChain.kt:30)
at io.github.inflationx.calligraphy3.CalligraphyInterceptor.intercept(CalligraphyInterceptor.java:18)
at io.github.inflationx.viewpump.internal.-InterceptorChain.proceed(-InterceptorChain.kt:30)
at io.github.inflationx.viewpump.ViewPump.inflate(ViewPump.kt:36)
at io.github.inflationx.viewpump.internal.-ViewPumpLayoutInflater.onCreateView(-ViewPumpLayoutInflater.kt:151)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:762)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:704)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:835)
at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:798)
at android.view.LayoutInflater.inflate(LayoutInflater.java:515)
at io.github.inflationx.viewpump.internal.-ViewPumpLayoutInflater.inflate(-ViewPumpLayoutInflater.kt:57)
at android.view.LayoutInflater.inflate(LayoutInflater.java:423)
at io.github.inflationx.viewpump.internal.-ViewPumpLayoutInflater.inflate(-ViewPumpLayoutInflater.kt:48)
at android.view.LayoutInflater.inflate(LayoutInflater.java:374)
at com.android.internal.policy.PhoneWindow.setContentView(PhoneWindow.java:401)
at android.app.Activity.setContentView(Activity.java:2171)
at com.schwab.mobile.ssm.lms3.LMSLogin.onCreate(LMSLogin.java:121)
at android.app.Activity.performCreate(Activity.java:6272)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1108)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2387)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2494)
at android.app.ActivityThread.access$900(ActivityThread.java:157)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1356)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:5551)
at java.lang.reflect.Method.invoke(Method.java)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:730)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:620)

Caused by java.lang.reflect.InvocationTargetException
at java.lang.reflect.Constructor.newInstance(Constructor.java)
at android.view.LayoutInflater.createView(LayoutInflater.java:619)
at io.github.inflationx.viewpump.internal.-ViewPumpLayoutInflater$NameAndAttrsViewCreator.onCreateView(-ViewPumpLayoutInflater.kt:290)
at io.github.inflationx.viewpump.internal.-FallbackViewCreationInterceptor.intercept(-FallbackViewCreationInterceptor.kt:14)
at io.github.inflationx.viewpump.internal.-InterceptorChain.proceed(-InterceptorChain.kt:30)
at io.github.inflationx.calligraphy3.CalligraphyInterceptor.intercept(CalligraphyInterceptor.java:18)
at io.github.inflationx.viewpump.internal.-InterceptorChain.proceed(-InterceptorChain.kt:30)
at io.github.inflationx.viewpump.ViewPump.inflate(ViewPump.kt:36)
at io.github.inflationx.viewpump.internal.-ViewPumpLayoutInflater.onCreateView(-ViewPumpLayoutInflater.kt:169)
at android.view.LayoutInflater.onCreateView(LayoutInflater.java:694)
at io.github.inflationx.viewpump.internal.-ViewPumpLayoutInflater.superOnCreateView(-ViewPumpLayoutInflater.kt:233)
at io.github.inflationx.viewpump.internal.-ViewPumpLayoutInflater.access$superOnCreateView(-ViewPumpLayoutInflater.kt:19)
at io.github.inflationx.viewpump.internal.-ViewPumpLayoutInflater$ParentAndNameAndAttrsViewCreator.onCreateView(-ViewPumpLayoutInflater.kt:271)
at io.github.inflationx.viewpump.internal.-FallbackViewCreationInterceptor.intercept(-FallbackViewCreationInterceptor.kt:14)
at io.github.inflationx.viewpump.internal.-InterceptorChain.proceed(-InterceptorChain.kt:30)
at io.github.inflationx.calligraphy3.CalligraphyInterceptor.intercept(CalligraphyInterceptor.java:18)
at io.github.inflationx.viewpump.internal.-InterceptorChain.proceed(-InterceptorChain.kt:30)
at io.github.inflationx.viewpump.ViewPump.inflate(ViewPump.kt:36)
at io.github.inflationx.viewpump.internal.-ViewPumpLayoutInflater.onCreateView(-ViewPumpLayoutInflater.kt:151)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:762)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:704)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:835)
at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:798)
at android.view.LayoutInflater.inflate(LayoutInflater.java:515)
at io.github.inflationx.viewpump.internal.-ViewPumpLayoutInflater.inflate(-ViewPumpLayoutInflater.kt:57)
at android.view.LayoutInflater.inflate(LayoutInflater.java:423)
at io.github.inflationx.viewpump.internal.-ViewPumpLayoutInflater.inflate(-ViewPumpLayoutInflater.kt:48)
at android.view.LayoutInflater.inflate(LayoutInflater.java:374)
at com.android.internal.policy.PhoneWindow.setContentView(PhoneWindow.java:401)
at android.app.Activity.setContentView(Activity.java:2171)
at com.schwab.mobile.ssm.lms3.LMSLogin.onCreate(LMSLogin.java:121)
at android.app.Activity.performCreate(Activity.java:6272)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1108)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2387)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2494)
at android.app.ActivityThread.access$900(ActivityThread.java:157)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1356)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:5551)
at java.lang.reflect.Method.invoke(Method.java)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:730)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:620)

Question: can this library help with integration of translation SDKs, such as Lokalise ?

I've noticed some edge cases that their SDK doesn't cover, such as inflation of Views (example is inflation via the class that extends Application, to show content on top using SAW permission) .

Could this library be used such that whenever the app needs to get an instance of Resources class, it would use the one of the SDK , including when inflating of Views ?

I ask because I've found this article, saying it might help:

https://jitinsharma.com/posts/taming-android-resources-and-layoutinflater-for-string-manipulation/?q=cache:NtfvHgBjYAgJ:https://jitinsharma.com/posts/taming-android-resources-and-layoutinflater-for-string-manipulation/%20&cd=19&hl=en&ct=clnk&gl=il

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.