List of usage examples for android.view ViewGroup findViewById
@Nullable public final <T extends View> T findViewById(@IdRes int id)
From source file:net.seedboxer.seedroid.activities.fragments.InQueueFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { ViewGroup rootView = (ViewGroup) inflater.inflate(R.layout.in_queue_view, container, false); mListView = (DragSortListView) rootView.findViewById(android.R.id.list); mListView.setAdapter(adapter);//from w ww. j ava2 s. c o m mListView.setEmptyView(rootView.findViewById(android.R.id.empty)); final DragSortController dragSortController = new ConfigurationDragSortController(); mListView.setFloatViewManager(dragSortController); mListView.setDropListener(new DragSortListView.DropListener() { public void drop(int from, int to) { adapter.change(from, to); } }); final SwipeDismissListViewTouchListener swipeDismissTouchListener = new SwipeDismissListViewTouchListener( mListView, new SwipeDismissListViewTouchListener.DismissCallbacks() { public boolean canDismiss(int position) { return position < adapter.getCount(); } public void onDismiss(ListView listView, int[] reverseSortedPositions) { for (int position : reverseSortedPositions) { FileValue item = adapter.remove(position); delete(item); } } }); mListView.setOnScrollListener(swipeDismissTouchListener.makeScrollListener()); mListView.setOnTouchListener(new View.OnTouchListener() { public boolean onTouch(View view, MotionEvent motionEvent) { return dragSortController.onTouch(view, motionEvent) || (!dragSortController.isDragging() && swipeDismissTouchListener.onTouch(view, motionEvent)); } }); mListView.setItemsCanFocus(true); setHasOptionsMenu(true); return rootView; }
From source file:net.olejon.mdapp.SubstancesFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { ViewGroup viewGroup = (ViewGroup) inflater.inflate(R.layout.fragment_substances, container, false); // Context//from www. j a v a 2 s. c o m mContext = viewGroup.getContext(); // Tools mTools = new MyTools(mContext); // Search mSearchEditText = (EditText) getActivity().findViewById(R.id.main_search_edittext); // List mListView = (ListView) viewGroup.findViewById(R.id.main_substances_list); mListViewEmpty = viewGroup.findViewById(R.id.main_substances_list_empty); // Get substances GetSubstancesTask getSubstancesTask = new GetSubstancesTask(); getSubstancesTask.execute(); return viewGroup; }
From source file:com.andrew.apollo.ui.fragments.profile.PlaylistSongFragment.java
/** * {@inheritDoc}//from w ww. j a va 2 s . co m */ @Override public View onCreateView(final LayoutInflater inflater, final ViewGroup container, final Bundle savedInstanceState) { // The View for the fragment's UI final ViewGroup rootView = (ViewGroup) inflater.inflate(R.layout.list_base, null); // Initialize the list mListView = (DragSortListView) rootView.findViewById(R.id.list_base); // Set the data behind the list mListView.setAdapter(mAdapter); // Release any references to the recycled Views mListView.setRecyclerListener(new RecycleHolder()); // Listen for ContextMenus to be created mListView.setOnCreateContextMenuListener(this); // Play the selected song mListView.setOnItemClickListener(this); // Set the drop listener mListView.setDropListener(this); // Set the swipe to remove listener mListView.setRemoveListener(this); // Quick scroll while dragging mListView.setDragScrollProfile(this); // To help make scrolling smooth mListView.setOnScrollListener(new VerticalScrollListener(null, mProfileTabCarousel, 0)); // Remove the scrollbars and padding for the fast scroll mListView.setVerticalScrollBarEnabled(false); mListView.setFastScrollEnabled(false); mListView.setPadding(0, 0, 0, 0); return rootView; }
From source file:es.ubiqua.atractivas.GaleryPageFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { Imagen imagen = ((GaleryActivity) getActivity()).m_parts.get(mPageNumber); Rss rss = ((GaleryActivity) getActivity()).rss; // Inflate the layout containing a title and body text. ViewGroup rootView = (ViewGroup) inflater.inflate(R.layout.fragment_galery_page, container, false); FontLoader.overrideFonts(rootView, "normal"); NoAutoScrollView scroll = (NoAutoScrollView) rootView.findViewById(R.id.content); scroll.setOnEndScrollListener(new NoAutoScrollView.OnEndScrollListener() { @Override/*from w w w . j a v a 2 s.com*/ public void onEndScroll(boolean home, boolean end) { if (home || end) { ((GaleryActivity) getActivity()).showButtons(); } else { ((GaleryActivity) getActivity()).hideButtons(); } } }); // Set the title view to show the page number. ((TextView) rootView.findViewById(R.id.DetalleCategoria)).setText(rss.getCategory()); ImageView favorito = (ImageView) rootView.findViewById(R.id.DetalleFavorito); favorito.setTag(rss); if (rss.getFavorito()) { favorito.setImageDrawable(ApplicationApp.getDrawable("favoritos_selected")); } else { favorito.setImageDrawable(ApplicationApp.getDrawable("favoritos")); } ((TextView) rootView.findViewById(R.id.DetalleTitulo)).setText(rss.getTitle()); favorito.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { ImageView imagen = (ImageView) view; RssDataSource _rssDataSource = new RssDataSource(getActivity().getApplicationContext()); try { _rssDataSource.open(); } catch (SQLException e) { // Log.d( "action fragment_category", "Enter: handleMessage -> " + e.getMessage() ); } Rss rss = (Rss) imagen.getTag(); rss.setFavorito(!rss.getFavorito()); _rssDataSource.updateFavorito(rss.getId(), rss.getFavorito()); if (rss.getFavorito()) { imagen.setImageDrawable(ApplicationApp.getDrawable("favoritos_selected")); } else { imagen.setImageDrawable(ApplicationApp.getDrawable("favoritos")); } ((GaleryActivity) getActivity()).rss = rss; _rssDataSource.close(); } }); // whenever you want to load an image from url // call DisplayImage function // url - image url to load // loader - loader image, will be displayed before getting image // image - ImageView imgLoader.DisplayImage(imagen.getUrl(), R.drawable.placeholder_detalle, (ImageView) rootView.findViewById(R.id.DetalleImagen)); ((WebView) rootView.findViewById(R.id.DestalleFulltext)).loadData(HEADER + imagen.getTexto() + FOOTER, "text/html; charset=UTF-8", null); yocAdBannerViewb = (YocAdViewContainer) rootView.findViewById(R.id.baner_publicidad); if (rss.getParentCategory().equals(new String("En Forma"))) { _yocAdManagerb = new YocAdManager(getActivity(), ApplicationApp.YOC_TAG_ENFORMA_BANNER, AdSize.BANNER_SMARTPHONE_480x80, new AdBanner()); } else if (rss.getParentCategory().equals(new String("Salud"))) { _yocAdManagerb = new YocAdManager(getActivity(), ApplicationApp.YOC_TAG_SALUD_BANNER, AdSize.BANNER_SMARTPHONE_480x80, new AdBanner()); } else if (rss.getParentCategory().equals(new String("Moda"))) { _yocAdManagerb = new YocAdManager(getActivity(), ApplicationApp.YOC_TAG_MODA_BANNER, AdSize.BANNER_SMARTPHONE_480x80, new AdBanner()); } else if (rss.getParentCategory().equals(new String("Nutricin"))) { _yocAdManagerb = new YocAdManager(getActivity(), ApplicationApp.YOC_TAG_NUTRI_BANNER, AdSize.BANNER_SMARTPHONE_480x80, new AdBanner()); } else if (rss.getParentCategory().equals(new String("Belleza"))) { _yocAdManagerb = new YocAdManager(getActivity(), ApplicationApp.YOC_TAG_BELLEZA_BANNER, AdSize.BANNER_SMARTPHONE_480x80, new AdBanner()); } else { _yocAdManagerb = new YocAdManager(getActivity(), ApplicationApp.YOC_TAG_GENERAL_BANNER, AdSize.BANNER_SMARTPHONE_480x80, new AdBanner()); } createLigAdView(ApplicationApp.LigatusId, rootView); return rootView; }
From source file:es.ubiqua.atractivas.ArticlePageFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { rss = ((ArticleActivity) getActivity()).m_parts.get(mPageNumber); // Inflate the layout containing a title and body text. ViewGroup rootView = (ViewGroup) inflater.inflate(R.layout.fragment_article_page, container, false); FontLoader.overrideFonts(rootView, "bold"); NoAutoScrollView scroll = (NoAutoScrollView) rootView.findViewById(R.id.content); if (((ArticleActivity) getActivity()).m_parts.size() <= 1) { ((ArticleActivity) getActivity()).hideButtons(); } else {// ww w . jav a 2 s . c om scroll.setOnEndScrollListener(new NoAutoScrollView.OnEndScrollListener() { @Override public void onEndScroll(boolean home, boolean end) { if (home || end) { ((ArticleActivity) getActivity()).showButtons(); } else { ((ArticleActivity) getActivity()).hideButtons(); } } }); } // Set the title view to show the page number. ((TextView) rootView.findViewById(R.id.DetalleCategoria)).setText(rss.getCategory()); ImageView favorito = (ImageView) rootView.findViewById(R.id.DetalleFavorito); favorito.setTag(rss); if (rss.getFavorito()) { favorito.setImageDrawable(ApplicationApp.getDrawable("favoritos_selected")); } else { favorito.setImageDrawable(ApplicationApp.getDrawable("favoritos")); } ((TextView) rootView.findViewById(R.id.DetalleTitulo)).setText(rss.getTitle()); favorito.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { ImageView imagen = (ImageView) view; RssDataSource _rssDataSource = new RssDataSource(getActivity().getApplicationContext()); try { _rssDataSource.open(); } catch (SQLException e) { // Log.d( "action fragment_category", "Enter: handleMessage -> " + e.getMessage() ); } Rss rss = (Rss) imagen.getTag(); rss.setFavorito(!rss.getFavorito()); _rssDataSource.updateFavorito(rss.getId(), rss.getFavorito()); if (rss.getFavorito()) { imagen.setImageDrawable(ApplicationApp.getDrawable("favoritos_selected")); } else { imagen.setImageDrawable(ApplicationApp.getDrawable("favoritos")); } _rssDataSource.close(); } }); // whenever you want to load an image from url // call DisplayImage function // url - image url to load // loader - loader image, will be displayed before getting image // image - ImageView imgLoader.DisplayImage(rss.getImage(), R.drawable.placeholder_detalle, (ImageView) rootView.findViewById(R.id.DetalleImagen)); ((WebView) rootView.findViewById(R.id.DestalleFulltext)).loadData(HEADER + rss.getFullText() + FOOTER, "text/html; charset=UTF-8", null); yocAdBannerViewb = (YocAdViewContainer) rootView.findViewById(R.id.baner_publicidad); if (rss.getParentCategory().equals(new String("En Forma"))) { _yocAdManagerb = new YocAdManager(getActivity(), ApplicationApp.YOC_TAG_ENFORMA_BANNER, AdSize.BANNER_SMARTPHONE_480x80, new AdBanner()); } else if (rss.getParentCategory().equals(new String("Salud"))) { _yocAdManagerb = new YocAdManager(getActivity(), ApplicationApp.YOC_TAG_SALUD_BANNER, AdSize.BANNER_SMARTPHONE_480x80, new AdBanner()); } else if (rss.getParentCategory().equals(new String("Moda"))) { _yocAdManagerb = new YocAdManager(getActivity(), ApplicationApp.YOC_TAG_MODA_BANNER, AdSize.BANNER_SMARTPHONE_480x80, new AdBanner()); } else if (rss.getParentCategory().equals(new String("Nutricin"))) { _yocAdManagerb = new YocAdManager(getActivity(), ApplicationApp.YOC_TAG_NUTRI_BANNER, AdSize.BANNER_SMARTPHONE_480x80, new AdBanner()); } else if (rss.getParentCategory().equals(new String("Belleza"))) { _yocAdManagerb = new YocAdManager(getActivity(), ApplicationApp.YOC_TAG_BELLEZA_BANNER, AdSize.BANNER_SMARTPHONE_480x80, new AdBanner()); } else { _yocAdManagerb = new YocAdManager(getActivity(), ApplicationApp.YOC_TAG_GENERAL_BANNER, AdSize.BANNER_SMARTPHONE_480x80, new AdBanner()); } createLigAdView(ApplicationApp.LigatusId, rootView); return rootView; }
From source file:com.javielinux.dialogs.CreateListTwitterDialogFragment.java
@Override public Dialog onCreateDialog(Bundle savedInstanceState) { final ViewGroup view = (ViewGroup) LayoutInflater.from(getActivity()).inflate(R.layout.create_list_dialog, null);/*w w w .j av a2 s. co m*/ return new AlertDialog.Builder(getActivity()).setTitle(R.string.newList).setView(view) .setPositiveButton(R.string.save, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialogInterface, int i) { String title = ((TextView) view.findViewById(R.id.dialog_title)).getText().toString(); String description = ((TextView) view.findViewById(R.id.dialog_description)).getText() .toString(); boolean isPublic = ((CheckBox) view.findViewById(R.id.dialog_is_public)).isChecked(); if (!TextUtils.isEmpty(title) && !TextUtils.isEmpty(description)) { onCreateListListener.onCreateList(title, description, isPublic); } } }).setNegativeButton(R.string.cancel, null).create(); }
From source file:net.naonedbus.card.impl.HoraireCard.java
private void fillView(final ViewGroup base, final ViewGroup parent) { final int viewsCount = getTextViewCount(base); final TableRow rowTop = (TableRow) parent.findViewById(R.id.rowTop); final TableRow rowBottom = (TableRow) parent.findViewById(R.id.rowBottom); for (int i = 0; i < viewsCount; i++) { int layoutHoraire; if (i == 0) layoutHoraire = R.layout.card_horaire_text_first; else if (i < viewsCount - 1) layoutHoraire = R.layout.card_horaire_text; else//from w ww . j ava 2s .c o m layoutHoraire = R.layout.card_horaire_text_last; final TextView horaireView = (TextView) mLayoutInflater.inflate(layoutHoraire, null); final TextView delayView = (TextView) mLayoutInflater.inflate(R.layout.card_horaire_delay, null); setTypefaceRobotoLight(horaireView); rowTop.addView(horaireView); rowBottom.addView(delayView); mHoraireViews.add(horaireView); mDelaiViews.add(delayView); } initLoader(null, this).forceLoad(); }
From source file:com.skubit.android.SkubitAndroidActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); if (savedInstanceState != null) { mResolvingError = savedInstanceState.getBoolean("ResolvingError"); mLoginInProcess = savedInstanceState.getBoolean("LoginInProcess"); }/*from w ww. ja v a2 s .c o m*/ setContentView(R.layout.main_activity); new FontManager(this); ViewGroup mActionBarLayout = (ViewGroup) getLayoutInflater().inflate(R.layout.action_bar, null); TextView mTitle = (TextView) mActionBarLayout.findViewById(R.id.displayName); mTitle.setTypeface(FontManager.LITE); getActionBar().setHomeButtonEnabled(true); getActionBar().setDisplayHomeAsUpEnabled(true); getActionBar().setDisplayShowCustomEnabled(true); getActionBar().setDisplayShowTitleEnabled(false); getActionBar().setCustomView(mActionBarLayout); setColorResource(R.color.action_bar_coin_color); mAccountSettings = AccountSettings.get(this); String cookie = mAccountSettings.retrieveCookie(); if (TextUtils.isEmpty(cookie)) { Intent intent = new Intent(); intent.setClass(this, LoginActivity.class); this.startActivity(intent); //TODO: get from db //this.signoutOfSkubit();//bad cookie, remove all account info } mImageLoader = ((SkubitApplication) getApplication()).getImageLoader(); mAccountView = (BitIdAccountView) findViewById(R.id.google_accounts); mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout); mDrawerLayout.setDrawerShadow(R.drawable.drawer_shadow, GravityCompat.START); mDrawerToggle = new ActionBarDrawerToggle(this, mDrawerLayout, R.drawable.ic_drawer, R.string.drawer_open, R.string.drawer_close) { @Override public void onDrawerClosed(View view) { super.onDrawerClosed(view); invalidateOptionsMenu(); } @Override public void onDrawerOpened(View drawerView) { super.onDrawerOpened(drawerView); invalidateOptionsMenu(); } }; mDrawerList = (ListView) findViewById(R.id.left_drawer); mDrawerListFrame = (LinearLayout) this.findViewById(R.id.left_drawer_frame); mDrawerAdapter = new DrawerAdapter(this, null, R.array.drawer_items); mDrawerList.setOnItemClickListener(new DrawerItemClickListener()); mDrawerLayout.setDrawerListener(mDrawerToggle); mDrawerList.setAdapter(mDrawerAdapter); mDrawerAdapter.setBoldPosition(0); selectItem(0); mAccountView.initialize(this, mDrawerLayout); }
From source file:com.ymt.demo1.plates.hub.MyHubFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = inflater.inflate(R.layout.fragment_scrollview_ultra_list_view, container, false); scrollView = (ObservableScrollView) view.findViewById(R.id.scroll); Fragment parentFragment = getParentFragment(); ViewGroup viewGroup = (ViewGroup) parentFragment.getView(); if (viewGroup != null) { scrollView.setTouchInterceptionViewGroup((ViewGroup) viewGroup.findViewById(R.id.container)); if (parentFragment instanceof ObservableScrollViewCallbacks) { scrollView.setScrollViewCallbacks((ObservableScrollViewCallbacks) parentFragment); }//w w w . ja v a2s. c om } initView(view); switch (type) { case MY_POST: //? postList = new ArrayList<>(); mQueue.add(getHubMyPost(AppContext.now_user_name, index)); pullToRefreshListView.setMode(PullToRefreshBase.Mode.BOTH); break; case MY_REPLIES: // replyList = new ArrayList<>(); mQueue.add(getHubMyReplies(AppContext.now_user_name, index)); pullToRefreshListView.setMode(PullToRefreshBase.Mode.BOTH); break; case MY_SYS_INFO: //? sysInfoList = new ArrayList<>(); mQueue.add(getHubSysInfo(AppContext.now_user_name)); pullToRefreshListView.setMode(PullToRefreshBase.Mode.DISABLED); break; default: break; } return view; }
From source file:com.cairoconfessions.ScreenSlidePageFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // Inflate the layout containing a title and body text. ViewGroup rootView; switch (mPageNumber) { case 0://from ww w . java 2s. co m rootView = (ViewGroup) inflater.inflate(R.layout.fragment_location_screen_slide_page, container, false); adapter = new ArrayAdapter<String>(getActivity(), android.R.layout.simple_dropdown_item_1line, COUNTRIES); adapter.setNotifyOnChange(true); AutoCompleteTextView textView = (AutoCompleteTextView) rootView.findViewById(R.id.addLocation); textView.setAdapter(adapter); break; case 1: rootView = (ViewGroup) inflater.inflate(R.layout.fragment_main_screen_slide_page, container, false); break; case 2: rootView = (ViewGroup) inflater.inflate(R.layout.fragment_category_screen_slide_page, container, false); break; default: rootView = (ViewGroup) inflater.inflate(R.layout.fragment_screen_slide_page, container, false); } return rootView; }