List of usage examples for android.view LayoutInflater getFactory
public final Factory getFactory()
From source file:com.github.shareme.blackandroids.greenandroid.viewdecorator.ViewDecoratorInstaller.java
@UiThread public boolean install(@NonNull Activity activity) { LayoutInflater layoutInflater = activity.getLayoutInflater(); if (layoutInflater.getFactory() == null) { LayoutInflaterFactory layoutInflaterFactory = new DecoratingLayoutInflaterFactory( getPlatformViewFactory(layoutInflater), viewDecorator); LayoutInflaterCompat.setFactory(layoutInflater, layoutInflaterFactory); return true; }// w w w . j a v a 2 s.com return false; }
From source file:com.github.shareme.blackandroids.greenandroid.viewdecorator.ViewDecoratorInstaller.java
/** * Installs the helper to an activity. Once the helper is installed to an activity it can't be installed to another activty * * @param activity activity to install the helper to * @return true if installation was successful, false otherwise * @throws IllegalStateException if helper is already install with the activity * *///from w ww .j a v a2 s .c o m @UiThread public boolean install(@NonNull AppCompatActivity activity) { AppCompatDelegate delegate = activity.getDelegate(); LayoutInflater layoutInflater = activity.getLayoutInflater(); if (layoutInflater.getFactory() == null) { LayoutInflaterFactory layoutInflaterFactory = new DecoratingLayoutInflaterFactory( new CompositingViewFactory(getPlatformViewFactory(layoutInflater), new AppCompatViewFactory(delegate, activity)), viewDecorator); LayoutInflaterCompat.setFactory(layoutInflater, layoutInflaterFactory); return true; } Log.w(TAG, "view decorator can't be installed, layout infalter already has view factory installed"); return false; }
From source file:org.mariotaku.twidere.activity.support.ThemedFragmentActivity.java
@NonNull @Override/*from w w w .j av a 2 s . co m*/ public LayoutInflater getLayoutInflater() { final LayoutInflater inflater = super.getLayoutInflater(); if (inflater.getFactory() == null) { LayoutInflaterCompat.setFactory(inflater, new ThemedLayoutInflaterFactory(this, new LayoutInflaterFactory() { @Override public View onCreateView(View parent, String name, Context context, AttributeSet attrs) { return ThemedFragmentActivity.this.onCreateView(parent, name, context, attrs); } })); } return inflater; }
From source file:android.support.v7.app.AppCompatDelegateImplV7.java
@Override public void installViewFactory() { LayoutInflater layoutInflater = LayoutInflater.from(mContext); if (layoutInflater.getFactory() == null) { LayoutInflaterCompat.setFactory(layoutInflater, this); } else {//from ww w .j av a 2s . co m Log.i(TAG, "The Activity's LayoutInflater already has a Factory installed" + " so we can not install AppCompat's"); } }
From source file:android.support.v7ox.app.AppCompatDelegateImplV7.java
@Override public void installViewFactory() { LayoutInflater layoutInflater = LayoutInflater.from(mContext); if (layoutInflater.getFactory() == null) { LayoutInflaterCompat.setFactory(layoutInflater, this); } else {// w ww . j av a 2s.c om if (!(LayoutInflaterCompat.getFactory(layoutInflater) instanceof AppCompatDelegateImplV7)) { Log.i(TAG, "The Activity's LayoutInflater already has a Factory installed" + " so we can not install AppCompat's"); } } }