InflationX/ViewPump

intercepting bug, or better understanding ?

jbruchanov opened this issue · 1 comments

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 ?

Please use discussions