List of usage examples for android.view ViewGroup findViewById
@Nullable public final <T extends View> T findViewById(@IdRes int id)
From source file:org.ohmage.prompts.SurveyItemFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { ViewGroup view = (ViewGroup) inflater.inflate(R.layout.prompt_basic, container, false); ((TextView) view.findViewById(R.id.text)).setText(getPromptText()); mButtons = view.findViewById(R.id.buttons); skipButton = (TextView) view.findViewById(R.id.skip); okButton = (TextView) view.findViewById(R.id.ok); okButton.setOnClickListener(new OnClickListener() { @Override// w w w. j a v a2 s.c o m public void onClick(View v) { mAnswered = true; onOkPressed(); } }); skipButton.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { mAnswered = true; onSkipPressed(); } }); if (isSkippable()) { skipButton.setVisibility(View.VISIBLE); } else { skipButton.setVisibility(View.GONE); } if (isAnswered()) { mButtons.setVisibility(View.GONE); } else { updateCanContinue(); } onCreatePromptView(inflater, (ViewGroup) view.findViewById(R.id.content), savedInstanceState); // Fade the prompt in if (!isAnswered()) { AlphaAnimation aa = new AlphaAnimation(0f, 1f); aa.setFillAfter(true); aa.setDuration(200); view.startAnimation(aa); } return view; }
From source file:com.woodblockwithoutco.quickcontroldock.ui.view.pager.PagerSwitcher.java
@Override public void onAttachedToWindow() { super.onAttachedToWindow(); if (mControlledPager == null && mPagerId != 0) { ViewParent parent = getParent(); if (parent != null && parent instanceof ViewGroup) { ViewGroup parentView = (ViewGroup) parent; mControlledPager = (ViewPager) parentView.findViewById(mPagerId); if (mControlledPager != null) { OnPageChangeListener l = getPageChangeListener(mControlledPager); if (l == null) { l = new MultiPageChangeListener(); }/*from w ww . j ava 2s . c o m*/ ((MultiPageChangeListener) l).addOnPageChangeListener(this); mControlledPager.setOnPageChangeListener(l); } else { Log.e(TAG, "Can't find given ViewPager!"); } } else { Log.e(TAG, "Can't find given ViewPager!"); } checkIfNeedToHideOrShow(mControlledPager.getCurrentItem()); } }
From source file:io.vit.vitio.StartScreens.DetailFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { ViewGroup rootView = (ViewGroup) inflater.inflate(R.layout.detail_fragment, container, false); displayImage = (ImageView) rootView.findViewById(R.id.detail_image); desHead = (TextView) rootView.findViewById(R.id.des_head); desText = (TextView) rootView.findViewById(R.id.des_text); setFonts();/*from w ww . jav a2 s . c o m*/ //nextButton=(Button)rootView.findViewById(R.id.next_button); /* nextButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { ((FragmentHolder)getActivity()).changePage(FRAGMENTID); } });*/ setData(); Log.d(String.valueOf(FRAGMENTID), "oncreateview"); return rootView; }
From source file:net.kjmaster.cookiemom.action.scout.ActionScoutPickup.java
@Override public void setupInnerViewElements(ViewGroup parent, View view) { super.setupInnerViewElements(parent, view); //To change body of overridden methods use File | Settings | File Templates. final ListView listView = (ListView) parent.findViewById(R.id.action_list); if (listView != null) { listView.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override//from w ww . j a v a 2 s. co m public void onItemClick(AdapterView<?> adapterView, View view, int i, long l) { Scout scout = (Scout) listView.getAdapter().getItem(i); ScoutPickupDialog scoutPickupDialog = new ScoutPickupDialog(); scoutPickupDialog.ScoutPickupDialog(scout, mActivity, mFragment); } }); } }
From source file:cf.obsessiveorange.rhcareerfairlayout.ui.fragments.VPFiltersFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = inflater.inflate(R.layout.fragment_filters, container, false); setHasOptionsMenu(true);// w w w .ja va 2s.c o m recyclerView = (ObservableRecyclerView) view.findViewById(R.id.scroll); recyclerView.setLayoutManager(new LinearLayoutManager(getActivity())); recyclerView.setHasFixedSize(false); recyclerView.addOnItemTouchListener(new RecyclerView.OnItemTouchListener() { @Override public boolean onInterceptTouchEvent(RecyclerView rv, MotionEvent e) { return false; } @Override public void onTouchEvent(RecyclerView rv, MotionEvent e) { } @Override public void onRequestDisallowInterceptTouchEvent(boolean disallowIntercept) { } }); recyclerView.setAdapter(new FiltersCellAdapter(getActivity())); Fragment parentFragment = getParentFragment(); ViewGroup viewGroup = (ViewGroup) parentFragment.getView(); if (viewGroup != null) { recyclerView.setTouchInterceptionViewGroup((ViewGroup) viewGroup.findViewById(R.id.container)); if (parentFragment instanceof ObservableScrollViewCallbacks) { recyclerView.setScrollViewCallbacks((ObservableScrollViewCallbacks) parentFragment); } } return view; }
From source file:net.peterkuterna.android.apps.devoxxfrsched.ui.ScheduleFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { ViewGroup root = (ViewGroup) inflater.inflate(R.layout.fragment_schedule, null); mViewPager = (ViewPager) root.findViewById(R.id.viewpager); mViewPager.setOffscreenPageLimit(4); mViewPager.setPageMargin(getResources().getDimensionPixelSize(R.dimen.viewpager_page_margin)); mViewPager.setPageMarginDrawable(R.drawable.viewpager_margin); mTabs = (SwipeyTabs) root.findViewById(R.id.viewpagerheader); return root;// w w w . ja v a 2 s .c o m }
From source file:com.racoon.ampdroid.views.PlaylistsView.java
@SuppressLint("InflateParams") @Override// w w w . j a va 2 s. co m public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { controller = Controller.getInstance(); ViewGroup root = (ViewGroup) inflater.inflate(R.layout.ampache_playlists, null); ListView listview = (ListView) root.findViewById(R.id.playlists_listview); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) { listview.setFastScrollAlwaysVisible(true); } if (controller.getServer() != null) { ArrayList<String> list = new ArrayList<String>(); for (Playlist p : controller.getPlaylists()) { list.add(p.toString()); } PlaylistArrayAdapter adapter = new PlaylistArrayAdapter(getActivity().getApplicationContext(), list, controller.getPlaylists()); listview.setAdapter(adapter); registerForContextMenu(listview); listview.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView<?> parent, final View view, int position, long id) { Playlist selected = controller.getPlaylists().get(position); String urlString = controller.getServer().getHost() + "/server/xml.server.php?action=playlist_songs&auth=" + controller.getServer().getAuthKey() + "&filter=" + String.valueOf(selected.getId()); Log.d("url", urlString); controller.getSelectedSongs().clear(); controller.parsePlaylistSongs(urlString, controller.getSelectedSongs()); SelectedSongsView newFragment = new SelectedSongsView(); FragmentTransaction transaction = getActivity().getSupportFragmentManager().beginTransaction(); // Replace whatever is in the fragment_container view with this fragment, // and add the transaction to the back stack transaction.replace(R.id.content_frame, newFragment); transaction.addToBackStack(null); ((MainActivity) getActivity()).setActiveFragment(6); // Commit the transaction transaction.commit(); } }); } else { Log.d("bugs", "server null"); } return root; }
From source file:com.tdispatch.passenger.core.TDFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { if (isBusyOverlayPresent()) { ViewGroup baseLayout = (ViewGroup) inflater.inflate(R.layout.tdfragment, container, false); ViewGroup contentContainer = (ViewGroup) baseLayout.findViewById(R.id.tdfragment_content_container); inflater.inflate(getLayoutId(), contentContainer); mFragmentView = baseLayout;// w w w . j a v a2 s . c o m } else { mFragmentView = (ViewGroup) inflater.inflate(getLayoutId(), container, false); } lockUI(false); WebnetTools.setCustomFonts(mApp, (ViewGroup) mFragmentView); onPostCreateView(); return mFragmentView; }
From source file:org.omni.roadrunner.WakelocksFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // Inflate the layout for this fragment ViewGroup root = (ViewGroup) inflater.inflate(R.layout.fragment_wakelocks, container, false); SwipeListView swipeListView = (SwipeListView) root.findViewById(R.id.wakelocks_lv); mAdapter = new WakelocksAdapter(getActivity()); TextView wlCount = (TextView) root.findViewById(R.id.tv_wakelocks_count); wlCount.setText(Integer.toString(mAdapter.getCount())); swipeListView.setAdapter(mAdapter);/*from w ww . j a v a2 s.co m*/ swipeListView.setChoiceMode(SwipeListView.CHOICE_MODE_NONE); swipeListView.setSwipeListViewListener(new BaseSwipeListViewListener() { @Override public void onOpened(int position, boolean toRight) { } @Override public void onClosed(int position, boolean fromRight) { } @Override public void onListChanged() { } @Override public void onMove(int position, float x) { } @Override public void onStartOpen(int position, int action, boolean right) { } @Override public void onStartClose(int position, boolean right) { } @Override public void onClickFrontView(int position) { } @Override public void onClickBackView(int position) { } @Override public void onDismiss(int[] reverseSortedPositions) { for (int position : reverseSortedPositions) { mData.remove(position); } mAdapter.notifyDataSetChanged(); } }); return root; }
From source file:com.racoon.ampdroid.views.ArtistsView.java
@SuppressLint("InflateParams") @Override//from w ww .ja va 2 s .c o m public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { controller = Controller.getInstance(); ViewGroup root = (ViewGroup) inflater.inflate(R.layout.ampache_songs, null); ListView listview = (ListView) root.findViewById(R.id.songs_listview); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) { listview.setFastScrollAlwaysVisible(true); } if (controller.getServer() != null) { ArrayList<String> list = new ArrayList<String>(); for (Artist a : controller.getArtists()) { list.add(a.toString()); } ArtistArrayAdapter adapter = new ArtistArrayAdapter(getActivity().getApplicationContext(), list, controller.getArtists()); listview.setAdapter(adapter); registerForContextMenu(listview); listview.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView<?> parent, final View view, int position, long id) { Artist artist = controller.getArtists().get(position); controller.getSelectedAlbums().clear(); for (Album a : controller.findAlbums(artist)) { controller.getSelectedAlbums().add(a); } // Create new fragment and transaction SelectedAlbumsView newFragment = new SelectedAlbumsView(); // controller.getSelectedSongs().clear(); // for (Song s : controller.findSongs(a)) { // controller.getSelectedSongs().add(s); // } // // Create new fragment and transaction // SelectedSongsView newFragment = new SelectedSongsView(); FragmentTransaction transaction = getActivity().getSupportFragmentManager().beginTransaction(); // Replace whatever is in the fragment_container view with this fragment, // and add the transaction to the back stack transaction.replace(R.id.content_frame, newFragment); transaction.addToBackStack(null); // ((MainActivity) getActivity()).setActiveFragment(6); // Commit the transaction transaction.commit(); } }); } return root; }