@Override public void setContentView(View view, LayoutParams params) { if (requestDecorView(view, params, -1)) { mDecorView.removeAllViewsInLayout(); mDecorView.addView(view, params); } }
private boolean requestDecorView(View view, LayoutParams params, int layoutRes) { if (mDecorView != null) { return true; } mDecorView = new ActivityDecorView(); mDecorView.setId(android.R.id.content); mDecorView.setProvider(this); if (view != null) { mDecorView.addView(view, params); } else if (layoutRes > 0) { getThemedLayoutInflater().inflate(layoutRes, mDecorView, true); } final LayoutParams p = new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT); performAddonAction( new AddonCallback<IAddonActivity>() { @Override public boolean action(IAddonActivity addon) { return addon.installDecorView(mDecorView, p); } @Override public void justPost() { getWindow().setContentView(mDecorView, p); } }); return false; }
@Override public void addContentView(View view, LayoutParams params) { if (requestDecorView(view, params, -1)) { mDecorView.addView(view, params); onContentChanged(); } }
private boolean requestDecorView(View view, LayoutParams params, int layoutRes) { if (mDecorView != null) { return true; } mDecorView = new WindowDecorView(getContext()); mDecorView.setId(android.R.id.content); mDecorView.setProvider(this); if (view != null) { mDecorView.addView(view, params); } else if (layoutRes > 0) { getLayoutInflater().inflate(layoutRes, mDecorView, true); } getWindow() .setContentView( mDecorView, new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT)); return false; }