List of usage examples for android.view LayoutInflater getContext
public Context getContext()
From source file:com.ixvil.android.BoxBonus.Fragments.NewsListFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { RecyclerView recyclerView = (RecyclerView) inflater.inflate(R.layout.recycler_view, container, false); contentAdapter = new NewsAdapter(recyclerView.getContext()); recyclerView.setAdapter(contentAdapter); recyclerView.setHasFixedSize(true);// w w w . j ava 2 s . c om recyclerView.setLayoutManager(new LinearLayoutManager(getActivity())); NewsModel.getFromNet(inflater.getContext(), this); return recyclerView; }
From source file:vn.cybersoft.obs.android.fragments.AboutFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = inflater.inflate(LAYOUT_ID, container, false); // Load content mWebView = (WebView) view.findViewById(R.id.webview); mWebView.setScrollBarStyle(View.SCROLLBARS_INSIDE_OVERLAY); String helpFileName = "about_en.html"; /*if (Preferences.getInstance().getLanguage().equals("en")) helpFileName="about_us.html";/*from www . j a va 2s. co m*/ else helpFileName="about_us_vi.html";*/ String html = Utils.getFileContent(inflater.getContext(), helpFileName); mWebView.loadDataWithBaseURL(null, html, "text/html", "utf-8", null); return view; }
From source file:com.firma.dev.letschat.MyFavoriteFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { final View listFragmentView = super.onCreateView(inflater, container, savedInstanceState); apiManager = new ApiManager(); ProfileDataSource profileDao = new ProfileDataSource(inflater.getContext()); try {//from ww w . j a va2s .com profileDao.open(); currentProfile = profileDao.getAllProfiles().get(0); profileDao.close(); } catch (SQLException e) { e.printStackTrace(); } userContactsTimer = new Timer(); getUserContactsTask = new GetUserContactsTask(); userContactsTimer.schedule(getUserContactsTask, 1000, 60000); fAdapter = new FavoriteAdapter(inflater.getContext(), getActivity()); setListAdapter(fAdapter); mSwipeRefreshLayout = new ListFragmentSwipeRefreshLayout(container.getContext()); mSwipeRefreshLayout.addView(listFragmentView, ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT); mSwipeRefreshLayout.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT)); this.setRefreshing(false); mSwipeRefreshLayout.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() { @Override public void onRefresh() { forceUpdate(); } }); return mSwipeRefreshLayout; }
From source file:de.mrapp.android.util.view.AbstractViewRecycler.java
/** * Creates a new recycler, which allows to cache views in order to be able to reuse them later, * instead of inflating new instances.//from w w w . ja va 2 s.com * * @param inflater * The layout inflater, which should be used to inflate views, as an instance of the * class {@link LayoutInflater}. The layout inflater may not be null */ public AbstractViewRecycler(@NonNull final LayoutInflater inflater) { ensureNotNull(inflater, "The layout inflater may not be null"); this.context = inflater.getContext(); this.inflater = inflater; this.activeViews = new HashMap<>(); this.logger = new Logger(LogLevel.INFO); this.adapter = null; this.unusedViews = null; this.useCache = true; }
From source file:com.wit.and.dialog.EditDialog.java
/** *//* w w w .j a v a2s. co m*/ @Override protected View onCreateBodyView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { final Context context = inflater.getContext(); EditText editText = new EditText(context); editText.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT)); editText.setId(R.id.And_Dialog_EditText); return editText; }
From source file:de.tudarmstadt.dvs.myhealthassistant.myhealthhub.fragments.SensorConfigurationListFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { //ArrayAdapter<String> adapter = new ArrayAdapter<String>(inflater.getContext(), android.R.layout.simple_list_item_1,countries); //setListAdapter(adapter); SensorModule[] modules = new SensorModule[] { new SensorModule("Heart Rate"), new SensorModule("Accelerometer"), new SensorModule("Scale"), new SensorModule("Blood Pressure") }; SensorModuleAdapter adapter = new SensorModuleAdapter(inflater.getContext(), R.layout.list_sensor_config_row, modules); setListAdapter(adapter);// w ww . j av a2s . c o m return super.onCreateView(inflater, container, savedInstanceState); }
From source file:edu.rowan.app.fragments.HomescreenFragment.java
/** * Construct the view for this fragment. * The core layout of this fragment is a CarouselView and grid of available buttons *///from w w w . ja va 2 s . c o m @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // hide actionbar loading indicator TODO: move this elsewhere activity.showLoading(false); View view = inflater.inflate(R.layout.activity_main, container, false); RelativeLayout layout = (RelativeLayout) view.findViewById(R.id.mainLayout); layout.setPadding(0, 20, 0, 0); CarouselView rowanFeatures = new CarouselView(inflater.getContext()); // set view Id so that relativeLayout can position. Without an Id relativeLayout doesn't work rowanFeatures.setId(2342343); layout.addView(rowanFeatures); setTouchListener(rowanFeatures); GridView grid = new GridView(inflater.getContext()); grid.setOnItemClickListener(this); grid.setNumColumns(3); grid.setVerticalSpacing(20); grid.setAdapter(new RowanAdapter()); RelativeLayout.LayoutParams gridParams = new RelativeLayout.LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT); gridParams.addRule(RelativeLayout.BELOW, rowanFeatures.getId()); gridParams.topMargin = 20; layout.addView(grid, gridParams); return view; }
From source file:com.silentcircle.contacts.list.ScDefaultContactBrowseListFragment.java
/** * This method creates a pseudo user profile contact. When the returned query doesn't have * a profile, this methods creates 2 views that are inserted as headers to the listview: * 1. A header view with the "ME" title and the contacts count. * 2. A button that prompts the user to create a local profile *//* w ww .j a v a 2s.c o m*/ @TargetApi(Build.VERSION_CODES.ICE_CREAM_SANDWICH) private void addEmptyUserProfileHeader(LayoutInflater inflater) { ListView list = getListView(); // Put a header with the "ME" name and a view for the number of contacts // The view is embedded in a frame view since you cannot change the visibility of a // view in a ListView without having a parent view. mProfileHeaderContainer = new FrameLayout(inflater.getContext()); mProfileHeader = inflater.inflate(R.layout.user_profile_header, null, false); mCounterHeaderView = (TextView) mProfileHeader.findViewById(R.id.contacts_count); mProfileTitle = (TextView) mProfileHeader.findViewById(R.id.profile_title); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) mProfileTitle.setAllCaps(true); mProfileHeaderContainer.addView(mProfileHeader); list.addHeaderView(mProfileHeaderContainer, null, false); // Add a selectable view with a message inviting the user to create a local profile mMessageContainer = new FrameLayout(inflater.getContext()); mProfileMessage = (Button) inflater.inflate(R.layout.user_profile_button, null, false); mMessageContainer.addView(mProfileMessage); list.addHeaderView(mMessageContainer, null, true); mProfileMessage.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { Intent intent = new Intent(Intent.ACTION_INSERT, RawContacts.CONTENT_URI); intent.putExtra(ContactEditorFragment.INTENT_EXTRA_NEW_LOCAL_PROFILE, true); startActivity(intent); } }); }
From source file:com.github.pockethub.ui.comment.CommentListAdapter.java
/** * Create list adapter/*from w w w .j av a 2 s. c o m*/ * * @param inflater * @param elements * @param avatars * @param imageGetter * @param userName * @param isOwner */ public CommentListAdapter(LayoutInflater inflater, GithubComment[] elements, AvatarLoader avatars, HttpImageGetter imageGetter, EditCommentListener editCommentListener, DeleteCommentListener deleteCommentListener, String userName, boolean isOwner, Issue issue) { super(inflater); this.issue = issue; this.userName = userName; this.isOwner = isOwner; this.context = inflater.getContext(); this.avatars = avatars; this.imageGetter = imageGetter; this.editCommentListener = editCommentListener; this.deleteCommentListener = deleteCommentListener; setItems(elements); }
From source file:org.chinamil.downland.fragments.ArticleFragment.java
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // If activity recreated (such as from screen rotate), restore // the previous article selection set by onSaveInstanceState(). // This is primarily necessary when in the two-pane layout. if (savedInstanceState != null) { mCurrentPosition = savedInstanceState.getInt(ARG_POSITION); Title = savedInstanceState.getString(Title); }/*ww w . j a v a 2s . c o m*/ this.inflater = inflater; context = inflater.getContext(); /* View view01 = getLocalActivityManager().startActivity("activity01", new Intent(this, MainActivity1.class)).getDecorView();*/ // Inflate the layout for this fragment /* ActivityGroup activityGroup=new ActivityGroup(); Intent intent= new Intent(inflater.getContext(), WebviewActivity.class); intent.putExtra("who", MD5.getMD5(titleString)); intent.putExtra("date", titleString); bView = activityGroup.getLocalActivityManager().startActivity("activity01", intent ).getDecorView(); return bView; */ // return inflater.inflate(R.layout.article_view, container, false); width = getActivity().getWindowManager().getDefaultDisplay().getWidth(); return inflater.inflate(R.layout.article_view, container, false); }