Example usage for android.view LayoutInflater getContext

List of usage examples for android.view LayoutInflater getContext

Introduction

In this page you can find the example usage for android.view LayoutInflater getContext.

Prototype

public Context getContext() 

Source Link

Document

Return the context we are running in, for access to resources, class loader, etc.

Usage

From source file:com.tune.news.fragment.SwipeRefreshListFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    mRefreshLayout = new SwipeRefreshLayout(inflater.getContext()) {
        @Override//w  ww  .  j a  v  a 2s.c om
        public boolean canChildScrollUp() {
            return mListView != null && mListView.getFirstVisiblePosition() != 0;
        }
    };
    inflateView(inflater, mRefreshLayout, savedInstanceState);

    mListView = (ListView) mRefreshLayout.findViewById(android.R.id.list);
    if (mListView != null) {
        // HACK to be able to know when we are on the top of the list (for the swipe refresh)
        mListView.addHeaderView(new View(mListView.getContext()));
    }

    return mRefreshLayout;
}

From source file:com.aphidmobile.flip.demo.fragment.FlipTextViewFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    flipView = new FlipViewController(inflater.getContext());

    flipView.setAdapter(new BaseAdapter() {
        @Override//from w  ww .  j  a va 2  s  . com
        public int getCount() {
            return 10;
        }

        @Override
        public Object getItem(int position) {
            return position;
        }

        @Override
        public long getItemId(int position) {
            return position;
        }

        @Override
        public View getView(int position, View convertView, ViewGroup parent) {
            NumberTextView view;
            if (convertView == null) {
                final Context context = parent.getContext();
                view = new NumberTextView(context, position);
                view.setTextSize(context.getResources().getDimension(R.dimen.textSize));
            } else {
                view = (NumberTextView) convertView;
                view.setNumber(position);
            }

            return view;
        }
    });

    return flipView;
}

From source file:com.technoxist.fragment.SwipeRefreshListFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    mRefreshLayout = new SwipeRefreshLayout(inflater.getContext()) {
        @Override//from  ww  w  . j  a  v a2  s  .  c om
        public boolean canChildScrollUp() {
            if (mListView != null) {
                return mListView.getFirstVisiblePosition() != 0;
            }
            return false;
        }
    };
    inflateView(inflater, mRefreshLayout, savedInstanceState);

    mListView = (ListView) mRefreshLayout.findViewById(android.R.id.list);
    if (mListView != null) {
        // HACK to be able to know when we are on the top of the list (for the swipe refresh)
        mListView.addHeaderView(new View(mListView.getContext()));
    }

    return mRefreshLayout;
}

From source file:hobby.wei.c.framework.AbsFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    mCreatedView = inflater.inflate(Injector.layoutID(inflater.getContext(), getClass()), container, false);
    Injector.inject(this, mCreatedView, AbsFragment.class);
    return mCreatedView;
}

From source file:net.gsantner.opoc.activity.GsFragmentBase.java

/**
 * Inflate the fragments layout. Don't override this method, just supply the needed
 * {@link LayoutRes} via abstract method {@link #getLayoutResId()}, super does the rest
 *//*from   w  ww  .  ja v  a2  s.  c o  m*/
@Deprecated
@Nullable
@Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container,
        @Nullable Bundle savedInstanceState) {
    _cu = new ContextUtils(inflater.getContext());
    _cu.setAppLanguage(getAppLanguage());
    _savedInstanceState = savedInstanceState;
    View view = inflater.inflate(getLayoutResId(), container, false);
    ButterKnife.bind(this, view);
    return view;
}

From source file:net.saga.aeroconf.app.ui.fragment.ScheduleFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    view = new ListView(inflater.getContext());
    view.setAdapter(adapter);//from w ww .  j a  va2  s  .  c o  m

    view.setOnItemClickListener(new AdapterView.OnItemClickListener() {
        @Override
        public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
            if (adapter.getItem(position) instanceof Schedule) {
                Schedule item = (Schedule) adapter.getItem(position);
            }
        }
    });

    return view;
}

From source file:com.whatime.framework.ui.fragment.RightFragment.java

public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    view = inflater.inflate(R.layout.right, null);
    mContext = inflater.getContext();
    listener = new MyOnclickListener();
    bitmapUtils = new BitmapUtils(mContext);
    initUi();/*from  w  w  w. j av a  2 s  .c om*/

    return view;
}

From source file:com.android.madpausa.cardnotificationviewer.MainActivityFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    //TODO implement extra to filter this view
    //creating the adapter
    notificationAdapter = new NotificationListAdapter(inflater.getContext());

    nRecyclerView = (RecyclerView) inflater.inflate(R.layout.fragment_main, container, false);
    nRecyclerView.setHasFixedSize(false);

    nLayoutManager = new LinearLayoutManager(inflater.getContext());
    nRecyclerView.setLayoutManager(nLayoutManager);

    nRecyclerView.setAdapter(notificationAdapter);
    super.onCreateView(inflater, container, savedInstanceState);

    //loading the loader
    return nRecyclerView;
}

From source file:com.mobilesolutionworks.android.managedview.test.DemoInFragment.java

@Override
public LayoutInflater getLayoutInflater(Bundle savedInstanceState) {
    LayoutInflater inflater = super.getLayoutInflater(savedInstanceState);
    inflater = inflater.cloneInContext(inflater.getContext());

    inflater.setFactory(this);
    return inflater;
}

From source file:org.dmfs.android.microfragments.HostFragment.java

@Nullable
@Override//w ww .j av a2 s  .  c o  m
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container,
        @Nullable Bundle savedInstanceState) {
    View result = new FrameLayout(inflater.getContext());
    result.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
            ViewGroup.LayoutParams.MATCH_PARENT));
    result.setId(R.id.microfragments_host);
    return result;
}